use of org.apache.flink.table.module.ModuleManager in project zeppelin by apache.
the class TableEnvFactory method createScalaBlinkStreamTableEnvironment.
public TableEnvironment createScalaBlinkStreamTableEnvironment(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.scala.internal.StreamTableEnvironmentImpl");
try {
Constructor constructor = clazz.getConstructor(CatalogManager.class, ModuleManager.class, FunctionCatalog.class, TableConfig.class, org.apache.flink.streaming.api.scala.StreamExecutionEnvironment.class, Planner.class, Executor.class, boolean.class);
return (TableEnvironment) constructor.newInstance(catalogManager, moduleManager, functionCatalog, streamTableConfig, senv, 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.scala.StreamExecutionEnvironment.class, Planner.class, Executor.class, boolean.class, ClassLoader.class);
return (TableEnvironment) constructor.newInstance(catalogManager, moduleManager, functionCatalog, streamTableConfig, senv, planner, executor, settings.isStreamingMode(), classLoader);
}
} catch (Exception e) {
throw new TableException("Fail to createScalaBlinkStreamTableEnvironment", e);
}
}
use of org.apache.flink.table.module.ModuleManager in project flink by apache.
the class FunctionCatalogTest method init.
@Before
public void init() {
catalog = new GenericInMemoryCatalog(DEFAULT_CATALOG, DEFAULT_DATABASE);
moduleManager = new ModuleManager();
functionCatalog = new FunctionCatalog(TableConfig.getDefault(), CatalogManagerMocks.preparedCatalogManager().defaultCatalog(DEFAULT_CATALOG, catalog).build(), moduleManager);
}
use of org.apache.flink.table.module.ModuleManager in project flink by apache.
the class FunctionCatalogTest method testGetBuiltInFunctions.
@Test
public void testGetBuiltInFunctions() {
Set<String> actual = new HashSet<>();
Collections.addAll(actual, functionCatalog.getFunctions());
Set<String> expected = new ModuleManager().listFunctions();
assertThat(actual.containsAll(expected)).isTrue();
}
use of org.apache.flink.table.module.ModuleManager in project flink by apache.
the class TableEnvironmentMock method getInstance.
private static TableEnvironmentMock getInstance(boolean isStreamingMode) {
final TableConfig tableConfig = createTableConfig();
final CatalogManager catalogManager = CatalogManagerMocks.createEmptyCatalogManager();
final ModuleManager moduleManager = new ModuleManager();
return new TableEnvironmentMock(catalogManager, moduleManager, tableConfig, createExecutor(), createFunctionCatalog(tableConfig, catalogManager, moduleManager), createPlanner(), isStreamingMode);
}
use of org.apache.flink.table.module.ModuleManager in project flink by apache.
the class TableEnvironmentImpl method create.
private static TableEnvironmentImpl create(EnvironmentSettings settings, Configuration configuration) {
// temporary solution until FLINK-15635 is fixed
final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
// use configuration to init table config
final TableConfig tableConfig = new TableConfig();
tableConfig.addConfiguration(configuration);
final ModuleManager moduleManager = new ModuleManager();
final CatalogManager catalogManager = CatalogManager.newBuilder().classLoader(classLoader).config(tableConfig.getConfiguration()).defaultCatalog(settings.getBuiltInCatalogName(), new GenericInMemoryCatalog(settings.getBuiltInCatalogName(), settings.getBuiltInDatabaseName())).build();
final FunctionCatalog functionCatalog = new FunctionCatalog(tableConfig, catalogManager, moduleManager);
final ExecutorFactory executorFactory = FactoryUtil.discoverFactory(classLoader, ExecutorFactory.class, settings.getExecutor());
final Executor executor = executorFactory.create(configuration);
final Planner planner = PlannerFactoryUtil.createPlanner(settings.getPlanner(), executor, tableConfig, moduleManager, catalogManager, functionCatalog);
return new TableEnvironmentImpl(catalogManager, moduleManager, tableConfig, executor, functionCatalog, planner, settings.isStreamingMode(), classLoader);
}
Aggregations