forked from apache/calcite
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CALCITE-6024] A more efficient implementation of SqlOperatorTable, b…
…acked by an immutable multi-map keyed by upper-case operator name ReflectiveSqlOperatorTable and ListSqlOperatorTable now have a common base class, the new class SqlOperatorTables.IndexedSqlOperatorTable, which stores operators in a multi-map keyed by their upper-case name. Because it is a multi-map it is OK if there are several operators with the same name, same name an different syntax, or the same name with different case. The map is efficient because there are unlikely to be very many such operators. The multi-map is immutable. You can still add an operator to a ListSqlOperatorTable, but it will rebuild the whole multi-map, then assign the new map to the field, and so is not very efficient. The 'register(SqlOperator)' method is now deprecated, to remind people that tables are better created in entirety, rather than incrementally. Previously there were two maps, whose keys were case-sensitive and case-insensitive names; the keys also inclued the syntax of the operator. Now the syntax is filtered on retrieval, which makes sense because the syntax of the call to an operator does not precisely match the syntax of the operator (e.g. I can call CURRENT_TIMESTAMP with no parentheses, with empty parentheses, or with parentheses containing precision). Different subclasses have slightly different policies for matching syntax. Singleton instances of SqlStdOperatorTable and OracleSqlOperatorTable are now held in a memoizing supplier, which is simpler than the prefious two-phase initialization. Close apache#3483
- Loading branch information
1 parent
b11f179
commit 7b9660f
Showing
6 changed files
with
149 additions
and
140 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
Oops, something went wrong.