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

Plan modification fails if view query contains filter that produces no data #10

Open
kriti-sc opened this issue Sep 5, 2023 · 0 comments

Comments

@kriti-sc
Copy link
Contributor

kriti-sc commented Sep 5, 2023

Assume the following series of queries:

CREATE TABLE hello(a INTEGER, b VARCHAR, c VARCHAR); 
-- note that table hello has no data
CREATE VIEW test AS (SELECT SUM(a), COUNT(c), b FROM hello WHERE b = 'true' GROUP BY b);

PRAGMA ivm_upsert('memory', 'main', 'test');

The logical plan that we modify to incrementally maintain view test is for query SELECT SUM(a), COUNT(c), b FROM hello WHERE b = 'true' GROUP BY b. It will look like below, because the FILTER gets pushed down. This happens becausehello has no data, and also happens if the filter clause produces no data.

┌───────────────────────────┐
│         PROJECTION        │
│   ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─   │
│           sum(a)          │
│          count(c)         │
│             b             │
└─────────────┬─────────────┘
┌─────────────┴─────────────┐
│         AGGREGATE         │
│   ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─   │
│             b             │
│     sum_no_overflow(a)    │
│        count_star()       │
└─────────────┬─────────────┘
┌─────────────┴─────────────┐
│        EMPTY_RESULT       │
└───────────────────────────┘
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