-
Notifications
You must be signed in to change notification settings - Fork 2k
Upgrade to sqlparser 0.61.0 #20177
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
Open
alamb
wants to merge
7
commits into
apache:main
Choose a base branch
from
alamb:alamb/test_sqlparser_update
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+101
−54
Open
Upgrade to sqlparser 0.61.0 #20177
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e3e0e71
Update sqlparser to 0.61.0
alamb 0461c5a
Update for new APIs
alamb d0373e8
cleanups
alamb 5573fe4
Merge remote-tracking branch 'apache/main' into alamb/test_sqlparser_…
alamb 3764c31
use released sqlparser
alamb 1a4964f
Fix merge issue
alamb 79eaa41
Merge branch 'main' into alamb/test_sqlparser_update
alamb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -342,26 +342,28 @@ impl<S: ContextProvider> SqlToRel<'_, S> { | |
| refresh_mode, | ||
| initialize, | ||
| require_user, | ||
| partition_of, | ||
| for_values, | ||
| }) => { | ||
| if temporary { | ||
| return not_impl_err!("Temporary tables not supported")?; | ||
| return not_impl_err!("Temporary tables not supported"); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a drive by cleanup -- no need to return and |
||
| } | ||
| if external { | ||
| return not_impl_err!("External tables not supported")?; | ||
| return not_impl_err!("External tables not supported"); | ||
| } | ||
| if global.is_some() { | ||
| return not_impl_err!("Global tables not supported")?; | ||
| return not_impl_err!("Global tables not supported"); | ||
| } | ||
| if transient { | ||
| return not_impl_err!("Transient tables not supported")?; | ||
| return not_impl_err!("Transient tables not supported"); | ||
| } | ||
| if volatile { | ||
| return not_impl_err!("Volatile tables not supported")?; | ||
| return not_impl_err!("Volatile tables not supported"); | ||
| } | ||
| if hive_distribution != ast::HiveDistributionStyle::NONE { | ||
| return not_impl_err!( | ||
| "Hive distribution not supported: {hive_distribution:?}" | ||
| )?; | ||
| ); | ||
| } | ||
| if hive_formats.is_some() | ||
| && !matches!( | ||
|
|
@@ -374,122 +376,126 @@ impl<S: ContextProvider> SqlToRel<'_, S> { | |
| }) | ||
| ) | ||
| { | ||
| return not_impl_err!( | ||
| "Hive formats not supported: {hive_formats:?}" | ||
| )?; | ||
| return not_impl_err!("Hive formats not supported: {hive_formats:?}"); | ||
| } | ||
| if file_format.is_some() { | ||
| return not_impl_err!("File format not supported")?; | ||
| return not_impl_err!("File format not supported"); | ||
| } | ||
| if location.is_some() { | ||
| return not_impl_err!("Location not supported")?; | ||
| return not_impl_err!("Location not supported"); | ||
| } | ||
| if without_rowid { | ||
| return not_impl_err!("Without rowid not supported")?; | ||
| return not_impl_err!("Without rowid not supported"); | ||
| } | ||
| if like.is_some() { | ||
| return not_impl_err!("Like not supported")?; | ||
| return not_impl_err!("Like not supported"); | ||
| } | ||
| if clone.is_some() { | ||
| return not_impl_err!("Clone not supported")?; | ||
| return not_impl_err!("Clone not supported"); | ||
| } | ||
| if comment.is_some() { | ||
| return not_impl_err!("Comment not supported")?; | ||
| return not_impl_err!("Comment not supported"); | ||
| } | ||
| if on_commit.is_some() { | ||
| return not_impl_err!("On commit not supported")?; | ||
| return not_impl_err!("On commit not supported"); | ||
| } | ||
| if on_cluster.is_some() { | ||
| return not_impl_err!("On cluster not supported")?; | ||
| return not_impl_err!("On cluster not supported"); | ||
| } | ||
| if primary_key.is_some() { | ||
| return not_impl_err!("Primary key not supported")?; | ||
| return not_impl_err!("Primary key not supported"); | ||
| } | ||
| if order_by.is_some() { | ||
| return not_impl_err!("Order by not supported")?; | ||
| return not_impl_err!("Order by not supported"); | ||
| } | ||
| if partition_by.is_some() { | ||
| return not_impl_err!("Partition by not supported")?; | ||
| return not_impl_err!("Partition by not supported"); | ||
| } | ||
| if cluster_by.is_some() { | ||
| return not_impl_err!("Cluster by not supported")?; | ||
| return not_impl_err!("Cluster by not supported"); | ||
| } | ||
| if clustered_by.is_some() { | ||
| return not_impl_err!("Clustered by not supported")?; | ||
| return not_impl_err!("Clustered by not supported"); | ||
| } | ||
| if strict { | ||
| return not_impl_err!("Strict not supported")?; | ||
| return not_impl_err!("Strict not supported"); | ||
| } | ||
| if copy_grants { | ||
| return not_impl_err!("Copy grants not supported")?; | ||
| return not_impl_err!("Copy grants not supported"); | ||
| } | ||
| if enable_schema_evolution.is_some() { | ||
| return not_impl_err!("Enable schema evolution not supported")?; | ||
| return not_impl_err!("Enable schema evolution not supported"); | ||
| } | ||
| if change_tracking.is_some() { | ||
| return not_impl_err!("Change tracking not supported")?; | ||
| return not_impl_err!("Change tracking not supported"); | ||
| } | ||
| if data_retention_time_in_days.is_some() { | ||
| return not_impl_err!("Data retention time in days not supported")?; | ||
| return not_impl_err!("Data retention time in days not supported"); | ||
| } | ||
| if max_data_extension_time_in_days.is_some() { | ||
| return not_impl_err!( | ||
| "Max data extension time in days not supported" | ||
| )?; | ||
| ); | ||
| } | ||
| if default_ddl_collation.is_some() { | ||
| return not_impl_err!("Default DDL collation not supported")?; | ||
| return not_impl_err!("Default DDL collation not supported"); | ||
| } | ||
| if with_aggregation_policy.is_some() { | ||
| return not_impl_err!("With aggregation policy not supported")?; | ||
| return not_impl_err!("With aggregation policy not supported"); | ||
| } | ||
| if with_row_access_policy.is_some() { | ||
| return not_impl_err!("With row access policy not supported")?; | ||
| return not_impl_err!("With row access policy not supported"); | ||
| } | ||
| if with_tags.is_some() { | ||
| return not_impl_err!("With tags not supported")?; | ||
| return not_impl_err!("With tags not supported"); | ||
| } | ||
| if iceberg { | ||
| return not_impl_err!("Iceberg not supported")?; | ||
| return not_impl_err!("Iceberg not supported"); | ||
| } | ||
| if external_volume.is_some() { | ||
| return not_impl_err!("External volume not supported")?; | ||
| return not_impl_err!("External volume not supported"); | ||
| } | ||
| if base_location.is_some() { | ||
| return not_impl_err!("Base location not supported")?; | ||
| return not_impl_err!("Base location not supported"); | ||
| } | ||
| if catalog.is_some() { | ||
| return not_impl_err!("Catalog not supported")?; | ||
| return not_impl_err!("Catalog not supported"); | ||
| } | ||
| if catalog_sync.is_some() { | ||
| return not_impl_err!("Catalog sync not supported")?; | ||
| return not_impl_err!("Catalog sync not supported"); | ||
| } | ||
| if storage_serialization_policy.is_some() { | ||
| return not_impl_err!("Storage serialization policy not supported")?; | ||
| return not_impl_err!("Storage serialization policy not supported"); | ||
| } | ||
| if inherits.is_some() { | ||
| return not_impl_err!("Table inheritance not supported")?; | ||
| return not_impl_err!("Table inheritance not supported"); | ||
| } | ||
| if dynamic { | ||
| return not_impl_err!("Dynamic tables not supported")?; | ||
| return not_impl_err!("Dynamic tables not supported"); | ||
| } | ||
| if version.is_some() { | ||
| return not_impl_err!("Version not supported")?; | ||
| return not_impl_err!("Version not supported"); | ||
| } | ||
| if target_lag.is_some() { | ||
| return not_impl_err!("Target lag not supported")?; | ||
| return not_impl_err!("Target lag not supported"); | ||
| } | ||
| if warehouse.is_some() { | ||
| return not_impl_err!("Warehouse not supported")?; | ||
| return not_impl_err!("Warehouse not supported"); | ||
| } | ||
| if refresh_mode.is_some() { | ||
| return not_impl_err!("Refresh mode not supported")?; | ||
| return not_impl_err!("Refresh mode not supported"); | ||
| } | ||
| if initialize.is_some() { | ||
| return not_impl_err!("Initialize not supported")?; | ||
| return not_impl_err!("Initialize not supported"); | ||
| } | ||
| if require_user { | ||
| return not_impl_err!("Require user not supported")?; | ||
| return not_impl_err!("Require user not supported"); | ||
| } | ||
| if partition_of.is_some() { | ||
| return not_impl_err!("PARTITION OF not supported"); | ||
| } | ||
| if for_values.is_some() { | ||
| return not_impl_err!("PARTITION OF .. FOR VALUES .. not supported"); | ||
| } | ||
| // Merge inline constraints and existing constraints | ||
| let mut all_constraints = constraints; | ||
|
|
@@ -989,7 +995,8 @@ impl<S: ContextProvider> SqlToRel<'_, S> { | |
| has_table_keyword, | ||
| settings, | ||
| format_clause, | ||
| insert_token: _insert_token, // record the location the `INSERT` token | ||
| insert_token: _, // record the location the `INSERT` token | ||
| optimizer_hint, | ||
| }) => { | ||
| let table_name = match table { | ||
| TableObject::TableName(table_name) => table_name, | ||
|
|
@@ -1045,6 +1052,9 @@ impl<S: ContextProvider> SqlToRel<'_, S> { | |
| if format_clause.is_some() { | ||
| plan_err!("Inserts with format clause not supported")?; | ||
| } | ||
| if optimizer_hint.is_some() { | ||
| plan_err!("Optimizer hints not supported")?; | ||
| } | ||
| // optional keywords don't change behavior | ||
| let _ = into; | ||
| let _ = has_table_keyword; | ||
|
|
@@ -1059,6 +1069,7 @@ impl<S: ContextProvider> SqlToRel<'_, S> { | |
| or, | ||
| limit, | ||
| update_token: _, | ||
| optimizer_hint, | ||
| }) => { | ||
| let from_clauses = | ||
| from.map(|update_table_from_kind| match update_table_from_kind { | ||
|
|
@@ -1079,6 +1090,9 @@ impl<S: ContextProvider> SqlToRel<'_, S> { | |
| if limit.is_some() { | ||
| return not_impl_err!("Update-limit clause not supported")?; | ||
| } | ||
| if optimizer_hint.is_some() { | ||
| plan_err!("Optimizer hints not supported")?; | ||
| } | ||
| self.update_to_plan(table, &assignments, update_from, selection) | ||
| } | ||
|
|
||
|
|
@@ -1091,6 +1105,7 @@ impl<S: ContextProvider> SqlToRel<'_, S> { | |
| order_by, | ||
| limit, | ||
| delete_token: _, | ||
| optimizer_hint, | ||
| }) => { | ||
| if !tables.is_empty() { | ||
| plan_err!("DELETE <TABLE> not supported")?; | ||
|
|
@@ -1108,6 +1123,10 @@ impl<S: ContextProvider> SqlToRel<'_, S> { | |
| plan_err!("Delete-order-by clause not yet supported")?; | ||
| } | ||
|
|
||
| if optimizer_hint.is_some() { | ||
| plan_err!("Optimizer hints not supported")?; | ||
| } | ||
|
|
||
| let table_name = self.get_delete_target(from)?; | ||
| self.delete_to_plan(&table_name, selection, limit) | ||
| } | ||
|
|
@@ -1393,6 +1412,7 @@ impl<S: ContextProvider> SqlToRel<'_, S> { | |
| cascade, | ||
| on_cluster, | ||
| table, | ||
| if_exists, | ||
| }) => { | ||
| let _ = table; // Support TRUNCATE TABLE and TRUNCATE syntax | ||
| if table_names.len() != 1 { | ||
|
|
@@ -1421,6 +1441,9 @@ impl<S: ContextProvider> SqlToRel<'_, S> { | |
| if on_cluster.is_some() { | ||
| return not_impl_err!("TRUNCATE with ON CLUSTER is not supported"); | ||
| } | ||
| if if_exists { | ||
| return not_impl_err!("TRUNCATE .. WITH EXISTS is not supported"); | ||
| } | ||
| let table = self.object_name_to_table_reference(target.name.clone())?; | ||
| let source = self.context_provider.get_table_source(table.clone())?; | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Should we add a new slt test for this, e.g.,
select all * from test? It’s equivalent toselect * from test.