Search in sources :

Example 11 with EnvironmentSettings

use of org.apache.flink.table.api.EnvironmentSettings 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);
    }
}
Also used : EnvironmentSettings(org.apache.flink.table.api.EnvironmentSettings) TableException(org.apache.flink.table.api.TableException) ExecutorFactory(org.apache.flink.table.delegation.ExecutorFactory) AttributedString(org.jline.utils.AttributedString) Method(java.lang.reflect.Method) FlinkException(org.apache.flink.util.FlinkException) TableException(org.apache.flink.table.api.TableException) IOException(java.io.IOException)

Example 12 with EnvironmentSettings

use of org.apache.flink.table.api.EnvironmentSettings in project zeppelin by apache.

the class Flink114Shims method createPlannerAndExecutor.

@Override
public ImmutablePair<Object, Object> createPlannerAndExecutor(ClassLoader classLoader, Object environmentSettings, Object sEnv, Object tableConfig, Object functionCatalog, Object catalogManager) {
    EnvironmentSettings settings = (EnvironmentSettings) environmentSettings;
    Executor executor = (Executor) lookupExecutor(classLoader, environmentSettings, sEnv);
    Planner planner = PlannerFactoryUtil.createPlanner(settings.getPlanner(), executor, (TableConfig) tableConfig, (CatalogManager) catalogManager, (FunctionCatalog) functionCatalog);
    return ImmutablePair.of(planner, executor);
}
Also used : EnvironmentSettings(org.apache.flink.table.api.EnvironmentSettings) Executor(org.apache.flink.table.delegation.Executor) Planner(org.apache.flink.table.delegation.Planner)

Example 13 with EnvironmentSettings

use of org.apache.flink.table.api.EnvironmentSettings 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);
    }
}
Also used : EnvironmentSettings(org.apache.flink.table.api.EnvironmentSettings) TableException(org.apache.flink.table.api.TableException) Executor(org.apache.flink.table.delegation.Executor) ExecutorFactory(org.apache.flink.table.delegation.ExecutorFactory) StreamExecutionEnvironment(org.apache.flink.streaming.api.environment.StreamExecutionEnvironment) AttributedString(org.jline.utils.AttributedString) Method(java.lang.reflect.Method) FlinkException(org.apache.flink.util.FlinkException) TableException(org.apache.flink.table.api.TableException) IOException(java.io.IOException)

Example 14 with EnvironmentSettings

use of org.apache.flink.table.api.EnvironmentSettings in project flink by apache.

the class CatalogITCase method getTableEnvironment.

private TableEnvironment getTableEnvironment() {
    EnvironmentSettings settings = EnvironmentSettings.newInstance().inStreamingMode().build();
    StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
    return StreamTableEnvironment.create(env, settings);
}
Also used : EnvironmentSettings(org.apache.flink.table.api.EnvironmentSettings) StreamExecutionEnvironment(org.apache.flink.streaming.api.environment.StreamExecutionEnvironment)

Example 15 with EnvironmentSettings

use of org.apache.flink.table.api.EnvironmentSettings in project flink by apache.

the class CatalogConstraintTest method setup.

@Before
public void setup() {
    EnvironmentSettings settings = EnvironmentSettings.newInstance().inBatchMode().build();
    tEnv = TableEnvironment.create(settings);
    catalog = tEnv.getCatalog(tEnv.getCurrentCatalog()).orElse(null);
    assertNotNull(catalog);
}
Also used : EnvironmentSettings(org.apache.flink.table.api.EnvironmentSettings) Before(org.junit.Before)

Aggregations

EnvironmentSettings (org.apache.flink.table.api.EnvironmentSettings)16 TableEnvironment (org.apache.flink.table.api.TableEnvironment)6 Executor (org.apache.flink.table.delegation.Executor)5 AttributedString (org.jline.utils.AttributedString)4 StreamExecutionEnvironment (org.apache.flink.streaming.api.environment.StreamExecutionEnvironment)3 TableException (org.apache.flink.table.api.TableException)3 Planner (org.apache.flink.table.delegation.Planner)3 IOException (java.io.IOException)2 Method (java.lang.reflect.Method)2 Table (org.apache.flink.table.api.Table)2 ExecutorFactory (org.apache.flink.table.delegation.ExecutorFactory)2 PlannerFactory (org.apache.flink.table.delegation.PlannerFactory)2 Row (org.apache.flink.types.Row)2 FlinkException (org.apache.flink.util.FlinkException)2 Before (org.junit.Before)2 URLClassLoader (java.net.URLClassLoader)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 Configuration (org.apache.flink.configuration.Configuration)1 TableConfig (org.apache.flink.table.api.TableConfig)1