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 support for Projections in logic tests #255

Closed
thorfour opened this issue Nov 23, 2022 · 4 comments
Closed

Add support for Projections in logic tests #255

thorfour opened this issue Nov 23, 2022 · 4 comments
Labels
good first issue Good for newcomers

Comments

@thorfour
Copy link
Contributor

We recently discovered that the logic tests don't support projections when I implemented projections during aggregations here: #252

@asubiotto asubiotto added the good first issue Good for newcomers label Nov 24, 2022
@asubiotto
Copy link
Member

To implement this, we probably need to add another switch case in the following function:

func (v *astVisitor) leaveImpl(n ast.Node) error {

To figure out what the ast node is, the best way is to step through using a debugger while running a logictest sub test with a projection.

@palash25
Copy link
Contributor

could this be solved by iterating over SelectFields and applying a projection for each? something like this?

case *ast.FieldList:
		for _, f := range expr.Fields {
			v.builder.Project(f.Expr)
		}

@asubiotto
Copy link
Member

I haven't looked at this closely enough to know, but this would make sense, although Project takes multiple expressions so we'd probably want to push them on the expression stack and then pop them all off when encountering a FieldList if that makes sense. I'm also wondering about the case when we don't want to call builder.Project (i.e. as we currently do).

@thorfour
Copy link
Contributor Author

This was added by #258

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants