aromanenko-dev commented on a change in pull request #14229:
URL: https://github.com/apache/beam/pull/14229#discussion_r594269053



##########
File path: sdks/java/io/parquet/src/test/resources/log4j-test.properties
##########
@@ -0,0 +1,39 @@
+################################################################################
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+# limitations under the License.
+################################################################################
+
+# Set root logger level to ERROR.
+# set manually to INFO for debugging purposes.
+log4j.rootLogger=ERROR, testlogger
+
+# ConsoleAppender.
+log4j.appender.testlogger=org.apache.log4j.ConsoleAppender
+log4j.appender.testlogger.target = System.err
+log4j.appender.testlogger.layout=org.apache.log4j.PatternLayout
+log4j.appender.testlogger.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n
+
+# Beam SDK logging
+log4j.logger.org.apache.beam=INFO
+#log4j.logger.org.apache.beam.sdk.options.PipelineOptionsFactory=INFO
+#log4j.logger.org.apache.beam.sdk.runners.TransformHierarchy=INFO
+#log4j.logger.org.apache.beam.sdk.util.WindowTracing=INFO
+log4j.logger.org.apache.beam.sdk.io.LocalFileSystem=DEBUG

Review comment:
       I guess that log level was temporary changed and it should be back to 
INFO?

##########
File path: 
sdks/java/io/parquet/src/main/java/org/apache/beam/sdk/io/parquet/ParquetIO.java
##########
@@ -1012,14 +1016,15 @@ public void processElement(ProcessContext 
processContext) throws Exception {
         try (ParquetReader<GenericRecord> reader = builder.build()) {
           GenericRecord read;
           while ((read = reader.read()) != null) {
-            processContext.output(parseFn.apply(read));
+            receiver.output(parseFn.apply(read));

Review comment:
       What is a reason of using this instead of `ProcessContext`?

##########
File path: 
sdks/java/io/parquet/src/main/java/org/apache/beam/sdk/io/parquet/ParquetIO.java
##########
@@ -762,83 +762,86 @@ public void processElement(
               conf, new Schema.Parser().parse(requestSchemaString));
         }
         ParquetReadOptions options = HadoopReadOptions.builder(conf).build();
-        ParquetFileReader reader =
-            ParquetFileReader.open(new 
BeamParquetInputFile(file.openSeekable()), options);
-        Filter filter = checkNotNull(options.getRecordFilter(), "filter");
-        Configuration hadoopConf = ((HadoopReadOptions) options).getConf();
-        FileMetaData parquetFileMetadata = 
reader.getFooter().getFileMetaData();
-        MessageType fileSchema = parquetFileMetadata.getSchema();
-        Map<String, String> fileMetadata = 
parquetFileMetadata.getKeyValueMetaData();
-        ReadSupport.ReadContext readContext =
-            readSupport.init(
-                new InitContext(
-                    hadoopConf, Maps.transformValues(fileMetadata, 
ImmutableSet::of), fileSchema));
-        ColumnIOFactory columnIOFactory = new 
ColumnIOFactory(parquetFileMetadata.getCreatedBy());
-
-        RecordMaterializer<GenericRecord> recordConverter =
-            readSupport.prepareForRead(hadoopConf, fileMetadata, fileSchema, 
readContext);
-        reader.setRequestedSchema(readContext.getRequestedSchema());
-        MessageColumnIO columnIO =
-            columnIOFactory.getColumnIO(readContext.getRequestedSchema(), 
fileSchema, true);
-        long currentBlock = tracker.currentRestriction().getFrom();
-        for (int i = 0; i < currentBlock; i++) {
-          reader.skipNextRowGroup();
-        }
-        while (tracker.tryClaim(currentBlock)) {
-          PageReadStore pages = reader.readNextRowGroup();
-          LOG.debug("block {} read in memory. row count = {}", currentBlock, 
pages.getRowCount());
-          currentBlock += 1;
-          RecordReader<GenericRecord> recordReader =
-              columnIO.getRecordReader(
-                  pages, recordConverter, options.useRecordFilter() ? filter : 
FilterCompat.NOOP);
-          long currentRow = 0;
-          long totalRows = pages.getRowCount();
-          while (currentRow < totalRows) {
-            try {
-              GenericRecord record;
-              currentRow += 1;
+        try (ParquetFileReader reader =

Review comment:
       Is it only `try-with-resources` change or something else?




----------------------------------------------------------------
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]


Reply via email to