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

Confused about columnar cache regression test #261

Open
japinli opened this issue Apr 30, 2024 · 2 comments
Open

Confused about columnar cache regression test #261

japinli opened this issue Apr 30, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@japinli
Copy link
Contributor

japinli commented Apr 30, 2024

What's wrong?

Hi,

When I read the regression test in columnar_cache.sql, I noticed that it contains the following test case:

CREATE TABLE big_table (
  id INT,
  firstname TEXT,
  lastname TEXT
) USING columnar;

INSERT INTO big_table (id, firstname, lastname)
  SELECT i,
         CONCAT('firstname-', i),
         CONCAT('lastname-', i)
    FROM generate_series(1, 1000000) as i;

-- get some baselines from multiple chunks
SELECT firstname,
       lastname,
       SUM(id)
  FROM big_table
 WHERE id < 1000
 GROUP BY firstname,
       lastname
UNION
SELECT firstname,
       lastname,
       SUM(id)
  FROM big_table
 WHERE id BETWEEN 15000 AND 16000
 GROUP BY firstname,
       lastname
 ORDER BY firstname;


-- enable caching
SET columnar.enable_column_cache = 't';

-- the results should be the same as above
SELECT firstname,
       lastname,
       SUM(id)
  FROM big_table
 WHERE id < 1000
 GROUP BY firstname,
       lastname
UNION
SELECT firstname,
       lastname,
       SUM(id)
  FROM big_table
 WHERE id BETWEEN 15000 AND 16000
 GROUP BY firstname,
       lastname
 ORDER BY firstname;

The comments claim that both queries produce the same outcome but columnar_cache.out results differ. The first query returns 2000 rows while the second only returns 999 rows.

Is this expected?

@japinli japinli added the bug Something isn't working label Apr 30, 2024
@wuputah
Copy link
Member

wuputah commented May 1, 2024

good catch, it looks like the union part is not working when caching is enabled; @JerrySievert would you be able to comment here?

@JerrySievert
Copy link
Contributor

I can take a look at it in the next day or so - it's been long enough on the caching code that I'd need to do a deeper dive

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants