[
https://issues.apache.org/jira/browse/FLINK-22983?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17364179#comment-17364179
]
Maciej Bryński commented on FLINK-22983:
----------------------------------------
Hmmm... It's not working with Python UDF:
{code:java}
table_env.execute_sql("""
CREATE TABLE datagen (
id INT
) WITH (
'connector' = 'datagen',
'number-of-rows' = '10'
)
""")
table_env.execute_sql("""
CREATE TABLE IF NOT EXISTS print (
id INT
) WITH (
'connector' = 'print'
)
""")
@udf(result_type=DataTypes.BOOLEAN())
def trace(condition, message):
logging.warn(str(condition)+ str(message))
return condition
table_env.create_temporary_function("trace_python", trace)
result = table_env.execute_sql("""
INSERT INTO print
SELECT id FROM
datagen
where trace_python(true, id) OR trace_python(false, id)
""")
{code}
Result from logs:
{code:java}
2021-06-16 11:52:53,908 WARN <ipython-input-4-83901d47bacb>:3
[] - True-1137377863
2021-06-16 11:52:53,908 WARN <ipython-input-4-83901d47bacb>:3
[] - False-1137377863
2021-06-16 11:52:53,908 WARN <ipython-input-4-83901d47bacb>:3
[] - True-1350134520
2021-06-16 11:52:53,908 WARN <ipython-input-4-83901d47bacb>:3
[] - False-1350134520
2021-06-16 11:52:53,908 WARN <ipython-input-4-83901d47bacb>:3
[] - True709109306
2021-06-16 11:52:53,908 WARN <ipython-input-4-83901d47bacb>:3
[] - False709109306
2021-06-16 11:52:53,909 WARN <ipython-input-4-83901d47bacb>:3
[] - True2010777997
2021-06-16 11:52:53,909 WARN <ipython-input-4-83901d47bacb>:3
[] - False2010777997
2021-06-16 11:52:53,909 WARN <ipython-input-4-83901d47bacb>:3
[] - True1247695791
2021-06-16 11:52:53,909 WARN <ipython-input-4-83901d47bacb>:3
[] - False1247695791
2021-06-16 11:52:53,909 WARN <ipython-input-4-83901d47bacb>:3
[] - True-644149786
2021-06-16 11:52:53,909 WARN <ipython-input-4-83901d47bacb>:3
[] - False-644149786
2021-06-16 11:52:53,909 WARN <ipython-input-4-83901d47bacb>:3
[] - True1908143659
2021-06-16 11:52:53,909 WARN <ipython-input-4-83901d47bacb>:3
[] - False1908143659
2021-06-16 11:52:53,909 WARN <ipython-input-4-83901d47bacb>:3
[] - True923142768
2021-06-16 11:52:53,909 WARN <ipython-input-4-83901d47bacb>:3
[] - False923142768
2021-06-16 11:52:53,909 WARN <ipython-input-4-83901d47bacb>:3
[] - True64866625
2021-06-16 11:52:53,909 WARN <ipython-input-4-83901d47bacb>:3
[] - False64866625
2021-06-16 11:52:53,909 WARN <ipython-input-4-83901d47bacb>:3
[] - True-812929671
2021-06-16 11:52:53,909 WARN <ipython-input-4-83901d47bacb>:3
[] - False-812929671
{code}
Could you please tell how to get generated code ?
> Support lazy evaluation in Flink SQL
> ------------------------------------
>
> Key: FLINK-22983
> URL: https://issues.apache.org/jira/browse/FLINK-22983
> Project: Flink
> Issue Type: Bug
> Components: Table SQL / Runtime
> Affects Versions: 1.13.1
> Reporter: Maciej Bryński
> Priority: Major
>
> Currently when there is logical condition in Flink SQL we're calculating all
> arguments.
> Example:
> {code:java}
> SELECT n > 0 AND n > 100 {code}
> This will trigger both checks even when n > 0.
> Same for AND
> {code:java}
> SELECT n > 0 AND n > 100 {code}
> will trigger n > 100 check for n <= 0
>
> I think we should support lazy condition evaluation.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)