[jira] [Created] (CALCITE-3242) RelToSqlConverter not handling "NOT IN" properly

2019-08-12 Thread Atharv Rajput (JIRA)
Atharv Rajput created CALCITE-3242:
--

 Summary: RelToSqlConverter not handling "NOT IN" properly
 Key: CALCITE-3242
 URL: https://issues.apache.org/jira/browse/CALCITE-3242
 Project: Calcite
  Issue Type: Bug
  Components: core
Reporter: Atharv Rajput
Assignee: Atharv Rajput
 Fix For: 1.21.0


When RelNode is having `NOT IN` operator, it's being converted incorrectly by 
RelToSqlConverter. For example
{code:java}
@Test public void testNotInOperator() {
  final RelBuilder builder = relBuilder().scan("EMP");
  final RexNode condition =
builder.call(SqlStdOperatorTable.NOT_IN, builder.field("DEPTNO"),
  builder.literal(20), builder.literal(30));
  final RelNode root = relBuilder().scan("EMP").filter(condition).build();
  final String sql = toSql(root);
  final String expectedSql = "SELECT *\n"
+ "FROM \"scott\".\"EMP\"\n"
+ "WHERE \"DEPTNO\" NOT IN (20, 30)";
  assertThat(sql, isLinux(expectedSql));
}
{code}
Above test fails with error:
{code:java}
Expected: is "SELECT *\nFROM \"scott\".\"EMP\"\nWHERE \"DEPTNO\" NOT IN (20, 
30)"
but: was "SELECT *\nFROM \"scott\".\"EMP\"\nWHERE \"DEPTNO\" NOT IN 20 NOT IN 
30"
{code}
 



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)


Calcite swag

2019-08-12 Thread Michael Mior
For anyone who may be interested, Calcite swag now available at the
link below. You'll see a link there to view the logo on other products
besides the t-shirt.

https://www.redbubble.com/people/comdev/works/40515208-apache-calcite?p=t-shirt
--
Michael Mior
mm...@apache.org


Re: Filterable table

2019-08-12 Thread Michael Mior
These subclasses exist to avoid creating intermediate relational
algebra expressions. You don't *need* to use any of them to push down
operations. (I didn't when creating the Cassandra adapter.) You can
create instances of different relational algebra operators for your
particular calling convention and then create rules to convert
expressions to those of your calling convention. If you want to
convert an aggregate operation, you could consider this approach.

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

Le lun. 12 août 2019 à 00:20, Albert  a écrit :
>
> talking about this class reminds me of my own usage of
> ProjectableFilterable. it works.
> but this feels like a very bad design, what if I want to push down
> Aggregation ? AggregatableProjectableFilterable?
>
> I don't know the intention of the initial design, but this just doesn't
> feel right.
>
> On Mon, Aug 12, 2019 at 9:35 AM Danny Chan  wrote:
>
> > There is a ProjectableFilterableTable[1] that can be both used for filter
> > and projects push down, have a try :)
> >
> > [1]
> > https://github.com/apache/calcite/blob/996cdd0249a4e5086fadc27a15ccc23eb9defd8e/core/src/main/java/org/apache/calcite/schema/ProjectableFilterableTable.java#L36
> >
> > Best,
> > Danny Chan
> > 在 2019年8月12日 +0800 AM7:55,Lekshmi ,写道:
> > > Hi Danny Chan,
> > > Thank you so much for responding to my email. Can we use, Translatable
> > > table instead of Filterable table? which is more efficient? Usecase that
> > if
> > > need to write a Project push down (Push down Project fields into table
> > scan
> > > then do Filtering) and Filter push down?
> > > Or Filterable table is enough to use Project push down as well?
> > > Thanks and Regards
> > >
> > > Lekshmi B.G
> > > Email: lekshmib...@gmail.com
> > >
> > >
> > >
> > >
> > > On Fri, Aug 9, 2019 at 11:15 AM Danny Chan  wrote:
> > >
> > > > Hi, Lekshmi ~
> > > >
> > > >
> > > > The FilterableTable can be scanned with a list of filter expression,
> > that
> > > > means the filter conditions above the project + scan can be
> > > > pushed directly into the table scan[1][2], which is more efficient.
> > Here is
> > > > a CsvFilterableTable example [3].
> > > >
> > > > [1]
> > > >
> > https://github.com/apache/calcite/blob/602b2a10e3f81888c0759ca69f7415497124ef82/core/src/main/java/org/apache/calcite/rel/rules/FilterTableScanRule.java#L130
> > > > [2]
> > > >
> > https://github.com/apache/calcite/blob/602b2a10e3f81888c0759ca69f7415497124ef82/core/src/main/java/org/apache/calcite/rel/rules/ProjectTableScanRule.java#L128
> > > > [3]
> > > >
> > https://github.com/apache/calcite/blob/602b2a10e3f81888c0759ca69f7415497124ef82/example/csv/src/main/java/org/apache/calcite/adapter/csv/CsvFilterableTable.java#L65
> > > >
> > > > Best,
> > > > Danny Chan
> > > > 在 2019年8月8日 +0800 PM10:56,dev@calcite.apache.org,写道:
> > > > >
> > > > > Filterable
> > > >
> >
>
>
> --
> ~~~
> no mistakes
> ~~


Re: Virtual key signing party

2019-08-12 Thread Stamatis Zampetakis
Given that nobody expressed interest to participate in the sessions today,
I suggest to postpone the party.
We can still try to find some other slots this week; if there is any
interest please reply to this thread otherwise we can try again in a couple
of months.

On Sat, Aug 10, 2019 at 11:24 AM Francis Chuang 
wrote:

> Thanks for organizing this, Stamatis! I don't think I'll be able to
> attend these sessions this time, but I do encourage everyone else to
> attend including committers. If you're from another Apache project, feel
> free to attend too.
>
> Francis
>
> On 10/08/2019 6:26 pm, Stamatis Zampetakis wrote:
> > Hello,
> >
> > The last virtual key signing party [1] was a few months ago [2]. I would
> > propose to hold another one in the next few days. We could have the
> > following two slots:
> >
> >   * Slot A https://tinyurl.com/y3coduw7
> >   * Slot B https://tinyurl.com/yxqmq429
> >
> > hoping that at least one would be convenient for people in the US,
> Europe,
> > and Asia.
> >
> > If you would like to attend, please reply to this thread with your public
> > keys' fingerprint (gpg --fingerprint) and the slot you plan to join
> before
> > the respective meeting.
> >
> > pub   rsa4096 2019-03-15 [SC] [expires: 2023-03-15]
> >0474 9577 FD93 4674 B9CD  45C5 D77C 3383 F192 7570
> > uid   [ultimate] Stamatis Zampetakis 
> > uid   [ultimate] Stamatis Zampetakis 
> > sub   rsa4096 2019-03-15 [E] [expires: 2023-03-15]
> >
> > To verify your identity, please bring with you a government issued ID
> > (preferably passport).
> >
> > As a reminder of the procedure have a look in the notes [1] took by
> Francis
> > during a previous party!
> >
> > Best,
> > Stamatis
> >
> > [1]
> >
> http://www.cryptnet.net/fdp/crypto/keysigning_party/en/keysigning_party.html
> > [2]
> >
> https://lists.apache.org/thread.html/af8403a495c5067a7f7dfcb684d24b3362db0331e315b745492d748e@%3Cdev.calcite.apache.org%3E
> > [3] https://gist.github.com/F21/b0e8c62c49dfab267ff1d0c6af39ab84
> >
>


Re: Calcite swag

2019-08-12 Thread Stamatis Zampetakis
Thanks for sharing Michael!

I think, I will pass a command quite soon :)

On Mon, Aug 12, 2019 at 2:49 PM Michael Mior  wrote:

> For anyone who may be interested, Calcite swag now available at the
> link below. You'll see a link there to view the logo on other products
> besides the t-shirt.
>
>
> https://www.redbubble.com/people/comdev/works/40515208-apache-calcite?p=t-shirt
> --
> Michael Mior
> mm...@apache.org
>


[jira] [Created] (CALCITE-3243) Incomplete validation of operands in JSON functions

2019-08-12 Thread Stamatis Zampetakis (JIRA)
Stamatis Zampetakis created CALCITE-3243:


 Summary: Incomplete validation of operands in JSON functions  
 Key: CALCITE-3243
 URL: https://issues.apache.org/jira/browse/CALCITE-3243
 Project: Calcite
  Issue Type: Bug
  Components: core
Affects Versions: 1.20.0
Reporter: Stamatis Zampetakis


The operands of various JSON functions are not validated correctly. 

Consider for instance the {{JSON_VALUE}} function and the following calls:
{code:sql}
json_value('{\"foo\":100}', 'strict $.foo')"
json_value(1, 'strict $.foo')"
json_value(TRUE, 'strict $.foo')"
{code}

The first call is legal but the next are not; if I am not wrong the operands 
should be always CHAR or VARCHAR literals which is not the case above.

Queries involving such calls fail at runtime when compiling generated code. I 
guess that such kind of problems should be captured by the validator and we 
should not even arrive at the code generation step.

The problems can be easily reproduced by adding such calls in the 
{{SqlOperatorBaseTest}}.

The problem does not only affect {{JSON_VALUE}} but other JSON functions (such 
as {{JSON_QUERY}} etc.) as well. 




--
This message was sent by Atlassian JIRA
(v7.6.14#76016)


Re: Virtual key signing party

2019-08-12 Thread Andrei Sereda
If there are more people interested I'll join the party (this or next week).

Stamatis and I signed each others keys a while ago.

pub   rsa4096 2018-10-18 [SC]
  25E7 0310 6B1B 3D7B 1050  32BD C41C FDDF ED34 C028
uid   [ultimate] Andrei Sereda (CODE SIGNING KEY) 
uid   [ultimate] Andrei Sereda 
uid   [ultimate] asereda-gs (Andrei Sereda) <
25229979+asereda...@users.noreply.github.com>
uid   [ultimate] Andrei Sereda 
sub   rsa4096 2018-10-18 [E]


On Mon, Aug 12, 2019 at 10:17 AM Stamatis Zampetakis 
wrote:

> Given that nobody expressed interest to participate in the sessions today,
> I suggest to postpone the party.
> We can still try to find some other slots this week; if there is any
> interest please reply to this thread otherwise we can try again in a couple
> of months.
>
> On Sat, Aug 10, 2019 at 11:24 AM Francis Chuang 
> wrote:
>
> > Thanks for organizing this, Stamatis! I don't think I'll be able to
> > attend these sessions this time, but I do encourage everyone else to
> > attend including committers. If you're from another Apache project, feel
> > free to attend too.
> >
> > Francis
> >
> > On 10/08/2019 6:26 pm, Stamatis Zampetakis wrote:
> > > Hello,
> > >
> > > The last virtual key signing party [1] was a few months ago [2]. I
> would
> > > propose to hold another one in the next few days. We could have the
> > > following two slots:
> > >
> > >   * Slot A https://tinyurl.com/y3coduw7
> > >   * Slot B https://tinyurl.com/yxqmq429
> > >
> > > hoping that at least one would be convenient for people in the US,
> > Europe,
> > > and Asia.
> > >
> > > If you would like to attend, please reply to this thread with your
> public
> > > keys' fingerprint (gpg --fingerprint) and the slot you plan to join
> > before
> > > the respective meeting.
> > >
> > > pub   rsa4096 2019-03-15 [SC] [expires: 2023-03-15]
> > >0474 9577 FD93 4674 B9CD  45C5 D77C 3383 F192 7570
> > > uid   [ultimate] Stamatis Zampetakis 
> > > uid   [ultimate] Stamatis Zampetakis 
> > > sub   rsa4096 2019-03-15 [E] [expires: 2023-03-15]
> > >
> > > To verify your identity, please bring with you a government issued ID
> > > (preferably passport).
> > >
> > > As a reminder of the procedure have a look in the notes [1] took by
> > Francis
> > > during a previous party!
> > >
> > > Best,
> > > Stamatis
> > >
> > > [1]
> > >
> >
> http://www.cryptnet.net/fdp/crypto/keysigning_party/en/keysigning_party.html
> > > [2]
> > >
> >
> https://lists.apache.org/thread.html/af8403a495c5067a7f7dfcb684d24b3362db0331e315b745492d748e@%3Cdev.calcite.apache.org%3E
> > > [3] https://gist.github.com/F21/b0e8c62c49dfab267ff1d0c6af39ab84
> > >
> >
>


Re: Virtual key signing party

2019-08-12 Thread Stamatis Zampetakis
Thanks Andrei, just a small precision; my old key has been compromised so I
was forced to revoke it.
The one I send earlier is my new key.

On Mon, Aug 12, 2019 at 4:43 PM Andrei Sereda  wrote:

> If there are more people interested I'll join the party (this or next
> week).
>
> Stamatis and I signed each others keys a while ago.
>
> pub   rsa4096 2018-10-18 [SC]
>   25E7 0310 6B1B 3D7B 1050  32BD C41C FDDF ED34 C028
> uid   [ultimate] Andrei Sereda (CODE SIGNING KEY) <
> ser...@apache.org
> >
> uid   [ultimate] Andrei Sereda 
> uid   [ultimate] asereda-gs (Andrei Sereda) <
> 25229979+asereda...@users.noreply.github.com>
> uid   [ultimate] Andrei Sereda 
> sub   rsa4096 2018-10-18 [E]
>
>
> On Mon, Aug 12, 2019 at 10:17 AM Stamatis Zampetakis 
> wrote:
>
> > Given that nobody expressed interest to participate in the sessions
> today,
> > I suggest to postpone the party.
> > We can still try to find some other slots this week; if there is any
> > interest please reply to this thread otherwise we can try again in a
> couple
> > of months.
> >
> > On Sat, Aug 10, 2019 at 11:24 AM Francis Chuang <
> francischu...@apache.org>
> > wrote:
> >
> > > Thanks for organizing this, Stamatis! I don't think I'll be able to
> > > attend these sessions this time, but I do encourage everyone else to
> > > attend including committers. If you're from another Apache project,
> feel
> > > free to attend too.
> > >
> > > Francis
> > >
> > > On 10/08/2019 6:26 pm, Stamatis Zampetakis wrote:
> > > > Hello,
> > > >
> > > > The last virtual key signing party [1] was a few months ago [2]. I
> > would
> > > > propose to hold another one in the next few days. We could have the
> > > > following two slots:
> > > >
> > > >   * Slot A https://tinyurl.com/y3coduw7
> > > >   * Slot B https://tinyurl.com/yxqmq429
> > > >
> > > > hoping that at least one would be convenient for people in the US,
> > > Europe,
> > > > and Asia.
> > > >
> > > > If you would like to attend, please reply to this thread with your
> > public
> > > > keys' fingerprint (gpg --fingerprint) and the slot you plan to join
> > > before
> > > > the respective meeting.
> > > >
> > > > pub   rsa4096 2019-03-15 [SC] [expires: 2023-03-15]
> > > >0474 9577 FD93 4674 B9CD  45C5 D77C 3383 F192 7570
> > > > uid   [ultimate] Stamatis Zampetakis 
> > > > uid   [ultimate] Stamatis Zampetakis 
> > > > sub   rsa4096 2019-03-15 [E] [expires: 2023-03-15]
> > > >
> > > > To verify your identity, please bring with you a government issued ID
> > > > (preferably passport).
> > > >
> > > > As a reminder of the procedure have a look in the notes [1] took by
> > > Francis
> > > > during a previous party!
> > > >
> > > > Best,
> > > > Stamatis
> > > >
> > > > [1]
> > > >
> > >
> >
> http://www.cryptnet.net/fdp/crypto/keysigning_party/en/keysigning_party.html
> > > > [2]
> > > >
> > >
> >
> https://lists.apache.org/thread.html/af8403a495c5067a7f7dfcb684d24b3362db0331e315b745492d748e@%3Cdev.calcite.apache.org%3E
> > > > [3] https://gist.github.com/F21/b0e8c62c49dfab267ff1d0c6af39ab84
> > > >
> > >
> >
>


[jira] [Created] (CALCITE-3244) Decorrelating sub-queries - Adding Implicit RowID support

2019-08-12 Thread benj (JIRA)
benj created CALCITE-3244:
-

 Summary: Decorrelating sub-queries - Adding Implicit RowID support
 Key: CALCITE-3244
 URL: https://issues.apache.org/jira/browse/CALCITE-3244
 Project: Calcite
  Issue Type: Improvement
Affects Versions: 1.20.0
Reporter: benj


Some very useful type of requests currently failed with:
{code:java}
SYSTEM ERROR: UnsupportedOperationException: Adding Implicit RowID column is 
not supported for ValuesPrel operator 
{code}
Examples from DRILL-7050:
{code:sql}
select t1.id,
 (select count(t2.id) 
 from (
 select 1 as id 
 union all 
 select 2 as id
 ) t2 where t2.id = t1.id)
 from (
 select 1 as id 
 union all 
 select 2 as id
 ) t1
{code}
{code:sql}
SELECT t,
(SELECT count(*) FROM
 (SELECT split(r,' ') AS r FROM
  (SELECT sub.t AS r)) AS x
 ,LATERAL(SELECT $unnest AS u FROM unnest(x.r))
 /* WHERE ... */) t2
FROM
(SELECT 'unnest is useful' AS t) sub
{code}
 

_Please note that in 1.18 the error for these requests was:_
{code:java}
Error: PLAN ERROR: Cannot convert RexNode to equivalent Drill expression. 
RexNode Class: org.apache.calcite.rex.RexCorrelVariable, RexNode Digest: $cor0
{code}



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)


Re: Virtual key signing party

2019-08-12 Thread Andrei Sereda
Didn't know about your key.

Since you're release manager for 1.20 we can meet one-to-one (or arrange
new party next week). I'll sign your key.

On Mon, Aug 12, 2019 at 10:47 AM Stamatis Zampetakis 
wrote:

> Thanks Andrei, just a small precision; my old key has been compromised so I
> was forced to revoke it.
> The one I send earlier is my new key.
>
> On Mon, Aug 12, 2019 at 4:43 PM Andrei Sereda  wrote:
>
> > If there are more people interested I'll join the party (this or next
> > week).
> >
> > Stamatis and I signed each others keys a while ago.
> >
> > pub   rsa4096 2018-10-18 [SC]
> >   25E7 0310 6B1B 3D7B 1050  32BD C41C FDDF ED34 C028
> > uid   [ultimate] Andrei Sereda (CODE SIGNING KEY) <
> > ser...@apache.org
> > >
> > uid   [ultimate] Andrei Sereda 
> > uid   [ultimate] asereda-gs (Andrei Sereda) <
> > 25229979+asereda...@users.noreply.github.com>
> > uid   [ultimate] Andrei Sereda 
> > sub   rsa4096 2018-10-18 [E]
> >
> >
> > On Mon, Aug 12, 2019 at 10:17 AM Stamatis Zampetakis 
> > wrote:
> >
> > > Given that nobody expressed interest to participate in the sessions
> > today,
> > > I suggest to postpone the party.
> > > We can still try to find some other slots this week; if there is any
> > > interest please reply to this thread otherwise we can try again in a
> > couple
> > > of months.
> > >
> > > On Sat, Aug 10, 2019 at 11:24 AM Francis Chuang <
> > francischu...@apache.org>
> > > wrote:
> > >
> > > > Thanks for organizing this, Stamatis! I don't think I'll be able to
> > > > attend these sessions this time, but I do encourage everyone else to
> > > > attend including committers. If you're from another Apache project,
> > feel
> > > > free to attend too.
> > > >
> > > > Francis
> > > >
> > > > On 10/08/2019 6:26 pm, Stamatis Zampetakis wrote:
> > > > > Hello,
> > > > >
> > > > > The last virtual key signing party [1] was a few months ago [2]. I
> > > would
> > > > > propose to hold another one in the next few days. We could have the
> > > > > following two slots:
> > > > >
> > > > >   * Slot A https://tinyurl.com/y3coduw7
> > > > >   * Slot B https://tinyurl.com/yxqmq429
> > > > >
> > > > > hoping that at least one would be convenient for people in the US,
> > > > Europe,
> > > > > and Asia.
> > > > >
> > > > > If you would like to attend, please reply to this thread with your
> > > public
> > > > > keys' fingerprint (gpg --fingerprint) and the slot you plan to join
> > > > before
> > > > > the respective meeting.
> > > > >
> > > > > pub   rsa4096 2019-03-15 [SC] [expires: 2023-03-15]
> > > > >0474 9577 FD93 4674 B9CD  45C5 D77C 3383 F192 7570
> > > > > uid   [ultimate] Stamatis Zampetakis 
> > > > > uid   [ultimate] Stamatis Zampetakis 
> > > > > sub   rsa4096 2019-03-15 [E] [expires: 2023-03-15]
> > > > >
> > > > > To verify your identity, please bring with you a government issued
> ID
> > > > > (preferably passport).
> > > > >
> > > > > As a reminder of the procedure have a look in the notes [1] took by
> > > > Francis
> > > > > during a previous party!
> > > > >
> > > > > Best,
> > > > > Stamatis
> > > > >
> > > > > [1]
> > > > >
> > > >
> > >
> >
> http://www.cryptnet.net/fdp/crypto/keysigning_party/en/keysigning_party.html
> > > > > [2]
> > > > >
> > > >
> > >
> >
> https://lists.apache.org/thread.html/af8403a495c5067a7f7dfcb684d24b3362db0331e315b745492d748e@%3Cdev.calcite.apache.org%3E
> > > > > [3] https://gist.github.com/F21/b0e8c62c49dfab267ff1d0c6af39ab84
> > > > >
> > > >
> > >
> >
>


Our dependence on Drill and MapR's nexus server

2019-08-12 Thread Julian Hyde
Calcite devs, 

FYI, I just started a thread on Drill’s dev list about our dependence on MapR’s 
nexus server. (MapR was just acquired, so there is a concern that over the long 
term that server will disappear and our builds will stop working.)

If you have opinions, please join the discussion.

https://lists.apache.org/thread.html/7da1b319f74cb038fa69f07c56e9581b6849f7de81c0e4ca74962bca@%3Cdev.drill.apache.org%3E
 


Julian

Re: Our dependence on Drill and MapR's nexus server

2019-08-12 Thread Vladimir Sitnikov
Ah, good old drill-fmpp-plugin

For instance: we migrate to Gradle, and the problem is solved automatically.

Just a datapoint: Apache JMeter has recently switched to Gradle.
The PR for Avatica (including a release candidate waiting for review) is
ready: https://github.com/apache/calcite-avatica/pull/104

It won't really take long to switch Calcite. Really. The build is just a
build, and it is way simpler than the main codebase :)

On top of that, Gradle improves IDE integration. For instance, I often run
into
"org.apache.calcite.sql.parser.parserextensiontesting.ExtensionSqlParserImpl
not found" error when running tests from IDEA.
The thing is ExtensionSqlParserImpl is an autogenerated java file, so that
generation must be run somehow before Calcite code even compiles.
That is extremely sad.

In 99.42% of the times I just comment that line as follows:

public class ExtensionSqlParserTest extends SqlParserTest {
  @Override protected SqlParserImplFactory parserImplFactory() {
return null; //ExtensionSqlParserImpl.FACTORY;
  }

Gradle enables to configure certain tasks for automatic execution "on
project import", and it resolves those cases seamlessly.
For instance, JMeter uses that to generate JMeterVersion.java class on the
fly:
https://github.com/apache/jmeter/blob/41bad20e9d495240e140da6cbdbf5d9e2c8d3123/src/core/src/main/version/org/apache/jmeter/util/JMeterVersion.java#L30

PS. As you might know, Gradle build pushes release candidates just fine:
https://dist.apache.org/repos/dist/dev/calcite/apache-calcite-avatica-1.16.0-rc1/
PPS. I'm not working for Gradle. I really like the way it simplifies
development.

Vladimir


[jira] [Created] (CALCITE-3245) CompileException in Janino when a query contains a division between a Double and a BigDecimal

2019-08-12 Thread Stamatis Zampetakis (JIRA)
Stamatis Zampetakis created CALCITE-3245:


 Summary: CompileException in Janino when a query contains a 
division between a Double and a BigDecimal
 Key: CALCITE-3245
 URL: https://issues.apache.org/jira/browse/CALCITE-3245
 Project: Calcite
  Issue Type: Bug
  Components: core
Affects Versions: 1.20.0
Reporter: Stamatis Zampetakis


A CompileException in Janino is raised when the SQL query contains a division 
operator between a column of type Double and a column of type BigDecimal.

The following test added in {{ReflectiveSchemaTest}} can reproduce the problem.

{code:java}
@Test public void testDivideDoubleBigDecimal() {
final CalciteAssert.AssertThat with =
CalciteAssert.that().withSchema("s", CATCHALL);
with.query("select \"wrapperDouble\" / \"bigDecimal\" as c\n"
+ " from \"s\".\"everyTypes\"")
.runs();
  }
{code}

The generated code is the following:

{code:java}
public org.apache.calcite.linq4j.Enumerable bind(final 
org.apache.calcite.DataContext root) {
  final org.apache.calcite.linq4j.Enumerable _inputEnumerable = 
org.apache.calcite.linq4j.Linq4j.asEnumerable(((org.apache.calcite.test.ReflectiveSchemaTest.CatchallSchema)
 ((org.apache.calcite.adapter.java.ReflectiveSchema) 
root.getRootSchema().getSubSchema("s").unwrap(org.apache.calcite.adapter.java.ReflectiveSchema.class)).getTarget()).everyTypes);
  return new org.apache.calcite.linq4j.AbstractEnumerable(){
  public org.apache.calcite.linq4j.Enumerator enumerator() {
return new org.apache.calcite.linq4j.Enumerator(){
public final org.apache.calcite.linq4j.Enumerator inputEnumerator = 
_inputEnumerable.enumerator();
public void reset() {
  inputEnumerator.reset();
}

public boolean moveNext() {
  return inputEnumerator.moveNext();
}

public void close() {
  inputEnumerator.close();
}

public Object current() {
  final org.apache.calcite.test.ReflectiveSchemaTest.EveryType 
current = (org.apache.calcite.test.ReflectiveSchemaTest.EveryType) 
inputEnumerator.current();
  final Double inp15_ = current.wrapperDouble;
  final java.math.BigDecimal inp21_ = current.bigDecimal;
  return inp15_ == null || inp21_ == null ? (java.math.BigDecimal) 
null : (java.math.BigDecimal) (inp15_.doubleValue() / inp21_.doubleValue());
}

  };
  }

};
}


public Class getElementType() {
  return java.math.BigDecimal.class;
}

{code}

and the stack trace is given below:

{noformat}
Caused by: java.lang.RuntimeException: Error while compiling generated Java 
code:
...
at org.apache.calcite.avatica.Helper.wrap(Helper.java:37)
at 
org.apache.calcite.adapter.enumerable.EnumerableInterpretable.toBindable(EnumerableInterpretable.java:128)
at 
org.apache.calcite.prepare.CalcitePrepareImpl$CalcitePreparingStmt.implement(CalcitePrepareImpl.java:1110)
at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:332)
at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:231)
at 
org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:638)
at 
org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:502)
at 
org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:472)
at 
org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:231)
at 
org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:550)
at 
org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:675)
at 
org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:156)
... 28 more
Caused by: org.codehaus.commons.compiler.CompileException: Line 23, Column 111: 
Cannot cast "double" to "java.math.BigDecimal"
at 
org.codehaus.janino.UnitCompiler.compileError(UnitCompiler.java:12211)
at org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:5051)
at org.codehaus.janino.UnitCompiler.access$8600(UnitCompiler.java:215)
at org.codehaus.janino.UnitCompiler$16.visitCast(UnitCompiler.java:4418)
at org.codehaus.janino.UnitCompiler$16.visitCast(UnitCompiler.java:4396)
at org.codehaus.janino.Java$Cast.accept(Java.java:4898)
at org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:4396)
at 
org.codehaus.janino.UnitCompiler.compileGetValue(UnitCompiler.java:5662)
at org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:4716)
at org.codehaus.janino.UnitCompiler.access$8800(UnitCompiler.java:215)
at 
org.codehaus.janino.UnitCompiler$16.visitConditionalExpression(UnitCo

Re: Calcite swag

2019-08-12 Thread Danny Chan
Nice t-shirt, I like the black one ~

Best,
Danny Chan
在 2019年8月12日 +0800 PM8:49,Michael Mior ,写道:
> For anyone who may be interested, Calcite swag now available at the
> link below. You'll see a link there to view the logo on other products
> besides the t-shirt.
>
> https://www.redbubble.com/people/comdev/works/40515208-apache-calcite?p=t-shirt
> --
> Michael Mior
> mm...@apache.org


Re: Calcite swag

2019-08-12 Thread Albert
Nice

在 2019年8月13日星期二,Danny Chan  写道:

> Nice t-shirt, I like the black one ~
>
> Best,
> Danny Chan
> 在 2019年8月12日 +0800 PM8:49,Michael Mior ,写道:
> > For anyone who may be interested, Calcite swag now available at the
> > link below. You'll see a link there to view the logo on other products
> > besides the t-shirt.
> >
> > https://www.redbubble.com/people/comdev/works/40515208-
> apache-calcite?p=t-shirt
> > --
> > Michael Mior
> > mm...@apache.org
>


-- 
~~~
no mistakes
~~


[jira] [Created] (CALCITE-3246) NullPointerException while deserializing of udf.

2019-08-12 Thread Wang Yanlin (JIRA)
Wang Yanlin created CALCITE-3246:


 Summary: NullPointerException  while deserializing of udf.
 Key: CALCITE-3246
 URL: https://issues.apache.org/jira/browse/CALCITE-3246
 Project: Calcite
  Issue Type: Bug
  Components: core
Reporter: Wang Yanlin


when deserializing of logical rel with udf operator, NPE occurs.

The exception stacktrace as follow.
{code:java}
java.lang.RuntimeException: java.lang.NullPointerException

at org.apache.calcite.tools.Frameworks.withPrepare(Frameworks.java:181)
at org.apache.calcite.tools.Frameworks.withPlanner(Frameworks.java:125)
at org.apache.calcite.tools.Frameworks.withPlanner(Frameworks.java:143)
at org.apache.calcite.plan.RelWriterTest.testUdf(RelWriterTest.java:598)
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.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at 
com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at 
com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at 
com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at 
com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: java.lang.NullPointerException
at java.util.Objects.requireNonNull(Objects.java:203)
at org.apache.calcite.rex.RexCall.(RexCall.java:83)
at org.apache.calcite.rex.RexBuilder.makeCall(RexBuilder.java:237)
at org.apache.calcite.rel.externalize.RelJson.toRex(RelJson.java:485)
at 
org.apache.calcite.rel.externalize.RelJsonReader$2.getExpressionList(RelJsonReader.java:204)
at org.apache.calcite.rel.core.Project.(Project.java:100)
at 
org.apache.calcite.rel.logical.LogicalProject.(LogicalProject.java:88)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at 
org.apache.calcite.rel.externalize.RelJsonReader.readRel(RelJsonReader.java:261)
at 
org.apache.calcite.rel.externalize.RelJsonReader.readRels(RelJsonReader.java:91)
at 
org.apache.calcite.rel.externalize.RelJsonReader.read(RelJsonReader.java:85)
at 
org.apache.calcite.plan.RelWriterTest.lambda$testUdf$7(RelWriterTest.java:603)
at 
org.apache.calcite.tools.Frameworks.lambda$withPlanner$0(Frameworks.java:130)
at 
org.apache.calcite.prepare.CalcitePrepareImpl.perform(CalcitePrepareImpl.java:915)
at org.apache.calcite.tools.Frameworks.withPrepare(Frameworks.java:179)
... 25 more
{code}



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)