Search in sources :

Example 1 with TestingTableHandle

use of io.trino.testing.TestingMetadata.TestingTableHandle in project trino by trinodb.

the class TestAnalyzer method testAnalysisDuplicateNames.

// This test validates object resolution order (materialized view, view and table).
// The order is arbitrary (connector should not return different object types with same name)
// and can be changed along with test.
@Test
public void testAnalysisDuplicateNames() {
    // Materialized view redirects to "t1"
    Analysis analysis = analyze("SELECT * FROM table_view_and_materialized_view");
    TableHandle handle = getOnlyElement(analysis.getTables());
    assertThat(((TestingTableHandle) handle.getConnectorHandle()).getTableName().getTableName()).isEqualTo("t1");
    // View redirects to "t2"
    analysis = analyze("SELECT * FROM table_and_view");
    handle = getOnlyElement(analysis.getTables());
    assertThat(((TestingTableHandle) handle.getConnectorHandle()).getTableName().getTableName()).isEqualTo("t2");
}
Also used : TableHandle(io.trino.metadata.TableHandle) TestingTableHandle(io.trino.testing.TestingMetadata.TestingTableHandle) Test(org.testng.annotations.Test)

Aggregations

TableHandle (io.trino.metadata.TableHandle)1 TestingTableHandle (io.trino.testing.TestingMetadata.TestingTableHandle)1 Test (org.testng.annotations.Test)1