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(query): new table function infer_schema. #9936

Merged
merged 6 commits into from
Feb 9, 2023

Conversation

youngsofun
Copy link
Member

@youngsofun youngsofun commented Feb 9, 2023

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

Summary

Closes #9908

currently only support named stage, with parquet format.

examples:

mysql> select * from infer_schema(location=> '@s2/data/tuple.parquet');
+-------------+---------------------+----------+----------+
| column_name | type                | nullable | order_id |
+-------------+---------------------+----------+----------+
| id          | INT                 |        0 |        0 |
| t           | (A INT32, B STRING) |        0 |        1 |
+-------------+---------------------+----------+----------+

also support parameter pattern

select * from infer_schema(location => '@s2/data/', pattern => '.*parquet');

diff with desc <table>

  • it is table function
  • no Default and Extra; add order_id column
  • as a table function, it's results is for processing, so nullable/ order_id column has type bool/uint64; while in desc <table>, all column is string

diff with copy/ select from stage

  1. currently, arg value of table function must be const literal. so '@s2/data/' in the example is single quoted (as a string).
  2. we currently only support infer the first file, so parameter files in not needed.

@vercel
Copy link

vercel bot commented Feb 9, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated
databend ⬜️ Ignored (Inspect) Feb 9, 2023 at 3:31AM (UTC)

@mergify mergify bot added the pr-feature this PR introduces a new feature to the codebase label Feb 9, 2023
@BohuTANG BohuTANG merged commit f53dc21 into databendlabs:main Feb 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-feature this PR introduces a new feature to the codebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: table function infer_schema
2 participants