You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
DataFusion contains a custom DFParser that extends sqlparser and overrides its parsing of DESCRIBE TABLES and CREATE EXTERNAL TABLE.
Describe the solution you'd like
Looking at sqlparser the only functionality missing upstream is understanding the COMPRESSION keyword in CREATE EXTERNAL TABLE. This feels like a very simple upstream contribution that would then allow removing DFParser and its corresponding Statement abstraction.
Also, just as an FYI, when DFParser was introduced, we did not have a good mechanism for selectively overriding parsing in sqlparser-rs but we do now. It should now be possible for us to implement a DataFusion Dialect and override parsing at the statement, prefix, and infix levels. See tests at https://github.com/sqlparser-rs/sqlparser-rs/blob/main/tests/sqlparser_custom_dialect.rs for examples. I'm not sure the impact of this approach would be on supporting multiple dialects though.
There are some differences in datafusion's CreateExternalTable and sqlparser's CreateTable, for example has_header , delimiter, table_partition_cols and file_compression_type are not exist in sqlparser's CreateTable. Are there any way to create custom Statement in sqlparser?
The partitoning is under one of the Hive options, not sure about the others. I believe there is support for custom dialects, but in this case I'd vote for upstreaming anything missing - we don't have any especially esoteric needs AFAIK
From what I know, the CREATE EXTERNAL TABLE syntax is not based on any other dialect and thus is DataFusion specific. I think it may not belong upstream in sqlparser-rs
The COPY syntax I tried to base on DuckDB's copy syntax (which is different than Postgres), so if we added DuckDB style COPY support to sqlparser-rs we could probably migrate DataFusion to use it
Activity
tustvold commentedon Jan 3, 2023
Actually I think I would like to use Statement, to remove the DDL from LogicalPlan
andygrove commentedon Jan 3, 2023
Makes sense to me.
Also, just as an FYI, when DFParser was introduced, we did not have a good mechanism for selectively overriding parsing in sqlparser-rs but we do now. It should now be possible for us to implement a DataFusion
Dialectand override parsing at the statement, prefix, and infix levels. See tests at https://github.com/sqlparser-rs/sqlparser-rs/blob/main/tests/sqlparser_custom_dialect.rs for examples. I'm not sure the impact of this approach would be on supporting multiple dialects though.unconsolable commentedon Jan 5, 2023
There are some differences in datafusion's
CreateExternalTableand sqlparser'sCreateTable, for examplehas_header,delimiter,table_partition_colsandfile_compression_typeare not exist in sqlparser'sCreateTable. Are there any way to create customStatementinsqlparser?tustvold commentedon Jan 5, 2023
The partitoning is under one of the Hive options, not sure about the others. I believe there is support for custom dialects, but in this case I'd vote for upstreaming anything missing - we don't have any especially esoteric needs AFAIK
Jefffrey commentedon Jan 1, 2024
I'd like to take this on. I'll try do the migration in steps to make PRs more digestible and ensure no breakages/regressions.
First step is here: #8703
alamb commentedon Jan 2, 2024
Related conversation in apache/datafusion-sqlparser-rs#1080
From what I know, the
CREATE EXTERNAL TABLEsyntax is not based on any other dialect and thus is DataFusion specific. I think it may not belong upstream in sqlparser-rsThe COPY syntax I tried to base on DuckDB's copy syntax (which is different than Postgres), so if we added DuckDB style COPY support to sqlparser-rs we could probably migrate DataFusion to use it
alamb commentedon Feb 3, 2025
I don't think we plan to do this / remove the EXTERNAL TABLE syntax so let's close this ticket to avoid confusion