aboutsummaryrefslogtreecommitdiff
path: root/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestParquetMetadataCache.java
diff options
context:
space:
mode:
Diffstat (limited to 'exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestParquetMetadataCache.java')
-rw-r--r--exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestParquetMetadataCache.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestParquetMetadataCache.java b/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestParquetMetadataCache.java
index f152078bf..f85ef2b71 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestParquetMetadataCache.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestParquetMetadataCache.java
@@ -902,6 +902,28 @@ public class TestParquetMetadataCache extends PlanTestBase {
.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);
+ // TODO: Check that metadata cache file is actually regenerated, once Drill will use JDK version with resolved JDK-8177809.
+ }
+
/**
* Helper method for checking the metadata file existence
*