rdblue commented on a change in pull request #398: Push down StringStartsWith 
in Spark IcebergSource
URL: https://github.com/apache/incubator-iceberg/pull/398#discussion_r318197341
 
 

 ##########
 File path: 
parquet/src/test/java/org/apache/iceberg/parquet/TestDictionaryRowGroupFilter.java
 ##########
 @@ -231,6 +236,41 @@ public void testRequiredColumn() {
     Assert.assertFalse("Should skip: required columns are always non-null", 
shouldRead);
   }
 
+  @Test
+  public void testStartsWith() {
+    boolean shouldRead = new ParquetDictionaryRowGroupFilter(SCHEMA, 
startsWith("non_dict", "re"))
+        .shouldRead(PARQUET_SCHEMA, ROW_GROUP_METADATA, DICTIONARY_STORE);
+    Assert.assertTrue("Should read: no dictionary", shouldRead);
+
+    shouldRead = new ParquetDictionaryRowGroupFilter(SCHEMA, 
startsWith("required", "re"))
+        .shouldRead(PARQUET_SCHEMA, ROW_GROUP_METADATA, DICTIONARY_STORE);
+    Assert.assertTrue("Should read: dictionary contains a matching entry", 
shouldRead);
+
+    shouldRead = new ParquetDictionaryRowGroupFilter(SCHEMA, 
startsWith("required", "req"))
+        .shouldRead(PARQUET_SCHEMA, ROW_GROUP_METADATA, DICTIONARY_STORE);
+    Assert.assertTrue("Should read: dictionary contains a matching entry", 
shouldRead);
+
+    shouldRead = new ParquetDictionaryRowGroupFilter(SCHEMA, 
startsWith("some_nulls", "so"))
+        .shouldRead(PARQUET_SCHEMA, ROW_GROUP_METADATA, DICTIONARY_STORE);
+    Assert.assertTrue("Should read: dictionary contains a matching entry", 
shouldRead);
+
+    shouldRead = new ParquetDictionaryRowGroupFilter(SCHEMA, 
startsWith("no_stats", UUID.randomUUID().toString()))
+        .shouldRead(PARQUET_SCHEMA, ROW_GROUP_METADATA, DICTIONARY_STORE);
+    Assert.assertFalse("Should skip: no stats but dictionary is present", 
shouldRead);
+
+    shouldRead = new ParquetDictionaryRowGroupFilter(SCHEMA, 
startsWith("required", "reqs"))
+        .shouldRead(PARQUET_SCHEMA, ROW_GROUP_METADATA, DICTIONARY_STORE);
+    Assert.assertFalse("Should skip: no match in dictionary", shouldRead);
+
+    shouldRead = new ParquetDictionaryRowGroupFilter(SCHEMA, 
startsWith("some_nulls", "somex"))
+        .shouldRead(PARQUET_SCHEMA, ROW_GROUP_METADATA, DICTIONARY_STORE);
+    Assert.assertFalse("Should skip: no match in dictionary", shouldRead);
+
+    shouldRead = new ParquetDictionaryRowGroupFilter(SCHEMA, 
startsWith("no_nulls", "xxx"))
+        .shouldRead(PARQUET_SCHEMA, ROW_GROUP_METADATA, DICTIONARY_STORE);
+    Assert.assertFalse("Should skip: no match in dictionary", shouldRead);
 
 Review comment:
   Can you add tests for `all_nulls` and `not_in_file` columns?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to