Skip to content

Commit

Permalink
Introduce BaseOrcWithBloomFiltersTest and TestHiveOrcWithBloomFilters
Browse files Browse the repository at this point in the history
  • Loading branch information
zhengxingmao authored and findepi committed May 24, 2022
1 parent 2d8fbb8 commit 755dc91
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.trino.plugin.hive.orc;

import io.trino.plugin.hive.HiveQueryRunner;
import io.trino.testing.BaseOrcWithBloomFiltersTest;
import io.trino.testing.QueryRunner;

import static java.lang.String.format;

public class TestHiveOrcWithBloomFilters
extends BaseOrcWithBloomFiltersTest
{
@Override
protected QueryRunner createQueryRunner()
throws Exception
{
return HiveQueryRunner.builder()
.addHiveProperty("hive.orc.bloom-filters.enabled", "true")
.addHiveProperty("hive.orc.default-bloom-filter-fpp", "0.001")
.build();
}

@Override
protected String getTableProperties(String bloomFilterColumnName, String bucketingColumnName)
{
return format(
"orc_bloom_filter_columns = ARRAY['%s'], bucketed_by = array['%s'], bucket_count = 1",
bloomFilterColumnName,
bucketingColumnName);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.trino.plugin.hive.orc;
package io.trino.testing;

import io.trino.Session;
import io.trino.plugin.hive.HiveQueryRunner;
import io.trino.testing.AbstractTestQueryFramework;
import io.trino.testing.QueryRunner;
import org.intellij.lang.annotations.Language;
import org.testng.annotations.Test;

import static io.trino.testing.sql.TestTable.randomTableSuffix;
import static java.lang.String.format;
import static org.assertj.core.api.Assertions.assertThat;

public class TestOrcWithBloomFilters
public abstract class BaseOrcWithBloomFiltersTest
extends AbstractTestQueryFramework
{
@Override
protected QueryRunner createQueryRunner()
throws Exception
{
return HiveQueryRunner.builder()
.addHiveProperty("hive.orc.bloom-filters.enabled", "true")
.addHiveProperty("hive.orc.default-bloom-filter-fpp", "0.001")
.build();
}
protected abstract String getTableProperties(String bloomFilterColumnName, String bucketingColumnName);

@Test
public void testOrcBloomFilterIsWrittenDuringCreate()
Expand Down Expand Up @@ -69,14 +58,6 @@ public void testOrcBloomFilterIsWrittenDuringInsert()
assertUpdate("DROP TABLE " + tableName);
}

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

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

0 comments on commit 755dc91

Please sign in to comment.