rdblue commented on code in PR #7886:
URL: https://github.com/apache/iceberg/pull/7886#discussion_r1240436315


##########
spark/v3.4/spark/src/test/java/org/apache/iceberg/spark/TestSparkV2Filters.java:
##########
@@ -264,4 +288,198 @@ public void testNotIn() {
         Expressions.and(Expressions.notNull("col"), Expressions.notIn("col", 
1, 2));
     Assert.assertEquals("Expressions should match", expected.toString(), 
actual.toString());
   }
+
+  @Test
+  public void testYear() {
+    ScalarFunction<Integer> dateToYear = new 
YearsFunction.DateToYearsFunction();
+    UserDefinedScalarFunc udf =
+        new UserDefinedScalarFunc(
+            dateToYear.name(),
+            dateToYear.canonicalName(),
+            expressions(FieldReference.apply("col1")));
+    testUDF(udf, Expressions.year("col1"), 2021, DataTypes.IntegerType);

Review Comment:
   This may be confusing. The Iceberg `year` function produces an ordinal value 
starting at 1970. Expressions like this one that look for a specific 
human-readable year are misleading because 2021 is actually 51. We should 
consider how to handle this so that it isn't confusing.



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