Title: Grouping doesn't apply as expected when filtering · Issue #312 · IBM/JSONata4Java · GitHub
Open Graph Title: Grouping doesn't apply as expected when filtering · Issue #312 · IBM/JSONata4Java
X Title: Grouping doesn't apply as expected when filtering · Issue #312 · IBM/JSONata4Java
Description: Apologies in advance if overlooking something obvious - I am not well versed in JSONata I'm trying to reproduce this case with the library: https://try.jsonata.org/ZkhsVPArq It seems that there is something weird happening when applying ...
Open Graph Description: Apologies in advance if overlooking something obvious - I am not well versed in JSONata I'm trying to reproduce this case with the library: https://try.jsonata.org/ZkhsVPArq It seems that there is ...
X Description: Apologies in advance if overlooking something obvious - I am not well versed in JSONata I'm trying to reproduce this case with the library: https://try.jsonata.org/ZkhsVPArq It seems that there...
Opengraph URL: https://github.com/IBM/JSONata4Java/issues/312
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Grouping doesn't apply as expected when filtering","articleBody":"Apologies in advance if overlooking something obvious - I am not well versed in JSONata\r\n\r\nI'm trying to reproduce this case with the library: https://try.jsonata.org/ZkhsVPArq\r\n\r\nIt seems that there is something weird happening when applying a grouping after a filter. An example can be found in the test below:\r\n\r\n```\r\n @Test\r\n void testBrokenPredicate() throws Exception {\r\n JSONObject json = new JSONObject(\"{\\\"vendor\\\":[{\\\"name\\\":\\\"kwik\\\",\\\"number\\\":1},{\\\"name\\\":\\\"kwek\\\",\\\"number\\\":2},{\\\"name\\\":\\\"kwak\\\",\\\"number\\\":3},{\\\"name\\\":\\\"kwak\\\",\\\"number\\\":4}]}\");\r\n\r\n @Nonnull final JsonNode jsonObj;\r\n try {\r\n jsonObj = new ObjectMapper().readTree(json.toString());\r\n } catch (IOException e) {\r\n throw new APIException(e, \"JSONata failed during reading of json\");\r\n }\r\n Expressions jsonataExpression = Expressions.parse(\"vendor[name=\\\"kwak\\\"]{`name`: `number`}\");\r\n Expressions brokenJsonataExpression = Expressions.parse(\"vendor[name=\\\"kwek\\\"]{`name`: `number`}\");\r\n\r\n JsonNode result = jsonataExpression.evaluate(jsonObj);\r\n JsonNode brokenResult = brokenJsonataExpression.evaluate(jsonObj);\r\n\r\n // The brokenResult does not apply the grouping as expected\r\n JSONAssert.assertEquals(\"{\\\"kwak\\\":[3,4]}\", result.toString(), true);\r\n\r\n // Here we can see the actual result\r\n JSONAssert.assertEquals(\"{\\\"kwek\\\":{\\\"number\\\":2,\\\"name\\\":\\\"kwek\\\"}}\", brokenResult.toString(), true);\r\n\r\n // I expect this to succeed as seen here https://try.jsonata.org/ZkhsVPArq, but it fails\r\n JSONAssert.assertEquals(\"{\\\"kwek\\\":2}\", brokenResult.toString(), true);\r\n }\r\n```\r\n\r\nPlease let me know what I'm doing wrong or if this is a known issue.","author":{"url":"https://github.com/daanp","@type":"Person","name":"daanp"},"datePublished":"2024-06-21T13:02:28.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/312/JSONata4Java/issues/312"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:7c387597-74f2-a915-4bbb-0d05dacd5c08 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B5E0:1E086E:1032784:1798819:6A4E3569 |
| html-safe-nonce | 75d5d8f3f30312995cf34797dbc49c60339aeb353621a3080f00457f4a7c99bd |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNUUwOjFFMDg2RToxMDMyNzg0OjE3OTg4MTk6NkE0RTM1NjkiLCJ2aXNpdG9yX2lkIjoiNjYyNDY4NjY2NTg1MDgyODEzNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | bd3a05d1f5178c3de0a07d4f35d0dca5ccf8aa6ef08796eeb1f535b40bab651b |
| hovercard-subject-tag | issue:2366505709 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/IBM/JSONata4Java/312/issue_layout |
| twitter:image | https://opengraph.githubassets.com/293839f4ae8e45c56b3e493711cc8039be55756a556df7ad8ddd9eca0208189b/IBM/JSONata4Java/issues/312 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/293839f4ae8e45c56b3e493711cc8039be55756a556df7ad8ddd9eca0208189b/IBM/JSONata4Java/issues/312 |
| og:image:alt | Apologies in advance if overlooking something obvious - I am not well versed in JSONata I'm trying to reproduce this case with the library: https://try.jsonata.org/ZkhsVPArq It seems that there is ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | daanp |
| hostname | github.com |
| expected-hostname | github.com |
| None | 030096ee0db095447bfe77409d33bfac127ca7128299c58deef27c52eaa1b1f0 |
| turbo-cache-control | no-preview |
| go-import | github.com/IBM/JSONata4Java git https://github.com/IBM/JSONata4Java.git |
| octolytics-dimension-user_id | 1459110 |
| octolytics-dimension-user_login | IBM |
| octolytics-dimension-repository_id | 169904880 |
| octolytics-dimension-repository_nwo | IBM/JSONata4Java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 169904880 |
| octolytics-dimension-repository_network_root_nwo | IBM/JSONata4Java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 42a6d378d7587a44c93aca255096cd66b7c8eb2d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width