有没有办法知道存储的配置单元分隔符?我试过Describe扩展但没有用..我已经搜索了很多,还没有得到答案。
答案 0 :(得分:8)
其他答案是正确的,如果它不是默认值,你将获得字段分隔符。但是,如果分隔符是默认分隔符,我不会看到它,它是Control-A字符或ASCII中的“\ 01”
答案 1 :(得分:6)
尝试运行" show create table "命令,它会显示分隔符。
答案 2 :(得分:4)
我看到使用describe extended table
命令
示例:
hive> create table difdelimiter (id int, name string)
row format delimited
fields terminated by ',';
hive> describe extended difdelimiter;
OK id int
name string
Detailed Table Information Table(tableName:difdelimiter, dbName:default, owner:cloudera, createTime:1439375349, lastAccessTime:0, retention:0, sd:StorageDescriptor(cols:[FieldSchema(name:id, type:int, comment:null), FieldSchema(name:name, type:string, comment:null)], location:hdfs://quickstart.cloudera:8020/user/hive/warehouse/difdelimiter, inputFormat:org.apache.hadoop.mapred.TextInputFormat, outputFormat:org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat, compressed:false, numBuckets:-1, serdeInfo:SerDeInfo(name:null, serializationLib:org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe, parameters:{serialization.format=,, field.delim=,}), bucketCols:[], sortCols:[], parameters:{}, skewedInfo:SkewedInfo(skewedColNames:[], skewedColValues:[], skewedColValueLocationMaps:{}), storedAsSubDirectories:false), partitionKeys:[], parameters:{transient_lastDdlTime=1439375349}, viewOriginalText:null, viewExpandedText:null, tableType:MANAGED_TABLE) Time taken: 0.154 seconds, Fetched: 4 row(s)
以下是有关分隔符的信息
parameters:{serialization.format=,, field.delim=,}
根据评论添加
hive> create table tb3 (id int, name string) row format delimited fields terminated by '/t';
OK
Time taken: 0.09 seconds
hive> describe extended tb3;
OK
id int
name string
Detailed Table Information Table(tableName:tb3, dbName:default, owner:cloudera, createTime:1439377591, lastAccessTime:0, retention:0, sd:StorageDescriptor(cols:[FieldSchema(name:id, type:int, comment:null), FieldSchema(name:name, type:string, comment:null)], location:hdfs://quickstart.cloudera:8020/user/hive/warehouse/tb3, inputFormat:org.apache.hadoop.mapred.TextInputFormat, outputFormat:org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat, compressed:false, numBuckets:-1, serdeInfo:SerDeInfo(name:null, serializationLib:org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe, parameters:{serialization.format=/t, field.delim=/t}), bucketCols:[], sortCols:[], parameters:{}, skewedInfo:SkewedInfo(skewedColNames:[], skewedColValues:[], skewedColValueLocationMaps:{}), storedAsSubDirectories:false), partitionKeys:[], parameters:{transient_lastDdlTime=1439377591}, viewOriginalText:null, viewExpandedText:null, tableType:MANAGED_TABLE)
Time taken: 0.125 seconds, Fetched: 4 row(s)
parameters:{serialization.format=/t, field.delim=/t})
答案 3 :(得分:2)
当您执行 describe extended your_table_name 命令时,您将在最后一部分(详细信息表信息)中获取此信息 - 只需搜索 field.delim 。
但是,结果集格式不是很好,而且用户友好的方法是 show create table your_table_name 。