Skip to content

Commit

Permalink
add q test
Browse files Browse the repository at this point in the history
  • Loading branch information
kasakrisz committed Oct 14, 2024
1 parent cd816a0 commit 99042b8
Show file tree
Hide file tree
Showing 4 changed files with 274 additions and 41 deletions.
5 changes: 0 additions & 5 deletions ql/src/test/queries/clientpositive/distributeby.q
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
set hive.vectorized.execution.enabled=false;

create table t1 (a string, b int);

insert into t1 values ('2014-03-14 10:10:12', 10);
Expand All @@ -19,9 +17,6 @@ explain
select * from t1 distribute by a, b sort by a;

-- cluster by
explain ast
select * from t1 cluster by a, b;

explain cbo
select * from t1 cluster by a, b;

Expand Down
26 changes: 26 additions & 0 deletions ql/src/test/queries/clientpositive/distributeby_cboret.q
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
set hive.cbo.returnpath.hiveop=true;

create table t1 (a string, b int);

insert into t1 values ('2014-03-14 10:10:12', 10);

-- distribute by
explain cbo
select * from t1 where a between date_add('2014-03-14', -1) and '2014-03-14' distribute by a;
explain
select * from t1 where a between date_add('2014-03-14', -1) and '2014-03-14' distribute by a;
select * from t1 where a between date_add('2014-03-14', -1) and '2014-03-14' distribute by a;

-- distribute by and sort by
explain cbo
select * from t1 distribute by a, b sort by a;

explain
select * from t1 distribute by a, b sort by a;

-- cluster by
explain cbo
select * from t1 cluster by a, b;

explain
select * from t1 cluster by a, b;
42 changes: 6 additions & 36 deletions ql/src/test/results/clientpositive/llap/distributeby.q.out
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ STAGE PLANS:
Map-reduce partition columns: _col0 (type: string)
Statistics: Num rows: 1 Data size: 107 Basic stats: COMPLETE Column stats: COMPLETE
value expressions: _col0 (type: string), _col1 (type: int)
Execution mode: llap
Execution mode: vectorized, llap
LLAP IO: all inputs
Reducer 2
Execution mode: llap
Execution mode: vectorized, llap
Reduce Operator Tree:
Select Operator
expressions: VALUE._col0 (type: string), VALUE._col1 (type: int)
Expand Down Expand Up @@ -158,10 +158,10 @@ STAGE PLANS:
Map-reduce partition columns: _col0 (type: string), _col1 (type: int)
Statistics: Num rows: 1 Data size: 107 Basic stats: COMPLETE Column stats: COMPLETE
value expressions: _col1 (type: int)
Execution mode: llap
Execution mode: vectorized, llap
LLAP IO: all inputs
Reducer 2
Execution mode: llap
Execution mode: vectorized, llap
Reduce Operator Tree:
Select Operator
expressions: KEY.reducesinkkey0 (type: string), VALUE._col0 (type: int)
Expand All @@ -181,36 +181,6 @@ STAGE PLANS:
Processor Tree:
ListSink

PREHOOK: query: explain ast
select * from t1 cluster by a, b
PREHOOK: type: QUERY
PREHOOK: Input: default@t1
#### A masked pattern was here ####
POSTHOOK: query: explain ast
select * from t1 cluster by a, b
POSTHOOK: type: QUERY
POSTHOOK: Input: default@t1
#### A masked pattern was here ####
ABSTRACT SYNTAX TREE:

TOK_QUERY
TOK_FROM
TOK_TABREF
TOK_TABNAME
t1
TOK_INSERT
TOK_DESTINATION
TOK_DIR
TOK_TMP_FILE
TOK_SELECT
TOK_SELEXPR
TOK_ALLCOLREF
TOK_CLUSTERBY
TOK_TABLE_OR_COL
a
TOK_TABLE_OR_COL
b

PREHOOK: query: explain cbo
select * from t1 cluster by a, b
PREHOOK: type: QUERY
Expand Down Expand Up @@ -263,10 +233,10 @@ STAGE PLANS:
sort order: ++
Map-reduce partition columns: _col0 (type: string), _col1 (type: int)
Statistics: Num rows: 1 Data size: 107 Basic stats: COMPLETE Column stats: COMPLETE
Execution mode: llap
Execution mode: vectorized, llap
LLAP IO: all inputs
Reducer 2
Execution mode: llap
Execution mode: vectorized, llap
Reduce Operator Tree:
Select Operator
expressions: KEY.reducesinkkey0 (type: string), KEY.reducesinkkey1 (type: int)
Expand Down
242 changes: 242 additions & 0 deletions ql/src/test/results/clientpositive/llap/distributeby_cboret.q.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,242 @@
PREHOOK: query: create table t1 (a string, b int)
PREHOOK: type: CREATETABLE
PREHOOK: Output: database:default
PREHOOK: Output: default@t1
POSTHOOK: query: create table t1 (a string, b int)
POSTHOOK: type: CREATETABLE
POSTHOOK: Output: database:default
POSTHOOK: Output: default@t1
PREHOOK: query: insert into t1 values ('2014-03-14 10:10:12', 10)
PREHOOK: type: QUERY
PREHOOK: Input: _dummy_database@_dummy_table
PREHOOK: Output: default@t1
POSTHOOK: query: insert into t1 values ('2014-03-14 10:10:12', 10)
POSTHOOK: type: QUERY
POSTHOOK: Input: _dummy_database@_dummy_table
POSTHOOK: Output: default@t1
POSTHOOK: Lineage: t1.a SCRIPT []
POSTHOOK: Lineage: t1.b SCRIPT []
PREHOOK: query: explain cbo
select * from t1 where a between date_add('2014-03-14', -1) and '2014-03-14' distribute by a
PREHOOK: type: QUERY
PREHOOK: Input: default@t1
#### A masked pattern was here ####
POSTHOOK: query: explain cbo
select * from t1 where a between date_add('2014-03-14', -1) and '2014-03-14' distribute by a
POSTHOOK: type: QUERY
POSTHOOK: Input: default@t1
#### A masked pattern was here ####
PREHOOK: query: explain
select * from t1 where a between date_add('2014-03-14', -1) and '2014-03-14' distribute by a
PREHOOK: type: QUERY
PREHOOK: Input: default@t1
#### A masked pattern was here ####
POSTHOOK: query: explain
select * from t1 where a between date_add('2014-03-14', -1) and '2014-03-14' distribute by a
POSTHOOK: type: QUERY
POSTHOOK: Input: default@t1
#### A masked pattern was here ####
STAGE DEPENDENCIES:
Stage-1 is a root stage
Stage-0 depends on stages: Stage-1

STAGE PLANS:
Stage: Stage-1
Tez
#### A masked pattern was here ####
Edges:
Reducer 2 <- Map 1 (CUSTOM_SIMPLE_EDGE)
#### A masked pattern was here ####
Vertices:
Map 1
Map Operator Tree:
TableScan
alias: t1
filterExpr: CAST( a AS DATE) BETWEEN DATE'2014-03-13' AND DATE'2014-03-14' (type: boolean)
Statistics: Num rows: 1 Data size: 107 Basic stats: COMPLETE Column stats: COMPLETE
Filter Operator
predicate: CAST( a AS DATE) BETWEEN DATE'2014-03-13' AND DATE'2014-03-14' (type: boolean)
Statistics: Num rows: 1 Data size: 107 Basic stats: COMPLETE Column stats: COMPLETE
Select Operator
expressions: a (type: string), b (type: int)
outputColumnNames: a, b
Statistics: Num rows: 1 Data size: 107 Basic stats: COMPLETE Column stats: COMPLETE
Reduce Output Operator
null sort order:
sort order:
Map-reduce partition columns: a (type: string)
Statistics: Num rows: 1 Data size: 107 Basic stats: COMPLETE Column stats: COMPLETE
value expressions: a (type: string), b (type: int)
Execution mode: vectorized, llap
LLAP IO: all inputs
Reducer 2
Execution mode: vectorized, llap
Reduce Operator Tree:
Select Operator
expressions: VALUE.a (type: string), VALUE.b (type: int)
outputColumnNames: a, b
Statistics: Num rows: 1 Data size: 107 Basic stats: COMPLETE Column stats: COMPLETE
File Output Operator
compressed: false
Statistics: Num rows: 1 Data size: 107 Basic stats: COMPLETE Column stats: COMPLETE
table:
input format: org.apache.hadoop.mapred.SequenceFileInputFormat
output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe

Stage: Stage-0
Fetch Operator
limit: -1
Processor Tree:
ListSink

PREHOOK: query: select * from t1 where a between date_add('2014-03-14', -1) and '2014-03-14' distribute by a
PREHOOK: type: QUERY
PREHOOK: Input: default@t1
#### A masked pattern was here ####
POSTHOOK: query: select * from t1 where a between date_add('2014-03-14', -1) and '2014-03-14' distribute by a
POSTHOOK: type: QUERY
POSTHOOK: Input: default@t1
#### A masked pattern was here ####
2014-03-14 10:10:12 10
PREHOOK: query: explain cbo
select * from t1 distribute by a, b sort by a
PREHOOK: type: QUERY
PREHOOK: Input: default@t1
#### A masked pattern was here ####
POSTHOOK: query: explain cbo
select * from t1 distribute by a, b sort by a
POSTHOOK: type: QUERY
POSTHOOK: Input: default@t1
#### A masked pattern was here ####
PREHOOK: query: explain
select * from t1 distribute by a, b sort by a
PREHOOK: type: QUERY
PREHOOK: Input: default@t1
#### A masked pattern was here ####
POSTHOOK: query: explain
select * from t1 distribute by a, b sort by a
POSTHOOK: type: QUERY
POSTHOOK: Input: default@t1
#### A masked pattern was here ####
STAGE DEPENDENCIES:
Stage-1 is a root stage
Stage-0 depends on stages: Stage-1

STAGE PLANS:
Stage: Stage-1
Tez
#### A masked pattern was here ####
Edges:
Reducer 2 <- Map 1 (SIMPLE_EDGE)
#### A masked pattern was here ####
Vertices:
Map 1
Map Operator Tree:
TableScan
alias: t1
Statistics: Num rows: 1 Data size: 107 Basic stats: COMPLETE Column stats: COMPLETE
Select Operator
expressions: a (type: string), b (type: int)
outputColumnNames: a, b
Statistics: Num rows: 1 Data size: 107 Basic stats: COMPLETE Column stats: COMPLETE
Reduce Output Operator
key expressions: a (type: string)
null sort order: z
sort order: +
Map-reduce partition columns: a (type: string), b (type: int)
Statistics: Num rows: 1 Data size: 107 Basic stats: COMPLETE Column stats: COMPLETE
value expressions: b (type: int)
Execution mode: vectorized, llap
LLAP IO: all inputs
Reducer 2
Execution mode: vectorized, llap
Reduce Operator Tree:
Select Operator
expressions: KEY.reducesinkkey0 (type: string), VALUE.b (type: int)
outputColumnNames: a, b
Statistics: Num rows: 1 Data size: 107 Basic stats: COMPLETE Column stats: COMPLETE
File Output Operator
compressed: false
Statistics: Num rows: 1 Data size: 107 Basic stats: COMPLETE Column stats: COMPLETE
table:
input format: org.apache.hadoop.mapred.SequenceFileInputFormat
output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe

Stage: Stage-0
Fetch Operator
limit: -1
Processor Tree:
ListSink

PREHOOK: query: explain cbo
select * from t1 cluster by a, b
PREHOOK: type: QUERY
PREHOOK: Input: default@t1
#### A masked pattern was here ####
POSTHOOK: query: explain cbo
select * from t1 cluster by a, b
POSTHOOK: type: QUERY
POSTHOOK: Input: default@t1
#### A masked pattern was here ####
PREHOOK: query: explain
select * from t1 cluster by a, b
PREHOOK: type: QUERY
PREHOOK: Input: default@t1
#### A masked pattern was here ####
POSTHOOK: query: explain
select * from t1 cluster by a, b
POSTHOOK: type: QUERY
POSTHOOK: Input: default@t1
#### A masked pattern was here ####
STAGE DEPENDENCIES:
Stage-1 is a root stage
Stage-0 depends on stages: Stage-1

STAGE PLANS:
Stage: Stage-1
Tez
#### A masked pattern was here ####
Edges:
Reducer 2 <- Map 1 (SIMPLE_EDGE)
#### A masked pattern was here ####
Vertices:
Map 1
Map Operator Tree:
TableScan
alias: t1
Statistics: Num rows: 1 Data size: 107 Basic stats: COMPLETE Column stats: COMPLETE
Select Operator
expressions: a (type: string), b (type: int)
outputColumnNames: a, b
Statistics: Num rows: 1 Data size: 107 Basic stats: COMPLETE Column stats: COMPLETE
Reduce Output Operator
key expressions: a (type: string), b (type: int)
null sort order: aa
sort order: ++
Map-reduce partition columns: a (type: string), b (type: int)
Statistics: Num rows: 1 Data size: 107 Basic stats: COMPLETE Column stats: COMPLETE
Execution mode: vectorized, llap
LLAP IO: all inputs
Reducer 2
Execution mode: vectorized, llap
Reduce Operator Tree:
Select Operator
expressions: KEY.reducesinkkey0 (type: string), KEY.reducesinkkey1 (type: int)
outputColumnNames: a, b
Statistics: Num rows: 1 Data size: 107 Basic stats: COMPLETE Column stats: COMPLETE
File Output Operator
compressed: false
Statistics: Num rows: 1 Data size: 107 Basic stats: COMPLETE Column stats: COMPLETE
table:
input format: org.apache.hadoop.mapred.SequenceFileInputFormat
output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe

Stage: Stage-0
Fetch Operator
limit: -1
Processor Tree:
ListSink

0 comments on commit 99042b8

Please sign in to comment.