2017-12-08 11 views
0

最近ハイブの学習を始めました。私は次の値を持つpythonリストを持っていますPythonを使ってhive ddlを作成するには

list=['hello:struct', 'env:string', 'element:struct','AppId:string','processId:string'] 

したがって、上記の値を使用してハイブDDLを作成する必要があります。これに似ています。

create table demo 

{ 

hello :struct 

< 

    env:string, 

    element:struct 

     < 

     AppId:string, 

     processId:string 

     > 

> 

formatted b\y.. 

location.. 

答えて

0

JSON serdeを使用することをお勧めします。あなたが後にあるhttps://community.hortonworks.com/repos/30883/hive-json-serde.html

DDLは次のようになり、ここを参照してください

CREATE TABLE demo 
(
    hello struct 
    < 
     env:string, 
     element:struct 
      < 
       AppId:string, 
       processId:string 
      > 
    > 
) 
ROW FORMAT SERDE 'org.openx.data.jsonserde.JsonSerDe' 
LOCATION '/user/hive/demo'; 
関連する問題