[ https://issues.apache.org/jira/browse/DRILL-7063?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16806569#comment-16806569 ]
ASF GitHub Bot commented on DRILL-7063: --------------------------------------- vdiravka commented on pull request #1723: DRILL-7063: Seperate metadata cache file into summary, file metadata URL: https://github.com/apache/drill/pull/1723#discussion_r270784411 ########## 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 + @Test + public void testAutoRefreshRowCount() throws Exception { + String tableName = "orders_ctas_refresh5"; + test("use dfs"); + + test("create table `%s/t1` as select * from cp.`tpch/orders.parquet`", tableName); + test("create table `%s/t2` as select * from cp.`tpch/orders.parquet`", tableName); + test("create table `%s/t3` as select * from cp.`tpch/orders.parquet`", tableName); + test("create table `%s/t4` as select * from cp.`tpch/orders.parquet`", tableName); + test("refresh table metadata COLUMNS (o_orderdate) %s", tableName); + sleep(1000); + + tableName = tableName + "/t1"; + 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); + checkForMetadataFile(tableName); + createMetadataDir(tableName); + dirTestWatcher.copyResourceToRoot(Paths.get("multilevel/parquet/1994/Q1/orders_94_q1.parquet"), Paths.get("orders_ctas_refresh5/t1/q1.parquet")); + + testBuilder() + .sqlQuery(query) + .unOrdered() + .baselineColumns("count") + .baselineValues(100L) + .go(); + testBuilder() + .sqlQuery(rowCountQuery) + .unOrdered() + .baselineColumns("rowCount") + .baselineValues(100L) + .go(); + } + + @Test + public void testRefreshWithInterestingColumn() throws Exception { + String tableName = "orders_ctas_refresh"; + test("use dfs"); + + test("create table `%s/t1` as select * from cp.`tpch/orders.parquet`", tableName); + test("create table `%s/t2` as select * from cp.`tpch/orders.parquet`", tableName); + test("create table `%s/t3` as select * from cp.`tpch/orders.parquet`", tableName); + test("create table `%s/t4` as select * from cp.`tpch/orders.parquet`", tableName); + + test("refresh table metadata COLUMNS (o_orderdate) %s", tableName); + sleep(1000); + + String rowCountQuery = String.format("select t.allColumnsInteresting as allColumnsInteresting from `%s/metadataDir/summary_meta.json` as t", tableName); + checkForMetadataFile(tableName); + createMetadataDir(tableName); + testBuilder() + .sqlQuery(rowCountQuery) + .unOrdered() + .baselineColumns("allColumnsInteresting") + .baselineValues(false) + .go(); + } + + @Test + public void testDefaultRefresh() throws Exception { + String tableName = "orders_ctas_refresh1"; + test("use dfs"); + + test("create table `%s/t1` as select * from cp.`tpch/orders.parquet`", tableName); + test("create table `%s/t2` as select * from cp.`tpch/orders.parquet`", tableName); + test("create table `%s/t3` as select * from cp.`tpch/orders.parquet`", tableName); + test("create table `%s/t4` as select * from cp.`tpch/orders.parquet`", tableName); + + test("refresh table metadata %s", tableName); + sleep(1000); + + String rowCountQuery = String.format("select t.allColumnsInteresting as allColumnsInteresting from `%s/metadataDir/summary_meta.json` as t", tableName); + checkForMetadataFile(tableName); + createMetadataDir(tableName); + testBuilder() + .sqlQuery(rowCountQuery) + .unOrdered() + .baselineColumns("allColumnsInteresting") + .baselineValues(true) + .go(); + } + + @Test + public void testAutoRefreshWithInterestingColumn() throws Exception { + String tableName = "orders_ctas_refresh2"; + test("use dfs"); + + test("create table `%s/t1` as select * from cp.`tpch/orders.parquet`", tableName); + test("create table `%s/t2` as select * from cp.`tpch/orders.parquet`", tableName); + test("create table `%s/t3` as select * from cp.`tpch/orders.parquet`", tableName); + test("create table `%s/t4` as select * from cp.`tpch/orders.parquet`", tableName); + test("refresh table metadata COLUMNS (o_orderdate) %s", tableName); + sleep(1000); + test("create table `%s/t5` as select * from cp.`tpch/orders.parquet`", tableName); + test("Select count(*) from `%s`", tableName); + tableName = tableName + "/t5"; + checkForMetadataFile(tableName); + createMetadataDir(tableName); + String rowCountQuery = String.format("select t.allColumnsInteresting as allColumnsInteresting from `%s/metadataDir/summary_meta.json` as t", tableName); + testBuilder() + .sqlQuery(rowCountQuery) + .unOrdered() + .baselineColumns("allColumnsInteresting") + .baselineValues(false) + .go(); + } + + + @Test + public void testAutoRefreshWithInterestingColumnFile() throws Exception { + String tableName = "orders_ctas_refresh3"; + test("use dfs"); + + test("create table `%s/t1` as select * from cp.`tpch/orders.parquet`", tableName); + test("create table `%s/t2` as select * from cp.`tpch/orders.parquet`", tableName); + test("create table `%s/t3` as select * from cp.`tpch/orders.parquet`", tableName); + test("create table `%s/t4` as select * from cp.`tpch/orders.parquet`", tableName); + test("refresh table metadata COLUMNS (o_orderdate) %s", tableName); + sleep(1000); + test("create table `%s/t5` as select * from cp.`tpch/orders.parquet`", tableName); + test("Select count(*) from `%s`", tableName); + tableName = tableName + "/t5"; + checkForMetadataFile(tableName); + createMetadataDir(tableName); + dirTestWatcher.copyResourceToRoot(Paths.get("multilevel/parquet/1994/Q1/orders_94_q1.parquet"), Paths.get("orders_ctas_refresh3/t5/q1.parquet")); + String rowCountQuery = String.format("select t.allColumnsInteresting as allColumnsInteresting from `%s/metadataDir/summary_meta.json` as t", tableName); + testBuilder() + .sqlQuery(rowCountQuery) + .unOrdered() + .baselineColumns("allColumnsInteresting") + .baselineValues(false) + .go(); + } + + + @Test + public void testRefreshWithIsNull() throws Exception { + String tableName = "orders_ctas_refresh_not_null"; + test("use dfs"); + test("create table `%s/t4` as select * from cp.`tpch/orders.parquet`", tableName); + test("refresh table metadata COLUMNS (o_orderdate) %s", tableName); + String query = String.format("Select count(*) as cnt from `%s` where o_orderpriority is not null", tableName); + + checkForMetadataFile(tableName); + + testBuilder() + .sqlQuery(query) Review comment: 4 spaces indent is used in Drill code for builder's chain. ---------------------------------------------------------------- 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: us...@infra.apache.org > Create separate summary file for schema, totalRowCount, totalNullCount > (includes maintenance) > --------------------------------------------------------------------------------------------- > > Key: DRILL-7063 > URL: https://issues.apache.org/jira/browse/DRILL-7063 > Project: Apache Drill > Issue Type: Sub-task > Components: Metadata > Reporter: Venkata Jyothsna Donapati > Assignee: Venkata Jyothsna Donapati > Priority: Major > Fix For: 1.16.0 > > Original Estimate: 252h > Remaining Estimate: 252h > -- This message was sent by Atlassian JIRA (v7.6.3#76005)