blob: cb856d5a52e29171767a4150ee5f3e209224bfd7 [file] [log] [blame]
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
use tpcds;
--- test with subplan into subplan pushdown enabled (default)
--- set `compiler.subplan.merge` "true";
// The case expression contains correlated subqueries.
select case when (select value count(ss)
from store_sales ss
where ss_quantity = item.i_item_sk)[0] < 25437
then (select avg(ss_ext_discount_amt)
from store_sales
where ss_quantity = item.i_item_sk)
else (select avg(ss_net_profit)
from store_sales
where ss_quantity = item.i_item_sk)
end bucket1
from item
where i_item_sk = 2;