Search in sources :

Example 26 with CatalogManager

use of org.apache.flink.table.catalog.CatalogManager in project flink by apache.

the class DatabaseCalciteSchemaTest method testTemporaryTableWithPrimaryKey.

@Test
public void testTemporaryTableWithPrimaryKey() {
    final CatalogManager catalogManager = CatalogManagerMocks.createEmptyCatalogManager();
    final DatabaseCalciteSchema calciteSchema = new DatabaseCalciteSchema("other_catalog", "other_database", catalogManager, true);
    catalogManager.createTemporaryTable(createTable(), ObjectIdentifier.of("other_catalog", "other_database", TABLE_NAME), false);
    final Table table = calciteSchema.getTable(TABLE_NAME);
    assertThat(table, instanceOf(CatalogSchemaTable.class));
    assertThat(((CatalogSchemaTable) table).getStatistic().getUniqueKeys().iterator().next(), containsInAnyOrder("a", "b"));
}
Also used : CatalogTable(org.apache.flink.table.catalog.CatalogTable) Table(org.apache.calcite.schema.Table) CatalogBaseTable(org.apache.flink.table.catalog.CatalogBaseTable) CatalogManager(org.apache.flink.table.catalog.CatalogManager) Test(org.junit.Test)

Aggregations

CatalogManager (org.apache.flink.table.catalog.CatalogManager)26 TableConfig (org.apache.flink.table.api.TableConfig)13 ModuleManager (org.apache.flink.table.module.ModuleManager)13 FunctionCatalog (org.apache.flink.table.catalog.FunctionCatalog)12 Executor (org.apache.flink.table.delegation.Executor)8 Planner (org.apache.flink.table.delegation.Planner)8 StreamExecutionEnvironment (org.apache.flink.streaming.api.environment.StreamExecutionEnvironment)6 TableException (org.apache.flink.table.api.TableException)6 GenericInMemoryCatalog (org.apache.flink.table.catalog.GenericInMemoryCatalog)6 ObjectIdentifier (org.apache.flink.table.catalog.ObjectIdentifier)6 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)6 Constructor (java.lang.reflect.Constructor)5 Configuration (org.apache.flink.configuration.Configuration)5 TableEnvironment (org.apache.flink.table.api.TableEnvironment)5 ValidationException (org.apache.flink.table.api.ValidationException)5 JsonSerdeTestUtil.configuredSerdeContext (org.apache.flink.table.planner.plan.nodes.exec.serde.JsonSerdeTestUtil.configuredSerdeContext)5 HashMap (java.util.HashMap)4 CatalogTable (org.apache.flink.table.catalog.CatalogTable)4 ContextResolvedTable (org.apache.flink.table.catalog.ContextResolvedTable)4 ResolvedCatalogTable (org.apache.flink.table.catalog.ResolvedCatalogTable)4