Files
impala/testdata/workloads/functional-query/queries/QueryTest/compute-stats-date.test
Chang Wu a93f2c2675 IMPALA-8205: Support number of true and false statistics for boolean column
This change compute the real number of true and false statistics
information for boolean columns. Before this, impala used to set
numTrues and numFalses to hardcoded -1 to indicate that its
statistics is missing.

Test Done:
Append the numTrue and numFalse test for all the statistics-related
test cases including the non-incremental, incremental and other test
cases.

Change-Id: I991bee8e7fdc644d908289f5fe2ee8032cc2c431
Reviewed-on: http://gerrit.cloudera.org:8080/14666
Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
2020-05-12 23:29:04 +00:00

84 lines
2.7 KiB
Plaintext

====
---- QUERY
# test compute stats on a partitioned date text table
create table date_tbl_copy like functional.date_tbl;
insert into date_tbl_copy partition(date_part)
select * from functional.date_tbl;
alter table date_tbl_copy add column d DATE;
====
---- QUERY
compute stats date_tbl_copy;
---- RESULTS
'Updated 4 partition(s) and 3 column(s).'
====
---- QUERY
show table stats date_tbl_copy;
---- LABELS
date_part, #Rows, #Files, Size, Bytes Cached, Cache Replication, Format, Incremental Stats, Location
---- RESULTS
'0001-01-01',7,1,'83B','NOT CACHED','NOT CACHED','TEXT','false',regex:.*
'1399-06-27',3,1,'34B','NOT CACHED','NOT CACHED','TEXT','false',regex:.*
'2017-11-27',10,1,'140B','NOT CACHED','NOT CACHED','TEXT','false',regex:.*
'9999-12-31',2,1,'28B','NOT CACHED','NOT CACHED','TEXT','false',regex:.*
'Total',22,4,'285B','0B','','','',''
---- TYPES
STRING, BIGINT, BIGINT, STRING, STRING, STRING, STRING, STRING, STRING
====
---- QUERY
show column stats date_tbl_copy;
---- LABELS
COLUMN, TYPE, #DISTINCT VALUES, #NULLS, MAX SIZE, AVG SIZE, #TRUES, #FALSES
---- RESULTS
'd','DATE',0,22,4,4,-1,-1
'date_part','DATE',4,0,4,4,-1,-1
'date_col','DATE',16,2,4,4,-1,-1
'id_col','INT',22,0,4,4,-1,-1
---- TYPES
STRING, STRING, BIGINT, BIGINT, BIGINT, DOUBLE, BIGINT, BIGINT
====
---- QUERY
# Removing a column shouldn't cause the stats to be dropped.
alter table date_tbl_copy drop column date_col;
---- RESULTS
'Column has been dropped.'
====
---- QUERY
show column stats date_tbl_copy;
---- LABELS
COLUMN, TYPE, #DISTINCT VALUES, #NULLS, MAX SIZE, AVG SIZE, #TRUES, #FALSES
---- RESULTS
'd','DATE',0,22,4,4,-1,-1
'id_col','INT',22,0,4,4,-1,-1
'date_part','DATE',4,0,4,4,-1,-1
---- TYPES
STRING, STRING, BIGINT, BIGINT, BIGINT, DOUBLE, BIGINT, BIGINT
====
---- QUERY
# drop stats from this table
drop stats date_tbl_copy;
====
---- QUERY
show table stats date_tbl_copy;
---- LABELS
date_part, #Rows, #Files, Size, Bytes Cached, Cache Replication, Format, Incremental Stats, Location
---- RESULTS
'0001-01-01',-1,1,'83B','NOT CACHED','NOT CACHED','TEXT','false',regex:.*
'1399-06-27',-1,1,'34B','NOT CACHED','NOT CACHED','TEXT','false',regex:.*
'2017-11-27',-1,1,'140B','NOT CACHED','NOT CACHED','TEXT','false',regex:.*
'9999-12-31',-1,1,'28B','NOT CACHED','NOT CACHED','TEXT','false',regex:.*
'Total',-1,4,'285B','0B','','','',''
---- TYPES
STRING, BIGINT, BIGINT, STRING, STRING, STRING, STRING, STRING, STRING
====
---- QUERY
show column stats date_tbl_copy;
---- LABELS
COLUMN, TYPE, #DISTINCT VALUES, #NULLS, MAX SIZE, AVG SIZE, #TRUES, #FALSES
---- RESULTS
'd','DATE',-1,-1,4,4,-1,-1
'id_col','INT',-1,-1,4,4,-1,-1
'date_part','DATE',4,0,4,4,-1,-1
---- TYPES
STRING, STRING, BIGINT, BIGINT, BIGINT, DOUBLE, BIGINT, BIGINT
====