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

Method parse

src/db/sqlengine/parser/zvec_cached_sql_parser.cc:47–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45ZVecCachedSQLParser::~ZVecCachedSQLParser() {}
46
47SQLInfo::Ptr ZVecCachedSQLParser::parse(const std::string &query,
48 bool need_formatted_tree) {
49 std::string query_cache_key{""};
50 SQLInfo::Ptr cached_sql_info = get_from_cache(query, &query_cache_key);
51 if (cached_sql_info != nullptr) {
52 return cached_sql_info;
53 }
54
55 SQLInfo::Ptr new_sql_info = real_parser_.parse(query, need_formatted_tree);
56 if (new_sql_info == nullptr) {
57 // no need to cache parse failed sql. just return.
58 err_msg_ = real_parser_.err_msg();
59 return nullptr;
60 }
61
62 put_into_cache(query_cache_key, new_sql_info);
63
64 return new_sql_info;
65}
66
67void ZVecCachedSQLParser::put_into_cache(const std::string &query_cache_key,
68 const SQLInfo::Ptr &new_sql_info) {

Callers

nothing calls this directly

Calls 1

err_msgMethod · 0.80

Tested by

no test coverage detected