You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "charlesdong1991 (via GitHub)" <gi...@apache.org> on 2025/09/14 18:56:44 UTC
[PR] [FLINK-38319] Allow TO_TIMESTAMP_LTZ to accept expression in PyFlink [flink]
charlesdong1991 opened a new pull request, #26987:
URL: https://github.com/apache/flink/pull/26987
## What is the purpose of the change
This PR will fix the issue in PyFlink where to_timestamp_ltz only accepts literal values
--
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.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-38319][python] Allow TO_TIMESTAMP_LTZ to accept expression in PyFlink [flink]
Posted by "charlesdong1991 (via GitHub)" <gi...@apache.org>.
charlesdong1991 commented on code in PR #26987:
URL: https://github.com/apache/flink/pull/26987#discussion_r2354546771
##########
flink-python/pyflink/table/tests/test_expression.py:
##########
@@ -295,6 +295,12 @@ def test_expressions(self):
self.assertEqual("TO_TIMESTAMP_LTZ('2023-01-01 00:00:00', 'yyyy-MM-dd HH:mm:ss', 'UTC')",
str(to_timestamp_ltz("2023-01-01 00:00:00", "yyyy-MM-dd HH:mm:ss", "UTC")))
self.assertEqual("TO_TIMESTAMP_LTZ(123, 0)", str(to_timestamp_ltz(123, 0)))
+ self.assertEqual('TO_TIMESTAMP_LTZ(a)', str(to_timestamp_ltz(expr1))
Review Comment:
Thanks @davidradl when i tested locally, in PyFlink, cases such as expr1 (aka `to_timestamp_ltz (col(a))` ) will fail actually, and with the new change, it will work and return the right results given different input args.
WDYT?
--
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.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-38319][python] Allow TO_TIMESTAMP_LTZ to accept expression in PyFlink [flink]
Posted by "dianfu (via GitHub)" <gi...@apache.org>.
dianfu merged PR #26987:
URL: https://github.com/apache/flink/pull/26987
--
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.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-38319][python] Allow TO_TIMESTAMP_LTZ to accept expression in PyFlink [flink]
Posted by "davidradl (via GitHub)" <gi...@apache.org>.
davidradl commented on code in PR #26987:
URL: https://github.com/apache/flink/pull/26987#discussion_r2348339060
##########
flink-python/pyflink/table/tests/test_expression.py:
##########
@@ -295,6 +295,12 @@ def test_expressions(self):
self.assertEqual("TO_TIMESTAMP_LTZ('2023-01-01 00:00:00', 'yyyy-MM-dd HH:mm:ss', 'UTC')",
str(to_timestamp_ltz("2023-01-01 00:00:00", "yyyy-MM-dd HH:mm:ss", "UTC")))
self.assertEqual("TO_TIMESTAMP_LTZ(123, 0)", str(to_timestamp_ltz(123, 0)))
+ self.assertEqual('TO_TIMESTAMP_LTZ(a)', str(to_timestamp_ltz(expr1))
Review Comment:
I am curious, would these added tests would have failed before the fix? As the Lit function gets string input - which I would think it could cope with. By all means leave in these tests, but I think we should have more tests; I suggest including a test of the reported issue with col() which fails prior to the fix.
I suggest adding some tests where the function is not successful.
--
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.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-38319][python] Allow TO_TIMESTAMP_LTZ to accept expression in PyFlink [flink]
Posted by "charlesdong1991 (via GitHub)" <gi...@apache.org>.
charlesdong1991 commented on code in PR #26987:
URL: https://github.com/apache/flink/pull/26987#discussion_r2354546771
##########
flink-python/pyflink/table/tests/test_expression.py:
##########
@@ -295,6 +295,12 @@ def test_expressions(self):
self.assertEqual("TO_TIMESTAMP_LTZ('2023-01-01 00:00:00', 'yyyy-MM-dd HH:mm:ss', 'UTC')",
str(to_timestamp_ltz("2023-01-01 00:00:00", "yyyy-MM-dd HH:mm:ss", "UTC")))
self.assertEqual("TO_TIMESTAMP_LTZ(123, 0)", str(to_timestamp_ltz(123, 0)))
+ self.assertEqual('TO_TIMESTAMP_LTZ(a)', str(to_timestamp_ltz(expr1))
Review Comment:
Thanks @davidradl when i tested locally, in PyFlink, cases such as expr1 (aka `to_timestamp_ltz (col(a))` ) will fail actually, and with the new change, it will work and return the right results given different input args, so should be already covered in the test cases.
WDYT?
--
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.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-38319][python] Allow TO_TIMESTAMP_LTZ to accept expression in PyFlink [flink]
Posted by "dianfu (via GitHub)" <gi...@apache.org>.
dianfu commented on code in PR #26987:
URL: https://github.com/apache/flink/pull/26987#discussion_r2354155420
##########
flink-python/pyflink/table/tests/test_expression.py:
##########
@@ -295,6 +295,12 @@ def test_expressions(self):
self.assertEqual("TO_TIMESTAMP_LTZ('2023-01-01 00:00:00', 'yyyy-MM-dd HH:mm:ss', 'UTC')",
str(to_timestamp_ltz("2023-01-01 00:00:00", "yyyy-MM-dd HH:mm:ss", "UTC")))
self.assertEqual("TO_TIMESTAMP_LTZ(123, 0)", str(to_timestamp_ltz(123, 0)))
+ self.assertEqual('TO_TIMESTAMP_LTZ(a)', str(to_timestamp_ltz(expr1))
Review Comment:
I agree. What about adding a test case such as the following:
`self.assertEqual("TO_TIMESTAMP_LTZ(ts, 'yyyy-MM-dd HH:mm:ss')", str(to_timestamp_ltz(col("ts"), "yyyy-MM-dd HH:mm:ss")))`
--
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.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-38319][python] Allow TO_TIMESTAMP_LTZ to accept expression in PyFlink [flink]
Posted by "flinkbot (via GitHub)" <gi...@apache.org>.
flinkbot commented on PR #26987:
URL: https://github.com/apache/flink/pull/26987#issuecomment-3289793167
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "e76930f403f593758daa0f7d435d736109bb3a89",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "e76930f403f593758daa0f7d435d736109bb3a89",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* e76930f403f593758daa0f7d435d736109bb3a89 UNKNOWN
<details>
<summary>Bot commands</summary>
The @flinkbot bot supports the following commands:
- `@flinkbot run azure` re-run the last Azure build
</details>
--
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.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-38319][python] Allow TO_TIMESTAMP_LTZ to accept expression in PyFlink [flink]
Posted by "dianfu (via GitHub)" <gi...@apache.org>.
dianfu commented on code in PR #26987:
URL: https://github.com/apache/flink/pull/26987#discussion_r2354155420
##########
flink-python/pyflink/table/tests/test_expression.py:
##########
@@ -295,6 +295,12 @@ def test_expressions(self):
self.assertEqual("TO_TIMESTAMP_LTZ('2023-01-01 00:00:00', 'yyyy-MM-dd HH:mm:ss', 'UTC')",
str(to_timestamp_ltz("2023-01-01 00:00:00", "yyyy-MM-dd HH:mm:ss", "UTC")))
self.assertEqual("TO_TIMESTAMP_LTZ(123, 0)", str(to_timestamp_ltz(123, 0)))
+ self.assertEqual('TO_TIMESTAMP_LTZ(a)', str(to_timestamp_ltz(expr1))
Review Comment:
I agree. What about adding a test case such as the following:
`self.assertEqual("TO_TIMESTAMP_LTZ(ts, 'yyyy-MM-dd HH:mm:ss')", str(to_timestamp_ltz(col("ts"), "yyyy-MM-dd HH:mm:ss")))`
--
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.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org