[GitHub] [calcite] chunweilei commented on pull request #2030: [CALCITE-4098] Remove redundant code in "RelJson.toJson(RelDistribution)".

2020-06-30 Thread GitBox


chunweilei commented on pull request #2030:
URL: https://github.com/apache/calcite/pull/2030#issuecomment-652159186


   Please refer the doc[1] about the format of commit message.
   
   [1]https://calcite.apache.org/develop/#contributing



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [calcite] chunweilei commented on a change in pull request #2030: [CALCITE-4098] Remove redundant code in "RelJson.toJson(RelDistribution)".

2020-06-30 Thread GitBox


chunweilei commented on a change in pull request #2030:
URL: https://github.com/apache/calcite/pull/2030#discussion_r448088033



##
File path: core/src/test/java/org/apache/calcite/plan/RelWriterTest.java
##
@@ -385,6 +385,34 @@
   + "  ]\n"
   + "}";
 
+  public static final String XX4 = "{\n"
+  + "  \"rels\": [\n"
+  + "{\n"
+  + "  \"id\": \"0\",\n"

Review comment:
   Please use a more readable name.





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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [calcite] yanlin-Lynn commented on pull request #2030: [CALCITE-4098] Remove redundant code in "RelJson.toJson(RelDistribution)".

2020-06-30 Thread GitBox


yanlin-Lynn commented on pull request #2030:
URL: https://github.com/apache/calcite/pull/2030#issuecomment-652156774


   make sense, +1



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [calcite] danny0405 commented on a change in pull request #2019: [CALCITE-4059] SqlTypeUtil#equalSansNullability consider Array/Map type.

2020-06-30 Thread GitBox


danny0405 commented on a change in pull request #2019:
URL: https://github.com/apache/calcite/pull/2019#discussion_r448083189



##
File path: core/src/test/java/org/apache/calcite/sql/type/SqlTypeUtilTest.java
##
@@ -117,6 +120,45 @@
 SqlTypeCoercionRule.THREAD_PROVIDERS.set(defaultRules);
   }
 
+  @Test void testEqualAsCollectionSansNullability() {
+final SqlTypeFactoryImpl factory =
+new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT);
+

Review comment:
   I would prefer add the types to `SqlTypeFixture` and give it a good name.





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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [calcite] danny0405 closed pull request #2025: [CALCITE-4033] Does not produce parenthesized table expressions for U…

2020-06-30 Thread GitBox


danny0405 closed pull request #2025:
URL: https://github.com/apache/calcite/pull/2025


   



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[calcite] branch master updated: [CALCITE-4033] Does not produce parenthesized table expressions for UNNEST (Rui Wang)

2020-06-30 Thread danny0405
This is an automated email from the ASF dual-hosted git repository.

danny0405 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 2d6e57f  [CALCITE-4033] Does not produce parenthesized table 
expressions for UNNEST (Rui Wang)
2d6e57f is described below

commit 2d6e57f00e6ade5ef534bb4404184a44c2f149f8
Author: amaliujia 
AuthorDate: Sat Jun 13 12:07:06 2020 -0700

[CALCITE-4033] Does not produce parenthesized table expressions for UNNEST 
(Rui Wang)

Before this change, Calcite parser produces "(UNEST(...))". However, 
Calcite parser fails to parse UNNEST as parenthesized table expressions: "JOIN 
(SELECT * FROM ^(UNNEST(...))^)". This change stops produces parenthesized 
table expressions for UNNEST to fix this problem.

close apache/calcite#2025
---
 .../main/java/org/apache/calcite/sql/SqlKind.java  |  3 ++-
 .../apache/calcite/sql/parser/SqlParserTest.java   | 29 +-
 2 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/core/src/main/java/org/apache/calcite/sql/SqlKind.java 
b/core/src/main/java/org/apache/calcite/sql/SqlKind.java
index f98a0c2..f1cfb08 100644
--- a/core/src/main/java/org/apache/calcite/sql/SqlKind.java
+++ b/core/src/main/java/org/apache/calcite/sql/SqlKind.java
@@ -1240,6 +1240,7 @@ public enum SqlKind {
* {@link #ORDER_BY},
* {@link #COLLECTION_TABLE},
* {@link #TABLESAMPLE},
+   * {@link #UNNEST}
* or an aggregate function, DML or DDL.
*/
   public static final Set EXPRESSION =
@@ -1254,7 +1255,7 @@ public enum SqlKind {
   LITERAL_CHAIN, JDBC_FN, PRECEDING, FOLLOWING, ORDER_BY,
   NULLS_FIRST, NULLS_LAST, COLLECTION_TABLE, TABLESAMPLE,
   VALUES, WITH, WITH_ITEM, ITEM, SKIP_TO_FIRST, SKIP_TO_LAST,
-  JSON_VALUE_EXPRESSION),
+  JSON_VALUE_EXPRESSION, UNNEST),
   AGGREGATE, DML, DDL));
 
   /**
diff --git 
a/core/src/test/java/org/apache/calcite/sql/parser/SqlParserTest.java 
b/core/src/test/java/org/apache/calcite/sql/parser/SqlParserTest.java
index e5d3cec..19cd942 100644
--- a/core/src/test/java/org/apache/calcite/sql/parser/SqlParserTest.java
+++ b/core/src/test/java/org/apache/calcite/sql/parser/SqlParserTest.java
@@ -7155,10 +7155,10 @@ public class SqlParserTest {
   @Test void testUnnest() {
 sql("select*from unnest(x)")
 .ok("SELECT *\n"
-+ "FROM (UNNEST(`X`))");
++ "FROM UNNEST(`X`)");
 sql("select*from unnest(x) AS T")
 .ok("SELECT *\n"
-+ "FROM (UNNEST(`X`)) AS `T`");
++ "FROM UNNEST(`X`) AS `T`");
 
 // UNNEST cannot be first word in query
 sql("^unnest^(x)")
@@ -7169,24 +7169,41 @@ public class SqlParserTest {
 + "unnest(dept.employees, dept.managers)";
 final String expected = "SELECT *\n"
 + "FROM `DEPT`,\n"
-+ "(UNNEST(`DEPT`.`EMPLOYEES`, `DEPT`.`MANAGERS`))";
++ "UNNEST(`DEPT`.`EMPLOYEES`, `DEPT`.`MANAGERS`)";
 sql(sql).ok(expected);
 
 // LATERAL UNNEST is not valid
 sql("select * from dept, lateral ^unnest^(dept.employees)")
 .fails("(?s)Encountered \"unnest\" at .*");
+
+// Does not generate extra parentheses around UNNEST because UNNEST is
+// a table expression.
+final String sql1 = ""
++ "SELECT\n"
++ "  item.name,\n"
++ "  relations.*\n"
++ "FROM dfs.tmp item\n"
++ "JOIN (\n"
++ "  SELECT * FROM UNNEST(item.related) i(rels)\n"
++ ") relations\n"
++ "ON TRUE";
+final String expected1 = "SELECT `ITEM`.`NAME`, `RELATIONS`.*\n"
++ "FROM `DFS`.`TMP` AS `ITEM`\n"
++ "INNER JOIN (SELECT *\n"
++ "FROM UNNEST(`ITEM`.`RELATED`) AS `I` (`RELS`)) AS `RELATIONS` ON 
TRUE";
+sql(sql1).ok(expected1);
   }
 
   @Test void testUnnestWithOrdinality() {
 sql("select * from unnest(x) with ordinality")
 .ok("SELECT *\n"
-+ "FROM (UNNEST(`X`) WITH ORDINALITY)");
++ "FROM UNNEST(`X`) WITH ORDINALITY");
 sql("select*from unnest(x) with ordinality AS T")
 .ok("SELECT *\n"
-+ "FROM (UNNEST(`X`) WITH ORDINALITY) AS `T`");
++ "FROM UNNEST(`X`) WITH ORDINALITY AS `T`");
 sql("select*from unnest(x) with ordinality AS T(c, o)")
 .ok("SELECT *\n"
-+ "FROM (UNNEST(`X`) WITH ORDINALITY) AS `T` (`C`, `O`)");
++ "FROM UNNEST(`X`) WITH ORDINALITY AS `T` (`C`, `O`)");
 sql("select*from unnest(x) as T ^with^ ordinality")
 .fails("(?s)Encountered \"with\" at .*");
   }



[GitHub] [calcite] Aaaaaaron commented on pull request #2030: minor, remove redundant code in "RelJson.toJson(RelDistribution)".

2020-06-30 Thread GitBox


Aaron commented on pull request #2030:
URL: https://github.com/apache/calcite/pull/2030#issuecomment-652148774


   > you are changing the code, worth a jira for this PR.
   
   Thanks for your advice



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [calcite] Aaaaaaron commented on a change in pull request #2019: [CALCITE-4059] SqlTypeUtil#equalSansNullability consider Array/Map type.

2020-06-30 Thread GitBox


Aaron commented on a change in pull request #2019:
URL: https://github.com/apache/calcite/pull/2019#discussion_r448079966



##
File path: core/src/test/java/org/apache/calcite/sql/type/SqlTypeUtilTest.java
##
@@ -117,6 +120,45 @@
 SqlTypeCoercionRule.THREAD_PROVIDERS.set(defaultRules);
   }
 
+  @Test void testEqualAsCollectionSansNullability() {
+final SqlTypeFactoryImpl factory =
+new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT);
+

Review comment:
   The basic type is replaced, but nested type in SqlTypeFixture does not 
meet the requirements(map type/nullability), should I add these to 
SqlTypeFixture? Or just leave them in this ut.





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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [calcite] XuQianJin-Stars commented on pull request #1996: [CALCITE-4034] Implement a MySQL InnoDB adapter

2020-06-30 Thread GitBox


XuQianJin-Stars commented on pull request #1996:
URL: https://github.com/apache/calcite/pull/1996#issuecomment-652136500


   hi @neoremind What is the production usage scenario of this MySQL InnoDB 
Java Reader?



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [calcite] XuQianJin-Stars commented on a change in pull request #1996: [CALCITE-4034] Implement a MySQL InnoDB adapter

2020-06-30 Thread GitBox


XuQianJin-Stars commented on a change in pull request #1996:
URL: https://github.com/apache/calcite/pull/1996#discussion_r447719202



##
File path: innodb/src/main/java/org/apache/calcite/adapter/innodb/QueryType.java
##
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.calcite.adapter.innodb;
+
+/**
+ * Query type of a push down condition in InnoDB data source.
+ */
+public enum QueryType {
+  /** Primary key point query. */
+  PK_POINT_QUERY(0),
+  /** Secondary key point query. */
+  SK_POINT_QUERY(1),
+  /** Primary key range query with lower and upper bound. */
+  PK_RANGE_QUERY(2),
+  /** Secondary key range query with lower and upper bound. */
+  SK_RANGE_QUERY(3),
+  /** Scanning table fully with primary key. */
+  PK_FULL_SCAN(4),
+  /** Scanning table fully with secondary key. */
+  SK_FULL_SCAN(5);
+
+  private int priority;

Review comment:
 private int priority -> private final int priority ?





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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [calcite] hsyuan opened a new pull request #2051: [CALCITE-4097] Avoid requesting unnecessary trait request when deriving traits

2020-06-30 Thread GitBox


hsyuan opened a new pull request #2051:
URL: https://github.com/apache/calcite/pull/2051


   If the child subset is used to derive new traits for current relnode, the
   subset will be marked REQUIRED when registering the new derived relnode and
   later will add enforcers between other delivered subsets.  e.g. a MergeJoin
   request both inputs hash distributed by [a,b] sorted by [a,b]. If the left
   input R1 happens to be distributed by [a], the MergeJoin can derive new 
traits
   from this input and request both input to be distributed by [a] sorted by
   [a,b]. In case there is a alternative R2 with ANY distribution in the left
   input's RelSet, we end up with requesting hash distribution [a] on 
alternative
   R2, which is unnecessary and waste, because we request distribution by [a]
   because of R1 can deliver the exact same distribution and we don't need to
   enforce properties on other subsets that can't satisfy the specific trait
   requirement.



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [calcite] zabetak opened a new pull request #2050: Site: Remove '(for Calcite committers)' suffix from headers in section dedicated to committers

2020-06-30 Thread GitBox


zabetak opened a new pull request #2050:
URL: https://github.com/apache/calcite/pull/2050


   



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[calcite-site] branch master updated: Site: Add instructions for managing Calcite repos through GitHub

2020-06-30 Thread zabetak
This is an automated email from the ASF dual-hosted git repository.

zabetak pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/calcite-site.git


The following commit(s) were added to refs/heads/master by this push:
 new 2bb32ed  Site: Add instructions for managing Calcite repos through 
GitHub
2bb32ed is described below

commit 2bb32ede16e3e2a98da2aaed89929167ab224cf3
Author: Stamatis Zampetakis 
AuthorDate: Wed Jul 1 00:57:24 2020 +0200

Site: Add instructions for managing Calcite repos through GitHub
---
 docs/howto.html | 29 +
 1 file changed, 29 insertions(+)

diff --git a/docs/howto.html b/docs/howto.html
index b55d007..ac8e78f 100644
--- a/docs/howto.html
+++ b/docs/howto.html
@@ -118,6 +118,7 @@ adapters.
 
   
   Advanced topics for 
committers
+  Managing
 Calcite repositories through GitHub (for Calcite committers)
   Merging pull 
requests (for Calcite committers)
   Set up PGP 
signing keys (for Calcite committers)
   Set
 up Nexus repository credentials (for Calcite committers)
@@ -575,6 +576,34 @@ need to be re-generated only every build, only when the 
schema changes.
 The following sections are of interest to Calcite committers and in
 particular release managers.
 
+Managing
 Calcite repositories through GitHub (for Calcite committers)
+
+Committers have write access to Calcite’s 
+https://gitbox.apache.org/repos/asf#calcite;>ASF git repositories 
hosting
+the source code of the project as well as the website.
+
+All repositories present on GitBox are available on GitHub with 
write-access 
+enabled, including rights to open/close/merge pull requests and address 
issues.
+
+In order to exploit the GitHub services, committers should link their ASF 
and
+GitHub accounts via the https://gitbox.apache.org/setup/;>account 
linking page.
+
+Here are the steps:
+
+
+  Set your GitHub username into your https://id.apache.org/;>Apache profile.
+  Enable https://help.github.com/articles/securing-your-account-with-two-factor-authentication-2fa/;>GitHub
 2FA
+on your GitHub account.
+  Activating GitHub 2FA changes the authentication process and may affect 
the way you 
+ https://help.github.com/en/github/authenticating-to-github/accessing-github-using-two-factor-authentication#using-two-factor-authentication-with-the-command-line;>access
 GitHub.
+You may need to establish personal access tokens or upload your public SSH key 
to GitHub depending on the 
+protocol that you are using (HTTPS vs. SSH).
+  Merge your Apache and GitHub accounts using the https://gitbox.apache.org/setup/;>account linking page
+(you should see 3 green checks in GitBox).
+  Wait at least 30 minutes for an email inviting you to Apache GitHub 
Organization.
+  Accept the invitation and verify that you are a https://github.com/orgs/apache/teams/calcite-committers/members;>member 
of the team.
+
+
 Merging pull requests 
(for Calcite committers)
 
 These are instructions for a Calcite committer who has reviewed a pull 
request



[calcite] branch site updated (b708fdc -> a171fe4)

2020-06-30 Thread zabetak
This is an automated email from the ASF dual-hosted git repository.

zabetak pushed a change to branch site
in repository https://gitbox.apache.org/repos/asf/calcite.git.


from b708fdc  [CALCITE-3989] Release Calcite 1.23.0
 new d0ee89a  Improve 1.23.0 release note and document
 new 50a2f95  Add 1.23.0 release announcement
 new a171fe4  Site: Add instructions for managing Calcite repos through 
GitHub

The 3 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:
 site/_docs/history.md| 420 +--
 site/_docs/howto.md  |  34 ++-
 site/_posts/2020-05-23-release-1.23.0.md |  49 
 3 files changed, 368 insertions(+), 135 deletions(-)
 create mode 100644 site/_posts/2020-05-23-release-1.23.0.md



[calcite] 03/03: Site: Add instructions for managing Calcite repos through GitHub

2020-06-30 Thread zabetak
This is an automated email from the ASF dual-hosted git repository.

zabetak pushed a commit to branch site
in repository https://gitbox.apache.org/repos/asf/calcite.git

commit a171fe4b3d0f374877f6ac028056d405520b1bff
Author: Stamatis Zampetakis 
AuthorDate: Fri Jun 5 12:36:42 2020 +0200

Site: Add instructions for managing Calcite repos through GitHub

Close apache/calcite#2009
---
 site/_docs/howto.md | 26 ++
 1 file changed, 26 insertions(+)

diff --git a/site/_docs/howto.md b/site/_docs/howto.md
index d14c0e0..d87a33d 100644
--- a/site/_docs/howto.md
+++ b/site/_docs/howto.md
@@ -474,6 +474,32 @@ $ ./src/main/scripts/generate-protobuf.sh
 The following sections are of interest to Calcite committers and in
 particular release managers.
 
+## Managing Calcite repositories through GitHub (for Calcite committers)
+
+Committers have write access to Calcite's 
+[ASF git repositories](https://gitbox.apache.org/repos/asf#calcite) hosting
+the source code of the project as well as the website.
+
+All repositories present on GitBox are available on GitHub with write-access 
+enabled, including rights to open/close/merge pull requests and address issues.
+
+In order to exploit the GitHub services, committers should link their ASF and
+GitHub accounts via the [account linking 
page](https://gitbox.apache.org/setup/).
+
+Here are the steps:
+
+ * Set your GitHub username into your [Apache profile](https://id.apache.org/).
+ * Enable [GitHub 
2FA](https://help.github.com/articles/securing-your-account-with-two-factor-authentication-2fa/)
+on your GitHub account. 
+ * Activating GitHub 2FA changes the authentication process and may affect the 
way you 
+ [access 
GitHub](https://help.github.com/en/github/authenticating-to-github/accessing-github-using-two-factor-authentication#using-two-factor-authentication-with-the-command-line).
+You may need to establish personal access tokens or upload your public SSH key 
to GitHub depending on the 
+protocol that you are using (HTTPS vs. SSH). 
+ * Merge your Apache and GitHub accounts using the [account linking 
page](https://gitbox.apache.org/setup/)
+(you should see 3 green checks in GitBox).
+ * Wait at least 30 minutes for an email inviting you to Apache GitHub 
Organization. 
+ * Accept the invitation and verify that you are a [member of the 
team](https://github.com/orgs/apache/teams/calcite-committers/members). 
+
 ## Merging pull requests (for Calcite committers)
 
 These are instructions for a Calcite committer who has reviewed a pull request



[calcite] 01/03: Improve 1.23.0 release note and document

2020-06-30 Thread zabetak
This is an automated email from the ASF dual-hosted git repository.

zabetak pushed a commit to branch site
in repository https://gitbox.apache.org/repos/asf/calcite.git

commit d0ee89a068c451a2c52f3140c09778970ceb10fb
Author: Haisheng Yuan 
AuthorDate: Sat May 23 13:10:59 2020 -0500

Improve 1.23.0 release note and document
---
 site/_docs/history.md | 420 ++
 site/_docs/howto.md   |   8 +-
 2 files changed, 293 insertions(+), 135 deletions(-)

diff --git a/site/_docs/history.md b/site/_docs/history.md
index 5d0c491..7e40ae4 100644
--- a/site/_docs/history.md
+++ b/site/_docs/history.md
@@ -28,22 +28,27 @@ For a full list of releases, see
 Downloads are available on the
 [downloads page]({{ site.baseurl }}/downloads/).
 
-## https://github.com/apache/calcite/releases/tag/calcite-1.23.0;>1.23.0 
/ 2020-05-15
+## https://github.com/apache/calcite/releases/tag/calcite-1.23.0;>1.23.0 
/ 2020-05-23
 {: #v1-23-0}
 
 This release comes two months after 1.22.0. It includes more than 100 resolved
 issues, comprising a lot of new features as well as performance improvements
-and bug-fixes. This is the fastest version of Calcite, for some complex 
queries,
-the planning speed can be 50x or more faster than previous versions with 
built-in
-default rule set. TPC-H queries that can't finish planning in previous versions
-now can finish in several seconds. Among others, it is worth highlighting the 
following.
-
-* [https://issues.apache.org/jira/browse/CALCITE-3896;>CALCITE-3896] 
`VolcanoPlanner` supports top down trait request and trait enforcement without 
abstract converter
-* [https://issues.apache.org/jira/browse/CALCITE-3753;>CALCITE-3753] 
Boost `VolcanoPlanner` performance by removing rule match and subset importance
-* [https://issues.apache.org/jira/browse/CALCITE-2970;>CALCITE-2970] 
Improve `VolcanoPlanner` performance when abstract converter is enabled
-* [https://issues.apache.org/jira/browse/CALCITE-2157;>CALCITE-2157] 
ClickHouse dialect implementation (Chris Baynes)
-* [https://issues.apache.org/jira/browse/CALCITE-3780;>CALCITE-3780] 
Support `SESSION` Table function (Rui Wang)
-* [https://issues.apache.org/jira/browse/CALCITE-3737;>CALCITE-3737] 
Support `HOP` Table function (Rui Wang)
+and bug-fixes. For some complex queries, the planning speed can be 50x or more
+faster than previous versions with built-in default rule set. It is also worth
+highlighting the following.
+
+* `VolcanoPlanner` supports top down trait request and trait enforcement 
without
+  abstract converter
+  (https://issues.apache.org/jira/browse/CALCITE-3896;>CALCITE-3896)
+* Improve `VolcanoPlanner` performance by removing rule match and subset 
importance
+  (https://issues.apache.org/jira/browse/CALCITE-3753;>CALCITE-3753)
+* Improve `VolcanoPlanner` performance when abstract converter is enabled
+  (https://issues.apache.org/jira/browse/CALCITE-2970;>CALCITE-2970)
+* Support ClickHouse dialect
+  (https://issues.apache.org/jira/browse/CALCITE-2157;>CALCITE-2157)
+* Support `SESSION` and `HOP` Table function
+  (https://issues.apache.org/jira/browse/CALCITE-3780;>CALCITE-3780,
+  https://issues.apache.org/jira/browse/CALCITE-3737;>CALCITE-3737)
 
 Compatibility: This release is tested on Linux, macOS, Microsoft Windows;
 using Oracle JDK 8, 9, 10, 11, 12, 13, 14 and OpenJDK 8, 9, 10, 11, 12, 13, 14;
@@ -52,132 +57,282 @@ gradle.properties.
 
  Breaking Changes
 
-* [https://issues.apache.org/jira/browse/CALCITE-3877;>CALCITE-3877] In 
`RexWindow`, make fields `upperBound` and `lowerBound` not-nullable
-* [https://issues.apache.org/jira/browse/CALCITE-3868;>CALCITE-3868] 
Remove redundant `ruleSet`(protected)and `ruleNames`(private) in 
`VolcanoPlanner`
-* [https://issues.apache.org/jira/browse/CALCITE-3753;>CALCITE-3753] 
`VolcanoPlanner` flags `impatient` and `ambitious` are removed, alternatively 
use `checkCancel()` to achieve `impatient` mode
-* [https://issues.apache.org/jira/browse/CALCITE-3997;>CALCITE-3997] In 
`VolcanoPlanner`, transformation rules won't match with Enumerable physical 
operators
+* [https://issues.apache.org/jira/browse/CALCITE-3877;>CALCITE-3877]
+  In `RexWindow`, make fields `upperBound` and `lowerBound` not-nullable
+* [https://issues.apache.org/jira/browse/CALCITE-3868;>CALCITE-3868]
+  Remove redundant `ruleSet`(protected)and `ruleNames`(private) in 
`VolcanoPlanner`
+* [https://issues.apache.org/jira/browse/CALCITE-3753;>CALCITE-3753]
+  `VolcanoPlanner` flags `impatient` and `ambitious` are removed, alternatively
+  use `checkCancel()` to achieve `impatient` mode
+* [https://issues.apache.org/jira/browse/CALCITE-3997;>CALCITE-3997]
+  In `VolcanoPlanner`, transformation rules won't match with Enumerable 
physical
+  operators
+* [https://issues.apache.org/jira/browse/CALCITE-3825;>CALCITE-3825]
+  Split `AbstractMaterializedViewRule` into multiple classes (addendum)
 
  New features
 
-* 

[calcite] 02/03: Add 1.23.0 release announcement

2020-06-30 Thread zabetak
This is an automated email from the ASF dual-hosted git repository.

zabetak pushed a commit to branch site
in repository https://gitbox.apache.org/repos/asf/calcite.git

commit 50a2f95deede6e680fc02953e97a75e14b0f940c
Author: Haisheng Yuan 
AuthorDate: Sat May 23 22:23:51 2020 -0500

Add 1.23.0 release announcement
---
 site/_posts/2020-05-23-release-1.23.0.md | 49 
 1 file changed, 49 insertions(+)

diff --git a/site/_posts/2020-05-23-release-1.23.0.md 
b/site/_posts/2020-05-23-release-1.23.0.md
new file mode 100644
index 000..60ef7c5
--- /dev/null
+++ b/site/_posts/2020-05-23-release-1.23.0.md
@@ -0,0 +1,49 @@
+---
+layout: news_item
+date: "2020-05-23 22:30:00 -0500"
+author: hyuan
+version: 1.23.0
+categories: [release]
+tag: v1-23-0
+sha: b708fdc46d4c5fd4c5a6c7a398823318a7b4dce3
+---
+
+
+The [Apache Calcite PMC]({{ site.baseurl }})
+is pleased to announce
+[Apache Calcite release 1.23.0]({{ site.baseurl }}/docs/history.html#v1-23-0).
+
+This release comes two months after 1.22.0. It includes more than 100 resolved
+issues, comprising a lot of new features as well as performance improvements
+and bug-fixes. For some complex queries, the planning speed can be 50x or more
+faster than previous versions with built-in default rule set. It is also worth
+highlighting that Calcite now:
+
+* Supports top down trait request and trait enforcement without abstract 
converter
+  (https://issues.apache.org/jira/browse/CALCITE-3896;>CALCITE-3896)
+* Improves `VolcanoPlanner` performance by removing rule match and subset 
importance
+  (https://issues.apache.org/jira/browse/CALCITE-3753;>CALCITE-3753)
+* Improves `VolcanoPlanner` performance when abstract converter is enabled
+  (https://issues.apache.org/jira/browse/CALCITE-2970;>CALCITE-2970)
+* Supports ClickHouse dialect
+  (https://issues.apache.org/jira/browse/CALCITE-2157;>CALCITE-2157)
+* Supports `SESSION` and `HOP` Table function
+  (https://issues.apache.org/jira/browse/CALCITE-3780;>CALCITE-3780,
+  https://issues.apache.org/jira/browse/CALCITE-3737;>CALCITE-3737)



[calcite] branch master updated: Site: Add instructions for managing Calcite repos through GitHub

2020-06-30 Thread zabetak
This is an automated email from the ASF dual-hosted git repository.

zabetak 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 3e7349f  Site: Add instructions for managing Calcite repos through 
GitHub
3e7349f is described below

commit 3e7349f78d3edf6e6c7f2ca93aebed94f0f6aeb1
Author: Stamatis Zampetakis 
AuthorDate: Fri Jun 5 12:36:42 2020 +0200

Site: Add instructions for managing Calcite repos through GitHub

Close apache/calcite#2009
---
 site/_docs/howto.md | 26 ++
 1 file changed, 26 insertions(+)

diff --git a/site/_docs/howto.md b/site/_docs/howto.md
index d14c0e0..d87a33d 100644
--- a/site/_docs/howto.md
+++ b/site/_docs/howto.md
@@ -474,6 +474,32 @@ $ ./src/main/scripts/generate-protobuf.sh
 The following sections are of interest to Calcite committers and in
 particular release managers.
 
+## Managing Calcite repositories through GitHub (for Calcite committers)
+
+Committers have write access to Calcite's 
+[ASF git repositories](https://gitbox.apache.org/repos/asf#calcite) hosting
+the source code of the project as well as the website.
+
+All repositories present on GitBox are available on GitHub with write-access 
+enabled, including rights to open/close/merge pull requests and address issues.
+
+In order to exploit the GitHub services, committers should link their ASF and
+GitHub accounts via the [account linking 
page](https://gitbox.apache.org/setup/).
+
+Here are the steps:
+
+ * Set your GitHub username into your [Apache profile](https://id.apache.org/).
+ * Enable [GitHub 
2FA](https://help.github.com/articles/securing-your-account-with-two-factor-authentication-2fa/)
+on your GitHub account. 
+ * Activating GitHub 2FA changes the authentication process and may affect the 
way you 
+ [access 
GitHub](https://help.github.com/en/github/authenticating-to-github/accessing-github-using-two-factor-authentication#using-two-factor-authentication-with-the-command-line).
+You may need to establish personal access tokens or upload your public SSH key 
to GitHub depending on the 
+protocol that you are using (HTTPS vs. SSH). 
+ * Merge your Apache and GitHub accounts using the [account linking 
page](https://gitbox.apache.org/setup/)
+(you should see 3 green checks in GitBox).
+ * Wait at least 30 minutes for an email inviting you to Apache GitHub 
Organization. 
+ * Accept the invitation and verify that you are a [member of the 
team](https://github.com/orgs/apache/teams/calcite-committers/members). 
+
 ## Merging pull requests (for Calcite committers)
 
 These are instructions for a Calcite committer who has reviewed a pull request



[GitHub] [calcite] zabetak closed pull request #2009: Site: Add instructions for managing Calcite repos through GitHub

2020-06-30 Thread GitBox


zabetak closed pull request #2009:
URL: https://github.com/apache/calcite/pull/2009


   



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [calcite] amaliujia commented on pull request #2025: [CALCITE-4033] Does not produce parenthesized table expressions for U…

2020-06-30 Thread GitBox


amaliujia commented on pull request #2025:
URL: https://github.com/apache/calcite/pull/2025#issuecomment-652069459


   @danny0405 is it now the right time to merge this PR?



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [calcite] neoremind commented on pull request #1996: [CALCITE-4034] Implement a MySQL InnoDB adapter

2020-06-30 Thread GitBox


neoremind commented on pull request #1996:
URL: https://github.com/apache/calcite/pull/1996#issuecomment-651833186


   In MySQL 5.6, `COMPACT` is the default row format. After MySQL 5.7 (include 
8.0), `DYNAMIC` is the default row format. The two are the most popular row 
formats.  
   
   For `COMPRESSED`, it is not supported yet. Users who cares about storage 
size rather than CPU load might choose this format. But IMHO, most MySQL users 
do not specify row format when creating table.
   
   For `FIXED` row format, it is rarely used. Refer to 
https://dev.mysql.com/doc/refman/5.7/en/create-table.html
   ```
   ROW_FORMAT=FIXED is not supported. If ROW_FORMAT=FIXED is specified while 
innodb_strict_mode is disabled, InnoDB issues a warning and assumes 
ROW_FORMAT=DYNAMIC. If ROW_FORMAT=FIXED is specified while innodb_strict_mode 
is enabled, which is the default, InnoDB returns an error.
   ```
   
   For `REDUNDANT` row format, it is an very old format before MySQL 5.1. 
   
   For `extra`, there is no such row format. Valid row formats are {DEFAULT | 
DYNAMIC | FIXED | COMPRESSED | REDUNDANT | COMPACT}
   
   To conclude, the adapter supports `COMPACT` and `DYNAMIC` format which are 
most commonly used nowadays. I can add explanations in `Limitation` section. 



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [calcite] XuQianJin-Stars commented on pull request #1996: [CALCITE-4034] Implement a MySQL InnoDB adapter

2020-06-30 Thread GitBox


XuQianJin-Stars commented on pull request #1996:
URL: https://github.com/apache/calcite/pull/1996#issuecomment-651808436


   hi @neoremind  
   Have you considered that row_format has some other values:
   `default` `fixed` `dynamic` `compressed` `extra` `compact`



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [calcite] zinking edited a comment on pull request #1929: Add CheckerFramework to GitHub Actions CI

2020-06-30 Thread GitBox


zinking edited a comment on pull request #1929:
URL: https://github.com/apache/calcite/pull/1929#issuecomment-65135


   > You are right, there's not enough annotations.
   > The idea was that once all the annotations are there, we could enforce the 
check for all the commits.
   > 
   > Feel free to pick it up.
   > I don't have the bandwidth in the nearest future :-/
   
   I remember you do these things using script last time I saw ^_^
   -- 
   ok , after some digging, this isn't scripting task.



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [calcite] zinking commented on pull request #1929: Add CheckerFramework to GitHub Actions CI

2020-06-30 Thread GitBox


zinking commented on pull request #1929:
URL: https://github.com/apache/calcite/pull/1929#issuecomment-65135


   > You are right, there's not enough annotations.
   > The idea was that once all the annotations are there, we could enforce the 
check for all the commits.
   > 
   > Feel free to pick it up.
   > I don't have the bandwidth in the nearest future :-/
   
   I remember you do these things using script last time I saw ^_^



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [calcite] zinking commented on a change in pull request #1944: [CALCITE-3956] Unify comparison logic for RelOptCost

2020-06-30 Thread GitBox


zinking commented on a change in pull request #1944:
URL: https://github.com/apache/calcite/pull/1944#discussion_r447663248



##
File path: core/src/main/java/org/apache/calcite/plan/RelOptCost.java
##
@@ -76,19 +132,28 @@
 
   /**
* Compares this to another cost.
+   * This is based on the implementation of method {@link 
#compareCost(RelOptCost)},
+   *  and is not intended to be overridden.
*
* @param cost another cost
* @return true iff this is less than or equal to other cost
*/
-  boolean isLe(RelOptCost cost);
+  default boolean isLe(RelOptCost cost) {
+ComparisonResult result = compareCost(cost);
+return result == ComparisonResult.LT || result == ComparisonResult.EQ;
+  }
 
   /**
* Compares this to another cost.
+   * This is based on the implementation of method {@link 
#compareCost(RelOptCost)},
+   * and is not intended to be overridden.
*
* @param cost another cost
* @return true iff this is strictly less than other cost
*/
-  boolean isLt(RelOptCost cost);
+  default boolean isLt(RelOptCost cost) {
+return compareCost(cost) == ComparisonResult.LT;
+  }

Review comment:
   I don't see interface definition needs to be changed, the change should 
be made in the IMPlementation file.





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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [calcite] zinking commented on pull request #1946: [CALCITE-3539] Implement INSTR function

2020-06-30 Thread GitBox


zinking commented on pull request #1946:
URL: https://github.com/apache/calcite/pull/1946#issuecomment-651772100


   looks good overall



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [calcite] zinking commented on a change in pull request #1946: [CALCITE-3539] Implement INSTR function

2020-06-30 Thread GitBox


zinking commented on a change in pull request #1946:
URL: https://github.com/apache/calcite/pull/1946#discussion_r447658773



##
File path: site/_docs/reference.md
##
@@ -2359,6 +2359,7 @@ semantics.
 | m | SPACE(integer) | Returns a string of 
*integer* spaces; returns an empty string if *integer* is less than 1
 | o | SUBSTR(string, position [, substringLength ]) | Returns a portion of 
*string*, beginning at character *position*, *substringLength* characters long. 
SUBSTR calculates lengths using characters as defined by the input character set
 | m | STRCMP(string, string) | Returns 0 if both of 
the strings are same and returns -1 when the first argument is smaller than the 
second and 1 when the second one is smaller the first one.
+| m | INSTR(string, string)  | Returns the index of 
the first occurrence of the second argument in the first argument and returns 0 
if the first argument not include the second argument.

Review comment:
   well, STRCMP does the same, change it altogether





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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [calcite] danny0405 commented on a change in pull request #2019: [CALCITE-4059] SqlTypeUtil#equalSansNullability consider Array/Map type.

2020-06-30 Thread GitBox


danny0405 commented on a change in pull request #2019:
URL: https://github.com/apache/calcite/pull/2019#discussion_r447636635



##
File path: core/src/test/java/org/apache/calcite/sql/type/SqlTypeUtilTest.java
##
@@ -117,6 +120,45 @@
 SqlTypeCoercionRule.THREAD_PROVIDERS.set(defaultRules);
   }
 
+  @Test void testEqualAsCollectionSansNullability() {
+final SqlTypeFactoryImpl factory =
+new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT);
+

Review comment:
   Try to reuse the `Fixture`.





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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [calcite] rubenada commented on a change in pull request #2037: [CALCITE-3834] Support AntiJoin in EnumerableMergeJoin

2020-06-30 Thread GitBox


rubenada commented on a change in pull request #2037:
URL: https://github.com/apache/calcite/pull/2037#discussion_r447452267



##
File path: 
linq4j/src/main/java/org/apache/calcite/linq4j/EnumerableDefaults.java
##
@@ -3878,6 +3879,8 @@ public void remove() {
 private final Comparator comparator;
 private boolean done;
 private Enumerator results;
+// only used for ANTI join: if right input is over, all remaining elements 
from left are results
+private boolean remainingLeft;

Review comment:
   Correct, it means the right input is over, but the left is not; hence 
all remaining tuples from the left relation are results for the anti-join





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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [calcite] rubenada commented on pull request #2027: [CALCITE-4049] Improve the implementation of the shortest-path algorithm

2020-06-30 Thread GitBox


rubenada commented on pull request #2027:
URL: https://github.com/apache/calcite/pull/2027#issuecomment-651583172


   LGTM



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[calcite] branch master updated: [CALCITE-4049] Improve the implementation of the shortest-path algorithm

2020-06-30 Thread rubenql
This is an automated email from the ASF dual-hosted git repository.

rubenql 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 bd121aa  [CALCITE-4049] Improve the implementation of the 
shortest-path algorithm
bd121aa is described below

commit bd121aa3a6d3b0314785a4c9141028b2ef252ebf
Author: liyafan82 
AuthorDate: Tue Jun 30 11:01:15 2020 +0800

[CALCITE-4049] Improve the implementation of the shortest-path algorithm
---
 .../apache/calcite/plan/ConventionTraitDef.java|  6 +-
 .../calcite/plan/RelOptMaterializations.java   |  4 +-
 .../java/org/apache/calcite/runtime/ConsList.java  |  9 ++-
 .../java/org/apache/calcite/util/graph/Graphs.java | 64 +-
 .../calcite/util/graph/DirectedGraphTest.java  | 30 ++
 5 files changed, 55 insertions(+), 58 deletions(-)

diff --git a/core/src/main/java/org/apache/calcite/plan/ConventionTraitDef.java 
b/core/src/main/java/org/apache/calcite/plan/ConventionTraitDef.java
index 13a4ad9..d38d296 100644
--- a/core/src/main/java/org/apache/calcite/plan/ConventionTraitDef.java
+++ b/core/src/main/java/org/apache/calcite/plan/ConventionTraitDef.java
@@ -197,7 +197,7 @@ public class ConventionTraitDef extends 
RelTraitDef {
   Convention toConvention) {
 ConversionData conversionData = getConversionData(planner);
 return fromConvention.canConvertConvention(toConvention)
-|| conversionData.getShortestPath(fromConvention, toConvention) != 
null;
+|| conversionData.getShortestDistance(fromConvention, toConvention) != 
-1;
   }
 
   private ConversionData getConversionData(RelOptPlanner planner) {
@@ -234,10 +234,10 @@ public class ConventionTraitDef extends 
RelTraitDef {
   return pathMap;
 }
 
-public List getShortestPath(
+public int getShortestDistance(
 Convention fromConvention,
 Convention toConvention) {
-  return getPathMap().getShortestPath(fromConvention, toConvention);
+  return getPathMap().getShortestDistance(fromConvention, toConvention);
 }
   }
 }
diff --git 
a/core/src/main/java/org/apache/calcite/plan/RelOptMaterializations.java 
b/core/src/main/java/org/apache/calcite/plan/RelOptMaterializations.java
index d06ec2b..eb15bf0 100644
--- a/core/src/main/java/org/apache/calcite/plan/RelOptMaterializations.java
+++ b/core/src/main/java/org/apache/calcite/plan/RelOptMaterializations.java
@@ -254,8 +254,8 @@ public abstract class RelOptMaterializations {
   Set usedTables,
   Graphs.FrozenGraph, DefaultEdge> usesGraph) {
 for (RelOptTable queryTable : usedTables) {
-  if (usesGraph.getShortestPath(queryTable.getQualifiedName(), 
qualifiedName)
-  != null) {
+  if (usesGraph.getShortestDistance(queryTable.getQualifiedName(), 
qualifiedName)
+  != -1) {
 return true;
   }
 }
diff --git a/core/src/main/java/org/apache/calcite/runtime/ConsList.java 
b/core/src/main/java/org/apache/calcite/runtime/ConsList.java
index b212626..445cf7e 100644
--- a/core/src/main/java/org/apache/calcite/runtime/ConsList.java
+++ b/core/src/main/java/org/apache/calcite/runtime/ConsList.java
@@ -33,7 +33,6 @@ import javax.annotation.Nonnull;
 public class ConsList extends AbstractImmutableList {
   private final E first;
   private final List rest;
-  private final int size;
 
   /** Creates a ConsList.
* It consists of an element pre-pended to another list.
@@ -52,7 +51,6 @@ public class ConsList extends AbstractImmutableList {
   private ConsList(E first, List rest) {
 this.first = first;
 this.rest = rest;
-this.size = 1 + rest.size();
   }
 
   public E get(int index) {
@@ -68,7 +66,12 @@ public class ConsList extends AbstractImmutableList {
   }
 
   public int size() {
-return size;
+int s = 1;
+for (ConsList c = this;; c = (ConsList) c.rest, ++s) {
+  if (!(c.rest instanceof ConsList)) {
+return s + c.rest.size();
+  }
+}
   }
 
   @Override public int hashCode() {
diff --git a/core/src/main/java/org/apache/calcite/util/graph/Graphs.java 
b/core/src/main/java/org/apache/calcite/util/graph/Graphs.java
index 2aaebd1..e731e17 100644
--- a/core/src/main/java/org/apache/calcite/util/graph/Graphs.java
+++ b/core/src/main/java/org/apache/calcite/util/graph/Graphs.java
@@ -22,14 +22,13 @@ import com.google.common.collect.ImmutableList;
 
 import java.util.AbstractList;
 import java.util.ArrayList;
+import java.util.Comparator;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import static org.apache.calcite.util.Static.cons;
-
 /**
  * Miscellaneous graph utilities.
  */
@@ -56,42 +55,40 @@ public class Graphs {
   public static  FrozenGraph makeImmutable(
   DirectedGraph graph) {
 DefaultDirectedGraph graph1 = (DefaultDirectedGraph) graph;
-Map, List> shortestPaths = new 

[GitHub] [calcite] rubenada merged pull request #2027: [CALCITE-4049] Improve the implementation of the shortest-path algorithm

2020-06-30 Thread GitBox


rubenada merged pull request #2027:
URL: https://github.com/apache/calcite/pull/2027


   



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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org