tanclary commented on code in PR #3128:
URL: https://github.com/apache/calcite/pull/3128#discussion_r1146504287
##########
core/src/main/java/org/apache/calcite/sql/fun/SqlLibrary.java:
##########
@@ -68,7 +69,9 @@ public enum SqlLibrary {
POSTGRESQL("p", "postgresql"),
/** A collection of operators that are in Apache Spark but not in standard
* SQL. */
- SPARK("s", "spark");
+ SPARK("s", "spark"),
+ /** A collection of operators that could be used in all libraries except
STANDARD and SPATIAL. */
+ ALL("*", "all");
Review Comment:
Should this be alphabetical?
##########
site/_docs/reference.md:
##########
@@ -2648,7 +2648,7 @@ BigQuery's type system uses confusingly different names
for types and functions:
| b | ARRAY_REVERSE(array) | Reverses elements of
*array*
| m s | CHAR(integer) | Returns the character
whose ASCII code is *integer* % 256, or null if *integer* < 0
| o p | CHR(integer) | Returns the character
whose UTF-8 code is *integer*
-| b o | COSH(numeric) | Returns the hyperbolic
cosine of *numeric*
+| * | COSH(numeric) | Returns the hyperbolic
cosine of *numeric*
Review Comment:
I think it could be useful to have a line in reference.md that tells readers
that * = all libraries.
##########
core/src/main/java/org/apache/calcite/sql/fun/SqlLibrary.java:
##########
@@ -94,11 +97,21 @@ public enum SqlLibrary {
/** Parses a comma-separated string such as "standard,oracle". */
public static List<SqlLibrary> parse(String libraryNameList) {
final ImmutableList.Builder<SqlLibrary> list = ImmutableList.builder();
- for (String libraryName : libraryNameList.split(",")) {
- SqlLibrary library =
- requireNonNull(SqlLibrary.of(libraryName),
- () -> "library does not exist: " + libraryName);
- list.add(library);
+ List<String> libList = Arrays.asList(libraryNameList.split(","));
+ if (libList.contains(ALL.abbrev) || libList.contains(ALL.fun)) {
+ // Add all the libraries except ALL, STANDARD, SPATIAL for 'all' and '*'.
+ for (SqlLibrary value : values()) {
+ if (value != ALL && value != STANDARD && value != SPATIAL) {
+ list.add(value);
+ }
+ }
+ } else {
+ for (String libraryName : libraryNameList.split(",")) {
Review Comment:
Why can't you reuse libList here?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]