hadoop-hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "S. Alex Smith (JIRA)" <j...@apache.org>
Subject [jira] Updated: (HIVE-297) Parses doesn't catch certain type errors.
Date Sun, 22 Feb 2009 09:13:02 GMT

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

S. Alex Smith updated HIVE-297:
-------------------------------

    Description: 
The following query:

FROM (
    FROM (FROM my_table
         SELECT CAST(userid AS BIGINT) AS userid a
   SELECT userid
   UNION ALL
   FROM (FROM my_table
         SELECT CAST(userid AS STRING) AS userid) b
   SELECT userid
   ) unioned
   SELECT DISTINCT userid;

Is accepted by the parse, but throws the following at run-time:
java.lang.RuntimeException: org.apache.hadoop.hive.serde2.SerDeException: java.lang.ClassCastException:
java.lang.Long cannot be cast to java.lang.String

(Note that this seems less silly if the inner queries are different tables with userid stored
as a bigint and a string, respectively)

I have interpreted this as a bug in the parser, but it could also be viewed as a bug about
not auto-casting.

This can be worked around by using explicit CAST statements.

  was:
If table_a and table_c have schemas:
 userid bigint

and table_b has a schema:
  userid string

Then the following with make it through the parser, but will fail when running:

FROM (
    FROM table_a
    SELECT userid
    UNION ALL
    FROM table_b
    SELECT userid) unioned
INSERT OVERWRITE TABLE table_c
SELECT *;

Specifically, the map step with throw:
java.lang.RuntimeException: org.apache.hadoop.hive.serde2.SerDeException: java.lang.ClassCastException:
java.lang.Long cannot be cast to java.lang.String

I have interpreted this as a bug in the parser, but it could also be viewed as a bug about
not auto-casting.

Note that this can be worked around by using explicit CAST statements.


Correcting example to one which actually exhibits the problem.

> Parses doesn't catch certain type errors.
> -----------------------------------------
>
>                 Key: HIVE-297
>                 URL: https://issues.apache.org/jira/browse/HIVE-297
>             Project: Hadoop Hive
>          Issue Type: Bug
>          Components: Query Processor
>            Reporter: S. Alex Smith
>
> The following query:
> FROM (
>     FROM (FROM my_table
>          SELECT CAST(userid AS BIGINT) AS userid a
>    SELECT userid
>    UNION ALL
>    FROM (FROM my_table
>          SELECT CAST(userid AS STRING) AS userid) b
>    SELECT userid
>    ) unioned
>    SELECT DISTINCT userid;
> Is accepted by the parse, but throws the following at run-time:
> java.lang.RuntimeException: org.apache.hadoop.hive.serde2.SerDeException: java.lang.ClassCastException:
java.lang.Long cannot be cast to java.lang.String
> (Note that this seems less silly if the inner queries are different tables with userid
stored as a bigint and a string, respectively)
> I have interpreted this as a bug in the parser, but it could also be viewed as a bug
about not auto-casting.
> This can be worked around by using explicit CAST statements.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message