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

Feature request: Query builder: Support derivation in projection #254

Closed
13 tasks done
akphi opened this issue Jun 15, 2021 · 1 comment · Fixed by #314
Closed
13 tasks done

Feature request: Query builder: Support derivation in projection #254

akphi opened this issue Jun 15, 2021 · 1 comment · Fixed by #314
Labels
Component: Query Builder Issues related to query builder core Studio Core Team Opened by a member of the Studio core team Type: Feature Request

Comments

@akphi
Copy link
Contributor

akphi commented Jun 15, 2021

Right now the only type of lambda that is supported in the query builder projection column is a property expression. We should allow any expression to be typed.

Context and Motivation

We want to support use cases like the following:

test::Person.all()
   ->project
    (
      [
        x|$x.lastName + $x.firstName
      ], 
      [
        'Full Name'
      ]
    )

Implementation Plan

We do a very strict check to ensure the only form of column lambda we support in form view is property expression, anything deviate from that would be considered derivation (or free form). To accommodate for this, we need to create a new wrapper type for ValueSpecification, we call this UnknownValue (this is in line with what we want to do in #315)

class UnknownValue extends ValueSpecification {
  content: object;
}

Steps

  • Support compilation in form mode (F9)
  • Support detecting derivation and converting it to UnknownValue
  • Support roundtrip for processing unsupported column expressions in project() expression
  • Support reveal compilation errors in form mode for derivation
  • Support adding new property in form mode
    • Support + - default to x|'' in projection panel
    • Support DnD to re-arrange
  • Support roundtrip for processing unsupported column expressions in groupBy() expression

Optional

  • Support using hotkey F9 to compile in query builder
  • Write a changeset for derivation feature
  • Support custom aggregation - default to x|x->count() -> after discussion, this does not seem to make a lot of sense since we should only allow a fairly restricted sets of functions for aggregation
  • Support custom filter - default to x|true -> This could make sense, but we would move it back to the main thread
    Feature request: Query builder improvements #256
  • Support converting a normal property expression to a derivation (Query builder: add support for preview data #328)
@akphi akphi changed the title RFC: Support derivition in query builder projection RFC: Query builder: Support derivation in projection Jun 28, 2021
@akphi akphi added the Component: Query Builder Issues related to query builder core label Jul 6, 2021
@akphi akphi closed this as completed in #314 Jul 9, 2021
@github-actions github-actions bot mentioned this issue Jul 9, 2021
@akphi akphi added the Studio Core Team Opened by a member of the Studio core team label Oct 29, 2021
@akphi akphi changed the title RFC: Query builder: Support derivation in projection Feature request: Query builder: Support derivation in projection Nov 4, 2021
@akphi
Copy link
Contributor Author

akphi commented Nov 4, 2021

NOTE: Updated this to Feature Request instead of RFC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Query Builder Issues related to query builder core Studio Core Team Opened by a member of the Studio core team Type: Feature Request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant