nastra commented on code in PR #14108:
URL: https://github.com/apache/iceberg/pull/14108#discussion_r2446883372
##########
spark/v4.0/spark/src/test/java/org/apache/iceberg/spark/actions/TestRewriteDataFilesAction.java:
##########
@@ -2110,6 +2112,25 @@ public void testExecutorCacheForDeleteFilesDisabled() {
.isFalse();
}
+ @TestTemplate
+ public void testZOrderUDFWithDateType() {
+ SparkZOrderUDF zorderUDF = new SparkZOrderUDF(1, 16, 1024);
+
+ Dataset<Row> testCol = spark.sql("SELECT DATE '2025-01-01' as test_col");
+ Dataset<Row> result =
+ testCol.withColumn(
+ "zorder_result",
+ zorderUDF.sortedLexicographically(col("test_col"),
DataTypes.DateType));
+
+ List<Row> rows = result.collectAsList();
+ Row row = rows.get(0);
+
+
assertThat(result.schema().apply("zorder_result").dataType()).isEqualTo(DataTypes.BinaryType);
+
+ byte[] zorderBytes = row.getAs("zorder_result");
+ assertThat(zorderBytes).isNotNull().isNotEmpty();
+ }
Review Comment:
```suggestion
public void testZOrderUDFWithDateType() {
SparkZOrderUDF zorderUDF = new SparkZOrderUDF(1, 16, 1024);
Dataset<Row> result =
spark
.sql("SELECT DATE '2025-01-01' as test_col")
.withColumn(
"zorder_result",
zorderUDF.sortedLexicographically(col("test_col"),
DataTypes.DateType));
assertThat(result.schema().apply("zorder_result").dataType()).isEqualTo(DataTypes.BinaryType);
List<Row> rows = result.collectAsList();
Row row = rows.get(0);
byte[] zorderBytes = row.getAs("zorder_result");
assertThat(zorderBytes).isNotNull().isNotEmpty();
}
```
--
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]