nssalian commented on code in PR #16827:
URL: https://github.com/apache/iceberg/pull/16827#discussion_r3779003615
##########
spark/v4.1/spark/src/test/java/org/apache/iceberg/spark/actions/TestSparkFileRewriteRunners.java:
##########
@@ -136,4 +136,38 @@ public void testInvalidValuesForZOrderDataOptions() {
.hasMessageContaining("Cannot use less than 1 byte for variable length
types with ZOrder")
.hasMessageContaining("'var-length-contribution' was set to 0");
}
+
+ @Test
+ public void testInvalidConstructorUsagesHilbertData() {
Review Comment:
Some enhancement suggestions: could you add a column-not-found case
(hilbert("nonexistent")) and a mixed identity+data case (hilbert("dep", "id"))
to testInvalidConstructorUsagesHilbertData, plus a zero-columns case
(hilbertIndex(new byte[0][], 8)) in TestHilbertByteUtils, to cover the "Cannot
find column", identity-filtering, and "zero columns" guards?
##########
core/src/main/java/org/apache/iceberg/util/HilbertByteUtils.java:
##########
@@ -0,0 +1,141 @@
+/*
+ * 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.iceberg.util;
+
+import java.nio.ByteBuffer;
+import org.apache.iceberg.relocated.com.google.common.base.Preconditions;
+
+/**
+ * Maps a set of columns (each already converted to fixed-width,
lexicographically-ordered unsigned
+ * bytes by {@link ZOrderByteUtils}) onto a single byte array whose unsigned
big-endian
+ * lexicographic ordering follows the multi-dimensional Hilbert space-filling
curve.
+ *
+ * <p>Unlike Z-ordering, the Hilbert transform requires every dimension to
contribute the same
+ * number of bits, so each column is read to a fixed {@code bitsPerColumn}
precision.
+ *
+ * <p>The transform is the standard "axes to transposed Hilbert index"
algorithm from J. Skilling,
+ * "Programming the Hilbert curve" (2004); the transposed index is then
serialized to a scalar with
Review Comment:
nit: do we want to copy the full reference with the citation here?
--
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]