Package org.apache.pinot.common.utils
Class SchemaUtils
- java.lang.Object
-
- org.apache.pinot.common.utils.SchemaUtils
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleandeleteSchema(String host, int port, String schemaName)Given host, port and schema name, send a http DELETE request to delete theSchema.static booleanequalsIgnoreVersion(Schema schema1, Schema schema2)Compare two schemas ignoring their version number.static SchemafromZNRecord(org.apache.helix.ZNRecord record)FetchSchemafrom aZNRecord.static SchemagetSchema(String host, int port, String schemaName)Given host, port and schema name, send a http GET request to download theSchema.static voidmain(String[] args)An example on how to use this utility class.static booleanpostSchema(String host, int port, Schema schema)Given host, port and schema, send a http POST request to upload theSchema.static org.apache.helix.ZNRecordtoZNRecord(Schema schema)WrapSchemainto aZNRecord.
-
-
-
Method Detail
-
fromZNRecord
public static Schema fromZNRecord(@Nonnull org.apache.helix.ZNRecord record) throws IOException
FetchSchemafrom aZNRecord.- Throws:
IOException
-
toZNRecord
public static org.apache.helix.ZNRecord toZNRecord(@Nonnull Schema schema)WrapSchemainto aZNRecord.
-
getSchema
@Nullable public static Schema getSchema(@Nonnull String host, int port, @Nonnull String schemaName)
Given host, port and schema name, send a http GET request to download theSchema.- Returns:
- schema on success.
nullon failure.
-
postSchema
public static boolean postSchema(@Nonnull String host, int port, @Nonnull Schema schema)Given host, port and schema, send a http POST request to upload theSchema.- Returns:
trueon success.falseon failure.
-
deleteSchema
public static boolean deleteSchema(@Nonnull String host, int port, @Nonnull String schemaName)Given host, port and schema name, send a http DELETE request to delete theSchema.- Returns:
trueon success.falseon failure.
-
equalsIgnoreVersion
public static boolean equalsIgnoreVersion(@Nonnull Schema schema1, @Nonnull Schema schema2)Compare two schemas ignoring their version number.- Returns:
trueif two schemas equal to each other.falseif two schemas do not equal to each other.
-
main
public static void main(String[] args)
An example on how to use this utility class.
-
-