Class DataSchema


  • public class DataSchema
    extends Object
    The DataSchema class describes the schema of DataTable.
    • 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.
    • Method Detail

      • size

        public int size()
      • getColumnName

        public String getColumnName​(int index)
      • getColumnNames

        public String[] getColumnNames()
      • 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 LONG can cover INT and LONG.

        Data type DOUBLE can cover all numbers, but with potential precision loss when use it to cover LONG.

        NOTE: The given data schema should be type compatible with this one.

        Parameters:
        originalSchema - the original Data schema
        anotherDataSchema - Data schema to cover
      • 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
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object