-
-
Notifications
You must be signed in to change notification settings - Fork 117
feat (hql): HQL object wrapping + IS_IN implementation #415
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: Shashank Verma <[email protected]>
## Description Well, my query with `!EXIST` was not working as expected anymore after the docker feature update so I went to see the changes.. found little whoopsie ## Related Issues <!-- Link to any related issues using #issue_number --> Closes # ## Checklist when merging to main <!-- Mark items with "x" when completed --> - [ ] No compiler warnings (if applicable) - [ ] Code is formatted with `rustfmt` - [ ] No useless or dead code (if applicable) - [ ] Code is easy to understand - [ ] Doc comments are used for all functions, enums, structs, and fields (where appropriate) - [ ] All tests pass - [ ] Performance has not regressed (assuming change was not to fix a bug) - [ ] Version number has been updated in `helix-cli/Cargo.toml` and `helixdb/Cargo.toml` ## Additional Notes <!-- Add any additional information that would be helpful for reviewers -->
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.
Pull Request Overview
This PR implements HQL object wrapping functionality and adds support for the IS_IN operator. The changes introduce array literal support in the parser, enhance value type conversion through From trait implementations, and add new boolean operations for checking if values are contained within arrays.
- Replaces the CastValue trait with standard From trait implementations for better type conversion
- Adds array literal support and IS_IN operator for HQL queries
- Implements IntoPrimitive trait for extracting references to underlying values
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
helix-db/src/protocol/value.rs | Major refactoring replacing CastValue trait with From implementations and adding IntoPrimitive trait |
helix-db/src/helixc/parser/helix_parser.rs | Adds array literal parsing and new boolean operations (CONTAINS, IS_IN) |
helix-db/src/helixc/generator/utils.rs | Adds Array variant to GeneratedValue enum |
helix-db/src/helixc/generator/statements.rs | Adds Array variant to Statement enum for code generation |
helix-db/src/helixc/generator/bool_op.rs | Implements IsIn boolean operation and updates display formatting |
helix-db/src/helixc/analyzer/methods/traversal_validation.rs | Handles validation for new CONTAINS and IS_IN operations |
helix-db/src/helixc/analyzer/methods/infer_expr_type.rs | Adds type inference support for array literals |
helix-db/src/helix_gateway/mcp/tools.rs | Code formatting improvements for error messages |
helix-db/src/grammar.pest | Grammar updates for array literals and new boolean operations |
helix-cli/src/instance_manager.rs | Minor import reorganization |
Comments suppressed due to low confidence (1)
helix-db/src/helixc/analyzer/methods/infer_expr_type.rs:1
- The
unwrap()
call could panic ifstmt
isNone
. The TODO comments indicate this case needs proper handling. Consider usingstmt.ok_or_else(|| error)
or implementing proper error handling.
//! Semantic analyzer for Helix‑QL.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
@@ -2458,6 +2467,13 @@ impl HelixParser { | |||
} | |||
} | |||
|
|||
fn parse_array_literal(&self, pair: Pair<Rule>) -> Result<Vec<Expression>, ParserError> { | |||
println!("pair: {pair:?}"); |
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.
Debug print statement should be removed from production code. This appears to be leftover debugging code that will clutter the output.
println!("pair: {pair:?}"); |
Copilot uses AI. Check for mistakes.
pub fn is_in<T>(&self, values: &[T]) -> bool | ||
where | ||
T: PartialEq, | ||
Value: IntoPrimitive<T> + Into<T>, |
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.
The trait bounds IntoPrimitive<T> + Into<T>
are potentially confusing since both traits serve similar purposes. Consider using only IntoPrimitive<T>
which returns a reference, or clarify the intended usage pattern.
Value: IntoPrimitive<T> + Into<T>, | |
Value: IntoPrimitive<T>, |
Copilot uses AI. Check for mistakes.
T: PartialEq, | ||
Value: IntoPrimitive<T> + Into<T>, | ||
{ | ||
values.contains(self.into_primitive()) |
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.
This will not compile because values.contains()
expects &T
but into_primitive()
returns &T
, so values.contains(&self.into_primitive())
would be correct, or better yet use values.iter().any(|v| v == self.into_primitive())
.
values.contains(self.into_primitive()) | |
values.iter().any(|v| v == &self.into_primitive()) |
Copilot uses AI. Check for mistakes.
}; | ||
BoolOp::IsIn(IsIn { value: v }) | ||
} | ||
_ => unreachable!("shouldve been caught earlier"), |
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.
"shouldve" should be "should've" or "should have".
_ => unreachable!("shouldve been caught earlier"), | |
_ => unreachable!("should've been caught earlier"), |
Copilot uses AI. Check for mistakes.
## Description <!-- Provide a brief description of the changes in this PR --> ## Related Issues <!-- Link to any related issues using #issue_number --> Closes # ## Checklist when merging to main <!-- Mark items with "x" when completed --> - [ ] No compiler warnings (if applicable) - [ ] Code is formatted with `rustfmt` - [ ] No useless or dead code (if applicable) - [ ] Code is easy to understand - [ ] Doc comments are used for all functions, enums, structs, and fields (where appropriate) - [ ] All tests pass - [ ] Performance has not regressed (assuming change was not to fix a bug) - [ ] Version number has been updated in `helix-cli/Cargo.toml` and `helixdb/Cargo.toml` ## Additional Notes <!-- Add any additional information that would be helpful for reviewers -->
## Description <!-- Provide a brief description of the changes in this PR --> ## Related Issues <!-- Link to any related issues using #issue_number --> Closes # ## Checklist when merging to main <!-- Mark items with "x" when completed --> - [ ] No compiler warnings (if applicable) - [ ] Code is formatted with `rustfmt` - [ ] No useless or dead code (if applicable) - [ ] Code is easy to understand - [ ] Doc comments are used for all functions, enums, structs, and fields (where appropriate) - [ ] All tests pass - [ ] Performance has not regressed (assuming change was not to fix a bug) - [ ] Version number has been updated in `helix-cli/Cargo.toml` and `helixdb/Cargo.toml` ## Additional Notes <!-- Add any additional information that would be helpful for reviewers -->
Description
Related Issues
Closes #
Checklist when merging to main
rustfmt
helix-cli/Cargo.toml
andhelixdb/Cargo.toml
Additional Notes