[fix](planner) Keep type of null literal expr when register conjuncts (#15878)
For now, type information of child expr which is NullLiteral would get lost in the CastExpr#getResultValue, this will produce a NullLiteral with Null type which cause BE core when doing cast
This commit is contained in:
@ -417,7 +417,7 @@ public class CastExpr extends Expr {
|
||||
|
||||
private Expr castTo(LiteralExpr value) throws AnalysisException {
|
||||
if (value instanceof NullLiteral) {
|
||||
return value;
|
||||
return NullLiteral.create(targetTypeDef.getType());
|
||||
} else if (type.isIntegerType()) {
|
||||
return new IntLiteral(value.getLongValue(), type);
|
||||
} else if (type.isLargeIntType()) {
|
||||
|
||||
@ -75,7 +75,7 @@ public class FunctionParams implements Writable {
|
||||
}
|
||||
|
||||
public TAggregateExpr createTAggregateExpr(boolean isMergeAggFn) {
|
||||
List<TTypeDesc> paramTypes = new ArrayList<TTypeDesc>();
|
||||
List<TTypeDesc> paramTypes = new ArrayList<>();
|
||||
if (exprs != null) {
|
||||
for (Expr expr : exprs) {
|
||||
TTypeDesc desc = expr.getType().toThrift();
|
||||
|
||||
@ -0,0 +1,6 @@
|
||||
-- This file is automatically generated. You should know what you did if you want to edit this
|
||||
-- !select --
|
||||
1
|
||||
2
|
||||
3
|
||||
|
||||
@ -0,0 +1,48 @@
|
||||
// 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.
|
||||
|
||||
suite("test_bitmap_max") {
|
||||
sql """DROP TABLE IF EXISTS t1;"""
|
||||
|
||||
sql """
|
||||
CREATE TABLE `t1`
|
||||
(
|
||||
`col1` INT,
|
||||
`col2` bitmap BITMAP_UNION NOT NULL COMMENT ""
|
||||
) ENGINE = OLAP AGGREGATE KEY(`col1`)
|
||||
DISTRIBUTED BY HASH(`col1`) BUCKETS 4
|
||||
PROPERTIES (
|
||||
"replication_allocation" = "tag.location.default: 1"
|
||||
);
|
||||
"""
|
||||
|
||||
sql """
|
||||
INSERT INTO t1 VALUES(1, to_bitmap(1)),
|
||||
(2, to_bitmap(2)),
|
||||
(3, to_bitmap(3));
|
||||
"""
|
||||
|
||||
order_qt_select """
|
||||
SELECT /*+ SET_VAR(query_timeout = 600) */
|
||||
Coalesce(Bitmap_max(Cast(
|
||||
Bitmap_empty() AS BITMAP)), a.`col1`)
|
||||
AS c4
|
||||
FROM t1 AS a
|
||||
WHERE Bitmap_max(Cast(NULL AS BITMAP)) IS NULL;
|
||||
"""
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user