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

fix: remove error on explain analyze select into clause #315

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ZelinMa557
Copy link
Contributor

@ZelinMa557 ZelinMa557 commented Jun 20, 2023

What problem does this PR solve?

Issue Number: close #309

What is changed and how it works?

image
When running these codes, the ctx has no value WRITER_CONTEXT, so ctx.Value(WRITER_CONTEXT) is nil. It can be fixed by adding ctx value before executing explain analyze statement.
Also, we don't want to really write data when executing explain analyze select into, so we can define a dummy writer, which will write the data into io.Discard.
image

How Has This Been Tested?

I insert some data into db0..cpu_load, and try explain analyze select * into db1..cpuload from db0..cpu_load, it works properly:
image
image
image
image
Also I add integretion test:
image

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@codecov
Copy link

codecov bot commented Jun 20, 2023

Codecov Report

Merging #315 (99c1eec) into main (6eecffc) will increase coverage by 0.03%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main     #315      +/-   ##
==========================================
+ Coverage   72.87%   72.90%   +0.03%     
==========================================
  Files         465      466       +1     
  Lines       97700    97702       +2     
==========================================
+ Hits        71194    71228      +34     
+ Misses      22020    21999      -21     
+ Partials     4486     4475      -11     

@shilinlee shilinlee linked an issue Jun 20, 2023 that may be closed by this pull request
@shilinlee shilinlee changed the title fix : remove error on explain analyze select into clause fix: remove error on explain analyze select into clause Jun 20, 2023
@ZelinMa557 ZelinMa557 force-pushed the fix-explain branch 2 times, most recently from d9bae39 to 1a903ae Compare June 22, 2023 10:26
Signed-off-by: ZelinMa557 <3388706467@qq.com>
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

Successfully merging this pull request may close these issues.

error on explain analyze select into clause
1 participant