Hive XML SerDe - 在

时间:2017-06-29 22:33:40

标签: xml xpath hive hive-serde

我有一个像下面的Hive表..我希望第一列是一个常量值(它不会出现在XML文件中)。如果我对该值进行硬编码,那么当我在桌面上进行选择时它就不显示了...我做错了什么? 我也尝试使用连接运算符(使用虚拟xpath并添加字符串)...仍然没有运气 ...任何帮助表示赞赏..

`

CREATE EXTERNAL TABLE IF NOT EXISTS raw_RMS_20170629(
SourceSystem STRING,
Account  STRING,
Action STRING,
AllocationType STRING,
AlternativeTradeId STRING,
...
...
ROW FORMAT SERDE 'com.ibm.spss.hive.serde2.xml.XmlSerDe'
WITH SERDEPROPERTIES (
"column.xpath.SourceSystem"="RMS",
"column.xpath.Account"="Trade/Account/text()",
"column.xpath.Action"="Trade/Action/text()",
"column.xpath.AllocationType"="Trade/AllocationType/text()",
...
...

以下示例数据。每次oozie工作流运行时都会动态创建外部表,我想在创建表时添加一个常量字段(sourcesystem = RMS或.. GSS等)

<queryReply> <Trade xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rms="http://www.example.org/store/schema/abc/durables/rms" xmlns:rms-raw="http://www.example.org/td/tm/lite/rms-raw/v1.0"> <Account>AKA</Account> <Action xsi:nil="true"/> <AllocationType xsi:nil="true"/> <TradeId> <rms:SYSTEMID>97926437</rms:SYSTEMID> </TradeId> <TradeVersion> <rms:VERSION>1</rms:VERSION> </TradeVersion> <InstrumentId xsi:nil="true"/> <TraderSourceSystemName xsi:nil="true"/> <TraderId xsi:nil="true"/> <TraderName xsi:nil="true"/> <TraderEmail xsi:nil="true"/> <TradeStatus>Open</TradeStatus> ... ... <Currency/> <UnderlyingCurrency> <UNDERCURRENCY>USD</UNDERCURRENCY> </UnderlyingCurrency> <ExpiryDate xsi:nil="true"/> <FuturesExpiryDate xsi:nil="true"/> <FutureSubType xsi:nil="true"/> <CashBalance xsi:nil="true"/> <FutureCode xsi:nil="true"/> <UnderlyingExchange xsi:nil="true"/> <CorrelationId xsi:nil="true"/> </Trade> </queryReply>

0 个答案:

没有答案