Пример #1
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;
    }
Пример #2
0
  public static parquet.schema.Type getParquetType(
      HiveColumnHandle column, MessageType messageType, boolean useParquetColumnNames) {
    if (useParquetColumnNames) {
      return getParquetTypeByName(column.getName(), messageType);
    }

    if (column.getHiveColumnIndex() < messageType.getFieldCount()) {
      return messageType.getType(column.getHiveColumnIndex());
    }
    return null;
  }
Пример #3
0
  private static parquet.schema.Type getParquetTypeByName(
      String columnName, MessageType messageType) {
    if (messageType.containsField(columnName)) {
      return messageType.getType(columnName);
    }
    // parquet is case-sensitive, but hive is not. all hive columns get converted to lowercase
    // check for direct match above but if no match found, try case-insensitive match
    for (Type type : messageType.getFields()) {
      if (type.getName().equalsIgnoreCase(columnName)) {
        return type;
      }
    }

    return null;
  }