vdiravka commented on a change in pull request #1748: DRILL-7171: Create 
metadata directories cache file in the leaf level directories to support 
ConvertCountToDirectScan optimization.
URL: https://github.com/apache/drill/pull/1748#discussion_r275222089
 
 

 ##########
 File path: 
exec/java-exec/src/test/java/org/apache/drill/exec/planner/logical/TestConvertCountToDirectScan.java
 ##########
 @@ -274,4 +274,72 @@ public void testCountsWithWildCard() throws Exception {
       test("drop table if exists %s", tableName);
     }
   }
+
+  @Test
+  public void testCountsForLeafDirectories() throws Exception {
+    test("use dfs.tmp");
+    String tableName = "parquet_table_counts";
+
+    try {
+      test("create table `%s/1` as select * from cp.`tpch/nation.parquet`", 
tableName);
+      test("create table `%s/2` as select * from cp.`tpch/nation.parquet`", 
tableName);
+      test("create table `%s/3` as select * from cp.`tpch/nation.parquet`", 
tableName);
+      test("refresh table metadata %s", tableName);
+
+      String sql = String.format("select\n" +
+              "count(*) as star_count\n" +
+              "from `%s/1`", tableName);
+
+      int expectedNumFiles = 1;
+      String numFilesPattern = "numFiles = " + expectedNumFiles;
+      String usedMetaSummaryPattern = "usedMetadataSummaryFile = true";
+      String recordReaderPattern = "DynamicPojoRecordReader";
+
+      testPlanMatchingPatterns(sql, new String[]{numFilesPattern, 
usedMetaSummaryPattern, recordReaderPattern});
+
+      testBuilder()
+              .sqlQuery(sql)
+              .unOrdered()
+              .baselineColumns("star_count")
+              .baselineValues(25L)
+              .go();
+
+    } finally {
+      test("drop table if exists %s", tableName);
+    }
+  }
+
+  @Test
+  public void testcountsForDirWithFilesAndDir() throws Exception {
 
 Review comment:
   ```suggestion
     public void testCountsForDirWithFilesAndDir() throws Exception {
   ```

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

Reply via email to