[GitHub] [calcite-avatica] stoty commented on a change in pull request #147: CALCITE-4646 Update to Jetty 9.4.42.v20210604
stoty commented on a change in pull request #147: URL: https://github.com/apache/calcite-avatica/pull/147#discussion_r663649732 ## File path: server/src/test/java/org/apache/calcite/avatica/server/BasicAuthHttpServerTest.java ## @@ -44,8 +44,8 @@ private static String url; @BeforeClass public static void startServer() throws Exception { -final String userPropertiesFile = URLDecoder.decode(BasicAuthHttpServerTest.class -.getResource("/auth-users.properties").getFile(), "UTF-8"); +final String userPropertiesFile = (new File(BasicAuthHttpServerTest.class +.getResource("/auth-users.properties").toURI())).getPath(); Review comment: I have copied most of Sources.java and Source.java to Avatica. I've put them in core, but it may also make sense to put them in server or even server/tests. -- 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: commits-unsubscr...@calcite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [calcite] DonnyZone commented on a change in pull request #1792: [CALCITE-3775] Implicit lookup methods in SimpleCalciteSchema ignore case sensitivity parameter
DonnyZone commented on a change in pull request #1792: URL: https://github.com/apache/calcite/pull/1792#discussion_r663638994 ## File path: core/src/main/java/org/apache/calcite/jdbc/SimpleCalciteSchema.java ## @@ -67,33 +69,72 @@ public CalciteSchema add(String name, Schema schema) { return calciteSchema; } + private String caseInsensitiveLookup(Set candidates, String name) { +// Exact string lookup +if (candidates.contains(name)) { + return name; +} +// Upper case string lookup +final String upperCaseName = name.toUpperCase(Locale.ROOT); +if (candidates.contains(upperCaseName)) { + return upperCaseName; +} +// Lower case string lookup +final String lowerCaseName = name.toLowerCase(Locale.ROOT); +if (candidates.contains(lowerCaseName)) { + return lowerCaseName; +} +// Fall through: Set iteration +for (String candidate: candidates) { + if (candidate.equalsIgnoreCase(name)) { +return candidate; + } +} +return null; + } + protected CalciteSchema getImplicitSubSchema(String schemaName, boolean caseSensitive) { // Check implicit schemas. -Schema s = schema.getSubSchema(schemaName); -if (s != null) { - return new SimpleCalciteSchema(this, s, schemaName); +final String schemaName2 = caseSensitive ? schemaName : caseInsensitiveLookup( +schema.getSubSchemaNames(), schemaName); +if (schemaName2 == null) { + return null; } -return null; +final Schema s = schema.getSubSchema(schemaName2); +if (s == null) { + return null; +} +return new SimpleCalciteSchema(this, s, schemaName2); } protected TableEntry getImplicitTable(String tableName, boolean caseSensitive) { // Check implicit tables. -Table table = schema.getTable(tableName); -if (table != null) { - return tableEntry(tableName, table); +final String tableName2 = caseSensitive ? tableName : caseInsensitiveLookup( +schema.getTableNames(), tableName); +if (tableName2 == null) { Review comment: > @DonnyZone Moving discussion here. why open a new PR? what's wrong with this one? There are conflicts now. I will take time to rebase it. -- 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: commits-unsubscr...@calcite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[calcite] branch master updated: [CALCITE-4644] Add PERCENTILE_CONT and PERCENTILE_DISC functions (Rafay)
This is an automated email from the ASF dual-hosted git repository. jhyde pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/calcite.git The following commit(s) were added to refs/heads/master by this push: new 85953ce [CALCITE-4644] Add PERCENTILE_CONT and PERCENTILE_DISC functions (Rafay) 85953ce is described below commit 85953ceb99e07b95129f4934797760a88709fcf6 Author: Rafay AuthorDate: Mon Jun 14 16:53:09 2021 -0700 [CALCITE-4644] Add PERCENTILE_CONT and PERCENTILE_DISC functions (Rafay) In this change, we can parse and validate those functions, but execution will be [CALCITE-4666]. Validation is based on new method SqlAggFunction.isPercentile() (experimental and subject to change without notice). There are connections between the RANGE clause in windowed aggregate functions and interpolation used by PERCENTILE_CONT. Therefore use the same logic to determine whether "x" is a valid type in OVER (ORDER BY x RANGE r)" and "PERCENTILE_CONT(f) WITHIN GROUP (ORER BY x)" Close apache/calcite#2444 --- core/src/main/codegen/templates/Parser.jj | 2 + .../apache/calcite/runtime/CalciteResource.java| 9 +++ .../org/apache/calcite/sql/SqlAggFunction.java | 11 .../main/java/org/apache/calcite/sql/SqlKind.java | 7 +++ .../java/org/apache/calcite/sql/SqlWindow.java | 29 - .../calcite/sql/fun/SqlBasicAggFunction.java | 34 --- .../calcite/sql/fun/SqlStdOperatorTable.java | 30 ++ .../org/apache/calcite/sql/type/OperandTypes.java | 43 ++ .../org/apache/calcite/sql/type/SqlTypeFamily.java | 36 +++ .../calcite/sql/validate/SqlValidatorImpl.java | 27 + .../calcite/runtime/CalciteResource.properties | 3 + .../apache/calcite/sql/test/AbstractSqlTester.java | 5 ++ .../apache/calcite/sql/test/SqlAdvisorTest.java| 2 + .../calcite/sql/test/SqlOperatorBaseTest.java | 32 ++ .../apache/calcite/test/SqlToRelConverterTest.java | 33 +++ .../org/apache/calcite/test/SqlValidatorTest.java | 69 ++ .../apache/calcite/test/SqlToRelConverterTest.xml | 58 ++ site/_docs/reference.md| 15 + 18 files changed, 417 insertions(+), 28 deletions(-) diff --git a/core/src/main/codegen/templates/Parser.jj b/core/src/main/codegen/templates/Parser.jj index bab7a64..dd21035 100644 --- a/core/src/main/codegen/templates/Parser.jj +++ b/core/src/main/codegen/templates/Parser.jj @@ -6933,6 +6933,8 @@ SqlIdentifier ReservedFunctionName() : | | | +| +| | | | diff --git a/core/src/main/java/org/apache/calcite/runtime/CalciteResource.java b/core/src/main/java/org/apache/calcite/runtime/CalciteResource.java index 2cd4657..ec38767 100644 --- a/core/src/main/java/org/apache/calcite/runtime/CalciteResource.java +++ b/core/src/main/java/org/apache/calcite/runtime/CalciteResource.java @@ -472,6 +472,12 @@ public interface CalciteResource { @BaseMessage("Type ''{0}'' is not supported") ExInst typeNotSupported(String a0); + @BaseMessage("Invalid type ''{0}'' in ORDER BY clause of ''{1}'' function. Only NUMERIC types are supported") + ExInst unsupportedTypeInOrderBy(String a0, String a1); + + @BaseMessage("''{0}'' requires precisely one ORDER BY key") + ExInst orderByRequiresOneKey(String a0); + @BaseMessage("DISTINCT/ALL not allowed with {0} function") ExInst functionQuantifierNotAllowed(String a0); @@ -540,6 +546,9 @@ public interface CalciteResource { @BaseMessage("Argument to function ''{0}'' must be a positive integer literal") ExInst argumentMustBePositiveInteger(String a0); + @BaseMessage("Argument to function ''{0}'' must be a numeric literal between {1,number,#} and {2,number,#}") + ExInst argumentMustBeNumericLiteralInRange(String a0, int min, int max); + @BaseMessage("Validation Error: {0}") ExInst validationError(String a0); diff --git a/core/src/main/java/org/apache/calcite/sql/SqlAggFunction.java b/core/src/main/java/org/apache/calcite/sql/SqlAggFunction.java index 9e04e45..208b34b 100644 --- a/core/src/main/java/org/apache/calcite/sql/SqlAggFunction.java +++ b/core/src/main/java/org/apache/calcite/sql/SqlAggFunction.java @@ -16,6 +16,7 @@ */ package org.apache.calcite.sql; +import org.apache.calcite.linq4j.function.Experimental; import org.apache.calcite.plan.Context; import org.apache.calcite.rel.type.RelDataType; import org.apache.calcite.rel.type.RelDataTypeFactory; @@ -215,4 +216,14 @@ public abstract class SqlAggFunction extends SqlFunction implements Context { public @Nullable SqlAggFunction getRollup() { return null; } + + /** Returns whether this aggregate function is a PERCENTILE function. + * Such functions require a {@code WITHIN GROUP} clause that has precisely + * one sort key. + * + * NOTE:
[GitHub] [calcite] julianhyde closed pull request #2444: [CALCITE-4644] Added PERCENTILE_CONT and PERCENTILE_DISC functions in…
julianhyde closed pull request #2444: URL: https://github.com/apache/calcite/pull/2444 -- 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: commits-unsubscr...@calcite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [calcite] AlonEldar89 commented on a change in pull request #1792: [CALCITE-3775] Implicit lookup methods in SimpleCalciteSchema ignore case sensitivity parameter
AlonEldar89 commented on a change in pull request #1792: URL: https://github.com/apache/calcite/pull/1792#discussion_r663474401 ## File path: core/src/main/java/org/apache/calcite/jdbc/SimpleCalciteSchema.java ## @@ -67,33 +69,72 @@ public CalciteSchema add(String name, Schema schema) { return calciteSchema; } + private String caseInsensitiveLookup(Set candidates, String name) { +// Exact string lookup +if (candidates.contains(name)) { + return name; +} +// Upper case string lookup +final String upperCaseName = name.toUpperCase(Locale.ROOT); +if (candidates.contains(upperCaseName)) { + return upperCaseName; +} +// Lower case string lookup +final String lowerCaseName = name.toLowerCase(Locale.ROOT); +if (candidates.contains(lowerCaseName)) { + return lowerCaseName; +} +// Fall through: Set iteration +for (String candidate: candidates) { + if (candidate.equalsIgnoreCase(name)) { +return candidate; + } +} +return null; + } + protected CalciteSchema getImplicitSubSchema(String schemaName, boolean caseSensitive) { // Check implicit schemas. -Schema s = schema.getSubSchema(schemaName); -if (s != null) { - return new SimpleCalciteSchema(this, s, schemaName); +final String schemaName2 = caseSensitive ? schemaName : caseInsensitiveLookup( +schema.getSubSchemaNames(), schemaName); +if (schemaName2 == null) { + return null; } -return null; +final Schema s = schema.getSubSchema(schemaName2); +if (s == null) { + return null; +} +return new SimpleCalciteSchema(this, s, schemaName2); } protected TableEntry getImplicitTable(String tableName, boolean caseSensitive) { // Check implicit tables. -Table table = schema.getTable(tableName); -if (table != null) { - return tableEntry(tableName, table); +final String tableName2 = caseSensitive ? tableName : caseInsensitiveLookup( +schema.getTableNames(), tableName); +if (tableName2 == null) { Review comment: @DonnyZone Moving discussion here. why open a new PR? what's wrong with this one? -- 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: commits-unsubscr...@calcite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org