如何获取现有的 Hive table 分隔符
How to get existing Hive table delimiter
有没有办法知道存储的配置单元表分隔符?我试过 Describe extended 但没有用.. 我搜索了很多,还没有得到答案。
我正在使用 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})
尝试运行“show create table”命令,它会显示分隔符。
当您执行 describe extended your_table_name 命令时,您将在最后一部分获得此信息(详细 Table 信息)- 只需搜索 field.delim。
然而,该结果集的格式不是很好,更加用户友好的方法是 show create table your_table_name.
其他答案是正确的,因为如果字段分隔符不是默认值,您将获得该字段分隔符。但是,如果分隔符是默认分隔符,即 Control-A 字符或 ASCII 中的“\01”
,我看不到它
有没有办法知道存储的配置单元表分隔符?我试过 Describe extended 但没有用.. 我搜索了很多,还没有得到答案。
我正在使用 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})
尝试运行“show create table”命令,它会显示分隔符。
当您执行 describe extended your_table_name 命令时,您将在最后一部分获得此信息(详细 Table 信息)- 只需搜索 field.delim。
然而,该结果集的格式不是很好,更加用户友好的方法是 show create table your_table_name.
其他答案是正确的,因为如果字段分隔符不是默认值,您将获得该字段分隔符。但是,如果分隔符是默认分隔符,即 Control-A 字符或 ASCII 中的“\01”
,我看不到它