java.lang.Object
com.gpudb.Type
All Implemented Interfaces:
Immutable collection of metadata about a GPUdb type.
See Also:
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classImmutable collection of metadata about a column that is part of a GPUdb type.Constructor Summary
ConstructorsConstructorDescriptionType(Type.Column… columns) Creates aTypeobject with the specified column metadata and an empty type label.Creates aTypeobject with column metadata from an Avro record schema and an empty type label.Type(String label, Type.Column… columns) Creates aTypeobject with the specified metadata.Creates aTypeobject with metadata in the format returned from the GPUdb /show/table or /show/types endpoints.Type(String label, List<Type.Column> columns) Creates aTypeobject with the specified metadata.Type(List<Type.Column> columns) Creates aTypeobject with the specified column metadata and an empty type label.Method Summary
Modifier and TypeMethodDescriptionCreates a type in GPUdb based on the metadata in theTypeobject and returns the type ID for reference.booleanstatic TypefromDynamicSchema(String schemaString, ByteBuffer encodedData) Creates aTypeobject with the specified dynamic schema metadata and encoded dynamic table data.static TypeCreates aTypeobject containing metadata for the GPUdb type of an existing table in GPUdb.static TypeCreates aTypeobject containing metadata for an existing type in GPUdb.getColumn(int index) Gets the column with the specified index.Gets the column with the specified name.intGets the number of columns.intgetColumnIndex(String name) Gets the index of the column with the specified name.Gets the list of columns that the type comprises.getLabel()Gets the user-defined description string which can be used to differentiate between data with otherwise identical schemas.org.apache.avro.SchemaGets the Avro record schema for the type.inthashCode()Creates a newRecordbased on the type.toString()
Constructor Details
Type
Creates aTypeobject with the specified column metadata and an empty type label.Parameters:columns- the list of columns that the type comprisesThrows:IllegalArgumentException- if no columns are specifiedType
Creates aTypeobject with the specified column metadata and an empty type label.Parameters:columns- the list of columns that the type comprisesThrows:IllegalArgumentException- if no columns are specifiedType
Creates aTypeobject with the specified metadata.Parameters:label- a user-defined description string which can be used to differentiate between data with otherwise identical schemascolumns- the list of columns that the type comprisesThrows:IllegalArgumentException- if no columns are specifiedType
Creates aTypeobject with the specified metadata.Parameters:label- a user-defined description string which can be used to differentiate between data with otherwise identical schemascolumns- the list of columns that the type comprisesThrows:IllegalArgumentException- if no columns are specifiedType
Creates aTypeobject with column metadata from an Avro record schema and an empty type label.Parameters:typeSchema- the Avro record schema for the typeThrows:IllegalArgumentException- iftypeSchemais invalid or contains unsupported field typesType
Creates aTypeobject with metadata in the format returned from the GPUdb /show/table or /show/types endpoints.Parameters:label- a user-defined description string which can be used to differentiate between data with otherwise identical schemastypeSchema- the Avro record schema for the typeproperties- an optional map of column names to lists of properties that apply to those columnsThrows:IllegalArgumentException- iftypeSchemais invalid or contains unsupported field types, or if anypropertiesare invalid
Method Details
fromTable
Creates aTypeobject containing metadata for the GPUdb type of an existing table in GPUdb. Note that this method makes a request to GPUdb to obtain the metadata.Parameters:gpudb- theGPUdbinstance from which to obtain the metadatatableName- the name of the table in GPUdbReturns:the createdTypeobjectThrows:GPUdbException- if the table does not exist or is not homogeneous, or if an error occurs during the request for metadatafromType
Creates aTypeobject containing metadata for an existing type in GPUdb. Note that this method makes a request to GPUdb to obtain the metadata.Parameters:gpudb- theGPUdbinstance from which to obtain the metadatatypeId- the type ID of the type in GPUdbReturns:the createdTypeobjectThrows:GPUdbException- if the type does not exist or if an error occurs during the request for metadatafromDynamicSchema
public static Type fromDynamicSchema(String schemaString, ByteBuffer encodedData) throws GPUdbException Creates aTypeobject with the specified dynamic schema metadata and encoded dynamic table data.Parameters:schemaString- a String object containing the dynamic schemaencodedData- the binary encoded data that contains metadata on the dynamic schemaReturns:the createdTypeobjectThrows:GPUdbException- if an error occurs during the processing of the metadatagetColumns
Gets the list of columns that the type comprises.Returns:the list of columns that the type comprisesgetColumn
Gets the column with the specified index.Parameters:index- the column indexReturns:the column with the specified indexThrows:IndexOutOfBoundsException- if the specified index is out of rangegetColumn
Gets the column with the specified name.Parameters:name- the column nameReturns:the column with the specified name, or null if no such column existsgetSchema
public org.apache.avro.Schema getSchema()Gets the Avro record schema for the type.Returns:the Avro record schema for the typecreate
Creates a type in GPUdb based on the metadata in theTypeobject and returns the type ID for reference. If an identical type already exists in GPUdb, the type ID of the existing type will be returned and no new type will be created.Parameters:gpudb- theGPUdbinstance in which to create the typeReturns:the type ID of the type in GPUdbThrows:GPUdbException- if an error occurs while creating the type