hive sql,serde如何不引用我的字段? [英] hive sql, serde how to not quote my fields?

查看:298
本文介绍了hive sql,serde如何不引用我的字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因为默认情况下,serde用引用字段,我怎么不能使用serde引用字段?

Since by default serde quotes fields by ", How can I not quote my fields using serde?

我试过:

row format serde "org.apache.hadoop.hive.serde2.OpenCSVSerde"
with serdeproperties(
"separatorChar" = ",",
"quoteChar" = "")

但我得到

FAILED: SemanticException java.lang.StringIndexOutOfBoundsException: String index out of range: 0


推荐答案

您可以通过指定 \\\ 作为引号字符来实现。由于 quoteChar 需要一个字符串,因此您应该使用 NULL 的此unicode版本。

You could achieve this by specifying \u0000 as the quote character. Since quoteChar expects a string, you should use this unicode version of NULL.

ROW FORMAT SERDE
    "org.apache.hadoop.hive.serde2.OpenCSVSerde"
WITH SERDEPROPERTIES (
    "separatorChar" = ",",
    "quoteChar" = "\u0000")

\\\ CSV writer 类用作 NO_QUOTE_CHARACTER http://www.java2s.com/Code/ Java / Development-Class / AverysimpleCSVwriterreleasedunderacommercialfriendlylicense.htm

这篇关于hive sql,serde如何不引用我的字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆