You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/12/13 03:13:41 UTC

[GitHub] [iceberg] hililiwei commented on a diff in pull request #6402: Flink: Add UT for NaN

hililiwei commented on code in PR #6402:
URL: https://github.com/apache/iceberg/pull/6402#discussion_r1046618093


##########
flink/v1.16/flink/src/test/java/org/apache/iceberg/flink/source/TestFlinkTableSource.java:
##########
@@ -603,7 +605,103 @@ public void testFilterPushDown2Literal() {
   }
 
   @Test
-  public void testSqlParseNaN() {
-    // todo add some test case to test NaN
+  public void testFilterNaN() {
+    sql(
+        "CREATE TABLE %s (id INT, data VARCHAR,d DOUBLE, f FLOAT) WITH ('write.format.default'='%s')",
+        TABLE_NAME_NAN, format.name());
+    sql(
+        "INSERT INTO %s VALUES (1,'iceberg',10, 1.1),(2,'b',20,2.2),(3,CAST(NULL AS VARCHAR),30,3.3),(4,'d',CAST('NaN' AS DOUBLE),4.4)",
+        TABLE_NAME_NAN);
+
+    String sqlNaNDoubleEqual =
+        String.format("SELECT * FROM %s  WHERE d = CAST('NaN' AS DOUBLE)  ", TABLE_NAME_NAN);
+    List<Row> resultDoubleEqual = sql(sqlNaNDoubleEqual);
+    Assert.assertEquals("Should have 0 records", 0, resultDoubleEqual.size());

Review Comment:
   Yes, I totally agree with you. I've been blocked here for a long time. Until a fellow database expert told me that NaN should not equal any value in IEEE 754, ref: https://en.wikipedia.org/wiki/NaN. Flink seems to follow this standard, while Iceberg doesn't.
   



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org