Gustavo de Morais created FLINK-41109:
-----------------------------------------
Summary: Add guidelines for embedding user input in generated code
to the planner's AGENTS.md
Key: FLINK-41109
URL: https://issues.apache.org/jira/browse/FLINK-41109
Project: Flink
Issue Type: Improvement
Components: Table SQL / Planner
Reporter: Gustavo de Morais
Assignee: Gustavo de Morais
The planner embeds values that come from the query into Java source that is
compiled with Janino. A value that is not escaped correctly breaks out of the
string literal and changes the generated code, as fixed in FLINK-39355 and
FLINK-39360. The escaping rules are spread across helpers and not written down,
so new code generation, including AI-assisted contributions, can easily repeat
this mistake.
We should add a short section to {{flink-table-planner/AGENTS.md}} that covers
passing values via {{addReusableObject}}, escaping string literals with
{{EncodingUtils.escapeJava}}, the contexts where escaping is not enough (char
literals, identifiers, comments), the raw {{GeneratedExpression.literalValue}},
and how to test for it.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)