MCPcopy Create free account
hub / github.com/alibaba/zvec / handle_const_num_and_str_node

Method handle_const_num_and_str_node

src/db/sqlengine/parser/zvec_sql_parser.cc:585–606  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

583}
584
585Node::Ptr ZVecSQLParser::handle_const_num_and_str_node(VoidPtr node) {
586 Node::Ptr const_expr = nullptr;
587 SQLParser::Constant_num_and_strContext *constant_num_and_str_node =
588 reinterpret_cast<SQLParser::Constant_num_and_strContext *>(node);
589 if (constant_num_and_str_node->numeric()) {
590 const_expr = std::make_shared<ConstantNode>(
591 constant_num_and_str_node->numeric()->getText());
592 if (constant_num_and_str_node->numeric()->int_value()) {
593 const_expr->set_op(NodeOp::T_INT_VALUE);
594 } else if (constant_num_and_str_node->numeric()->float_value()) {
595 const_expr->set_op(NodeOp::T_FLOAT_VALUE);
596 }
597 } else if (constant_num_and_str_node->quoted_string()) {
598 std::string value = constant_num_and_str_node->quoted_string()->getText();
599 value = trim(value);
600 value = Util::normalize(value);
601 const_expr = std::make_shared<ConstantNode>(value);
602 const_expr->set_op(NodeOp::T_STRING_VALUE);
603 }
604
605 return const_expr;
606}
607
608Node::Ptr ZVecSQLParser::handle_vector_expr_node(VoidPtr node) {
609 SQLParser::Vector_exprContext *vector_expr_node =

Callers

nothing calls this directly

Calls 6

numericMethod · 0.80
getTextMethod · 0.80
int_valueMethod · 0.80
quoted_stringMethod · 0.80
set_opMethod · 0.45
float_valueMethod · 0.45

Tested by

no test coverage detected