Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,19 @@ protected TestTable createTableWithUnsupportedColumn()

// TODO move common tests from connector-specific classes here

@Test
public void testCharTrailingSpace()
{
String schema = getSession().getSchema().orElseThrow();
try (TestTable table = new TestTable(onRemoteDatabase(), schema + ".char_trailing_space", "(x char(10))", List.of("'test'"))) {
String tableName = table.getName();
assertQuery("SELECT * FROM " + tableName + " WHERE x = char 'test'", "VALUES 'test'");
assertQuery("SELECT * FROM " + tableName + " WHERE x = char 'test '", "VALUES 'test'");
assertQuery("SELECT * FROM " + tableName + " WHERE x = char 'test '", "VALUES 'test'");
assertQueryReturnsEmptyResult("SELECT * FROM " + tableName + " WHERE x = char ' test'");
}
}

@Test
public void testAggregationPushdown()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,14 @@ public void testDateYearOfEraPredicate()
"Date must be between 1970-01-01 and 2106-02-07 in ClickHouse: -1996-09-14");
}

@Override
public void testCharTrailingSpace()
{
assertThatThrownBy(super::testCharTrailingSpace)
.hasMessageStartingWith("Failed to execute statement: CREATE TABLE tpch.char_trailing_space");
throw new SkipException("Implement test for ClickHouse");
}

@Override
protected SqlExecutor onRemoteDatabase()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import static io.trino.sql.planner.assertions.PlanMatchPattern.node;
import static io.trino.testing.MaterializedResult.resultBuilder;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;

public abstract class BaseDruidConnectorTest
extends BaseJdbcConnectorTest
Expand Down Expand Up @@ -291,4 +292,12 @@ public void testDateYearOfEraPredicate()
{
throw new SkipException("Druid connector does not map 'orderdate' column to date type");
}

@Override
public void testCharTrailingSpace()
{
assertThatThrownBy(super::testCharTrailingSpace)
.hasMessageContaining("Error while executing SQL \"CREATE TABLE druid.char_trailing_space");
throw new SkipException("Implement test for Druid");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -255,21 +255,6 @@ public void testMySqlTinyint()
assertUpdate("DROP TABLE mysql_test_tinyint1");
}

@Test
public void testCharTrailingSpace()
{
onRemoteDatabase().execute("CREATE TABLE tpch.char_trailing_space (x char(10))");
assertUpdate("INSERT INTO char_trailing_space VALUES ('test')", 1);

assertQuery("SELECT * FROM char_trailing_space WHERE x = char 'test'", "VALUES 'test'");
assertQuery("SELECT * FROM char_trailing_space WHERE x = char 'test '", "VALUES 'test'");
assertQuery("SELECT * FROM char_trailing_space WHERE x = char 'test '", "VALUES 'test'");

assertEquals(getQueryRunner().execute("SELECT * FROM char_trailing_space WHERE x = char ' test'").getRowCount(), 0);

assertUpdate("DROP TABLE char_trailing_space");
}

@Override
protected String errorMessageForCreateTableAsSelectNegativeDate(String date)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,14 @@ public void testVarcharCharComparison()
}
}

@Override
public void testCharTrailingSpace()
{
assertThatThrownBy(super::testCharTrailingSpace)
.hasMessageContaining("The table does not have a primary key. tableName=TPCH.CHAR_TRAILING_SPACE");
throw new SkipException("Implement test for Phoenix");
}

// Overridden because Phoenix requires a ROWID column
@Override
public void testCountDistinctWithStringTypes()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,14 @@ public void testVarcharCharComparison()
}
}

@Override
public void testCharTrailingSpace()
{
assertThatThrownBy(super::testCharTrailingSpace)
.hasMessageContaining("The table does not have a primary key. tableName=TPCH.CHAR_TRAILING_SPACE");
throw new SkipException("Implement test for Phoenix");
}

// Overridden because Phoenix requires a ROWID column
@Override
public void testCountDistinctWithStringTypes()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@
import static java.util.stream.Collectors.joining;
import static java.util.stream.IntStream.range;
import static org.assertj.core.api.Assertions.assertThat;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;

Expand Down Expand Up @@ -683,21 +682,6 @@ public void testCharPredicatePushdown()
}
}

@Test
public void testCharTrailingSpace()
{
onRemoteDatabase().execute("CREATE TABLE char_trailing_space (x char(10))");
assertUpdate("INSERT INTO char_trailing_space VALUES ('test')", 1);

assertQuery("SELECT * FROM char_trailing_space WHERE x = char 'test'", "VALUES 'test'");
assertQuery("SELECT * FROM char_trailing_space WHERE x = char 'test '", "VALUES 'test'");
assertQuery("SELECT * FROM char_trailing_space WHERE x = char 'test '", "VALUES 'test'");

assertEquals(getQueryRunner().execute("SELECT * FROM char_trailing_space WHERE x = char ' test'").getRowCount(), 0);

assertUpdate("DROP TABLE char_trailing_space");
}

@Test
public void testOrPredicatePushdown()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,21 +229,6 @@ public void testSingleStoreTinyint()
assertUpdate("DROP TABLE mysql_test_tinyint1");
}

@Test
public void testCharTrailingSpace()
{
onRemoteDatabase().execute("CREATE TABLE tpch.char_trailing_space (x char(10))");
assertUpdate("INSERT INTO char_trailing_space VALUES ('test')", 1);

assertQuery("SELECT * FROM char_trailing_space WHERE x = char 'test'", "VALUES 'test'");
assertQuery("SELECT * FROM char_trailing_space WHERE x = char 'test '", "VALUES 'test'");
assertQuery("SELECT * FROM char_trailing_space WHERE x = char 'test '", "VALUES 'test'");

assertEquals(getQueryRunner().execute("SELECT * FROM char_trailing_space WHERE x = char ' test'").getRowCount(), 0);

assertUpdate("DROP TABLE char_trailing_space");
}

@Override
protected String errorMessageForInsertIntoNotNullColumn(String columnName)
{
Expand Down