Skip to content

Instantly share code, notes, and snippets.

@kokosing
Created July 4, 2019 06:30
Show Gist options
  • Save kokosing/ffbc55bd3a8aa5bf8ad56ea89a7bffd8 to your computer and use it in GitHub Desktop.
Save kokosing/ffbc55bd3a8aa5bf8ad56ea89a7bffd8 to your computer and use it in GitHub Desktop.
hive> create table x(c_bigint BIGINT, c_varchar VARCHAR(255)) ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.OpenCSVSerde' WITH SERDEPROPERTIES ("separatorCh
ar" = "S", "quoteChar" = "Q", "escapeChar" = "E") STORED AS TEXTFILE TBLPROPERTIES ("separatorChar" = "s", "quoteChar" = "q", "escapeChar" = "e");
OK
Time taken: 0.655 seconds
hive> insert into x values (1, 'dwa');
OK
Time taken: 18.714 seconds
hive>
hive> show create table x;
OK
CREATE TABLE `x`(
`c_bigint` string COMMENT 'from deserializer',
`c_varchar` string COMMENT 'from deserializer')
ROW FORMAT SERDE
'org.apache.hadoop.hive.serde2.OpenCSVSerde'
WITH SERDEPROPERTIES (
'escapeChar'='E',
'quoteChar'='Q',
'separatorChar'='S')
STORED AS INPUTFORMAT
'org.apache.hadoop.mapred.TextInputFormat'
OUTPUTFORMAT
'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
LOCATION
'hdfs://hadoop-master:9000/user/hive/warehouse/x'
TBLPROPERTIES (
'COLUMN_STATS_ACCURATE'='{\"BASIC_STATS\":\"true\"}',
'escapeChar'='e',
'numFiles'='1',
'numRows'='1',
'quoteChar'='q',
'rawDataSize'='0',
'separatorChar'='s',
'totalSize'='10',
'transient_lastDdlTime'='1562220931')
Time taken: 0.17 seconds, Fetched: 25 row(s)
hive> select * from x;
OK
1 dwa
Time taken: 0.151 seconds, Fetched: 1 row(s)
hive>
[root@hadoop-master /]# hadoop fs -cat /user/hive/warehouse/x/000000_0
q1qsqdwaq
[root@hadoop-master /]#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment