Skip to content

Commit

Permalink
Use nation table instead of orders in test
Browse files Browse the repository at this point in the history
  • Loading branch information
aditi-pandit committed Jun 4, 2024
1 parent f64d2fc commit eb6f508
Showing 1 changed file with 25 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ public void testCreateTableAsSelect()
@Test
public void testCreateTableAsSelectBucketedTable()
{
assertFalse(getQueryRunner().tableExists(getSession(), "orders_bucketed_ctas"));
assertUpdate("" +
/*assertFalse(getQueryRunner().tableExists(getSession(), "orders_bucketed_ctas"));
assertUpdate(
"CREATE TABLE orders_bucketed_ctas(orderkey, orderdate, totalprice) " +
"WITH ( " +
" bucket_count = 10, bucketed_by = ARRAY['orderkey'], " +
Expand All @@ -121,12 +121,32 @@ public void testCreateTableAsSelectBucketedTable()
"SELECT count(*) FROM orders");
assertTableColumnNames("orders_bucketed_ctas", "orderkey", "orderdate", "totalprice");
assertQuery("SELECT * from orders_bucketed_ctas");
assertQuery("SELECT * FROM orders_bucketed_ctas");
assertQuery("SELECT orderkey, sum(totalprice) FROM orders_bucketed_ctas GROUP BY orderkey");
// Check the number of distinct files for lineitem_bucketed_ctas is the same as the number of buckets.
// Check the number of distinct files for orders_bucketed_ctas is the same as the number of buckets.
assertQuery("SELECT count(distinct(\"$path\")) FROM orders_bucketed_ctas", "SELECT CAST(10 AS BIGINT)");
assertUpdate("DROP TABLE orders_bucketed_ctas");
assertFalse(getQueryRunner().tableExists(getSession(), "orders_bucketed_ctas"));
assertFalse(getQueryRunner().tableExists(getSession(), "orders_bucketed_ctas"));*/

assertFalse(getQueryRunner().tableExists(getSession(), "nation_bucketed_ctas"));
assertUpdate(
"CREATE TABLE nation_bucketed_ctas(nationkey, name, comment) " +
"WITH ( " +
" bucket_count = 10, bucketed_by = ARRAY['nationkey'], " +
" sorted_by = ARRAY['nationkey'] " +
") " +
"AS " +
"SELECT nationkey, name, comment FROM nation",
"SELECT count(*) FROM nation");
assertTableColumnNames("nation_bucketed_ctas", "nationkey", "name", "comment");

assertQuery("SELECT * FROM nation_bucketed_ctas");
//assertQuery("SELECT nationkey, sum(totalprice) FROM nation_bucketed_ctas GROUP BY orderkey");
// Check the number of distinct files for orders_bucketed_ctas is the same as the number of buckets.
assertQuery("SELECT count(distinct(\"$path\")) FROM nation_bucketed_ctas", "SELECT CAST(10 AS BIGINT)");
assertUpdate("DROP TABLE nation_bucketed_ctas");
assertFalse(getQueryRunner().tableExists(getSession(), "nation_bucketed_ctas"));


assertFalse(getQueryRunner().tableExists(getSession(), "empty_bucketed_table"));
assertUpdate("" +
Expand Down

0 comments on commit eb6f508

Please sign in to comment.