You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Ashutosh Chauhan (JIRA)" <ji...@apache.org> on 2015/02/02 22:35:34 UTC

[jira] [Commented] (HIVE-9397) SELECT max(bar) FROM foo is broken after ANALYZE ... FOR COLUMNS

    [ https://issues.apache.org/jira/browse/HIVE-9397?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14301974#comment-14301974 ] 

Ashutosh Chauhan commented on HIVE-9397:
----------------------------------------

I agree. StatsOptimizer shouldn't try to build and provide schema. After the good work by [~jcamachorodriguez] on HIVE-9327 we are guaranteed to have a valid Row Schema with any operator at any point in query compilation. So, stats optimizer can just Row Schema of FileSink Op of matched tree to infer return schema, instead of building one itself.  If we do that, than we can eliminate family of bugs like this. [~navis] would you like to do that? Alternatively, we can check in this patch and take on the improvement in a follow-up jira.

> SELECT max(bar) FROM foo is broken after ANALYZE ... FOR COLUMNS
> ----------------------------------------------------------------
>
>                 Key: HIVE-9397
>                 URL: https://issues.apache.org/jira/browse/HIVE-9397
>             Project: Hive
>          Issue Type: Bug
>          Components: Beeline
>    Affects Versions: 0.14.0, 0.15.0
>            Reporter: Damien Carol
>            Assignee: Navis
>         Attachments: HIVE-9397.1.patch.txt
>
>
> These queries produce an error :
> {code:sql}
> DROP TABLE IF EXISTS foo;
> CREATE TABLE foo (id int) STORED AS ORC;
> INSERT INTO TABLE foo VALUES (1);
> INSERT INTO TABLE foo VALUES (2);
> INSERT INTO TABLE foo VALUES (3);
> INSERT INTO TABLE foo VALUES (4);
> INSERT INTO TABLE foo VALUES (5);
> SELECT max(id) FROM foo;
> ANALYZE TABLE foo COMPUTE STATISTICS FOR COLUMNS id;
> SELECT max(id) FROM foo;
> {code}
> The last query throws {{org.apache.hive.service.cli.HiveSQLException}}
> {noformat}
> 0: jdbc:hive2://nc-h04:10000/casino> SELECT max(id) FROM foo;
> +-------------+--+
> |     _c0     |
> +-------------+--+
> org.apache.hive.service.cli.HiveSQLException: java.lang.ClassCastException
> 0: jdbc:hive2://nc-h04:10000/casino>
> {noformat}



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