diff --git a/src/sql/engine/expr/ob_expr_time.cpp b/src/sql/engine/expr/ob_expr_time.cpp index 1d082f070a..605dd40f9d 100644 --- a/src/sql/engine/expr/ob_expr_time.cpp +++ b/src/sql/engine/expr/ob_expr_time.cpp @@ -40,7 +40,7 @@ int ObExprTime::calc_result_type1(ObExprResType& type, ObExprResType& type1, ObE int16_t scale1 = MIN(type1.get_scale(), MAX_SCALE_FOR_TEMPORAL); int16_t scale = (SCALE_UNKNOWN_YET == scale1) ? MAX_SCALE_FOR_TEMPORAL : scale1; type.set_scale(scale); - UNUSED(type_ctx); + type_ctx.set_cast_mode(type_ctx.get_cast_mode() | CM_NULL_ON_WARN); return ret; } diff --git a/src/sql/engine/expr/ob_expr_time.h b/src/sql/engine/expr/ob_expr_time.h index 82a5fbaff3..c939fbeba7 100644 --- a/src/sql/engine/expr/ob_expr_time.h +++ b/src/sql/engine/expr/ob_expr_time.h @@ -24,6 +24,10 @@ public: virtual int calc_result_type1(ObExprResType& type, ObExprResType& type1, common::ObExprTypeCtx& type_ctx) const; virtual int calc_result1(common::ObObj& result, const common::ObObj& time, common::ObExprCtx& expr_ctx) const; virtual int cg_expr(ObExprCGCtx& op_cg_ctx, const ObRawExpr& raw_expr, ObExpr& rt_expr) const override; + virtual common::ObCastMode get_cast_mode() const override + { + return CM_NULL_ON_WARN; + } static int calc_time(const ObExpr& expr, ObEvalCtx& ctx, ObDatum& expr_datum); private: