Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1148: Show clearer error message for mismatched types in QueryBuilder #1557

Merged
merged 5 commits into from May 21, 2024

Conversation

muhammadhamzasajjad
Copy link
Collaborator

@muhammadhamzasajjad muhammadhamzasajjad commented May 8, 2024

Reference Issues/PRs

Fixes #1148.
previously if a type was mismatched in the QueryBuilder as follows

df1 = pd.DataFrame({"col1": [1, 2, 3], "col2": [2, 3, 4], "col3": [4, 5, 6], "col_str": ["1", "2", "3"]})
sym = "symbol"
lib.write(sym, df1)
q = QueryBuilder()
q = q[q["col1"] + 1  == "3"]
lib.read(sym, query_builder=q)

it would show an unclear message with UTF_DYNAMIC64 type shown for strings

arcticdb_ext.exceptions.InternalException: E_ASSERTION_FAILURE Cannot compare TD<type=UTF_DYNAMIC64, dim=0> to TD<type=UINT32, dim=0> (possible categorical?)

Now the error is much clearer where column names are generated according to the query and STRING type is shown for strings

arcticdb_ext.exceptions.UserInputException: E_INVALID_USER_ARGUMENT Invalid comparison (col1 + 1) (TD<type=INT64, dim=0>) == "3" (TD<type=STRING, dim=0>)

For a more complex query like q = q[1 + q["col1"] * q["col2"] - q["col3"] == q["col_str"]] it will show column name ((1 + (col1 * col2)) - col3) in the error message which allows the user to better understand the error.

What does this implement or fix?

Any other comments?

Checklist

Checklist for code changes...
  • Have you updated the relevant docstrings, documentation and copyright notice?
  • Is this contribution tested against all ArcticDB's features?
  • Do all exceptions introduced raise appropriate error messages?
  • Are API changes highlighted in the PR description?
  • Is the PR labelled as enhancement or bug so it appears in autogenerated release notes?

@muhammadhamzasajjad muhammadhamzasajjad added the bug Something isn't working label May 8, 2024
@muhammadhamzasajjad muhammadhamzasajjad self-assigned this May 8, 2024
cpp/arcticdb/processing/operation_types.hpp Outdated Show resolved Hide resolved
cpp/arcticdb/processing/operation_types.hpp Outdated Show resolved Hide resolved
cpp/arcticdb/processing/operation_dispatch_binary.hpp Outdated Show resolved Hide resolved
cpp/arcticdb/processing/operation_dispatch_binary.hpp Outdated Show resolved Hide resolved
cpp/arcticdb/processing/expression_node.hpp Outdated Show resolved Hide resolved
cpp/arcticdb/processing/operation_dispatch_unary.hpp Outdated Show resolved Hide resolved
cpp/arcticdb/processing/operation_dispatch_unary.hpp Outdated Show resolved Hide resolved
cpp/arcticdb/processing/operation_dispatch_binary.hpp Outdated Show resolved Hide resolved
cpp/arcticdb/processing/operation_dispatch_binary.hpp Outdated Show resolved Hide resolved
cpp/arcticdb/entity/type_utils.hpp Outdated Show resolved Hide resolved
cpp/arcticdb/processing/operation_dispatch_unary.hpp Outdated Show resolved Hide resolved
cpp/arcticdb/processing/operation_dispatch_unary.hpp Outdated Show resolved Hide resolved
cpp/arcticdb/processing/operation_dispatch_unary.hpp Outdated Show resolved Hide resolved
cpp/arcticdb/processing/operation_dispatch_binary.hpp Outdated Show resolved Hide resolved
cpp/arcticdb/pipeline/value.hpp Outdated Show resolved Hide resolved
@muhammadhamzasajjad muhammadhamzasajjad merged commit 8c3ec68 into master May 21, 2024
114 checks passed
@muhammadhamzasajjad muhammadhamzasajjad deleted the bug/query_type_mismatch_message branch May 21, 2024 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clearer error messages for mismatched types
3 participants