如何获取现有的配置单元表分隔符

uyto3xhc  于 2021-06-02  发布在  Hadoop
关注(0)|答案(4)|浏览(299)

有没有办法知道存储的配置单元表分隔符?我试过了,但没用。。我找了很多,还没有找到答案。

svmlkihl

svmlkihl1#

我正在用 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})
juzqafwq

juzqafwq2#

其他答案是正确的,因为如果字段分隔符不是默认值,您将得到它。但是,我看不出分隔符是否是默认分隔符,即control-a字符或ascii中的“\01”

mctunoxg

mctunoxg3#

尝试运行“showcreatetable”命令,它将显示分隔符。

djmepvbi

djmepvbi4#

当您执行descripe extended your\u table\u name命令时,您将在最后一部分(详细表信息)中获得此信息-只需搜索field.delim。
但是,结果集的格式不是很好,一种更为用户友好的方法是显示createtable\u table\u名称。

相关问题