Search in sources :

Example 1 with PlannerFactory

use of org.apache.flink.table.delegation.PlannerFactory in project flink by apache.

the class PlannerFactoryUtil method createPlanner.

/**
 * Discovers a planner factory and creates a planner instance.
 */
public static Planner createPlanner(String plannerIdentifier, Executor executor, TableConfig tableConfig, ModuleManager moduleManager, CatalogManager catalogManager, FunctionCatalog functionCatalog) {
    final PlannerFactory plannerFactory = FactoryUtil.discoverFactory(Thread.currentThread().getContextClassLoader(), PlannerFactory.class, plannerIdentifier);
    final Context context = new DefaultPlannerContext(executor, tableConfig, moduleManager, catalogManager, functionCatalog);
    return plannerFactory.create(context);
}
Also used : Context(org.apache.flink.table.delegation.PlannerFactory.Context) DefaultPlannerContext(org.apache.flink.table.delegation.PlannerFactory.DefaultPlannerContext) DefaultPlannerContext(org.apache.flink.table.delegation.PlannerFactory.DefaultPlannerContext) PlannerFactory(org.apache.flink.table.delegation.PlannerFactory)

Example 2 with PlannerFactory

use of org.apache.flink.table.delegation.PlannerFactory in project flink by apache.

the class LoaderITCase method testPlannerFactory.

@Test
public void testPlannerFactory() {
    assertThat(DelegatePlannerFactory.class.getClassLoader().getResourceAsStream(FLINK_TABLE_PLANNER_FAT_JAR)).isNotNull();
    PlannerFactory plannerFactory = FactoryUtil.discoverFactory(LoaderITCase.class.getClassLoader(), PlannerFactory.class, PlannerFactory.DEFAULT_IDENTIFIER);
    assertThat(plannerFactory).isNotNull().isInstanceOf(DelegatePlannerFactory.class);
    assertThat(plannerFactory.factoryIdentifier()).isEqualTo(PlannerFactory.DEFAULT_IDENTIFIER);
}
Also used : PlannerFactory(org.apache.flink.table.delegation.PlannerFactory) Test(org.junit.jupiter.api.Test)

Aggregations

PlannerFactory (org.apache.flink.table.delegation.PlannerFactory)2 Context (org.apache.flink.table.delegation.PlannerFactory.Context)1 DefaultPlannerContext (org.apache.flink.table.delegation.PlannerFactory.DefaultPlannerContext)1 Test (org.junit.jupiter.api.Test)1