use of org.apache.flink.table.api.TableException in project flink by apache.
the class PythonConfigUtil method getMergedConfig.
@SuppressWarnings("unchecked")
public static Configuration getMergedConfig(ExecutionEnvironment env, TableConfig tableConfig) {
try {
Field field = ExecutionEnvironment.class.getDeclaredField("cacheFile");
field.setAccessible(true);
Configuration config = new Configuration(env.getConfiguration());
PythonDependencyUtils.merge(config, tableConfig.getConfiguration());
Configuration mergedConfig = PythonDependencyUtils.configurePythonDependencies((List<Tuple2<String, DistributedCache.DistributedCacheEntry>>) field.get(env), config);
mergedConfig.setString("table.exec.timezone", tableConfig.getLocalTimeZone().getId());
return mergedConfig;
} catch (NoSuchFieldException | IllegalAccessException e) {
throw new TableException("Method getMergedConfig failed.", e);
}
}
use of org.apache.flink.table.api.TableException in project zeppelin by apache.
the class Flink113Shims method lookupExecutor.
private Object lookupExecutor(ClassLoader classLoader, Object settings, Object sEnv) {
try {
Map<String, String> executorProperties = ((EnvironmentSettings) settings).toExecutorProperties();
ExecutorFactory executorFactory = ComponentFactoryService.find(ExecutorFactory.class, executorProperties);
Method createMethod = executorFactory.getClass().getMethod("create", Map.class, StreamExecutionEnvironment.class);
return createMethod.invoke(executorFactory, executorProperties, sEnv);
} catch (Exception e) {
throw new TableException("Could not instantiate the executor. Make sure a planner module is on the classpath", e);
}
}
use of org.apache.flink.table.api.TableException in project zeppelin by apache.
the class Flink114Shims method lookupExecutor.
private Object lookupExecutor(ClassLoader classLoader, Object settings, Object sEnv) {
try {
final ExecutorFactory executorFactory = FactoryUtil.discoverFactory(classLoader, ExecutorFactory.class, ((EnvironmentSettings) settings).getExecutor());
final Method createMethod = executorFactory.getClass().getMethod("create", StreamExecutionEnvironment.class);
return createMethod.invoke(executorFactory, sEnv);
} catch (Exception e) {
throw new TableException("Could not instantiate the executor. Make sure a planner module is on the classpath", e);
}
}
use of org.apache.flink.table.api.TableException in project zeppelin by apache.
the class Flink112Shims method lookupExecutor.
private Object lookupExecutor(ClassLoader classLoader, Object settings, Object sEnv) {
try {
Map<String, String> executorProperties = ((EnvironmentSettings) settings).toExecutorProperties();
ExecutorFactory executorFactory = ComponentFactoryService.find(ExecutorFactory.class, executorProperties);
Method createMethod = executorFactory.getClass().getMethod("create", Map.class, StreamExecutionEnvironment.class);
return (Executor) createMethod.invoke(executorFactory, executorProperties, (StreamExecutionEnvironment) sEnv);
} catch (Exception e) {
throw new TableException("Could not instantiate the executor. Make sure a planner module is on the classpath", e);
}
}
use of org.apache.flink.table.api.TableException in project zeppelin by apache.
the class TableEnvFactory method createJavaFlinkBatchTableEnvironment.
public TableEnvironment createJavaFlinkBatchTableEnvironment() {
try {
Class<?> clazz = Class.forName("org.apache.flink.table.api.bridge.java.internal.BatchTableEnvironmentImpl");
Constructor con = clazz.getConstructor(ExecutionEnvironment.class, TableConfig.class, CatalogManager.class, ModuleManager.class);
return (TableEnvironment) con.newInstance(benv.getJavaEnv(), oldPlannerBatchTableConfig, oldPlannerCatalogManager, moduleManager);
} catch (Throwable t) {
throw new TableException("Create BatchTableEnvironment failed.", t);
}
}
Aggregations