vvysotskyi commented on a change in pull request #1638: DRILL-7022: Partition 
pruning is not happening the first time after the metadata auto-refresh
URL: https://github.com/apache/drill/pull/1638#discussion_r257256343
 
 

 ##########
 File path: 
exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestParquetMetadataCache.java
 ##########
 @@ -902,6 +902,27 @@ public void testEmptyDirectoryWithMetadataDirFile() 
throws Exception {
             .run();
   }
 
+  @Test
+  public void testAutoRefreshPartitionPruning() throws Exception {
+    test("create table dfs.tmp.`orders` partition by (o_orderstatus) as\n" +
+        "select * from cp.`tpch/orders.parquet`");
+
+    test("refresh table metadata dfs.tmp.`orders`");
+
+    File ordersTable = new File(dirTestWatcher.getDfsTestTmpDir(), "orders");
+
+    // sets last-modified time of directory greater than the time of cache 
file to force metadata cache file auto-refresh
+    assertTrue("Unable to change the last-modified time of table directory",
+        ordersTable.setLastModified(new File(ordersTable, 
Metadata.METADATA_FILENAME).lastModified() + 100500));
+
+    String query = "select * from dfs.tmp.`orders`\n" +
+        "where o_orderstatus = 'O' and o_orderdate < '1995-03-10'";
+    PlanTestBase.testPlanOneExpectedPattern(query, "numRowGroups=1");
+
+    int actualRowCount = testSql(query);
+    assertEquals("Row count does not match the expected value", 1, 
actualRowCount);
 
 Review comment:
   Done.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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

Reply via email to