Loading xml data into hive table :org.apache.hadoop.hive.ql.metadata.HiveException

后端 未结 6 2225
借酒劲吻你
借酒劲吻你 2021-02-06 14:48

I\'m trying to load XML data into Hive but I\'m getting an error :

java.lang.RuntimeException: org.apache.hadoop.hive.ql.metadata.HiveException: Hive Runt

6条回答
  •  独厮守ぢ
    2021-02-06 15:12

    then follow the below steps to get the solution as like as you want, just change the source data this

     11Computer44
    44Fantasy5 
    

    now try below steps:

    select xpath(xmldata, '/catalog/book/id/text()')as id,
    xpath(xmldata, '/catalog/book/genre/text()')as genre,
    xpath(xmldata, '/catalog/book/price/text()')as price FROM xmltable;
    

    now you will get ans as like this:

    ["11"] ["Computer"] ["44"]

    ["44"] ["Fantasy"] ["5"]

    if you apply xapth_string, xpath_int, xpath_int udfs the you will get ans like

    11 computer 44

    44 Fantasy 5.

    Thanks

提交回复
热议问题