You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/04/24 02:53:11 UTC

[GitHub] [shardingsphere] wgy8283335 opened a new pull request #10168: 10104 oracle antlr transfer tool

wgy8283335 opened a new pull request #10168:
URL: https://github.com/apache/shardingsphere/pull/10168


   Fixes #10104.
   
   Changes proposed in this pull request:
   - add ANTLR g4 files to analyze the ORACLE SQL rue.
   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] wgy8283335 commented on pull request #10168: 10104 oracle antlr transfer tool

Posted by GitBox <gi...@apache.org>.
wgy8283335 commented on pull request #10168:
URL: https://github.com/apache/shardingsphere/pull/10168#issuecomment-826023414


   Is it suitable to put g4 files in the 'tool' directory? @tristaZero 


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] wgy8283335 commented on pull request #10168: 10104 oracle antlr transfer tool

Posted by GitBox <gi...@apache.org>.
wgy8283335 commented on pull request #10168:
URL: https://github.com/apache/shardingsphere/pull/10168#issuecomment-826023711


   I've checked several rules whether could be analyzed correctly. Below is an example.
   ![image](https://user-images.githubusercontent.com/22066046/115944956-af490480-a4eb-11eb-986e-8aba815c726f.png)
   ```
   DROP TABLE [ schema. ] table [ CASCADE CONSTRAINTS ] [ PURGE ] ;
   UPDATE [ hint ] { dml_table_expression_clause | ONLY (dml_table_expression_clause) } [ t_alias ] update_set_clause [ where_clause ] [ returning_clause ] [error_logging_clause] ;
   SET TRANSACTION { { READ { ONLY | WRITE } | ISOLATION LEVEL { SERIALIZABLE | READ COMMITTED } | USE ROLLBACK SEGMENT rollback_segment } [ NAME string ] | NAME string } ;
   [ with_clause ] SELECT [ hint ] [ { { DISTINCT | UNIQUE } | ALL } ] select_list FROM { table_reference | join_clause | ( join_clause ) | inline_analytic_view } [ , { table_reference | join_clause | (join_clause) | inline_analytic_view} ] ... [ where_clause ] [ hierarchical_query_clause ] [ group_by_clause ] [ model_clause ]
   
   ALTER TABLE [ schema. ] table
     [ memoptimize_read_clause ]
     [ memoptimize_write_clause ]
     [ alter_table_properties
     | column_clauses
     | constraint_clauses
     | alter_table_partitioning
     | alter_external_table
     | move_table_clause
     | modify_to_partitioned
     | modify_opaque_type
     | immutable_table_clauses
     | blockchain_table_clauses
     ]
     [ enable_disable_clause
     | { ENABLE | DISABLE }
       { TABLE LOCK | ALL TRIGGERS | CONTAINER_MAP | CONTAINERS_DEFAULT }
     ] ...
     ;
     
   CREATE USER user
      { { 
          IDENTIFIED       
       
           {
              BY password [ [HTTP] DIGEST { ENABLE | DISABLE } ]
              | EXTERNALLY [ AS 'certificate_DN'  |  AS 'kerberos_principal_name' ]
              | GLOBALLY [ AS '[ directory_DN ]' ]
              }
   
           }               
             | NO AUTHENTICATION
      }
      [ DEFAULT COLLATION collation_name ]
      [ DEFAULT TABLESPACE tablespace
      | [ LOCAL ] TEMPORARY TABLESPACE { tablespace | tablespace_group_name }
      | { QUOTA { size_clause | UNLIMITED } ON tablespace }...
      | PROFILE profile
      | PASSWORD EXPIRE
      | ACCOUNT { LOCK | UNLOCK }
        [ DEFAULT TABLESPACE tablespace
        | TEMPORARY TABLESPACE
             { tablespace | tablespace_group_name }
        | { QUOTA { size_clause | UNLIMITED } ON tablespace }...
        | PROFILE profile
        | PASSWORD EXPIRE
        | ACCOUNT { LOCK | UNLOCK }
        | ENABLE EDITIONS
        | CONTAINER = { CURRENT | ALL }
        ]...
     ] ;
       
   SET
   { { (column [, column ]...) = (subquery)
     | column = { expr | (subquery) | DEFAULT }
     }
        [, { (column [, column]...) = (subquery)
           | column = { expr | (subquery) | DEFAULT }
           }
        ]...
   | VALUE (t_alias) = { expr | (subquery) }
   }};
   
   { [ schema. ]
     { table
       [ partition_extension_clause
       | @ dblink
       ]
     | { view | materialized view } [ @ dblink ]
     }
   | ( subquery [ subquery_restriction_clause ] )
   | table_collection_expression
   }
   ```


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] wgy8283335 commented on pull request #10168: 10104 oracle antlr transfer tool

Posted by GitBox <gi...@apache.org>.
wgy8283335 commented on pull request #10168:
URL: https://github.com/apache/shardingsphere/pull/10168#issuecomment-826023983


   I will add an implementation class of TransferRuleListener in the next PR to transfer the ORACLE rule to the g4 rule.


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] wgy8283335 commented on pull request #10168: 10104 oracle antlr transfer tool

Posted by GitBox <gi...@apache.org>.
wgy8283335 commented on pull request #10168:
URL: https://github.com/apache/shardingsphere/pull/10168#issuecomment-826447551


   I've test the TransferTool, the result of the rule sentence like below:
   
   ```
   -----------------------------------
   Before:
   UPDATE [ hint ] { dml_table_expression_clause | ONLY (dml_table_expression_clause) } [ t_alias ] update_set_clause [ where_clause ] [ returning_clause ] [error_logging_clause] ;
   After:
   UPDATE (hint)?  (dmlTableExpressionClause | ONLY LP_(dmlTableExpressionClause)RP_ )  (tAlias)? updateSetClause (whereClause)?  (returningClause)?  (errorLoggingClause)? ;
   
   -----------------------------------
   Before:
   ALTER TABLE [ schema. ] table
     [ memoptimize_read_clause ]
     [ memoptimize_write_clause ]
     [ alter_table_properties
     | column_clauses
     | constraint_clauses
     | alter_table_partitioning
     | alter_external_table
     | move_table_clause
     | modify_to_partitioned
     | modify_opaque_type
     | immutable_table_clauses
     | blockchain_table_clauses
     ]
     [ enable_disable_clause
     | { ENABLE | DISABLE }
       { TABLE LOCK | ALL TRIGGERS | CONTAINER_MAP | CONTAINERS_DEFAULT }
     ] ...
     ;
   After:
   ALTER TABLE (schema.)? table (memoptimizeReadClause)?  (memoptimizeWriteClause)?  (alterTableProperties | columnClauses | constraintClauses | alterTablePartitioning | alterExternalTable | moveTableClause | modifyToPartitioned | modifyOpaqueType | immutableTableClauses | blockchainTableClauses)?  (enableDisableClause |  (ENABLE | DISABLE)  (TABLE LOCK | ALL TRIGGERS | CONTAINER_MAP | CONTAINERS_DEFAULT) )* ;
   ------------------------------------
   Before:
   SET
   { { (column [, column ]...) = (subquery)
     | column = { expr | (subquery) | DEFAULT }
     }
        [, { (column [, column]...) = (subquery)
           | column = { expr | (subquery) | DEFAULT }
           }
        ]...
   | VALUE (t_alias) = { expr | (subquery) }
   }};
   After:
   SET ( ( LP_(column (,column)* )RP_  EQ_  LP_(subquery)RP_  | column EQ_  (expr |  LP_(subquery)RP_  | DEFAULT) )  (, ( LP_(column (,column)* )RP_  EQ_  LP_(subquery)RP_  | column EQ_  (expr |  LP_(subquery)RP_  | DEFAULT) ) )*  | VALUE LP_(tAlias)RP_  EQ_  (expr |  LP_(subquery)RP_ ) ) 
   -------------------------------
   ```


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] wgy8283335 commented on pull request #10168: 10104 oracle antlr transfer tool

Posted by GitBox <gi...@apache.org>.
wgy8283335 commented on pull request #10168:
URL: https://github.com/apache/shardingsphere/pull/10168#issuecomment-826447551


   I've test the TransferTool, the result of the rule sentence like below:
   
   ```
   -----------------------------------
   Before:
   UPDATE [ hint ] { dml_table_expression_clause | ONLY (dml_table_expression_clause) } [ t_alias ] update_set_clause [ where_clause ] [ returning_clause ] [error_logging_clause] ;
   After:
   UPDATE (hint)?  (dmlTableExpressionClause | ONLY LP_(dmlTableExpressionClause)RP_ )  (tAlias)? updateSetClause (whereClause)?  (returningClause)?  (errorLoggingClause)? ;
   
   -----------------------------------
   Before:
   ALTER TABLE [ schema. ] table
     [ memoptimize_read_clause ]
     [ memoptimize_write_clause ]
     [ alter_table_properties
     | column_clauses
     | constraint_clauses
     | alter_table_partitioning
     | alter_external_table
     | move_table_clause
     | modify_to_partitioned
     | modify_opaque_type
     | immutable_table_clauses
     | blockchain_table_clauses
     ]
     [ enable_disable_clause
     | { ENABLE | DISABLE }
       { TABLE LOCK | ALL TRIGGERS | CONTAINER_MAP | CONTAINERS_DEFAULT }
     ] ...
     ;
   After:
   ALTER TABLE (schema.)? table (memoptimizeReadClause)?  (memoptimizeWriteClause)?  (alterTableProperties | columnClauses | constraintClauses | alterTablePartitioning | alterExternalTable | moveTableClause | modifyToPartitioned | modifyOpaqueType | immutableTableClauses | blockchainTableClauses)?  (enableDisableClause |  (ENABLE | DISABLE)  (TABLE LOCK | ALL TRIGGERS | CONTAINER_MAP | CONTAINERS_DEFAULT) )* ;
   ------------------------------------
   Before:
   SET
   { { (column [, column ]...) = (subquery)
     | column = { expr | (subquery) | DEFAULT }
     }
        [, { (column [, column]...) = (subquery)
           | column = { expr | (subquery) | DEFAULT }
           }
        ]...
   | VALUE (t_alias) = { expr | (subquery) }
   }};
   After:
   SET ( ( LP_(column (,column)* )RP_  EQ_  LP_(subquery)RP_  | column EQ_  (expr |  LP_(subquery)RP_  | DEFAULT) )  (, ( LP_(column (,column)* )RP_  EQ_  LP_(subquery)RP_  | column EQ_  (expr |  LP_(subquery)RP_  | DEFAULT) ) )*  | VALUE LP_(tAlias)RP_  EQ_  (expr |  LP_(subquery)RP_ ) ) 
   -------------------------------
   ```


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] wgy8283335 closed pull request #10168: 10104 oracle antlr transfer tool

Posted by GitBox <gi...@apache.org>.
wgy8283335 closed pull request #10168:
URL: https://github.com/apache/shardingsphere/pull/10168


   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org