Skip to content

Commit

Permalink
Removes unnecessary sorting from hive bloom filter tests
Browse files Browse the repository at this point in the history
Please refer to the link for detailed discussion information
#11732 (comment)
  • Loading branch information
zhengxingmao authored and findepi committed May 24, 2022
1 parent 7834be9 commit 2d8fbb8
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void testOrcBloomFilterIsWrittenDuringCreate()
format(
"CREATE TABLE %s WITH (%s) AS SELECT orderstatus, totalprice FROM tpch.tiny.orders",
tableName,
getTableProperties("totalprice", "orderstatus", "totalprice")),
getTableProperties("totalprice", "orderstatus")),
15000);

// `totalprice 51890 is chosen to lie between min/max values of row group
Expand All @@ -61,21 +61,20 @@ public void testOrcBloomFilterIsWrittenDuringInsert()
format(
"CREATE TABLE %s (totalprice DOUBLE, orderstatus VARCHAR) WITH (%s)",
tableName,
getTableProperties("totalprice", "orderstatus", "totalprice")));
getTableProperties("totalprice", "orderstatus")));
assertUpdate(format("INSERT INTO %s SELECT totalprice, orderstatus FROM tpch.tiny.orders", tableName), 15000);

// `totalprice 51890 is chosen to lie between min/max values of row group
assertBloomFilterBasedRowGroupPruning(format("SELECT * FROM %s WHERE totalprice = 51890", tableName));
assertUpdate("DROP TABLE " + tableName);
}

private String getTableProperties(String bloomFilterColumnName, String bucketingColumnName, String sortByColumnName)
private String getTableProperties(String bloomFilterColumnName, String bucketingColumnName)
{
return format(
"orc_bloom_filter_columns = ARRAY['%s'], bucketed_by = array['%s'], bucket_count = 1, sorted_by = ARRAY['%s']",
"orc_bloom_filter_columns = ARRAY['%s'], bucketed_by = array['%s'], bucket_count = 1",
bloomFilterColumnName,
bucketingColumnName,
sortByColumnName);
bucketingColumnName);
}

private void assertBloomFilterBasedRowGroupPruning(@Language("SQL") String sql)
Expand Down

0 comments on commit 2d8fbb8

Please sign in to comment.