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

Phabricator updated HIVE-4116:
------------------------------

    Attachment: D12975.1.patch

navis requested code review of "HIVE-4116 [jira] Can't use views using map 
datatype.".

Reviewers: JIRA

HIVE-4116 Cannot use views using map datatype

Executing the following

DROP TABLE IF EXISTS `items`;
CREATE TABLE IF NOT EXISTS `items` (id INT, name STRING, info 
MAP<STRING,STRING>) PARTITIONED BY (ds STRING);

DROP VIEW IF EXISTS `priceview`;
CREATE VIEW `priceview` AS
    SELECT
        `items`.`id`,
        `items`.info['price']
    FROM
        `items`
;

select * from `priceview`;

Produces the following error:

karel@tomato:~/tmp$ $HIVE_HOME/bin/hive -f hivebug.sql
WARNING: org.apache.hadoop.metrics.jvm.EventCounter is deprecated. Please use 
org.apache.hadoop.log.metrics.EventCounter in all the log4j.properties files.
Logging initialized using configuration in 
jar:file:/home/karel/opt/hive-0.10.0-bin/lib/hive-common-0.10.0.jar!/hive-log4j.properties
Hive history file=/tmp/karel/hive_job_log_karel_201303051117_945318761.txt
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in 
[jar:file:/home/karel/opt/hadoop-2.0.0-mr1-cdh4.0.0/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in 
[jar:file:/home/karel/opt/hive-0.10.0-bin/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
OK
Time taken: 5.449 seconds
OK
Time taken: 0.303 seconds
OK
Time taken: 0.131 seconds
OK
Time taken: 0.206 seconds
FAILED: SemanticException line 3:22 mismatched input '.' expecting FROM near 
'`items`' in from clause
 in definition of VIEW priceview [
SELECT
        `items`.`id`,
        `items``items`.`info`info['price']
    FROM
        `default`.`items`
] used as priceview at Line 3:14

Unless I'm not using the right syntax, I would expect this simple example to 
work. I have tried some variations (quotes, no quotes, ...), to no avail.

TEST PLAN
  EMPTY

REVISION DETAIL
  https://reviews.facebook.net/D12975

AFFECTED FILES
  ql/src/java/org/apache/hadoop/hive/ql/parse/ParseDriver.java
  ql/src/test/queries/clientpositive/create_view_translate.q
  ql/src/test/results/clientpositive/create_view_translate.q.out

MANAGE HERALD RULES
  https://reviews.facebook.net/herald/view/differential/

WHY DID I GET THIS EMAIL?
  https://reviews.facebook.net/herald/transcript/31011/

To: JIRA, navis

                
> Can't use views using map datatype.
> -----------------------------------
>
>                 Key: HIVE-4116
>                 URL: https://issues.apache.org/jira/browse/HIVE-4116
>             Project: Hive
>          Issue Type: Bug
>    Affects Versions: 0.8.1, 0.10.0, 0.11.0
>            Reporter: Karel Vervaeke
>            Assignee: Navis
>         Attachments: D12975.1.patch
>
>
> Executing the following 
> {noformat}
> DROP TABLE IF EXISTS `items`;
> CREATE TABLE IF NOT EXISTS `items` (id INT, name STRING, info 
> MAP<STRING,STRING>) PARTITIONED BY (ds STRING);
> DROP VIEW IF EXISTS `priceview`;
> CREATE VIEW `priceview` AS
>     SELECT
>         `items`.`id`,
>         `items`.info['price']
>     FROM
>         `items`
> ;
> select * from `priceview`;
> {noformat}
> Produces the following error:
> {noformat}
> karel@tomato:~/tmp$ $HIVE_HOME/bin/hive -f hivebug.sql
> WARNING: org.apache.hadoop.metrics.jvm.EventCounter is deprecated. Please use 
> org.apache.hadoop.log.metrics.EventCounter in all the log4j.properties files.
> Logging initialized using configuration in 
> jar:file:/home/karel/opt/hive-0.10.0-bin/lib/hive-common-0.10.0.jar!/hive-log4j.properties
> Hive history file=/tmp/karel/hive_job_log_karel_201303051117_945318761.txt
> SLF4J: Class path contains multiple SLF4J bindings.
> SLF4J: Found binding in 
> [jar:file:/home/karel/opt/hadoop-2.0.0-mr1-cdh4.0.0/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
> SLF4J: Found binding in 
> [jar:file:/home/karel/opt/hive-0.10.0-bin/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
> SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an 
> explanation.
> OK
> Time taken: 5.449 seconds
> OK
> Time taken: 0.303 seconds
> OK
> Time taken: 0.131 seconds
> OK
> Time taken: 0.206 seconds
> FAILED: SemanticException line 3:22 mismatched input '.' expecting FROM near 
> '`items`' in from clause
>  in definition of VIEW priceview [
> SELECT
>         `items`.`id`,
>         `items``items`.`info`info['price']
>     FROM
>         `default`.`items`
> ] used as priceview at Line 3:14
> {noformat}
> Unless I'm not using the right syntax, I would expect this simple example to 
> work. I have tried some variations (quotes, no quotes, ...), to no avail.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to