parquet-hadoop/src/main/java/org/apache/parquet/format/converter/ParquetMetadataConverter.java
LogicalTypeAnnotation getLogicalTypeAnnotation(ConvertedType type, SchemaElement schemaElement) {
    switch (type) {
      case UTF8:
        return LogicalTypeAnnotation.stringType();
      case MAP:
        return LogicalTypeAnnotation.mapType();
      case MAP_KEY_VALUE:
        return LogicalTypeAnnotation.MapKeyValueTypeAnnotation.getInstance();
      case LIST:
        return LogicalTypeAnnotation.listType();
      case ENUM:
        return LogicalTypeAnnotation.enumType();
      case DECIMAL:
        int scale = (schemaElement == null ? 0 : schemaElement.scale);
        int precision = (schemaElement == null ? 0 : schemaElement.precision);
        return LogicalTypeAnnotation.decimalType(scale, precision);
      case DATE:
        return LogicalTypeAnnotation.dateType();
      case TIME_MILLIS:
        return LogicalTypeAnnotation.timeType(true, LogicalTypeAnnotation.TimeUnit.MILLIS);
      case TIME_MICROS:
        return LogicalTypeAnnotation.timeType(true, LogicalTypeAnnotation.TimeUnit.MICROS);
      case TIMESTAMP_MILLIS:
        return LogicalTypeAnnotation.timestampType(true, LogicalTypeAnnotation.TimeUnit.MILLIS);
      case TIMESTAMP_MICROS:
        return LogicalTypeAnnotation.timestampType(true, LogicalTypeAnnotation.TimeUnit.MICROS);
      case INTERVAL:
        return LogicalTypeAnnotation.IntervalLogicalTypeAnnotation.getInstance();
      case INT_8:
        return LogicalTypeAnnotation.intType(8, true);
      case INT_16:
        return LogicalTypeAnnotation.intType(16, true);
      case INT_32:
        return LogicalTypeAnnotation.intType(32, true);
      case INT_64:
        return LogicalTypeAnnotation.intType(64, true);
      case UINT_8:
        return LogicalTypeAnnotation.intType(8, false);
      case UINT_16:
        return LogicalTypeAnnotation.intType(16, false);
      case UINT_32:
        return LogicalTypeAnnotation.intType(32, false);
      case UINT_64:
        return LogicalTypeAnnotation.intType(64, false);
      case JSON:
        return LogicalTypeAnnotation.jsonType();
      case BSON:
        return LogicalTypeAnnotation.bsonType();
      default:
        throw new RuntimeException("Can't convert converted type to logical type, unknown converted type " + type);
    }
  }
LogicalTypeAnnotation getLogicalTypeAnnotation(ConvertedType type, SchemaElement schemaElement) {
    switch (type) {
      case UTF8:
        return LogicalTypeAnnotation.stringType();
      case MAP:
        return LogicalTypeAnnotation.mapType();
      case MAP_KEY_VALUE:
        return LogicalTypeAnnotation.MapKeyValueTypeAnnotation.getInstance();
      case LIST:
        return LogicalTypeAnnotation.listType();
      case ENUM:
        return LogicalTypeAnnotation.enumType();
      case DECIMAL:
        int scale = (schemaElement == null ? 0 : schemaElement.scale);
        int precision = (schemaElement == null ? 0 : schemaElement.precision);
        return LogicalTypeAnnotation.decimalType(scale, precision);
      case DATE:
        return LogicalTypeAnnotation.dateType();
      case TIME_MILLIS:
        return LogicalTypeAnnotation.timeType(true, LogicalTypeAnnotation.TimeUnit.MILLIS);
      case TIME_MICROS:
        return LogicalTypeAnnotation.timeType(true, LogicalTypeAnnotation.TimeUnit.MICROS);
      case TIMESTAMP_MILLIS:
        return LogicalTypeAnnotation.timestampType(true, LogicalTypeAnnotation.TimeUnit.MILLIS);
      case TIMESTAMP_MICROS:
        return LogicalTypeAnnotation.timestampType(true, LogicalTypeAnnotation.TimeUnit.MICROS);
      case INTERVAL:
        return LogicalTypeAnnotation.IntervalLogicalTypeAnnotation.getInstance();
      case INT_8:
        return LogicalTypeAnnotation.intType(8, true);
      case INT_16:
        return LogicalTypeAnnotation.intType(16, true);
      case INT_32:
        return LogicalTypeAnnotation.intType(32, true);
      case INT_64:
        return LogicalTypeAnnotation.intType(64, true);
      case UINT_8:
        return LogicalTypeAnnotation.intType(8, false);
      case UINT_16:
        return LogicalTypeAnnotation.intType(16, false);
      case UINT_32:
        return LogicalTypeAnnotation.intType(32, false);
      case UINT_64:
        return LogicalTypeAnnotation.intType(64, false);
      case JSON:
        return LogicalTypeAnnotation.jsonType();
      case BSON:
        return LogicalTypeAnnotation.bsonType();
      default:
        throw new RuntimeException("Can't convert converted type to logical type, unknown converted type " + type);
    }
  }
LogicalTypeAnnotation getLogicalTypeAnnotation ( ConvertedType type , SchemaElement schemaElement ) { switch ( type ) { case UTF8 : return LogicalTypeAnnotation . stringType ( ) ; case MAP : return LogicalTypeAnnotation . mapType ( ) ; case MAP_KEY_VALUE : return LogicalTypeAnnotation . MapKeyValueTypeAnnotation . getInstance ( ) ; case LIST : return LogicalTypeAnnotation . listType ( ) ; case ENUM : return LogicalTypeAnnotation . enumType ( ) ; case DECIMAL : int scale = ( schemaElement == null ? 0 : schemaElement . scale ) ; int precision = ( schemaElement == null ? 0 : schemaElement . precision ) ; return LogicalTypeAnnotation . decimalType ( scale , precision ) ; case DATE : return LogicalTypeAnnotation . dateType ( ) ; case TIME_MILLIS : return LogicalTypeAnnotation . timeType ( true , LogicalTypeAnnotation . TimeUnit . MILLIS ) ; case TIME_MICROS : return LogicalTypeAnnotation . timeType ( true , LogicalTypeAnnotation . TimeUnit . MICROS ) ; case TIMESTAMP_MILLIS : return LogicalTypeAnnotation . timestampType ( true , LogicalTypeAnnotation . TimeUnit . MILLIS ) ; case TIMESTAMP_MICROS : return LogicalTypeAnnotation . timestampType ( true , LogicalTypeAnnotation . TimeUnit . MICROS ) ; case INTERVAL : return LogicalTypeAnnotation . IntervalLogicalTypeAnnotation . getInstance ( ) ; case INT_8 : return LogicalTypeAnnotation . intType ( 8 , true ) ; case INT_16 : return LogicalTypeAnnotation . intType ( 16 , true ) ; case INT_32 : return LogicalTypeAnnotation . intType ( 32 , true ) ; case INT_64 : return LogicalTypeAnnotation . intType ( 64 , true ) ; case UINT_8 : return LogicalTypeAnnotation . intType ( 8 , false ) ; case UINT_16 : return LogicalTypeAnnotation . intType ( 16 , false ) ; case UINT_32 : return LogicalTypeAnnotation . intType ( 32 , false ) ; case UINT_64 : return LogicalTypeAnnotation . intType ( 64 , false ) ; case JSON : return LogicalTypeAnnotation . jsonType ( ) ; case BSON : return LogicalTypeAnnotation . bsonType ( ) ; default : throw new RuntimeException ( "Can't convert converted type to logical type, unknown converted type " + type ) ; } }
Visible for testing
Visible for testing