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

Query consolidator can break when queries have non-grouped aggregations #478

Closed
andyrooger opened this issue Aug 12, 2024 · 0 comments · Fixed by #479
Closed

Query consolidator can break when queries have non-grouped aggregations #478

andyrooger opened this issue Aug 12, 2024 · 0 comments · Fixed by #479

Comments

@andyrooger
Copy link
Contributor

Try to run the following queries:

  • SELECT x FROM table
  • SELECT COUNT(*) FROM table

The QueryConsolidator combines these to SELECT "x" AS "col0", COUNT(*)::INTEGER AS "col1" FROM "table" AS "source" which obviously fails.

it('should not consolidate aggregated and non-aggregated queries', async () => {
        const qs = [];
        const c = consolidator(q => qs.push(q.request.query.toString()), voidCache(), () => {/*ignore*/});
        c.add({request: { type: 'arrow', query: Query.from({ source: 'table' }).select({ x: 'x' }) }}, Priority.Normal);
        c.add({request: { type: 'arrow', query: Query.from({ source: 'table' }).select({ x: count() }) }}, Priority.Normal);
        await new Promise(resolve => setImmediate(resolve));
        assert.equal(qs.length, 2);
    });
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 a pull request may close this issue.

1 participant