You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "EthanVieira (via GitHub)" <gi...@apache.org> on 2026/09/28 08:03:09 UTC

[PR] Databricks: support multipart TABLE queries [datafusion-sqlparser-rs]

EthanVieira opened a new pull request, #2594:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2594

   Allows Databricks TABLE queries to reference multipart names such as main.raw.source, while preserving existing behavior for other dialects.
   
   Reference: [Names](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-names)


-- 
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] Databricks: support multipart TABLE queries [datafusion-sqlparser-rs]

Posted by "LucaCappelletti94 (via GitHub)" <gi...@apache.org>.
LucaCappelletti94 commented on PR #2594:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2594#issuecomment-5867694507

   @EthanVieira please do add an entry to the fuzzer seed corpus with this syntax if there isn't one already


-- 
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] Databricks: support multipart TABLE queries [datafusion-sqlparser-rs]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #2594:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2594#issuecomment-5865927425

   ## [Codecov](https://app.codecov.io/gh/apache/datafusion-sqlparser-rs/pull/2594?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :x: Patch coverage is `96.87500%` with `1 line` in your changes missing coverage. Please review.
   :white_check_mark: Project coverage is 81.11%. Comparing base ([`560a13c`](https://app.codecov.io/gh/apache/datafusion-sqlparser-rs/commit/560a13c32b6c3b9f1a202d6b9a9020c016bbf7be?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`669d6c8`](https://app.codecov.io/gh/apache/datafusion-sqlparser-rs/commit/669d6c8cffbbabb17192c8534058fe080bb84886?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/datafusion-sqlparser-rs/pull/2594?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [src/parser/mod.rs](https://app.codecov.io/gh/apache/datafusion-sqlparser-rs/pull/2594?src=pr&el=tree&filepath=src%2Fparser%2Fmod.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL3BhcnNlci9tb2QucnM=) | 96.15% | [0 Missing and 1 partial :warning: ](https://app.codecov.io/gh/apache/datafusion-sqlparser-rs/pull/2594?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@            Coverage Diff             @@
   ##             main    #2594      +/-   ##
   ==========================================
   + Coverage   81.09%   81.11%   +0.01%     
   ==========================================
     Files          42       42              
     Lines       33684    33716      +32     
     Branches    33684    33716      +32     
   ==========================================
   + Hits        27316    27348      +32     
   + Misses       2798     2797       -1     
   - Partials     3570     3571       +1     
   ```
   </details>
   
   [:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/datafusion-sqlparser-rs/pull/2594?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   </details>


-- 
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] Databricks: support multipart TABLE queries [datafusion-sqlparser-rs]

Posted by "EthanVieira (via GitHub)" <gi...@apache.org>.
EthanVieira commented on PR #2594:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2594#issuecomment-6522872434

   > I believe that we need to make the `Table` struct hold an `ObjectName`, as `TableFactor::Table` does, so a qualified name of any length keeps its parts.
   > 
   > ```diff
   > @@ -300,6 +300,4 @@ impl fmt::Display for SetQuantifier {
   >  pub struct Table {
   > -    /// Optional table name (absent for e.g. `TABLE` command without argument).
   > -    pub table_name: Option<Ident>,
   > -    /// Optional schema/catalog name qualifying the table.
   > -    pub schema_name: Option<Ident>,
   > +    /// Optional, possibly qualified, table name (absent for e.g. `TABLE` command without argument).
   > +    pub name: Option<ObjectName>,
   >  }
   > ```
   > 
   > This of course will call for several changes both in the repo and downstream, but it seems like the cleanest solution to me. @alamb opinions?
   
   Haven't heard from @alamb, but I went ahead and did this.


-- 
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] Databricks: support multipart TABLE queries [datafusion-sqlparser-rs]

Posted by "LucaCappelletti94 (via GitHub)" <gi...@apache.org>.
LucaCappelletti94 commented on code in PR #2594:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2594#discussion_r4252384326


##########
src/parser/mod.rs:
##########


Review Comment:
   You should keep every name part as its own `Ident` instead of joining the qualifiers into one. As written, `main.raw.source` and `` `main.raw`.source `` both give a `schema_name` whose `value` is `"main.raw"`, and `` `a b`.raw.source `` gives the `value` `` "`a b`.raw" `` with the backticks inside it, so consumers cannot recover the parts. This relies on the `Table` change in the global note.
   
   ```suggestion
           let max_parts = if self.dialect.supports_multipart_table_query_name() {
               usize::MAX
           } else {
               2
           };
           let mut parts = vec![self.parse_identifier()?];
           while parts.len() < max_parts && self.consume_token(&Token::Period) {
               parts.push(self.parse_identifier()?);
           }
           Ok(Table {
               name: Some(ObjectName::from(parts)),
           })
   ```



##########
tests/sqlparser_databricks.rs:
##########
@@ -769,3 +769,8 @@ fn parse_databricks_collated_data_types() {
         .parse_sql_statements("CREATE TABLE t (c ARRAY<STRING COLLATE UTF8_LCASE>)")
         .is_err());
 }
+
+#[test]
+fn parse_databricks_multipart_table_query() {
+    databricks().verified_stmt("CREATE VIEW copy AS TABLE main.raw.source");

Review Comment:
   You should assert the parsed parts, because `verified_stmt` only checks the round trip and the joined `Ident` passes it.
   
   ```suggestion
       let Statement::CreateView(view) =
           databricks().verified_stmt("CREATE VIEW copy AS TABLE main.raw.source")
       else {
           unreachable!()
       };
       assert_eq!(
           *view.query.body,
           SetExpr::Table(Box::new(Table {
               name: Some(ObjectName::from(vec![
                   Ident::new("main"),
                   Ident::new("raw"),
                   Ident::new("source"),
               ])),
           }))
       );
   ```



-- 
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