explode(ArrayColumn) desc: > Create a row for each element in the array column. explode_outer(ArrayColumn) desc: > Create a row for each element in the array column. Unlike explode, if the array is null or empty, it returns null. Usage example: 1. create a table with array column, and insert some data; 2. open enable_lateral_view and enable_vectorized_engine; ``` set enable_lateral_view = true; set enable_vectorized_engine=true; ``` 3. use explode_outer ``` > select * from array_test; +------+------+--------+ | k1 | k2 | k3 | +------+------+--------+ | 3 | NULL | NULL | | 1 | 2 | [1, 2] | | 2 | 3 | NULL | | 4 | NULL | [] | +------+------+--------+ > select k1,explode_column from array_test LATERAL VIEW explode_outer(k3) TempExplodeView as explode_column; +------+----------------+ | k1 | explode_column | +------+----------------+ | 1 | 1 | | 1 | 2 | | 2 | NULL | | 4 | NULL | | 3 | NULL | +------+----------------+ ``` 4. explode usage example. explode return empty rows while the ARRAY is null or empty ``` > select k1,explode_column from array_test LATERAL VIEW explode(k3) TempExplodeView as explode_column; +------+----------------+ | k1 | explode_column | +------+----------------+ | 1 | 1 | | 1 | 2 | +------+----------------+ ```
65 lines
2.4 KiB
C++
65 lines
2.4 KiB
C++
// 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/table_function/dummy_table_functions.h"
|
|
|
|
namespace doris {
|
|
|
|
void DummyTableFunctions::init() {}
|
|
|
|
StringVal DummyTableFunctions::explode_split(FunctionContext* context, const StringVal& str,
|
|
const StringVal& sep) {
|
|
return StringVal();
|
|
}
|
|
|
|
BigIntVal DummyTableFunctions::explode_bitmap(doris_udf::FunctionContext* context,
|
|
const doris_udf::StringVal& bitmap) {
|
|
return BigIntVal();
|
|
}
|
|
|
|
BigIntVal DummyTableFunctions::explode_json_array_int(doris_udf::FunctionContext* context,
|
|
const doris_udf::StringVal& str) {
|
|
return BigIntVal();
|
|
}
|
|
|
|
DoubleVal DummyTableFunctions::explode_json_array_double(doris_udf::FunctionContext* context,
|
|
const doris_udf::StringVal& str) {
|
|
return DoubleVal();
|
|
}
|
|
|
|
StringVal DummyTableFunctions::explode_json_array_string(doris_udf::FunctionContext* context,
|
|
const doris_udf::StringVal& str) {
|
|
return StringVal();
|
|
}
|
|
|
|
IntVal DummyTableFunctions::explode_numbers(doris_udf::FunctionContext* context,
|
|
const doris_udf::IntVal& str) {
|
|
return IntVal();
|
|
}
|
|
|
|
AnyVal DummyTableFunctions::explode(doris_udf::FunctionContext* context,
|
|
const doris_udf::CollectionVal& value) {
|
|
return AnyVal();
|
|
}
|
|
|
|
AnyVal DummyTableFunctions::explode_outer(doris_udf::FunctionContext* context,
|
|
const doris_udf::CollectionVal& value) {
|
|
return AnyVal();
|
|
}
|
|
|
|
} // namespace doris
|