File tree Expand file tree Collapse file tree 1 file changed +4
-8
lines changed
pinot-common/src/main/java/org/apache/pinot/sql/parsers Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -106,17 +106,13 @@ private CalciteSqlParser() {
106106 private static String removeTerminatingSemicolon (String sql ) {
107107 // trim all the leading and trailing whitespaces
108108 sql = sql .trim ();
109-
110- // Check if the query has semicolon
111- int semiColonIndex = sql .lastIndexOf (';' );
112109 int sqlLength = sql .length ();
113- boolean stripSemiColon = semiColonIndex >= 0 ;
114110
115- // check if semicolons is followed by whitespaces, only then it needs to be terminated
116- for ( int i = semiColonIndex + 1 ; i < sqlLength && stripSemiColon ; i ++ ) {
117- stripSemiColon = Character . isWhitespace ( sql .charAt ( i ) );
111+ // Terminate the semicolon only if the last character of the query is semicolon
112+ if ( sql . charAt ( sqlLength - 1 ) == ';' ) {
113+ return sql .substring ( 0 , sqlLength - 1 );
118114 }
119- return stripSemiColon ? sql . substring ( 0 , semiColonIndex ) : sql ;
115+ return sql ;
120116 }
121117
122118 public static PinotQuery compileToPinotQuery (String sql )
You can’t perform that action at this time.
0 commit comments