[GitHub] [calcite] junzheng-zheng commented on a change in pull request #1950: [CALCITE-3916] Implement top-down rule applying and upper bound space pruning
junzheng-zheng commented on a change in pull request #1950: URL: https://github.com/apache/calcite/pull/1950#discussion_r449746706 ## File path: core/src/main/java/org/apache/calcite/rel/metadata/RelMdLowerBoundCost.java ## @@ -0,0 +1,127 @@ +/* + * 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.rel.metadata; + +import org.apache.calcite.plan.Convention; +import org.apache.calcite.plan.ConventionTraitDef; +import org.apache.calcite.plan.RelOptCost; +import org.apache.calcite.plan.RelOptPlanner; +import org.apache.calcite.plan.volcano.AbstractConverter; +import org.apache.calcite.plan.volcano.CascadeRelSet; +import org.apache.calcite.plan.volcano.CascadeRelSubset; +import org.apache.calcite.plan.volcano.RelSubset; +import org.apache.calcite.rel.RelNode; +import org.apache.calcite.rel.metadata.BuiltInMetadata.LowerBoundCost; +import org.apache.calcite.util.BuiltInMethod; + +/** + * Default implementations of the + * {@link BuiltInMetadata.LowerBoundCost} + * metadata provider for the standard algebra. + */ +public class RelMdLowerBoundCost implements MetadataHandler { + + public static final RelMetadataProvider SOURCE = + ReflectiveRelMetadataProvider.reflectiveSource( + new RelMdLowerBoundCost(), BuiltInMethod.LOWER_BOUND_COST.method); + + //~ Constructors --- + + protected RelMdLowerBoundCost() {} + + //~ Methods + + public MetadataDef getDef() { +return BuiltInMetadata.LowerBoundCost.DEF; + } + + private boolean isLogical(RelNode relNode) { +return relNode.getTraitSet().getTrait(ConventionTraitDef.INSTANCE) +== Convention.NONE; + } + + public RelOptCost getLowerBoundCost(CascadeRelSubset subset, + RelMetadataQuery mq, RelOptPlanner planner) { + +if (isLogical(subset)) { + // currently only support physical, will improve in the future + return null; +} + +RelOptCost winner = subset.getWinnerCost(); +if (winner != null) { + // when this subset is fully optimized, just return the winner + return winner; +} + +// if group is not fully explored. Its properties like cardinality +// would get changed after exploration. So it cannot return a valid LB +if (subset.getSet().getState() != CascadeRelSet.ExploreState.EXPLORED) { + return null; +} + +RelOptCost lowerBound = null; +for (RelNode relNode : subset.getRels()) { Review comment: If current group is not fully optimized and has no winner, there may be problems to get the lower bound here. Since the current group's optimization may affact the input groups of the current group. E.g., the current group's optimization may push down some require traits and maybe somewhere of the inputs subtrees may enhance there's costs. So if we get the lower bound here, it may be larger than the actual lower bound which may miss optimal plan ## File path: core/src/main/java/org/apache/calcite/plan/volcano/CascadePlanner.java ## @@ -0,0 +1,946 @@ +/* + * 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.plan.volcano; + +import org.apache.calcite.linq4j.function.Function0; +import org.apache.calcite.plan.Context; +import org.apache.calcite.plan.Convention; +import org.apache.calcite.plan.RelOptCost; +import org.apache.calcite.plan.RelOptCostFactory; +import org
[GitHub] [calcite] zabetak opened a new pull request #2055: [CALCITE-4104] Add automatically link to GitHub PR and 'pull-request-available' label to issues
zabetak opened a new pull request #2055: URL: https://github.com/apache/calcite/pull/2055 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: Remove '(for Calcite committers)' suffix from headers in section dedicated to committers
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 5e87f70 Site: Remove '(for Calcite committers)' suffix from headers in section dedicated to committers 5e87f70 is described below commit 5e87f70a654b9234580a73fd1224b56d3c72265b Author: Stamatis Zampetakis AuthorDate: Fri Jul 3 11:12:02 2020 +0200 Site: Remove '(for Calcite committers)' suffix from headers in section dedicated to committers --- docs/howto.html | 40 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/docs/howto.html b/docs/howto.html index ac8e78f..5dacee1 100644 --- a/docs/howto.html +++ b/docs/howto.html @@ -118,26 +118,26 @@ 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) - Making a snapshot (for Calcite committers) - Making a release candidate (for Calcite committers) + Managing Calcite repositories through GitHub + Merging pull requests + Set up PGP signing keys + Set up Nexus repository credentials + Making a snapshot + Making a release candidate To prepare a release candidate directly in your environment: Checking the artifacts - Cleaning up after a failed release attempt (for Calcite committers) + Cleaning up after a failed release attempt Validate a release - Get approval for a release via Apache voting process (for Calcite committers) - Publishing a release (for Calcite committers) + Get approval for a release via Apache voting process + Publishing a release Publishing directly in your environment: - Publishing the web site (for Calcite committers) + Publishing the web site @@ -576,7 +576,7 @@ 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) +Managing Calcite repositories through GitHub Committers have write access to Calciteās https://gitbox.apache.org/repos/asf#calcite";>ASF git repositories hosting @@ -604,7 +604,7 @@ protocol that you are using (HTTPS vs. SSH). 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) +Merging pull requests These are instructions for a Calcite committer who has reviewed a pull request from a contributor, found it satisfactory, and is about to merge it to master. @@ -643,7 +643,7 @@ which resolves the issue (in GitHub or GitBox), and also thank the contributor for their contribution. -Set up PGP signing keys (for Calcite committers) +Set up PGP signing keys Follow instructions https://www.apache.org/dev/release-signing";>here to create a key pair. (On macOS, I did brew install gpg and @@ -656,7 +656,7 @@ file by following instructions in the KEYShttps://issues.apache.org/jira/browse/CALCITE-1746";>redundant.) -Set up Nexus repository credentials (for Calcite committers) +Set up Nexus repository credentials Gradle provides multiple ways to https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties";>configure project properties. For instance, you could update $HOME/.gradle/gradle.properties. @@ -677,7 +677,7 @@ For instance, you could update $HOME/.gradle/gra Note: if you want to uses gpg-agent, you need to pass useGpgCmd property, and specify the key id via signing.gnupg.keyName. -Making a snapshot (for Calcite committers) +Making a snapshot Before you start: @@ -691,7 +691,7 @@ git clean -xn # Publish snapshot artifacts ./gradlew clean publish -Pasf -Making a release candidate (for Calcite committers) +Making a release candidate Note: release artifacts (dist.apache.org and repository.apache.org) are managed with https://github.com/vlsi/vlsi-release-plugins/tree/master/plugins/stage-vote-release-plugin";>stage-vote-release-plugin @@ -824,7 +824,7 @@ https://repository.apache.org/content/repositories/orgapachecalcite-1000 (or a similar URL) -Cleaning up after a failed release attempt (for Calcite committers) +Cleaning up after a failed release attempt If something is not correct, you can fix it, commit it, and prepare the next candidate. The release candidate tags might be kept for
[calcite] branch site updated: Site: Remove '(for Calcite committers)' suffix from headers in section dedicated to committers
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 The following commit(s) were added to refs/heads/site by this push: new 8ce5300 Site: Remove '(for Calcite committers)' suffix from headers in section dedicated to committers 8ce5300 is described below commit 8ce5300891464968e9a516165dcbad79aa48312a Author: Stamatis Zampetakis AuthorDate: Wed Jul 1 01:10:51 2020 +0200 Site: Remove '(for Calcite committers)' suffix from headers in section dedicated to committers --- site/_docs/howto.md | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/site/_docs/howto.md b/site/_docs/howto.md index d87a33d..060eb8d 100644 --- a/site/_docs/howto.md +++ b/site/_docs/howto.md @@ -474,7 +474,7 @@ $ ./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) +## Managing Calcite repositories through GitHub Committers have write access to Calcite's [ASF git repositories](https://gitbox.apache.org/repos/asf#calcite) hosting @@ -500,7 +500,7 @@ protocol that you are using (HTTPS vs. SSH). * 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) +## Merging pull requests These are instructions for a Calcite committer who has reviewed a pull request from a contributor, found it satisfactory, and is about to merge it to master. @@ -537,7 +537,7 @@ manager); which resolves the issue (in GitHub or GitBox), and also thank the contributor for their contribution. -## Set up PGP signing keys (for Calcite committers) +## Set up PGP signing keys Follow instructions [here](https://www.apache.org/dev/release-signing) to create a key pair. (On macOS, I did `brew install gpg` and @@ -550,7 +550,7 @@ file by following instructions in the `KEYS` file. ball because that would be [redundant](https://issues.apache.org/jira/browse/CALCITE-1746).) -## Set up Nexus repository credentials (for Calcite committers) +## Set up Nexus repository credentials Gradle provides multiple ways to [configure project properties](https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties). For instance, you could update `$HOME/.gradle/gradle.properties`. @@ -573,7 +573,7 @@ Note: when https://github.com/vlsi/asflike-release-environment is used, the cred Note: if you want to uses `gpg-agent`, you need to pass `useGpgCmd` property, and specify the key id via `signing.gnupg.keyName`. -## Making a snapshot (for Calcite committers) +## Making a snapshot Before you start: @@ -587,7 +587,7 @@ git clean -xn ./gradlew clean publish -Pasf {% endhighlight %} -## Making a release candidate (for Calcite committers) +## Making a release candidate Note: release artifacts (dist.apache.org and repository.apache.org) are managed with [stage-vote-release-plugin](https://github.com/vlsi/vlsi-release-plugins/tree/master/plugins/stage-vote-release-plugin) @@ -706,7 +706,7 @@ Verify the staged artifacts in the Nexus repository: https://repository.apache.org/content/repositories/orgapachecalcite-1000 (or a similar URL) -## Cleaning up after a failed release attempt (for Calcite committers) +## Cleaning up after a failed release attempt If something is not correct, you can fix it, commit it, and prepare the next candidate. The release candidate tags might be kept for a while. @@ -743,7 +743,7 @@ function checkHash() { checkHash apache-calcite-X.Y.Z-rcN {% endhighlight %} -## Get approval for a release via Apache voting process (for Calcite committers) +## Get approval for a release via Apache voting process Release vote on dev list Note: the draft mail is printed as the final step of `prepareVote` task, @@ -832,7 +832,7 @@ shortened URLs for the vote proposal and result emails. Examples: [s.apache.org/calcite-1.2-result](https://s.apache.org/calcite-1.2-result). -## Publishing a release (for Calcite committers) +## Publishing a release After a successful release vote, we need to push the release out to mirrors, and other tasks. @@ -900,7 +900,7 @@ You can use [the 1.20.0 announcement](https://mail-archives.apache.org/mod_mbox/www-announce/201906.mbox/%3CCA%2BEpF8tcJcZ41rVuwJODJmyRy-qAxZUQm9OxKsoDi07c2SKs_A%40mail.gmail.com%3E) as a template. Be sure to include a brief description of the project. -## Publishing the web site (for Calcite committers) +## Publishing the web site {: #publish-the-web-site} See instructions in
[GitHub] [calcite] zabetak merged pull request #2050: Site: Remove '(for Calcite committers)' suffix from headers in section dedicated to committers
zabetak merged 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] branch master updated (e7aca69 -> 113892e)
This is an automated email from the ASF dual-hosted git repository. zabetak pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/calcite.git. from e7aca69 [CALCITE-4101] Calcite PR CI often failed due to `elasticsearch:test`, disable the related tests first (Jiatao Tao) add 113892e Site: Remove '(for Calcite committers)' suffix from headers in section dedicated to committers No new revisions were added by this update. Summary of changes: site/_docs/howto.md | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-)
[GitHub] [calcite] danny0405 closed pull request #2054: [CALCITE-4101] Calcite PR CI often failed due to `elasticsearch:test`, disable the related tests first
danny0405 closed pull request #2054: URL: https://github.com/apache/calcite/pull/2054 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 (32fc1f4 -> e7aca69)
This is an automated email from the ASF dual-hosted git repository. danny0405 pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/calcite.git. from 32fc1f4 [CALCITE-4098] Remove redundant code in RelJson.toJson(RelDistribution) (Jiatao Tao) add e7aca69 [CALCITE-4101] Calcite PR CI often failed due to `elasticsearch:test`, disable the related tests first (Jiatao Tao) No new revisions were added by this update. Summary of changes: .../java/org/apache/calcite/adapter/elasticsearch/AggregationTest.java | 2 ++ .../java/org/apache/calcite/adapter/elasticsearch/BooleanLogicTest.java | 2 ++ .../apache/calcite/adapter/elasticsearch/ElasticSearchAdapterTest.java | 2 ++ .../test/java/org/apache/calcite/adapter/elasticsearch/MatchTest.java | 2 ++ .../java/org/apache/calcite/adapter/elasticsearch/Projection2Test.java | 2 ++ .../java/org/apache/calcite/adapter/elasticsearch/ProjectionTest.java | 2 ++ .../java/org/apache/calcite/adapter/elasticsearch/ScrollingTest.java| 1 + 7 files changed, 13 insertions(+)
[GitHub] [calcite] danny0405 closed pull request #2030: [CALCITE-4098] Remove redundant code in "RelJson.toJson(RelDistribution)"
danny0405 closed pull request #2030: URL: https://github.com/apache/calcite/pull/2030 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 (8db7c9d -> 32fc1f4)
This is an automated email from the ASF dual-hosted git repository. danny0405 pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/calcite.git. from 8db7c9d [CALCITE-4066] SqlTypeUtil#convertTypeToSpec cover Array/Multiset/Row types (Jiatao Tao) add 32fc1f4 [CALCITE-4098] Remove redundant code in RelJson.toJson(RelDistribution) (Jiatao Tao) No new revisions were added by this update. Summary of changes: .../apache/calcite/rel/externalize/RelJson.java| 13 +-- .../org/apache/calcite/plan/RelWriterTest.java | 43 ++ 2 files changed, 45 insertions(+), 11 deletions(-)
[GitHub] [calcite] danny0405 closed pull request #2029: [CALCITE-4066] SqlTypeUtil#convertTypeToSpec cover Array/Multiset/Row types.
danny0405 closed pull request #2029: URL: https://github.com/apache/calcite/pull/2029 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 (a329e88 -> 8db7c9d)
This is an automated email from the ASF dual-hosted git repository. danny0405 pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/calcite.git. from a329e88 [CALCITE-4059] SqlTypeUtil#equalSansNullability consider Array/Map type (Jiatao Tao) add 8db7c9d [CALCITE-4066] SqlTypeUtil#convertTypeToSpec cover Array/Multiset/Row types (Jiatao Tao) No new revisions were added by this update. Summary of changes: .../org/apache/calcite/sql/type/SqlTypeUtil.java | 61 +- .../apache/calcite/sql/type/SqlTypeUtilTest.java | 39 ++ 2 files changed, 88 insertions(+), 12 deletions(-)