Files
impala/testdata/workloads/functional-query/queries/QueryTest/union-const-scalar-expr-codegen.test
Csaba Ringhofer 3843f7ff46 IMPALA-11200: Avoid redundant "Codegen enabled" messages in profile
Before this patch the message was added to the profile in Open(),
which can be called multiple times in subplans.

Moved it to Close(), which is only called once in the lifetime
of a Node/Aggregator.

A drawback of this is that this info won't be visible when the
Node is still active, but I don't think that it is a very useful
info in a still running query.

Also added a new feature to test_result_verifier.py:
Inside RUNTIME_PROFILE section row_regex can be negated with !,
so !row_regex [regex] means that regex is not matched by any line
in the profile.

Testing:
- added a regression test

Change-Id: Iad2e31900ee6d29385cc8adc6bbf067d91f6450f
Reviewed-on: http://gerrit.cloudera.org:8080/18385
Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
2022-04-13 12:31:36 +00:00

81 lines
2.3 KiB
Plaintext

====
---- QUERY
# Test union with multiple legs each having const expressions.
# Expect codegen to be disabled for const expressions.
set DISABLE_CODEGEN_ROWS_THRESHOLD=1;
select 1,2,3 union all select 4,5,6 union all select 7,8,9 order by 1;
---- TYPES
tinyint,tinyint,tinyint
---- RESULTS
1,2,3
4,5,6
7,8,9
---- RUNTIME_PROFILE
00:UNION
constant-operands=3
#SORT_NODE
ExecOption: Codegen Enabled
#UNION_NODE
ExecOption: Codegen Disabled for const scalar expressions, Codegen Enabled
====
---- QUERY
# Test insert statement with values (translated into UNION with const expressions).
# Expect codegen to be disabled for const expressions.
set DISABLE_CODEGEN_ROWS_THRESHOLD=1;
drop table if exists test_values_codegen;
create table test_values_codegen (c1 int, c2 timestamp, c3 string);
insert into test_values_codegen(c1) values (CAST(1+ceil(2.5)*3 as tinyint));
---- RUNTIME_PROFILE
00:UNION
constant-operands=1
#UNION_NODE
ExecOption: Codegen Disabled for const scalar expressions, Codegen Enabled
====
---- QUERY
# Test insert statement with values having const scalar expressions.
# Expect codegen to be disabled for const expressions.
set DISABLE_CODEGEN_ROWS_THRESHOLD=1;
insert into test_values_codegen values
(1+1, '2015-04-09 14:07:46.580465000', base64encode('hello world')),
(CAST(1*2+2-5 as INT), CAST(1428421382 as timestamp),
regexp_extract('abcdef123ghi456jkl','.*?(\\d+)',0));
---- RUNTIME_PROFILE
00:UNION
constant-operands=2
#UNION_NODE
ExecOption: Codegen Disabled for const scalar expressions, Codegen Enabled
====
---- QUERY
# Test the result of above inserts with codegen disabled.
select * from test_values_codegen order by c1;
---- TYPES
int, timestamp, string
---- RESULTS
-1,2015-04-07 15:43:02,'abcdef123ghi456'
2,2015-04-09 14:07:46.580465000,'aGVsbG8gd29ybGQ='
10,NULL,'NULL'
====
---- QUERY
# Test union with const expressions in a subplan.
# Expect codegen enabled.
select count(c.c_custkey), count(v.tot_price)
from tpch_nested_parquet.customer c, (
select sum(o_totalprice) tot_price from c.c_orders
union
select 9.99 tot_price) v;
---- TYPES
BIGINT, BIGINT
---- RESULTS
300000,249996
---- RUNTIME_PROFILE
01:SUBPLAN
| 03:UNION
| | constant-operands=1
#AGGREGATION_NODE (id=6)
ExecOption: Codegen Enabled
#UNION_NODE (id=3)
ExecOption: Codegen Enabled
#AGGREGATION_NODE (id=5)
ExecOption: Codegen Enabled
====