godfreyhe opened a new pull request #11794: [FLINK-17126] [table-planner] 
Correct the execution behavior of BatchTableEnvironment
URL: https://github.com/apache/flink/pull/11794
 
 
   
   ## What is the purpose of the change
   
   *In previous versions, BatchTableEnvironment.execute() can both trigger 
table and DataSet programs. For example:
   ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
   BatchTableEnvironment tableEnv = BatchTableEnvironment.create(env, new 
TableConfig());
   tEnv.sqlUpdate("INSERT INTO sink1 SELECT a, b FROM MyTable1");
   Table table = tEnv.sqlQuery("SELECT c, d from MyTable2");
   DataSet<Row> dataSet = tEnv.toDataSet(table, Row.class);
   dataSet...
   env.execute("job name");
   // or tEnv.execute("job name");
   // both env.execute and tEnv.execute can trigger the execution
   
   To correct current messy trigger point, we propose that: table programs can 
only be triggered by BatchTableEnvironment.execute(). Once table program is 
converted into DataSet program (through toDataSet() method), it can only be 
triggered by ExecutionEnvironment.execute()
   The example with new behavior:
   ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
   BatchTableEnvironment tableEnv = BatchTableEnvironment.create(env, new 
TableConfig());
   tEnv.sqlUpdate("INSERT INTO sink1 SELECT a, b FROM MyTable1");
   Table table = tEnv.sqlQuery("SELECT c, d from MyTable2");
   DataSet<Row> dataSet = tEnv.toDataSet(table, Row.class);
   dataSet...
   env.execute("job name") ; // only trigger the DataSet program
   tEnv.execute("job name"); // only trigger the sql update query program
   
   This issue is similar to FLINK-16363.*
   
   ## Brief change log
   
     - *Introduce CollectionPipelineExecutor for testing purpose through 
Executor*
     - *set `execution.target` and `execution.attached` in TestEnvironment for 
testing purpose through Executor*
     - *Correct the execution behavior of BatchTableEnvironment*
   
   
   ## Verifying this change
   
   This change added tests and can be verified as follows:
   - *Added CollectionExecutorTest to validate CollectionPipelineExecutor *
   - *Extended TableEnvironmentITCase to verify new execution behavior*
     
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): (yes / **no**)
     - The public API, i.e., is any changed class annotated with 
`@Public(Evolving)`: (yes / **no**)
     - The serializers: (yes / **no** / don't know)
     - The runtime per-record code paths (performance sensitive): (yes / **no** 
/ don't know)
     - Anything that affects deployment or recovery: JobManager (and its 
components), Checkpointing, Kubernetes/Yarn/Mesos, ZooKeeper: (yes / **no** / 
don't know)
     - The S3 file system connector: (yes / **no** / don't know)
   
   ## Documentation
   
     - Does this pull request introduce a new feature? (yes / no)
     - If yes, how is the feature documented? (not applicable / docs / JavaDocs 
/ **not documented**)
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to