Open vikramsubramanian opened 7 months ago
Summary: Improved error messages for non-existing function and node table names in CALL and MATCH queries.
Based on the provided information and code snippets, here is a solution to address the issue:
Improve error handling for non-existing function calls in CALL
expressions:
src/function/table_functions/call_functions.cpp
, implement a check to validate the function name against the list of available functions defined in src/include/common/enums/expression_type.h
.BinderException
with a clear error message indicating the function does not exist.Improve error handling for non-existing node table names in MATCH
expressions:
src/binder/bind/bind_graph_pattern.cpp
, before line 606, add a check to validate the node table name using the validate_node_table_name
function.BinderException
with a clear error message indicating the node table does not exist.Update the unordered_map usage to handle the "key not found" error gracefully:
unordered_map::at
is used, wrap it in a try-catch block to catch std::out_of_range
exceptions.BinderException
with a user-friendly error message.Address the assertion failure in bind_graph_pattern.cpp
on line 606:
KU_UNREACHABLE
assertion with a conditional check and a BinderException
if the condition is not met.Update error messages to be more informative:
BinderException
class to include additional context such as the query part that caused the error and suggestions for possible fixes.getErrorMessage
method in tools/java_api/src/test/java/com/kuzudb/test/QueryResultTest.java
to return the enhanced error messages.Ensure that all changes are thoroughly tested:
validate_function_name
and validate_node_table_name
.CALL
and MATCH
expressions.src/binder/bind/bind_graph_pattern.cpp
This file contains the code for binding graph patterns, which is relevant to the issue of providing better error messages for non-existing node table names.
src/binder/bind_expression/bind_function_expression.cpp
This file is responsible for binding function expressions, which is relevant to the issue of providing better error messages for non-existing function calls.
src/function/table_functions/call_functions.cpp
This file deals with the implementation of table functions, which may need to be modified to provide better error messages for non-existing function calls.
src/include/common/enums/expression_type.h
This file defines function names, which may be used to check for the existence of functions and provide better error messages.
Let's say something like: "show_table is not a valid function name".
Let's say something like: "kz_ex_rt is not a valid node table name". )