alexeykudinkin commented on code in PR #6986:
URL: https://github.com/apache/hudi/pull/6986#discussion_r1020536394
##########
hudi-common/src/main/java/org/apache/hudi/common/table/log/HoodieMergedLogRecordScanner.java:
##########
@@ -107,6 +107,33 @@ protected HoodieMergedLogRecordScanner(FileSystem fs,
String basePath, List<Stri
}
}
+ @SuppressWarnings("unchecked")
+ protected HoodieMergedLogRecordScanner(FileSystem fs, String basePath,
List<String> logFilePaths, Schema readerSchema,
Review Comment:
Let's avoid copying the whole ctor. Instead, generalize existing one and
redirect this one to it.
##########
hudi-common/src/main/java/org/apache/hudi/common/table/log/HoodieMergedLogRecordScanner.java:
##########
@@ -233,6 +260,8 @@ public static class Builder extends
AbstractHoodieLogRecordReader.Builder {
// Use scanV2 method.
private boolean useScanV2 = false;
+ private Object[] partitionValues;
Review Comment:
Let's create an object akin to `PartitionPath` we have in Spark
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/LogFileIterator.scala:
##########
@@ -300,6 +296,10 @@ object LogFileIterator {
if (logFiles.nonEmpty) {
logRecordScannerBuilder.withPartition(
getRelativePartitionPath(new Path(tableState.tablePath),
logFiles.head.getPath.getParent))
+
+ if (logFiles.head.isInstanceOf[HoodieLogFileWithPartition]) {
Review Comment:
Please check my comment below
##########
hudi-common/src/main/java/org/apache/hudi/common/model/HoodieLogFileWithPartition.java:
##########
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+
+package org.apache.hudi.common.model;
+
+public class HoodieLogFileWithPartition extends HoodieLogFile {
Review Comment:
Please check my comment below regarding this class
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/MergeOnReadSnapshotRelation.scala:
##########
@@ -213,7 +214,24 @@ class MergeOnReadSnapshotRelation(sqlContext: SQLContext,
PartitionedFile(getPartitionColumnsAsInternalRow(file.getFileStatus),
filePath, 0, file.getFileLen)
}
- HoodieMergeOnReadFileSplit(partitionedBaseFile, logFiles)
+ if (shouldExtractPartitionValuesFromPartitionPath && logFiles.nonEmpty) {
Review Comment:
I don't think we actually need this -- log-files always co-located w/
base-file and as such we can extract partition-values from there
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/MergeOnReadSnapshotRelation.scala:
##########
@@ -213,7 +214,24 @@ class MergeOnReadSnapshotRelation(sqlContext: SQLContext,
PartitionedFile(getPartitionColumnsAsInternalRow(file.getFileStatus),
filePath, 0, file.getFileLen)
Review Comment:
Let's also update `getPartitionColumnsAsInternalRow` to reuse
`parsePartitionColumnValues` instead
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]