Re: How to add some children to the abstract syntax tree AST to implement UDF encryption function

2022-09-21 Thread liuyehan
Hi,Jan Fili



Thank you for your reply. Since it is to cooperate with the customer, it must 
be changed in this way. The child nodes of the abstract syntax tree are added. 
You can't just add children through code like I did. To change the execution 
plan of the entire SQL?

The idea is to use the preAnalyze method to analyze the AST and change the AST 
to encrypt some fields.



Best regards,
Liuyehan 



| |
liuyehan
|
|
lyh1067341...@163.com
|
 Replied Message 
| From | Jan Fili |
| Date | 9/21/2022 14:02 |
| To |  |
| Subject | Re: How to add some children to the abstract syntax tree AST to 
implement UDF encryption function |
Just run the command internally to the UDF? Or use Map directly? 


Just as some quicker means. 


Otherwise you would need to adjust the Grammar file, rebuild and the new child 
will be recognized 


liuyehan  schrieb am Mi., 21. Sept. 2022, 05:06:

Hi,everyone 


Problem :  How to add some children to the abstract syntax tree AST to 
implement UDF encryption function



I want to implement a function like this, pass SQL as insert into B select ID 
from a -- Run the insert into b select UDF (ID) from A command At present, 
my idea is to implement HiveSemanticAnalyzerHook preAnalyze method, now I add 
child nodes in this way will report an error, see the source code did not find 
the example, so would like to ask you, how to change the AST add child nodes?

ASTNode outerAST = new ASTNode(new CommonToken(hiveParser.tok_function, 
"(TOK_FUNCTION MD5 (tok_table_or_col name))");

Ast. GetChild (0). The getChild (1). The getChild (1). The getChild (0). 
SetChild (0, outerAST);

Thank you.



Best regards,
Liuyehan 

| |
liuyehan
|
|
lyh1067341...@163.com
|

How to add some children to the abstract syntax tree AST to implement UDF encryption function

2022-09-20 Thread liuyehan
Hi,everyone 


Problem :  How to add some children to the abstract syntax tree AST to 
implement UDF encryption function



I want to implement a function like this, pass SQL as insert into B select ID 
from a -- Run the insert into b select UDF (ID) from A command At present, 
my idea is to implement HiveSemanticAnalyzerHook preAnalyze method, now I add 
child nodes in this way will report an error, see the source code did not find 
the example, so would like to ask you, how to change the AST add child nodes?

ASTNode outerAST = new ASTNode(new CommonToken(hiveParser.tok_function, 
"(TOK_FUNCTION MD5 (tok_table_or_col name))");

Ast. GetChild (0). The getChild (1). The getChild (1). The getChild (0). 
SetChild (0, outerAST);

Thank you.



Best regards,
Liuyehan 

| |
liuyehan
|
|
lyh1067341...@163.com
|

(无主题)

2022-06-21 Thread liuyehan
| |
lyh1067341434
|
|
邮箱:lyh1067341...@163.com
|