comphead commented on code in PR #7575:
URL: https://github.com/apache/datafusion-comet/pull/7575#discussion_r4778317247


##########
native/core/Cargo.toml:
##########
@@ -79,18 +79,18 @@ aws-credential-types = { workspace = true }
 aws-sdk-sts = { workspace = true }
 # Only for the `SharedHttpClient` type in `build_provider`'s test seam; 
already in the graph.
 aws-smithy-runtime-api = "1.16.0"
-parking_lot = "0.12.5"
+parking_lot = "0.13.0"
 # Optional Delta Lake contrib (enabled by the `contrib-delta` feature). Source 
lives
 # under `contrib/delta/native/` so non-Delta committers can ignore it.
 comet-contrib-delta = { path = "../../contrib/delta/native", optional = true }
 # Optional Lance contrib. The native scan implementation lives outside core.
 comet-contrib-lance = { path = "../../contrib/lance/native", optional = true }
 reqwest = { version = "0.12", default-features = false, features = 
["rustls-tls-native-roots", "http2"] }
-object_store_opendal = { version = "0.58.0", optional = true }
+object_store_opendal = { version = "0.60.5", optional = true }
 hdfs-sys = {version = "0.3.1", optional = true, features = ["hdfs_3_3"]}
 # Not optional: the location-scoped Iceberg storage recognizes opendal's 
permission errors, and
 # iceberg-storage-opendal builds the crate anyway. `hdfs-opendal` adds its 
HDFS service.
-opendal = { version = "0.58.1" }
+opendal = { version = "0.59.5" }

Review Comment:
   The coupling the description explains belongs in this comment too. 
`iceberg_location_scoped.rs` matches permission errors with 
`downcast_ref::<opendal::Error>()`, which matches only errors from the opendal 
version that `iceberg-storage-opendal` uses. Its tests build `opendal::Error` 
from this crate's own opendal, so a version skew would still build and pass 
while denied reads stop being recognized. Something like "Keep this on the 
opendal version that iceberg-storage-opendal uses" would stop the next pin bump 
from splitting them.



##########
spark/src/test/spark-4.x/org/apache/comet/serde/operator/CometIcebergNativeScanVariantSuite.scala:
##########
@@ -0,0 +1,43 @@
+/*
+ * 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.comet.serde.operator
+
+import org.scalatest.funsuite.AnyFunSuite
+import org.scalatest.matchers.should.Matchers
+
+import org.apache.iceberg.expressions.Expressions
+import org.apache.spark.sql.catalyst.expressions.AttributeReference
+import org.apache.spark.sql.types.VariantType
+
+class CometIcebergNativeScanVariantSuite extends AnyFunSuite with Matchers {
+

Review Comment:
   This suite is not listed in `.github/workflows/pr_build_linux.yml` or 
`pr_build_macos.yml`. `dev/ci/check-suites.py` exits with `Suite not found in 
workflow` for it, which I think is the Preflight failure, and Preflight gates 
every build job, so none of the new tests have run in CI. Adding it next to 
`org.apache.comet.serde.operator.CometIcebergNativeScanSuite` in both workflows 
should fix it. I read the script but did not run it.



##########
docs/source/user-guide/latest/datatypes.md:
##########
@@ -112,9 +112,9 @@ Direct projection requires explicit configuration on every 
supported Spark versi
 `spark.sql.variant.pushVariantIntoScan=false` (defaults to true in Spark 
4.1+), with the default
 Parquet timestamp inference settings. Support for Spark's whole-value pushdown 
rewrite is tracked
 by [#5519](https://github.com/apache/datafusion-comet/issues/5519). Nested 
Variant columns, pushed-down
-Variant field extraction, expressions, writes, shuffle and spill, Python 
operators, encrypted
-files, and Iceberg scans that read a Variant column fall back to Spark. 
Iceberg scans of tables
-whose Variant columns the query does not read run natively. Spark also handles 
columnar-to-row
+Variant field extraction, expressions, writes, shuffle and spill, Python 
operators, and encrypted
+files fall back to Spark. Native Iceberg scans read Variant columns at any 
depth, shredded or not,
+except in tables with equality deletes keyed on a Variant column. Spark also 
handles columnar-to-row

Review Comment:
   One more case fails now instead of falling back. When a data file has no 
Parquet field ids and the table has no name mapping, iceberg-rust uses 
position-based projection and returns `FeatureUnsupported: Reading variant 
columns from Parquet files without field ids is not supported yet` for any 
projected Variant (`crates/iceberg/src/arrow/reader/projection.rs` lines 
112-123 at `1d4c20a`). Iceberg Java reads such files with 
`ParquetSchemaUtil.addFallbackIds`. The gate cannot see this at planning time, 
so the query fails at runtime. Iceberg's `add_files` procedure sets a name 
mapping, so this mostly affects files imported by other tools. Could this page 
and `iceberg.md` mention it?



##########
spark/src/test/scala/org/apache/comet/CometIcebergNativeSuite.scala:
##########
@@ -8088,11 +8085,14 @@ class CometIcebergNativeSuite
           INSERT INTO $table VALUES
             (1, parse_json('{"num": 25}')),
             (2, parse_json('{"num": 30}')),
-            (3, parse_json('{"num": 35}'))
+            (3, parse_json('{"num": 35}')),
+            (4, parse_json('null')),
+            (5, NULL)
         """)
-        checkIcebergNativeScanFallback(
-          s"SELECT id FROM $table WHERE try_variant_get(data, '$$.num', 'int') 
> 30 ORDER BY id",
-          "the native scan does not support the VARIANT type")
+        checkIcebergNativeScan(
+          s"SELECT id FROM $table WHERE try_variant_get(data, '$$.num', 'int') 
> 30 ORDER BY id")
+        checkIcebergNativeScan(s"SELECT id, to_json(data) FROM $table ORDER BY 
id")

Review Comment:
   No test reads a Variant column that schema evolution added after some files 
were written. In that case iceberg-rust fills the missing column with 
`new_null_array` of `struct<metadata, value>` (its 
`test_read_variant_missing_from_file`), and Comet then sends that through 
`normalize_variant_array`. An `ALTER TABLE ... ADD COLUMN v VARIANT` after the 
first insert, with a second insert and a read of both files, would cover it at 
the top level and inside a struct. I did not run this.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to