[SQL] Support Grouping Sets, Rollup and Cube to extend group by statement
Support Grouping Sets, Rollup and Cube to extend group by statement support GROUPING SETS syntax ``` SELECT a, b, SUM( c ) FROM tab1 GROUP BY GROUPING SETS ( (a, b), (a), (b), ( ) ); ``` cube or rollup like ``` SELECT a, b,c, SUM( d ) FROM tab1 GROUP BY ROLLUP|CUBE(a,b,c) ``` [ADD] support grouping functions in expr like grouping(a) + grouping(b) (#2039) [FIX] fix analyzer error in window function(#2039)
This commit is contained in:
36
be/src/exprs/grouping_sets_functions.cpp
Normal file
36
be/src/exprs/grouping_sets_functions.cpp
Normal file
@ -0,0 +1,36 @@
|
||||
// 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.
|
||||
|
||||
#include "exprs/grouping_sets_functions.h"
|
||||
|
||||
namespace doris {
|
||||
|
||||
void GroupingSetsFunctions::init() {
|
||||
}
|
||||
|
||||
doris_udf::BigIntVal GroupingSetsFunctions::grouping_id(
|
||||
doris_udf::FunctionContext* ctx, const doris_udf::BigIntVal& grouping_id) {
|
||||
return grouping_id;
|
||||
}
|
||||
|
||||
BigIntVal GroupingSetsFunctions::grouping(
|
||||
doris_udf::FunctionContext* ctx, const doris_udf::BigIntVal& grouping) {
|
||||
return grouping;
|
||||
}
|
||||
|
||||
} // doris
|
||||
|
||||
Reference in New Issue
Block a user