private InternalTable buildColumns(
     Session session, String catalogName, Map<String, SerializableNativeValue> filters) {
   InternalTable.Builder table =
       InternalTable.builder(informationSchemaTableColumns(TABLE_COLUMNS));
   for (Entry<QualifiedTableName, List<ColumnMetadata>> entry :
       getColumnsList(session, catalogName, filters).entrySet()) {
     QualifiedTableName tableName = entry.getKey();
     int ordinalPosition = 1;
     for (ColumnMetadata column : entry.getValue()) {
       if (column.isHidden()) {
         continue;
       }
       table.add(
           tableName.getCatalogName(),
           tableName.getSchemaName(),
           tableName.getTableName(),
           column.getName(),
           ordinalPosition,
           null,
           "YES",
           column.getType().getDisplayName(),
           column.isPartitionKey() ? "YES" : "NO",
           column.getComment());
       ordinalPosition++;
     }
   }
   return table.build();
 }
Exemplo n.º 2
0
 private static void assertPrimitiveField(
     Map<String, ColumnMetadata> map, int position, String name, Type type, boolean partitionKey) {
   assertTrue(map.containsKey(name));
   ColumnMetadata column = map.get(name);
   assertEquals(column.getOrdinalPosition(), position);
   assertEquals(column.getType(), type, name);
   assertEquals(column.isPartitionKey(), partitionKey, name);
 }