Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix](nereids)like function's nullable property should be PropagateNullable #20237

Merged
merged 1 commit into from
May 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[fix](nereids)like function's nullable property should be PropagateNu…
…llable
  • Loading branch information
starocean999 committed May 30, 2023
commit a455ff0f4085d1eae1e79038a381fd7baba84c06
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
package org.apache.doris.nereids.trees.expressions;

import org.apache.doris.catalog.FunctionSignature;
import org.apache.doris.nereids.exceptions.UnboundException;
import org.apache.doris.nereids.trees.expressions.functions.ExplicitlyCastableSignature;
import org.apache.doris.nereids.trees.expressions.functions.PropagateNullable;
import org.apache.doris.nereids.trees.expressions.functions.scalar.ScalarFunction;
import org.apache.doris.nereids.trees.expressions.shape.BinaryExpression;
import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor;
Expand All @@ -35,7 +35,7 @@
* Such as: like, regexp
*/
public abstract class StringRegexPredicate extends ScalarFunction
implements BinaryExpression, ExplicitlyCastableSignature {
implements BinaryExpression, ExplicitlyCastableSignature, PropagateNullable {

private static final List<FunctionSignature> SIGNATURES = ImmutableList.of(
FunctionSignature.ret(BooleanType.INSTANCE).args(VarcharType.SYSTEM_DEFAULT, VarcharType.SYSTEM_DEFAULT)
Expand All @@ -57,11 +57,6 @@ public List<FunctionSignature> getSignatures() {
return SIGNATURES;
}

@Override
public boolean nullable() throws UnboundException {
return left().nullable();
}

@Override
public String toSql() {
return '(' + left().toSql() + ' ' + getName() + ' ' + right().toSql() + ')';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,5 @@ bb

-- !sql --

-- !sql --

Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,10 @@ suite("test_string_function_like") {
qt_sql "SELECT k FROM ${tbName} WHERE k LIKE \"%\" ORDER BY k;"
qt_sql "SELECT k FROM ${tbName} WHERE k NOT LIKE \"%\" ORDER BY k;"

sql "DROP TABLE IF EXISTS test_string_function_like_t0"
sql """
CREATE TABLE test_string_function_like_t0 (c0 SMALLINT DEFAULT "1") DISTRIBUTED BY HASH (c0) PROPERTIES ("replication_num" = "1");
"""
qt_sql "select CASE TRUE WHEN CASE FALSE WHEN ( c0 IS NULL) THEN TRUE END THEN NULL WHEN (('') LIKE c0) THEN '1970-04-17 18:47:49' END from test_string_function_like_t0;"
// sql "DROP TABLE ${tbName};"
}