protected List<HiveColumnHandle> getColumnHandles(List<TestColumn> testColumns) {
    List<HiveColumnHandle> columns = new ArrayList<>();
    int nextHiveColumnIndex = 0;
    for (int i = 0; i < testColumns.size(); i++) {
      TestColumn testColumn = testColumns.get(i);
      int columnIndex = testColumn.isPartitionKey() ? -1 : nextHiveColumnIndex++;

      ObjectInspector inspector = testColumn.getObjectInspector();
      HiveType hiveType = HiveType.getHiveType(inspector);
      Type type = getType(inspector, TYPE_MANAGER);

      columns.add(
          new HiveColumnHandle(
              "client_id",
              testColumn.getName(),
              i,
              hiveType,
              type.getTypeSignature(),
              columnIndex,
              testColumn.isPartitionKey()));
    }
    return columns;
  }
Beispiel #2
0
 private static Column fromMetastoreApiFieldSchema(FieldSchema fieldSchema) {
   return new Column(
       fieldSchema.getName(),
       HiveType.valueOf(fieldSchema.getType()),
       Optional.ofNullable(emptyToNull(fieldSchema.getComment())));
 }