Search in sources :

Example 6 with ColumnInfo

use of io.trino.spi.eventlistener.ColumnInfo in project trino by trinodb.

the class TestEventListenerBasic method testReferencedTablesAndRoutines.

@Test
public void testReferencedTablesAndRoutines() throws Exception {
    runQueryAndWaitForEvents("SELECT sum(linenumber) FROM lineitem", 2);
    QueryCompletedEvent event = getOnlyElement(generatedEvents.getQueryCompletedEvents());
    List<TableInfo> tables = event.getMetadata().getTables();
    assertEquals(tables.size(), 1);
    TableInfo table = tables.get(0);
    assertEquals(table.getCatalog(), "tpch");
    assertEquals(table.getSchema(), "tiny");
    assertEquals(table.getTable(), "lineitem");
    assertEquals(table.getAuthorization(), "user");
    assertTrue(table.getFilters().isEmpty());
    assertEquals(table.getColumns().size(), 1);
    ColumnInfo column = table.getColumns().get(0);
    assertEquals(column.getColumn(), "linenumber");
    assertTrue(column.getMasks().isEmpty());
    List<RoutineInfo> routines = event.getMetadata().getRoutines();
    assertEquals(tables.size(), 1);
    RoutineInfo routine = routines.get(0);
    assertEquals(routine.getRoutine(), "sum");
    assertEquals(routine.getAuthorization(), "user");
}
Also used : QueryCompletedEvent(io.trino.spi.eventlistener.QueryCompletedEvent) ColumnInfo(io.trino.spi.eventlistener.ColumnInfo) TableInfo(io.trino.spi.eventlistener.TableInfo) RoutineInfo(io.trino.spi.eventlistener.RoutineInfo) Test(org.testng.annotations.Test)

Aggregations

ColumnInfo (io.trino.spi.eventlistener.ColumnInfo)6 QueryCompletedEvent (io.trino.spi.eventlistener.QueryCompletedEvent)6 TableInfo (io.trino.spi.eventlistener.TableInfo)6 Test (org.testng.annotations.Test)6 ColumnDetail (io.trino.spi.eventlistener.ColumnDetail)1 OutputColumnMetadata (io.trino.spi.eventlistener.OutputColumnMetadata)1 RoutineInfo (io.trino.spi.eventlistener.RoutineInfo)1