Search in sources :

Example 16 with ModuleManager

use of org.apache.flink.table.module.ModuleManager in project zeppelin by apache.

the class TableEnvFactory method createJavaBlinkStreamTableEnvironment.

public TableEnvironment createJavaBlinkStreamTableEnvironment(EnvironmentSettings settings, ClassLoader classLoader) {
    try {
        ImmutablePair<Object, Object> pair = flinkShims.createPlannerAndExecutor(classLoader, settings, senv.getJavaEnv(), streamTableConfig, functionCatalog, catalogManager);
        Planner planner = (Planner) pair.left;
        Executor executor = (Executor) pair.right;
        Class clazz = Class.forName("org.apache.flink.table.api.bridge.java.internal.StreamTableEnvironmentImpl");
        try {
            Constructor constructor = clazz.getConstructor(CatalogManager.class, ModuleManager.class, FunctionCatalog.class, TableConfig.class, org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.class, Planner.class, Executor.class, boolean.class);
            return (TableEnvironment) constructor.newInstance(catalogManager, moduleManager, functionCatalog, streamTableConfig, senv.getJavaEnv(), planner, executor, settings.isStreamingMode());
        } catch (NoSuchMethodException e) {
            // Flink 1.11.1 change the constructor signature, FLINK-18419
            Constructor constructor = clazz.getConstructor(CatalogManager.class, ModuleManager.class, FunctionCatalog.class, TableConfig.class, org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.class, Planner.class, Executor.class, boolean.class, ClassLoader.class);
            return (TableEnvironment) constructor.newInstance(catalogManager, moduleManager, functionCatalog, streamTableConfig, senv.getJavaEnv(), planner, executor, settings.isStreamingMode(), classLoader);
        }
    } catch (Exception e) {
        throw new TableException("Fail to createJavaBlinkStreamTableEnvironment", e);
    }
}
Also used : FunctionCatalog(org.apache.flink.table.catalog.FunctionCatalog) TableException(org.apache.flink.table.api.TableException) Constructor(java.lang.reflect.Constructor) TableEnvironment(org.apache.flink.table.api.TableEnvironment) ModuleManager(org.apache.flink.table.module.ModuleManager) CatalogManager(org.apache.flink.table.catalog.CatalogManager) TableException(org.apache.flink.table.api.TableException) Executor(org.apache.flink.table.delegation.Executor) TableConfig(org.apache.flink.table.api.TableConfig) Planner(org.apache.flink.table.delegation.Planner) StreamExecutionEnvironment(org.apache.flink.streaming.api.environment.StreamExecutionEnvironment)

Aggregations

ModuleManager (org.apache.flink.table.module.ModuleManager)16 CatalogManager (org.apache.flink.table.catalog.CatalogManager)11 FunctionCatalog (org.apache.flink.table.catalog.FunctionCatalog)11 TableConfig (org.apache.flink.table.api.TableConfig)9 Executor (org.apache.flink.table.delegation.Executor)7 Planner (org.apache.flink.table.delegation.Planner)7 Constructor (java.lang.reflect.Constructor)5 StreamExecutionEnvironment (org.apache.flink.streaming.api.environment.StreamExecutionEnvironment)5 TableEnvironment (org.apache.flink.table.api.TableEnvironment)5 TableException (org.apache.flink.table.api.TableException)5 GenericInMemoryCatalog (org.apache.flink.table.catalog.GenericInMemoryCatalog)4 Test (org.junit.Test)4 ObjectReader (org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectReader)3 ObjectWriter (org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectWriter)3 FlinkContextImpl (org.apache.flink.table.planner.calcite.FlinkContextImpl)3 RexBuilder (org.apache.calcite.rex.RexBuilder)2 URLClassLoader (java.net.URLClassLoader)1 HashSet (java.util.HashSet)1 RexWindowBound (org.apache.calcite.rex.RexWindowBound)1 Configuration (org.apache.flink.configuration.Configuration)1