This repository has been archived by the owner on Aug 2, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve query verification by adding semantic analyzer (#201)
* Generate new parser by ANTLR * Integrate ANTLR parser to existing code * Fix string similarity and add visitor generated * Use visitor to change default visiting order * Add function arg type check * Add compatibility check for basic operator * Refactor inner classes to different upper class and subpackage * Change default MySQL grammar file for our case * Change default MySQL grammar file for our case * Change default MySQL grammar file for our case * Remove ANTLR plugin dependencies from runtime * Initial commit for syntax analysis by new ANTLR parser * Add missing function to grammar for unit test * Add support for index name with - or /type * Add more ES special functions to pass the unit test * Add more ES special syntax to pass IT * Add more syntax for MINUS to pass all IT * Fix checkstyle violation * Remove unsupported statements * Remove SELECT INTO * Remove more unused syntax * Remove unused function * Remove unused tokens * Remove unused tokens * Remove unused interval and charset syntax * Remove unused interval and charset syntax * Remove more unused syntax * Add setting for enabling new parser * Improve offending symbol location * Improve offending symbol location * Update 3rd party attribution with ANTLR * Add supported functions missing in existing test code * Add integration test * Change grammar for new merged code from master * Add integration test * Add more test cases * Add more test cases, enable/disable setting * Add more test cases * Add more test cases * Simplify exception for now * Add test mapping and cases for semantic check * Initial adding of semantic analyzer * Move generated source back to build folder * Rename analyze method and assert error message * Fix typo * Intial commit for semantic analysis copied from prototype * Intial commit for semantic analysis copied from prototype * Define all field names with index alias when visiting index * Define all field names with index alias when visiting index * Add support for nested field * Add support for deep nested field * Add more test cases for alias * Split test cases and organize into suite to avoid mapping reload * Simple test cases for identifier with suggestion * Add more test cases for identifier * Add IT for semantic check * Add IT for semantic check * Add more IT for semantic check * Add unit test for scalar function * Move inner mappings class to upper level * Move flat method to FieldMapping class * Add test cases for FieldMapping flat method * Add and pass basic test cases for scalar function * Add and pass basic test cases for scalar function * Fix function call visit issue * Fix function call visit issue * Add generic type to type system * Add unit test for generic type * Fix generic type bug in type system * Fix generic type usage() and add all basic functions to type system * Add IT for all math functions and constants * Add more IT for string function and failed cases * Add more IT for string function and failed cases * Add more IT for date_format and other functions * Add more IT for date_format * Introduce ES special functions into type system * Introduce ES special functions into type system * Fix real number visit issue * Add more test cases for text search functions * Support overloaded specification for type expression * Add unit test for type expression interface * Bypass scope checking for ES hidden fields * Fix alias is optional issue and skip naming conflict check for now * Add overloaded spec for functions * Add basic test cases for aggregate function * Add basic test cases for aggregate function * Add more test cases for aggregate function * Resolve symbol by prefix on all levels * Extract semantic context class to manage environment * Add UT for semantic context * Add UT for environment * Add UT for semantic analyzer * Add UT for semantic analyzer * Add isEmpty for context and overloaded data_format * Add substring * Add support for alias in select item * Add more UT for select item alias * Add UT for unknown data type * Add UT for subquery * Add UT for function composition * Fix IT * Fix all broken ITs * Fix all broken ITs * Fix all broken ITs * Fix check style * Add more Javadoc and move LocalClusterState to context class * Add more Javadoc and dev doc * Add more IT * Add more IT * Add IT for visitor and return result of select clause * Support operator type check and fix compatible base type relations * Add more UT for operator test * Fix broken ITs * Fix broken ITs by checking named argument * Operator implements type instead of type expression * Add IT for operator type check * Add img for dev doc * Pass all unit tests * Fix imports * Add more IT * Rename syntax exception * Add support for multi query type check * Add support for minus and refactor reduce method in visitor * Add more test cases for multi query * Add more test cases * Refactor types package into sub packages * Add support for subquery type check * Add more test cases for subquery * Disable field name auto suggestion for security concern * Add more tests for aggreagtion on nested field * Separate context intialization to a new visitor * Refactor semantic analyzer into 2 separator visitors * Address PR comments and finish dev doc * Add analysis config * Add UT and IT for analyzer config * Remove to-dos * Refactor string similarity class with UT * Move some test cases to proper place * Final code review
- Loading branch information