[
https://issues.apache.org/jira/browse/FLINK-30687?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
tanjialiang updated FLINK-30687:
--------------------------------
Description:
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.
was:
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.
> 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
> 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)