-
Notifications
You must be signed in to change notification settings - Fork 689
Fix DISTINCT with object values in SELECT and SEARCH queries #2192
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
Conversation
Co-authored-by: mathiasrw <1063454+mathiasrw@users.noreply.github.com>
Co-authored-by: mathiasrw <1063454+mathiasrw@users.noreply.github.com>
|
Run yarn test-format-all |
Co-authored-by: mathiasrw <1063454+mathiasrw@users.noreply.github.com>
Fixed formatting issues. Tests now use arrow functions without async done callbacks. Fixed in commit 7d43b9d. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Description
DISTINCT operations failed when comparing object values, treating all objects as identical due to
[object Object]string coercion. Additionally,SELECT COLUMN DISTINCTdid not apply distinct filtering to extracted values.Changes
Core Fix (src/38query.js)
doDistinct: UseJSON.stringify()for object comparison instead of default string coercionModifier Enhancement (src/40select.js)
modifyCOLUMN case: ApplydistinctArraywhen query has distinct flagTest Coverage (test/test167B.js)
SELECT DISTINCT *,SELECT COLUMN DISTINCT _, andSEARCH DISTINCT(/)Checklist
Original prompt
<issue_description>There are some problems with this operator to be fixed
</issue_description>
<agent_instructions>Please make a test file called test167B.js verifying if this issue is still a problem.
If it is a problem try to solve it.
If you need to update the grammar of alasql, then please do small precice changes to alasqlparser.jison and then run
yarn jison && yarn test</agent_instructions>Comments on the Issue (you are @copilot in this section)
@mathiasrw Can you describe the problems a bit more? @agershun The result of these two functions should be the same, and it seems that now it is a same:You can try this example in jsFiddle
</comment_new>
<comment_new>@mathiasrw
a) how come we use the
_in the column distinct?b) if you change the middle data to
b:2I would expect [{a:1},{b:2}] from res3 but get onlya:1http://jsfiddle.net/dw6eLu8h/2/</comment_new>
<comment_new>@agershun
_ is a original object from the source array (reference), where * is a copy property by property.
For example:
</comment_new>
<comment_new>@mathiasrw
Ahh - ok
Did you check out b) ?
</comment_new>
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.