GP中外部表例子
来源:互联网 发布:酷骑单车网络连接失败 编辑:程序博客网 时间:2024/05/16 23:49
创建外部表注意事项:
同一台机器上的外部表对应的gpfdist端口号尽量错开,从8081-8088
gpfdist -p 8081 -d /ftp2/interface/data/GPload_home
创建可写外部表:
Greenplum也支持对外部表的写操作。这需要在创建表的时候指定写关键字:
CREATE WRITABLE EXTERNAL TABLE weblogs
( md5 text,
url text,
request_date date,
request_time time,
ip int
)
LOCATION ('gphdfs://hdfs_host[:port]/path/filename.txt')
FORMAT 'custom' (formatter= 'delimiter_ou_any' ,hex_entry_delim ='80' ,fix_flag= 'FALSE' ,line_delim= '
' ,null= '' ,encoding= 'gbk' )
ENCODING 'UTF8';
--删除可写外部表(不加WRITABLE ):
drop EXTERNAL TABLE a;
创建只读外部表:
-- External Table: tdw_12580_busslist_d
-- DROP EXTERNAL TABLE tdw_12580_busslist_d;
CREATE EXTERNAL TABLE tdw_12580_busslist_d
(
statis_date numeric(8,0),
row_number numeric(20,0),
call_id character varying(25),
cust_type character varying(12)
)
LOCATION (
'gpfdist://10.255.235.39:8081/day/tdw_12580_busslist_d.gpload'
)
FORMAT 'custom' (formatter= 'delimiter_in' ,hex_entry_delim ='80' ,fix_flag= 'FALSE' ,line_delim= '
' ,null= '' ,encoding= 'gbk' )
ENCODING 'UTF8';
ALTER TABLE tdw_12580_busslist_d OWNER TO gpmon;
--注意:若报编码错误,可以考虑将外层的ENCODING 'UTF8'改为ENCODING 'GBK';
1:Formats are restricted, as follows:
- TEXT format is allowed for readable and writable external tables.
- Only the gphdfs_import formatter is allowed for readable external tables with a custom format.
custom格式的可读外部表只能是 gphdfs_import formatter
- Only the gphdfs_export formatter is allowed for writable external tables with a custom format.
custom格式的可写外部表只能是 gphdfs_export formatter
Compression is only applicable for writable external tables. Compression settings are determined automatically
for readable external tables and cannot be set.
只有可写的外部表才可以进行压缩设置;对于可读外部表,压缩是自动设置的,不能人为设置。
2:-- delimiter must be a single ASCII character, or 'off'
分隔符必须为单字节的符号,可以使用的分隔符:text csv custom
修改外部表的表结构:
alter external TABLE dw.exter_tb_det_music_serv_info_tab_d alter column author type character varying(90);
同一台机器上的外部表对应的gpfdist端口号尽量错开,从8081-8088
gpfdist -p 8081 -d /ftp2/interface/data/GPload_home
创建可写外部表:
Greenplum也支持对外部表的写操作。这需要在创建表的时候指定写关键字:
CREATE WRITABLE EXTERNAL TABLE weblogs
( md5 text,
url text,
request_date date,
request_time time,
ip int
)
LOCATION ('gphdfs://hdfs_host[:port]/path/filename.txt')
FORMAT 'custom' (formatter= 'delimiter_ou_any' ,hex_entry_delim ='80' ,fix_flag= 'FALSE' ,line_delim= '
' ,null= '' ,encoding= 'gbk' )
ENCODING 'UTF8';
--删除可写外部表(不加WRITABLE ):
drop EXTERNAL TABLE a;
创建只读外部表:
-- External Table: tdw_12580_busslist_d
-- DROP EXTERNAL TABLE tdw_12580_busslist_d;
CREATE EXTERNAL TABLE tdw_12580_busslist_d
(
statis_date numeric(8,0),
row_number numeric(20,0),
call_id character varying(25),
cust_type character varying(12)
)
LOCATION (
'gpfdist://10.255.235.39:8081/day/tdw_12580_busslist_d.gpload'
)
FORMAT 'custom' (formatter= 'delimiter_in' ,hex_entry_delim ='80' ,fix_flag= 'FALSE' ,line_delim= '
' ,null= '' ,encoding= 'gbk' )
ENCODING 'UTF8';
ALTER TABLE tdw_12580_busslist_d OWNER TO gpmon;
--注意:若报编码错误,可以考虑将外层的ENCODING 'UTF8'改为ENCODING 'GBK';
1:Formats are restricted, as follows:
- TEXT format is allowed for readable and writable external tables.
- Only the gphdfs_import formatter is allowed for readable external tables with a custom format.
custom格式的可读外部表只能是 gphdfs_import formatter
- Only the gphdfs_export formatter is allowed for writable external tables with a custom format.
custom格式的可写外部表只能是 gphdfs_export formatter
Compression is only applicable for writable external tables. Compression settings are determined automatically
for readable external tables and cannot be set.
只有可写的外部表才可以进行压缩设置;对于可读外部表,压缩是自动设置的,不能人为设置。
2:-- delimiter must be a single ASCII character, or 'off'
分隔符必须为单字节的符号,可以使用的分隔符:text csv custom
修改外部表的表结构:
alter external TABLE dw.exter_tb_det_music_serv_info_tab_d alter column author type character varying(90);
alter external table dc.exter_tkr_tool_game_rk3_m alter up_rate type numeric(20,6);
0 0
- GP中外部表例子
- GP中外部表数据装载
- GP 外部表
- 测试创建GP外部表
- GP数据库中时间函数例子
- GP加载和卸载数据之一外部表
- 创建外部表例子
- 外部表创建简单例子
- 一个使用FFmpeg库读取3gp视频的例子-Android中使用FFmpeg媒体库(三)
- 一个使用FFmpeg库读取3gp视频的例子-Android中使用FFmpeg媒体库(三)
- 一个使用FFmpeg库读取3gp视频的例子-Android中使用FFmpeg媒体库
- 一个使用FFmpeg库读取3gp视频的例子-Android中使用FFmpeg媒体库(三)
- 一个使用FFmpeg库读取3gp视频的例子-Android中使用FFmpeg媒体库(三)
- 一个使用FFmpeg库读取3gp视频的例子-Android中使用FFmpeg媒体库(三)
- 一个使用FFmpeg库读取3gp视频的例子-Android中使用FFmpeg媒体库(三)
- 一个使用FFmpeg库读取3gp视频的例子-Android中使用FFmpeg媒体库(三)
- GP加载和卸载数据之一外部表--有更新版本!
- GP通过外部表装载数据时遇到ERROR:extra data after last expected column解决方法
- 【CUDA】CUDA开发环境搭建
- js兼容火狐显示上传图片预览效果的方法(读取字节)
- GP中的临时表
- 图文混排之NSAttributedString
- RadioButton 底部菜单制作
- GP中外部表例子
- "No Spring WebApplicationInitializer types detected on classpath" 解决方案
- php json_decode 出错
- minSdkVersion <= targetSdkVersion <= compileSdkVersion
- ubuntu12.04 64bit安装hadoop2.2.0
- HTTP版本/层次/响应/状态之高屋建瓴
- mysql中key 、primary key 、unique key 与index区别
- 兼容浏览器的min-height和min-width
- 2015-01-08 工作笔记8