-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FLINK-35743][cdc-runtime] Fix the time zone configuration for temporal functions is not effective #3449
Conversation
@yuxiqian PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for @aiwenmo's quick fix! Just left some minor comments about test cases.
...rc/test/java/org/apache/flink/cdc/runtime/operators/transform/TransformDataOperatorTest.java
Show resolved
Hide resolved
...rc/test/java/org/apache/flink/cdc/runtime/operators/transform/TransformDataOperatorTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Pulled, tested locally and dateFormat
works as expected. cc @ruanhang1993
Considering this fixes timezone functions' incorrect behavior, should this be merged before 3.2 release? @leonardBang |
+1 to merge this before 3.2 release |
It's August 1st again and similar CI failure is observed on |
thx. I will add more test. |
Seems running tests between 00:00 ~ 08:00 UTC (08:00 ~ 16:00 UTC+08:00) on the first day of a month would trigger this problem. |
flink-cdc-runtime/src/main/java/org/apache/flink/cdc/runtime/functions/SystemFunctionUtils.java
Outdated
Show resolved
Hide resolved
flink-cdc-runtime/src/main/java/org/apache/flink/cdc/runtime/functions/SystemFunctionUtils.java
Outdated
Show resolved
Hide resolved
flink-cdc-runtime/src/main/java/org/apache/flink/cdc/runtime/functions/SystemFunctionUtils.java
Outdated
Show resolved
Hide resolved
8aef426
to
77e3b05
Compare
thx. I'm reviewing it. |
flink-cdc-runtime/src/main/java/org/apache/flink/cdc/runtime/parser/JaninoCompiler.java
Outdated
Show resolved
Hide resolved
flink-cdc-runtime/src/main/java/org/apache/flink/cdc/runtime/functions/SystemFunctionUtils.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for @leonardBang's great work! I just left some minor comments about argument list initialization.
flink-cdc-runtime/src/main/java/org/apache/flink/cdc/runtime/parser/JaninoCompiler.java
Outdated
Show resolved
Hide resolved
flink-cdc-runtime/src/main/java/org/apache/flink/cdc/runtime/parser/JaninoCompiler.java
Outdated
Show resolved
Hide resolved
flink-cdc-runtime/src/main/java/org/apache/flink/cdc/runtime/parser/JaninoCompiler.java
Outdated
Show resolved
Hide resolved
@yuxiqian Hi. I'm busy with other things. Could you add an e2e test for the temporal function?
I guess the data type generated by the temporal function modified by this PR may not match the Flink type in practical use. |
Sure, thanks for @aiwenmo's work so far, I'll create a patch for this. |
27d2f69
to
a06e06c
Compare
flink-cdc-runtime/src/test/java/org/apache/flink/cdc/runtime/parser/TransformParserTest.java
Outdated
Show resolved
Hide resolved
Seems
Investigating this... Update: Seems there's some conflicting function definitions among TransformSqlOperatorTable and SqlStdOperatorTable. Seems could be fixed by: Index: flink-cdc-runtime/src/main/java/org/apache/flink/cdc/runtime/parser/metadata/TransformSqlOperatorTable.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
import org.apache.calcite.sql.SqlKind;
import org.apache.calcite.sql.SqlOperator;
import org.apache.calcite.sql.SqlSyntax;
+import org.apache.calcite.sql.fun.SqlCurrentDateFunction;
import org.apache.calcite.sql.fun.SqlStdOperatorTable;
import org.apache.calcite.sql.type.InferTypes;
import org.apache.calcite.sql.type.OperandTypes;
@@ -86,11 +87,12 @@
.build();
public static final SqlFunction LOCALTIMESTAMP =
new BuiltInTimestampFunction("LOCALTIMESTAMP", SqlTypeName.TIMESTAMP, 3);
+ public static final SqlFunction CURRENT_TIME =
+ new BuiltInTimestampFunction("CURRENT_TIME", SqlTypeName.TIME, 0);
public static final SqlFunction CURRENT_TIMESTAMP =
new BuiltInTimestampFunction(
"CURRENT_TIMESTAMP", SqlTypeName.TIMESTAMP_WITH_LOCAL_TIME_ZONE, 3);
- public static final SqlFunction CURRENT_DATE =
- new BuiltInTimestampFunction("CURRENT_DATE", SqlTypeName.DATE, 0);
+ public static final SqlFunction CURRENT_DATE = new SqlCurrentDateFunction();
public static final SqlFunction NOW =
new BuiltInTimestampFunction("NOW", SqlTypeName.TIMESTAMP_WITH_LOCAL_TIME_ZONE, 3) {
@Override
and getting rid of SqlStdOperatorTable when parsing. |
I've added a draft integrated test case for this at my branch here, but noticed something strange. Run
(Pipeline local time zone was set to IIUC, |
It's expected as TIMESTAMP_LTZ type uses UTC0 timezone to get the string expression |
Seems CI is failing since ValuesDatabase is trying to deserialize every RecordData as STRINGs. Changes like yuxiqian@197819f#diff-901d80a3cf5b27fbd459d425310b5f27922d1963103b0f00dc58687f0440c24c might be necessary. |
cac651e
to
8b42db5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This closes apache#3449. Co-authored-by: wenmo <[email protected]> Co-authored-by: yuxiqian <[email protected]>
This closes FLINK-35743.