[ 
https://issues.apache.org/jira/browse/FLINK-30687?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

lincoln lee resolved FLINK-30687.
---------------------------------
    Resolution: Fixed

Fixed in master: 3891fe8c13dd905033ea6ac08f2b4806302628aa

> 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: 2.0.0, 1.19.2, 1.20.1
>            Reporter: tanjialiang
>            Assignee: lincoln lee
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.19.3, 1.20.2, 2.1.0
>
>         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 
> https://issues.apache.org/jira/browse/FLINK-29558. Maybe you try this demo 
> should cherry-pick this PR first.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to