echauchot commented on a change in pull request #15725:
URL: https://github.com/apache/flink/pull/15725#discussion_r651021811
##########
File path:
flink-formats/flink-parquet/src/main/java/org/apache/flink/formats/parquet/ParquetInputFormat.java
##########
@@ -168,6 +176,16 @@ public void open(FileInputSplit split) throws IOException {
ParquetReadOptions options = ParquetReadOptions.builder().build();
ParquetFileReader fileReader = new ParquetFileReader(inputFile,
options);
MessageType fileSchema = fileReader.getFileMetaData().getSchema();
+ if (expectedFileSchema == null) { // user did not provide a read
schema, use the file schema
+ if (fieldNames == null) { // user did not provide projected
fields, use all the fields
+ RowTypeInfo rowTypeInfo =
+ (RowTypeInfo)
ParquetSchemaConverter.fromParquetType(fileSchema);
+ fieldNames = rowTypeInfo.getFieldNames();
+ fieldTypes = rowTypeInfo.getFieldTypes();
+ } else { // user provided projected fields, get the corresponding
types from file schema
+ fieldTypes = getFieldTypesFromSchema(fieldNames, fileSchema);
+ }
+ }
Review comment:
yes :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]