Skip to content
Permalink
Browse files
DRILL 1221: Update for changes in Parquet-12 for new converted types.…
… 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 c2e32ac00e850e1ab6bee81e81070dfde4a48d9b
Show file tree
Hide file tree
Showing 14 changed files with 16 additions and 15 deletions.
@@ -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) {
@@ -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));
@@ -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));
@@ -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));
@@ -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));
@@ -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));
@@ -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));
BIN -1.85 KB (39%) sample-data/nation.parquet 100644 → 100755
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN -364 Bytes (56%) sample-data/region.parquet 100644 → 100755
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit c2e32ac

Please sign in to comment.