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

VIEW: COUNT and other aggregate functions do not work inside a view #6394

Open
jepett0 opened this issue Jul 8, 2024 · 1 comment
Open
Assignees

Comments

@jepett0
Copy link
Collaborator

jepett0 commented Jul 8, 2024

To reproduce:

  1. Create the necessary table to read from:
CREATE TABLE user_group_members (
    group_id uint32,
    user_id uint32,
    PRIMARY KEY (group_id, user_id)
);
  1. Create a view:
CREATE VIEW user_group_view WITH (security_invoker = TRUE) AS
    SELECT COUNT(user_id) AS members_count
    FROM `/Root/user_group_members`; -- write your own path to the `user_group_members` table
  1. Select from the view:
SELECT * FROM user_group_view;
  1. Observe an error:
Status: GENERIC_ERROR
Issues: 
<main>: Error: Type annotation, code: 1030
    <main>:1:1: Error: At function: RemovePrefixMembers, At function: RemoveSystemMembers, At function: PersistableRepr, At function: SqlProject, At function: PersistableRepr, At function: SqlProject
        <main>:1:48: Error: At function: AssumeColumnOrderPartial
            <main>:1:8: Error: At function: Aggregate, At function: Apply
                <main>:1:8: Error: Expected callable type, but got: Unit
@jepett0
Copy link
Collaborator Author

jepett0 commented Aug 19, 2024

PRs in stable:
#7501
#7523

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

1 participant