Skip to content
Merged
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 @@ -303,6 +303,33 @@ public void testInsertNegativeDate()
.hasStackTraceContaining("TrinoException: Driver returned null LocalDate for a non-null value");
}

@Override
public void testNativeQueryCreateStatement()
{
// SingleStore returns a ResultSet metadata with no columns for CREATE TABLE statement.
// This is unusual, because other connectors don't produce a ResultSet metadata for CREATE TABLE 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.
assertFalse(getQueryRunner().tableExists(getSession(), "numbers"));
assertThatThrownBy(() -> query("SELECT * FROM TABLE(system.query(query => 'CREATE TABLE numbers(n INTEGER)'))"))
.hasMessageContaining("descriptor has no fields");
assertFalse(getQueryRunner().tableExists(getSession(), "numbers"));
}

@Override
public void testNativeQueryInsertStatementTableExists()
{
// SingleStore returns a ResultSet metadata with no columns for INSERT statement.
// 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()) {
assertThatThrownBy(() -> query(format("SELECT * FROM TABLE(system.query(query => 'INSERT INTO %s VALUES (3)'))", testTable.getName())))
.hasMessageContaining("descriptor has no fields");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if it is the way to go. It sounds like we should disable this feature (system.query table function) in single-store as this not working fully.

assertQuery("SELECT * FROM " + testTable.getName(), "VALUES 1, 2");
}
}

/**
* This test helps to tune TupleDomain simplification threshold.
*/
Expand Down