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

groq-js results inconsistent with "GROQ Arcade" #28

Closed
goletaworks opened this issue Dec 19, 2020 · 2 comments
Closed

groq-js results inconsistent with "GROQ Arcade" #28

goletaworks opened this issue Dec 19, 2020 · 2 comments

Comments

@goletaworks
Copy link

Hello! I was looking for an easy way to query and filter JSON data and I discovered your library a couple days ago. I really like the expression syntax and after playing around with it on groq.dev, I was really encouraged that it was the answer to all my prayers :) I installed groq-js in my project and created a test using the example code here (https://www.npmjs.com/package/groq-js) replacing the data with my own. (Slightly transformed data from Overpass/OSM.)

Using the same dataset and expression, I found that the results in my local test were not the same as what I got on GROQ Arcade. The local test results were missing an attibute. (See attached code with data: groqTest.zip)

On GROQ Arcade, the result was (as expected):
[ [ { "name": "111A Avenue", "total": 3 } ], [ { "name": "153B Street", "total": 3 } ], [ { "name": "109 Avenue", "total": 3 } ] ]

But the local test produced:
[ { total: 3 }, { total: 3 }, { total: 3 } ]

What happened to the "name" attribute? It also seems to have removed the inner, single-element arrays. Am I doing something wrong? Is GROQ Arcade using a different version?

Thanks!

@judofyr
Copy link
Collaborator

judofyr commented Jan 14, 2021

Is GROQ Arcade using a different version?

Yes, groq-js is being actively developed. We haven't updated GROQ Arcade recently as we're still figuring out how GROQ should behave in all edge cases. This is one of those edge cases which isn't fully documented yet so I can't really say right away whether your query is incorrect or if the implementation is incorrect. We're working on it though!

@goletaworks
Copy link
Author

Ok, thanks for the update. Having no idea about the internals of groq-js or the particular issues of the edge cases, I can only naively suggest it might be nice to have an option to parameterize the behavior. (For my use case, I would want to keep the inner arrays and keep the other attribute :) .)

Anyway, I was really impressed that I was able to make my query in such an intuitive manner. I'm really hoping I can use this for my project. Cheers!

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

No branches or pull requests

2 participants