vinishjail97 commented on code in PR #772:
URL: https://github.com/apache/incubator-xtable/pull/772#discussion_r3478042257


##########
xtable-core/src/main/java/org/apache/hudi/stats/XTableValueMetadata.java:
##########
@@ -0,0 +1,173 @@
+/*
+ * 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.stats;
+
+import static 
org.apache.xtable.model.schema.InternalSchema.MetadataKey.TIMESTAMP_PRECISION;
+import static 
org.apache.xtable.model.schema.InternalSchema.MetadataValue.MICROS;
+
+import java.lang.reflect.Constructor;
+import java.time.Instant;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+
+import org.apache.hudi.metadata.HoodieIndexVersion;
+
+import org.apache.xtable.model.schema.InternalSchema;
+import org.apache.xtable.model.stat.ColumnStat;
+
+public class XTableValueMetadata {

Review Comment:
   Added — 
`xtable-core/src/test/java/org/apache/hudi/stats/TestXTableValueMetadata.java` 
covers the type mappings (primitives, decimal precision/scale, timestamp 
millis/micros, timestamp-ntz, enum, and unsupported-type handling).
   



##########
xtable-core/src/main/java/org/apache/xtable/hudi/BaseFileUpdatesExtractor.java:
##########
@@ -82,16 +93,50 @@ ReplaceMetadata extractSnapshotChanges(
         HoodieMetadataConfig.newBuilder()
             .enable(metaClient.getTableConfig().isMetadataTableAvailable())
             .build();
-    HoodieTableFileSystemView fsView =
-        new HoodieMetadataFileSystemView(
-            engineContext, metaClient, metaClient.getActiveTimeline(), 
metadataConfig);
+    HoodieTableMetadata tableMetadata =
+        metadataConfig.isEnabled()
+            ? metaClient
+                .getTableFormat()
+                .getMetadataFactory()
+                .create(
+                    engineContext,
+                    metaClient.getStorage(),
+                    metadataConfig,
+                    tableBasePath.toString(),
+                    true)

Review Comment:
   Yes — that last `true` is the `reuse` flag on the metadata-table factory 
`create(...)` (reuse the metadata reader / open file handles across calls). It 
matches the prior behavior (`HoodieTableMetadata.create(..., true)`), so no 
change in semantics.
   



##########
xtable-core/src/main/java/org/apache/xtable/hudi/BaseFileUpdatesExtractor.java:
##########
@@ -167,10 +213,13 @@ ReplaceMetadata extractSnapshotChanges(
    *
    * @param internalFilesDiff the diff to apply to the Hudi table
    * @param commit The current commit started by the Hudi client
+   * @param indexVersion the Hudi index version
    * @return The information needed to create a "replace" commit for the Hudi 
table
    */
   ReplaceMetadata convertDiff(
-      @NonNull InternalFilesDiff internalFilesDiff, @NonNull String commit) {
+      @NonNull InternalFilesDiff internalFilesDiff,
+      @NonNull String commit,
+      HoodieIndexVersion indexVersion) {

Review Comment:
   Agreed — `indexVersion` is always non-null here (it comes from 
`existingIndexVersionOrDefault(...)`), so marking it `@NonNull` like the other 
params is a safe tightening.
   



##########
xtable-core/src/main/java/org/apache/xtable/hudi/HudiConversionSource.java:
##########
@@ -112,7 +115,7 @@ public InternalSnapshot getCurrentSnapshot() {
             pendingInstants.stream()
                 .map(
                     hoodieInstant ->
-                        
HudiInstantUtils.parseFromInstantTime(hoodieInstant.getTimestamp()))
+                        
HudiInstantUtils.parseFromInstantTime(hoodieInstant.requestedTime()))

Review Comment:
   Added — `getCompletedAndPendingCommitsAfterInstant` now has a comment 
explaining that table version 6 uses the old timeline view, so instants are 
selected/ordered by requested (instant) time, with completion-time handling 
deferred to the table-version-9 follow-up.
   



##########
xtable-core/src/main/java/org/apache/xtable/hudi/HudiDataFileExtractor.java:
##########
@@ -85,15 +85,23 @@ public HudiDataFileExtractor(
       HoodieTableMetaClient metaClient,
       PathBasedPartitionValuesExtractor hudiPartitionValuesExtractor,
       HudiFileStatsExtractor hudiFileStatsExtractor) {
-    this.engineContext = new 
HoodieLocalEngineContext(metaClient.getHadoopConf());
+    this.engineContext = new 
HoodieLocalEngineContext(metaClient.getStorageConf());
     metadataConfig =
         HoodieMetadataConfig.newBuilder()
             .enable(metaClient.getTableConfig().isMetadataTableAvailable())
             .build();
-    this.basePath = metaClient.getBasePathV2();
+    this.basePath = 
HadoopFSUtils.convertToHadoopPath(metaClient.getBasePath());
     this.tableMetadata =
-        metadataConfig.enabled()
-            ? HoodieTableMetadata.create(engineContext, metadataConfig, 
basePath.toString(), true)
+        metadataConfig.isEnabled()
+            ? metaClient
+                .getTableFormat()
+                .getMetadataFactory()
+                .create(
+                    engineContext,
+                    metaClient.getStorage(),
+                    metadataConfig,
+                    basePath.toString(),
+                    true)

Review Comment:
   Yes — that last `true` is the `reuse` flag for the metadata-table reader, 
same as before the upgrade (`HoodieTableMetadata.create(..., true)`). Reuse 
keeps the metadata reader / file handles open across calls; no side effects 
beyond the prior behavior.
   



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

Reply via email to