Signed-off-by: silverbullet233 <3675229+silverbullet233@users.noreply.github.com> Co-authored-by: eyes_on_me <nopainnofame@sina.com>
This commit is contained in:
parent
47f53b9891
commit
0e50611222
|
|
@ -33,7 +33,7 @@ StatusOr<ColumnPtr> BinaryFunctions::to_binary(FunctionContext* context, const C
|
|||
auto to_binary_type = state->to_binary_type;
|
||||
switch (to_binary_type) {
|
||||
case BinaryFormatType::UTF8:
|
||||
return src_column;
|
||||
return std::move(*src_column).mutate();
|
||||
case BinaryFormatType::ENCODE64:
|
||||
return EncryptionFunctions::from_base64(context, columns);
|
||||
default:
|
||||
|
|
@ -79,7 +79,7 @@ StatusOr<ColumnPtr> BinaryFunctions::from_binary(FunctionContext* context, const
|
|||
auto to_binary_type = state->to_binary_type;
|
||||
switch (to_binary_type) {
|
||||
case BinaryFormatType::UTF8:
|
||||
return src_column;
|
||||
return std::move(*src_column).mutate();
|
||||
case BinaryFormatType::ENCODE64:
|
||||
return EncryptionFunctions::to_base64(context, columns);
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -421,7 +421,7 @@ public:
|
|||
*/
|
||||
template <LogicalType Type>
|
||||
DEFINE_VECTORIZED_FN(positive) {
|
||||
return VECTORIZED_FN_ARGS(0);
|
||||
return std::move(*columns[0]).mutate();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -450,7 +450,7 @@ public:
|
|||
template <LogicalType Type>
|
||||
static StatusOr<ColumnPtr> least(FunctionContext* context, const Columns& columns) {
|
||||
if (columns.size() == 1) {
|
||||
return columns[0];
|
||||
return std::move(*columns[0]).mutate();
|
||||
}
|
||||
|
||||
RETURN_IF_COLUMNS_ONLY_NULL(columns);
|
||||
|
|
@ -491,7 +491,7 @@ public:
|
|||
template <LogicalType Type>
|
||||
static StatusOr<ColumnPtr> greatest(FunctionContext* context, const Columns& columns) {
|
||||
if (columns.size() == 1) {
|
||||
return columns[0];
|
||||
return std::move(*columns[0]).mutate();
|
||||
}
|
||||
|
||||
RETURN_IF_COLUMNS_ONLY_NULL(columns);
|
||||
|
|
|
|||
|
|
@ -3046,7 +3046,7 @@ static inline ColumnPtr concat_not_const(Columns const& columns) {
|
|||
*/
|
||||
StatusOr<ColumnPtr> StringFunctions::concat(FunctionContext* context, const Columns& columns) {
|
||||
if (columns.size() == 1) {
|
||||
return columns[0]->clone();
|
||||
return std::move(*columns[0]).mutate();
|
||||
}
|
||||
|
||||
RETURN_IF_COLUMNS_ONLY_NULL(columns);
|
||||
|
|
@ -3132,7 +3132,7 @@ StatusOr<ColumnPtr> StringFunctions::concat_ws(FunctionContext* context, const C
|
|||
}
|
||||
|
||||
if (columns.size() == 2) {
|
||||
return columns[1];
|
||||
return std::move(*columns[1]).mutate();
|
||||
}
|
||||
|
||||
const auto sep_size = ColumnHelper::compute_bytes_size(columns.begin(), columns.begin() + 1);
|
||||
|
|
|
|||
|
|
@ -298,7 +298,7 @@ StatusOr<ColumnPtr> TimeFunctions::utc_time(FunctionContext* context, const Colu
|
|||
}
|
||||
|
||||
StatusOr<ColumnPtr> TimeFunctions::timestamp(FunctionContext* context, const Columns& columns) {
|
||||
return columns[0];
|
||||
return std::move(*columns[0]).mutate();
|
||||
}
|
||||
|
||||
static const std::vector<int> NOW_PRECISION_FACTORS = {1000000, 100000, 10000, 1000, 100, 10, 1};
|
||||
|
|
@ -3179,7 +3179,7 @@ Status TimeFunctions::date_trunc_prepare(FunctionContext* context, FunctionConte
|
|||
}
|
||||
|
||||
StatusOr<ColumnPtr> TimeFunctions::date_trunc_day(FunctionContext* context, const starrocks::Columns& columns) {
|
||||
return columns[1];
|
||||
return std::move(*columns[1]).mutate();
|
||||
}
|
||||
|
||||
DEFINE_UNARY_FN_WITH_IMPL(date_trunc_monthImpl, v) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
-- name: test_filter_same_columns
|
||||
WITH input AS (SELECT if(id%2=0, id, null) AS col FROM TABLE(generate_series(1, 10)) AS tmp(id) limit 10) SELECT col FROM input WHERE least(col) IS NOT NULL AND least(col) < 20;
|
||||
-- result:
|
||||
2
|
||||
4
|
||||
6
|
||||
8
|
||||
10
|
||||
-- !result
|
||||
WITH input AS (SELECT if(id%2=0, id, null) AS col FROM TABLE(generate_series(1, 10)) AS tmp(id) limit 10) SELECT col FROM input WHERE greatest(col) IS NOT NULL AND greatest(col) < 20;
|
||||
-- result:
|
||||
2
|
||||
4
|
||||
6
|
||||
8
|
||||
10
|
||||
-- !result
|
||||
WITH input AS (SELECT if(id%2=0, id, null) AS col FROM TABLE(generate_series(1, 10)) AS tmp(id) limit 10) SELECT col FROM input WHERE positive(col) IS NOT NULL AND positive(col) < 20;
|
||||
-- result:
|
||||
2
|
||||
4
|
||||
6
|
||||
8
|
||||
10
|
||||
-- !result
|
||||
with input as (select date'2020-01-01' as dt, if(id%2, add_months(dt, 1), null) as col from table(generate_series(1, 10)) as tmp(id)) select col from input where timestamp(col) is not null and timestamp(col) > '2020-01-01';
|
||||
-- result:
|
||||
20200201000000
|
||||
20200201000000
|
||||
20200201000000
|
||||
20200201000000
|
||||
20200201000000
|
||||
-- !result
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
-- name: test_filter_same_columns
|
||||
WITH input AS (SELECT if(id%2=0, id, null) AS col FROM TABLE(generate_series(1, 10)) AS tmp(id) limit 10) SELECT col FROM input WHERE least(col) IS NOT NULL AND least(col) < 20;
|
||||
WITH input AS (SELECT if(id%2=0, id, null) AS col FROM TABLE(generate_series(1, 10)) AS tmp(id) limit 10) SELECT col FROM input WHERE greatest(col) IS NOT NULL AND greatest(col) < 20;
|
||||
WITH input AS (SELECT if(id%2=0, id, null) AS col FROM TABLE(generate_series(1, 10)) AS tmp(id) limit 10) SELECT col FROM input WHERE positive(col) IS NOT NULL AND positive(col) < 20;
|
||||
with input as (select date'2020-01-01' as dt, if(id%2, add_months(dt, 1), null) as col from table(generate_series(1, 10)) as tmp(id)) select col from input where timestamp(col) is not null and timestamp(col) > '2020-01-01';
|
||||
Loading…
Reference in New Issue