AMashenkov commented on code in PR #5603: URL: https://github.com/apache/ignite-3/pull/5603#discussion_r2041955775
########## modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/sql/ParserServiceImplTest.java: ########## @@ -142,7 +143,52 @@ void parseMultiStatementQuery() { assertThat(parsedTree, notNullValue()); assertThat(parsedTree.toString(), equalTo(singleStatementResult.parsedTree().toString())); assertThat(result.normalizedQuery(), equalTo(singleStatementResult.normalizedQuery())); - assertThat(result.originalQuery(), equalTo(singleStatementResult.normalizedQuery())); + assertThat(result.originalQuery(), containsString(singleStatementResult.originalQuery())); + } + } + + @Test + void originalQueryMatchesTheWayItIsSpecifiedInScript() { + ParserService service = new ParserServiceImpl(); + + @SuppressWarnings("ConcatenationWithEmptyString") + String script = "" + + "-- simple comment before first statement \n" + + "seLECT * FROM Table_1; -- simple comment after first\n" + + "/* multiline\n" + + "comment\n" + + "before second */ \n" + + "select /*+ USE_INDEX(table_2_idx)*/ Table_2.* \n" + + " FROM table_2; /* multiline\n" + + "comment" + + "after second */"; + + List<ParsedResult> results = service.parseScript(script); + + for (ParsedResult result : results) { + assertThat( + script, + containsString(result.originalQuery()) + ); + } Review Comment: Let's check all strings are valid and we don't see partial comments after semicolon like` FROM table_2;/*` Or better add a test for this case. -- 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: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org