Re: how to validate a sql is optimize

2018-08-30 Thread Michael Mior
Unfortunately, I can't parse the question you're asking. You'll have to
provide more details to receive a useful response.

--
Michael Mior
mm...@apache.org



Le mer. 29 août 2018 à 03:01, 毛秀庆  a écrit :

>
>
>  when input a SQL, then output what is optimized by calcite ?
>
>  how the code write ?
>
>
>
>


Re: JSON support

2018-08-30 Thread Michael Mior
Thanks for the clarification :)
--
Michael Mior
mm...@apache.org



Le mer. 29 août 2018 à 19:28, Julian Hyde  a écrit :

> The rules for Parser.jj are a little different. JavaCC needs to parse the
> Java fragments inside rules and sometimes it can’t handle modern Java
> syntax such as “new ArrayList<>()”.
>
> > On Aug 29, 2018, at 1:16 PM, Michael Mior  wrote:
> >
> > One thing that jumped out to me was the use of an explicit type when
> > calling the ArrayList constructor in the parser. I initially thought this
> > was something that Julian had gotten rid of in his big update to support
> > Java 8 syntax. However, I see this still persists in Parser.jj . Is this
> > intentional?
> > --
> > Michael Mior
> > mm...@apache.org
> >
> >
> >
> > Le mer. 29 août 2018 à 16:11, Julian Hyde  a écrit :
> >
> >> Somehow I missed this… we have a pull request for JSON support. It’s a
> big
> >> change (both in terms of importance and the amount of effort).
> >>
> >> https://github.com/apache/calcite/pull/785 <
> >> https://github.com/apache/calcite/pull/785>
> >>
> >> https://issues.apache.org/jira/browse/CALCITE-2266 <
> >> https://issues.apache.org/jira/browse/CALCITE-2266>
> >>
> >> I made a quick review, and it looks good. I see Vladimir has reviewed.
> Can
> >> someone else (not necessarily a committer) take a look?
> >>
> >> Julian
> >>
> >>
> >>
>
>


identifying original SQL functions after rewrites (in adapters)

2018-08-30 Thread Andrei Sereda
Hello,

I’m trying to implement COALESCE for elastic adapter and would like to know
what is recommended approach to identify original function (after possible
rewrites).

Let me give an example.

Currently calcite converts COALESCE(attr, 'foo') into CASE(IS NOT
NULL(attr), attr, 'foo'). So in adapter I have to traverse RexCall and
check kind=CASE and operators[0] == IS NOT NULL and operators[1] ==
INPUT_REF and operators[2] is literal to properly convert this call into
native elastic operation. Elastic has something similar

to
coalesce (missing value) but not a generic case statement.

What if tomorrow calcite decides to keep coalesce as is or rewrite to CASE(IS
NULL(attr),'foo', attr) ? It seems to me that trying all possible
combinations is a wrong thing to do (correct me if I’m wrong).

How can I make this logic future-proof ?

Thanks,

Andrei.


Re: [VOTE] Release calcite-avatica-go-3.1.0 (release candidate 0)

2018-08-30 Thread Michael Mior
Thanks Francis. I thought I recalled Docker being an option but I missed in
the documentation. I get the failure message below. Other than that, tests
pass.

calcite-avatica-go_1 | --- FAIL: TestPhoenixOptimisticConcurrency (46.12s)
calcite-avatica-go_1 | driver_test.go:95: error on exec CREATE TABLE
test15356434203761149952 (
calcite-avatica-go_1 | id INTEGER PRIMARY KEY, calcite-avatica-go_1 | msg
VARCHAR,
calcite-avatica-go_1 | version INTEGER
calcite-avatica-go_1 | ) TRANSACTIONAL=true: An error was encountered while
processing your request: RuntimeException:
org.apache.phoenix.shaded.org.apache.thrift.TException: Unable to discover
transaction service. -> TException: Unable to discover transaction service

--
Michael Mior
mm...@apache.org



Le mer. 29 août 2018 à 20:44, Francis Chuang  a
écrit :

> Hey Michael,
>
> If you have docker and docker-compose installed on your machine, you can
> run: "docker-compose up --build" from the root of the directory. This
> will automatically run all tests (around 5 minutes).
>
> Francis
>
> On 30/08/2018 9:55 AM, Michael Mior wrote:
> > +1 (binding)
> >
> > Checked hash and signature and compiled. Did not run tests since I don't
> > currently have Avatica set up on my new dev box.
> >
> > --
> > Michael Mior
> > mm...@apache.org
> >
> >
> > Le mer. 29 août 2018 à 19:22, Francis Chuang 
> a
> > écrit :
> >
> >> Hi all,
> >>
> >> I have created a release for Apache Calcite Avatica Go 3.1.0, release
> >> candidate 0.
> >>
> >> The release notes are available here:
> >>
> https://github.com/apache/calcite-avatica-go/blob/master/site/go_history.md
> >>
> >> The commit to be voted on:
> >>
> >>
> http://git-wip-us.apache.org/repos/asf/calcite-avatica-go/commit/d328101ff81f0dc51db8dc5c62b4205a4cf0a48d
> >>
> >> The hash is d328101ff81f0dc51db8dc5c62b4205a4cf0a48d
> >>
> >> The artifacts to be voted on are located here:
> >>
> >>
> https://dist.apache.org/repos/dist/dev/calcite/apache-calcite-avatica-go-3.1.0-rc0/
> >>
> >> The hashes of the artifacts are as follows:
> >>
> >> src.tar.gz.sha256 497418D1 A017C97F 121CFD21 6DB1FE6B F0D536F6 CB32570C
> >> 232D59D0 B479CFA7
> >>
> >> Release artifacts are signed with the following key:
> >> https://people.apache.org/keys/committer/francischuang.asc
> >>
> >> Instructions for running the test suite is located here:
> >>
> >>
> https://github.com/apache/calcite-avatica-go/blob/master/site/develop/avatica-go.md#testing
> >>
> >> Please vote on releasing this package as Apache Calcite Avatica Go
> 3.1.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 Avatica Go 3.0.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)
> >>
> >> Francis
> >>
> >>
> >>
>
>


Re: [VOTE] Release calcite-avatica-go-3.1.0 (release candidate 0)

2018-08-30 Thread Josh Elser
That looks like an issue with Phoenix+Tephra rather than with the Go 
driver. The latest release of Tephra (going through IPMC vote now) 
should be fixing that.


Essentially, Tephra had an issue where it was trying to get a random 
port and then bind it in two separate steps. Sometimes, some other 
process would come along and bind that port before Tephra would, and 
then the Tephra service wouldn't start (and you'd get that message).


On 8/30/18 11:41 AM, Michael Mior wrote:

Thanks Francis. I thought I recalled Docker being an option but I missed in
the documentation. I get the failure message below. Other than that, tests
pass.

calcite-avatica-go_1 | --- FAIL: TestPhoenixOptimisticConcurrency (46.12s)
calcite-avatica-go_1 | driver_test.go:95: error on exec CREATE TABLE
test15356434203761149952 (
calcite-avatica-go_1 | id INTEGER PRIMARY KEY, calcite-avatica-go_1 | msg
VARCHAR,
calcite-avatica-go_1 | version INTEGER
calcite-avatica-go_1 | ) TRANSACTIONAL=true: An error was encountered while
processing your request: RuntimeException:
org.apache.phoenix.shaded.org.apache.thrift.TException: Unable to discover
transaction service. -> TException: Unable to discover transaction service

--
Michael Mior
mm...@apache.org



Le mer. 29 août 2018 à 20:44, Francis Chuang  a
écrit :


Hey Michael,

If you have docker and docker-compose installed on your machine, you can
run: "docker-compose up --build" from the root of the directory. This
will automatically run all tests (around 5 minutes).

Francis

On 30/08/2018 9:55 AM, Michael Mior wrote:

+1 (binding)

Checked hash and signature and compiled. Did not run tests since I don't
currently have Avatica set up on my new dev box.

--
Michael Mior
mm...@apache.org


Le mer. 29 août 2018 à 19:22, Francis Chuang 

a

écrit :


Hi all,

I have created a release for Apache Calcite Avatica Go 3.1.0, release
candidate 0.

The release notes are available here:


https://github.com/apache/calcite-avatica-go/blob/master/site/go_history.md


The commit to be voted on:



http://git-wip-us.apache.org/repos/asf/calcite-avatica-go/commit/d328101ff81f0dc51db8dc5c62b4205a4cf0a48d


The hash is d328101ff81f0dc51db8dc5c62b4205a4cf0a48d

The artifacts to be voted on are located here:



https://dist.apache.org/repos/dist/dev/calcite/apache-calcite-avatica-go-3.1.0-rc0/


The hashes of the artifacts are as follows:

src.tar.gz.sha256 497418D1 A017C97F 121CFD21 6DB1FE6B F0D536F6 CB32570C
232D59D0 B479CFA7

Release artifacts are signed with the following key:
https://people.apache.org/keys/committer/francischuang.asc

Instructions for running the test suite is located here:



https://github.com/apache/calcite-avatica-go/blob/master/site/develop/avatica-go.md#testing


Please vote on releasing this package as Apache Calcite Avatica Go

3.1.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 Avatica Go 3.0.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)

Francis










Re: [VOTE] Release calcite-avatica-go-3.1.0 (release candidate 0)

2018-08-30 Thread Michael Mior
Yeah, I assumed it probably wasn't an Avatica issue. I maintain my +1.
--
Michael Mior
mm...@apache.org



Le jeu. 30 août 2018 à 11:54, Josh Elser  a écrit :

> That looks like an issue with Phoenix+Tephra rather than with the Go
> driver. The latest release of Tephra (going through IPMC vote now)
> should be fixing that.
>
> Essentially, Tephra had an issue where it was trying to get a random
> port and then bind it in two separate steps. Sometimes, some other
> process would come along and bind that port before Tephra would, and
> then the Tephra service wouldn't start (and you'd get that message).
>
> On 8/30/18 11:41 AM, Michael Mior wrote:
> > Thanks Francis. I thought I recalled Docker being an option but I missed
> in
> > the documentation. I get the failure message below. Other than that,
> tests
> > pass.
> >
> > calcite-avatica-go_1 | --- FAIL: TestPhoenixOptimisticConcurrency
> (46.12s)
> > calcite-avatica-go_1 | driver_test.go:95: error on exec CREATE TABLE
> > test15356434203761149952 (
> > calcite-avatica-go_1 | id INTEGER PRIMARY KEY, calcite-avatica-go_1 | msg
> > VARCHAR,
> > calcite-avatica-go_1 | version INTEGER
> > calcite-avatica-go_1 | ) TRANSACTIONAL=true: An error was encountered
> while
> > processing your request: RuntimeException:
> > org.apache.phoenix.shaded.org.apache.thrift.TException: Unable to
> discover
> > transaction service. -> TException: Unable to discover transaction
> service
> >
> > --
> > Michael Mior
> > mm...@apache.org
> >
> >
> >
> > Le mer. 29 août 2018 à 20:44, Francis Chuang 
> a
> > écrit :
> >
> >> Hey Michael,
> >>
> >> If you have docker and docker-compose installed on your machine, you can
> >> run: "docker-compose up --build" from the root of the directory. This
> >> will automatically run all tests (around 5 minutes).
> >>
> >> Francis
> >>
> >> On 30/08/2018 9:55 AM, Michael Mior wrote:
> >>> +1 (binding)
> >>>
> >>> Checked hash and signature and compiled. Did not run tests since I
> don't
> >>> currently have Avatica set up on my new dev box.
> >>>
> >>> --
> >>> Michael Mior
> >>> mm...@apache.org
> >>>
> >>>
> >>> Le mer. 29 août 2018 à 19:22, Francis Chuang  >
> >> a
> >>> écrit :
> >>>
>  Hi all,
> 
>  I have created a release for Apache Calcite Avatica Go 3.1.0, release
>  candidate 0.
> 
>  The release notes are available here:
> 
> >>
> https://github.com/apache/calcite-avatica-go/blob/master/site/go_history.md
> 
>  The commit to be voted on:
> 
> 
> >>
> http://git-wip-us.apache.org/repos/asf/calcite-avatica-go/commit/d328101ff81f0dc51db8dc5c62b4205a4cf0a48d
> 
>  The hash is d328101ff81f0dc51db8dc5c62b4205a4cf0a48d
> 
>  The artifacts to be voted on are located here:
> 
> 
> >>
> https://dist.apache.org/repos/dist/dev/calcite/apache-calcite-avatica-go-3.1.0-rc0/
> 
>  The hashes of the artifacts are as follows:
> 
>  src.tar.gz.sha256 497418D1 A017C97F 121CFD21 6DB1FE6B F0D536F6
> CB32570C
>  232D59D0 B479CFA7
> 
>  Release artifacts are signed with the following key:
>  https://people.apache.org/keys/committer/francischuang.asc
> 
>  Instructions for running the test suite is located here:
> 
> 
> >>
> https://github.com/apache/calcite-avatica-go/blob/master/site/develop/avatica-go.md#testing
> 
>  Please vote on releasing this package as Apache Calcite Avatica Go
> >> 3.1.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 Avatica Go 3.0.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)
> 
>  Francis
> 
> 
> 
> >>
> >>
> >
>


Re: [VOTE] Release calcite-avatica-go-3.1.0 (release candidate 0)

2018-08-30 Thread Francis Chuang
Thanks for testing Michael! I just tried testing using docker on a VM 
with a lot of RAM and was not able to reproduce the issue. The Phoenix 
image I am using is boostport/hbase-phoenix-all-in-one:2.0-5.0.


I am going to cancel the vote and roll a new RC as I neglected to update 
the dockerfile so that Go modules work correctly. This meant that if 
tests are executed using docker-compose, they will not run correctly. My 
apologies for the oversight.


I will release a rc1 for voting soon.

Francis

On 31/08/2018 4:14 AM, Michael Mior wrote:

Yeah, I assumed it probably wasn't an Avatica issue. I maintain my +1.
--
Michael Mior
mm...@apache.org



Le jeu. 30 août 2018 à 11:54, Josh Elser  a écrit :


That looks like an issue with Phoenix+Tephra rather than with the Go
driver. The latest release of Tephra (going through IPMC vote now)
should be fixing that.

Essentially, Tephra had an issue where it was trying to get a random
port and then bind it in two separate steps. Sometimes, some other
process would come along and bind that port before Tephra would, and
then the Tephra service wouldn't start (and you'd get that message).

On 8/30/18 11:41 AM, Michael Mior wrote:

Thanks Francis. I thought I recalled Docker being an option but I missed

in

the documentation. I get the failure message below. Other than that,

tests

pass.

calcite-avatica-go_1 | --- FAIL: TestPhoenixOptimisticConcurrency

(46.12s)

calcite-avatica-go_1 | driver_test.go:95: error on exec CREATE TABLE
test15356434203761149952 (
calcite-avatica-go_1 | id INTEGER PRIMARY KEY, calcite-avatica-go_1 | msg
VARCHAR,
calcite-avatica-go_1 | version INTEGER
calcite-avatica-go_1 | ) TRANSACTIONAL=true: An error was encountered

while

processing your request: RuntimeException:
org.apache.phoenix.shaded.org.apache.thrift.TException: Unable to

discover

transaction service. -> TException: Unable to discover transaction

service

--
Michael Mior
mm...@apache.org



Le mer. 29 août 2018 à 20:44, Francis Chuang 

a

écrit :


Hey Michael,

If you have docker and docker-compose installed on your machine, you can
run: "docker-compose up --build" from the root of the directory. This
will automatically run all tests (around 5 minutes).

Francis

On 30/08/2018 9:55 AM, Michael Mior wrote:

+1 (binding)

Checked hash and signature and compiled. Did not run tests since I

don't

currently have Avatica set up on my new dev box.

--
Michael Mior
mm...@apache.org


Le mer. 29 août 2018 à 19:22, Francis Chuang 
a

écrit :


Hi all,

I have created a release for Apache Calcite Avatica Go 3.1.0, release
candidate 0.

The release notes are available here:


https://github.com/apache/calcite-avatica-go/blob/master/site/go_history.md

The commit to be voted on:



http://git-wip-us.apache.org/repos/asf/calcite-avatica-go/commit/d328101ff81f0dc51db8dc5c62b4205a4cf0a48d

The hash is d328101ff81f0dc51db8dc5c62b4205a4cf0a48d

The artifacts to be voted on are located here:



https://dist.apache.org/repos/dist/dev/calcite/apache-calcite-avatica-go-3.1.0-rc0/

The hashes of the artifacts are as follows:

src.tar.gz.sha256 497418D1 A017C97F 121CFD21 6DB1FE6B F0D536F6

CB32570C

232D59D0 B479CFA7

Release artifacts are signed with the following key:
https://people.apache.org/keys/committer/francischuang.asc

Instructions for running the test suite is located here:



https://github.com/apache/calcite-avatica-go/blob/master/site/develop/avatica-go.md#testing

Please vote on releasing this package as Apache Calcite Avatica Go

3.1.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 Avatica Go 3.0.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)

Francis









Re: Maven wrapper

2018-08-30 Thread Julian Hyde
Please review https://github.com/julianhyde/calcite/tree/2112-mvnw 
, and give it a try in 
your own sandbox.

I have built on the original patch. We no longer need to include a .jar or 
.java. And I’ve updated the documentation to use ‘./mvnw’ rather than ‘mvn’.

Julian


> On Aug 28, 2018, at 10:35 AM, Julian Hyde  wrote:
> 
>> On Aug 28, 2018, at 8:10 AM, Josh Elser  wrote:
>> 
>> Is it worthwhile to share the details of that situation with the community 
>> (or are the specifics you provided all that's really relevant)? Asking to 
>> better understand if there is some legitimate criticism of what Maven lets 
>> you do, or if it's something we can make better in Calcite itself.
> 
> This particular case was a consultant for my company for whom I was building 
> a custom version of Calcite. The consultant is technical and uses git all the 
> time, has a JVM installed on his machine (mainly for JRuby), but does not do 
> Java development, therefore does not have maven. 
> 
> Since his machine is macOS it was straightforward to do “brew install maven”. 
> (Which took about 20 minutes, because he first had to upgrade home-brew.)
> 
> Clearly it was not that hard for him to install maven, but if we used mvnw we 
> could remove even that friction.
> 
>> As long as we don't create a schism where some things can only be done by 
>> mvnw, I'm OK with this change.
> 
> I promise that won’t happen.
> 
> I believe that if you have mvn installed, mvnw will use it. Therefore most 
> developers will continue to use the same path, regardless of whether they 
> type “mvn” or “./mvnw”. I will continue to type “mvn”.
> 
> Julan



[VOTE] Release calcite-avatica-go-3.1.0 (release candidate 1)

2018-08-30 Thread Francis Chuang

Hi all,

I have created a release for Apache Calcite Avatica Go 3.1.0, release
candidate 1.

The release notes are available here:
https://github.com/apache/calcite-avatica-go/blob/master/site/_docs/go_history.md

The commit to be voted on:
http://git-wip-us.apache.org/repos/asf/calcite-avatica-go/commit/f564cfa42948b9a5c4c7f98f3e43ab5971bcaeda

The hash is f564cfa42948b9a5c4c7f98f3e43ab5971bcaeda

The artifacts to be voted on are located here:
https://dist.apache.org/repos/dist/dev/calcite/apache-calcite-avatica-go-3.1.0-rc1/

The hashes of the artifacts are as follows:

src.tar.gz.sha256 64BC4D9D 197457DC B0573F12 4A75A298 CB5207D6 FDC14DCB 
675FF731 0555F5A3

Release artifacts are signed with the following key:
https://people.apache.org/keys/committer/francischuang.asc

Instructions for running the test suite is located here:
https://github.com/apache/calcite-avatica-go/blob/master/site/develop/avatica-go.md#testing

Please vote on releasing this package as Apache Calcite Avatica Go 3.1.0.

To run the tests without a Go environment, install docker and docker-compose. 
Then, in the root of the release's directory, run:
docker-compose up --build

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 Avatica Go 3.0.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)

Francis



[CANCEL][VOTE] Release calcite-avatica-go-3.1.0 (release candidate 0)

2018-08-30 Thread Francis Chuang
The vote for Apache Calcite Avatica Go 3.1.0, release candidate 0 has 
been cancelled.


A new release will be tagged as 3.1.0-rc1 and will be available for 
voting soon.


Francis


[jira] [Created] (CALCITE-2513) Fix dockerfile for running tests using docker-compose to work with Go modules

2018-08-30 Thread Francis Chuang (JIRA)
Francis Chuang created CALCITE-2513:
---

 Summary: Fix dockerfile for running tests using docker-compose to 
work with Go modules
 Key: CALCITE-2513
 URL: https://issues.apache.org/jira/browse/CALCITE-2513
 Project: Calcite
  Issue Type: Task
  Components: avatica-go
Affects Versions: avatica-go-3.1.0
Reporter: Francis Chuang
Assignee: Francis Chuang


While updating avatica-go to use Go modules, I forgot to update the dockerfile 
for running tests to work with Go modules.

The fix is to found the source code outside the GOPATH, so that Go will 
download the dependencies using Go modules when running tests.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


Re: joins and low selectivity optimization

2018-08-30 Thread Vineet Garg
Hive actually does this optimization (it is called semi-join reduction) by 
generating bloom-filters on one side and passing it on to the other side.
This is not a rewrite but instead a physical implementation.

Vineet

On Aug 29, 2018, at 10:34 AM, Vladimir Sitnikov 
mailto:sitnikov.vladi...@gmail.com>> wrote:

Nested loops are never likely to happe

What's wrong with that?

Apparently Andrei asks for that, and "subquery precomputation" is quite
close to nested loops in my opinion.

Vladimir



[jira] [Created] (CALCITE-2510) CHR support

2018-08-30 Thread Sergey Tsvetkov (JIRA)
Sergey Tsvetkov created CALCITE-2510:


 Summary: CHR support
 Key: CALCITE-2510
 URL: https://issues.apache.org/jira/browse/CALCITE-2510
 Project: Calcite
  Issue Type: Task
  Components: core
Reporter: Sergey Tsvetkov
Assignee: Julian Hyde


Adding CHR() function support, available in Oracle & PostgreSql

[https://docs.oracle.com/cd/B19306_01/server.102/b14200/functions019.htm]

[https://www.postgresql.org/docs/9.4/static/functions-string.html]

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Created] (CALCITE-2511) Possible bug in parsing implementation of rown_num select

2018-08-30 Thread Piotr Bojko (JIRA)
Piotr Bojko created CALCITE-2511:


 Summary: Possible bug in parsing implementation of rown_num select
 Key: CALCITE-2511
 URL: https://issues.apache.org/jira/browse/CALCITE-2511
 Project: Calcite
  Issue Type: Bug
  Components: core
Affects Versions: 1.17.0, 1.18.0
Reporter: Piotr Bojko
Assignee: Julian Hyde
 Attachments: implementation.java

I've found a possible bug.

With following view:

{code:json}
{
"name": "STEPS",
"type": "view",
"sql": [
"WITH ALLROWS AS ( ",
" SELECT ",
"   ROW_NUMBER() OVER W AS IDX, 
I.ID ISSUE, COALESCE(CG.AUTHOR, I.REPORTER) AS AUTHOR, COALESCE(CI.OLDVALUE, 
I.STATUS) AS STATUS, I.CREATED AS STARTDATE, CG.CREATED AS ENDDATE ",
" FROM ISSUES AS I ",
" JOIN INTERNAL.CHANGEGROUP AS 
CG ON CG.ISSUEID = I.ID ",
" JOIN INTERNAL.CHANGEITEM AS 
CI ON CI.GROUPID = CG.ID ",
" WHERE CI.FIELDTYPE = 'jira' 
AND CI.FIELD = 'status' ",
" WINDOW w AS (PARTITION BY 
i.id ORDER BY CG.CREATED) ",
") ",
"SELECT ISSUE, AUTHOR, STATUS, 
STARTDATE, ENDDATE ",
"FROM ALLROWS WHERE ALLROWS.IDX 
<= 1 ",
"UNION ALL ",
"SELECT I.ID AS ISSUE, 
CG.AUTHOR, CI.NEWVALUE AS STATUS, CG.CREATED AS STARTDATE, LEAD(CG.CREATED, 1) 
OVER W AS ENDDATE ",
"FROM ISSUES i ",
"JOIN INTERNAL.CHANGEGROUP AS 
CG ON CG.ISSUEID = I.ID ",
"JOIN INTERNAL.CHANGEITEM AS CI 
ON CI.GROUPID = CG.ID ",
"WHERE CI.FIELDTYPE = 'jira' 
AND CI.FIELD = 'status' ",
"WINDOW W AS (PARTITION BY I.ID 
ORDER BY CG.CREATED) "
]
},
{code}

When performig
{code:sql}
SELECT * FROM STEPS
{code}

The result is

{noformat}
Line 1556, Column 0: Java$AmbiguousName is not allowed as an expression 
statement. Expressions statements must be one of assignments, method 
invocations, or object allocations..
{noformat}

As an attachment, I've attached implementation. Clearly the line 1555/1556 is 
wrong...




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Created] (CALCITE-2512) StreamTest#testStreamCancel fails in a flaky way

2018-08-30 Thread Sergey Nuyanzin (JIRA)
Sergey Nuyanzin created CALCITE-2512:


 Summary: StreamTest#testStreamCancel fails in a flaky way
 Key: CALCITE-2512
 URL: https://issues.apache.org/jira/browse/CALCITE-2512
 Project: Calcite
  Issue Type: Bug
Reporter: Sergey Nuyanzin
Assignee: Julian Hyde


It fails only once while local build {{mvn clean install}}
the trace is below
it leads to the code
{code}
  public static final Function0 ROW_GENERATOR =
  new Function0() {
private int counter = 0;
private Iterator items =
Iterables.cycle("paint", "paper", "brush").iterator();

@Override public Object[] apply() {
  return new Object[]{System.currentTimeMillis(), counter++, 
items.next(), 10};
}
  };
{code}
Unfortunately could not reproduce it again. The only thing that I have in mind: 
could it happen that items was not initialized before {{items.next()}} call in 
{{apply()}}. May be it makes sense to have {{items}} as {{final}}
{noformat}
[INFO] Tests run: 16, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 21.694 
s - in org.apache.calcite.test.CoreQuidemTest
[INFO] Running org.apache.calcite.test.StreamTest
java.util.NoSuchElementException
at java.util.ArrayList$Itr.next(ArrayList.java:862)
at com.google.common.collect.Iterators$4.next(Iterators.java:422)
at org.apache.calcite.test.StreamTest$1.apply(StreamTest.java:460)
at org.apache.calcite.test.StreamTest$1.apply(StreamTest.java:454)
at 
org.apache.calcite.test.StreamTest$InfiniteOrdersTable$1.next(StreamTest.java:476)
at 
org.apache.calcite.test.StreamTest$InfiniteOrdersTable$1.next(StreamTest.java:470)
at 
org.apache.calcite.linq4j.Linq4j$IterableEnumerator.moveNext(Linq4j.java:463)
at 
org.apache.calcite.linq4j.EnumerableDefaults$11$1.moveNext(EnumerableDefaults.java:1875)
at 
org.apache.calcite.linq4j.EnumerableDefaults$11$1.moveNext(EnumerableDefaults.java:1875)
at 
org.apache.calcite.linq4j.TransformedEnumerator.moveNext(TransformedEnumerator.java:35)
at 
org.apache.calcite.linq4j.Linq4j$EnumeratorIterator.next(Linq4j.java:685)
at 
org.apache.calcite.avatica.util.IteratorCursor.next(IteratorCursor.java:46)
at 
org.apache.calcite.avatica.AvaticaResultSet.next(AvaticaResultSet.java:217)
at 
org.apache.calcite.test.StreamTest.lambda$testStreamCancel$1(StreamTest.java:251)
at 
org.apache.calcite.test.CalciteAssert.assertQuery(CalciteAssert.java:552)
at 
org.apache.calcite.test.CalciteAssert$AssertQuery.returns(CalciteAssert.java:1328)
at 
org.apache.calcite.test.CalciteAssert$AssertQuery.returns(CalciteAssert.java:1305)
at 
org.apache.calcite.test.StreamTest.testStreamCancel(StreamTest.java:248)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at 
org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:298)
at 
org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:292)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.lang.Thread.run(Thread.java:748)
[ERROR] Tests run: 9, Failures: 0, Errors: 1, Skipped: 2, Time elapsed: 0.33 s 
<<< FAILURE! - in org.apache.calcite.test.StreamTest
[ERROR] testStreamCancel(org.apache.calcite.test.StreamTest)  Time elapsed: 
0.14 s  <<< ERROR!
java.lang.RuntimeException: exception while executing [select stream * from 
orders]
at 
org.apache.calcite.test.StreamTest.testStreamCancel(StreamTest.java:248)
Caused by: java.util.NoSuchElementException
at 
org.apache.calcite.test.StreamTest.lambda$testStreamCancel$1(StreamTest.java:251)
at 
org.apache.calcite.test.StreamTest.testStreamCancel(StreamTest.java:248)
{noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)