leaves12138 commented on code in PR #7917:
URL: https://github.com/apache/paimon/pull/7917#discussion_r3274635895


##########
paimon-mosaic/pom.xml:
##########
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <artifactId>paimon-parent</artifactId>
+        <groupId>org.apache.paimon</groupId>
+        <version>1.5-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>paimon-mosaic</artifactId>
+    <name>Paimon : Mosaic Format</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.paimon</groupId>
+            <artifactId>mosaic</artifactId>
+            <version>0.1.0-SNAPSHOT</version>

Review Comment:
   This still makes the default Paimon reactor depend on an external SNAPSHOT 
artifact. Since `paimon-mosaic` is listed in the root `<modules>`, a clean `mvn 
-pl paimon-mosaic -am ... compile` fails with `Could not find artifact 
org.apache.paimon:mosaic:jar:0.1.0-SNAPSHOT`. Please use a released artifact, 
build/include this dependency in the same releaseable reactor, or keep this 
module out of the default root reactor/profile-gated until the Mosaic Java 
artifact is released.



##########
paimon-mosaic/src/main/java/org/apache/paimon/format/mosaic/MosaicSimpleStatsExtractor.java:
##########
@@ -0,0 +1,169 @@
+/*
+ * 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.paimon.format.mosaic;
+
+import org.apache.paimon.format.SimpleColStats;
+import org.apache.paimon.format.SimpleStatsExtractor;
+import org.apache.paimon.fs.FileIO;
+import org.apache.paimon.fs.Path;
+import org.apache.paimon.mosaic.ColumnStatistics;
+import org.apache.paimon.mosaic.MosaicReader;
+import org.apache.paimon.statistics.SimpleColStatsCollector;
+import org.apache.paimon.types.DataType;
+import org.apache.paimon.types.RowType;
+import org.apache.paimon.utils.Pair;
+
+import org.apache.arrow.memory.BufferAllocator;
+import org.apache.arrow.memory.RootAllocator;
+
+import javax.annotation.Nullable;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import static org.apache.paimon.format.mosaic.MosaicObjects.convertStatsValue;
+
+/** Extracts statistics from Mosaic file metadata. */
+public class MosaicSimpleStatsExtractor implements SimpleStatsExtractor {
+
+    private final RowType rowType;
+    private final SimpleColStatsCollector.Factory[] statsCollectors;
+
+    public MosaicSimpleStatsExtractor(
+            RowType rowType, SimpleColStatsCollector.Factory[] 
statsCollectors) {
+        this.rowType = rowType;
+        this.statsCollectors = statsCollectors;
+    }
+
+    @Override
+    public SimpleColStats[] extract(FileIO fileIO, Path path, long length) {
+        MosaicInputFileAdapter inputFile = new MosaicInputFileAdapter(fileIO, 
path);
+        try (BufferAllocator allocator = new RootAllocator();
+                MosaicReader reader = MosaicReader.open(inputFile, length, 
allocator)) {
+            return extractFromStats(reader.numRowGroups(), 
reader::getRowGroupStatistics, null);

Review Comment:
   The file-only extraction path loses the configured stats-column set. For a 
file written with only a subset of `mosaic.stats-columns` (or the default empty 
set), columns missing from Mosaic's `ColumnStatistics` keep `nullCounts[colIdx] 
== 0`, so untracked columns are returned as `SimpleColStats(null, null, 0)` 
instead of `SimpleColStats.NONE`. That can persist an exact zero-null count on 
fallback/migration paths. Please track which columns actually appear in the 
Mosaic stats and return `NONE` for unseen columns, or persist/recover the 
collected stats-column set from the file metadata. The same issue applies to 
`extractWithFileInfo`.



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