[fix](Nereids) get_json_bigint should return bigint type (#18626)

This commit is contained in:
morrySnow
2023-04-14 14:01:44 +08:00
committed by GitHub
parent e009c459bf
commit 4d18ea30f4
3 changed files with 39 additions and 35 deletions

View File

@ -23,7 +23,7 @@ import org.apache.doris.nereids.trees.expressions.functions.AlwaysNullable;
import org.apache.doris.nereids.trees.expressions.functions.ExplicitlyCastableSignature;
import org.apache.doris.nereids.trees.expressions.shape.BinaryExpression;
import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor;
import org.apache.doris.nereids.types.IntegerType;
import org.apache.doris.nereids.types.BigIntType;
import org.apache.doris.nereids.types.StringType;
import org.apache.doris.nereids.types.VarcharType;
@ -39,8 +39,8 @@ public class GetJsonBigInt extends ScalarFunction
implements BinaryExpression, ExplicitlyCastableSignature, AlwaysNullable {
public static final List<FunctionSignature> SIGNATURES = ImmutableList.of(
FunctionSignature.ret(IntegerType.INSTANCE).args(VarcharType.SYSTEM_DEFAULT, VarcharType.SYSTEM_DEFAULT),
FunctionSignature.ret(IntegerType.INSTANCE).args(StringType.INSTANCE, StringType.INSTANCE)
FunctionSignature.ret(BigIntType.INSTANCE).args(VarcharType.SYSTEM_DEFAULT, VarcharType.SYSTEM_DEFAULT),
FunctionSignature.ret(BigIntType.INSTANCE).args(StringType.INSTANCE, StringType.INSTANCE)
);
/**

View File

@ -1,4 +1,7 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !sql_get_json_bigint_Varchar_Varchar --
1678708107000
-- !sql_greatest_TinyInt --
\N
1

View File

@ -16,35 +16,36 @@
// under the License.
suite("nereids_scalar_fn_G") {
sql 'use regression_test_nereids_function_p0'
sql 'set enable_nereids_planner=true'
sql 'set enable_fallback_to_original_planner=false'
qt_sql_greatest_TinyInt "select greatest(ktint) from fn_test order by ktint"
qt_sql_greatest_TinyInt_notnull "select greatest(ktint) from fn_test_not_nullable order by ktint"
qt_sql_greatest_SmallInt "select greatest(ksint) from fn_test order by ksint"
qt_sql_greatest_SmallInt_notnull "select greatest(ksint) from fn_test_not_nullable order by ksint"
qt_sql_greatest_Integer "select greatest(kint) from fn_test order by kint"
qt_sql_greatest_Integer_notnull "select greatest(kint) from fn_test_not_nullable order by kint"
qt_sql_greatest_BigInt "select greatest(kbint) from fn_test order by kbint"
qt_sql_greatest_BigInt_notnull "select greatest(kbint) from fn_test_not_nullable order by kbint"
qt_sql_greatest_LargeInt "select greatest(klint) from fn_test order by klint"
qt_sql_greatest_LargeInt_notnull "select greatest(klint) from fn_test_not_nullable order by klint"
qt_sql_greatest_Float "select greatest(kfloat) from fn_test order by kfloat"
qt_sql_greatest_Float_notnull "select greatest(kfloat) from fn_test_not_nullable order by kfloat"
qt_sql_greatest_Double "select greatest(kdbl) from fn_test order by kdbl"
qt_sql_greatest_Double_notnull "select greatest(kdbl) from fn_test_not_nullable order by kdbl"
qt_sql_greatest_DecimalV2 "select greatest(kdcmls1) from fn_test order by kdcmls1"
qt_sql_greatest_DecimalV2_notnull "select greatest(kdcmls1) from fn_test_not_nullable order by kdcmls1"
qt_sql_greatest_Date "select greatest(kdt) from fn_test order by kdt"
qt_sql_greatest_Date_notnull "select greatest(kdt) from fn_test_not_nullable order by kdt"
qt_sql_greatest_DateV2 "select greatest(kdtv2) from fn_test order by kdtv2"
qt_sql_greatest_DateV2_notnull "select greatest(kdtv2) from fn_test_not_nullable order by kdtv2"
qt_sql_greatest_DateTime "select greatest(kdtm) from fn_test order by kdtm"
qt_sql_greatest_DateTime_notnull "select greatest(kdtm) from fn_test_not_nullable order by kdtm"
qt_sql_greatest_DateTimeV2 "select greatest(kdtmv2s1) from fn_test order by kdtmv2s1"
qt_sql_greatest_DateTimeV2_notnull "select greatest(kdtmv2s1) from fn_test_not_nullable order by kdtmv2s1"
qt_sql_greatest_Varchar "select greatest(kvchrs1) from fn_test order by kvchrs1"
qt_sql_greatest_Varchar_notnull "select greatest(kvchrs1) from fn_test_not_nullable order by kvchrs1"
qt_sql_greatest_String "select greatest(kstr) from fn_test order by kstr"
qt_sql_greatest_String_notnull "select greatest(kstr) from fn_test_not_nullable order by kstr"
}
sql 'use regression_test_nereids_function_p0'
sql 'set enable_nereids_planner=true'
sql 'set enable_fallback_to_original_planner=false'
qt_sql_get_json_bigint_Varchar_Varchar """SELECT get_json_bigint('{"k1":1678708107000, "k2":"2"}', "\$.k1")"""
qt_sql_greatest_TinyInt "select greatest(ktint) from fn_test order by ktint"
qt_sql_greatest_TinyInt_notnull "select greatest(ktint) from fn_test_not_nullable order by ktint"
qt_sql_greatest_SmallInt "select greatest(ksint) from fn_test order by ksint"
qt_sql_greatest_SmallInt_notnull "select greatest(ksint) from fn_test_not_nullable order by ksint"
qt_sql_greatest_Integer "select greatest(kint) from fn_test order by kint"
qt_sql_greatest_Integer_notnull "select greatest(kint) from fn_test_not_nullable order by kint"
qt_sql_greatest_BigInt "select greatest(kbint) from fn_test order by kbint"
qt_sql_greatest_BigInt_notnull "select greatest(kbint) from fn_test_not_nullable order by kbint"
qt_sql_greatest_LargeInt "select greatest(klint) from fn_test order by klint"
qt_sql_greatest_LargeInt_notnull "select greatest(klint) from fn_test_not_nullable order by klint"
qt_sql_greatest_Float "select greatest(kfloat) from fn_test order by kfloat"
qt_sql_greatest_Float_notnull "select greatest(kfloat) from fn_test_not_nullable order by kfloat"
qt_sql_greatest_Double "select greatest(kdbl) from fn_test order by kdbl"
qt_sql_greatest_Double_notnull "select greatest(kdbl) from fn_test_not_nullable order by kdbl"
qt_sql_greatest_DecimalV2 "select greatest(kdcmls1) from fn_test order by kdcmls1"
qt_sql_greatest_DecimalV2_notnull "select greatest(kdcmls1) from fn_test_not_nullable order by kdcmls1"
qt_sql_greatest_Date "select greatest(kdt) from fn_test order by kdt"
qt_sql_greatest_Date_notnull "select greatest(kdt) from fn_test_not_nullable order by kdt"
qt_sql_greatest_DateV2 "select greatest(kdtv2) from fn_test order by kdtv2"
qt_sql_greatest_DateV2_notnull "select greatest(kdtv2) from fn_test_not_nullable order by kdtv2"
qt_sql_greatest_DateTime "select greatest(kdtm) from fn_test order by kdtm"
qt_sql_greatest_DateTime_notnull "select greatest(kdtm) from fn_test_not_nullable order by kdtm"
qt_sql_greatest_DateTimeV2 "select greatest(kdtmv2s1) from fn_test order by kdtmv2s1"
qt_sql_greatest_DateTimeV2_notnull "select greatest(kdtmv2s1) from fn_test_not_nullable order by kdtmv2s1"
qt_sql_greatest_Varchar "select greatest(kvchrs1) from fn_test order by kvchrs1"
qt_sql_greatest_Varchar_notnull "select greatest(kvchrs1) from fn_test_not_nullable order by kvchrs1"
qt_sql_greatest_String "select greatest(kstr) from fn_test order by kstr"
qt_sql_greatest_String_notnull "select greatest(kstr) from fn_test_not_nullable order by kstr"
}