drill-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jacques Nadeau (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (DRILL-1868) Filtering on an alias should return an error, user gets wrong result instead
Date Mon, 15 Dec 2014 18:37:13 GMT

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

Jacques Nadeau updated DRILL-1868:
----------------------------------
    Description: 
git.commit.id.abbrev=c65928f
{code}
0: jdbc:drill:schema=dfs> select * from `test.json`;
+------------+------------+
| eventdate  |    sold    |
+------------+------------+
| 2014-01-01 | 100        |
| 2014-01-01 | 100        |
| 2014-02-01 | 200        |
+------------+------------+
3 rows selected (0.099 seconds)
 
 
0: jdbc:drill:schema=dfs> -- Correct result
0: jdbc:drill:schema=dfs> SELECT
. . . . . . . . . . . . >                 extract( month from eventdate ) as `month`,
. . . . . . . . . . . . >                 extract( year  from eventdate ) as `year`
. . . . . . . . . . . . > 
. . . . . . . . . . . . > FROM            `test.json`
. . . . . . . . . . . . > WHERE           extract( month from eventdate ) IS NOT NULL;
+------------+------------+
|   month    |    year    |
+------------+------------+
| 1          | 2014       |
| 1          | 2014       |
| 2          | 2014       |
+------------+------------+
3 rows selected (0.074 seconds)


0: jdbc:drill:schema=dfs> -- Wrong result, should throw an error
0: jdbc:drill:schema=dfs> SELECT
. . . . . . . . . . . . >                 extract( month from eventdate ) as `month`,
. . . . . . . . . . . . >                 extract( year  from eventdate ) as `year`
. . . . . . . . . . . . > 
. . . . . . . . . . . . > FROM            `test.json`
. . . . . . . . . . . . > WHERE           `month` IS NOT NULL;
+------------+------------+
|   month    |    year    |
+------------+------------+
+------------+------------+
No rows selected (0.079 seconds)
 
0: jdbc:drill:schema=dfs> -- Wrong result, should throw an error
0: jdbc:drill:schema=dfs> SELECT
. . . . . . . . . . . . >                 extract( month from eventdate ) as xyz,
. . . . . . . . . . . . >                 extract( year  from eventdate ) as `year`
. . . . . . . . . . . . > 
. . . . . . . . . . . . > FROM            `test.json`
. . . . . . . . . . . . > WHERE           xyz IS NOT NULL;
+------------+------------+
|    xyz     |    year    |
+------------+------------+
+------------+------------+
No rows selected (0.073 seconds)
 
 
0: jdbc:drill:schema=dfs> -- Correct result
0: jdbc:drill:schema=dfs> SELECT *
. . . . . . . . . . . . > FROM
. . . . . . . . . . . . >         (
. . . . . . . . . . . . >         SELECT
. . . . . . . . . . . . >                 extract( month from eventdate ) as `month`,
. . . . . . . . . . . . >                 extract( year  from eventdate ) as `year`
. . . . . . . . . . . . > 
. . . . . . . . . . . . >         FROM    `test.json`
. . . . . . . . . . . . >         WHERE           `month` IS NULL
. . . . . . . . . . . . >         )
. . . . . . . . . . . . > WHERE `month` IS NOT NULL;
+------------+------------+
|   month    |    year    |
+------------+------------+
| 1          | 2014       |
| 1          | 2014       |
| 2          | 2014       |
+------------+------------+
3 rows selected (0.099 seconds)
{code}

  was:
git.commit.id.abbrev=c65928f

0: jdbc:drill:schema=dfs> select * from `test.json`;
+------------+------------+
| eventdate  |    sold    |
+------------+------------+
| 2014-01-01 | 100        |
| 2014-01-01 | 100        |
| 2014-02-01 | 200        |
+------------+------------+
3 rows selected (0.099 seconds)
 
 
0: jdbc:drill:schema=dfs> -- Correct result
0: jdbc:drill:schema=dfs> SELECT
. . . . . . . . . . . . >                 extract( month from eventdate ) as `month`,
. . . . . . . . . . . . >                 extract( year  from eventdate ) as `year`
. . . . . . . . . . . . > 
. . . . . . . . . . . . > FROM            `test.json`
. . . . . . . . . . . . > WHERE           extract( month from eventdate ) IS NOT NULL;
+------------+------------+
|   month    |    year    |
+------------+------------+
| 1          | 2014       |
| 1          | 2014       |
| 2          | 2014       |
+------------+------------+
3 rows selected (0.074 seconds)


0: jdbc:drill:schema=dfs> -- Wrong result, should throw an error
0: jdbc:drill:schema=dfs> SELECT
. . . . . . . . . . . . >                 extract( month from eventdate ) as `month`,
. . . . . . . . . . . . >                 extract( year  from eventdate ) as `year`
. . . . . . . . . . . . > 
. . . . . . . . . . . . > FROM            `test.json`
. . . . . . . . . . . . > WHERE           `month` IS NOT NULL;
+------------+------------+
|   month    |    year    |
+------------+------------+
+------------+------------+
No rows selected (0.079 seconds)
 
0: jdbc:drill:schema=dfs> -- Wrong result, should throw an error
0: jdbc:drill:schema=dfs> SELECT
. . . . . . . . . . . . >                 extract( month from eventdate ) as xyz,
. . . . . . . . . . . . >                 extract( year  from eventdate ) as `year`
. . . . . . . . . . . . > 
. . . . . . . . . . . . > FROM            `test.json`
. . . . . . . . . . . . > WHERE           xyz IS NOT NULL;
+------------+------------+
|    xyz     |    year    |
+------------+------------+
+------------+------------+
No rows selected (0.073 seconds)
 
 
0: jdbc:drill:schema=dfs> -- Correct result
0: jdbc:drill:schema=dfs> SELECT *
. . . . . . . . . . . . > FROM
. . . . . . . . . . . . >         (
. . . . . . . . . . . . >         SELECT
. . . . . . . . . . . . >                 extract( month from eventdate ) as `month`,
. . . . . . . . . . . . >                 extract( year  from eventdate ) as `year`
. . . . . . . . . . . . > 
. . . . . . . . . . . . >         FROM    `test.json`
. . . . . . . . . . . . >         WHERE           `month` IS NULL
. . . . . . . . . . . . >         )
. . . . . . . . . . . . > WHERE `month` IS NOT NULL;
+------------+------------+
|   month    |    year    |
+------------+------------+
| 1          | 2014       |
| 1          | 2014       |
| 2          | 2014       |
+------------+------------+
3 rows selected (0.099 seconds)



> Filtering on an alias should return an error, user  gets wrong result instead
> -----------------------------------------------------------------------------
>
>                 Key: DRILL-1868
>                 URL: https://issues.apache.org/jira/browse/DRILL-1868
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: SQL Parser
>            Reporter: Victoria Markman
>
> git.commit.id.abbrev=c65928f
> {code}
> 0: jdbc:drill:schema=dfs> select * from `test.json`;
> +------------+------------+
> | eventdate  |    sold    |
> +------------+------------+
> | 2014-01-01 | 100        |
> | 2014-01-01 | 100        |
> | 2014-02-01 | 200        |
> +------------+------------+
> 3 rows selected (0.099 seconds)
>  
>  
> 0: jdbc:drill:schema=dfs> -- Correct result
> 0: jdbc:drill:schema=dfs> SELECT
> . . . . . . . . . . . . >                 extract( month from eventdate ) as `month`,
> . . . . . . . . . . . . >                 extract( year  from eventdate ) as `year`
> . . . . . . . . . . . . > 
> . . . . . . . . . . . . > FROM            `test.json`
> . . . . . . . . . . . . > WHERE           extract( month from eventdate ) IS NOT NULL;
> +------------+------------+
> |   month    |    year    |
> +------------+------------+
> | 1          | 2014       |
> | 1          | 2014       |
> | 2          | 2014       |
> +------------+------------+
> 3 rows selected (0.074 seconds)
> 0: jdbc:drill:schema=dfs> -- Wrong result, should throw an error
> 0: jdbc:drill:schema=dfs> SELECT
> . . . . . . . . . . . . >                 extract( month from eventdate ) as `month`,
> . . . . . . . . . . . . >                 extract( year  from eventdate ) as `year`
> . . . . . . . . . . . . > 
> . . . . . . . . . . . . > FROM            `test.json`
> . . . . . . . . . . . . > WHERE           `month` IS NOT NULL;
> +------------+------------+
> |   month    |    year    |
> +------------+------------+
> +------------+------------+
> No rows selected (0.079 seconds)
>  
> 0: jdbc:drill:schema=dfs> -- Wrong result, should throw an error
> 0: jdbc:drill:schema=dfs> SELECT
> . . . . . . . . . . . . >                 extract( month from eventdate ) as xyz,
> . . . . . . . . . . . . >                 extract( year  from eventdate ) as `year`
> . . . . . . . . . . . . > 
> . . . . . . . . . . . . > FROM            `test.json`
> . . . . . . . . . . . . > WHERE           xyz IS NOT NULL;
> +------------+------------+
> |    xyz     |    year    |
> +------------+------------+
> +------------+------------+
> No rows selected (0.073 seconds)
>  
>  
> 0: jdbc:drill:schema=dfs> -- Correct result
> 0: jdbc:drill:schema=dfs> SELECT *
> . . . . . . . . . . . . > FROM
> . . . . . . . . . . . . >         (
> . . . . . . . . . . . . >         SELECT
> . . . . . . . . . . . . >                 extract( month from eventdate ) as `month`,
> . . . . . . . . . . . . >                 extract( year  from eventdate ) as `year`
> . . . . . . . . . . . . > 
> . . . . . . . . . . . . >         FROM    `test.json`
> . . . . . . . . . . . . >         WHERE           `month` IS NULL
> . . . . . . . . . . . . >         )
> . . . . . . . . . . . . > WHERE `month` IS NOT NULL;
> +------------+------------+
> |   month    |    year    |
> +------------+------------+
> | 1          | 2014       |
> | 1          | 2014       |
> | 2          | 2014       |
> +------------+------------+
> 3 rows selected (0.099 seconds)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message