Copilot commented on code in PR #68108:
URL: https://github.com/apache/doris/pull/68108#discussion_r4032881888
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/parser/NereidsParser.java:
##########
@@ -364,11 +364,14 @@ public LogicalPlan parseForCreateView(String sql) {
return (LogicalPlan) realLogicalPlanBuilder.visit(tree);
}
+ /** Parse SQL for masking without applying execution hints to the session.
*/
public LogicalPlan parseForEncryption(String sql, Map<Pair<Integer,
Integer>, String> indexInSqlToString) {
CommonTokenStream tokenStream = parseAllTokens(sql);
ParserRuleContext tree = toAst(tokenStream,
DorisParser::singleStatement);
+ // SQL masking must not apply SET_VAR hints to the current session.
+ // The original SQL, including its hints, is preserved by the property
replacements.
LogicalPlanBuilder realLogicalPlanBuilder = new
LogicalPlanBuilderForEncryption(
- getHintMap(sql, tokenStream, DorisParser::selectHint),
indexInSqlToString);
+ ImmutableMap.of(), indexInSqlToString);
Review Comment:
Passing an empty hint map here breaks valid `COPY INTO` statements that
contain an optional `selectHint`: `LogicalPlanBuilder.visitCopyInto` explicitly
throws `AnalysisException("hint should be in right place")` when
`ctx.selectHint()` is present but the map is empty (see
`DorisParser.g4:177-180` and `LogicalPlanBuilder.java:1377-1380`). Audit
redaction will therefore fail instead of returning masked SQL for those
statements. Preserve the parsed hint structure while suppressing only execution
of `SET_VAR` during encryption parsing.
--
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]