Oushu HAWQ++ 2.2.0版本比Oushu HAWQ++ 2.1.1版本有如下新特性增强:
-
在csv和text文件格式中增加了对非ASCII字符串或长度大于1的字符串作为分隔符的支持(2.1.1中只能支持单个ASCII字符作为分隔符)。涉及copy语句和create external语句。
-
关键Bug fixes
多字符分隔符支持示例
建表与查询
create writable external table exttable_option_multibytesDelimiter_w0(p varchar, q varchar)
location ('hdfs://localhost:8020/hawq_default/exttable_option_multibytesDelimiter_w0.csv')
format 'csv' (delimiter '^_^' escape '&' null 'NULL') encoding 'gbk';
insert into exttable_option_multibytesDelimiter_w0 values('&','&');
insert into exttable_option_multibytesDelimiter_w0 values('分隔符','^_^');
insert into exttable_option_multibytesDelimiter_w0 values('&分隔符','&^_^');
insert into exttable_option_multibytesDelimiter_w0 values('中','国');
insert into exttable_option_multibytesDelimiter_w0 values('chi','na');
select * from exttable_option_multibytesDelimiter_w0;
p | q
----------+------
& | &
分隔符 | ^_^
&分隔符 | &^_^
中 | 国
chi | na
(5 rows)
生成的csv文件内容
&^_^&
分隔符^_^"^_^"
&分隔符^_^"&&^_^"
中^_^国
chi^_^na
非ASCII分隔符支持示例
建表与查询
create writable external table exttable_option_multibytesDelimiter_w0(p varchar, q varchar)
location ('hdfs://localhost:8020/hawq_default/exttable_option_multibytesDelimiter_w0.csv')
format 'csv' (delimiter '分隔符' escape '&' null 'NULL') encoding 'gbk';
insert into exttable_option_multibytesDelimiter_w0 values('&','&');
insert into exttable_option_multibytesDelimiter_w0 values('分隔符','^_^');
insert into exttable_option_multibytesDelimiter_w0 values('&分隔符','&^_^');
insert into exttable_option_multibytesDelimiter_w0 values('中','国');
insert into exttable_option_multibytesDelimiter_w0 values('chi','na');
select * from exttable_option_multibytesDelimiter_w0;
p | q
---------+------
& | &
分隔符 | ^_^
&分隔符 | &^_^
中 | 国
chi | na
(5 rows)
对应的csv文件内容
&分隔符&
"分隔符"分隔符^_^
"&&分隔符"分隔符&^_^
中分隔符国
chi分隔符na