Search in sources :

Example 1 with TestTableSource

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");
}
Also used : ObjectPath(org.apache.flink.table.catalog.ObjectPath) TestTableSource(org.apache.flink.table.planner.utils.TestTableSource) Test(org.junit.Test)

Example 2 with TestTableSource

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);
}
Also used : TestTableSource(org.apache.flink.table.planner.utils.TestTableSource) ResolvedCatalogTable(org.apache.flink.table.catalog.ResolvedCatalogTable) CatalogSchemaTable(org.apache.flink.table.planner.catalog.CatalogSchemaTable) Prepare(org.apache.calcite.prepare.Prepare) FlinkPreparingTableBase(org.apache.flink.table.planner.plan.schema.FlinkPreparingTableBase) ConnectorCatalogTable(org.apache.flink.table.catalog.ConnectorCatalogTable) CatalogTable(org.apache.flink.table.catalog.CatalogTable) ResolvedCatalogTable(org.apache.flink.table.catalog.ResolvedCatalogTable) ResolvedSchema(org.apache.flink.table.catalog.ResolvedSchema) ObjectIdentifier(org.apache.flink.table.catalog.ObjectIdentifier) Test(org.junit.Test)

Aggregations

TestTableSource (org.apache.flink.table.planner.utils.TestTableSource)2 Test (org.junit.Test)2 Prepare (org.apache.calcite.prepare.Prepare)1 CatalogTable (org.apache.flink.table.catalog.CatalogTable)1 ConnectorCatalogTable (org.apache.flink.table.catalog.ConnectorCatalogTable)1 ObjectIdentifier (org.apache.flink.table.catalog.ObjectIdentifier)1 ObjectPath (org.apache.flink.table.catalog.ObjectPath)1 ResolvedCatalogTable (org.apache.flink.table.catalog.ResolvedCatalogTable)1 ResolvedSchema (org.apache.flink.table.catalog.ResolvedSchema)1 CatalogSchemaTable (org.apache.flink.table.planner.catalog.CatalogSchemaTable)1 FlinkPreparingTableBase (org.apache.flink.table.planner.plan.schema.FlinkPreparingTableBase)1