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

fix: Postrgres group aggregation #6522

Merged
merged 5 commits into from
Apr 6, 2020

Conversation

srameshr
Copy link
Contributor

No description provided.

@srameshr
Copy link
Contributor Author

@dplewis @cbaker6
Here is a new PR

@dplewis
Copy link
Member

dplewis commented Mar 21, 2020

@srameshr Can you add tests?

@srameshr
Copy link
Contributor Author

@dplewis There are already tests for group by, limit, sort, where. My changes do not affect the existing tests. Also all our local code works and returns the right values. So, I assume we do not need tests for this one.


const qs = `SELECT ${columns
.filter(Boolean)
.join()} FROM $1:name ${wherePattern} ${skipPattern} ${groupPattern} ${sortPattern} ${limitPattern}`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain the problem you are trying to fix? Just so we can determine if there are side-effects.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dplewis
The queries used to fail when * was used with GROUPBY operators and the order of few operators where off when GROUPBY was present.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dplewis
Can you please merge this? All the existing test cases that was there to handle groupBy and other conditions are working as it sits.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dplewis Anything on this?

@dplewis
Copy link
Member

dplewis commented Apr 3, 2020

@srameshr Sorry for the late reply. Can you resolve the conflict so that we can get this into the next release?

@cbaker6
Copy link
Contributor

cbaker6 commented Apr 3, 2020

@srameshr Sorry for the late reply. Can you resolve the conflict so that we can get this into the next release?

My guess is it's conflicting with the code I added in #6506 because we were editing the same method/lines (note, I'm not able to see the conflict, so I'm guessing).

@srameshr if this is the case, then the conflict is somewhere around this line:

const originalQuery = `SELECT ${columns.join()} FROM $1:name ${wherePattern} ${sortPattern} ${limitPattern} ${skipPattern} ${groupPattern}`;
const qs = explain ? this.createExplainableQuery(originalQuery) : originalQuery;

You code:

if (groupPattern) {
      columns.forEach((e, i, a) => {
        if (e && e.trim() === '*') {
          a[i] = '';
        }
      });
    }

Should be added before the line I mentioned above and that should resolve the conflict (if that's really the conflict) with everything still working. Let me know if that helps.

@srameshr
Copy link
Contributor Author

srameshr commented Apr 4, 2020

@cbaker6 Are your changes in master?

@srameshr
Copy link
Contributor Author

srameshr commented Apr 4, 2020

@dplewis @cbaker6
I have fixed the conflicts and updated the code. Can you please look into this? We have a release o n Monday and waiting on it.

@cbaker6
Copy link
Contributor

cbaker6 commented Apr 4, 2020

@dplewis @cbaker6
I have fixed the conflicts and updated the code. Can you please look into this? We have a release o n Monday and waiting on it.

I think you forgot to lint

@srameshr
Copy link
Contributor Author

srameshr commented Apr 5, 2020

@cbaker6 I did lint. Its a pre commit hook that automatically runs

@codecov
Copy link

codecov bot commented Apr 5, 2020

Codecov Report

Merging #6522 into master will decrease coverage by 0.00%.
The diff coverage is 96.77%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6522      +/-   ##
==========================================
- Coverage   93.91%   93.90%   -0.01%     
==========================================
  Files         169      169              
  Lines       11963    11968       +5     
==========================================
+ Hits        11235    11239       +4     
- Misses        728      729       +1     
Impacted Files Coverage Δ
...dapters/Storage/Postgres/PostgresStorageAdapter.js 96.33% <96.77%> (-0.15%) ⬇️
src/RestWrite.js 93.81% <0.00%> (+0.16%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b085717...abd4147. Read the comment docs.

@srameshr
Copy link
Contributor Author

srameshr commented Apr 5, 2020

@srameshr srameshr requested a review from dplewis April 5, 2020 12:39
@cbaker6
Copy link
Contributor

cbaker6 commented Apr 5, 2020

@cbaker6
I did run npm run lint again it is just messing up this line
https://github.com/parse-community/parse-server/pull/6522/files#diff-b0af2ee2c26859a8aa6d8d0a0cf3a64aR2587

Are you doing npm run lint locally before you push your code? It's easier to handle the problem locally before pushing. Whenever my lint passes locally, I don't have an issue on CI

@srameshr
Copy link
Contributor Author

srameshr commented Apr 5, 2020

@cbaker6
Yes, running it locally and it passes fine. But when I run commit, the line I have mentioned throws a lint error every time. Regardless of how I change it, so I just did a --no-verify while commit and left it to be merged.

@dplewis dplewis changed the title Postrgres group aggregation fix: Postrgres group aggregation Apr 6, 2020
@dplewis dplewis merged commit cc5f14e into parse-community:master Apr 6, 2020
@srameshr
Copy link
Contributor Author

srameshr commented Apr 7, 2020

@dplewis @acinader Can I expect a new release this week with the above changes going in?

@srameshr
Copy link
Contributor Author

srameshr commented Apr 9, 2020

@dplewis Any timeline as to when the next release will be? Could you do it this week?

@srameshr
Copy link
Contributor Author

@dplewis @acinader Are you guys planning a release this week? Is there a way we can create a release? I am waiting for this because our AWS instances do not allow npm install to run from github repo links for some reason.

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

Successfully merging this pull request may close these issues.

3 participants