[GitHub] [calcite] hsyuan commented on issue #1840: [CALCITE-3753] Remove rule queue importance
hsyuan commented on issue #1840: [CALCITE-3753] Remove rule queue importance URL: https://github.com/apache/calcite/pull/1840#issuecomment-596050901 @zabetak Thanks for reminding. Will update 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[calcite] branch site updated (98b61a4 -> 200a136)
This is an automated email from the ASF dual-hosted git repository. danny0405 pushed a change to branch site in repository https://gitbox.apache.org/repos/asf/calcite.git. discard 98b61a4 Site: Fix links to javadoc discard bca73e2 Add 1.22.0 release announcement add 4bd1328 Add 1.22.0 release announcement add ebc5070 Site: Fix links to javadoc add e9d302f [CALCITE-3837] AntiJoin with empty right input can always be transformed as its left input add 3c70ca4 [CALCITE-3820] EnumerableDefaults#orderBy should be lazily computed + support enumerator re-initialization add bfde14b [CALCITE-3828] MergeJoin throws NPE in case of null keys add 200a136 [CALCITE-3809] RexSimplify simplifies nondeterministic function incorrectly This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (98b61a4) \ N -- N -- N refs/heads/site (200a136) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. No new revisions were added by this update. Summary of changes: .../apache/calcite/rel/rules/PruneEmptyRules.java | 7 +- .../java/org/apache/calcite/rex/RexAnalyzer.java | 6 +- .../org/apache/calcite/rex/RexInterpreter.java | 12 +++ .../java/org/apache/calcite/rex/RexSimplify.java | 2 +- .../org/apache/calcite/rex/RexProgramTest.java | 18 .../apache/calcite/runtime/EnumerablesTest.java| 100 - .../org/apache/calcite/test/RelOptRulesTest.java | 2 +- .../test/enumerable/EnumerableJoinTest.java| 80 + .../org/apache/calcite/test/RelOptRulesTest.xml| 4 +- .../apache/calcite/linq4j/EnumerableDefaults.java | 38 ++-- 10 files changed, 223 insertions(+), 46 deletions(-)
[calcite] tag calcite-1.22.0 created (now 537b8db)
This is an automated email from the ASF dual-hosted git repository. danny0405 pushed a change to tag calcite-1.22.0 in repository https://gitbox.apache.org/repos/asf/calcite.git. at 537b8db (commit) No new revisions were added by this update.
[calcite] branch site updated: Site: Fix links to javadoc
This is an automated email from the ASF dual-hosted git repository. danny0405 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 98b61a4 Site: Fix links to javadoc 98b61a4 is described below commit 98b61a4b1eed2992a25aed0d3995109ec45faa4a Author: yuzhao.cyz AuthorDate: Thu Mar 5 06:31:45 2020 -0600 Site: Fix links to javadoc --- site/README.md | 18 -- site/_config.yml| 10 +++--- site/_data/docs.yml | 1 - site/_docs/api.md | 2 +- site/_docs/testapi.md | 28 site/_includes/section_nav.html | 2 +- site/docker-compose.yml | 2 +- 7 files changed, 14 insertions(+), 49 deletions(-) diff --git a/site/README.md b/site/README.md index 13c1ed5..8cbac2b 100644 --- a/site/README.md +++ b/site/README.md @@ -42,12 +42,12 @@ Site generation currently works best with ruby-2.5.1. 1. `cd ..` 2. `./gradlew javadocAggregate` -3. `rm -rf site/target/apidocs site/target/testapidocs` - `rmdir site\target\apidocs site\target\testapidocs /S /Q` (Windows) +3. `rm -rf site/target/javadocAggregate` + `rmdir site\target\javadocAggregate /S /Q` (Windows) 4. `mkdir site/target` `mkdir site\target` (Windows) -4. `mv build/docs/javadocAggregate site/target/apidocs` - `for /d %a in (target\site\apidocs* target\site\testapidocs*) do move %a site\target` (Windows) +4. `mv build/docs/javadocAggregate site/target` + `for /d %a in (build\docs\javadocAggregate*) do move %a site\target` (Windows) ### Running locally @@ -94,15 +94,13 @@ As you make changes to the site, the site will automatically rebuild. If you have not regenerated the javadoc and they are missing, restore them: -6. `git reset -- apidocs/` -7. `git reset -- testapidocs/` -8. `git checkout -- apidocs/` -9. `git checkout -- testapidocs/` +6. `git reset -- javadocAggregate/` +7. `git checkout -- javadocAggregate/` Restore the avatica site -10. `git reset -- avatica/` -11. `git checkout -- avatica/` +8. `git reset -- avatica/` +9. `git checkout -- avatica/` 10. `git add .` 11. Commit: `git commit -m "Your commit message goes here"` diff --git a/site/_config.yml b/site/_config.yml index c9fa570..402c7d0 100644 --- a/site/_config.yml +++ b/site/_config.yml @@ -21,7 +21,7 @@ excerpt_separator: "" repository: https://github.com/apache/calcite destination: target exclude: [README.md,Gemfile*] -keep_files: [".git", ".svn", "apidocs", "testapidocs", "avatica", "docs/cassandra.html"] +keep_files: [".git", ".svn", "javadocAggregate", "avatica", "docs/cassandra.html"] collections: docs: @@ -31,12 +31,8 @@ collections: sourceRoot: https://github.com/apache/calcite/blob/master # The URL where Javadocs are located -apiRoot: /apidocs -# apiRoot: http://calcite.apache.org/apidocs - -# The URL where Test Javadocs are located -testApiRoot: /testapidocs -# testApiRoot: http://calcite.apache.org/testapidocs +apiRoot: /javadocAggregate +# apiRoot: http://calcite.apache.org/javadocAggregate # The URL where Avatica's Javadocs are located avaticaApiRoot: /avatica/apidocs diff --git a/site/_data/docs.yml b/site/_data/docs.yml index 3a13d5d..5a6a714 100644 --- a/site/_data/docs.yml +++ b/site/_data/docs.yml @@ -49,5 +49,4 @@ - history - powered_by - api - - testapi # End docs.yml diff --git a/site/_docs/api.md b/site/_docs/api.md index 5ad8688..d9d9419 100644 --- a/site/_docs/api.md +++ b/site/_docs/api.md @@ -1,7 +1,7 @@ --- title: API layout: external -external_url: /apidocs +external_url: /javadocAggregate --- {% comment %} Ideally, we want to use {{ site.apiRoot }} instead of hardcoding diff --git a/site/_docs/testapi.md b/site/_docs/testapi.md deleted file mode 100644 index 661f374..000 --- a/site/_docs/testapi.md +++ /dev/null @@ -1,28 +0,0 @@ -title: Test API -layout: external -external_url: /testapidocs -{% comment %} -Ideally, we want to use {{ site.apiRoot }} instead of hardcoding -the above external_url value, but I don't believe there's a way to do that -{% endcomment %} - - diff --git a/site/_includes/section_nav.html b/site/_includes/section_nav.html index e154275..48b112f 100644 --- a/site/_includes/section_nav.html +++ b/site/_includes/section_nav.html @@ -33,7 +33,7 @@ next, lets build a link to it. {% comment %} See CALCITE-2036 for an explanation of the replacement below {% endcomment %} -Next +Next {% endif %} diff --git a/site/docker-compose.yml b/site/docker-compose.yml index 9ae4fbc..8299e3f 100644 --- a/site/docker-compose.yml +++ b/site/docker-compose.yml @@ -31,7 +31,7 @@ services: generate-javadoc: image: maven working_dir: /usr/src/calcite -command: sh -c "./gradlew javadocAggregate; rm -rf site/target/apidocs
[calcite] annotated tag v1.22.0-rc0 updated (213904c -> c0d0a0d)
This is an automated email from the ASF dual-hosted git repository. danny0405 pushed a change to annotated tag v1.22.0-rc0 in repository https://gitbox.apache.org/repos/asf/calcite.git. *** WARNING: tag v1.22.0-rc0 was modified! *** from 213904c (commit) to c0d0a0d (tag) tagging 213904cd07c840e1653bbc782cce4e8dc829b9a1 (commit) replaces calcite-1.21.0 by yuzhao.cyz on Fri Mar 6 22:50:08 2020 +0800 - Log - --- No new revisions were added by this update. Summary of changes:
svn commit: r38424 - in /dev/calcite/apache-calcite-1.22.0-rc0: apache-calcite-1.22.0-src.tar.gz apache-calcite-1.22.0-src.tar.gz.asc apache-calcite-1.22.0-src.tar.gz.sha512
Author: danny0405 Date: Fri Mar 6 14:50:30 2020 New Revision: 38424 Log: Uploading release candidate Apache Calcite v1.22.0-rc0 to dev area Modified: dev/calcite/apache-calcite-1.22.0-rc0/apache-calcite-1.22.0-src.tar.gz dev/calcite/apache-calcite-1.22.0-rc0/apache-calcite-1.22.0-src.tar.gz.asc dev/calcite/apache-calcite-1.22.0-rc0/apache-calcite-1.22.0-src.tar.gz.sha512 Modified: dev/calcite/apache-calcite-1.22.0-rc0/apache-calcite-1.22.0-src.tar.gz == Binary files dev/calcite/apache-calcite-1.22.0-rc0/apache-calcite-1.22.0-src.tar.gz (original) and dev/calcite/apache-calcite-1.22.0-rc0/apache-calcite-1.22.0-src.tar.gz Fri Mar 6 14:50:30 2020 differ Modified: dev/calcite/apache-calcite-1.22.0-rc0/apache-calcite-1.22.0-src.tar.gz.asc == --- dev/calcite/apache-calcite-1.22.0-rc0/apache-calcite-1.22.0-src.tar.gz.asc (original) +++ dev/calcite/apache-calcite-1.22.0-rc0/apache-calcite-1.22.0-src.tar.gz.asc Fri Mar 6 14:50:30 2020 @@ -1,17 +1,17 @@ -BEGIN PGP SIGNATURE- Version: BCPG v1.63 -iQIzBAABCAAdFiEEmkiSL2gqsF0a5KPnwpMeS9sD1a4FAl5Tos4ACgkQwpMeS9sD -1a6zrhAAlTc3T05WLvYad9rx0cFMvxlG6jR3CovUi+tm4R6YM8pYsKDXgf6pbKG7 -vsHewxhn5NaI9FJFcOwwn2loiqaYtXzgtLylwvIvpPY/7JopS78sx8/nsXVHWbm6 -z7dxoRmyQ1sn4vSRyDxYEPj9a12tMUFssDUpqnubrGhROpVYzPWJqJIkBoe2J5sf -tSOwdXvzJRnr+qjl2QpBEUa3Eb3ieSpqXKQe9zPBdCOqoHJetAE/JHDtHsmIIRfa -V0zNrV5HCBv7qb/xSRlFJ+HWpown0i6PxNiOlPFfOmXzWSWiHi0IE4ZQs9K0Yb1g -ENAIrDa7BMlNcA7eoIB+cL4tyyiwigPGgqnoj+XG50yqxMQPsInNOYTDaNQH2muU -RunObxo3B9PWzfsXKj1KLkIRp+w/s/XiZ3dCxl2vLU9010dRpLHwRen/m7XmlHwu -T0Jvc+zeMy52XVo1CFgQ9aBwA+D9s2h+HyTi/mPMrFNAeA64wXLddKeFgXqx7Obo -Z7MMpQegvPXrwLNJR6iVa5zQxXiBA6FFfGmjdg57Nt0lfT395weILCZ5W/+Xvyrz -nN4KZqpnvEk+oxikI2aKd+JjI9tgtEunUv1HiHrujLAzHAbbLZ4p/hq3ccLNewOR -LpzmjjrhMQtzdDW5g+SlLegbYhRWdbNYkmcrnX104RRrEQFc2lE= -=cogD +iQIzBAABCAAdFiEEmkiSL2gqsF0a5KPnwpMeS9sD1a4FAl5iYyEACgkQwpMeS9sD +1a7wlRAA1PBpEdkPGbswLEObafBDfnRlNROrxjCrjLcYZEjvTECOhZO+hWvoXxK0 +EJypL8ezN9Y7h38/GX06btr4T5dx0sS2e29Lb12Bh3U/4bD4MEFNe5Obsne50QFT +AAVNXuTyu9CJa/kuneGG6wQJ8HIDUWzk5ZQTznVA5phwreIoyDaVc6O1QUQEbygP +j1A3BTSdHSpmCHAQkZllUIrocrmOlxyP8FYRRYg7Gpf/fFujau+KMWZepTQh9ir7 +27Mey7GKCq17Zmq9MFxZikGWI8lv+UXkoZmivU7kaUtIs3dGIUQ29A5+Wzo/2xnN +dy3gg+2//7kEQvc/zUgHoaY4VroqB+z/WR/wiQGc3zbu+FYH8FxqLoK2Ltu4Yz/s +BUbSuSBbMiDcGKEzSJG51bna61aclXH8yrdy0m1gUTY+T3DoyEQ0b2RxMm9d856r +3JOKJHs2TnsQKSRyokXm3IqigvmoK5YPrM2BinO694lfC5Vbxzif9rNq1ZfXkEtM +t27H2Y0Hi79cimfYnof6YF+xZdQd1BpozeVonHk+iosxVNrvu4OzgKmz9rtaXmGv +1QxcA1kj4PbfvdnkPjGR8l1wM+WrObZIZQGrNPtmWUhBz+AD9+El+tiP8dHfHXD8 +m25VLCPlKvRCX+fs0n3ogW7IR2268JuzHHshWlx4PbmFNoNCzjo= +=M5cq -END PGP SIGNATURE- Modified: dev/calcite/apache-calcite-1.22.0-rc0/apache-calcite-1.22.0-src.tar.gz.sha512 == --- dev/calcite/apache-calcite-1.22.0-rc0/apache-calcite-1.22.0-src.tar.gz.sha512 (original) +++ dev/calcite/apache-calcite-1.22.0-rc0/apache-calcite-1.22.0-src.tar.gz.sha512 Fri Mar 6 14:50:30 2020 @@ -1 +1 @@ -f9333b4ce327f7715c71a6d14a8aaeafc140992e3751e1aeb9faf5635db44974b5a44f183644a91700378a06b68a29fa27bd9e8609cdcf1e61836c76a4402351 *apache-calcite-1.22.0-src.tar.gz +ea2a48ae527edec91a0dc9b74d7f03d667da685e8715d2e398084d80e297e39541c711e079a6c8d707c2a83f214a296ed5d28bda1d09629d3aaacbb57dfa942c *apache-calcite-1.22.0-src.tar.gz
[calcite] branch master updated: [CALCITE-3809] RexSimplify simplifies nondeterministic function incorrectly
This is an automated email from the ASF dual-hosted git repository. chunwei 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 200a136 [CALCITE-3809] RexSimplify simplifies nondeterministic function incorrectly 200a136 is described below commit 200a136dd3b2ca04a1d1283eb5a03a04388b1947 Author: Chunwei Lei AuthorDate: Thu Feb 20 22:56:29 2020 +0800 [CALCITE-3809] RexSimplify simplifies nondeterministic function incorrectly --- .../main/java/org/apache/calcite/rex/RexAnalyzer.java | 6 ++ .../java/org/apache/calcite/rex/RexInterpreter.java| 12 .../main/java/org/apache/calcite/rex/RexSimplify.java | 2 +- .../java/org/apache/calcite/rex/RexProgramTest.java| 18 ++ 4 files changed, 33 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/org/apache/calcite/rex/RexAnalyzer.java b/core/src/main/java/org/apache/calcite/rex/RexAnalyzer.java index efbd723..dea076c 100644 --- a/core/src/main/java/org/apache/calcite/rex/RexAnalyzer.java +++ b/core/src/main/java/org/apache/calcite/rex/RexAnalyzer.java @@ -128,13 +128,11 @@ public class RexAnalyzer { } @Override public Void visitCall(RexCall call) { - switch (call.getKind()) { - case CAST: + if (!RexInterpreter.SUPPORTED_SQL_KIND.contains(call.getKind())) { ++unsupportedCount; return null; - default: -return super.visitCall(call); } + return super.visitCall(call); } } } diff --git a/core/src/main/java/org/apache/calcite/rex/RexInterpreter.java b/core/src/main/java/org/apache/calcite/rex/RexInterpreter.java index 2d1f761..e3c3240 100644 --- a/core/src/main/java/org/apache/calcite/rex/RexInterpreter.java +++ b/core/src/main/java/org/apache/calcite/rex/RexInterpreter.java @@ -20,6 +20,7 @@ import org.apache.calcite.avatica.util.DateTimeUtils; import org.apache.calcite.avatica.util.TimeUnit; import org.apache.calcite.avatica.util.TimeUnitRange; import org.apache.calcite.rel.metadata.NullSentinel; +import org.apache.calcite.sql.SqlKind; import org.apache.calcite.util.NlsString; import org.apache.calcite.util.Util; @@ -29,6 +30,7 @@ import java.math.BigDecimal; import java.math.BigInteger; import java.util.ArrayList; import java.util.Comparator; +import java.util.EnumSet; import java.util.List; import java.util.Map; import java.util.function.IntPredicate; @@ -47,6 +49,16 @@ import java.util.function.IntPredicate; public class RexInterpreter implements RexVisitor { private static final NullSentinel N = NullSentinel.INSTANCE; + public static final EnumSet SUPPORTED_SQL_KIND = + EnumSet.of(SqlKind.IS_NOT_DISTINCT_FROM, SqlKind.EQUALS, SqlKind.IS_DISTINCT_FROM, + SqlKind.NOT_EQUALS, SqlKind.GREATER_THAN, SqlKind.GREATER_THAN_OR_EQUAL, + SqlKind.LESS_THAN, SqlKind.LESS_THAN_OR_EQUAL, SqlKind.AND, SqlKind.OR, + SqlKind.NOT, SqlKind.CASE, SqlKind.IS_TRUE, SqlKind.IS_NOT_TRUE, + SqlKind.IS_FALSE, SqlKind.IS_NOT_FALSE, SqlKind.PLUS_PREFIX, + SqlKind.MINUS_PREFIX, SqlKind.PLUS, SqlKind.MINUS, SqlKind.TIMES, + SqlKind.DIVIDE, SqlKind.COALESCE, SqlKind.CEIL, + SqlKind.FLOOR, SqlKind.EXTRACT); + private final Map environment; /** Creates an interpreter. diff --git a/core/src/main/java/org/apache/calcite/rex/RexSimplify.java b/core/src/main/java/org/apache/calcite/rex/RexSimplify.java index a8064df..becfe66 100644 --- a/core/src/main/java/org/apache/calcite/rex/RexSimplify.java +++ b/core/src/main/java/org/apache/calcite/rex/RexSimplify.java @@ -323,7 +323,7 @@ public class RexSimplify { // Simplify "x x" final RexNode o0 = operands.get(0); final RexNode o1 = operands.get(1); -if (o0.equals(o1)) { +if (o0.equals(o1) && RexUtil.isDeterministic(o0)) { RexNode newExpr; switch (e.getKind()) { case EQUALS: diff --git a/core/src/test/java/org/apache/calcite/rex/RexProgramTest.java b/core/src/test/java/org/apache/calcite/rex/RexProgramTest.java index d9c9c75..76b82eb 100644 --- a/core/src/test/java/org/apache/calcite/rex/RexProgramTest.java +++ b/core/src/test/java/org/apache/calcite/rex/RexProgramTest.java @@ -2550,4 +2550,22 @@ public class RexProgramTest extends RexProgramTestBase { ImmutableList.of(gt(ref, literal(1)), le(ref, literal(5; checkSimplifyFilter(gt(ref, literal(9)), relOptPredicateList, "false"); } + + @Test public void testSimplifyNonDeterministicFunction() { +final SqlOperator ndc = new SqlSpecialOperator( +"NDC", +SqlKind.OTHER_FUNCTION, +0, +false, +ReturnTypes.BOOLEAN, +null, null) { + @Override public boolean isDeterministic() { +return false; + } +}; +final RexNode call1 = rexBuilder.makeCall(ndc); +final RexNode call2 = rexBuilder.makeCall(ndc); +final
[GitHub] [calcite] chunweilei merged pull request #1818: [CALCITE-3809] RexSimplify simplifies nondeterministic function incorrectly
chunweilei merged pull request #1818: [CALCITE-3809] RexSimplify simplifies nondeterministic function incorrectly URL: https://github.com/apache/calcite/pull/1818 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 With regards, Apache Git Services
[calcite] branch master updated: [CALCITE-3828] MergeJoin throws NPE in case of null keys
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 bfde14b [CALCITE-3828] MergeJoin throws NPE in case of null keys bfde14b is described below commit bfde14be1284efc6d4560868fef3724238c35dc3 Author: rubenada AuthorDate: Wed Feb 26 10:37:47 2020 +0100 [CALCITE-3828] MergeJoin throws NPE in case of null keys --- .../apache/calcite/runtime/EnumerablesTest.java| 100 - .../apache/calcite/linq4j/EnumerableDefaults.java | 20 - 2 files changed, 95 insertions(+), 25 deletions(-) diff --git a/core/src/test/java/org/apache/calcite/runtime/EnumerablesTest.java b/core/src/test/java/org/apache/calcite/runtime/EnumerablesTest.java index dc1748c..1731653 100644 --- a/core/src/test/java/org/apache/calcite/runtime/EnumerablesTest.java +++ b/core/src/test/java/org/apache/calcite/runtime/EnumerablesTest.java @@ -122,52 +122,104 @@ public class EnumerablesTest { + " Emp(30, Greg), Dept(30, Development)]")); } + @Test public void testMergeJoinWithNullKeys() { +assertThat( +EnumerableDefaults.mergeJoin( +Linq4j.asEnumerable( +Arrays.asList( +new Emp(30, "Fred"), +new Emp(20, "Sebastian"), +new Emp(30, "Theodore"), +new Emp(20, "Theodore"), +new Emp(40, null), +new Emp(30, null))), +Linq4j.asEnumerable( +Arrays.asList( +new Dept(15, "Marketing"), +new Dept(20, "Sales"), +new Dept(30, "Theodore"), +new Dept(40, null))), +e -> e.name, +d -> d.name, +(v0, v1) -> v0 + ", " + v1, false, false).toList().toString(), +equalTo("[Emp(30, Theodore), Dept(30, Theodore)," ++ " Emp(20, Theodore), Dept(30, Theodore)]")); + } + @Test public void testMergeJoin2() { // Matching keys at start -assertThat( -intersect(Lists.newArrayList(1, 3, 4), -Lists.newArrayList(1, 4)).toList().toString(), +testIntersect( +Lists.newArrayList(1, 3, 4), +Lists.newArrayList(1, 4), equalTo("[1, 4]")); // Matching key at start and end of right, not of left -assertThat( -intersect(Lists.newArrayList(0, 1, 3, 4, 5), -Lists.newArrayList(1, 4)).toList().toString(), +testIntersect( +Lists.newArrayList(0, 1, 3, 4, 5), +Lists.newArrayList(1, 4), equalTo("[1, 4]")); // Matching key at start and end of left, not right -assertThat( -intersect(Lists.newArrayList(1, 3, 4), -Lists.newArrayList(0, 1, 4, 5)).toList().toString(), +testIntersect( +Lists.newArrayList(1, 3, 4), +Lists.newArrayList(0, 1, 4, 5), equalTo("[1, 4]")); // Matching key not at start or end of left or right -assertThat( -intersect(Lists.newArrayList(0, 2, 3, 4, 5), -Lists.newArrayList(1, 3, 4, 6)).toList().toString(), +testIntersect( +Lists.newArrayList(0, 2, 3, 4, 5), +Lists.newArrayList(1, 3, 4, 6), equalTo("[3, 4]")); } @Test public void testMergeJoin3() { // No overlap -assertThat( -intersect(Lists.newArrayList(0, 2, 4), -Lists.newArrayList(1, 3, 5)).toList().toString(), +testIntersect( +Lists.newArrayList(0, 2, 4), +Lists.newArrayList(1, 3, 5), equalTo("[]")); // Left empty -assertThat( -intersect(new ArrayList<>(), -newArrayList(1, 3, 4, 6)).toList().toString(), +testIntersect( +new ArrayList<>(), +newArrayList(1, 3, 4, 6), equalTo("[]")); // Right empty -assertThat( -intersect(newArrayList(3, 7), -new ArrayList<>()).toList().toString(), +testIntersect( +newArrayList(3, 7), +new ArrayList<>(), equalTo("[]")); // Both empty -assertThat( -intersect(new ArrayList(), -new ArrayList<>()).toList().toString(), +testIntersect( +new ArrayList(), +new ArrayList<>(), equalTo("[]")); } + private static > void testIntersect( + List list0, List list1, org.hamcrest.Matcher matcher) { +assertThat( +intersect(list0, list1).toList().toString(), +matcher); + +// Repeat test with nulls at the end of left / right: result should not be impacted + +// Null at the end of left +list0.add(null); +assertThat( +intersect(list0, list1).toList().toString(), +matcher); + +// Null at the end of right +list0.remove(list0.size() - 1); +list1.add(null); +assertThat( +intersect(list0,
[GitHub] [calcite] rubenada merged pull request #1833: [CALCITE-3828] MergeJoin throws NPE in case of null keys
rubenada merged pull request #1833: [CALCITE-3828] MergeJoin throws NPE in case of null keys URL: https://github.com/apache/calcite/pull/1833 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 With regards, Apache Git Services
[GitHub] [calcite] rubenada merged pull request #1826: [CALCITE-3820] EnumerableDefaults#orderBy should be lazily computed + support enumerator re-initialization
rubenada merged pull request #1826: [CALCITE-3820] EnumerableDefaults#orderBy should be lazily computed + support enumerator re-initialization URL: https://github.com/apache/calcite/pull/1826 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 With regards, Apache Git Services
[calcite] branch master updated: [CALCITE-3820] EnumerableDefaults#orderBy should be lazily computed + support enumerator re-initialization
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 3c70ca4 [CALCITE-3820] EnumerableDefaults#orderBy should be lazily computed + support enumerator re-initialization 3c70ca4 is described below commit 3c70ca47272053a7c1f1f41079b88713da06f29c Author: rubenada AuthorDate: Tue Feb 25 16:54:40 2020 +0100 [CALCITE-3820] EnumerableDefaults#orderBy should be lazily computed + support enumerator re-initialization --- .../test/enumerable/EnumerableJoinTest.java| 80 ++ .../apache/calcite/linq4j/EnumerableDefaults.java | 18 +++-- 2 files changed, 91 insertions(+), 7 deletions(-) diff --git a/core/src/test/java/org/apache/calcite/test/enumerable/EnumerableJoinTest.java b/core/src/test/java/org/apache/calcite/test/enumerable/EnumerableJoinTest.java index 18d0215..aa500ab 100644 --- a/core/src/test/java/org/apache/calcite/test/enumerable/EnumerableJoinTest.java +++ b/core/src/test/java/org/apache/calcite/test/enumerable/EnumerableJoinTest.java @@ -21,11 +21,13 @@ import org.apache.calcite.adapter.enumerable.EnumerableRules; import org.apache.calcite.adapter.java.ReflectiveSchema; import org.apache.calcite.config.CalciteConnectionProperty; import org.apache.calcite.config.Lex; +import org.apache.calcite.interpreter.Bindables; import org.apache.calcite.plan.RelOptPlanner; import org.apache.calcite.rel.core.JoinRelType; import org.apache.calcite.runtime.Hook; import org.apache.calcite.sql.fun.SqlStdOperatorTable; import org.apache.calcite.test.CalciteAssert; +import org.apache.calcite.test.HierarchySchema; import org.apache.calcite.test.JdbcTest; import org.junit.jupiter.api.Test; @@ -218,6 +220,84 @@ public class EnumerableJoinTest { + "empid=150; name=Sebastian; dept_name=Sales; e_deptno=10; d_deptno=10"); } + /** Test case for + * https://issues.apache.org/jira/browse/CALCITE-3820;>[CALCITE-3820] + * EnumerableDefaults#orderBy should be lazily computed + support enumerator + * re-initialization. */ + @Test public void testRepeatUnionWithMergeJoin() { +tester(false, new HierarchySchema()) +.query("?") +.withHook(Hook.PLANNER, (Consumer) planner -> { + planner.addRule(Bindables.BINDABLE_TABLE_SCAN_RULE); + planner.addRule(EnumerableRules.ENUMERABLE_MERGE_JOIN_RULE); + planner.removeRule(EnumerableRules.ENUMERABLE_JOIN_RULE); +}) +// Note: explicit sort is used so EnumerableMergeJoin can actually work +.withRel(builder -> builder +// WITH RECURSIVE delta(empid, name) as ( +// SELECT empid, name FROM emps WHERE empid = 2 +// UNION ALL +// SELECT e.empid, e.name FROM delta d +//JOIN hierarchies h ON d.empid = h.managerid +//JOIN emps eON h.subordinateid = e.empid +// ) +// SELECT empid, name FROM delta +.scan("s", "emps") +.filter( +builder.equals( +builder.field("empid"), +builder.literal(2))) +.project( +builder.field("emps", "empid"), +builder.field("emps", "name")) + +.transientScan("#DELTA#") +.sort(builder.field("empid")) +.scan("s", "hierarchies") +.sort(builder.field("managerid")) +.join( +JoinRelType.INNER, +builder.equals( +builder.field(2, "#DELTA#", "empid"), +builder.field(2, "hierarchies", "managerid"))) +.sort(builder.field("subordinateid")) + +.scan("s", "emps") +.sort(builder.field("empid")) +.join( +JoinRelType.INNER, +builder.equals( +builder.field(2, "hierarchies", "subordinateid"), +builder.field(2, "emps", "empid"))) +.project( +builder.field("emps", "empid"), +builder.field("emps", "name")) +.repeatUnion("#DELTA#", true) +.build() +) +.explainHookMatches("" // It is important to have MergeJoin + EnumerableSort in the plan ++ "EnumerableRepeatUnion(all=[true])\n" ++ " EnumerableTableSpool(readType=[LAZY], writeType=[LAZY], table=[[#DELTA#]])\n" ++ "EnumerableCalc(expr#0..4=[{inputs}], expr#5=[2], expr#6=[=($t0, $t5)], empid=[$t0], name=[$t2], $condition=[$t6])\n" ++ " EnumerableTableScan(table=[[s, emps]])\n" ++ " EnumerableTableSpool(readType=[LAZY], writeType=[LAZY], table=[[#DELTA#]])\n" ++ "EnumerableCalc(expr#0..8=[{inputs}],
[calcite] branch master updated: [CALCITE-3837] AntiJoin with empty right input can always be transformed as its left input
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 e9d302f [CALCITE-3837] AntiJoin with empty right input can always be transformed as its left input e9d302f is described below commit e9d302ffe37531c3e8eb5f657f236fe14d79992e Author: rubenada AuthorDate: Mon Mar 2 14:17:05 2020 +0100 [CALCITE-3837] AntiJoin with empty right input can always be transformed as its left input --- .../main/java/org/apache/calcite/rel/rules/PruneEmptyRules.java| 7 ++- core/src/test/java/org/apache/calcite/test/RelOptRulesTest.java| 2 +- .../src/test/resources/org/apache/calcite/test/RelOptRulesTest.xml | 4 +--- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/core/src/main/java/org/apache/calcite/rel/rules/PruneEmptyRules.java b/core/src/main/java/org/apache/calcite/rel/rules/PruneEmptyRules.java index a8838d8..62e872e 100644 --- a/core/src/main/java/org/apache/calcite/rel/rules/PruneEmptyRules.java +++ b/core/src/main/java/org/apache/calcite/rel/rules/PruneEmptyRules.java @@ -338,11 +338,8 @@ public abstract class PruneEmptyRules { return; } if (join.getJoinType() == JoinRelType.ANTI) { -// "select * from emp anti join dept" is not necessarily empty if dept is empty -if (join.analyzeCondition().isEqui()) { - // In case of anti (equi) join: Join(X, Empty, ANTI) becomes X - call.transformTo(join.getLeft()); -} +// In case of anti join: Join(X, Empty, ANTI) becomes X +call.transformTo(join.getLeft()); return; } call.transformTo(call.builder().push(join).empty().build()); diff --git a/core/src/test/java/org/apache/calcite/test/RelOptRulesTest.java b/core/src/test/java/org/apache/calcite/test/RelOptRulesTest.java index 829a580..728e1fc 100644 --- a/core/src/test/java/org/apache/calcite/test/RelOptRulesTest.java +++ b/core/src/test/java/org/apache/calcite/test/RelOptRulesTest.java @@ -3344,7 +3344,7 @@ public class RelOptRulesTest extends RelOptTestBase { final String planAfter = NL + RelOptUtil.toString(output); final DiffRepository diffRepos = getDiffRepos(); diffRepos.assertEquals("planBefore", "${planBefore}", planBefore); -// Cannot optimize away the join because it is not equi join. +// Plan should be scan("EMP") (i.e. join's left child) diffRepos.assertEquals("planAfter", "${planAfter}", planAfter); } diff --git a/core/src/test/resources/org/apache/calcite/test/RelOptRulesTest.xml b/core/src/test/resources/org/apache/calcite/test/RelOptRulesTest.xml index e18ce5a..bd22930 100644 --- a/core/src/test/resources/org/apache/calcite/test/RelOptRulesTest.xml +++ b/core/src/test/resources/org/apache/calcite/test/RelOptRulesTest.xml @@ -3133,9 +3133,7 @@ LogicalProject(EMPNO=[$0])
[GitHub] [calcite] rubenada merged pull request #1843: [CALCITE-3837] AntiJoin with empty right input can always be transformed as its left input
rubenada merged pull request #1843: [CALCITE-3837] AntiJoin with empty right input can always be transformed as its left input URL: https://github.com/apache/calcite/pull/1843 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 With regards, Apache Git Services