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

Add EqualsAny node #262

Merged
merged 1 commit into from
Jan 22, 2025
Merged

Add EqualsAny node #262

merged 1 commit into from
Jan 22, 2025

Conversation

otaviojacobi
Copy link
Contributor

Change-type: minor

@otaviojacobi otaviojacobi force-pushed the compile-any-node-as-operand branch 3 times, most recently from a4c9bcb to 77c25f0 Compare January 20, 2025 17:22
@otaviojacobi otaviojacobi changed the title Allow compiling ANY node as an operand without types Add EqualAny node Jan 20, 2025
@otaviojacobi otaviojacobi requested a review from Page- January 20, 2025 17:40
@otaviojacobi otaviojacobi changed the title Add EqualAny node Add EqualsAny node Jan 20, 2025
@@ -1000,6 +1002,10 @@ const typeRules: Dictionary<MatchFn> = {
return `COALESCE(JSON_AGG(${field}), '[]')`;
},
Equals: Comparison('Equals'),
EqualsAny: (args, indent) => {
checkArgs('EqualsAny', args, 2);
return `${AnyValue(getAbstractSqlQuery(args, 0), indent)} = ANY(${AnyValue(getAbstractSqlQuery(args, 1), indent)})`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally it'd be possible to do

Suggested change
return `${AnyValue(getAbstractSqlQuery(args, 0), indent)} = ANY(${AnyValue(getAbstractSqlQuery(args, 1), indent)})`;
return `${AnyValue(getAbstractSqlQuery(args, 0), indent)} = ${typeRules.Any(getAbstractSqlQuery(args, 1), indent)}`;

to reuse the same Any node for the relevant part, although I'm fine with it as-is and leave that as a potential future thing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Page- They are currently fairly similar, the only reason why can't currently be done this way is because Any requires a innerType to be casted, which I am not sure we want to infer for in. Ofc I can rework the Any logic to be able to handle no parameter on the innerTyping but at this point we could just use the AnyNode anyway. I think if we decide to do it, it should be part of a follow up PR

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I just wanted to raise awareness to consider that for future

Change-type: minor
@otaviojacobi otaviojacobi force-pushed the compile-any-node-as-operand branch from 77c25f0 to 79d5bce Compare January 22, 2025 18:44
@otaviojacobi otaviojacobi marked this pull request as ready for review January 22, 2025 18:44
@otaviojacobi otaviojacobi requested review from Page- and a team January 22, 2025 18:44
@flowzone-app flowzone-app bot enabled auto-merge January 22, 2025 18:48
@flowzone-app flowzone-app bot merged commit 312f18e into master Jan 22, 2025
52 checks passed
@flowzone-app flowzone-app bot deleted the compile-any-node-as-operand branch January 22, 2025 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants