PokIsemaine commented on issue #15071:
URL: https://github.com/apache/datafusion/issues/15071#issuecomment-2708645397

   I want to discuss `JoinType`:  
   
   JoinOperator
   - https://github.com/apache/datafusion-sqlparser-rs/pull/1692
   - https://github.com/apache/datafusion-sqlparser-rs/pull/1726
   
   Do we need to distinguish between `Inner/Join`, `Left/LeftOuter`, and 
`Right/RightOuter` in `JoinType`, like this?  
   
   ```rust
   pub enum JoinType {
       Inner,
       Join,
       Left,
       LeftOuter,
       Right,
       RightOuter,
       // other...
   }
   ```
   
   Since `sqlparser` now differentiates between `INNER JOIN` and `JOIN`, the 
parsed result no longer matches the original test cases. For example:  
   
   ```rust
   TestStatementWithDialect {
       sql: "
           SELECT
             j1_string,
             j2_string
           FROM
             (
               SELECT
                 distinct j1_id,
                 j1_string,
                 j2_string
               from
                 j1
                 INNER join j2 ON j1.j1_id = j2.j2_id
               order by
                 j1.j1_id desc
               limit
                 10
             ) abc
           ORDER BY
             abc.j2_string",
       expected: r#"SELECT abc.j1_string, abc.j2_string FROM (SELECT DISTINCT 
j1.j1_id, j1.j1_string, j2.j2_string FROM j1 JOIN j2 ON (j1.j1_id = j2.j2_id) 
ORDER BY j1.j1_id DESC NULLS FIRST LIMIT 10) AS abc ORDER BY abc.j2_string ASC 
NULLS LAST"#,
       parser_dialect: Box::new(GenericDialect {}),
       unparser_dialect: Box::new(UnparserDefaultDialect {}),
   },
   ```
   
   Should the `JOIN` in `expected` be changed to `INNER JOIN`?  
   
   If we make this distinction, it will affect printing and the unparser, which 
will indirectly impact many test cases. Do you have any good suggestions?


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to