vdiravka commented on a change in pull request #1723: DRILL-7063: Seperate
metadata cache file into summary, file metadata
URL: https://github.com/apache/drill/pull/1723#discussion_r270784820
##########
File path:
exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestParquetMetadataCache.java
##########
@@ -956,4 +957,302 @@ public void testRefreshNone() throws Exception {
int actualRowCount = testSql(query);
assertEquals(expectedRowCount, actualRowCount);
}
+
+ @Test
+ public void testTotalRowCount() throws Exception {
+ String tableName = "nation_ctas_rowcount";
+ test("use dfs");
+ test("create table `%s/t1` as select * from cp.`tpch/nation.parquet`",
tableName);
+ test("create table `%s/t2` as select * from cp.`tpch/nation.parquet`",
tableName);
+ test("create table `%s/t3` as select * from cp.`tpch/nation.parquet`",
tableName);
+ test("create table `%s/t4` as select * from cp.`tpch/nation.parquet`",
tableName);
+ long rowCount = testSql("select * from `nation_ctas_rowcount`");
+ test("refresh table metadata %s", tableName);
+ checkForMetadataFile(tableName);
+ createMetadataDir(tableName);
+ testBuilder()
+ .sqlQuery("select t.totalRowCount as rowCount from
`%s/metadataDir/summary_meta.json` as t", tableName)
+ .unOrdered()
+ .baselineColumns("rowCount")
+ .baselineValues(rowCount)
+ .go();
+ }
+
+ @Test
+ public void testTotalRowCountPerFile() throws Exception {
+ String tableName = "nation_ctas_rowcount1";
+ test("use dfs");
+ test("create table `%s/t1` as select * from cp.`tpch/nation.parquet`",
tableName);
+ test("create table `%s/t2` as select * from cp.`tpch/nation.parquet`",
tableName);
+ test("create table `%s/t3` as select * from cp.`tpch/nation.parquet`",
tableName);
+ test("create table `%s/t4` as select * from cp.`tpch/nation.parquet`",
tableName);
+ long rowCount = testSql("select * from `nation_ctas_rowcount1/t1`");
+ test("refresh table metadata %s", tableName);
+ tableName = tableName + "/t1";
+ checkForMetadataFile(tableName);
+ createMetadataDir(tableName);
+ testBuilder()
+ .sqlQuery("select t.totalRowCount as rowCount from
`%s/metadataDir/summary_meta.json` as t", tableName)
+ .unOrdered()
+ .baselineColumns("rowCount")
+ .baselineValues(rowCount)
+ .go();
+ }
+
+
+ @Test
+ public void testTotalRowCountAddDirectory() throws Exception {
+ String tableName = "nation_ctas_rowcount2";
+ test("use dfs");
+
+ test("create table `%s/t1` as select * from cp.`tpch/nation.parquet`",
tableName);
+ test("create table `%s/t2` as select * from cp.`tpch/nation.parquet`",
tableName);
+ test("create table `%s/t3` as select * from cp.`tpch/nation.parquet`",
tableName);
+ test("create table `%s/t4` as select * from cp.`tpch/nation.parquet`",
tableName);
+
+ test("refresh table metadata %s", tableName);
+ sleep(1000);
+ test("create table `%s/t5` as select * from cp.`tpch/nation.parquet`",
tableName);
+
+ String query = String.format("select count(*) as count from `%s`",
tableName);
+ String rowCountQuery = String.format("select t.totalRowCount as rowCount
from `%s/metadataDir/summary_meta.json` as t", tableName);
+
+ testBuilder()
+ .sqlQuery(query)
+ .unOrdered()
+ .baselineColumns("count")
+ .baselineValues(125L)
+ .go();
+ checkForMetadataFile(tableName);
+ createMetadataDir(tableName);
+ testBuilder()
+ .sqlQuery(rowCountQuery)
+ .unOrdered()
+ .baselineColumns("rowCount")
+ .baselineValues(125L)
+ .go();
+ }
+
+
+ @Test
+ public void testTotalRowCountAddSubDir() throws Exception {
+ String tableName = "nation_ctas_rowcount3";
+ test("use dfs");
+
+ test("create table `%s/t1` as select * from cp.`tpch/nation.parquet`",
tableName);
+ test("create table `%s/t2` as select * from cp.`tpch/nation.parquet`",
tableName);
+ test("create table `%s/t3` as select * from cp.`tpch/nation.parquet`",
tableName);
+ test("create table `%s/t4` as select * from cp.`tpch/nation.parquet`",
tableName);
+
+ test("refresh table metadata %s", tableName);
+ sleep(1000);
+ tableName = tableName + "/t1";
+ test("create table `%s/t5` as select * from cp.`tpch/nation.parquet`",
tableName);
+ String query = String.format("select count(*) as count from `%s`",
tableName);
+ String rowCountQuery = String.format("select t.totalRowCount as rowCount
from `%s/metadataDir/summary_meta.json` as t", tableName);
+ testBuilder()
+ .sqlQuery(query)
+ .unOrdered()
+ .baselineColumns("count")
+ .baselineValues(50L)
+ .go();
+ checkForMetadataFile(tableName);
+ createMetadataDir(tableName);
+ testBuilder()
+ .sqlQuery(rowCountQuery)
+ .unOrdered()
+ .baselineColumns("rowCount")
+ .baselineValues(50L)
+ .go();
+ }
+
+ @Test
+ public void testTotalRowCountAddSubDir1() throws Exception {
+ String tableName = "nation_ctas_rowcount4";
+ test("use dfs");
+
+ test("create table `%s/t1` as select * from cp.`tpch/nation.parquet`",
tableName);
+ test("create table `%s/t2` as select * from cp.`tpch/nation.parquet`",
tableName);
+ test("create table `%s/t3` as select * from cp.`tpch/nation.parquet`",
tableName);
+ test("create table `%s/t4` as select * from cp.`tpch/nation.parquet`",
tableName);
+
+ test("refresh table metadata %s", tableName);
+ sleep(1000);
+ tableName = tableName + "/t1";
+
+ test("create table `%s/t5` as select * from cp.`tpch/nation.parquet`",
tableName);
+
+ String query = String.format("select count(*) as count from `%s`",
tableName);
+ String rowCountQuery = String.format("select t.totalRowCount as rowCount
from `%s/metadataDir/summary_meta.json` as t", tableName);
+ testBuilder()
+ .sqlQuery(query)
+ .unOrdered()
+ .baselineColumns("count")
+ .baselineValues(50L)
+ .go();
+ checkForMetadataFile(tableName);
+ createMetadataDir(tableName);
+ testBuilder()
+ .sqlQuery(rowCountQuery)
+ .unOrdered()
+ .baselineColumns("rowCount")
+ .baselineValues(50L)
+ .go();
+ }
+
+ @Ignore
Review comment:
Why it is disabled?
----------------------------------------------------------------
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