Skip to content
Closed
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

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import io.trino.testing.MaterializedResult;
import io.trino.testing.TestingConnectorBehavior;
import io.trino.testing.sql.SqlExecutor;
import io.trino.testing.sql.TemporaryRelation;
import io.trino.testing.sql.TestTable;
import org.testng.SkipException;
import org.testng.annotations.Test;
Expand Down Expand Up @@ -505,7 +506,7 @@ protected Optional<DataMappingTestSetup> filterDataMappingSmokeTestData(DataMapp
public void testNumericAggregationPushdown()
{
String schemaName = getSession().getSchema().orElseThrow();
try (TestTable testTable = createAggregationTestTable(schemaName + ".test_aggregation_pushdown",
try (TemporaryRelation testTable = createAggregationTestTable(schemaName + ".test_aggregation_pushdown",
ImmutableList.of("100.000, 100000000.000000000, 100.000, 100000000", "123.321, 123456789.987654321, 123.321, 123456789"))) {
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();
Expand All @@ -516,9 +517,9 @@ public void testNumericAggregationPushdown()
}

@Override
protected TestTable createAggregationTestTable(String name, List<String> rows)
protected TemporaryRelation createAggregationTestTable(String name, List<String> rows)
{
return new TestTable(onRemoteDatabase(), name, "(short_decimal Nullable(Decimal(9, 3)), long_decimal Nullable(Decimal(30, 10)), t_double Nullable(Float64), a_bigint Nullable(Int64)) Engine=Log", rows);
return new TestTable(onRemoteDatabase(), format("%s.%s", getSession().getSchema().orElseThrow(), name), "(short_decimal Nullable(Decimal(9, 3)), long_decimal Nullable(Decimal(30, 10)), t_double Nullable(Float64), a_bigint Nullable(Int64)) Engine=Log", rows);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import io.trino.sql.planner.plan.FilterNode;
import io.trino.testing.MaterializedResult;
import io.trino.testing.TestingConnectorBehavior;
import io.trino.testing.sql.TemporaryRelation;
import io.trino.testing.sql.TestTable;
import org.testng.annotations.Test;

Expand Down Expand Up @@ -305,7 +306,7 @@ public void testNativeQueryInsertStatementTableExists()
// This is unusual, because other connectors don't produce a ResultSet metadata for INSERT at all.
// The query fails because there are no columns, but even if columns were not required, the query would fail
// to execute in MariaDB because the connector wraps it in additional syntax, which causes syntax error.
try (TestTable testTable = simpleTable()) {
try (TemporaryRelation testTable = simpleTable()) {
assertThatThrownBy(() -> query(format("SELECT * FROM TABLE(system.query(query => 'INSERT INTO %s VALUES (3)'))", testTable.getName())))
.hasMessageContaining("descriptor has no fields");
assertQuery("SELECT * FROM " + testTable.getName(), "VALUES 1, 2");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import io.trino.sql.planner.plan.ProjectNode;
import io.trino.testing.MaterializedResult;
import io.trino.testing.TestingConnectorBehavior;
import io.trino.testing.sql.TemporaryRelation;
import io.trino.testing.sql.TestTable;
import io.trino.testing.sql.TestView;
import org.testng.annotations.Test;
Expand Down Expand Up @@ -309,9 +310,9 @@ public void testAggregationWithUnsupportedResultType()
}

@Override
protected TestTable createAggregationTestTable(String name, List<String> rows)
protected TemporaryRelation createAggregationTestTable(String name, List<String> rows)
{
return new TestTable(onRemoteDatabase(), name, "(short_decimal number(9, 3), long_decimal number(30, 10), a_bigint number(19), t_double binary_double)", rows);
return new TestTable(onRemoteDatabase(), format("%s.%s", getSession().getSchema().orElseThrow(), name), "(short_decimal number(9, 3), long_decimal number(30, 10), a_bigint number(19), t_double binary_double)", rows);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import io.trino.testing.QueryRunner;
import io.trino.testing.TestingConnectorBehavior;
import io.trino.testing.sql.SqlExecutor;
import io.trino.testing.sql.TemporaryRelation;
import io.trino.testing.sql.TestTable;
import org.testng.SkipException;
import org.testng.annotations.AfterClass;
Expand Down Expand Up @@ -598,7 +599,7 @@ public void testNativeQuerySelectFromNation()
public void testNativeQuerySelectFromTestTable()
{
// not implemented
try (TestTable testTable = simpleTable()) {
try (TemporaryRelation testTable = simpleTable()) {
assertQueryFails(
format("SELECT * FROM TABLE(system.query(query => 'SELECT * FROM %s'))", testTable.getName()),
"line 1:21: Table function system.query not registered");
Expand Down Expand Up @@ -628,7 +629,7 @@ public void testNativeQueryInsertStatementTableDoesNotExist()
public void testNativeQueryInsertStatementTableExists()
{
// not implemented
try (TestTable testTable = simpleTable()) {
try (TemporaryRelation testTable = simpleTable()) {
assertThatThrownBy(() -> query(format("SELECT * FROM TABLE(system.query(query => 'INSERT INTO %s VALUES (3)'))", testTable.getName())))
.hasMessage("line 1:21: Table function system.query not registered");
assertThat(query("SELECT * FROM " + testTable.getName()))
Expand All @@ -645,16 +646,16 @@ public void testNativeQueryIncorrectSyntax()
}

@Override
protected TestTable simpleTable()
protected TemporaryRelation simpleTable()
{
// override because Phoenix requires primary key specification
return new PhoenixTestTable(onRemoteDatabase(), "tpch.simple_table", "(col BIGINT PRIMARY KEY)", ImmutableList.of("1", "2"));
}

@Override
protected TestTable createTableWithDoubleAndRealColumns(String name, List<String> rows)
protected TemporaryRelation createTableWithDoubleAndRealColumns(String name, List<String> rows)
{
return new TestTable(onRemoteDatabase(), name, "(t_double double primary key, u_double double, v_real float, w_real float)", rows);
return new TestTable(onRemoteDatabase(), format("%s.%s", getSession().getSchema().orElseThrow(), name), "(t_double double primary key, u_double double, v_real float, w_real float)", rows);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import io.trino.testing.QueryRunner;
import io.trino.testing.TestingConnectorBehavior;
import io.trino.testing.sql.SqlExecutor;
import io.trino.testing.sql.TemporaryRelation;
import io.trino.testing.sql.TestTable;
import org.testng.SkipException;
import org.testng.annotations.AfterClass;
Expand Down Expand Up @@ -324,7 +325,7 @@ public void testNativeQueryInsertStatementTableExists()
// This is unusual, because other connectors don't produce a ResultSet metadata for INSERT at all.
// The query fails because there are no columns, but even if columns were not required, the query would fail
// to execute in SingleStore because the connector wraps it in additional syntax, which causes syntax error.
try (TestTable testTable = simpleTable()) {
try (TemporaryRelation testTable = simpleTable()) {
assertThatThrownBy(() -> query(format("SELECT * FROM TABLE(system.query(query => 'INSERT INTO %s VALUES (3)'))", testTable.getName())))
.hasMessageContaining("descriptor has no fields");
assertQuery("SELECT * FROM " + testTable.getName(), "VALUES 1, 2");
Expand Down