[ 
https://issues.apache.org/jira/browse/IMPALA-10960?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17427499#comment-17427499
 ] 

carolinchen edited comment on IMPALA-10960 at 10/12/21, 8:07 AM:
-----------------------------------------------------------------

hi  [~stigahuang] [[email protected]]  thank you for your attentions

        1. i think we should treat   the commnet/hit  and  sql comment rule 
differently. 

             comment/hit is aimed to offer the information of SQL statement,  
that may be useful for query execute;

             sql commet rule is aimed to offer the rule which we want get in 
the query commet, which can offer us the query instruction or any thing we want 
get

             by set the query option.

        2.  sql comment rule is a query option just as other query options 
(such as mem_limit) to canonical query comments,  it is a criterion.

              which is used to check the query's comments msg whether  
justifiable for sql comment rule.

  The purpose for me to do this jiar in our used scene is that  we want the 
users offer us  some  fixed comments as we wish , when they use our clusters.

   above all, the query option is felxible 1) we can choose use or not use . 2) 
we can choose the rule we want set. 

                                                                                
                                                                                
                                                                                
                                                          Below  is local test: 
     
{code:java}
Query (id=6d4ba14327d49b4f:d266ec2d00000000):
  DEBUG MODE WARNING: Query profile created while running a DEBUG build of 
Impala. Use RELEASE builds to measure query performance.
   - InactiveTotalTime: 0.000ns
   - TotalTime: 0.000ns
  Summary:
    Session ID: d343918298f46ee9:b5ec9fe42e05deba
    Session Type: HIVESERVER2
    HiveServer2 Protocol Version: V6
    Start Time: 2021-10-12 11:11:30.350714000
    End Time: 2021-10-12 11:11:30.501073000
    Query Type: QUERY
    Query State: FINISHED
    Impala Query State: FINISHED
    Query Status: OK
    Impala Version: impalad version 4.1.0-SNAPSHOT DEBUG (build 
45fd3320ad4f68ca86998dff0c9504aa896a278a)
    User: tencent
    Connected User: tencent
    Delegated User: 
    Network Address: ::ffff:127.0.0.1:43846
    Default Db: tpcds
    Sql Statement: /*author:carolinchen project:data_hub desc:query for 
DAU*/select * from customer limit 100
    Coordinator: carolinchen-LC0:27000
    Query Options (set by configuration): TIMEZONE=PRC,CLIENT_IDENTIFIER=Impala 
Shell v4.1.0-SNAPSHOT (45fd332) built on Mon Oct 11 21:23:37 CST 
2021,SQL_COMMENT_RULE=/*author:\S+\s*?project:\S+\s*?desc:\S+\s*?.*/
{code}
 


was (Author: carolinchen):
hi  [~stigahuang] [[email protected]]  thank you for your attentions

        1. i think we should treat   the commnet/hit  and  sql comment rule 
differently. 

             comment/hit is aimed to offer the information of SQL statement,  
that may be useful for query execute;

             sql commet rule is aimed to offer the rule which we want get in 
the query commet, which can offer us the query instruction or any thing we want 
get

             by set the query option.

        2.  sql comment rule is a query option just as other query options 
(such as mem_limit) to canonical query comments,  it is a criterion.

              which is used to check the query's comments msg whether  
justifiable for sql comment rule.

  The purpose for me to do this jiar in our used scene is that  we want the 
users offer us  some  fixed comments as we wish , when they use our clusters.

   above all, the query option is felxible 1) we can choose use or not use . 2) 
we can choose the rule we want set. 

                                                                                
                                                                                
                                                                                
                                                                                
                                                              Below  is local 
test:                                                                           
                                                                                
                                                                                
                   
{code:java}
Query (id=6d4ba14327d49b4f:d266ec2d00000000):
  DEBUG MODE WARNING: Query profile created while running a DEBUG build of 
Impala. Use RELEASE builds to measure query performance.
   - InactiveTotalTime: 0.000ns
   - TotalTime: 0.000ns
  Summary:
    Session ID: d343918298f46ee9:b5ec9fe42e05deba
    Session Type: HIVESERVER2
    HiveServer2 Protocol Version: V6
    Start Time: 2021-10-12 11:11:30.350714000
    End Time: 2021-10-12 11:11:30.501073000
    Query Type: QUERY
    Query State: FINISHED
    Impala Query State: FINISHED
    Query Status: OK
    Impala Version: impalad version 4.1.0-SNAPSHOT DEBUG (build 
45fd3320ad4f68ca86998dff0c9504aa896a278a)
    User: tencent
    Connected User: tencent
    Delegated User: 
    Network Address: ::ffff:127.0.0.1:43846
    Default Db: tpcds
    Sql Statement: /*author:carolinchen project:data_hub desc:query for 
DAU*/select * from customer limit 100
    Coordinator: carolinchen-LC0:27000
    Query Options (set by configuration): TIMEZONE=PRC,CLIENT_IDENTIFIER=Impala 
Shell v4.1.0-SNAPSHOT (45fd332) built on Mon Oct 11 21:23:37 CST 
2021,SQL_COMMENT_RULE=/*author:\S+\s*?project:\S+\s*?desc:\S+\s*?.*/
{code}
 

> Add query option for sql comment rule
> -------------------------------------
>
>                 Key: IMPALA-10960
>                 URL: https://issues.apache.org/jira/browse/IMPALA-10960
>             Project: IMPALA
>          Issue Type: New Feature
>          Components: Backend
>    Affects Versions: Impala 4.0.0
>            Reporter: carolinchen
>            Assignee: carolinchen
>            Priority: Minor
>              Labels: features
>   Original Estimate: 12h
>  Remaining Estimate: 12h
>
> SQL comment can be used to describe the SQL statements.  with comments 
> containing information about the SQL statements,  This  may help in easily 
> correlating slow performance with source code.
> For better to use sql comment, we can set the sql comment rule with regular 
> expression
> eg: set  
> sql_comment_rule=/\*\s*author:\S+\s*?project:\S+\s*?desc:\S+\s*?.+\*/.+?;
> this example means that if the SQL statement want be addmitted by impala,  
> its sql comment must include auther. project and desc's infomation. then we 
> can trace the sql‘s origin.
> there are two steps:
>  # Set sql_comment_rule by own way, with set sql_comment_rule query option in 
> regular expression
>  # Check the query‘s  legality  based on the sql_comment_rule which we have 
> set. if check succeed, SQL can be admitted to Coordinator. otherwise, will 
> refuse the query.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to