-
Notifications
You must be signed in to change notification settings - Fork 65
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
Convert selecting a named tuple into a free object #776
Open
scotttrinh
wants to merge
15
commits into
master
Choose a base branch
from
named-tuple-to-free-object
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Type checks at this point, so going to use this as a savepoint
scotttrinh
force-pushed
the
named-tuple-to-free-object
branch
from
November 27, 2023 18:19
3fbacce
to
81ae623
Compare
scotttrinh
commented
Nov 30, 2023
expr = $for(expr as TypeSet<NamedTupleType>, (forScope) => { | ||
const shape: any = {}; | ||
for (const k of Object.keys(forScope.__element__.__shape__)) { | ||
shape[k] = op("distinct", (forScope as any)[k]); |
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 distinct
operator is a hack for dealing with edgedb/edgedb#6530.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Right now we do not allow selecting shapes on named tuples, so in order to support FTS, the simplest way forward is to convert any named tuples to a free object using a
for
expression.There is one outstanding issue edgedb/edgedb#6530 that requires an additional (hopefully temporary) hack for the output of
fts::search
to work properly: the compiler complains that theobject
computed in the resulting free object is not distinct, so we applydistinct
to all of the named tuple's properties which should be a no-op.There is some talk about making the output of
fts::search
into a free object in it's own right in the future, which is fine: everything will just work but now the query builder will be able to select shapes from named tuples.