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

Allow sorting by computed fields #4356

Open
vivekkannavenus opened this issue Apr 9, 2020 · 15 comments
Open

Allow sorting by computed fields #4356

vivekkannavenus opened this issue Apr 9, 2020 · 15 comments
Assignees
Labels
a/api/graphql c/server Related to server k/enhancement New feature or improve an existing feature p/longterm Low priority issues that will be picked up based on user feedback or bandwidth t/data-connectors t/native-dbs

Comments

@vivekkannavenus
Copy link

It would be so great if Hasura supports computed field in order by
Eg:

{
    show(order_by: {
       show_distance(args: {lat: 77.7843636, long: 9.4664509}): asc
    }) {
       ...ShowDetails
    }
}

Function created for Computed field show_distance

ST_Distance(
       ST_Transform(location::Geometry, 3857),
       ST_Transform(ST_SetSRID(ST_MakePoint(lat, long), 4326), 3857)
)
@tirumaraiselvan
Copy link
Contributor

Related to #3772

@tirumaraiselvan tirumaraiselvan added c/server Related to server k/enhancement New feature or improve an existing feature p/longterm Low priority issues that will be picked up based on user feedback or bandwidth labels Apr 11, 2020
@tirumaraiselvan tirumaraiselvan changed the title Support computed fields in Order By Allow sorting by computed fields Apr 11, 2020
@vivekkannavenus
Copy link
Author

@tirumaraiselvan Hi Selvan, We're waiting for this feature for a long time.
May I know, when developers can access this feature.

Sorting based on distance is one of the main functionality in our app. So, I would like to see the ticket with a closed tag.

@tirumaraiselvan
Copy link
Contributor

@vivekkannavenus Hi. Unfortunately, the ETA for this is still not clear at the moment because of backlog. I can probably suggest workarounds using Views/Custom functions if you can share your schema and computed field definitions.

@crieggalder
Copy link

Our team would really appreciate this! Our use case is sorting content by a computed score column and filtering results by followed sources. Serving this content feed is the main functionality of our product, so first class support for ordering by computed fields would be great.

@robandrose
Copy link

would very much appreciate this being implemented!

@FickleLife
Copy link

+1 Would be amazing to have this.

@amnaveenriaz
Copy link

@tirumaraiselvan Any update on this? Would be really helpful to reduce extra views and functions.

@manuFL
Copy link

manuFL commented Jun 23, 2021

Much needed..

@mikejackowski
Copy link

Hi, any updates?

@lorenzosignoretti
Copy link

+1, any updates on the feature?

For anyone interested, a viable workaround seems to be creating a view with all of the original table's columns plus the desired calculated field.

@mikejackowski
Copy link

Is there any chance this gets bumped from "p/longterm" to something closer to a more immediate development/release?

@akhilrajvc
Copy link

+1, Any update on this feature?

@austin-coffman
Copy link

+1 - any updates on this feature?

@mikejackowski
Copy link

any updates on sorting by computed_field with args? It's been a while now

@dventimihasura
Copy link

dventimihasura commented Sep 10, 2022

@mikejackowski this feature request is not currently scheduled. I believe it's also not strictly necessary, since it is possible to sort the results of tracked custom functions, even if it's not currently possible to sort by computed fields. This is illustrated in this GitHub repository and sub-directory:

https://github.com/dventimihasura/hasura-projects/tree/master/computed-fields-1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a/api/graphql c/server Related to server k/enhancement New feature or improve an existing feature p/longterm Low priority issues that will be picked up based on user feedback or bandwidth t/data-connectors t/native-dbs
Projects
None yet
Development

No branches or pull requests