[
https://issues.apache.org/jira/browse/FLINK-30687?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17677694#comment-17677694
]
Martijn Visser commented on FLINK-30687:
----------------------------------------
[~TsReaper] I believe you know most about the codegen, could you have a look?
> FILTER not effect in count(*)
> -----------------------------
>
> Key: FLINK-30687
> URL: https://issues.apache.org/jira/browse/FLINK-30687
> Project: Flink
> Issue Type: Bug
> Components: Table SQL / Planner
> Affects Versions: 1.16.0
> Reporter: tanjialiang
> Priority: Major
> Attachments: image-2023-01-16-10-54-04-673.png
>
>
> When i try to using Flink SQL like this, i found 'FILTER(WHERE class_id = 1)'
> is not effect.
> {code:java}
> CREATE TABLE student
> (
> id INT NOT NULL,
> name STRING,
> class_id INT NOT NULL
> )
> WITH (
> 'connector' = 'jdbc',
> 'url' = 'jdbc:mysql://localhost:3306/test',
> 'table-name' = 'student',
> 'username' = 'root',
> 'password' = '12345678'
> );
> SELECT COUNT(*) FILTER (WHERE class_id = 1) FROM student;
> or
> SELECT COUNT(1) FILTER (WHERE class_id = 1) FROM student;{code}
>
> But when i tried Flink SQL like this, it worked.
> {code:java}
> SELECT COUNT(*) FROM student WHERE class_id = 1;
> or
> SELECT COUNT(class_id) FILTER (WHERE class_id = 1) FROM student;{code}
>
> By the way, mysql connector has a bug and fixed in FLINK-27268. Maybe you try
> this demo should cherry-pick this PR first.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)