Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable average aggregation pushdown on decimal type in ClickHouse #10703

Merged
merged 2 commits into from
Jan 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/src/main/sphinx/connector/clickhouse.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Requirements

To connect to a ClickHouse server, you need:

* ClickHouse (version 20.8 or higher) or Altinity (version 20.3 or higher).
* ClickHouse (version 21.3 or higher) or Altinity (version 20.3 or higher).
ebyhr marked this conversation as resolved.
Show resolved Hide resolved
* Network access from the Trino coordinator and workers to the ClickHouse
server. Port 8123 is the default port.

Expand Down
5 changes: 0 additions & 5 deletions plugin/trino-clickhouse/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@
<artifactId>trino-base-jdbc</artifactId>
</dependency>

<dependency>
<groupId>io.trino</groupId>
<artifactId>trino-matching</artifactId>
</dependency>

<dependency>
<groupId>io.trino</groupId>
<artifactId>trino-plugin-toolkit</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ public ClickHouseClient(
.add(new ImplementMinMax(false)) // TODO: Revisit once https://github.com/trinodb/trino/issues/7100 is resolved
.add(new ImplementSum(ClickHouseClient::toTypeHandle))
.add(new ImplementAvgFloatingPoint())
.add(new ImplementAvgDecimal())
.add(new ImplementAvgBigint())
.build());
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
import io.trino.testing.QueryRunner;

import static io.trino.plugin.clickhouse.ClickHouseQueryRunner.createClickHouseQueryRunner;
import static io.trino.testing.sql.TestTable.randomTableSuffix;
import static org.assertj.core.api.Assertions.assertThatThrownBy;

public class TestClickHouseConnectorSmokeTest
extends BaseClickHouseConnectorSmokeTest
Expand All @@ -38,22 +36,4 @@ protected QueryRunner createQueryRunner()
.buildOrThrow(),
REQUIRED_TPCH_TABLES);
}

@Override
public void testRenameSchema()
{
// Override because the default database engine in version < v20.10.2.20-stable doesn't allow renaming schemas
assertThatThrownBy(super::testRenameSchema)
.hasMessageMatching("ClickHouse exception, code: 48,.* Ordinary: RENAME DATABASE is not supported .*\\n");

String schemaName = "test_rename_schema_" + randomTableSuffix();
try {
clickHouseServer.execute("CREATE DATABASE " + schemaName + " ENGINE = Atomic");
assertUpdate("ALTER SCHEMA " + schemaName + " RENAME TO " + schemaName + "_renamed");
}
finally {
assertUpdate("DROP SCHEMA IF EXISTS " + schemaName);
assertUpdate("DROP SCHEMA IF EXISTS " + schemaName + "_renamed");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import io.trino.plugin.jdbc.BaseJdbcConnectorTest;
import io.trino.sql.planner.plan.AggregationNode;
import io.trino.testing.MaterializedResult;
import io.trino.testing.QueryRunner;
import io.trino.testing.TestingConnectorBehavior;
Expand Down Expand Up @@ -98,25 +99,6 @@ public void testColumnName(String columnName)
throw new SkipException("TODO: test not implemented yet");
}

@Test
@Override
public void testRenameSchema()
{
// Override because the default database engine in version < v20.10.2.20-stable doesn't allow renaming schemas
assertThatThrownBy(super::testRenameSchema)
.hasMessageMatching("ClickHouse exception, code: 48,.* Ordinary: RENAME DATABASE is not supported .*\\n");

String schemaName = "test_rename_schema_" + randomTableSuffix();
try {
onRemoteDatabase().execute("CREATE DATABASE " + schemaName + " ENGINE = Atomic");
assertUpdate("ALTER SCHEMA " + schemaName + " RENAME TO " + schemaName + "_renamed");
}
finally {
assertUpdate("DROP SCHEMA IF EXISTS " + schemaName);
assertUpdate("DROP SCHEMA IF EXISTS " + schemaName + "_renamed");
}
}

@Override
public void testRenameColumn()
{
Expand Down Expand Up @@ -432,7 +414,8 @@ public void testNumericAggregationPushdown()
assertThat(query("SELECT min(short_decimal), min(long_decimal), min(a_bigint), min(t_double) FROM " + testTable.getName())).isFullyPushedDown();
assertThat(query("SELECT max(short_decimal), max(long_decimal), max(a_bigint), max(t_double) FROM " + testTable.getName())).isFullyPushedDown();
assertThat(query("SELECT sum(short_decimal), sum(long_decimal), sum(a_bigint), sum(t_double) FROM " + testTable.getName())).isFullyPushedDown();
assertThat(query("SELECT avg(short_decimal), avg(long_decimal), avg(a_bigint), avg(t_double) FROM " + testTable.getName())).isFullyPushedDown();
ebyhr marked this conversation as resolved.
Show resolved Hide resolved
assertThat(query("SELECT avg(a_bigint), avg(t_double) FROM " + testTable.getName())).isFullyPushedDown();
assertThat(query("SELECT avg(short_decimal), avg(long_decimal) FROM " + testTable.getName())).isNotFullyPushedDown(AggregationNode.class);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class TestingClickHouseServer
{
private static final DockerImageName CLICKHOUSE_IMAGE = DockerImageName.parse("yandex/clickhouse-server");
public static final DockerImageName CLICKHOUSE_LATEST_IMAGE = CLICKHOUSE_IMAGE.withTag("21.11.10.1");
public static final DockerImageName CLICKHOUSE_DEFAULT_IMAGE = CLICKHOUSE_IMAGE.withTag("20.8");
public static final DockerImageName CLICKHOUSE_DEFAULT_IMAGE = CLICKHOUSE_IMAGE.withTag("21.3.2.5"); // EOL is 30 Mar 2022

// Altinity Stable Builds Life-Cycle Table https://docs.altinity.com/altinitystablebuilds/#altinity-stable-builds-life-cycle-table
private static final DockerImageName ALTINITY_IMAGE = DockerImageName.parse("altinity/clickhouse-server").asCompatibleSubstituteFor("yandex/clickhouse-server");
Expand Down