[GitHub] [calcite] olivrlee commented on a diff in pull request #2973: [CALCITE-5180] Implement some of the overloads for BigQuery's DATE and TIMESTAMP
olivrlee commented on code in PR #2973: URL: https://github.com/apache/calcite/pull/2973#discussion_r1024660113 ## babel/src/main/codegen/includes/parserImpls.ftl: ## @@ -42,6 +42,26 @@ SqlNode DateFunctionCall() : } } +SqlNode TimestampFunctionCall() : Review Comment: Can you explain a bit (to me, not needing comments on the file )on the whole purpose of the `/babel` directory? What I'm understanding here is that its used to be able to parse new SQL statements coming in, the `date` function existed already above this block so it doesn't need to be added -- 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] olivrlee commented on a diff in pull request #2973: [CALCITE-5180] Implement some of the overloads for BigQuery's DATE and TIMESTAMP
olivrlee commented on code in PR #2973: URL: https://github.com/apache/calcite/pull/2973#discussion_r1024660113 ## babel/src/main/codegen/includes/parserImpls.ftl: ## @@ -42,6 +42,26 @@ SqlNode DateFunctionCall() : } } +SqlNode TimestampFunctionCall() : Review Comment: Can you explain a bit on the whole purpose of the `/babel` directory? What I'm understanding here is that its used to be able to parse new SQL statements coming in, the `date` function existed already above this block so it doesn't need to be added -- 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] wnob opened a new pull request, #2973: [CALCITE-5180] Implement some of the overloads for BigQuery's DATE and TIMESTAMP
wnob opened a new pull request, #2973: URL: https://github.com/apache/calcite/pull/2973 There is an existing implementation for a BQ `DATE` function but it wrongly thinks this is simply a typecast. See documentation [here][1]. This PR implements 2 of the 4 possible overloads for `DATE` (considering the optional time zone in the second form) as well as 1 of the possible overloads for `TIMESTAMP`, and was able to get a quidem test to pass utilizing both functions. I intend to implement the rest of the overloads in a follow-up commit but was hoping for some feedback now and thought this was a decent-sized commit to review at once. [1]: https://cloud.google.com/bigquery/docs/reference/standard-sql/date_functions#date -- 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] k-jamroz commented on pull request #2878: [CALCITE-5241] Implement CHAR function
k-jamroz commented on PR #2878: URL: https://github.com/apache/calcite/pull/2878#issuecomment-1317373320 Interesting changes in 1.32.0: * https://issues.apache.org/jira/browse/CALCITE-5241 - `CHAR` is now a reserved function name. I am not sure if this may impact parsing. Maybe we want to implement this function? * https://issues.apache.org/jira/browse/CALCITE-5232 (Upgrade protobuf-java from 3.17.1 to 3.21.5) - we currently have 3.21.9, so should be fine * https://issues.apache.org/jira/browse/CALCITE-5178 - we currently do not support scalar queries, should not impact us -- 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] 01/01: [CALCITE-5105] Add MEASURE type and AGGREGATE aggregate function
This is an automated email from the ASF dual-hosted git repository. jhyde pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/calcite.git commit 406c913b808b3234464d8c81d7352c4040dd281a Author: Julian Hyde AuthorDate: Mon Oct 25 17:06:56 2021 -0700 [CALCITE-5105] Add MEASURE type and AGGREGATE aggregate function The MEASURE type is internal. A RexNode expression that contains a measure and evaluates to an INTEGER will have the type MEASURE, using a parameterized SQL type similar to ARRAY. But the same measure column, as seen from SQL, will just have type INTEGER. The parameterized type helps us keep things straight in the relational algebra as we apply planner rules. The AGGREGATE function belongs to the new CALCITE function library. To use it, add 'lib=calcite' to your connect string. Add a new validator configuration parameter, `boolean SqlValidator.Config.nakedMeasures()`. The query SELECT deptno, AGGREGATE(avg_sal) FROM emp GROUP BY deptno is valid if `avg_sal` is a measure. If `nakedMeasures` is true, then the following query is a valid shorthand for it: SELECT deptno, avg_sal FROM emp GROUP BY deptno In the long term, we would like people to feel comfortable using the latter form. Measures are not necessarily aggregate functions, but are just expressions whose value depends on their context (the current GROUP BY key in an aggregate query, or the current row in a regular query). And we will generalize measures to analytic expressions, which are not necessarily just references to measure columns. But in the short term, setting the `nakedMeasures` flag to false provides a level of comfort to people (and tools that generate SQL) who think of measures as aggregate functions, and think that measures should only be used in `GROUP BY` queries. Extend mock catalog with a table that has measure columns. Add a new Quidem test, measure.iq. It is disabled because we don't yet have the means to create measure columns in queries (or views). That is to come in [CALCITE-4496]. Close apache/calcite#2965 --- .../apache/calcite/rel/hint/HintStrategyTable.java | 13 .../calcite/rel/type/RelDataTypeFactory.java | 8 ++ .../apache/calcite/runtime/CalciteResource.java| 9 +++ .../main/java/org/apache/calcite/sql/SqlKind.java | 3 + .../main/java/org/apache/calcite/sql/SqlNode.java | 7 +- .../java/org/apache/calcite/sql/SqlNodeList.java | 26 ++- .../org/apache/calcite/sql/SqlRowTypeNameSpec.java | 15 +--- .../main/java/org/apache/calcite/sql/SqlUtil.java | 13 .../org/apache/calcite/sql/fun/SqlLibrary.java | 2 + .../calcite/sql/fun/SqlLibraryOperators.java | 12 +++ .../org/apache/calcite/sql/type/ApplySqlType.java | 56 ++ .../apache/calcite/sql/type/MeasureSqlType.java| 40 ++ .../org/apache/calcite/sql/type/OperandTypes.java | 26 +++ .../calcite/sql/type/SqlTypeFactoryImpl.java | 5 ++ .../org/apache/calcite/sql/type/SqlTypeName.java | 1 + .../apache/calcite/sql/type/SqlTypeTransforms.java | 12 +++ .../org/apache/calcite/sql/util/SqlVisitor.java| 5 ++ .../apache/calcite/sql/validate/AggChecker.java| 38 +++-- .../sql/validate/AggregatingSelectScope.java | 50 ++-- .../calcite/sql/validate/DelegatingScope.java | 21 - .../apache/calcite/sql/validate/SqlValidator.java | 10 +++ .../calcite/sql/validate/SqlValidatorImpl.java | 10 +++ .../calcite/sql/validate/SqlValidatorScope.java| 22 ++ .../calcite/sql/validate/SqlValidatorUtil.java | 19 - .../main/java/org/apache/calcite/util/Litmus.java | 53 +++-- .../calcite/runtime/CalciteResource.properties | 3 + .../apache/calcite/test/SqlToRelConverterTest.java | 18 + .../org/apache/calcite/test/SqlValidatorTest.java | 90 ++ .../apache/calcite/test/SqlToRelConverterTest.xml | 14 core/src/test/resources/sql/measure.iq | 44 +++ site/_docs/reference.md| 8 ++ .../org/apache/calcite/test/SqlToRelTestBase.java | 2 +- .../test/catalog/MockCatalogReaderExtended.java| 19 - 33 files changed, 568 insertions(+), 106 deletions(-) diff --git a/core/src/main/java/org/apache/calcite/rel/hint/HintStrategyTable.java b/core/src/main/java/org/apache/calcite/rel/hint/HintStrategyTable.java index 3c91690386..f2ec1a1163 100644 --- a/core/src/main/java/org/apache/calcite/rel/hint/HintStrategyTable.java +++ b/core/src/main/java/org/apache/calcite/rel/hint/HintStrategyTable.java @@ -233,18 +233,5 @@ public class HintStrategyTable { LOGGER.warn(requireNonNull(message, "message"), args); return false; } - -@Override public boolean succeed() { - return true; -} - -@Over
[calcite] branch main updated (a0ce327511 -> 406c913b80)
This is an automated email from the ASF dual-hosted git repository. jhyde pushed a change to branch main in repository https://gitbox.apache.org/repos/asf/calcite.git from a0ce327511 [CALCITE-5310] JSON_OBJECT in scalar sub-query throws AssertionError add c40aa4ce7e Quidem: Allow CREATE VIEW in 'scott' connection new 406c913b80 [CALCITE-5105] Add MEASURE type and AGGREGATE aggregate function The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../apache/calcite/rel/hint/HintStrategyTable.java | 13 .../calcite/rel/type/RelDataTypeFactory.java | 8 ++ .../apache/calcite/runtime/CalciteResource.java| 9 +++ .../main/java/org/apache/calcite/sql/SqlKind.java | 3 + .../main/java/org/apache/calcite/sql/SqlNode.java | 7 +- .../java/org/apache/calcite/sql/SqlNodeList.java | 26 ++- .../org/apache/calcite/sql/SqlRowTypeNameSpec.java | 15 +--- .../main/java/org/apache/calcite/sql/SqlUtil.java | 13 .../org/apache/calcite/sql/fun/SqlLibrary.java | 2 + .../calcite/sql/fun/SqlLibraryOperators.java | 12 +++ ...OperandTypeInference.java => ApplySqlType.java} | 45 +++ ...SqlOperandMetadata.java => MeasureSqlType.java} | 29 --- .../org/apache/calcite/sql/type/OperandTypes.java | 26 +++ .../calcite/sql/type/SqlTypeFactoryImpl.java | 5 ++ .../org/apache/calcite/sql/type/SqlTypeName.java | 1 + .../apache/calcite/sql/type/SqlTypeTransforms.java | 12 +++ .../org/apache/calcite/sql/util/SqlVisitor.java| 5 ++ .../apache/calcite/sql/validate/AggChecker.java| 38 +++-- .../sql/validate/AggregatingSelectScope.java | 50 ++-- .../calcite/sql/validate/DelegatingScope.java | 21 - .../apache/calcite/sql/validate/SqlValidator.java | 10 +++ .../calcite/sql/validate/SqlValidatorImpl.java | 10 +++ .../calcite/sql/validate/SqlValidatorScope.java| 22 ++ .../calcite/sql/validate/SqlValidatorUtil.java | 19 - .../main/java/org/apache/calcite/util/Litmus.java | 53 +++-- .../calcite/runtime/CalciteResource.properties | 3 + core/src/test/codegen/config.fmpp | 2 + core/src/test/codegen/includes/parserImpls.ftl | 15 .../parserextensiontesting/SqlCreateTable.java | 8 +- .../org/apache/calcite/test/CoreQuidemTest.java| 8 +- .../apache/calcite/test/ExtensionDdlExecutor.java | 80 ++- .../apache/calcite/test/SqlToRelConverterTest.java | 18 + .../org/apache/calcite/test/SqlValidatorTest.java | 90 ++ .../apache/calcite/test/SqlToRelConverterTest.xml | 14 .../src/test/resources/sql/measure.iq | 31 ++-- core/src/test/resources/sql/misc.iq| 18 + .../apache/calcite/server/ServerDdlExecutor.java | 5 +- site/_docs/reference.md| 8 ++ .../org/apache/calcite/test/SqlToRelTestBase.java | 2 +- .../test/catalog/MockCatalogReaderExtended.java| 19 - 40 files changed, 625 insertions(+), 150 deletions(-) copy core/src/main/java/org/apache/calcite/sql/type/{SqlOperandTypeInference.java => ApplySqlType.java} (51%) copy core/src/main/java/org/apache/calcite/sql/type/{SqlOperandMetadata.java => MeasureSqlType.java} (58%) copy babel/src/test/resources/sql/dummy.iq => core/src/test/resources/sql/measure.iq (65%) mode change 100755 => 100644
[GitHub] [calcite] julianhyde closed pull request #2965: [CALCITE-5105] Add MEASURE type and AGGREGATE aggregate function
julianhyde closed pull request #2965: [CALCITE-5105] Add MEASURE type and AGGREGATE aggregate function URL: https://github.com/apache/calcite/pull/2965 -- 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