-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug: Improved error message for reserved keywords (#6166)
* adds support for 0x, X'', x'' type hex in udf:encode * added one line of comment * added some more tests for odd length hex and corrupted hex * remove input.json from pr * changed error message * added tests for non-reserved keywords * added tests for non-reserved keywords 2 * added tests for non-reserved keywords 3 * removed files from commit * undeleted files' ' * added comments * added comments 2 * added comments 3 * fix: changed the error message * removed hardcoding of keywords and added tests * refactored code * not a good time to mess up git * cleaned up imports * cleaning up * cleaned up imports more * changed javadoc for ParserKeywordValidatorUtil.java * removed useless import * changed comment to contrapositive in ParserUtil.java * added better error message * should build * should build1
- Loading branch information
Showing
7 changed files
with
168 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
ksqldb-parser/src/test/java/io/confluent/ksql/util/ParserUtilTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package io.confluent.ksql.util; | ||
|
||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
public class ParserUtilTest { | ||
|
||
@Test | ||
public void shouldBeReserved() { | ||
// Given: | ||
final String[] keywords = new String[]{ | ||
"size", // reserved word | ||
"load", // reserved word | ||
"SIZE", //upper case | ||
"Load" //case insensitive | ||
}; | ||
|
||
// Then: | ||
for (final String keyword : keywords) { | ||
assertEquals(true, ParserUtil.isReserved(keyword)); | ||
} | ||
} | ||
|
||
@Test | ||
public void shouldNotBeReserved() { | ||
// Given: | ||
final String[] keywords = new String[]{ | ||
"source", // non-reserved keyword | ||
"sink", // non-reserved keyword | ||
"MAP", //upper case | ||
"Array", //case insensitive | ||
"ASSERT", | ||
"foo", | ||
"bAR" | ||
}; | ||
|
||
// Then: | ||
for (final String keyword : keywords) { | ||
assertEquals(false, ParserUtil.isReserved(keyword)); | ||
} | ||
} | ||
} |