[jira] [Created] (CALCITE-1592) UnsupportedOperationException for queries with not(not()) filters

2017-01-18 Thread hongbin ma (JIRA)
hongbin ma created CALCITE-1592:
---

 Summary: UnsupportedOperationException for queries with not(not()) 
filters
 Key: CALCITE-1592
 URL: https://issues.apache.org/jira/browse/CALCITE-1592
 Project: Calcite
  Issue Type: Bug
Reporter: hongbin ma


when we're upgrading from calcite 1.10 to 1.11. we meet found that the 
following query:

{code:java}

  /**
   * Reads from a table.
   */
  @Test public void testSelectx() throws SQLException {
checkSql("model", "select * from EMPS where not (name not in ('Fred') )");
  }
{code}

will throw:

{code}
java.sql.SQLException: Error while executing SQL "select * from EMPS where not 
(name not in ('Fred') )": class org.apache.calcite.sql.SqlBasicCall: 
`EMPS`.`NAME` IN ('Fred')

at org.apache.calcite.avatica.Helper.createException(Helper.java:56)
at org.apache.calcite.avatica.Helper.createException(Helper.java:41)
at 
org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:156)
at 
org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:218)
at org.apache.calcite.test.CsvTest.checkSql(CsvTest.java:322)
at org.apache.calcite.test.CsvTest.checkSql(CsvTest.java:275)
at org.apache.calcite.test.CsvTest.testSelectx(CsvTest.java:175)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
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:51)
at 
com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:237)
at 
com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: java.lang.UnsupportedOperationException: class 
org.apache.calcite.sql.SqlBasicCall: `EMPS`.`NAME` IN ('Fred')
at org.apache.calcite.util.Util.needToImplement(Util.java:927)
at 
org.apache.calcite.sql.validate.SqlValidatorImpl.getValidatedNodeType(SqlValidatorImpl.java:1457)
at 
org.apache.calcite.sql2rel.StandardConvertletTable.castToValidatedType(StandardConvertletTable.java:1304)
at 
org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.convertExpression(SqlToRelConverter.java:4134)
at 
org.apache.calcite.sql2rel.SqlToRelConverter.convertWhere(SqlToRelConverter.java:960)
at 
org.apache.calcite.sql2rel.SqlToRelConverter.convertSelectImpl(SqlToRelConverter.java:645)
at 
org.apache.calcite.sql2rel.SqlToRelConverter.convertSelect(SqlToRelConverter.java:623)
at 
org.apache.calcite.sql2rel.SqlToRelConverter.convertQueryRecursive(SqlToRelConverter.java:2860)
at 
org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:559)
at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:235)
at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:200)
at 
org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:761)
at 

[jira] [Created] (CALCITE-1591) Drill adapter: Use "groupBy" query with extractionFn for time dimension

2017-01-18 Thread Julian Hyde (JIRA)
Julian Hyde created CALCITE-1591:


 Summary: Drill adapter: Use "groupBy" query with extractionFn for 
time dimension
 Key: CALCITE-1591
 URL: https://issues.apache.org/jira/browse/CALCITE-1591
 Project: Calcite
  Issue Type: Bug
Reporter: Julian Hyde
Assignee: Julian Hyde


For queries that aggregate on the time dimension, or a function of it such as 
{{FLOOR(__time TO DAY)}}, as of the fix for CALCITE-1579 we generate a 
"groupBy" query that does not sort or apply limit. It would be better (in the 
sense that Druid is doing more of the work, and Hive is doing less work) if we 
use an extractionFn to create a dimension that we can sort on.

In CALCITE-1578, [~nishantbangarwa] gives the following example query:

{code}
{
  "queryType": "groupBy",
  "dataSource": "druid_tpcds_ss_sold_time_subset",
  "granularity": "ALL",
  "dimensions": [
"i_brand_id",
{
  "type" : "extraction",
  "dimension" : "__time",
  "outputName" :  "year",
  "extractionFn" : {
"type" : "timeFormat",
"granularity" : "YEAR"
  }
}
  ],
  "limitSpec": {
"type": "default",
"limit": 10,
"columns": [
  {
"dimension": "$f3",
"direction": "ascending"
  }
]
  },
  "aggregations": [
{
  "type": "longMax",
  "name": "$f2",
  "fieldName": "ss_quantity"
},
{
  "type": "doubleSum",
  "name": "$f3",
  "fieldName": "ss_wholesale_cost"
}
  ],
  "intervals": [
"1900-01-01T00:00:00.000Z/3000-01-01T00:00:00.000Z"
  ]
}
{code}

and for {{DruidAdapterIt. testGroupByDaySortDescLimit}}, [~bslim] suggests

{code}
{
  "queryType": "groupBy",
  "dataSource": "foodmart",
  "granularity": "all",
  "dimensions": [
"brand_name",
{
  "type": "extraction",
  "dimension": "__time",
  "outputName": "day",
  "extractionFn": {
"type": "timeFormat",
"granularity": "DAY"
  }
}
  ],
  "aggregations": [
{
  "type": "longSum",
  "name": "S",
  "fieldName": "unit_sales"
}
  ],
  "limitSpec": {
"type": "default",
"limit": 30,
"columns": [
  {
"dimension": "S",
"direction": "ascending"
  }
]
  }
}
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Created] (CALCITE-1590) Support Guava version 21.0

2017-01-18 Thread Julian Hyde (JIRA)
Julian Hyde created CALCITE-1590:


 Summary: Support Guava version 21.0
 Key: CALCITE-1590
 URL: https://issues.apache.org/jira/browse/CALCITE-1590
 Project: Calcite
  Issue Type: Bug
Reporter: Julian Hyde
Assignee: Julian Hyde


Guava version 21.0 is an important version because it is the first with JDK 8 
support (hence lambdas). Make sure that Calcite runs on it (on JDK 8 and 
later). Continue to support other versions of Guava as early as 14.0.1.

Compilation using {{mvn clean -Dguava.version=21.0 clean test}} on JDK8 
currently yields many errors like the following:

{noformat}
[ERROR] Failed to execute goal 
org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (default-compile) 
on project calcite-core: Compilation failure: Compilation failure:
[ERROR] 
/Users/jhyde/open1/calcite.2/core/src/main/java/org/apache/calcite/rel/core/Values.java:[68,31]
  is not abstract and does not 
override abstract method test(org.apache.calcite.rel.core.Values) in 
java.util.function.Predicate
{noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


Spark and Calcite

2017-01-18 Thread Riccardo Tommasini
Hello,
I'm trying to understand how to use the spark adapter.

Does anyone have any example?

Thanks in advance

Riccardo Tommasini
Master Degree Computer Science
PhD Student at Politecnico di Milano (Italy)
streamreasoning.org

Submitted from an iPhone, I apologise for typos.


Re: : ApacheCon CFP closing soon (11 February)

2017-01-18 Thread Riccardo Tommasini
Thinking about it. My group and I are using calcite for ontology based data 
access

Riccardo Tommasini
Master Degree Computer Science
PhD Student at Politecnico di Milano (Italy)
streamreasoning.org

Submitted from an iPhone, I apologise for typos.

On 18 January 2017 at 20:46:05, Julian Hyde 
(jh...@apache.org) wrote:

There was 1 Calcite talk at ApacheCon: Big Data North America (by me), and 3 
Calcite talks at ApacheCon: Big Data Europe (by Jesus, Atri and Alan). Can we 
continue the trend?!

Please submit a talk about Calcite, or how you use it.

I’ve heard that Miami in May is quite pleasant. :)

Julian


Begin forwarded message:

From: Rich Bowen 
Subject: ApacheCon CFP closing soon (11 February)
Date: January 18, 2017 at 8:45:41 AM PST
To: comdev 
Reply-To: d...@drill.apache.org
Reply-To: comdev 

Hello, fellow Apache enthusiast. Thanks for your participation, and
interest in, the projects of the Apache Software Foundation.

I wanted to remind you that the Call For Papers (CFP) for ApacheCon
North America, and Apache: Big Data North America, closes in less than a
month. If you've been putting it off because there was lots of time
left, it's time to dig for that inspiration and get those talk proposals in.

It's also time to discuss with your developer and user community whether
there's a track of talks that you might want to propose, so that you
have more complete coverage of your project than a talk or two.

We're looking for talks directly, and indirectly, related to projects at
the Apache Software Foundation. These can be anything from in-depth
technical discussions of the projects you work with, to talks about
community, documentation, legal issues, marketing, and so on. We're also
very interested in talks about projects and services built on top of
Apache projects, and case studies of how you use Apache projects to
solve real-world problems.

We are particularly interested in presentations from Apache projects
either in the Incubator, or recently graduated. ApacheCon is where
people come to find out what technology they'll be using this time next
year.

Important URLs are:

To submit a talk for Apache: Big Data -
http://events.linuxfoundation.org/events/apache-big-data-north-america/program/cfp
To submit a talk for ApacheCon -
http://events.linuxfoundation.org/events/apachecon-north-america/program/cfp

To register for Apache: Big Data -
http://events.linuxfoundation.org/events/apache-big-data-north-america/attend/register-
To register for ApacheCon -
http://events.linuxfoundation.org/events/apachecon-north-america/attend/register-

Early Bird registration rates end March 12th, but if you're a committer
on an Apache project, you get the low committer rate, which is less than
half of the early bird rate!

For further updated about ApacheCon, follow us on Twitter, @ApacheCon,
or drop by our IRC channel, #apachecon on the Freenode IRC network. Or
contact me - rbo...@apache.org - with any questions or concerns.

Thanks!

Rich Bowen, VP Conferences, Apache Software Foundation

--
(You've received this email because you're on a dev@ or users@ mailing
list of an Apache Software Foundation project. For subscription and
unsubscription information, consult the headers of this email message,
as this varies from one list to another.)



[jira] [Created] (CALCITE-1589) Druid adapter: timeseries query shows all days, even if no data

2017-01-18 Thread Jesus Camacho Rodriguez (JIRA)
Jesus Camacho Rodriguez created CALCITE-1589:


 Summary: Druid adapter: timeseries query shows all days, even if 
no data
 Key: CALCITE-1589
 URL: https://issues.apache.org/jira/browse/CALCITE-1589
 Project: Calcite
  Issue Type: Bug
  Components: druid
Reporter: Jesus Camacho Rodriguez
Assignee: Julian Hyde
Priority: Critical
 Fix For: 1.12.0


Following query is transformed into timeseries Druid query which yields 
different results in Calcite vs Druid, since it will show all values for the 
given time granularity, even if there is no data for the given _i\_brand\_id_.

In Druid:
{code:sql}
SELECT floor_day(`__time`) as `granularity`, max(ss_quantity), 
sum(ss_wholesale_cost)
FROM store_sales_sold_time_subset
WHERE i_brand_id = 10001009
GROUP BY floor_day(`__time`)
ORDER BY `granularity`;
OK
1999-11-01 00:00:00 45  37.47
1999-11-02 00:00:00 -92233720368547758080.0
1999-11-03 00:00:00 -92233720368547758080.0
1999-11-04 00:00:00 39  61.52
1999-11-05 00:00:00 74  145.84
1999-11-06 00:00:00 62  14.5
1999-11-07 00:00:00 -92233720368547758080.0
1999-11-08 00:00:00 5   34.08
1999-11-09 00:00:00 -92233720368547758080.0
1999-11-10 00:00:00 -92233720368547758080.0
1999-11-11 00:00:00 -92233720368547758080.0
1999-11-12 00:00:00 66  67.22
1999-11-13 00:00:00 -92233720368547758080.0
1999-11-14 00:00:00 -92233720368547758080.0
1999-11-15 00:00:00 -92233720368547758080.0
1999-11-16 00:00:00 60  96.37
1999-11-17 00:00:00 50  79.11
1999-11-18 00:00:00 -92233720368547758080.0
1999-11-19 00:00:00 -92233720368547758080.0
1999-11-20 00:00:00 -92233720368547758080.0
1999-11-21 00:00:00 -92233720368547758080.0
1999-11-22 00:00:00 -92233720368547758080.0
1999-11-23 00:00:00 57  17.69
1999-11-24 00:00:00 -92233720368547758080.0
1999-11-25 00:00:00 -92233720368547758080.0
1999-11-26 00:00:00 -92233720368547758080.0
1999-11-27 00:00:00 86  91.59
1999-11-28 00:00:00 -92233720368547758080.0
1999-11-29 00:00:00 93  136.48
1999-11-30 00:00:00 -92233720368547758080.0
{code:sql}
SELECT floor_day(`__time`) as `granularity`, max(ss_quantity), 
sum(ss_wholesale_cost)
FROM store_sales_sold_time_subset_calcite
WHERE i_brand_id = 10001009
GROUP BY floor_day(`__time`)
ORDER BY `granularity`;
OK
1999-11-01 00:00:00 45  37.47
1999-11-04 00:00:00 39  61.52
1999-11-05 00:00:00 74  145.84
1999-11-06 00:00:00 62  14.5
1999-11-08 00:00:00 5   34.08
1999-11-12 00:00:00 66  67.22
1999-11-16 00:00:00 60  96.36
1999-11-17 00:00:00 50  79.11
1999-11-23 00:00:00 57  17.688
1999-11-27 00:00:00 86  91.59
1999-11-29 00:00:00 93  136.48
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Created] (CALCITE-1588) Add SQL syntax to allow approximate LIMIT and distinct-COUNT

2017-01-18 Thread Julian Hyde (JIRA)
Julian Hyde created CALCITE-1588:


 Summary: Add SQL syntax to allow approximate LIMIT and 
distinct-COUNT
 Key: CALCITE-1588
 URL: https://issues.apache.org/jira/browse/CALCITE-1588
 Project: Calcite
  Issue Type: Bug
Reporter: Julian Hyde
Assignee: Julian Hyde


Add SQL syntax to allow approximate LIMIT and distinct-COUNT. These will set 
the properties specified in CALCITE-1587. By default the properties are false, 
so the query will return exact results.

Exact syntax is to be decided. It could be at the top of the query (therefore 
affecting every LIMIT or aggregate in the query) or it could be more localized 
(e.g. {{COUNT(DISTINCT customerId) APPROXIMATE (WITHIN 10 PERCENT)}}).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Created] (CALCITE-1587) Druid adapter: topN returns approximate results

2017-01-18 Thread Jesus Camacho Rodriguez (JIRA)
Jesus Camacho Rodriguez created CALCITE-1587:


 Summary: Druid adapter: topN returns approximate results
 Key: CALCITE-1587
 URL: https://issues.apache.org/jira/browse/CALCITE-1587
 Project: Calcite
  Issue Type: Bug
  Components: druid
Affects Versions: 1.11.0
Reporter: Jesus Camacho Rodriguez
Assignee: Julian Hyde
 Fix For: 1.12.0


Currently, we convert to _topN_ queries. However, metrics returned by Druid 
will be approximate values. Thus, probably we should not convert to Druid topN 
queries and rather always use Druid groupBy.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


ApacheCon CFP closing soon (11 February)

2017-01-18 Thread Rich Bowen
Hello, fellow Apache enthusiast. Thanks for your participation, and
interest in, the projects of the Apache Software Foundation.

I wanted to remind you that the Call For Papers (CFP) for ApacheCon
North America, and Apache: Big Data North America, closes in less than a
month. If you've been putting it off because there was lots of time
left, it's time to dig for that inspiration and get those talk proposals in.

It's also time to discuss with your developer and user community whether
there's a track of talks that you might want to propose, so that you
have more complete coverage of your project than a talk or two.

We're looking for talks directly, and indirectly, related to projects at
the Apache Software Foundation. These can be anything from in-depth
technical discussions of the projects you work with, to talks about
community, documentation, legal issues, marketing, and so on. We're also
very interested in talks about projects and services built on top of
Apache projects, and case studies of how you use Apache projects to
solve real-world problems.

We are particularly interested in presentations from Apache projects
either in the Incubator, or recently graduated. ApacheCon is where
people come to find out what technology they'll be using this time next
year.

Important URLs are:

To submit a talk for Apache: Big Data -
http://events.linuxfoundation.org/events/apache-big-data-north-america/program/cfp
To submit a talk for ApacheCon -
http://events.linuxfoundation.org/events/apachecon-north-america/program/cfp

To register for Apache: Big Data -
http://events.linuxfoundation.org/events/apache-big-data-north-america/attend/register-
To register for ApacheCon -
http://events.linuxfoundation.org/events/apachecon-north-america/attend/register-

Early Bird registration rates end March 12th, but if you're a committer
on an Apache project, you get the low committer rate, which is less than
half of the early bird rate!

For further updated about ApacheCon, follow us on Twitter, @ApacheCon,
or drop by our IRC channel, #apachecon on the Freenode IRC network. Or
contact me - rbo...@apache.org - with any questions or concerns.

Thanks!

Rich Bowen, VP Conferences, Apache Software Foundation

-- 
(You've received this email because you're on a dev@ or users@ mailing
list of an Apache Software Foundation project. For subscription and
unsubscription information, consult the headers of this email message,
as this varies from one list to another.)