-
Notifications
You must be signed in to change notification settings - Fork 700
IMPORT INTO autodetect file format and wildcards for file path #21197
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
base: master
Are you sure you want to change the base?
Conversation
* Format detection based on file extensions (.csv, .sql, .parquet) for IMPORT INTO jobs. * Wildcards are accepted in file paths, but requires one by directory level (non-recursive). * Add explicit note that each IMPORT INTO job must target one file format; wildcards that match mixed extensions now fail the pre-check and require separate jobs. * Explain that compression suffixes (.gz, .zstd, .snappy, …) are ignored when TiDB infers CSV/SQL/PARQUET. * Minor wording clean-ups for consistency; no change to syntax or behavior.
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary of Changes
Hello @alastori, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request significantly enhances the IMPORT INTO
statement's flexibility and usability by introducing automatic file format detection based on extensions and expanding wildcard support to include directory levels in file paths. It also provides crucial clarifications regarding handling mixed file formats and compression suffixes, making the data import process more robust and user-friendly.
Highlights
- Enhanced File Format Auto-detection: The
IMPORT INTO
statement now automatically determines the file format (CSV, SQL, PARQUET) based on file extensions when theFORMAT
clause is omitted. This includes explicitly stating that compression suffixes (like.gz
,.zstd
,.snappy
) are ignored during this detection process. - Expanded Wildcard Support in File Paths: Wildcards (
*
and[]
) can now be used not only in filenames but also to match sub-path segments (directory levels) within thefileLocation
parameter. This allows for more flexible data import from structured or nested directories. - Clarification on Mixed File Formats with Wildcards: A new note has been added to emphasize that each
IMPORT INTO
job must target a single file format. If a wildcard pattern matches files with different extensions (e.g.,.csv
and.sql
), the pre-check will fail, requiring separate import statements for each format. - Updated Documentation and Examples: The documentation for the
fileLocation
andFormat
sections has been revised to reflect these new capabilities and clarifications. New examples have been added, specifically demonstrating the use of wildcards in directory paths for importing data from nested structures.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
@River2000i for technical review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request significantly enhances the IMPORT INTO
documentation by adding details on automatic file format detection based on extensions and expanding wildcard usage to support directory levels. It also clarifies how compression suffixes are handled during format inference and explicitly notes the requirement for single file format per import job when using wildcards. The examples for wildcard usage, especially for nested directory structures, are a valuable addition.
My review focuses on minor wording adjustments for directness and clarity, punctuation consistency, and adherence to Markdown best practices, aligning with the provided style guide. The changes are well-structured and improve the overall quality of the documentation.
The review was guided by the Documentation Review Style Guide, particularly focusing on:
- Clarity and Directness: Ensuring text is easy to understand and directly addresses the user (Style Guide line 22).
- Formatting and Punctuation: Adhering to correct markdown formatting for code elements and standard English punctuation (Style Guide lines 20, 34).
- Structure: Confirming proper use of headings and spacing around elements like lists and code blocks (Style Guide lines 32, 38).
Applying suggestions from @gemini-code-assist Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
What is changed, added or deleted? (Required)
Which TiDB version(s) do your changes apply to? (Required)
Tips for choosing the affected version(s):
By default, CHOOSE MASTER ONLY so your changes will be applied to the next TiDB major or minor releases. If your PR involves a product feature behavior change or a compatibility change, CHOOSE THE AFFECTED RELEASE BRANCH(ES) AND MASTER.
For details, see tips for choosing the affected versions.
What is the related PR or file link(s)?
Do your changes match any of the following descriptions?