Constructor and Description |
---|
LocalExecutor(DefaultContext defaultContext)
Creates a local executor for submitting table programs and retrieving results.
|
Modifier and Type | Method and Description |
---|---|
void |
closeSession()
Close the resources of session for given session id.
|
List<String> |
completeStatement(String statement,
int position)
Returns a list of completion hints for the given statement at the given position.
|
TableResultInternal |
executeModifyOperations(List<ModifyOperation> operations)
Executes modify operations, and return
TableResult as execution result. |
TableResultInternal |
executeOperation(Operation operation)
Executes an operation, and return
TableResult as execution result. |
ResultDescriptor |
executeQuery(QueryOperation query)
Submits a Flink SQL query job (detached) and returns the result descriptor.
|
protected ExecutionContext |
getExecutionContext()
Get the existed
ExecutionContext from contextMap, or thrown exception if does not
exist. |
ReadableConfig |
getSessionConfig()
Returns a
ReadableConfig of all session configurations that are defined by the
executor and the session. |
Map<String,String> |
getSessionConfigMap()
Returns a copy of
Map of all session configurations that are defined by the executor
and the session. |
void |
openSession(String sessionId)
Open a new session by using the given session id.
|
Operation |
parseStatement(String statement)
Parse a SQL statement to
Operation . |
void |
removeJar(String jarUrl)
Remove the JAR resource from the classloader with specified session.
|
void |
resetSessionProperties()
Reset all the properties for the given session identifier.
|
void |
resetSessionProperty(String key)
Reset given key's the session property for default value, if key is not defined in config
file, then remove it.
|
void |
setSessionProperty(String key,
String value)
Set given key's session property to the specific value.
|
void |
start()
Starts the executor and ensures that its is ready for commands to be executed.
|
Optional<String> |
stopJob(String jobId,
boolean isWithSavepoint,
boolean isWithDrain)
Stops a job in the specified session.
|
public LocalExecutor(DefaultContext defaultContext)
public void start()
Executor
public void openSession(@Nullable String sessionId) throws SqlExecutionException
Executor
openSession
in interface Executor
sessionId
- session identifier.SqlExecutionException
- if any error happenpublic void closeSession() throws SqlExecutionException
Executor
closeSession
in interface Executor
SqlExecutionException
- if any error happen@VisibleForTesting protected ExecutionContext getExecutionContext() throws SqlExecutionException
ExecutionContext
from contextMap, or thrown exception if does not
exist.SqlExecutionException
public Map<String,String> getSessionConfigMap() throws SqlExecutionException
Executor
Map
of all session configurations that are defined by the executor
and the session.
Both this method and Executor.getSessionConfig()
return the same configuration set, but
different return type.
getSessionConfigMap
in interface Executor
SqlExecutionException
public ReadableConfig getSessionConfig() throws SqlExecutionException
Executor
ReadableConfig
of all session configurations that are defined by the
executor and the session.
Both this method and Executor.getSessionConfigMap()
return the same configuration set, but
different return type.
getSessionConfig
in interface Executor
SqlExecutionException
public void resetSessionProperties() throws SqlExecutionException
Executor
resetSessionProperties
in interface Executor
SqlExecutionException
- if any error happen.public void resetSessionProperty(String key) throws SqlExecutionException
Executor
resetSessionProperty
in interface Executor
key
- of need to reset the session propertySqlExecutionException
- if any error happen.public void setSessionProperty(String key, String value) throws SqlExecutionException
Executor
setSessionProperty
in interface Executor
key
- of the session propertyvalue
- of the session propertySqlExecutionException
- if any error happen.public Operation parseStatement(String statement) throws SqlExecutionException
Executor
Operation
.parseStatement
in interface Executor
SqlExecutionException
public List<String> completeStatement(String statement, int position)
Executor
completeStatement
in interface Executor
public TableResultInternal executeOperation(Operation operation) throws SqlExecutionException
Executor
TableResult
as execution result.executeOperation
in interface Executor
SqlExecutionException
public TableResultInternal executeModifyOperations(List<ModifyOperation> operations) throws SqlExecutionException
Executor
TableResult
as execution result.executeModifyOperations
in interface Executor
SqlExecutionException
public ResultDescriptor executeQuery(QueryOperation query) throws SqlExecutionException
Executor
executeQuery
in interface Executor
SqlExecutionException
public void removeJar(String jarUrl)
Executor
public Optional<String> stopJob(String jobId, boolean isWithSavepoint, boolean isWithDrain) throws SqlExecutionException
Executor
stopJob
in interface Executor
SqlExecutionException
Copyright © 2014–2023 The Apache Software Foundation. All rights reserved.