tanjialiang created FLINK-30687: ----------------------------------- Summary: 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
When i try to using Flink SQL like this {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; {code} I found 'FILTER(WHERE class_id = 1)' is not effect. 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|(https://issues.apache.org/jira/browse/FLINK-27268]. Maybe you try this demo should cherry-pick this PR first. -- This message was sent by Atlassian Jira (v8.20.10#820010)