-
Notifications
You must be signed in to change notification settings - Fork 726
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
rfc: Infer Schema #8645
rfc: Infer Schema #8645
Conversation
Signed-off-by: Xuanwo <github@xuanwo.io>
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Signed-off-by: Xuanwo <github@xuanwo.io>
Signed-off-by: Xuanwo <github@xuanwo.io>
Signed-off-by: Xuanwo <github@xuanwo.io>
+-------------+---------+----------+ | ||
``` | ||
|
||
`CREATE TABLE` will support `CREATE TABLE <table> BY ( <Query> )` to accept the output from `INFER`, so users can create a table with `INFRE` directly. |
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.
we already support create table as
MySQL [(none)]> drop table a;
Query OK, 0 rows affected (0.004 sec)
MySQL [(none)]> create table a as select 3 as a, '3' as b;
Query OK, 0 rows affected (0.006 sec)
MySQL [(none)]> desc a;
+-------+------------------+------+---------+-------+
| Field | Type | Null | Default | Extra |
+-------+------------------+------+---------+-------+
| a | TINYINT UNSIGNED | NO | 0 | |
| b | VARCHAR | NO | | |
+-------+------------------+------+---------+-------+
2 rows in set (0.003 sec)
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.
I think create table as is different too.
```sql | ||
CREATE TABLE test BY ( | ||
SELECT UPPER(COLUMN_NAME), TYPE, TRUE from ( | ||
INFER 's3://mybucket/data.csv' FILE_FORMAT = ( TYPE = CSV ) |
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.
looks like it's a table function like select * from infer($location, $file_format)
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.
infer is much more complex that (location, file_format).
We need to accept stage/location like in COPY, file format options and so so. I feel it's hard to implement as a function with named args.
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.
I think it's more like a table function.
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.
Is there an existing example about table function in databend?
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.
Not yet, but it's in ClickHouse https://clickhouse.com/docs/en/sql-reference/table-functions/s3/
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.
I will take this a look.
pub struct TableFunctionFactory { | |
creators: TableFunctionCreators, | |
} | |
impl TableFunctionFactory { |
Signed-off-by: Xuanwo github@xuanwo.io
I hereby agree to the terms of the CLA available at: https://databend.rs/dev/policies/cla/
Summary
RFC: Infer Schema
preview of RFC: https://databend-git-fork-xuanwo-inferschema-databend.vercel.app/doc/contributing/rfcs/infer-schema