Skip to content

Commit

Permalink
DRILL 1221: Update for changes in Parquet-12 for new converted types.…
Browse files Browse the repository at this point in the history
… Also converted existing binary files in the test-data directory.
  • Loading branch information
jaltekruse authored and jacques-n committed Jul 29, 2014
1 parent 5bae9c8 commit c2e32ac
Show file tree
Hide file tree
Showing 14 changed files with 16 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ public class ParquetTypeHelper {
</#list>
originalTypeMap.put(MinorType.VARCHAR, OriginalType.UTF8);
originalTypeMap.put(MinorType.DATE, OriginalType.DATE);
originalTypeMap.put(MinorType.TIME, OriginalType.TIME);
originalTypeMap.put(MinorType.TIMESTAMP, OriginalType.TIMESTAMP);
originalTypeMap.put(MinorType.TIMESTAMPTZ, OriginalType.TIMESTAMPTZ);
originalTypeMap.put(MinorType.TIME, OriginalType.TIME_MILLIS);
originalTypeMap.put(MinorType.TIMESTAMP, OriginalType.TIMESTAMP_MILLIS);
// originalTypeMap.put(MinorType.TIMESTAMPTZ, OriginalType.TIMESTAMPTZ);
}

public static PrimitiveTypeName getPrimitiveTypeNameForMinorType(MinorType minorType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ public static TypeProtos.MajorType toMajorType(PrimitiveType.PrimitiveTypeName p
switch(convertedType) {
case DECIMAL:
return Types.withScaleAndPrecision(TypeProtos.MinorType.DECIMAL18, DataMode.OPTIONAL, schemaElement.getScale(), schemaElement.getPrecision());
case FINETIME:
throw new UnsupportedOperationException();
case TIMESTAMP:
// TODO - add this back if it is decided to be added upstream, was removed form our pull request July 2014
// case TIME_MICROS:
// throw new UnsupportedOperationException();
case TIMESTAMP_MILLIS:
return Types.optional(MinorType.TIMESTAMP);
default:
throw new UnsupportedOperationException(String.format("unsupported type: %s %s", primitiveTypeName, convertedType));
Expand All @@ -75,7 +76,7 @@ public static TypeProtos.MajorType toMajorType(PrimitiveType.PrimitiveTypeName p
return Types.withScaleAndPrecision(MinorType.DECIMAL9, DataMode.OPTIONAL, schemaElement.getScale(), schemaElement.getPrecision());
case DATE:
return Types.optional(MinorType.DATE);
case TIME:
case TIME_MILLIS:
return Types.optional(MinorType.TIME);
default:
throw new UnsupportedOperationException(String.format("unsupported type: %s %s", primitiveTypeName, convertedType));
Expand Down Expand Up @@ -123,9 +124,9 @@ public static TypeProtos.MajorType toMajorType(PrimitiveType.PrimitiveTypeName p
switch(convertedType) {
case DECIMAL:
return Types.withScaleAndPrecision(MinorType.DECIMAL18, DataMode.REQUIRED, schemaElement.getScale(), schemaElement.getPrecision());
case FINETIME:
throw new UnsupportedOperationException();
case TIMESTAMP:
// case FINETIME:
// throw new UnsupportedOperationException();
case TIMESTAMP_MILLIS:
return Types.required(MinorType.TIMESTAMP);
default:
throw new UnsupportedOperationException(String.format("unsupported type: %s %s", primitiveTypeName, convertedType));
Expand All @@ -139,7 +140,7 @@ public static TypeProtos.MajorType toMajorType(PrimitiveType.PrimitiveTypeName p
return Types.withScaleAndPrecision(MinorType.DECIMAL9, DataMode.REQUIRED, schemaElement.getScale(), schemaElement.getPrecision());
case DATE:
return Types.required(MinorType.DATE);
case TIME:
case TIME_MILLIS:
return Types.required(MinorType.TIME);
default:
throw new UnsupportedOperationException(String.format("unsupported type: %s %s", primitiveTypeName, convertedType));
Expand Down Expand Up @@ -187,9 +188,9 @@ public static TypeProtos.MajorType toMajorType(PrimitiveType.PrimitiveTypeName p
switch(convertedType) {
case DECIMAL:
return Types.withScaleAndPrecision(MinorType.DECIMAL18, DataMode.REPEATED, schemaElement.getScale(), schemaElement.getPrecision());
case FINETIME:
throw new UnsupportedOperationException();
case TIMESTAMP:
// case FINETIME:
// throw new UnsupportedOperationException();
case TIMESTAMP_MILLIS:
return Types.repeated(MinorType.TIMESTAMP);
default:
throw new UnsupportedOperationException(String.format("unsupported type: %s %s", primitiveTypeName, convertedType));
Expand All @@ -203,7 +204,7 @@ public static TypeProtos.MajorType toMajorType(PrimitiveType.PrimitiveTypeName p
return Types.withScaleAndPrecision(MinorType.DECIMAL9, DataMode.REPEATED, schemaElement.getScale(), schemaElement.getPrecision());
case DATE:
return Types.repeated(MinorType.DATE);
case TIME:
case TIME_MILLIS:
return Types.repeated(MinorType.TIME);
default:
throw new UnsupportedOperationException(String.format("unsupported type: %s %s", primitiveTypeName, convertedType));
Expand Down
Binary file modified sample-data/nation.parquet
100644 → 100755
Binary file not shown.
Binary file removed sample-data/nationsMF/nation.parquet
Binary file not shown.
Binary file removed sample-data/nationsMF/nation2.parquet
Binary file not shown.
Binary file added sample-data/nationsMF/nationsMF.parquet
Binary file not shown.
Binary file removed sample-data/nationsSF/nation.parquet
Binary file not shown.
Binary file added sample-data/nationsSF/nationsSF.parquet
Binary file not shown.
Binary file modified sample-data/region.parquet
100644 → 100755
Binary file not shown.
Binary file removed sample-data/regionsMF/region.parquet
Binary file not shown.
Binary file removed sample-data/regionsMF/region2.parquet
Binary file not shown.
Binary file added sample-data/regionsMF/regionsMF_Typed.parquet
Binary file not shown.
Binary file removed sample-data/regionsSF/region.parquet
Binary file not shown.
Binary file added sample-data/regionsSF/regionsSF.parquet
Binary file not shown.

0 comments on commit c2e32ac

Please sign in to comment.