Skip to content

Commit

Permalink
Fix Cassandra listTables denies empty table_name
Browse files Browse the repository at this point in the history
  • Loading branch information
ebyhr authored and kokosing committed Feb 6, 2018
1 parent 1c6c5d1 commit a4b99e6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Expand Up @@ -185,7 +185,7 @@ public Map<SchemaTableName, List<ColumnMetadata>> listTableColumns(ConnectorSess

private List<SchemaTableName> listTables(ConnectorSession session, SchemaTablePrefix prefix)
{
if (prefix.getSchemaName() == null) {
if (prefix.getSchemaName() == null || prefix.getTableName() == null) {
return listTables(session, prefix.getSchemaName());
}
return ImmutableList.of(new SchemaTableName(prefix.getSchemaName(), prefix.getTableName()));
Expand Down
Expand Up @@ -489,6 +489,17 @@ public void testInsert()
"key3", null, 999, null, null, null, "ansi", false, null, null, null, null, null, null, null, null, null, null));
}

@Test
public void testSelectInformationSchemaColumns()
{
assertQuery(
"SELECT table_schema FROM information_schema.columns WHERE table_schema = 'tpch' ORDER BY table_schema LIMIT 1",
"VALUES 'tpch'");
assertQuery(
"SELECT table_name FROM information_schema.columns WHERE table_name = 'orders' ORDER BY table_name LIMIT 1",
"VALUES 'orders'");
}

private void assertSelect(String tableName, boolean createdByPresto)
{
Type uuidType = createdByPresto ? createUnboundedVarcharType() : createVarcharType(36);
Expand Down

0 comments on commit a4b99e6

Please sign in to comment.