godfreyhe commented on a change in pull request #8984:
[FLINK-13088][table-api] Support lazy query transformation & execution on
TableEnvironment
URL: https://github.com/apache/flink/pull/8984#discussion_r300397588
##########
File path:
flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/TableEnvironmentImpl.java
##########
@@ -337,6 +362,47 @@ public TableConfig getConfig() {
return tableConfig;
}
+ @Override
+ public JobExecutionResult execute(String jobName) throws Exception {
+ translate(bufferedModifyOperations);
+ return execEnv.execute(jobName);
+ }
+
+ /**
+ * Defines the behavior of this {@link TableEnvironment}. If true the
queries will
+ * be translated immediately. If false the {@link ModifyOperation}s
will be buffered
+ * and translated only when {@link #execute(String)} is called.
+ *
+ * <p>If the {@link TableEnvironment} works in a lazy manner it is
undefined what
+ * configurations values will be used. It depends on the characteristic
of the particular
+ * parameter. Some might used values current to the time of query
construction (e.g. the currentCatalog)
+ * and some use values from the time when {@link #execute(String)} is
called (e.g. timeZone).
+ *
+ * @return true if the queries should be translated immediately.
+ */
+ protected boolean shouldTranslateEagerly() {
+ return false;
+ }
+
+ /**
+ * Subclasses can override this method to add additional checks.
+ *
+ * @param tableSource tableSource to validate
+ */
+ protected void validateTableSource(TableSource<?> tableSource) {
+ TableSourceValidation.validateTableSource(tableSource);
+ }
+
+ private void translate(List<ModifyOperation> modifyOperations) {
+ List<Transformation<?>> transformations =
planner.translate(modifyOperations);
Review comment:
will `translate` twice if `shouldTranslateEagerly` is true ?
----------------------------------------------------------------
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