Java Code Examples for org.apache.parquet.hadoop.metadata.ColumnPath#fromDotString()
The following examples show how to use
org.apache.parquet.hadoop.metadata.ColumnPath#fromDotString() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ParquetTableSource.java From flink with Apache License 2.0 | 4 votes |
@Nullable private Tuple2<Column, Comparable> extractColumnAndLiteral(BinaryComparison comp) { String columnName = getColumnName(comp); ColumnPath columnPath = ColumnPath.fromDotString(columnName); TypeInformation<?> typeInfo = null; try { Type type = parquetSchema.getType(columnPath.toArray()); typeInfo = ParquetSchemaConverter.convertParquetTypeToTypeInfo(type); } catch (InvalidRecordException e) { LOG.error("Pushed predicate on undefined field name {} in schema", columnName); return null; } // fetch literal and ensure it is comparable Object value = getLiteral(comp); // validate that literal is comparable if (!(value instanceof Comparable)) { LOG.warn("Encountered a non-comparable literal of type {}." + "Cannot push predicate [{}] into ParquetTablesource." + "This is a bug and should be reported.", value.getClass().getCanonicalName(), comp); return null; } if (typeInfo == BasicTypeInfo.BYTE_TYPE_INFO || typeInfo == BasicTypeInfo.SHORT_TYPE_INFO || typeInfo == BasicTypeInfo.INT_TYPE_INFO) { return new Tuple2<>(FilterApi.intColumn(columnName), ((Number) value).intValue()); } else if (typeInfo == BasicTypeInfo.LONG_TYPE_INFO) { return new Tuple2<>(FilterApi.longColumn(columnName), ((Number) value).longValue()); } else if (typeInfo == BasicTypeInfo.FLOAT_TYPE_INFO) { return new Tuple2<>(FilterApi.floatColumn(columnName), ((Number) value).floatValue()); } else if (typeInfo == BasicTypeInfo.BOOLEAN_TYPE_INFO) { return new Tuple2<>(FilterApi.booleanColumn(columnName), (Boolean) value); } else if (typeInfo == BasicTypeInfo.DOUBLE_TYPE_INFO) { return new Tuple2<>(FilterApi.doubleColumn(columnName), ((Number) value).doubleValue()); } else if (typeInfo == BasicTypeInfo.STRING_TYPE_INFO) { return new Tuple2<>(FilterApi.binaryColumn(columnName), Binary.fromString((String) value)); } else { // unsupported type return null; } }
Example 2
Source File: FilterApi.java From parquet-mr with Apache License 2.0 | 4 votes |
public static IntColumn intColumn(String columnPath) { return new IntColumn(ColumnPath.fromDotString(columnPath)); }
Example 3
Source File: FilterApi.java From parquet-mr with Apache License 2.0 | 4 votes |
public static LongColumn longColumn(String columnPath) { return new LongColumn(ColumnPath.fromDotString(columnPath)); }
Example 4
Source File: FilterApi.java From parquet-mr with Apache License 2.0 | 4 votes |
public static FloatColumn floatColumn(String columnPath) { return new FloatColumn(ColumnPath.fromDotString(columnPath)); }
Example 5
Source File: FilterApi.java From parquet-mr with Apache License 2.0 | 4 votes |
public static DoubleColumn doubleColumn(String columnPath) { return new DoubleColumn(ColumnPath.fromDotString(columnPath)); }
Example 6
Source File: FilterApi.java From parquet-mr with Apache License 2.0 | 4 votes |
public static BooleanColumn booleanColumn(String columnPath) { return new BooleanColumn(ColumnPath.fromDotString(columnPath)); }
Example 7
Source File: FilterApi.java From parquet-mr with Apache License 2.0 | 4 votes |
public static BinaryColumn binaryColumn(String columnPath) { return new BinaryColumn(ColumnPath.fromDotString(columnPath)); }