src/data 目录下面是输入数据
src/ql/src/test/queries下面是测试用例,clientpositive是运行成功的用例,clientnegative是运行失败,返回非0的用例。
src/ql/src/test/results 下面是测试用例对应的输出结果。如src/ql/src/test/queries/case_sensitivity.q对应的输出结果是src/ql/src/test/results/case_sensitivity.q.out
测试会运行case_sensitivity.q产生的输出放入build/ql/test/logs/clientpositive/case_sensitivity.q.out文件中,然后通过diff比对build/ql/test/logs/clientpositive/case_sensitivity.q.out src/ql/src/test/results/case_sensitivity.q.out两个文件,如果相同则测试通过,如果不同则测试失败。
测试前会事先create一些table,并load一些数据进去。
比如:case_sensitivity.q 的代码是
tianzhao@tianzhao-VirtualBox:~/hive/hive-1.1.2/src/ql/src/test/queries/clientpositive$ cat case_sensitivity.q
CREATE TABLE DEST1(Key INT, VALUE STRING) STORED AS TEXTFILE;
EXPLAIN
FROM SRC_THRIFT
INSERT OVERWRITE TABLE dest1 SELECT src_Thrift.LINT[1], src_thrift.lintstring[0].MYSTRING where src_thrift.liNT[0] > 0;
FROM SRC_THRIFT
INSERT OVERWRITE TABLE dest1 SELECT src_Thrift.LINT[1], src_thrift.lintstring[0].MYSTRING where src_thrift.liNT[0] > 0;
SELECT DEST1.* FROM Dest1;
/// 上面的HSQL中并没有创建SRC_THRIFT 表,但是能够用,那是因为在执行该文件的语句前已经创建好了这个表。
代码在org.apache.hadoop.hive.ql.QTestUtil.java中,它的方法init、createSources等。
从ant test -Dtestcase=TestCliDriver -Dqfile=case_sensitivity.q -Dtest.silent=false 在终端的输出也可以看出:
[junit] PREHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/kv1.txt' OVERWRITE INTO TABLE srcpart PARTITION (ds='2008-04-08',hr='11')
[junit] PREHOOK: type: LOAD
[junit] PREHOOK: Output: default@srcpart
[junit] Copying data from file:/home/tianzhao/apache/hive-trunk/data/files/kv1.txt
[junit] Copying file: file:/home/tianzhao/apache/hive-trunk/data/files/kv1.txt
[junit] Loading data to table default.srcpart partition (ds=2008-04-08, hr=11)
[junit] POSTHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/kv1.txt' OVERWRITE INTO TABLE srcpart PARTITION (ds='2008-04-08',hr='11')
[junit] POSTHOOK: type: LOAD
[junit] POSTHOOK: Output: default@srcpart
[junit] POSTHOOK: Output: default@srcpart@ds=2008-04-08/hr=11
[junit] OK
[junit] PREHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/kv1.txt' OVERWRITE INTO TABLE srcpart PARTITION (ds='2008-04-08',hr='12')
[junit] PREHOOK: type: LOAD
[junit] PREHOOK: Output: default@srcpart
[junit] Copying data from file:/home/tianzhao/apache/hive-trunk/data/files/kv1.txt
[junit] Copying file: file:/home/tianzhao/apache/hive-trunk/data/files/kv1.txt
[junit] Loading data to table default.srcpart partition (ds=2008-04-08, hr=12)
[junit] POSTHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/kv1.txt' OVERWRITE INTO TABLE srcpart PARTITION (ds='2008-04-08',hr='12')
[junit] POSTHOOK: type: LOAD
[junit] POSTHOOK: Output: default@srcpart
[junit] POSTHOOK: Output: default@srcpart@ds=2008-04-08/hr=12
[junit] OK
[junit] PREHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/kv1.txt' OVERWRITE INTO TABLE srcpart PARTITION (ds='2008-04-09',hr='11')
[junit] PREHOOK: type: LOAD
[junit] PREHOOK: Output: default@srcpart
[junit] Copying data from file:/home/tianzhao/apache/hive-trunk/data/files/kv1.txt
[junit] Copying file: file:/home/tianzhao/apache/hive-trunk/data/files/kv1.txt
[junit] Loading data to table default.srcpart partition (ds=2008-04-09, hr=11)
[junit] POSTHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/kv1.txt' OVERWRITE INTO TABLE srcpart PARTITION (ds='2008-04-09',hr='11')
[junit] POSTHOOK: type: LOAD
[junit] POSTHOOK: Output: default@srcpart
[junit] POSTHOOK: Output: default@srcpart@ds=2008-04-09/hr=11
[junit] OK
[junit] PREHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/kv1.txt' OVERWRITE INTO TABLE srcpart PARTITION (ds='2008-04-09',hr='12')
[junit] PREHOOK: type: LOAD
[junit] PREHOOK: Output: default@srcpart
[junit] Copying data from file:/home/tianzhao/apache/hive-trunk/data/files/kv1.txt
[junit] Copying file: file:/home/tianzhao/apache/hive-trunk/data/files/kv1.txt
[junit] Loading data to table default.srcpart partition (ds=2008-04-09, hr=12)
[junit] POSTHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/kv1.txt' OVERWRITE INTO TABLE srcpart PARTITION (ds='2008-04-09',hr='12')
[junit] POSTHOOK: type: LOAD
[junit] POSTHOOK: Output: default@srcpart
[junit] POSTHOOK: Output: default@srcpart@ds=2008-04-09/hr=12
[junit] OK
[junit] PREHOOK: query: CREATE TABLE srcbucket(key int, value string) CLUSTERED BY (key) INTO 2 BUCKETS STORED AS TEXTFILE
[junit] PREHOOK: type: CREATETABLE
[junit] POSTHOOK: query: CREATE TABLE srcbucket(key int, value string) CLUSTERED BY (key) INTO 2 BUCKETS STORED AS TEXTFILE
[junit] POSTHOOK: type: CREATETABLE
[junit] POSTHOOK: Output: default@srcbucket
[junit] OK
[junit] PREHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/srcbucket0.txt' INTO TABLE srcbucket
[junit] PREHOOK: type: LOAD
[junit] PREHOOK: Output: default@srcbucket
[junit] Copying data from file:/home/tianzhao/apache/hive-trunk/data/files/srcbucket0.txt
[junit] Copying file: file:/home/tianzhao/apache/hive-trunk/data/files/srcbucket0.txt
[junit] Loading data to table default.srcbucket
[junit] POSTHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/srcbucket0.txt' INTO TABLE srcbucket
[junit] POSTHOOK: type: LOAD
[junit] POSTHOOK: Output: default@srcbucket
[junit] OK
[junit] PREHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/srcbucket1.txt' INTO TABLE srcbucket
[junit] PREHOOK: type: LOAD
[junit] PREHOOK: Output: default@srcbucket
[junit] Copying data from file:/home/tianzhao/apache/hive-trunk/data/files/srcbucket1.txt
[junit] Copying file: file:/home/tianzhao/apache/hive-trunk/data/files/srcbucket1.txt
[junit] Loading data to table default.srcbucket
[junit] POSTHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/srcbucket1.txt' INTO TABLE srcbucket
[junit] POSTHOOK: type: LOAD
[junit] POSTHOOK: Output: default@srcbucket
[junit] OK
[junit] PREHOOK: query: CREATE TABLE srcbucket2(key int, value string) CLUSTERED BY (key) INTO 4 BUCKETS STORED AS TEXTFILE
[junit] PREHOOK: type: CREATETABLE
[junit] POSTHOOK: query: CREATE TABLE srcbucket2(key int, value string) CLUSTERED BY (key) INTO 4 BUCKETS STORED AS TEXTFILE
[junit] POSTHOOK: type: CREATETABLE
[junit] POSTHOOK: Output: default@srcbucket2
[junit] OK
[junit] PREHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/srcbucket20.txt' INTO TABLE srcbucket2
[junit] PREHOOK: type: LOAD
[junit] PREHOOK: Output: default@srcbucket2
[junit] Copying data from file:/home/tianzhao/apache/hive-trunk/data/files/srcbucket20.txt
[junit] Copying file: file:/home/tianzhao/apache/hive-trunk/data/files/srcbucket20.txt
[junit] Loading data to table default.srcbucket2
[junit] POSTHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/srcbucket20.txt' INTO TABLE srcbucket2
[junit] POSTHOOK: type: LOAD
[junit] POSTHOOK: Output: default@srcbucket2
[junit] OK
[junit] PREHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/srcbucket21.txt' INTO TABLE srcbucket2
[junit] PREHOOK: type: LOAD
[junit] PREHOOK: Output: default@srcbucket2
[junit] Copying data from file:/home/tianzhao/apache/hive-trunk/data/files/srcbucket21.txt
[junit] Copying file: file:/home/tianzhao/apache/hive-trunk/data/files/srcbucket21.txt
[junit] Loading data to table default.srcbucket2
[junit] POSTHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/srcbucket21.txt' INTO TABLE srcbucket2
[junit] POSTHOOK: type: LOAD
[junit] POSTHOOK: Output: default@srcbucket2
[junit] OK
[junit] PREHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/srcbucket22.txt' INTO TABLE srcbucket2
[junit] PREHOOK: type: LOAD
[junit] PREHOOK: Output: default@srcbucket2
[junit] Copying data from file:/home/tianzhao/apache/hive-trunk/data/files/srcbucket22.txt
[junit] Copying file: file:/home/tianzhao/apache/hive-trunk/data/files/srcbucket22.txt
[junit] Loading data to table default.srcbucket2
[junit] POSTHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/srcbucket22.txt' INTO TABLE srcbucket2
[junit] POSTHOOK: type: LOAD
[junit] POSTHOOK: Output: default@srcbucket2
[junit] OK
[junit] PREHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/srcbucket23.txt' INTO TABLE srcbucket2
[junit] PREHOOK: type: LOAD
[junit] PREHOOK: Output: default@srcbucket2
[junit] Copying data from file:/home/tianzhao/apache/hive-trunk/data/files/srcbucket23.txt
[junit] Copying file: file:/home/tianzhao/apache/hive-trunk/data/files/srcbucket23.txt
[junit] Loading data to table default.srcbucket2
[junit] POSTHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/srcbucket23.txt' INTO TABLE srcbucket2
[junit] POSTHOOK: type: LOAD
[junit] POSTHOOK: Output: default@srcbucket2
[junit] OK
[junit] PREHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/kv1.txt' INTO TABLE src
[junit] PREHOOK: type: LOAD
[junit] PREHOOK: Output: default@src
[junit] Copying data from file:/home/tianzhao/apache/hive-trunk/data/files/kv1.txt
[junit] Copying file: file:/home/tianzhao/apache/hive-trunk/data/files/kv1.txt
[junit] Loading data to table default.src
[junit] POSTHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/kv1.txt' INTO TABLE src
[junit] POSTHOOK: type: LOAD
[junit] POSTHOOK: Output: default@src
[junit] OK
[junit] PREHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/kv3.txt' INTO TABLE src1
[junit] PREHOOK: type: LOAD
[junit] PREHOOK: Output: default@src1
[junit] Copying data from file:/home/tianzhao/apache/hive-trunk/data/files/kv3.txt
[junit] Copying file: file:/home/tianzhao/apache/hive-trunk/data/files/kv3.txt
[junit] Loading data to table default.src1
[junit] POSTHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/kv3.txt' INTO TABLE src1
[junit] POSTHOOK: type: LOAD
[junit] POSTHOOK: Output: default@src1
[junit] OK
[junit] PREHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/kv1.seq' INTO TABLE src_sequencefile
[junit] PREHOOK: type: LOAD
[junit] PREHOOK: Output: default@src_sequencefile
[junit] Copying data from file:/home/tianzhao/apache/hive-trunk/data/files/kv1.seq
[junit] Copying file: file:/home/tianzhao/apache/hive-trunk/data/files/kv1.seq
[junit] Loading data to table default.src_sequencefile
[junit] POSTHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/kv1.seq' INTO TABLE src_sequencefile
[junit] POSTHOOK: type: LOAD
[junit] POSTHOOK: Output: default@src_sequencefile
[junit] OK
[junit] PREHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/complex.seq' INTO TABLE src_thrift
[junit] PREHOOK: type: LOAD
[junit] PREHOOK: Output: default@src_thrift
[junit] Copying data from file:/home/tianzhao/apache/hive-trunk/data/files/complex.seq
[junit] Copying file: file:/home/tianzhao/apache/hive-trunk/data/files/complex.seq
[junit] Loading data to table default.src_thrift
[junit] POSTHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/complex.seq' INTO TABLE src_thrift
[junit] POSTHOOK: type: LOAD
[junit] POSTHOOK: Output: default@src_thrift
[junit] OK
[junit] PREHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/json.txt' INTO TABLE src_json
[junit] PREHOOK: type: LOAD
[junit] PREHOOK: Output: default@src_json
[junit] Copying data from file:/home/tianzhao/apache/hive-trunk/data/files/json.txt
[junit] Copying file: file:/home/tianzhao/apache/hive-trunk/data/files/json.txt
[junit] Loading data to table default.src_json
[junit] POSTHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/json.txt' INTO TABLE src_json
[junit] POSTHOOK: type: LOAD
[junit] POSTHOOK: Output: default@src_json
[junit] OK
上面显示了创建的表和load的数据。
测试case_sensitivity.q的显示是:
[junit] Running org.apache.hadoop.hive.cli.TestCliDriver
[junit] Begin query: case_sensitivity.q
[junit] Deleted file:/home/tianzhao/apache/hive-trunk/build/ql/test/data/warehouse/dest1
[junit] diff -a -I file: -I pfile: -I hdfs: -I /tmp/ -I invalidscheme: -I lastUpdateTime -I lastAccessTime -I [Oo]wner -I CreateTime -I LastAccessTime -I Location -I transient_lastDdlTime -I last_modified_ -I java.lang.RuntimeException -I at org -I at sun -I at java -I at junit -I Caused by: -I LOCK_QUERYID: -I grantTime -I [.][.][.] [0-9]* more -I USING 'java -cp /home/tianzhao/apache/hive-trunk/build/ql/test/logs/clientpositive/case_sensitivity.q.out /home/tianzhao/apache/hive-trunk/ql/src/test/results/clientpositive/case_sensitivity.q.out
[junit] Done query: case_sensitivity.q
[junit] Cleaning up TestCliDriver
生成的结果在build/ql/test/logs/clientpositive/case_sensitivity.q.out 中,通过diff比对它与ql/src/test/results/clientpositive/case_sensitivity.q.out是否相同来判断该UT是否通过。
我们来看如何手工创建src_thrift表,load数据,并执行case_sensitivity.q中的HSQL。
org.apache.hadoop.hive.ql.QTestUtil.createSources()中创建src_thrift表的语句是:
Table srcThrift = new Table(db.getCurrentDatabase(), "src_thrift");
srcThrift.setInputFormatClass(SequenceFileInputFormat.class.getName());
srcThrift.setOutputFormatClass(SequenceFileOutputFormat.class.getName());
srcThrift.setSerializationLib(ThriftDeserializer.class.getName());
srcThrift.setSerdeParam(Constants.SERIALIZATION_CLASS, Complex.class
.getName());
srcThrift.setSerdeParam(Constants.SERIALIZATION_FORMAT,
TBinaryProtocol.class.getName());
db.createTable(srcThrift);
存储格式是SequenceFile,serde是ThriftDeserializer,serde的两个属性是SERIALIZATION_CLASS和SERIALIZATION_FORMAT。创建表的时候需要知道表的字段,这里没有写。但是在(Constants.SERIALIZATION_CLASS, Complex.class.getName())中已经定义了。
那么看org.apache.hadoop.hive.serde2.thrift.test.Complex的定义:
public int aint;
public static final int AINT = 1;
public String aString;
public static final int ASTRING = 2;
public List<Integer> lint;
public static final int LINT = 3;
public List<String> lString;
public static final int LSTRING = 4;
public List<IntString> lintString;
public static final int LINTSTRING = 5;
public Map<String,String> mStringString;
public static final int MSTRINGSTRING = 6;
IntString的定义:
public int myint;
public static final int MYINT = 1;
public String myString;
public static final int MYSTRING = 2;
public int underscore_int;
public static final int UNDERSCORE_INT = 3;
可以还原src_thrift的字段:
建表语句是:
hive> create table src_thrift(aint int, aString string,lint array<int>, lString array<string>, lintString array<struct<myint:int, mString:string, underscore_int:int>>, mStringString map<string, string>)
> row format serde 'org.apache.hadoop.hive.serde2.thrift.ThriftDeserializer' with serdeproperties("serialization.class"="org.apache.hadoop.hive.serde2.thrift.test.Complex", "serialization.format"="org.apache.thrift.protocol.TBinaryProtocol")
> stored as sequencefile;
OK
Time taken: 0.462 seconds
load数据是:
hive> load data local inpath 'src/data/files/complex.seq' into table src_thrift;
Copying data from file:/home/tianzhao/hive/hive-1.1.2/src/data/files/complex.seq
Loading data to table src_thrift
OK
Time taken: 0.286 seconds
查看数据是:
hive> select * from src_thrift limit 2;
OK
1712634731 record_0 [0,0,0] ["0","0","0"] [{"myint":0,"mystring":"0","underscore_int":0}] {"key_0":"value_0"}
465985200 record_1 [1,2,3] ["10","100","1000"] [{"myint":1,"mystring":"1","underscore_int":1}] {"key_1":"value_1"}
Time taken: 0.34 seconds
查看表的信息是:
hive> desc src_thrift;
OK
aint int from deserializer
astring string from deserializer
lint array<int> from deserializer
lstring array<string> from deserializer
lintstring array<org.apache.hadoop.hive.serde2.thrift.test.IntString> from deserializer
mstringstring map<string,string> from deserializer
Time taken: 0.085 seconds
运行case_sensitivity.q里面的一个语句:(截取了一部分)
hive> from src_thrift SELECT src_Thrift.LINT[1], src_thrift.lintstring[0].MYSTRING where src_thrift.liNT[0] > 0;
Total MapReduce jobs = 1
Launching Job 1 out of 1
Number of reduce tasks is set to 0 since there's no reduce operator
Starting Job = job_201105281127_0001, Tracking URL = http://localhost:50030/jobdetails.jsp?jobid=job_201105281127_0001
Kill Command = /home/tianzhao/hive/hadoop-0.20.2/bin/../bin/hadoop job -Dmapred.job.tracker=localhost:54311 -kill job_201105281127_0001
2011-05-28 12:04:52,869 Stage-1 map = 0%, reduce = 0%
2011-05-28 12:04:55,921 Stage-1 map = 100%, reduce = 0%
2011-05-28 12:04:58,962 Stage-1 map = 100%, reduce = 100%
Ended Job = job_201105281127_0001
OK
2 1
4 8
6 27
8 64
10 125
12 216
14 343
16 512
18 729
Time taken: 12.147 seconds
src表
org.apache.hadoop.hive.ql.QTestUtil.createSources() :
LinkedList<String> cols = new LinkedList<String>();
cols.add("key");
cols.add("value");
for (String tname : new String[] {"src", "src1"}) {
db.createTable(tname, cols, null, TextInputFormat.class,
IgnoreKeyTextOutputFormat.class);
}
src、src1两表都是两个columns:
create table src(key string, value string);
load数据:
// load the input data into the src table
fpath = new Path(testFiles, "kv1.txt");
newfpath = new Path(tmppath, "kv1.txt");
fs.copyFromLocalFile(false, true, fpath, newfpath);
// db.loadTable(newfpath, "src", false);
runLoadCmd("LOAD DATA INPATH '" + newfpath.toString() + "' INTO TABLE src");
load data local inpath 'src/data/files/kv1.txt' into table src;
有了这些东西,我们可以手工测试使用src/ql/src/test/queries下面的各个UT里面的语句。
目录下面的文件 hive-0.7.0/src/ql/src/test/queries/clientpositive
(1) add_part_exist.q 创建有partition的表,增加partition,显示partition
CREATE TABLE add_part_test (key STRING, value STRING) PARTITIONED BY (ds STRING);
SHOW PARTITIONS add_part_test;
ALTER TABLE add_part_test ADD PARTITION (ds='2010-01-01');
SHOW PARTITIONS add_part_test;
ALTER TABLE add_part_test ADD IF NOT EXISTS PARTITION (ds='2010-01-01');
SHOW PARTITIONS add_part_test;
ALTER TABLE add_part_test ADD IF NOT EXISTS PARTITION (ds='2010-01-02');
SHOW PARTITIONS add_part_test;
ALTER TABLE add_part_test ADD IF NOT EXISTS PARTITION (ds='2010-01-01') PARTITION (ds='2010-01-02') PARTITION (ds='2010-01-03');
SHOW PARTITIONS add_part_test;
DROP TABLE add_part_test;
SHOW TABLES;
desc extended add_part_test partition(ds='2010-01-03');
需要注意的是:
SHOW TABLES , SHOW PARTITIONS 时,PARTITIONS和TABLES 都需要加上S,复数形式.
关于'2010-01-02'的一些困惑。
hive> alter table add_part_test add if not exists partition(ds=2010-01-02);
FAILED: Parse Error: line 1:61 mismatched input '-' expecting ) in add partition statement
hive> alter table add_part_test add if not exists partition(ds='2010-01-02');
OK
Time taken: 0.294 seconds
hive> alter table add_part_test add if not exists partition(ds=2011102);
OK
Time taken: 0.178 seconds
hive> show partitions add_part_test;
OK
ds=2010-01-01
ds=2010-01-02
ds=2011102
Time taken: 0.057 seconds
(2) alter1.q 修改一个表的属性,表的serde以及serde属性。修改column信息。
(3) create_default_prop.q 创建表
create_1.q 创建表的操作
create_*
DESCRIBE table3;
DESCRIBE EXTENDED table3;
DESC table3;
DESC EXTENDED table3;
是一样的,大小写不区分。
desc 0.7版本支持,0.5不支持
src/ql/src/test/queries下面是测试用例,clientpositive是运行成功的用例,clientnegative是运行失败,返回非0的用例。
src/ql/src/test/results 下面是测试用例对应的输出结果。如src/ql/src/test/queries/case_sensitivity.q对应的输出结果是src/ql/src/test/results/case_sensitivity.q.out
测试会运行case_sensitivity.q产生的输出放入build/ql/test/logs/clientpositive/case_sensitivity.q.out文件中,然后通过diff比对build/ql/test/logs/clientpositive/case_sensitivity.q.out src/ql/src/test/results/case_sensitivity.q.out两个文件,如果相同则测试通过,如果不同则测试失败。
测试前会事先create一些table,并load一些数据进去。
比如:case_sensitivity.q 的代码是
tianzhao@tianzhao-VirtualBox:~/hive/hive-1.1.2/src/ql/src/test/queries/clientpositive$ cat case_sensitivity.q
CREATE TABLE DEST1(Key INT, VALUE STRING) STORED AS TEXTFILE;
EXPLAIN
FROM SRC_THRIFT
INSERT OVERWRITE TABLE dest1 SELECT src_Thrift.LINT[1], src_thrift.lintstring[0].MYSTRING where src_thrift.liNT[0] > 0;
FROM SRC_THRIFT
INSERT OVERWRITE TABLE dest1 SELECT src_Thrift.LINT[1], src_thrift.lintstring[0].MYSTRING where src_thrift.liNT[0] > 0;
SELECT DEST1.* FROM Dest1;
/// 上面的HSQL中并没有创建SRC_THRIFT 表,但是能够用,那是因为在执行该文件的语句前已经创建好了这个表。
代码在org.apache.hadoop.hive.ql.QTestUtil.java中,它的方法init、createSources等。
从ant test -Dtestcase=TestCliDriver -Dqfile=case_sensitivity.q -Dtest.silent=false 在终端的输出也可以看出:
[junit] PREHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/kv1.txt' OVERWRITE INTO TABLE srcpart PARTITION (ds='2008-04-08',hr='11')
[junit] PREHOOK: type: LOAD
[junit] PREHOOK: Output: default@srcpart
[junit] Copying data from file:/home/tianzhao/apache/hive-trunk/data/files/kv1.txt
[junit] Copying file: file:/home/tianzhao/apache/hive-trunk/data/files/kv1.txt
[junit] Loading data to table default.srcpart partition (ds=2008-04-08, hr=11)
[junit] POSTHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/kv1.txt' OVERWRITE INTO TABLE srcpart PARTITION (ds='2008-04-08',hr='11')
[junit] POSTHOOK: type: LOAD
[junit] POSTHOOK: Output: default@srcpart
[junit] POSTHOOK: Output: default@srcpart@ds=2008-04-08/hr=11
[junit] OK
[junit] PREHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/kv1.txt' OVERWRITE INTO TABLE srcpart PARTITION (ds='2008-04-08',hr='12')
[junit] PREHOOK: type: LOAD
[junit] PREHOOK: Output: default@srcpart
[junit] Copying data from file:/home/tianzhao/apache/hive-trunk/data/files/kv1.txt
[junit] Copying file: file:/home/tianzhao/apache/hive-trunk/data/files/kv1.txt
[junit] Loading data to table default.srcpart partition (ds=2008-04-08, hr=12)
[junit] POSTHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/kv1.txt' OVERWRITE INTO TABLE srcpart PARTITION (ds='2008-04-08',hr='12')
[junit] POSTHOOK: type: LOAD
[junit] POSTHOOK: Output: default@srcpart
[junit] POSTHOOK: Output: default@srcpart@ds=2008-04-08/hr=12
[junit] OK
[junit] PREHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/kv1.txt' OVERWRITE INTO TABLE srcpart PARTITION (ds='2008-04-09',hr='11')
[junit] PREHOOK: type: LOAD
[junit] PREHOOK: Output: default@srcpart
[junit] Copying data from file:/home/tianzhao/apache/hive-trunk/data/files/kv1.txt
[junit] Copying file: file:/home/tianzhao/apache/hive-trunk/data/files/kv1.txt
[junit] Loading data to table default.srcpart partition (ds=2008-04-09, hr=11)
[junit] POSTHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/kv1.txt' OVERWRITE INTO TABLE srcpart PARTITION (ds='2008-04-09',hr='11')
[junit] POSTHOOK: type: LOAD
[junit] POSTHOOK: Output: default@srcpart
[junit] POSTHOOK: Output: default@srcpart@ds=2008-04-09/hr=11
[junit] OK
[junit] PREHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/kv1.txt' OVERWRITE INTO TABLE srcpart PARTITION (ds='2008-04-09',hr='12')
[junit] PREHOOK: type: LOAD
[junit] PREHOOK: Output: default@srcpart
[junit] Copying data from file:/home/tianzhao/apache/hive-trunk/data/files/kv1.txt
[junit] Copying file: file:/home/tianzhao/apache/hive-trunk/data/files/kv1.txt
[junit] Loading data to table default.srcpart partition (ds=2008-04-09, hr=12)
[junit] POSTHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/kv1.txt' OVERWRITE INTO TABLE srcpart PARTITION (ds='2008-04-09',hr='12')
[junit] POSTHOOK: type: LOAD
[junit] POSTHOOK: Output: default@srcpart
[junit] POSTHOOK: Output: default@srcpart@ds=2008-04-09/hr=12
[junit] OK
[junit] PREHOOK: query: CREATE TABLE srcbucket(key int, value string) CLUSTERED BY (key) INTO 2 BUCKETS STORED AS TEXTFILE
[junit] PREHOOK: type: CREATETABLE
[junit] POSTHOOK: query: CREATE TABLE srcbucket(key int, value string) CLUSTERED BY (key) INTO 2 BUCKETS STORED AS TEXTFILE
[junit] POSTHOOK: type: CREATETABLE
[junit] POSTHOOK: Output: default@srcbucket
[junit] OK
[junit] PREHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/srcbucket0.txt' INTO TABLE srcbucket
[junit] PREHOOK: type: LOAD
[junit] PREHOOK: Output: default@srcbucket
[junit] Copying data from file:/home/tianzhao/apache/hive-trunk/data/files/srcbucket0.txt
[junit] Copying file: file:/home/tianzhao/apache/hive-trunk/data/files/srcbucket0.txt
[junit] Loading data to table default.srcbucket
[junit] POSTHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/srcbucket0.txt' INTO TABLE srcbucket
[junit] POSTHOOK: type: LOAD
[junit] POSTHOOK: Output: default@srcbucket
[junit] OK
[junit] PREHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/srcbucket1.txt' INTO TABLE srcbucket
[junit] PREHOOK: type: LOAD
[junit] PREHOOK: Output: default@srcbucket
[junit] Copying data from file:/home/tianzhao/apache/hive-trunk/data/files/srcbucket1.txt
[junit] Copying file: file:/home/tianzhao/apache/hive-trunk/data/files/srcbucket1.txt
[junit] Loading data to table default.srcbucket
[junit] POSTHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/srcbucket1.txt' INTO TABLE srcbucket
[junit] POSTHOOK: type: LOAD
[junit] POSTHOOK: Output: default@srcbucket
[junit] OK
[junit] PREHOOK: query: CREATE TABLE srcbucket2(key int, value string) CLUSTERED BY (key) INTO 4 BUCKETS STORED AS TEXTFILE
[junit] PREHOOK: type: CREATETABLE
[junit] POSTHOOK: query: CREATE TABLE srcbucket2(key int, value string) CLUSTERED BY (key) INTO 4 BUCKETS STORED AS TEXTFILE
[junit] POSTHOOK: type: CREATETABLE
[junit] POSTHOOK: Output: default@srcbucket2
[junit] OK
[junit] PREHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/srcbucket20.txt' INTO TABLE srcbucket2
[junit] PREHOOK: type: LOAD
[junit] PREHOOK: Output: default@srcbucket2
[junit] Copying data from file:/home/tianzhao/apache/hive-trunk/data/files/srcbucket20.txt
[junit] Copying file: file:/home/tianzhao/apache/hive-trunk/data/files/srcbucket20.txt
[junit] Loading data to table default.srcbucket2
[junit] POSTHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/srcbucket20.txt' INTO TABLE srcbucket2
[junit] POSTHOOK: type: LOAD
[junit] POSTHOOK: Output: default@srcbucket2
[junit] OK
[junit] PREHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/srcbucket21.txt' INTO TABLE srcbucket2
[junit] PREHOOK: type: LOAD
[junit] PREHOOK: Output: default@srcbucket2
[junit] Copying data from file:/home/tianzhao/apache/hive-trunk/data/files/srcbucket21.txt
[junit] Copying file: file:/home/tianzhao/apache/hive-trunk/data/files/srcbucket21.txt
[junit] Loading data to table default.srcbucket2
[junit] POSTHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/srcbucket21.txt' INTO TABLE srcbucket2
[junit] POSTHOOK: type: LOAD
[junit] POSTHOOK: Output: default@srcbucket2
[junit] OK
[junit] PREHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/srcbucket22.txt' INTO TABLE srcbucket2
[junit] PREHOOK: type: LOAD
[junit] PREHOOK: Output: default@srcbucket2
[junit] Copying data from file:/home/tianzhao/apache/hive-trunk/data/files/srcbucket22.txt
[junit] Copying file: file:/home/tianzhao/apache/hive-trunk/data/files/srcbucket22.txt
[junit] Loading data to table default.srcbucket2
[junit] POSTHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/srcbucket22.txt' INTO TABLE srcbucket2
[junit] POSTHOOK: type: LOAD
[junit] POSTHOOK: Output: default@srcbucket2
[junit] OK
[junit] PREHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/srcbucket23.txt' INTO TABLE srcbucket2
[junit] PREHOOK: type: LOAD
[junit] PREHOOK: Output: default@srcbucket2
[junit] Copying data from file:/home/tianzhao/apache/hive-trunk/data/files/srcbucket23.txt
[junit] Copying file: file:/home/tianzhao/apache/hive-trunk/data/files/srcbucket23.txt
[junit] Loading data to table default.srcbucket2
[junit] POSTHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/srcbucket23.txt' INTO TABLE srcbucket2
[junit] POSTHOOK: type: LOAD
[junit] POSTHOOK: Output: default@srcbucket2
[junit] OK
[junit] PREHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/kv1.txt' INTO TABLE src
[junit] PREHOOK: type: LOAD
[junit] PREHOOK: Output: default@src
[junit] Copying data from file:/home/tianzhao/apache/hive-trunk/data/files/kv1.txt
[junit] Copying file: file:/home/tianzhao/apache/hive-trunk/data/files/kv1.txt
[junit] Loading data to table default.src
[junit] POSTHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/kv1.txt' INTO TABLE src
[junit] POSTHOOK: type: LOAD
[junit] POSTHOOK: Output: default@src
[junit] OK
[junit] PREHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/kv3.txt' INTO TABLE src1
[junit] PREHOOK: type: LOAD
[junit] PREHOOK: Output: default@src1
[junit] Copying data from file:/home/tianzhao/apache/hive-trunk/data/files/kv3.txt
[junit] Copying file: file:/home/tianzhao/apache/hive-trunk/data/files/kv3.txt
[junit] Loading data to table default.src1
[junit] POSTHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/kv3.txt' INTO TABLE src1
[junit] POSTHOOK: type: LOAD
[junit] POSTHOOK: Output: default@src1
[junit] OK
[junit] PREHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/kv1.seq' INTO TABLE src_sequencefile
[junit] PREHOOK: type: LOAD
[junit] PREHOOK: Output: default@src_sequencefile
[junit] Copying data from file:/home/tianzhao/apache/hive-trunk/data/files/kv1.seq
[junit] Copying file: file:/home/tianzhao/apache/hive-trunk/data/files/kv1.seq
[junit] Loading data to table default.src_sequencefile
[junit] POSTHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/kv1.seq' INTO TABLE src_sequencefile
[junit] POSTHOOK: type: LOAD
[junit] POSTHOOK: Output: default@src_sequencefile
[junit] OK
[junit] PREHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/complex.seq' INTO TABLE src_thrift
[junit] PREHOOK: type: LOAD
[junit] PREHOOK: Output: default@src_thrift
[junit] Copying data from file:/home/tianzhao/apache/hive-trunk/data/files/complex.seq
[junit] Copying file: file:/home/tianzhao/apache/hive-trunk/data/files/complex.seq
[junit] Loading data to table default.src_thrift
[junit] POSTHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/complex.seq' INTO TABLE src_thrift
[junit] POSTHOOK: type: LOAD
[junit] POSTHOOK: Output: default@src_thrift
[junit] OK
[junit] PREHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/json.txt' INTO TABLE src_json
[junit] PREHOOK: type: LOAD
[junit] PREHOOK: Output: default@src_json
[junit] Copying data from file:/home/tianzhao/apache/hive-trunk/data/files/json.txt
[junit] Copying file: file:/home/tianzhao/apache/hive-trunk/data/files/json.txt
[junit] Loading data to table default.src_json
[junit] POSTHOOK: query: LOAD DATA LOCAL INPATH '/home/tianzhao/apache/hive-trunk/data/files/json.txt' INTO TABLE src_json
[junit] POSTHOOK: type: LOAD
[junit] POSTHOOK: Output: default@src_json
[junit] OK
上面显示了创建的表和load的数据。
测试case_sensitivity.q的显示是:
[junit] Running org.apache.hadoop.hive.cli.TestCliDriver
[junit] Begin query: case_sensitivity.q
[junit] Deleted file:/home/tianzhao/apache/hive-trunk/build/ql/test/data/warehouse/dest1
[junit] diff -a -I file: -I pfile: -I hdfs: -I /tmp/ -I invalidscheme: -I lastUpdateTime -I lastAccessTime -I [Oo]wner -I CreateTime -I LastAccessTime -I Location -I transient_lastDdlTime -I last_modified_ -I java.lang.RuntimeException -I at org -I at sun -I at java -I at junit -I Caused by: -I LOCK_QUERYID: -I grantTime -I [.][.][.] [0-9]* more -I USING 'java -cp /home/tianzhao/apache/hive-trunk/build/ql/test/logs/clientpositive/case_sensitivity.q.out /home/tianzhao/apache/hive-trunk/ql/src/test/results/clientpositive/case_sensitivity.q.out
[junit] Done query: case_sensitivity.q
[junit] Cleaning up TestCliDriver
生成的结果在build/ql/test/logs/clientpositive/case_sensitivity.q.out 中,通过diff比对它与ql/src/test/results/clientpositive/case_sensitivity.q.out是否相同来判断该UT是否通过。
我们来看如何手工创建src_thrift表,load数据,并执行case_sensitivity.q中的HSQL。
org.apache.hadoop.hive.ql.QTestUtil.createSources()中创建src_thrift表的语句是:
Table srcThrift = new Table(db.getCurrentDatabase(), "src_thrift");
srcThrift.setInputFormatClass(SequenceFileInputFormat.class.getName());
srcThrift.setOutputFormatClass(SequenceFileOutputFormat.class.getName());
srcThrift.setSerializationLib(ThriftDeserializer.class.getName());
srcThrift.setSerdeParam(Constants.SERIALIZATION_CLASS, Complex.class
.getName());
srcThrift.setSerdeParam(Constants.SERIALIZATION_FORMAT,
TBinaryProtocol.class.getName());
db.createTable(srcThrift);
存储格式是SequenceFile,serde是ThriftDeserializer,serde的两个属性是SERIALIZATION_CLASS和SERIALIZATION_FORMAT。创建表的时候需要知道表的字段,这里没有写。但是在(Constants.SERIALIZATION_CLASS, Complex.class.getName())中已经定义了。
那么看org.apache.hadoop.hive.serde2.thrift.test.Complex的定义:
public int aint;
public static final int AINT = 1;
public String aString;
public static final int ASTRING = 2;
public List<Integer> lint;
public static final int LINT = 3;
public List<String> lString;
public static final int LSTRING = 4;
public List<IntString> lintString;
public static final int LINTSTRING = 5;
public Map<String,String> mStringString;
public static final int MSTRINGSTRING = 6;
IntString的定义:
public int myint;
public static final int MYINT = 1;
public String myString;
public static final int MYSTRING = 2;
public int underscore_int;
public static final int UNDERSCORE_INT = 3;
可以还原src_thrift的字段:
建表语句是:
hive> create table src_thrift(aint int, aString string,lint array<int>, lString array<string>, lintString array<struct<myint:int, mString:string, underscore_int:int>>, mStringString map<string, string>)
> row format serde 'org.apache.hadoop.hive.serde2.thrift.ThriftDeserializer' with serdeproperties("serialization.class"="org.apache.hadoop.hive.serde2.thrift.test.Complex", "serialization.format"="org.apache.thrift.protocol.TBinaryProtocol")
> stored as sequencefile;
OK
Time taken: 0.462 seconds
load数据是:
hive> load data local inpath 'src/data/files/complex.seq' into table src_thrift;
Copying data from file:/home/tianzhao/hive/hive-1.1.2/src/data/files/complex.seq
Loading data to table src_thrift
OK
Time taken: 0.286 seconds
查看数据是:
hive> select * from src_thrift limit 2;
OK
1712634731 record_0 [0,0,0] ["0","0","0"] [{"myint":0,"mystring":"0","underscore_int":0}] {"key_0":"value_0"}
465985200 record_1 [1,2,3] ["10","100","1000"] [{"myint":1,"mystring":"1","underscore_int":1}] {"key_1":"value_1"}
Time taken: 0.34 seconds
查看表的信息是:
hive> desc src_thrift;
OK
aint int from deserializer
astring string from deserializer
lint array<int> from deserializer
lstring array<string> from deserializer
lintstring array<org.apache.hadoop.hive.serde2.thrift.test.IntString> from deserializer
mstringstring map<string,string> from deserializer
Time taken: 0.085 seconds
运行case_sensitivity.q里面的一个语句:(截取了一部分)
hive> from src_thrift SELECT src_Thrift.LINT[1], src_thrift.lintstring[0].MYSTRING where src_thrift.liNT[0] > 0;
Total MapReduce jobs = 1
Launching Job 1 out of 1
Number of reduce tasks is set to 0 since there's no reduce operator
Starting Job = job_201105281127_0001, Tracking URL = http://localhost:50030/jobdetails.jsp?jobid=job_201105281127_0001
Kill Command = /home/tianzhao/hive/hadoop-0.20.2/bin/../bin/hadoop job -Dmapred.job.tracker=localhost:54311 -kill job_201105281127_0001
2011-05-28 12:04:52,869 Stage-1 map = 0%, reduce = 0%
2011-05-28 12:04:55,921 Stage-1 map = 100%, reduce = 0%
2011-05-28 12:04:58,962 Stage-1 map = 100%, reduce = 100%
Ended Job = job_201105281127_0001
OK
2 1
4 8
6 27
8 64
10 125
12 216
14 343
16 512
18 729
Time taken: 12.147 seconds
src表
org.apache.hadoop.hive.ql.QTestUtil.createSources() :
LinkedList<String> cols = new LinkedList<String>();
cols.add("key");
cols.add("value");
for (String tname : new String[] {"src", "src1"}) {
db.createTable(tname, cols, null, TextInputFormat.class,
IgnoreKeyTextOutputFormat.class);
}
src、src1两表都是两个columns:
create table src(key string, value string);
load数据:
// load the input data into the src table
fpath = new Path(testFiles, "kv1.txt");
newfpath = new Path(tmppath, "kv1.txt");
fs.copyFromLocalFile(false, true, fpath, newfpath);
// db.loadTable(newfpath, "src", false);
runLoadCmd("LOAD DATA INPATH '" + newfpath.toString() + "' INTO TABLE src");
load data local inpath 'src/data/files/kv1.txt' into table src;
有了这些东西,我们可以手工测试使用src/ql/src/test/queries下面的各个UT里面的语句。
目录下面的文件 hive-0.7.0/src/ql/src/test/queries/clientpositive
(1) add_part_exist.q 创建有partition的表,增加partition,显示partition
CREATE TABLE add_part_test (key STRING, value STRING) PARTITIONED BY (ds STRING);
SHOW PARTITIONS add_part_test;
ALTER TABLE add_part_test ADD PARTITION (ds='2010-01-01');
SHOW PARTITIONS add_part_test;
ALTER TABLE add_part_test ADD IF NOT EXISTS PARTITION (ds='2010-01-01');
SHOW PARTITIONS add_part_test;
ALTER TABLE add_part_test ADD IF NOT EXISTS PARTITION (ds='2010-01-02');
SHOW PARTITIONS add_part_test;
ALTER TABLE add_part_test ADD IF NOT EXISTS PARTITION (ds='2010-01-01') PARTITION (ds='2010-01-02') PARTITION (ds='2010-01-03');
SHOW PARTITIONS add_part_test;
DROP TABLE add_part_test;
SHOW TABLES;
desc extended add_part_test partition(ds='2010-01-03');
需要注意的是:
SHOW TABLES , SHOW PARTITIONS 时,PARTITIONS和TABLES 都需要加上S,复数形式.
关于'2010-01-02'的一些困惑。
hive> alter table add_part_test add if not exists partition(ds=2010-01-02);
FAILED: Parse Error: line 1:61 mismatched input '-' expecting ) in add partition statement
hive> alter table add_part_test add if not exists partition(ds='2010-01-02');
OK
Time taken: 0.294 seconds
hive> alter table add_part_test add if not exists partition(ds=2011102);
OK
Time taken: 0.178 seconds
hive> show partitions add_part_test;
OK
ds=2010-01-01
ds=2010-01-02
ds=2011102
Time taken: 0.057 seconds
(2) alter1.q 修改一个表的属性,表的serde以及serde属性。修改column信息。
(3) create_default_prop.q 创建表
create_1.q 创建表的操作
create_*
DESCRIBE table3;
DESCRIBE EXTENDED table3;
DESC table3;
DESC EXTENDED table3;
是一样的,大小写不区分。
desc 0.7版本支持,0.5不支持