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 @@ -91,6 +91,7 @@
import java.io.IOException;
import java.sql.Array;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.JDBCType;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
Expand Down Expand Up @@ -375,6 +376,20 @@ protected String getTableSchemaName(ResultSet resultSet)
return firstNonNull(resultSet.getString("TABLE_SCHEM"), DEFAULT_SCHEMA);
}

@Override
protected ResultSet getColumns(JdbcTableHandle handle, DatabaseMetaData metadata)
throws SQLException
{
try {
return super.getColumns(handle, metadata);
}
catch (org.apache.phoenix.schema.TableNotFoundException e) {
// Most JDBC driver return an empty result when DatabaseMetaData.getColumns can't find objects, but Phoenix driver throws an exception
// Rethrow as Trino TableNotFoundException to suppress the exception during listing information_schema
throw new io.trino.spi.connector.TableNotFoundException(new SchemaTableName(handle.getSchemaName(), handle.getTableName()));
}
}

@Override
public Optional<ColumnMapping> toColumnMapping(ConnectorSession session, Connection connection, JdbcTypeHandle typeHandle)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import io.trino.testing.TestingConnectorBehavior;
import io.trino.testing.sql.SqlExecutor;
import io.trino.testing.sql.TestTable;
import io.trino.testng.services.Flaky;
import org.testng.SkipException;
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;
Expand Down Expand Up @@ -221,30 +220,6 @@ public void testShowCreateTable()
")");
}

// TODO (https://github.com/trinodb/trino/issues/10904): Test is flaky because tests execute in parallel
@Flaky(issue = "https://github.com/trinodb/trino/issues/10904", match = "\\QERROR 1012 (42M03): Table undefined. tableName=")
@Test
@Override
public void testSelectInformationSchemaColumns()
{
super.testSelectInformationSchemaColumns();
}

@Override
public void testReadMetadataWithRelationsConcurrentModifications()
{
try {
super.testReadMetadataWithRelationsConcurrentModifications();
}
catch (Exception expected) {
// The test failure is not guaranteed
// TODO (https://github.com/trinodb/trino/issues/10904): shouldn't fail
assertThat(expected)
.hasMessageContaining("ERROR 1012 (42M03): Table undefined. tableName=");
throw new SkipException("to be fixed");
}
}

@Override
public void testCharVarcharComparison()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
import java.io.IOException;
import java.sql.Array;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.JDBCType;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
Expand Down Expand Up @@ -367,6 +368,20 @@ protected String getTableSchemaName(ResultSet resultSet)
return firstNonNull(resultSet.getString("TABLE_SCHEM"), DEFAULT_SCHEMA);
}

@Override
protected ResultSet getColumns(JdbcTableHandle handle, DatabaseMetaData metadata)
throws SQLException
{
try {
return super.getColumns(handle, metadata);
}
catch (org.apache.phoenix.schema.TableNotFoundException e) {
// Most JDBC driver return an empty result when DatabaseMetaData.getColumns can't find objects, but Phoenix driver throws an exception
// Rethrow as Trino TableNotFoundException to suppress the exception during listing information_schema
throw new io.trino.spi.connector.TableNotFoundException(new SchemaTableName(handle.getSchemaName(), handle.getTableName()));
}
}

@Override
public Optional<ColumnMapping> toColumnMapping(ConnectorSession session, Connection connection, JdbcTypeHandle typeHandle)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import io.trino.testing.TestingConnectorBehavior;
import io.trino.testing.sql.SqlExecutor;
import io.trino.testing.sql.TestTable;
import io.trino.testng.services.Flaky;
import org.testng.SkipException;
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;
Expand Down Expand Up @@ -239,30 +238,6 @@ public void testShowCreateTable()
")");
}

// TODO (https://github.com/trinodb/trino/issues/10904): Test is flaky because tests execute in parallel
@Flaky(issue = "https://github.com/trinodb/trino/issues/10904", match = "\\QERROR 1012 (42M03): Table undefined. tableName=")
@Test
@Override
public void testSelectInformationSchemaColumns()
{
super.testSelectInformationSchemaColumns();
}

@Override
public void testReadMetadataWithRelationsConcurrentModifications()
{
try {
super.testReadMetadataWithRelationsConcurrentModifications();
}
catch (Exception expected) {
// The test failure is not guaranteed
// TODO (https://github.com/trinodb/trino/issues/10904): shouldn't fail
assertThat(expected)
.hasMessageContaining("ERROR 1012 (42M03): Table undefined. tableName=");
throw new SkipException("to be fixed");
}
}

@Override
public void testCharVarcharComparison()
{
Expand Down