Package org.apache.pinot.common.utils
Class DataSchema
- java.lang.Object
-
- org.apache.pinot.common.utils.DataSchema
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDataSchema.ColumnDataType
-
Field Summary
Fields Modifier and Type Field Description static DataSchemaEXPLAIN_RESULT_SCHEMAUsed by both Broker and Server to generate results for EXPLAIN PLAN queries.
-
Constructor Summary
Constructors Constructor Description DataSchema(String[] columnNames, DataSchema.ColumnDataType[] columnDataTypes)
-
Method Summary
Modifier and Type Method Description DataSchemaclone()booleanequals(Object anObject)static DataSchemafromBytes(ByteBuffer buffer)This method use relative operations on the ByteBuffer and expects the buffer's position to be set correctly.DataSchema.ColumnDataTypegetColumnDataType(int index)DataSchema.ColumnDataType[]getColumnDataTypes()StringgetColumnName(int index)String[]getColumnNames()DataSchema.ColumnDataType[]getStoredColumnDataTypes()Lazy compute the _storeColumnDataTypes field.inthashCode()booleanisTypeCompatibleWith(DataSchema anotherDataSchema)Returns whether the given data schema is type compatible with this one.intsize()byte[]toBytes()StringtoString()static DataSchemaupgradeToCover(DataSchema originalSchema, DataSchema anotherDataSchema)Upgrade the current data schema to cover the column data types in the given data schema.
-
-
-
Field Detail
-
EXPLAIN_RESULT_SCHEMA
public static final DataSchema EXPLAIN_RESULT_SCHEMA
Used by both Broker and Server to generate results for EXPLAIN PLAN queries.
-
-
Constructor Detail
-
DataSchema
public DataSchema(String[] columnNames, DataSchema.ColumnDataType[] columnDataTypes)
-
-
Method Detail
-
size
public int size()
-
getColumnName
public String getColumnName(int index)
-
getColumnNames
public String[] getColumnNames()
-
getColumnDataType
public DataSchema.ColumnDataType getColumnDataType(int index)
-
getColumnDataTypes
public DataSchema.ColumnDataType[] getColumnDataTypes()
-
getStoredColumnDataTypes
public DataSchema.ColumnDataType[] getStoredColumnDataTypes()
Lazy compute the _storeColumnDataTypes field.
-
isTypeCompatibleWith
public boolean isTypeCompatibleWith(DataSchema anotherDataSchema)
Returns whether the given data schema is type compatible with this one.- All numbers are type compatible with each other
- Numbers are not type compatible with string
- Non-array types are not type compatible with array types
- Parameters:
anotherDataSchema- Data schema to compare with- Returns:
- Whether the two data schemas are type compatible
-
upgradeToCover
public static DataSchema upgradeToCover(DataSchema originalSchema, DataSchema anotherDataSchema)
Upgrade the current data schema to cover the column data types in the given data schema.Data type
LONGcan coverINTandLONG.Data type
DOUBLEcan cover all numbers, but with potential precision loss when use it to coverLONG.NOTE: The given data schema should be type compatible with this one.
- Parameters:
originalSchema- the original Data schemaanotherDataSchema- Data schema to cover
-
toBytes
public byte[] toBytes() throws IOException- Throws:
IOException
-
fromBytes
public static DataSchema fromBytes(ByteBuffer buffer) throws IOException
This method use relative operations on the ByteBuffer and expects the buffer's position to be set correctly.- Throws:
IOException
-
clone
public DataSchema clone()
-
-