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

feat: support COPY ... TO STDOUT (FORMAT parquet|json) #195

Merged
merged 3 commits into from
Nov 21, 2024

Conversation

fanyang01
Copy link
Collaborator

No description provided.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 suggestions.

Files not reviewed (1)
  • pgtest/psql/copy/parquet.sql: Language not supported
Comments skipped due to low confidence (5)

pgserver/copy.go:21

  • The regular expression might not handle multiple spaces or newlines correctly. Consider using \s+ to match any whitespace characters.
reCopyToFormat = regexp.MustCompile(`(?i)^COPY\s+(.*?)\s+TO\s+STDOUT(?:\s+(?:WITH\s*)?\(\s*(?:FORMAT\s+(\w+)\s*,?\s*)?(.*?)\s*\))?$`)

pgserver/copy.go:25

  • Ensure the RemoveComments function is robust enough to handle all edge cases, as it plays a crucial role in cleaning up the input before parsing.
stmt = RemoveComments(stmt)

pgserver/copy.go:12

  • Verify that the CopyFormat constants are correctly defined and used throughout the code. Incrementing from tree.CopyFormatCSV might cause issues if the enum values are not contiguous.
CopyFormatParquet = tree.CopyFormatCSV + 1

pgserver/stmt.go:113

  • Verify the correctness of the nested block comment handling in the RemoveLeadingComments function.
// Skip block comment with nesting support

pgserver/datawriter.go:124

  • Redundant closing parenthesis for the FORMAT CSV case. It should be removed.
builder.WriteString(")")

pgserver/stmt.go Show resolved Hide resolved
pgserver/connection_handler.go Show resolved Hide resolved
pgserver/connection_handler.go Show resolved Hide resolved
Copy link
Contributor

@VWagen1989 VWagen1989 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work! LGTM

@fanyang01 fanyang01 merged commit 34d91fd into main Nov 21, 2024
5 checks passed
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.

2 participants