mirror of https://github.com/apache/nifi.git
NIFI-4051: Ensure that we use the appropriate Lexical syntax for SQL query validation as we do when running
Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com> This closes #2054.
This commit is contained in:
parent
40cde0466a
commit
969bbe654c
|
@ -46,6 +46,7 @@ import org.apache.calcite.config.Lex;
|
|||
import org.apache.calcite.jdbc.CalciteConnection;
|
||||
import org.apache.calcite.schema.SchemaPlus;
|
||||
import org.apache.calcite.sql.parser.SqlParser;
|
||||
import org.apache.calcite.sql.parser.SqlParser.Config;
|
||||
import org.apache.nifi.annotation.behavior.DynamicProperty;
|
||||
import org.apache.nifi.annotation.behavior.DynamicRelationship;
|
||||
import org.apache.nifi.annotation.behavior.EventDriven;
|
||||
|
@ -546,7 +547,12 @@ public class QueryRecord extends AbstractProcessor {
|
|||
}
|
||||
|
||||
final String substituted = context.newPropertyValue(input).evaluateAttributeExpressions().getValue();
|
||||
final SqlParser parser = SqlParser.create(substituted);
|
||||
|
||||
final Config config = SqlParser.configBuilder()
|
||||
.setLex(Lex.MYSQL_ANSI)
|
||||
.build();
|
||||
|
||||
final SqlParser parser = SqlParser.create(substituted, config);
|
||||
try {
|
||||
parser.parseStmt();
|
||||
return new ValidationResult.Builder()
|
||||
|
|
Loading…
Reference in New Issue