diff --git a/be/src/service/query-options.cc b/be/src/service/query-options.cc index 00f55a36d..08c66253e 100644 --- a/be/src/service/query-options.cc +++ b/be/src/service/query-options.cc @@ -284,7 +284,8 @@ Status impala::SetQueryOption(const string& key, const string& value, query_options->__set_exec_single_node_rows_threshold(atoi(value.c_str())); break; case TImpalaQueryOptions::OPTIMIZE_PARTITION_KEY_SCANS: - query_options->__set_optimize_partition_key_scans(atoi(value.c_str())); + query_options->__set_optimize_partition_key_scans( + iequals(value, "true") || iequals(value, "1")); break; case TImpalaQueryOptions::REPLICA_PREFERENCE: if (iequals(value, "cache_local") || iequals(value, "0")) { @@ -308,8 +309,10 @@ Status impala::SetQueryOption(const string& key, const string& value, break; case TImpalaQueryOptions::SCAN_NODE_CODEGEN_THRESHOLD: query_options->__set_scan_node_codegen_threshold(atol(value.c_str())); + break; case TImpalaQueryOptions::DISABLE_STREAMING_PREAGGREGATIONS: - query_options->__set_disable_streaming_preaggregations(atoi(value.c_str())); + query_options->__set_disable_streaming_preaggregations( + iequals(value, "true") || iequals(value, "1")); break; case TImpalaQueryOptions::RUNTIME_FILTER_MODE: if (iequals(value, "off") || iequals(value, "0")) { diff --git a/testdata/workloads/functional-query/queries/QueryTest/set.test b/testdata/workloads/functional-query/queries/QueryTest/set.test index f32107762..361fc9b78 100644 --- a/testdata/workloads/functional-query/queries/QueryTest/set.test +++ b/testdata/workloads/functional-query/queries/QueryTest/set.test @@ -165,3 +165,94 @@ select count(string_col) from functional.alltypestiny ---- TYPES BIGINT ==== +---- QUERY +# IMPALA-3334: 'optimize_partition_key_scans' is a boolean query option +set explain_level=0; +set optimize_partition_key_scans=true; +explain select min(month), max(year), ndv(day) from functional.alltypesagg; +---- RESULTS: VERIFY_IS_SUBSET +'01:AGGREGATE [FINALIZE]' +'00:UNION' +' constant-operands=11' +==== +---- QUERY +set explain_level=0; +set optimize_partition_key_scans=1; +explain select min(month), max(year), ndv(day) from functional.alltypesagg; +---- RESULTS: VERIFY_IS_SUBSET +'01:AGGREGATE [FINALIZE]' +'00:UNION' +' constant-operands=11' +==== +---- QUERY +set explain_level=0; +set optimize_partition_key_scans=false; +explain select min(month), max(year), ndv(day) from functional.alltypesagg; +---- RESULTS: VERIFY_IS_SUBSET +'03:AGGREGATE [FINALIZE]' +'02:EXCHANGE [UNPARTITIONED]' +'01:AGGREGATE' +'00:SCAN HDFS [functional.alltypesagg]' +==== +---- QUERY +set explain_level=0; +set optimize_partition_key_scans=0; +explain select min(month), max(year), ndv(day) from functional.alltypesagg; +---- RESULTS: VERIFY_IS_SUBSET +'03:AGGREGATE [FINALIZE]' +'02:EXCHANGE [UNPARTITIONED]' +'01:AGGREGATE' +'00:SCAN HDFS [functional.alltypesagg]' +==== +---- QUERY +set explain_level=0; +set disable_streaming_preaggregations=false; +explain select count(distinct double_col) from functional.alltypesagg; +---- RESULTS: VERIFY_IS_SUBSET +'06:AGGREGATE [FINALIZE]' +'05:EXCHANGE [UNPARTITIONED]' +'02:AGGREGATE' +'04:AGGREGATE' +'03:EXCHANGE [HASH(double_col)]' +'01:AGGREGATE [STREAMING]' +'00:SCAN HDFS [functional.alltypesagg]' +==== +---- QUERY +set explain_level=0; +set disable_streaming_preaggregations=0; +explain select count(distinct double_col) from functional.alltypesagg; +---- RESULTS: VERIFY_IS_SUBSET +'06:AGGREGATE [FINALIZE]' +'05:EXCHANGE [UNPARTITIONED]' +'02:AGGREGATE' +'04:AGGREGATE' +'03:EXCHANGE [HASH(double_col)]' +'01:AGGREGATE [STREAMING]' +'00:SCAN HDFS [functional.alltypesagg]' +==== +---- QUERY +set explain_level=0; +set disable_streaming_preaggregations=true; +explain select count(distinct double_col) from functional.alltypesagg; +---- RESULTS: VERIFY_IS_SUBSET +'06:AGGREGATE [FINALIZE]' +'05:EXCHANGE [UNPARTITIONED]' +'02:AGGREGATE' +'04:AGGREGATE' +'03:EXCHANGE [HASH(double_col)]' +'01:AGGREGATE' +'00:SCAN HDFS [functional.alltypesagg]' +==== +---- QUERY +set explain_level=0; +set disable_streaming_preaggregations=1; +explain select count(distinct double_col) from functional.alltypesagg; +---- RESULTS: VERIFY_IS_SUBSET +'06:AGGREGATE [FINALIZE]' +'05:EXCHANGE [UNPARTITIONED]' +'02:AGGREGATE' +'04:AGGREGATE' +'03:EXCHANGE [HASH(double_col)]' +'01:AGGREGATE' +'00:SCAN HDFS [functional.alltypesagg]' +==== \ No newline at end of file