0

我有一个如下所示的 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 工作流运行时都会动态创建外部表,我想添加一个常量字段(创建表时源系统 = 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>

4

0 回答 0