From 0e3b58c8e1cc2606e5f59a4643db280227c8196f Mon Sep 17 00:00:00 2001 From: Shouren Yang Date: Thu, 9 Jan 2025 10:17:17 +0800 Subject: [PATCH] fix(hybridse): handling nullptr after converting FrameBound in ConvertFrameBound of ast_node_converter.cc (#4015) Signed-off-by: shouren --- hybridse/src/planv2/ast_node_converter.cc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/hybridse/src/planv2/ast_node_converter.cc b/hybridse/src/planv2/ast_node_converter.cc index ae6f7815ff2..4aa0c377f96 100644 --- a/hybridse/src/planv2/ast_node_converter.cc +++ b/hybridse/src/planv2/ast_node_converter.cc @@ -996,6 +996,7 @@ base::Status ConvertExprNodeList(const absl::Spanframe_unit()) { @@ -1069,19 +1072,24 @@ base::Status ConvertFrameNode(const zetasql::ASTWindowFrame* window_frame, node: return status; } } + node::FrameBound* start = nullptr; node::FrameBound* end = nullptr; CHECK_TRUE(nullptr != window_frame->start_expr(), common::kSqlAstError, "Un-support window frame with null start") CHECK_TRUE(nullptr != window_frame->end_expr(), common::kSqlAstError, "Un-support window frame with null end") CHECK_STATUS(ConvertFrameBound(window_frame->start_expr(), node_manager, &start)) CHECK_STATUS(ConvertFrameBound(window_frame->end_expr(), node_manager, &end)) + CHECK_TRUE(nullptr != start, common::kSqlAstError) + CHECK_TRUE(nullptr != end, common::kSqlAstError) + auto* frame_ext = node_manager->MakeFrameExtent(start, end); + CHECK_TRUE(frame_ext->Valid(), common::kSqlAstError, + "The lower bound of a window frame must be less than or equal to the upper bound"); + node::ExprNode* frame_max_size = nullptr; if (nullptr != window_frame->max_size()) { CHECK_STATUS(ConvertExprNode(window_frame->max_size()->max_size(), node_manager, &frame_max_size)) } - auto* frame_ext = node_manager->MakeFrameExtent(start, end); - CHECK_TRUE(frame_ext->Valid(), common::kSqlAstError, - "The lower bound of a window frame must be less than or equal to the upper bound"); + *output = node_manager->MakeFrameNode(frame_type, frame_ext, frame_max_size); return base::Status::OK(); }