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");
}
Aggregations