Merge pull request #48632 from hanfei1991/hanfei/refine-expmsg

refine some messages of exception in regexp tree
This commit is contained in:
Han Fei 2023-04-11 14:45:35 +02:00 committed by GitHub
commit 7210b50551
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -272,7 +272,7 @@ void RegExpTreeDictionary::initGraph()
if (value->parent_id == 0) // this is root node. if (value->parent_id == 0) // this is root node.
initTopologyOrder(id, visited, topology_id); initTopologyOrder(id, visited, topology_id);
if (topology_order.size() != regex_nodes.size()) if (topology_order.size() != regex_nodes.size())
throw Exception(ErrorCodes::INCORRECT_DICTIONARY_DEFINITION, "Invalid Regex tree"); throw Exception(ErrorCodes::LOGICAL_ERROR, "The topology order cannot match the number of regex nodes. This is likely a internal bug.");
} }
void RegExpTreeDictionary::initTopologyOrder(UInt64 node_idx, std::set<UInt64> & visited, UInt64 & topology_id) void RegExpTreeDictionary::initTopologyOrder(UInt64 node_idx, std::set<UInt64> & visited, UInt64 & topology_id)
@ -280,7 +280,7 @@ void RegExpTreeDictionary::initTopologyOrder(UInt64 node_idx, std::set<UInt64> &
visited.insert(node_idx); visited.insert(node_idx);
for (UInt64 child_idx : regex_nodes[node_idx]->children) for (UInt64 child_idx : regex_nodes[node_idx]->children)
if (visited.contains(child_idx)) if (visited.contains(child_idx))
throw Exception(ErrorCodes::INCORRECT_DICTIONARY_DEFINITION, "Invalid Regex tree. The input tree is cyclical"); throw Exception(ErrorCodes::INCORRECT_DICTIONARY_DEFINITION, "The regexp tree is cyclical. Please check your config.");
else else
initTopologyOrder(child_idx, visited, topology_id); initTopologyOrder(child_idx, visited, topology_id);
topology_order[node_idx] = topology_id++; topology_order[node_idx] = topology_id++;