Re: [VOTE] Release apache-calcite-1.23.0 (release candidate 1)

2020-05-18 Thread XING JIN
Thanks, Haisheng ~

Local Calcite build with tests enabled on Linux: *OK*
Calcite-based system test suite: *OK*

Vote:
+1 (non-binding)

Francis Chuang  于2020年5月18日周一 下午2:00写道:

> Thanks for making this release available for voting, Haisheng!
>
> Verified GPG signature - OK
> Verified SHA512 - OK
> Ran tests per HOWTO (./gradlew check) - OK
> Quickly skimmed release notes - OK
> Spotted checked a few JARs in the Maven repository - OK
>
> Environment (OpenJDK:latest docker container):
> Gradle 6.3 (via gradlew)
> Debian GNU/Linux 8
> openjdk version "1.8.0_111"
> OpenJDK Runtime Environment (build 1.8.0_111-8u111-b14-2~bpo8+1-b14)
> OpenJDK 64-Bit Server VM (build 25.111-b14, mixed mode)
>
> My vote is: +1 (binding)
>
> Francis
>
> On 16/05/2020 2:02 pm, Haisheng Yuan wrote:
> > Hi all,
> >
> > I have created a build for Apache Calcite 1.23.0, release
> > candidate 1.
> >
> > Thanks to everyone who has contributed to this release.
> >
> > You can read the release notes here:
> >
> https://github.com/apache/calcite/blob/calcite-1.23.0-rc1/site/_docs/history.md
> >
> > The commit to be voted upon:
> >
> https://gitbox.apache.org/repos/asf?p=calcite.git;a=commit;h=b708fdc46d4c5fd4c5a6c7a398823318a7b4dce3
> >
> > Its hash is b708fdc46d4c5fd4c5a6c7a398823318a7b4dce3
> >
> > Tag:
> > https://github.com/apache/calcite/tree/calcite-1.23.0-rc1
> >
> > The artifacts to be voted on are located here:
> > https://dist.apache.org/repos/dist/dev/calcite/apache-calcite-1.23.0-rc1
> > (revision 39622)
> >
> > The hashes of the artifacts are as follows:
> >
> 961c4f13199e199c669a6168ba655a9492bdd80d644da375a684b732c0b628b8a2ffacea5da97c82e8702a8e3bf7a1f58784baa49509fb3c48ef593259e11f46
> > *apache-calcite-1.23.0-src.tar.gz
> >
> > A staged Maven repository is available for review at:
> >
> https://repository.apache.org/content/repositories/orgapachecalcite-1089/org/apache/calcite/
> >
> > Release artifacts are signed with the following key:
> > https://dist.apache.org/repos/dist/release/calcite/KEYS
> >
> > N.B.
> > To create the jars and test Apache Calcite: "./gradlew build".
> >
> > If you do not have a Java environment available, you can run the tests
> > using docker. To do so, install docker and docker-compose, then run
> > "docker-compose run test" from the root of the directory.
> >
> > Please vote on releasing this package as Apache Calcite 1.23.0.
> >
> > The vote is open for the next 72 hours and passes if a majority of at
> > least three +1 PMC votes are cast.
> >
> > [ ] +1 Release this package as Apache Calcite 1.23.0
> > [ ]  0 I don't feel strongly about it, but I'm okay with the release
> > [ ] -1 Do not release this package because...
> >
> >
> > Here is my vote:
> >
> > +1 (binding)
> >
> > Thanks,
> > Haisheng Yuan
> >
>


Re: [VOTE] Release apache-calcite-1.23.0 (release candidate 1)

2020-05-18 Thread Feng Zhu
Thanks for work, Haisheng!

Environment: Windows-10/Mac-OS
JDK version: 1.8.0_241

Release notes: OK
Build with tests: OK
Checksums and signatures: OK

Vote: +1 (non-binding)

Haisheng Yuan  于2020年5月16日周六 下午12:02写道:

> Hi all,
>
> I have created a build for Apache Calcite 1.23.0, release
> candidate 1.
>
> Thanks to everyone who has contributed to this release.
>
> You can read the release notes here:
>
> https://github.com/apache/calcite/blob/calcite-1.23.0-rc1/site/_docs/history.md
>
> The commit to be voted upon:
>
> https://gitbox.apache.org/repos/asf?p=calcite.git;a=commit;h=b708fdc46d4c5fd4c5a6c7a398823318a7b4dce3
>
> Its hash is b708fdc46d4c5fd4c5a6c7a398823318a7b4dce3
>
> Tag:
> https://github.com/apache/calcite/tree/calcite-1.23.0-rc1
>
> The artifacts to be voted on are located here:
> https://dist.apache.org/repos/dist/dev/calcite/apache-calcite-1.23.0-rc1
> (revision 39622)
>
> The hashes of the artifacts are as follows:
>
> 961c4f13199e199c669a6168ba655a9492bdd80d644da375a684b732c0b628b8a2ffacea5da97c82e8702a8e3bf7a1f58784baa49509fb3c48ef593259e11f46
> *apache-calcite-1.23.0-src.tar.gz
>
> A staged Maven repository is available for review at:
>
> https://repository.apache.org/content/repositories/orgapachecalcite-1089/org/apache/calcite/
>
> Release artifacts are signed with the following key:
> https://dist.apache.org/repos/dist/release/calcite/KEYS
>
> N.B.
> To create the jars and test Apache Calcite: "./gradlew build".
>
> If you do not have a Java environment available, you can run the tests
> using docker. To do so, install docker and docker-compose, then run
> "docker-compose run test" from the root of the directory.
>
> Please vote on releasing this package as Apache Calcite 1.23.0.
>
> The vote is open for the next 72 hours and passes if a majority of at
> least three +1 PMC votes are cast.
>
> [ ] +1 Release this package as Apache Calcite 1.23.0
> [ ]  0 I don't feel strongly about it, but I'm okay with the release
> [ ] -1 Do not release this package because...
>
>
> Here is my vote:
>
> +1 (binding)
>
> Thanks,
> Haisheng Yuan
>


[jira] [Created] (CALCITE-4010) Revise codegen for EnumerableMergeJoin to accept any sort order

2020-05-18 Thread Haisheng Yuan (Jira)
Haisheng Yuan created CALCITE-4010:
--

 Summary: Revise codegen for EnumerableMergeJoin to accept any sort 
order
 Key: CALCITE-4010
 URL: https://issues.apache.org/jira/browse/CALCITE-4010
 Project: Calcite
  Issue Type: Improvement
  Components: core
Reporter: Haisheng Yuan


Given MergeJoin on foo.a=bar.a and foo.b=bar.b,
The codegen for EnumerableMergeJoin always sort tuples by (a,b), but after 
1.23.0 calcite can generate MergeJoin on collation of (b,a), or even (a,b,c), 
(b,a,c), with any asc/desc, null direction, which are all legit. So the codegen 
should sort tuples exactly according to the requirement of collation.

See 
https://github.com/apache/calcite/blob/master/linq4j/src/main/java/org/apache/calcite/linq4j/EnumerableDefaults.java#L1966
and
https://github.com/apache/calcite/pull/1833



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Created] (CALCITE-4009) Revert traitset mapping that was added to ProjectJoinTransposeRule

2020-05-18 Thread Haisheng Yuan (Jira)
Haisheng Yuan created CALCITE-4009:
--

 Summary: Revert traitset mapping that was added to 
ProjectJoinTransposeRule
 Key: CALCITE-4009
 URL: https://issues.apache.org/jira/browse/CALCITE-4009
 Project: Calcite
  Issue Type: Improvement
  Components: core
Reporter: Haisheng Yuan


Revert traitset mapping that was added to ProjectJoinTransposeRule by 
CALCITE-3353. Now it becomes obsolete, we should fail fast if that happens. 
Otherwise, all the downstream projects that uses this rule will be wasted time 
to deal with traitsets they don't need.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Created] (CALCITE-4008) Implement Code generation for EnumerableSortedAggregate

2020-05-18 Thread Haisheng Yuan (Jira)
Haisheng Yuan created CALCITE-4008:
--

 Summary: Implement Code generation for EnumerableSortedAggregate
 Key: CALCITE-4008
 URL: https://issues.apache.org/jira/browse/CALCITE-4008
 Project: Calcite
  Issue Type: Improvement
  Components: core
Reporter: Haisheng Yuan


EnumerableSortedAggregate is added in 1.23.0, but doesn't implement code 
generation. It would be nice if we can add code generation for it, so that more 
efficient plan can be generated and used for some queries, e.g.

{code:java}
select foo.a, max(b) from
   foo join bar on foo.a=bar.a 
   group by a order by a desc;
{code}





--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Created] (CALCITE-4007) MergeJoin collation check should not be limited to join key's order

2020-05-18 Thread Haisheng Yuan (Jira)
Haisheng Yuan created CALCITE-4007:
--

 Summary: MergeJoin collation check should not be limited to join 
key's order
 Key: CALCITE-4007
 URL: https://issues.apache.org/jira/browse/CALCITE-4007
 Project: Calcite
  Issue Type: Improvement
  Components: core
Reporter: Haisheng Yuan


Given MergeJoin on foo.a=bar.a and foo.b=bar.b,
The collation check on MergeJoin always require it is sorted by (a,b), but 
after 1.23.0 calcite can generate MergeJoin on collation of (b,a), or even 
(a,b,c), (b,a,c), which are all legit. We should relax the check condition.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


Re: Adapter usage of RexImpTable

2020-05-18 Thread Rui Wang
RexToLixTranslator offers some public static methods to help you translate
things to expressions (Ling4j). E.g. RexToLixTranslator.translateProjects
might be what you need the most.

After you get expressions, a way I know to execute it is by utilizing
Janino [1] to compile expressions to bytecode and execute the bytecode
directly. The following are some code examples how Apache Beam is doing:

1. translate projects to expressions. [2]
2. compile expressions. [3]
3. execute the compiled code. [4]


[1]: https://janino-compiler.github.io/janino/
[2]:
https://github.com/apache/beam/blob/master/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/rel/BeamCalcRel.java#L159
[3]:
https://github.com/apache/beam/blob/7c80ecb8c354575e4332f0f1731f1b5a3f0c4362/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/rel/BeamCalcRel.java#L232
[4]:
https://github.com/apache/beam/blob/7c80ecb8c354575e4332f0f1731f1b5a3f0c4362/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/rel/BeamCalcRel.java#L259


-Rui

On Mon, May 18, 2020 at 7:43 AM Jon Pither  wrote:

> Hi,
>
> Is it possible for an adapter to leverage RexImpTable to handle
> calculations?
>
> From RexImpTable I can get an Implementor for a given operation in a
> RexCall, but then the implement method that would generate an expression,
> takes a RexToLixTranslator. The RexToLixTranslator has a private
> constructor, so I'm not sure how to get hold of one. I also couldn't find
> any supporting prior art in the various adapters in the code-base.
>
> Does my approach make sense, to want to use Calcite for
> handling calculations across projects, filters & join conditions?
>
> Context is that our database is a rule-engine that runs in-process - I want
> to pass it arbitrary functions that could potentially wrap Linq
> expressions, to implement a wider range of SQL backed by Calcite.
>
> Regards,
>
> Jon.
>


Adapter usage of RexImpTable

2020-05-18 Thread Jon Pither
Hi,

Is it possible for an adapter to leverage RexImpTable to handle
calculations?

>From RexImpTable I can get an Implementor for a given operation in a
RexCall, but then the implement method that would generate an expression,
takes a RexToLixTranslator. The RexToLixTranslator has a private
constructor, so I'm not sure how to get hold of one. I also couldn't find
any supporting prior art in the various adapters in the code-base.

Does my approach make sense, to want to use Calcite for
handling calculations across projects, filters & join conditions?

Context is that our database is a rule-engine that runs in-process - I want
to pass it arbitrary functions that could potentially wrap Linq
expressions, to implement a wider range of SQL backed by Calcite.

Regards,

Jon.


[jira] [Created] (CALCITE-4006) Add ordered-set aggregate functions

2020-05-18 Thread Zoltan Haindrich (Jira)
Zoltan Haindrich created CALCITE-4006:
-

 Summary: Add ordered-set aggregate functions
 Key: CALCITE-4006
 URL: https://issues.apache.org/jira/browse/CALCITE-4006
 Project: Calcite
  Issue Type: Improvement
Reporter: Zoltan Haindrich


* mode
* percentile_cont
* percentile_disc



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


Re: [VOTE] Release apache-calcite-1.23.0 (release candidate 1)

2020-05-18 Thread Francis Chuang

Thanks for making this release available for voting, Haisheng!

Verified GPG signature - OK
Verified SHA512 - OK
Ran tests per HOWTO (./gradlew check) - OK
Quickly skimmed release notes - OK
Spotted checked a few JARs in the Maven repository - OK

Environment (OpenJDK:latest docker container):
Gradle 6.3 (via gradlew)
Debian GNU/Linux 8
openjdk version "1.8.0_111"
OpenJDK Runtime Environment (build 1.8.0_111-8u111-b14-2~bpo8+1-b14)
OpenJDK 64-Bit Server VM (build 25.111-b14, mixed mode)

My vote is: +1 (binding)

Francis

On 16/05/2020 2:02 pm, Haisheng Yuan wrote:

Hi all,

I have created a build for Apache Calcite 1.23.0, release
candidate 1.

Thanks to everyone who has contributed to this release.

You can read the release notes here:
https://github.com/apache/calcite/blob/calcite-1.23.0-rc1/site/_docs/history.md

The commit to be voted upon:
https://gitbox.apache.org/repos/asf?p=calcite.git;a=commit;h=b708fdc46d4c5fd4c5a6c7a398823318a7b4dce3

Its hash is b708fdc46d4c5fd4c5a6c7a398823318a7b4dce3

Tag:
https://github.com/apache/calcite/tree/calcite-1.23.0-rc1

The artifacts to be voted on are located here:
https://dist.apache.org/repos/dist/dev/calcite/apache-calcite-1.23.0-rc1
(revision 39622)

The hashes of the artifacts are as follows:
961c4f13199e199c669a6168ba655a9492bdd80d644da375a684b732c0b628b8a2ffacea5da97c82e8702a8e3bf7a1f58784baa49509fb3c48ef593259e11f46
*apache-calcite-1.23.0-src.tar.gz

A staged Maven repository is available for review at:
https://repository.apache.org/content/repositories/orgapachecalcite-1089/org/apache/calcite/

Release artifacts are signed with the following key:
https://dist.apache.org/repos/dist/release/calcite/KEYS

N.B.
To create the jars and test Apache Calcite: "./gradlew build".

If you do not have a Java environment available, you can run the tests
using docker. To do so, install docker and docker-compose, then run
"docker-compose run test" from the root of the directory.

Please vote on releasing this package as Apache Calcite 1.23.0.

The vote is open for the next 72 hours and passes if a majority of at
least three +1 PMC votes are cast.

[ ] +1 Release this package as Apache Calcite 1.23.0
[ ]  0 I don't feel strongly about it, but I'm okay with the release
[ ] -1 Do not release this package because...


Here is my vote:

+1 (binding)

Thanks,
Haisheng Yuan