private void testRoundTrip(HiveColumnHandle expected) {
    String json = codec.toJson(expected);
    HiveColumnHandle actual = codec.fromJson(json);

    assertEquals(actual.getClientId(), expected.getClientId());
    assertEquals(actual.getName(), expected.getName());
    assertEquals(actual.getHiveType(), expected.getHiveType());
    assertEquals(actual.getHiveColumnIndex(), expected.getHiveColumnIndex());
    assertEquals(actual.isPartitionKey(), expected.isPartitionKey());
  }
Ejemplo n.º 2
0
    private parquet.schema.Type getParquetType(HiveColumnHandle column, MessageType messageType) {
      if (useParquetColumnNames) {
        if (messageType.containsField(column.getName())) {
          return messageType.getType(column.getName());
        }
        return null;
      }

      if (column.getHiveColumnIndex() < messageType.getFieldCount()) {
        return messageType.getType(column.getHiveColumnIndex());
      }
      return null;
    }