使用Spark中的集合类型处理Hive查询

时间:2015-08-13 22:58:59

标签: apache-spark hive hiveql

我有以下查询:

Select * from MyNode

如何处理spark中哪一列是MAP以获取Key及其值?

Hive Table Schema

CREATE EXTERNAL TABLE IF NOT EXISTS MyNode
(
    Name STRING,
    CommandText MAP <TINYINT, STRING> ,
    )
 ROW FORMAT DELIMITED
    FIELDS TERMINATED BY '|'
    COLLECTION ITEMS TERMINATED BY ','
    MAP KEYS TERMINATED BY ':'
    LINES TERMINATED BY '\n'
   STORED AS TEXTFILE
LOCATION '/user/hive/warehouse/MyNode'

1行数据

MYNODENAME|{1:"echo",2:"mkdir",3:"cp"}

提前致谢。

0 个答案:

没有答案