-
Notifications
You must be signed in to change notification settings - Fork 178
bin command error message enhancement #4690
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
Conversation
Signed-off-by: Kai Huang <[email protected]>
Signed-off-by: Kai Huang <[email protected]>
9798be7 to
048a7de
Compare
core/src/main/java/org/opensearch/sql/calcite/utils/binning/BinFieldValidator.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/opensearch/sql/calcite/utils/binning/BinFieldValidator.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Kai Huang <[email protected]>
Signed-off-by: Kai Huang <[email protected]>
Signed-off-by: Kai Huang <[email protected]>
dai-chen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QQ: what's the expected behavior? In PR description, semantic exception is expected. In issue #4590, the expectation is "the bin command should gracefully skip numeric binning for non-numeric fields and preserve the original field values instead of throwing an error." ?
ykmr1224
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with minor comment.
| * | ||
| * @return true if the field should use numeric binning, false if it should use time-based binning | ||
| */ | ||
| public boolean requiresNumericBinning() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: This method was confusing to me. It might be better changing it to isNumeric is it is actually used to check if the field is numeric.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Tomo, this method exists because some parameters such as minspan, start, end currently don't support time-based binning, so they will use this method to check first
Hi @dai-chen , this PR is for short-term fix to enhance error handling, our long-term goal would be the expected behavior in #4590 |
|
The backport to To backport manually, run these commands in your terminal: # Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/sql/backport-2.19-dev 2.19-dev
# Navigate to the new working tree
pushd ../.worktrees/sql/backport-2.19-dev
# Create a new branch
git switch --create backport/backport-4690-to-2.19-dev
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 d1ffabd500e11730b982d53a29342e8953026724
# Push it to GitHub
git push --set-upstream origin backport/backport-4690-to-2.19-dev
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/sql/backport-2.19-devThen, create a pull request where the |
|
@ahkcs backport required, thanks. |
(cherry picked from commit d1ffabd) Signed-off-by: Kai Huang <[email protected]>
Description
When the bin command is applied to a non-numeric field (e.g., string) with numeric span parameters, the command fails with unclear Calcite type validation errors, making it difficult for users to identify the root cause
This PR Added clear validation in BinFieldValidator that throws SemanticCheckException with message, Added field type checks in all numeric bin handlers before Calcite validation, providing clearer user-facing error messages
Related Issues
Partially resolves #4590
Check List
--signoffor-s.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.