[jira] [Comment Edited] (CALCITE-2059) Apache Geode adapter

2018-02-14 Thread Julian Hyde (JIRA)

[ 
https://issues.apache.org/jira/browse/CALCITE-2059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16364548#comment-16364548
 ] 

Julian Hyde edited comment on CALCITE-2059 at 2/14/18 6:22 PM:
---

FYI, I recently added Uber to the logos, so I added Geode as well. We can drop 
powered-by.png from the pull request.


was (Author: julianhyde):
FYI, I recently added Uber to the logos, to I added Geode as well. We can drop 
powered-by.png from the pull request.

> Apache Geode adapter
> 
>
> Key: CALCITE-2059
> URL: https://issues.apache.org/jira/browse/CALCITE-2059
> Project: Calcite
>  Issue Type: New Feature
>  Components: geode
>Reporter: Christian Tzolov
>Assignee: Julian Hyde
>Priority: Major
>
> I've been working on a Calcite adapter for [Apache 
> Geode|http://geode.apache.org]. 
> Current implementation uses the plain Geode API and 
> [OQL|http://geode.apache.org/docs/guide/13/developing/querying_basics/chapter_overview.html](Object
>  Query Interface) to push down relational expressions such as projections, 
> filtering, sorting, and grouping . 
> Provided functionality can hopefully address certain Geode use cases and will 
> provide a stepping stone for future improvements. 
> Here are some remaining tasks as i see it:
> * New tests for test suite (and update calcite-test-dataset to support Geode)
> * Add Integration tests that use calcite-test-dataset
> * Documentation



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


[jira] [Commented] (CALCITE-2059) Apache Geode adapter

2018-02-14 Thread Julian Hyde (JIRA)

[ 
https://issues.apache.org/jira/browse/CALCITE-2059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16364548#comment-16364548
 ] 

Julian Hyde commented on CALCITE-2059:
--

FYI, I recently added Uber to the logos, to I added Geode as well. We can drop 
powered-by.png from the pull request.

> Apache Geode adapter
> 
>
> Key: CALCITE-2059
> URL: https://issues.apache.org/jira/browse/CALCITE-2059
> Project: Calcite
>  Issue Type: New Feature
>  Components: geode
>Reporter: Christian Tzolov
>Assignee: Julian Hyde
>Priority: Major
>
> I've been working on a Calcite adapter for [Apache 
> Geode|http://geode.apache.org]. 
> Current implementation uses the plain Geode API and 
> [OQL|http://geode.apache.org/docs/guide/13/developing/querying_basics/chapter_overview.html](Object
>  Query Interface) to push down relational expressions such as projections, 
> filtering, sorting, and grouping . 
> Provided functionality can hopefully address certain Geode use cases and will 
> provide a stepping stone for future improvements. 
> Here are some remaining tasks as i see it:
> * New tests for test suite (and update calcite-test-dataset to support Geode)
> * Add Integration tests that use calcite-test-dataset
> * Documentation



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


[jira] [Created] (CALCITE-2177) TUMBLE_START does not respect AS when SELECT and GROUP BY match

2018-02-14 Thread Andrew Pilloud (JIRA)
Andrew Pilloud created CALCITE-2177:
---

 Summary: TUMBLE_START does not respect AS when SELECT and GROUP BY 
match
 Key: CALCITE-2177
 URL: https://issues.apache.org/jira/browse/CALCITE-2177
 Project: Calcite
  Issue Type: Bug
  Components: core
Affects Versions: 1.13.0
Reporter: Andrew Pilloud
Assignee: Julian Hyde


When the order of SELECT and GROUP BY arguments match, the output of 
TUMBLE_START and HOP_START can not be named with AS. Found while trying to 
implement Nexmark benchmark queries in Apache Beam.

This query fails with "An exception occured while executing the Java class. 
null: InvocationTargetException: Type 'RecordType(TIMESTAMP(0) $f0)' has no 
field 'starttime'"
{code:sql}
SELECT B.starttime FROM
   (SELECT
 TUMBLE_START(B1.dateTime, INTERVAL '1' SECOND) AS starttime
  FROM Bid B1
  GROUP BY
 TUMBLE(B1.dateTime, INTERVAL '1' SECOND)) B
{code}
This more useful query also fails with "An exception occured while executing 
the Java class. null: InvocationTargetException: Type 'RecordType(BIGINT 
auction, BIGINT price, TIMESTAMP(0) $f2)' has no field 'starttime'"
{code:sql}
SELECT B.starttime FROM
   (SELECT B1.auction, B1.price,
 TUMBLE_START(B1.dateTime, INTERVAL '1' SECOND) AS starttime
  FROM Bid B1
  GROUP BY B1.auction, B1.price,
 TUMBLE(B1.dateTime, INTERVAL '1' SECOND)) B
{code}
 However swap the order of the select arguments and it works as expected:
{code:sql}
SELECT B.starttime FROM
   (SELECT B1.price, B1.auction,
 TUMBLE_START(B1.dateTime, INTERVAL '1' SECOND) AS starttime
  FROM Bid B1
  GROUP BY B1.auction, B1.price,
  TUMBLE(B1.dateTime, INTERVAL '1' SECOND)) B
{code}
 

More detailed stack from second query:
{code:java}
Caused by: java.lang.AssertionError: Type 'RecordType(TIMESTAMP(0) $f0, BIGINT 
auction, BIGINT price)' has no field 'starttime'
at 
org.apache.beam.sdks.java.extensions.sql.repackaged.org.apache.calcite.rex.RexBuilder.makeFieldAccess(RexBuilder.java:175)
at 
org.apache.beam.sdks.java.extensions.sql.repackaged.org.apache.calcite.sql2rel.SqlToRelConverter.convertIdentifier(SqlToRelConverter.java:3533)
at 
org.apache.beam.sdks.java.extensions.sql.repackaged.org.apache.calcite.sql2rel.SqlToRelConverter.access$1800(SqlToRelConverter.java:210)
at 
org.apache.beam.sdks.java.extensions.sql.repackaged.org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.visit(SqlToRelConverter.java:4545)
at 
org.apache.beam.sdks.java.extensions.sql.repackaged.org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.visit(SqlToRelConverter.java:3904)
at 
org.apache.beam.sdks.java.extensions.sql.repackaged.org.apache.calcite.sql.SqlIdentifier.accept(SqlIdentifier.java:344)
at 
org.apache.beam.sdks.java.extensions.sql.repackaged.org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.convertExpression(SqlToRelConverter.java:4438)
at 
org.apache.beam.sdks.java.extensions.sql.repackaged.org.apache.calcite.sql2rel.SqlToRelConverter.convertSelectList(SqlToRelConverter.java:3744)
at 
org.apache.beam.sdks.java.extensions.sql.repackaged.org.apache.calcite.sql2rel.SqlToRelConverter.convertSelectImpl(SqlToRelConverter.java:662)
at 
org.apache.beam.sdks.java.extensions.sql.repackaged.org.apache.calcite.sql2rel.SqlToRelConverter.convertSelect(SqlToRelConverter.java:619)
at 
org.apache.beam.sdks.java.extensions.sql.repackaged.org.apache.calcite.sql2rel.SqlToRelConverter.convertQueryRecursive(SqlToRelConverter.java:3054)
at 
org.apache.beam.sdks.java.extensions.sql.repackaged.org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:555)
at 
org.apache.beam.sdks.java.extensions.sql.repackaged.org.apache.calcite.prepare.PlannerImpl.rel(PlannerImpl.java:232)
at 
org.apache.beam.sdk.extensions.sql.impl.planner.BeamQueryPlanner.convertToRelNode(BeamQueryPlanner.java:164)
{code}



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


[jira] [Commented] (CALCITE-2170) Use Druid Expressions capabilities to improve the amount of work that can be pushed to Druid

2018-02-14 Thread Jesus Camacho Rodriguez (JIRA)

[ 
https://issues.apache.org/jira/browse/CALCITE-2170?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16364583#comment-16364583
 ] 

Jesus Camacho Rodriguez commented on CALCITE-2170:
--

[~julianhyde], will you be taking a look at the PR? I already did one pass, I 
will be doing another one today and then we would like to merge it. Thanks

> Use Druid Expressions capabilities to improve the amount of work that can be 
> pushed to Druid
> 
>
> Key: CALCITE-2170
> URL: https://issues.apache.org/jira/browse/CALCITE-2170
> Project: Calcite
>  Issue Type: New Feature
>  Components: druid
>Reporter: slim bouguerra
>Assignee: slim bouguerra
>Priority: Major
>
> Druid 0.11 has newly built in capabilities called Expressions that can be 
> used to push expression like projects/aggregates/filters. 
> In order to leverage this new feature, some changes need to be done to the 
> Druid Calcite adapter. 
> This is a link to the current supported functions and expressions in Druid
>  [http://druid.io/docs/latest/misc/math-expr.html]
> As you can see from the Docs an expression can be an actual tree of operators,
> Expression can be used with Filters, Projects, Aggregates, PostAggregates and
> Having filters. For Filters will have new Filter kind called Filter 
> expression.
> FYI, you might ask can we push everything as Expression Filter the short 
> answer
> is no because, other kinds of Druid filters perform better when used, Hence
> Expression filter is a plan B sort of thing. In order to push expression as
> Projects and Aggregates we will be using Expression based Virtual Columns.
> The major change is the merging of the logic of pushdown verification code and
> the Translation of RexCall/RexNode to Druid Json, native physical language. 
> The
> main drive behind this redesign is the fact that in order to check if we can
> push down a tree of expressions to Druid we have to compute the Druid 
> Expression
> String anyway. Thus instead of having 2 different code paths, one for pushdown
> validation and one for Json generation we can have one function that does 
> both.
> For instance instead of having one code path to test and check if a given 
> filter
> can be pushed or not and then having a translation layer code, will have
> one function that either returns a valid Druid Filter or null if it is not
> possible to pushdown. The same idea will be applied to how we push Projects 
> and
> Aggregates, Post Aggregates and Sort.
> Here are the main elements/Classes of the new design. First will be merging 
> the logic of
> Translation of Literals/InputRex/RexCall to a Druid physical representation.
> Translate leaf RexNode to Valid pair Druid Column + Extraction functions if 
> possible
> {code:java}
> /**
>  * @param rexNode leaf Input Ref to Druid Column
>  * @param rowType row type
>  * @param druidQuery druid query
>  *
>  * @return {@link Pair} of Column name and Extraction Function on the top of 
> the input ref or
>  * {@link Pair of(null, null)} when can not translate to valid Druid column
>  */
>  protected static Pair toDruidColumn(RexNode 
> rexNode,
>  RelDataType rowType, DruidQuery druidQuery
>  )
> {code}
> In the other hand, in order to Convert Literals to Druid Literals will 
> introduce
> {code:java}
> /**
>  * @param rexNode rexNode to translate to Druid literal equivalante
>  * @param rowType rowType associated to rexNode
>  * @param druidQuery druid Query
>  *
>  * @return non null string or null if it can not translate to valid Druid 
> equivalent
>  */
> @Nullable
> private static String toDruidLiteral(RexNode rexNode, RelDataType rowType,
>  DruidQuery druidQuery
> )
> {code}
> Main new functions used to pushdown nodes and Druid Json generation.
> Filter pushdown verification and generates is done via
> {code:java}
> org.apache.calcite.adapter.druid.DruidJsonFilter#toDruidFilters
> {code}
> For project pushdown added
> {code:java}
> org.apache.calcite.adapter.druid.DruidQuery#computeProjectAsScan.
> {code}
> For Grouping pushdown added
> {code:java}
> org.apache.calcite.adapter.druid.DruidQuery#computeProjectGroupSet.
> {code}
> For Aggregation pushdown added
> {code:java}
> org.apache.calcite.adapter.druid.DruidQuery#computeDruidJsonAgg
> {code}
> For sort pushdown added
> {code:java}
> org.apache.calcite.adapter.druid.DruidQuery#computeSort\{code}
> Pushing of PostAggregates will be using Expression post Aggregates and use
> {code}
> org.apache.calcite.adapter.druid.DruidExpressions#toDruidExpression\{code}
> to generate expression
> For Expression computation most of the work is done here
> {code:java}
> org.apache.calcite.adapter.druid.DruidExpressions#toDruidExpression\{code}
> This static function generates Druid Str

[jira] [Commented] (CALCITE-2059) Apache Geode adapter

2018-02-14 Thread Christian Tzolov (JIRA)

[ 
https://issues.apache.org/jira/browse/CALCITE-2059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16364795#comment-16364795
 ] 

Christian Tzolov commented on CALCITE-2059:
---

Thanks [~julianhyde]! Sure we can address the REGION_MAP'/JAVA_TYPE_FACTOR 
later.

As mentioned above i've removed the GeodeAggregationSort and Main1Foo as 
redundant. So i hope this is addressed too. 

Would you remove the powered-by.png during the merge or you would like me to do 
it?

> Apache Geode adapter
> 
>
> Key: CALCITE-2059
> URL: https://issues.apache.org/jira/browse/CALCITE-2059
> Project: Calcite
>  Issue Type: New Feature
>  Components: geode
>Reporter: Christian Tzolov
>Assignee: Julian Hyde
>Priority: Major
>
> I've been working on a Calcite adapter for [Apache 
> Geode|http://geode.apache.org]. 
> Current implementation uses the plain Geode API and 
> [OQL|http://geode.apache.org/docs/guide/13/developing/querying_basics/chapter_overview.html](Object
>  Query Interface) to push down relational expressions such as projections, 
> filtering, sorting, and grouping . 
> Provided functionality can hopefully address certain Geode use cases and will 
> provide a stepping stone for future improvements. 
> Here are some remaining tasks as i see it:
> * New tests for test suite (and update calcite-test-dataset to support Geode)
> * Add Integration tests that use calcite-test-dataset
> * Documentation



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


[jira] [Created] (CALCITE-2178) Extend expression simplifier to work on datetime FLOOR functions

2018-02-14 Thread Jesus Camacho Rodriguez (JIRA)
Jesus Camacho Rodriguez created CALCITE-2178:


 Summary: Extend expression simplifier to work on datetime FLOOR 
functions
 Key: CALCITE-2178
 URL: https://issues.apache.org/jira/browse/CALCITE-2178
 Project: Calcite
  Issue Type: Improvement
  Components: core
 Environment: Extend expression simplifier to support:
{code}
FLOOR(FLOOR(CAST('2010-01-10 00:00:00' AS TIMESTAMP) TO HOUR) TO DAY) => 
FLOOR(CAST('2010-01-10 00:00:00' AS TIMESTAMP) TO DAY)
{code}
Reporter: Jesus Camacho Rodriguez
Assignee: Jesus Camacho Rodriguez
 Fix For: 1.16.0






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


[jira] [Updated] (CALCITE-2178) Extend expression simplifier to work on datetime FLOOR functions

2018-02-14 Thread Jesus Camacho Rodriguez (JIRA)

 [ 
https://issues.apache.org/jira/browse/CALCITE-2178?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jesus Camacho Rodriguez updated CALCITE-2178:
-
Description: 
Extend expression simplifier to support: FLOOR(FLOOR(CAST( '2010-01-10 
00:00:00' AS TIMESTAMP) TO HOUR) TO DAY) => FLOOR(CAST( '2010-01-10 00:00:00' 
AS TIMESTAMP) TO DAY)


> Extend expression simplifier to work on datetime FLOOR functions
> 
>
> Key: CALCITE-2178
> URL: https://issues.apache.org/jira/browse/CALCITE-2178
> Project: Calcite
>  Issue Type: Improvement
>  Components: core
> Environment: Extend expression simplifier to support:
> {code}
> FLOOR(FLOOR(CAST('2010-01-10 00:00:00' AS TIMESTAMP) TO HOUR) TO DAY) => 
> FLOOR(CAST('2010-01-10 00:00:00' AS TIMESTAMP) TO DAY)
> {code}
>Reporter: Jesus Camacho Rodriguez
>Assignee: Jesus Camacho Rodriguez
>Priority: Major
> Fix For: 1.16.0
>
>
> Extend expression simplifier to support: FLOOR(FLOOR(CAST( '2010-01-10 
> 00:00:00' AS TIMESTAMP) TO HOUR) TO DAY) => FLOOR(CAST( '2010-01-10 00:00:00' 
> AS TIMESTAMP) TO DAY)



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


[jira] [Updated] (CALCITE-2178) Extend expression simplifier to work on datetime FLOOR functions

2018-02-14 Thread Jesus Camacho Rodriguez (JIRA)

 [ 
https://issues.apache.org/jira/browse/CALCITE-2178?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jesus Camacho Rodriguez updated CALCITE-2178:
-
Environment: (was: Extend expression simplifier to support:
{code}
FLOOR(FLOOR(CAST('2010-01-10 00:00:00' AS TIMESTAMP) TO HOUR) TO DAY) => 
FLOOR(CAST('2010-01-10 00:00:00' AS TIMESTAMP) TO DAY)
{code})

> Extend expression simplifier to work on datetime FLOOR functions
> 
>
> Key: CALCITE-2178
> URL: https://issues.apache.org/jira/browse/CALCITE-2178
> Project: Calcite
>  Issue Type: Improvement
>  Components: core
>Reporter: Jesus Camacho Rodriguez
>Assignee: Jesus Camacho Rodriguez
>Priority: Major
> Fix For: 1.16.0
>
>
> Extend expression simplifier to support: FLOOR(FLOOR(CAST( '2010-01-10 
> 00:00:00' AS TIMESTAMP) TO HOUR) TO DAY) => FLOOR(CAST( '2010-01-10 00:00:00' 
> AS TIMESTAMP) TO DAY)



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


[jira] [Updated] (CALCITE-2178) Extend expression simplifier to work on datetime FLOOR functions

2018-02-14 Thread Jesus Camacho Rodriguez (JIRA)

 [ 
https://issues.apache.org/jira/browse/CALCITE-2178?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jesus Camacho Rodriguez updated CALCITE-2178:
-
Description: 
Extend expression simplifier to support:
{code}
FLOOR(FLOOR(CAST( '2010-01-10 00:00:00' AS TIMESTAMP) TO HOUR) TO DAY) => 
FLOOR(CAST( '2010-01-10 00:00:00' AS TIMESTAMP) TO DAY)
{code}


  was:
Extend expression simplifier to support: FLOOR(FLOOR(CAST( '2010-01-10 
00:00:00' AS TIMESTAMP) TO HOUR) TO DAY) => FLOOR(CAST( '2010-01-10 00:00:00' 
AS TIMESTAMP) TO DAY)



> Extend expression simplifier to work on datetime FLOOR functions
> 
>
> Key: CALCITE-2178
> URL: https://issues.apache.org/jira/browse/CALCITE-2178
> Project: Calcite
>  Issue Type: Improvement
>  Components: core
>Reporter: Jesus Camacho Rodriguez
>Assignee: Jesus Camacho Rodriguez
>Priority: Major
> Fix For: 1.16.0
>
>
> Extend expression simplifier to support:
> {code}
> FLOOR(FLOOR(CAST( '2010-01-10 00:00:00' AS TIMESTAMP) TO HOUR) TO DAY) => 
> FLOOR(CAST( '2010-01-10 00:00:00' AS TIMESTAMP) TO DAY)
> {code}



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


[jira] [Comment Edited] (CALCITE-2172) Document IDE setup for project contribution

2018-02-14 Thread Julian Hyde (JIRA)

[ 
https://issues.apache.org/jira/browse/CALCITE-2172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16363436#comment-16363436
 ] 

Julian Hyde edited comment on CALCITE-2172 at 2/14/18 10:34 PM:


Settled on IDEA and NetBeans for now. There are couple of open issues with 
Calcite, Maven, and Eclipse (see CALCITE-994). 


was (Author: ebegoli):
Settled on IDEA and NetBeans for now. There are couple of open issues with 
Calcite, Maven, and Eclipse 
(https://issues.apache.org/jira/browse/CALCITE-994). 

> Document IDE setup for project contribution
> ---
>
> Key: CALCITE-2172
> URL: https://issues.apache.org/jira/browse/CALCITE-2172
> Project: Calcite
>  Issue Type: Improvement
>  Components: site
>Reporter: Edmon Begoli
>Assignee: Edmon Begoli
>Priority: Trivial
>  Labels: documentation
>   Original Estimate: 48h
>  Remaining Estimate: 48h
>
> Document the IDE setup for Calcite development. 
> Start with IDEA, document Eclipse, NetBeans, and maybe VIM and Emacs. 



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


[jira] [Commented] (CALCITE-2172) Document IDE setup for project contribution

2018-02-14 Thread Julian Hyde (JIRA)

[ 
https://issues.apache.org/jira/browse/CALCITE-2172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16364881#comment-16364881
 ] 

Julian Hyde commented on CALCITE-2172:
--

I reviewed [PR 
627|https://github.com/apache/calcite/pull/627/commits/04c461f5302aff89ef1429bbb59850e87cf82f8e]:
* It's easier if you build Calcite from the command line *before* opening the 
project in Intellij, so I think your instructions should mention that. (I know 
you mention how to re-build, later.)
* Make clear that testWinAgg is just an example of how you can run a test. Also 
mention that once you've run it, you can also invoke it from the debugger.
* Also, please add links to the Intellij and Netbeans sections from the 
developer guide.

> Document IDE setup for project contribution
> ---
>
> Key: CALCITE-2172
> URL: https://issues.apache.org/jira/browse/CALCITE-2172
> Project: Calcite
>  Issue Type: Improvement
>  Components: site
>Reporter: Edmon Begoli
>Assignee: Edmon Begoli
>Priority: Trivial
>  Labels: documentation
>   Original Estimate: 48h
>  Remaining Estimate: 48h
>
> Document the IDE setup for Calcite development. 
> Start with IDEA, document Eclipse, NetBeans, and maybe VIM and Emacs. 



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


[jira] [Created] (CALCITE-2179) General improvements for materialized view rewriting rule

2018-02-14 Thread Jesus Camacho Rodriguez (JIRA)
Jesus Camacho Rodriguez created CALCITE-2179:


 Summary: General improvements for materialized view rewriting rule
 Key: CALCITE-2179
 URL: https://issues.apache.org/jira/browse/CALCITE-2179
 Project: Calcite
  Issue Type: Improvement
  Components: core
Reporter: Jesus Camacho Rodriguez
Assignee: Jesus Camacho Rodriguez
 Fix For: 1.16.0


This issue is for extending {{AbstractMaterializedViewRule}} rule:
- Support for rolling up date nodes. For instance, rewrite in the following 
case:
{code}
Materialization:
select "empid", floor(cast('1997-01-20' as timestamp) to month), count(*) + 1 
as c, sum("empid") as s
from "emps" group by "empid", floor(cast('1997-01-20' as timestamp) to month);
Query:
select floor(cast('1997-01-20' as timestamp) to year), sum("empid") as s
from "emps" group by floor(cast('1997-01-20' as timestamp) to year);
{code}
- Add flag to enable/disable fast bail out for joins. By default it is true, 
and thus, we were only creating the rewriting in the minimal subtree of plan 
operators. For instance:
{code}
View: (A JOIN B) JOIN C
Query: (((A JOIN B) JOIN D) JOIN C) JOIN E
{code}
We produce it at:
{code}
((A JOIN B) JOIN D) JOIN C
{code}
But not at:
{code}
(((A JOIN B) JOIN D) JOIN C) JOIN E
{code}
This is important when the rule is used with the Volcano planner together with 
other rules, e.g. join reordering, as it prevents that the search space grows 
unnecessarily. However, if we use the rewriting rule in isolation, fast bail 
out can lead to missing rewriting opportunities (e.g. for bushy join trees).
- Possibility to provide a HepProgram to optimize query branch in union 
rewritings. Note that when we produce a partial rewriting with a Union, the 
branch that will execute the (partial) query can be fully rewritten so we can 
add the compensation predicate. (We cannot do the same for views because the 
expression might not be computable if the needed subexpressions are not 
available in the view output). If we use Volcano with a determined set of 
rules, this might not be needed, hence providing this program is optional.
- Multiple small fixes discovered while testing.



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


[jira] [Commented] (CALCITE-2178) Extend expression simplifier to work on datetime FLOOR functions

2018-02-14 Thread Jesus Camacho Rodriguez (JIRA)

[ 
https://issues.apache.org/jira/browse/CALCITE-2178?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16364913#comment-16364913
 ] 

Jesus Camacho Rodriguez commented on CALCITE-2178:
--

[~julianhyde], could you take a look at it? This should go in before 
CALCITE-2179.
https://github.com/apache/calcite/pull/628

Thanks

> Extend expression simplifier to work on datetime FLOOR functions
> 
>
> Key: CALCITE-2178
> URL: https://issues.apache.org/jira/browse/CALCITE-2178
> Project: Calcite
>  Issue Type: Improvement
>  Components: core
>Reporter: Jesus Camacho Rodriguez
>Assignee: Jesus Camacho Rodriguez
>Priority: Major
> Fix For: 1.16.0
>
>
> Extend expression simplifier to support:
> {code}
> FLOOR(FLOOR(CAST( '2010-01-10 00:00:00' AS TIMESTAMP) TO HOUR) TO DAY) => 
> FLOOR(CAST( '2010-01-10 00:00:00' AS TIMESTAMP) TO DAY)
> {code}



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


[jira] [Commented] (CALCITE-2172) Document IDE setup for project contribution

2018-02-14 Thread Julian Hyde (JIRA)

[ 
https://issues.apache.org/jira/browse/CALCITE-2172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16364920#comment-16364920
 ] 

Julian Hyde commented on CALCITE-2172:
--

It would be nice if someone make a video of these steps (git clone, mvn, open 
in intellij, create a test method, set a break-point (e.g. in the constructor 
of Sort), and run the test method in the debugger until you hit the break 
point). I believe this video could be well under 3 minutes long (in mvn, skip 
tests and checkstyle; and open intellij when core has completed but while other 
modules are still building).

> Document IDE setup for project contribution
> ---
>
> Key: CALCITE-2172
> URL: https://issues.apache.org/jira/browse/CALCITE-2172
> Project: Calcite
>  Issue Type: Improvement
>  Components: site
>Reporter: Edmon Begoli
>Assignee: Edmon Begoli
>Priority: Trivial
>  Labels: documentation
>   Original Estimate: 48h
>  Remaining Estimate: 48h
>
> Document the IDE setup for Calcite development. 
> Start with IDEA, document Eclipse, NetBeans, and maybe VIM and Emacs. 



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


[jira] [Commented] (CALCITE-2172) Document IDE setup for project contribution

2018-02-14 Thread Edmon Begoli (JIRA)

[ 
https://issues.apache.org/jira/browse/CALCITE-2172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16364960#comment-16364960
 ] 

Edmon Begoli commented on CALCITE-2172:
---

Let's do debugging as a separate JIRA. Maybe something like "Getting started 
with the Calcite development process." I think such tutorial is missing, and it 
is really easy for these systems that have multiple points of entry when it 
comes to development, testing, and execution.  

> Document IDE setup for project contribution
> ---
>
> Key: CALCITE-2172
> URL: https://issues.apache.org/jira/browse/CALCITE-2172
> Project: Calcite
>  Issue Type: Improvement
>  Components: site
>Reporter: Edmon Begoli
>Assignee: Edmon Begoli
>Priority: Trivial
>  Labels: documentation
>   Original Estimate: 48h
>  Remaining Estimate: 48h
>
> Document the IDE setup for Calcite development. 
> Start with IDEA, document Eclipse, NetBeans, and maybe VIM and Emacs. 



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


[jira] [Comment Edited] (CALCITE-2172) Document IDE setup for project contribution

2018-02-14 Thread Edmon Begoli (JIRA)

[ 
https://issues.apache.org/jira/browse/CALCITE-2172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16364960#comment-16364960
 ] 

Edmon Begoli edited comment on CALCITE-2172 at 2/14/18 11:58 PM:
-

Let's do debugging-centered video as a separate JIRA. Maybe something like 
"Getting started with the Calcite development process." I think such tutorial 
is missing/needed, but probably under a different unit of work.


was (Author: ebegoli):
Let's do debugging as a separate JIRA. Maybe something like "Getting started 
with the Calcite development process." I think such tutorial is missing, and it 
is really easy for these systems that have multiple points of entry when it 
comes to development, testing, and execution.  

> Document IDE setup for project contribution
> ---
>
> Key: CALCITE-2172
> URL: https://issues.apache.org/jira/browse/CALCITE-2172
> Project: Calcite
>  Issue Type: Improvement
>  Components: site
>Reporter: Edmon Begoli
>Assignee: Edmon Begoli
>Priority: Trivial
>  Labels: documentation
>   Original Estimate: 48h
>  Remaining Estimate: 48h
>
> Document the IDE setup for Calcite development. 
> Start with IDEA, document Eclipse, NetBeans, and maybe VIM and Emacs. 



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


[jira] [Commented] (CALCITE-2178) Extend expression simplifier to work on datetime FLOOR functions

2018-02-14 Thread Julian Hyde (JIRA)

[ 
https://issues.apache.org/jira/browse/CALCITE-2178?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16365051#comment-16365051
 ] 

Julian Hyde commented on CALCITE-2178:
--

Review comments:
* Any time we add a feature for FLOOR, let's also do it for CEIL. They are 
duals. In the long run, doing it for just FLOOR makes things more complicated.
* Time units are a partial order, not a total order. You cannot roll up weeks 
to months, nor months to weeks. So, comparing TimeUnitHierarchy.ordinal() is 
wrong.
* I don't see the need for TimeUnitHierarchy. There is already 
org.apache.calcite.avatica.util.TimeUnit, which is very similar. It even 
contains details of the roll-up, like the multiplier between a unit and its 
parent unit. Rather than TimeUnitHierarchy, I'd add a method {{static boolean 
canRollUp(TimeUnit, TimeUnit)}}. Perhaps that could get added to Avatica 
eventually.

> Extend expression simplifier to work on datetime FLOOR functions
> 
>
> Key: CALCITE-2178
> URL: https://issues.apache.org/jira/browse/CALCITE-2178
> Project: Calcite
>  Issue Type: Improvement
>  Components: core
>Reporter: Jesus Camacho Rodriguez
>Assignee: Jesus Camacho Rodriguez
>Priority: Major
> Fix For: 1.16.0
>
>
> Extend expression simplifier to support:
> {code}
> FLOOR(FLOOR(CAST( '2010-01-10 00:00:00' AS TIMESTAMP) TO HOUR) TO DAY) => 
> FLOOR(CAST( '2010-01-10 00:00:00' AS TIMESTAMP) TO DAY)
> {code}



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


[jira] [Commented] (CALCITE-2172) Document IDE setup for project contribution

2018-02-14 Thread Julian Hyde (JIRA)

[ 
https://issues.apache.org/jira/browse/CALCITE-2172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16365053#comment-16365053
 ] 

Julian Hyde commented on CALCITE-2172:
--

Agreed. Video is out of scope.

> Document IDE setup for project contribution
> ---
>
> Key: CALCITE-2172
> URL: https://issues.apache.org/jira/browse/CALCITE-2172
> Project: Calcite
>  Issue Type: Improvement
>  Components: site
>Reporter: Edmon Begoli
>Assignee: Edmon Begoli
>Priority: Trivial
>  Labels: documentation
>   Original Estimate: 48h
>  Remaining Estimate: 48h
>
> Document the IDE setup for Calcite development. 
> Start with IDEA, document Eclipse, NetBeans, and maybe VIM and Emacs. 



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


[jira] [Commented] (CALCITE-2178) Extend expression simplifier to work on datetime FLOOR functions

2018-02-14 Thread Jesus Camacho Rodriguez (JIRA)

[ 
https://issues.apache.org/jira/browse/CALCITE-2178?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16365106#comment-16365106
 ] 

Jesus Camacho Rodriguez commented on CALCITE-2178:
--

Thanks for the feedback [~julianhyde], I have updated the PR, could you take a 
look? Weeks should not be there indeed. I have rewritten the logic to use 
{{TimeUnit}} and I have added a method {{canRollUp}} that accounts for the fact 
that {{QUARTER}} is not in order in the enumeration.

> Extend expression simplifier to work on datetime FLOOR functions
> 
>
> Key: CALCITE-2178
> URL: https://issues.apache.org/jira/browse/CALCITE-2178
> Project: Calcite
>  Issue Type: Improvement
>  Components: core
>Reporter: Jesus Camacho Rodriguez
>Assignee: Jesus Camacho Rodriguez
>Priority: Major
> Fix For: 1.16.0
>
>
> Extend expression simplifier to support:
> {code}
> FLOOR(FLOOR(CAST( '2010-01-10 00:00:00' AS TIMESTAMP) TO HOUR) TO DAY) => 
> FLOOR(CAST( '2010-01-10 00:00:00' AS TIMESTAMP) TO DAY)
> {code}



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