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

Executor doesn't support " GROUP BY ... HAVING AVG(...) < ..." #1831

Closed
stonyw opened this issue Jun 26, 2023 · 0 comments
Closed

Executor doesn't support " GROUP BY ... HAVING AVG(...) < ..." #1831

stonyw opened this issue Jun 26, 2023 · 0 comments
Assignees

Comments

@stonyw
Copy link

stonyw commented Jun 26, 2023

Similar with #1822

    def test_execute_group_by_having_aggr(self):
        tables = {
            "x": [
                {"a": "a1", "b": 1},
                {"a": "a2", "b": 2},
                {"a": "a3", "b": 3},
                {"a": "a1", "b": 6},
                {"a": "a2", "b": 9},
                {"a": "a2", "b": 2},
            ],
        }
        schema = {
            "x": {
                "a": "VARCHAR",
                "b": "numeric",
            },
        }

        for sql, cols, rows in [
            ('select a from x group by a having max(b) > 4', ["a"], [('a1',), ('a2',)]),  # FAILED
            ('select a from x group by a having avg(b) < 4', ["a"], [('a1',), ('a3',)]),  # FAILED
            ('select a from x group by a having count(*) = 2', ["a"], [('a1',)]),  # FAILED
        ]:
            with self.subTest(sql):
                result = execute(sql, schema=schema, tables=tables)
                self.assertEqual(result.columns, tuple(cols))
                self.assertEqual(result.rows, rows)
@tobymao tobymao self-assigned this Jun 26, 2023
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