kylin-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alberto Ramón <a.ramonporto...@gmail.com>
Subject Re: Incorrect query result
Date Mon, 10 Oct 2016 18:16:34 GMT
can you try this
<http://apache-kylin.74782.x6.nabble.com/about-kylin-sql-key-words-IN-td5908.html>


BR, Alb

2016-10-10 16:30 GMT+02:00 Joel Victor <joelsvictor@gmail.com>:

> There are two columns in the table which are event date and event hour.
> I have attached the result and the plans for all three queries that I ran.
>
> The first query will *not* show the value for date 2016-09-28 and hour 0
> in the result
> The second query will show the value for date 2016-09-28 and hour 0 in the
> result
> The third query will also show the value for date 2016-09-28 and hour 0 in
> the result
> According to me the first query should also show the value for date
> 2016-09-28 and hour 0 in the result
>
> All the three queries look correct to me and their plans look correct as
> well.
> I would appreciate any help in debugging this.
>
> Following are the three queries:
>
> Query one:
> SELECT
>   event_date, event_hour, SUM(cnt)
> FROM analytics_issue_report
> WHERE ((((event_date IN ('2016-09-28')) AND event_hour = 0)
> OR ((event_date IN ('2016-09-28')) AND event_hour >= 1)
> OR ((event_date IN ('2016-10-04')) AND event_hour = 23)
> OR ((event_date IN ('2016-10-04')) AND event_hour < 23)
> OR event_date BETWEEN '2016-09-29' AND '2016-10-03')
> AND action_type=1)
> GROUP BY event_date, event_hour ORDER BY event_date, event_hour;
>
> Query two:
> SELECT
>   event_date, event_hour, SUM(cnt)
> FROM analytics_issue_report
> WHERE ((event_date BETWEEN '2016-09-28' AND '2016-10-04')
> AND action_type=1)
> GROUP BY event_date, event_hour ORDER BY event_date, event_hour;
>
> Query three:
> SELECT
>   event_date, event_hour, SUM(cnt)
> FROM analytics_issue_report
> WHERE ((((event_date IN ('2016-09-28')) AND event_hour <= 23)
> OR ((event_date IN ('2016-10-04')) AND event_hour = 23)
> OR ((event_date IN ('2016-10-04')) AND event_hour < 23)
> OR event_date BETWEEN '2016-09-29' AND '2016-10-03')
> AND action_type=1)
> GROUP BY event_date, event_hour ORDER BY event_date, event_hour;
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message