| 549 | } |
| 550 | |
| 551 | Node::Ptr ZVecSQLParser::handle_const_node(VoidPtr node) { |
| 552 | Node::Ptr const_expr = nullptr; |
| 553 | SQLParser::ConstantContext *constant_node = |
| 554 | reinterpret_cast<SQLParser::ConstantContext *>(node); |
| 555 | if (constant_node->numeric()) { |
| 556 | const_expr = |
| 557 | std::make_shared<ConstantNode>(constant_node->numeric()->getText()); |
| 558 | if (constant_node->numeric()->int_value()) { |
| 559 | const_expr->set_op(NodeOp::T_INT_VALUE); |
| 560 | } else if (constant_node->numeric()->float_value()) { |
| 561 | const_expr->set_op(NodeOp::T_FLOAT_VALUE); |
| 562 | } |
| 563 | } else if (constant_node->quoted_string()) { |
| 564 | std::string value = constant_node->quoted_string()->getText(); |
| 565 | value = trim(value); |
| 566 | value = Util::normalize(value); |
| 567 | const_expr = std::make_shared<ConstantNode>(value); |
| 568 | const_expr->set_op(NodeOp::T_STRING_VALUE); |
| 569 | } else if (constant_node->vector_expr()) { |
| 570 | const_expr = handle_vector_expr_node(constant_node->vector_expr()); |
| 571 | if (const_expr == nullptr) { |
| 572 | err_msg_ = "Parse failed. vector format error." + |
| 573 | constant_node->vector_expr()->getText(); |
| 574 | LOG_ERROR("Parse failed. vector format error. [%s]", |
| 575 | constant_node->vector_expr()->getText().c_str()); |
| 576 | return nullptr; |
| 577 | } |
| 578 | } else if (constant_node->bool_value()) { |
| 579 | const_expr = handle_bool_value_node(constant_node->bool_value()); |
| 580 | } |
| 581 | |
| 582 | return const_expr; |
| 583 | } |
| 584 | |
| 585 | Node::Ptr ZVecSQLParser::handle_const_num_and_str_node(VoidPtr node) { |
| 586 | Node::Ptr const_expr = nullptr; |
nothing calls this directly
no test coverage detected