[
https://issues.apache.org/jira/browse/FLINK-17868?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17258187#comment-17258187
]
Qingyue commented on FLINK-17868:
---------------------------------
Hi [~jark] and [~lzljs3620320], I'm interested in this issue and want to have a
try.
I came up with three possible solutions and listed the proposed and rejected
alternatives and want to hear your opinions. Please correct me if I'm wrong.
h3. Proposed plan
Introduce a new rule and program to `FlinkBatchProgram` to rewrite `PROCTIME()`
to `CURRENT_TIMESTAMP()` at planning phase.
h3. Alternative plans
1. Introduce `FlinkBatchProgram` to `FlinkRelTimeIndicatorProgram` (i.e. reuse
`RelTimeIndicatorConveter`) and rewrite `PROCTIME ` to `PROCTIME_MATERIALIZE `
during planning phase.
* Pro: translated batch plan is same as stream plan `Calc(select=[a, c,
PROCTIME_MATERIALIZE(PROCTIME()) AS EXPR$2])`.
* Con: `PROCTIME_MATERIALIZE ` is transformed to process function
of`AbstractProcessStreamOperator`, which introduces `ctx.timerService()`. While
`BatchExecCalc` uses `TableStreamOperator` as operator base class, it causes
the generated code to fail to compile. To solve this, either modify the codegen
logic to avoid using `timerService` for batch or move `ctx` from
`AbstractProcessStreamOperator` to its parent `TableStreamOperator`.
2. We don't change the current plan(i.e., `Calc(select=[a, c, PROCTIME() AS
EXPR$2]` remains unchanged). Instead, we modify the codegen logic at the
transformation phase. We add a check on `PROCTIME` when
`ExprCodeGenerator#generateCallExpression` is called, and if it's a batch
transformation, we generate `currentTimestamp` directly.
* Pro: the modified scope is limited to a minimum.
* Con: It may not be proper to distinguish stream vs. batch during the
transformation phase.
Thanks, Qingyue.
> Proctime in DDL can not work in batch mode
> ------------------------------------------
>
> Key: FLINK-17868
> URL: https://issues.apache.org/jira/browse/FLINK-17868
> Project: Flink
> Issue Type: Bug
> Components: Table SQL / Planner
> Reporter: Jingsong Lee
> Priority: Major
> Labels: sprint
> Fix For: 1.13.0
>
>
> The data of this proctime column will be all null. Should same to current
> timestamp.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)