Search in sources :

Example 6 with AvaticaType

use of org.apache.calcite.avatica.ColumnMetaData.AvaticaType in project drill by apache.

the class DrillColumnMetaDataList method updateColumnMetaData.

/**
   * Update the metadata with given metadata received from server.
   * @param metadata
   */
public void updateColumnMetaData(List<ResultColumnMetadata> metadata) {
    final List<ColumnMetaData> newColumns = new ArrayList<>(metadata.size());
    int offset = 0;
    for (ResultColumnMetadata m : metadata) {
        final AvaticaType bundledSqlDataType = getAvaticaType(m.getDataType());
        newColumns.add(new ColumnMetaData(offset, m.getAutoIncrement(), m.getCaseSensitivity(), m.getSearchability() != ColumnSearchability.NONE, m.getIsCurrency(), m.getIsNullable() ? ResultSetMetaData.columnNullable : ResultSetMetaData.columnNoNulls, m.getSigned(), m.getDisplaySize(), m.getLabel(), m.getColumnName(), m.getSchemaName(), m.getPrecision(), m.getScale(), m.getTableName(), m.getCatalogName(), bundledSqlDataType, m.getUpdatability() == ColumnUpdatability.READ_ONLY, m.getUpdatability() == ColumnUpdatability.WRITABLE, m.getUpdatability() == ColumnUpdatability.WRITABLE, m.getClassName()));
        offset++;
    }
    columns = ImmutableList.copyOf(newColumns);
}
Also used : ResultColumnMetadata(org.apache.drill.exec.proto.UserProtos.ResultColumnMetadata) AvaticaType(org.apache.calcite.avatica.ColumnMetaData.AvaticaType) ArrayList(java.util.ArrayList) ColumnMetaData(org.apache.calcite.avatica.ColumnMetaData)

Aggregations

AvaticaType (org.apache.calcite.avatica.ColumnMetaData.AvaticaType)6 ArrayList (java.util.ArrayList)4 ColumnMetaData (org.apache.calcite.avatica.ColumnMetaData)3 Array (java.sql.Array)2 List (java.util.List)2 ArrayFactoryImpl (org.apache.calcite.avatica.util.ArrayFactoryImpl)2 Connection (java.sql.Connection)1 ResultSetMetaData (java.sql.ResultSetMetaData)1 SQLException (java.sql.SQLException)1 Time (java.sql.Time)1 Timestamp (java.sql.Timestamp)1 Date (java.util.Date)1 HashSet (java.util.HashSet)1 ArrayType (org.apache.calcite.avatica.ColumnMetaData.ArrayType)1 SqlType (org.apache.calcite.avatica.SqlType)1 ByteString (org.apache.calcite.avatica.util.ByteString)1 MajorType (org.apache.drill.common.types.TypeProtos.MajorType)1 ResultColumnMetadata (org.apache.drill.exec.proto.UserProtos.ResultColumnMetadata)1 MaterializedField (org.apache.drill.exec.record.MaterializedField)1 Test (org.junit.Test)1