Skip to content
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

Freemine.lemon.warning.as.error.with.jointest #29410

Open
wants to merge 11 commits into
base: 3.0
Choose a base branch
from

Conversation

freemine
Copy link
Contributor

#29277
merge with newly-added-jointest cases

table_reference(B) INNER JOIN table_reference(E) join_on_clause_opt(F)
window_offset_clause_opt(G) jlimit_clause_opt(H). { JOINED_TABLE_MK(JOIN_TYPE_INNER, JOIN_STYPE_NONE, A, B, E, F, G, H); }

inner_joined(A) ::=
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这是outer join

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please be kindly noted, here is the old gramma:

%type join_type                                                                   { EJoinType }                                                                                  
%destructor join_type                                                             { }  
join_type(A) ::= .                                                                { A = JOIN_TYPE_INNER; }
join_type(A) ::= INNER.                                                           { A = JOIN_TYPE_INNER; }
join_type(A) ::= LEFT.                                                            { A = JOIN_TYPE_LEFT; }
join_type(A) ::= RIGHT.                                                           { A = JOIN_TYPE_RIGHT; }
join_type(A) ::= FULL.                                                            { A = JOIN_TYPE_FULL; }
                                                                                    
%type join_subtype                                                                { EJoinSubType }
%destructor join_subtype                                                          { }  
join_subtype(A) ::= .                                                             { A = JOIN_STYPE_NONE; }
join_subtype(A) ::= OUTER.                                                        { A = JOIN_STYPE_OUTER; }
join_subtype(A) ::= SEMI.                                                         { A = JOIN_STYPE_SEMI; }
join_subtype(A) ::= ANTI.                                                         { A = JOIN_STYPE_ANTI; }
join_subtype(A) ::= ASOF.                                                         { A = JOIN_STYPE_ASOF; }
join_subtype(A) ::= WINDOW.                                                       { A = JOIN_STYPE_WIN; }

which means: INNER JOIN matches:
join_type(A) ::= INNER. { A = JOIN_TYPE_INNER; }
and
join_subtye(A) ::= . { A = JOIN_STYPE_NONE; }

and i guess the actual join type is modified in c code which this PR is not touched yet.
Please reconsider if this is a MUST for this PR?

table_reference(B) LEFT JOIN table_reference(E) join_on_clause_opt(F)
window_offset_clause_opt(G) jlimit_clause_opt(H). { JOINED_TABLE_MK(JOIN_TYPE_LEFT, JOIN_STYPE_NONE, A, B, E, F, G, H); }

inner_joined(A) ::=
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

table_reference(B) RIGHT JOIN table_reference(E) join_on_clause_opt(F)
window_offset_clause_opt(G) jlimit_clause_opt(H). { JOINED_TABLE_MK(JOIN_TYPE_RIGHT, JOIN_STYPE_NONE, A, B, E, F, G, H); }

inner_joined(A) ::=
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

window_offset_clause_opt(G) jlimit_clause_opt(H). { JOINED_TABLE_MK(JOIN_TYPE_FULL, JOIN_STYPE_NONE, A, B, E, F, G, H); }

/************************************************ outer join **********************************************************/
outer_joined(A) ::=
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个不合法

Copy link
Contributor Author

@freemine freemine Jan 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again, according to https://docs.taosdata.com/reference/taos-sql/join/, i tend to believe FULL JOIN is illegal.
but, i tried to test with the following result:

(.py3) xxh@xxh-virtual-machine:~/Documents/taos/TDengine$ taos -s 'select * from foo.t1 full join foo.t2 on t1.ts = t2.ts'
Welcome to the TDengine Command Line Interface, Client Version:3.3.5.0.alpha
Copyright (c) 2023 by TDengine, all rights reserved.

taos> select * from foo.t1 full join foo.t2 on t1.ts = t2.ts
Query OK, 0 row(s) in set (0.004551s)

(.py3) xxh@xxh-virtual-machine:~/Documents/taos/TDengine$ git log -1
commit e5f617db796cd7110b7efe26dd24095e55128a68 (HEAD -> main, origin/main)
Merge: e102063a1e 8bf82a9ce8
Author: Shengliang Guan <slguan@taosdata.com>
Date:   Fri Dec 27 14:32:11 2024 +0800

    Merge pull request #29364 from taosdata/wangmm0220-patch-3
    
    fix:log description error

so, it seems FULL JOIN is supported by the taos version before this PR.

and once again, please confirm if we MUST do a thorough match-up in this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI. here's a clue that c code lazily modifies JOIN_STYPE_NONE to JOIN_STYPE_OUTER on the same git commit.

截屏2025-01-02 07 54 13

window_offset_clause_opt(G) jlimit_clause_opt(H). { JOINED_TABLE_MK(JOIN_TYPE_FULL, JOIN_STYPE_OUTER, A, B, E, F, G, H); }

/************************************************ semi join ***********************************************************/
semi_joined(A) ::=
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不合法语法可以删除

window_offset_clause_opt(G) jlimit_clause_opt(H). { JOINED_TABLE_MK(JOIN_TYPE_FULL, JOIN_STYPE_SEMI, A, B, E, F, G, H); }

/************************************************ ansi join ***********************************************************/
anti_joined(A) ::=
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

window_offset_clause_opt(G) jlimit_clause_opt(H). { JOINED_TABLE_MK(JOIN_TYPE_FULL, JOIN_STYPE_ANTI, A, B, E, F, G, H); }

/************************************************ asof join ***********************************************************/
asof_joined(A) ::=
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

window_offset_clause_opt(G) jlimit_clause_opt(H). { JOINED_TABLE_MK(JOIN_TYPE_FULL, JOIN_STYPE_ASOF, A, B, E, F, G, H); }

/************************************************ window join *********************************************************/
win_joined(A) ::=
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

Copy link
Contributor Author

@freemine freemine Dec 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, it was initially designed to fully-compatible to what has been deployed with the old gramma, which actually seems unnecessary unless no customer strongly relied on this.

@freemine freemine requested a review from dapan1121 January 1, 2025 03:49
@freemine
Copy link
Contributor Author

freemine commented Jan 2, 2025

checking list to be confirmed:
ref: https://docs.taosdata.com/reference/taos-sql/join/

inner_join:                                                                        
  JOIN                 === INNER JOIN                                              
                                                                                   
outer_join:                                                                        
  OUTER JOIN           ??? LEFT OUTER JOIN                                         
  LEFT JOIN            === LEFT OUTER JOIN                                         
  RIGHT JOIN           === RIGHT OUTER JOIN                                        
  FUUL JOIN            === FULL OUTER JOIN                                                                                                                                      
                                                                                   
semi_join:                                                                         
  LEFT SEMI JOIN                                                                   
  RIGHT SEMI JOIN                                                                  
                                                                                   
anti_join:                                                                         
  LEFT ANTI JOIN                                                                   
  RIGHT ANTI JOIN                                                                  
                                                                                   
asof_join:                                                                         
  LEFT ASOF JOIN                                                                   
  RIGHT ASOF JOIN                                                                  
                                                                                   
win_join:                                                                          
  LEFT WINDOW JOIN                                                                 
  RIGHT WINDOW JOIN                                                                
                                                                                   
join clauses:                                                                      
inner_join:        ON ...                                                          
                                                                                   
outer_join:        ON ...                                                          
                                                                                   
semi_join:         ON ...                                                          
                                                                                   
anti_join:         ON ...                                                          
                                                                                   
asof_join:         [ON ...] [JLIMIT ...]                                           
                                                                                   
win_join:          WINDOW_OFFSET ... [JLIMIT ...]                                  

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants