use of org.apache.flink.table.planner.utils.TestTableSource in project flink by apache.
the class CatalogStatisticsTest method testGetStatsFromCatalogForConnectorCatalogTable.
@Test
public void testGetStatsFromCatalogForConnectorCatalogTable() throws Exception {
catalog.createTable(new ObjectPath(databaseName, "T1"), ConnectorCatalogTable.source(new TestTableSource(true, tableSchema), true), false);
catalog.createTable(new ObjectPath(databaseName, "T2"), ConnectorCatalogTable.source(new TestTableSource(true, tableSchema), true), false);
alterTableStatistics(catalog, "T1");
assertStatistics(tEnv, "T1");
alterTableStatisticsWithUnknownRowCount(catalog, "T2");
assertTableStatisticsWithUnknownRowCount(tEnv, "T2");
}
use of org.apache.flink.table.planner.utils.TestTableSource in project flink by apache.
the class FlinkCalciteCatalogReaderTest method testGetFlinkPreparingTableBase.
@Test
public void testGetFlinkPreparingTableBase() {
// Mock CatalogSchemaTable.
final ObjectIdentifier objectIdentifier = ObjectIdentifier.of("a", "b", "c");
final ResolvedSchema schema = new ResolvedSchema(Collections.emptyList(), Collections.emptyList(), null);
final CatalogTable catalogTable = ConnectorCatalogTable.source(new TestTableSource(true, TableSchema.fromResolvedSchema(schema)), true);
final ResolvedCatalogTable resolvedCatalogTable = new ResolvedCatalogTable(catalogTable, schema);
CatalogSchemaTable mockTable = new CatalogSchemaTable(ContextResolvedTable.permanent(objectIdentifier, CatalogManagerMocks.createEmptyCatalog(), resolvedCatalogTable), FlinkStatistic.UNKNOWN(), true);
rootSchemaPlus.add(tableMockName, mockTable);
Prepare.PreparingTable preparingTable = catalogReader.getTable(Collections.singletonList(tableMockName));
assertTrue(preparingTable instanceof FlinkPreparingTableBase);
}
Aggregations