You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2024/11/29 12:25:42 UTC
[PR] Improve unsupported compound identifier message [datafusion]
alamb opened a new pull request, #13605:
URL: https://github.com/apache/datafusion/pull/13605
## Which issue does this PR close?
- Part of https://github.com/apache/datafusion/pull/13546
## Rationale for this change
While working on the upgrade of sqlparser, the structure has changed and thus the debug formatting has changed (so I needed to change this error message anyways)
The error message was hard to understand anyways, so I spent a few moments improving it to show the actual indentifers rather than a debug version
## What changes are included in this PR?
1. Improve error message and test
## Are these changes tested?
Yes
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code
If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
-->
## Are there any user-facing changes?
<!--
If there are user-facing changes then we may require documentation to be updated before approving the PR.
-->
<!--
If there are any breaking changes to public APIs, please add the `api change` label.
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Improve unsupported compound identifier message [datafusion]
Posted by "Weijun-H (via GitHub)" <gi...@apache.org>.
Weijun-H commented on code in PR #13605:
URL: https://github.com/apache/datafusion/pull/13605#discussion_r1864040114
##########
datafusion/sqllogictest/test_files/errors.slt:
##########
@@ -70,7 +70,7 @@ SELECT COUNT(*) FROM nonexistentschema.aggregate_test_100
statement error Error during planning: table 'nonexistentcatalog\.public\.aggregate_test_100' not found
SELECT COUNT(*) FROM nonexistentcatalog.public.aggregate_test_100
-statement error Error during planning: Unsupported compound identifier '\[Ident \{ value: "way", quote_style: None \}, Ident \{ value: "too", quote_style: None \}, Ident \{ value: "many", quote_style: None \}, Ident \{ value: "namespaces", quote_style: None \}, Ident \{ value: "as", quote_style: None \}, Ident \{ value: "ident", quote_style: None \}, Ident \{ value: "prefixes", quote_style: None \}, Ident \{ value: "aggregate_test_100", quote_style: None \}\]'
+statement error DataFusion error: Error during planning: Unsupported compound identifier 'way\.too\.many\.namespaces\.as\.ident\.prefixes\.aggregate_test_100'\. Expected 1, 2 or 3 parts, got 8
Review Comment:
👍
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Improve unsupported compound identifier message [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #13605:
URL: https://github.com/apache/datafusion/pull/13605#issuecomment-2508952545
Thanks @Weijun-H and @jonahgao
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Improve unsupported compound identifier message [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb merged PR #13605:
URL: https://github.com/apache/datafusion/pull/13605
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Improve unsupported compound identifier message [datafusion]
Posted by "jonahgao (via GitHub)" <gi...@apache.org>.
jonahgao commented on code in PR #13605:
URL: https://github.com/apache/datafusion/pull/13605#discussion_r1863695929
##########
datafusion/sql/src/planner.rs:
##########
@@ -622,24 +622,41 @@ pub fn object_name_to_table_reference(
idents_to_table_reference(idents, enable_normalization)
}
+struct IdentTaker(Vec<Ident>);
+/// Take the next identifier from the back of idents, panic'ing if
+/// there are none left
+impl IdentTaker {
+ fn take(&mut self, enable_normalization: bool) -> String {
+ let ident = self.0.pop().expect("no more identifiers");
+ IdentNormalizer::new(enable_normalization).normalize(ident)
Review Comment:
Not related to the current PR, maybe we can move `IdentNormalizer` into `IdentTaker` to simplify `take()` and avoid creating normalizer every time.
##########
datafusion/sqllogictest/test_files/errors.slt:
##########
@@ -70,7 +70,7 @@ SELECT COUNT(*) FROM nonexistentschema.aggregate_test_100
statement error Error during planning: table 'nonexistentcatalog\.public\.aggregate_test_100' not found
SELECT COUNT(*) FROM nonexistentcatalog.public.aggregate_test_100
-statement error Error during planning: Unsupported compound identifier '\[Ident \{ value: "way", quote_style: None \}, Ident \{ value: "too", quote_style: None \}, Ident \{ value: "many", quote_style: None \}, Ident \{ value: "namespaces", quote_style: None \}, Ident \{ value: "as", quote_style: None \}, Ident \{ value: "ident", quote_style: None \}, Ident \{ value: "prefixes", quote_style: None \}, Ident \{ value: "aggregate_test_100", quote_style: None \}\]'
+statement error DataFusion error: Error during planning: Unsupported compound identifier 'way\.too\.many\.namespaces\.as\.ident\.prefixes\.aggregate_test_100'\. Expected 1, 2 or 3 parts, got 8
Review Comment:
👍
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Improve unsupported compound identifier message [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #13605:
URL: https://github.com/apache/datafusion/pull/13605#discussion_r1864245102
##########
datafusion/sql/src/planner.rs:
##########
@@ -622,24 +622,41 @@ pub fn object_name_to_table_reference(
idents_to_table_reference(idents, enable_normalization)
}
+struct IdentTaker(Vec<Ident>);
+/// Take the next identifier from the back of idents, panic'ing if
+/// there are none left
+impl IdentTaker {
+ fn take(&mut self, enable_normalization: bool) -> String {
+ let ident = self.0.pop().expect("no more identifiers");
+ IdentNormalizer::new(enable_normalization).normalize(ident)
Review Comment:
will do in a follow on PR
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Improve unsupported compound identifier message [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #13605:
URL: https://github.com/apache/datafusion/pull/13605#discussion_r1863452171
##########
datafusion/sqllogictest/test_files/errors.slt:
##########
@@ -70,7 +70,7 @@ SELECT COUNT(*) FROM nonexistentschema.aggregate_test_100
statement error Error during planning: table 'nonexistentcatalog\.public\.aggregate_test_100' not found
SELECT COUNT(*) FROM nonexistentcatalog.public.aggregate_test_100
-statement error Error during planning: Unsupported compound identifier '\[Ident \{ value: "way", quote_style: None \}, Ident \{ value: "too", quote_style: None \}, Ident \{ value: "many", quote_style: None \}, Ident \{ value: "namespaces", quote_style: None \}, Ident \{ value: "as", quote_style: None \}, Ident \{ value: "ident", quote_style: None \}, Ident \{ value: "prefixes", quote_style: None \}, Ident \{ value: "aggregate_test_100", quote_style: None \}\]'
+statement error DataFusion error: Error during planning: Unsupported compound identifier 'way\.too\.many\.namespaces\.as\.ident\.prefixes\.aggregate_test_100'\. Expected 1, 2 or 3 parts, got 8
Review Comment:
This line has to change anyways with the sqlparser update, and I think this PR has a nicer message
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Improve unsupported compound identifier message [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #13605:
URL: https://github.com/apache/datafusion/pull/13605#discussion_r1864245102
##########
datafusion/sql/src/planner.rs:
##########
@@ -622,24 +622,41 @@ pub fn object_name_to_table_reference(
idents_to_table_reference(idents, enable_normalization)
}
+struct IdentTaker(Vec<Ident>);
+/// Take the next identifier from the back of idents, panic'ing if
+/// there are none left
+impl IdentTaker {
+ fn take(&mut self, enable_normalization: bool) -> String {
+ let ident = self.0.pop().expect("no more identifiers");
+ IdentNormalizer::new(enable_normalization).normalize(ident)
Review Comment:
will do in a follow on PR
Update: in https://github.com/apache/datafusion/pull/13609
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org