如何将整个xml作为字符串插入到Hive表列中

时间:2019-06-07 17:47:35

标签: xml hive

我有一个示例XML,我想按原样插入到Hive表列中。我不想从xml中提取任何值,而只是将xml按原样存储在配置单元表中。

insert语句出现错误,因为xml在其内容中具有双引号和单引号,并且会导致以下错误。

xmlcontent="<?xml version='1.0' encoding='utf8'?...."
impala -q "insert into xyz.archive_xml values($xmlcontent)"
ERROR
'<?xml version='1.0' encoding='utf8'?>
                             ^
Encountered: DECIMAL LITERAL
Expected: AND, AS, ASC, BETWEEN, BLOCK_SIZE, COMMENT, COMPRESSION, CROSS, DEFAULT, DESC, DIV, ELSE, ENCODING, END, FOLLOWING, FROM, FULL, GROUP, IGNORE, HAVING, ILIKE, IN, INNER, IREGEXP, IS, JOIN, LEFT, LIKE, LIMIT, NOT, NULL, NULLS, OFFSET, OR, ORDER, PRECEDING, PRIMARY, RANGE, REGEXP, RIGHT, RLIKE, ROWS, THEN, UNION, WHEN, WHERE, COMMA, IDENTIFIER

CAUSED BY: Exception: Syntax error

0 个答案:

没有答案