Skip to content

Conversation

@freshtonic
Copy link
Contributor

Support ORE column usage in GROUP BY

My first pass mad the Transformer impl incredibly messy and opaque. I ended up factoring out the transformations into seperate rules.

Acknowledgment

By submitting this pull request, I confirm that CipherStash can use, modify, copy, and redistribute this contribution, under the terms of CipherStash's choice.

`AsNodeKey` replaces `Semantic` from `sqltk`.
1. `Expr::Value` in projection columns will be resolved to
   `NativeValue` if they are unconstained (i.e. not used elsewhere in a
   manner that would contrain their type).

2. Standalone literals like the `true` in `SELECT * FROM tbl WHERE
   true;` will also be resolved to `Native`
`ValueTracker` keeps a reference to all of the `Expr::Value` types
encountered during AST traversal and provides an API that other visitor
pipeline states can interrogate.

It is used to implement the automatic resolution of projection columns
whose type would be unresolved if their type was unused in the
statement.

Unresolved type variables in projection columns can safely be resolved to
`Native` if there is an `Expr::Value` node in the AST with the same type
variable.
@freshtonic freshtonic requested a review from tobyhede April 14, 2025 03:15
A function which is not a known EQL function will always be typed as
returning `NativeValue(None)`.

There is simply no way for `TypeInferencer` to know whether a function
returns the same native type as its argument.

The test previously worked because the `InferType` impl for `Function`
was calling `self.unify_nodes(function, expr)` (where `expr` was the
argument to the function).

I'd noticed that it was incorrect but the test was not correspondingly
updated.
@freshtonic freshtonic closed this Apr 21, 2025
@freshtonic freshtonic deleted the feat/mapper/group-by branch April 21, 2025 23:04
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.

3 participants