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

refactor: use temp table to refactor materialized cte #16900

Merged
merged 18 commits into from
Dec 4, 2024

Conversation

xudong963
Copy link
Member

@xudong963 xudong963 commented Nov 21, 2024

I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/

Summary

Use temp table to refactor materialized cte:

  1. We can eliminate many unnecessary codes and improve maintenance.
  2. Add the setting persist_materialized_cte to decide if the cte is to persist storage or not. The default behavior is using the memory table. If the user's materialized cte results are large and may OOM, they can open the setting.
  3. Support distribution materialized cte. TPCH 15 under cluser may be faster, but ci-benchmark is broken, will check later

Tests

  • Unit Test
  • Logic Test
  • Benchmark Test
  • No Test - Explain why

Type of change

  • Bug Fix (non-breaking change which fixes an issue)
  • New Feature (non-breaking change which adds functionality)
  • Breaking Change (fix or feature that could cause existing functionality not to work as expected)
  • Documentation Update
  • Refactoring
  • Performance Improvement
  • Other (please describe):

This change is Reviewable

@github-actions github-actions bot added the pr-refactor this PR changes the code base without new features or bugfix label Nov 21, 2024
@xudong963 xudong963 marked this pull request as draft November 21, 2024 05:41
@xudong963 xudong963 force-pushed the temp_table_m_cte branch 5 times, most recently from ba5f7d5 to b4ced32 Compare November 25, 2024 11:45
@xudong963
Copy link
Member Author

Wait #16941

@xudong963
Copy link
Member Author

12_0005_changes_select:                                                 [ FAIL ] - result differs with:
--- /runner/_work/databend/databend/tests/suites/0_stateless/12_time_travel/12_0005_changes_select.result	2024-11-25 12:23:54.553130727 +0000
+++ /runner/_work/databend/databend/tests/suites/0_stateless/12_time_travel/12_0005_changes_select.stdout	2024-11-25 12:26:02.435793713 +0000
@@ -1,22 +1,15 @@
 latest snapshot should contain 2 rows
 2
 changes default snapshot at the first insertion
-1	1	DELETE	false
-2	1	DELETE	true
-2	2	INSERT	true
-3	3	INSERT	false
+Error: APIError: ResponseError with 1006: can not use temp table in http handler if cookie is not enabled
 changes default snapshot at the first insertion end the deletion
-1	1	DELETE	false
-2	1	DELETE	true
-2	2	INSERT	true
+Error: APIError: ResponseError with 1006: can not use temp table in http handler if cookie is not enabled
 changes append_only snapshot at the first insertion

can not use temp table in http handler if cookie is not enabled

http session for temp table has supported, is there a plan to update client? cc @everpcpc @sundy-li

@sundy-li
Copy link
Member

http session for temp table has supported, is there a plan to update client?

@youngsofun to support it.

@everpcpc
Copy link
Member

bendsql in runner upgraded to 0.23.1

@xudong963 xudong963 force-pushed the temp_table_m_cte branch 3 times, most recently from 2619b9e to 8e6eecd Compare November 28, 2024 08:07
@xudong963 xudong963 added the ci-benchmark Benchmark: run all test label Nov 28, 2024
Copy link
Contributor

Docker Image for PR

  • tag: pr-16900-eb8a5f4-1732782822

note: this image tag is only available for internal use,
please check the internal doc for more details.

@xudong963 xudong963 added ci-benchmark Benchmark: run all test and removed ci-benchmark Benchmark: run all test labels Nov 28, 2024
Copy link
Contributor

Docker Image for PR

  • tag: pr-16900-15a36c4-1732791390

note: this image tag is only available for internal use,
please check the internal doc for more details.

@xudong963 xudong963 force-pushed the temp_table_m_cte branch 4 times, most recently from caab63e to 59e593a Compare December 3, 2024 04:06
@xudong963 xudong963 added ci-benchmark Benchmark: run all test and removed ci-benchmark Benchmark: run all test labels Dec 3, 2024
Copy link
Contributor

github-actions bot commented Dec 3, 2024

Docker Image for PR

  • tag: pr-16900-a872110-1733200739

note: this image tag is only available for internal use,
please check the internal doc for more details.

@xudong963
Copy link
Member Author

It seems that ci benchmark is broken. cc @everpcpc

@everpcpc
Copy link
Member

everpcpc commented Dec 3, 2024

It seems that ci benchmark is broken. cc @everpcpc

cc @zhang2014

@xudong963 xudong963 added ci-benchmark Benchmark: run all test and removed ci-benchmark Benchmark: run all test labels Dec 3, 2024
@xudong963 xudong963 enabled auto-merge December 4, 2024 07:07
@xudong963 xudong963 added this pull request to the merge queue Dec 4, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 4, 2024
@xudong963 xudong963 added this pull request to the merge queue Dec 4, 2024
Merged via the queue into databendlabs:main with commit bea64df Dec 4, 2024
72 checks passed
@xudong963 xudong963 deleted the temp_table_m_cte branch December 4, 2024 10:08
@zhyass zhyass mentioned this pull request Dec 19, 2024
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci-benchmark Benchmark: run all test pr-refactor this PR changes the code base without new features or bugfix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor: use temp table to refactor materialized cte runtime.
5 participants