[GitHub] [calcite] chunweilei commented on issue #921: [CALCITE-2658] Add ExchangeRemoveConstantKeysRule that removes consta…

2019-03-27 Thread GitBox
chunweilei commented on issue #921: [CALCITE-2658] Add 
ExchangeRemoveConstantKeysRule that removes consta…
URL: https://github.com/apache/calcite/pull/921#issuecomment-477451000
 
 
   @hsyuan Resolved.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [calcite] LaiZhou commented on issue #1126: [CALCITE-2960] CalciteCatalogReader now uses config.caseSensitive() to get functions…

2019-03-27 Thread GitBox
LaiZhou commented on issue #1126: [CALCITE-2960] CalciteCatalogReader now uses 
config.caseSensitive() to get functions…
URL: https://github.com/apache/calcite/pull/1126#issuecomment-477449008
 
 
   @hsyuan done . 
[CALCITE-2960](https://issues.apache.org/jira/browse/CALCITE-2960)


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [calcite] zhztheplayer closed pull request #1111: [CALCITE-2927] The Javadoc and implement of RuleQueue.computeImportance() is inconsistent

2019-03-27 Thread GitBox
zhztheplayer closed pull request #: [CALCITE-2927] The Javadoc and 
implement of RuleQueue.computeImportance() is inconsistent
URL: https://github.com/apache/calcite/pull/
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[calcite] branch master updated: [CALCITE-2927] The Javadoc and implement of RuleQueue.computeImportance() is inconsistent (Meng Wang)

2019-03-27 Thread hongze
This is an automated email from the ASF dual-hosted git repository.

hongze pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/calcite.git


The following commit(s) were added to refs/heads/master by this push:
 new 3124a85  [CALCITE-2927] The Javadoc and implement of 
RuleQueue.computeImportance() is inconsistent (Meng Wang)
3124a85 is described below

commit 3124a85b93ff2f1b79484c7bd4cc41835d4f1920
Author: wangzzu 
AuthorDate: Mon Mar 18 09:57:44 2019 +0800

[CALCITE-2927] The Javadoc and implement of RuleQueue.computeImportance() 
is inconsistent (Meng Wang)

Close apache/calcite#
---
 core/src/main/java/org/apache/calcite/plan/volcano/RuleQueue.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/core/src/main/java/org/apache/calcite/plan/volcano/RuleQueue.java 
b/core/src/main/java/org/apache/calcite/plan/volcano/RuleQueue.java
index ab025e3..25135f0 100644
--- a/core/src/main/java/org/apache/calcite/plan/volcano/RuleQueue.java
+++ b/core/src/main/java/org/apache/calcite/plan/volcano/RuleQueue.java
@@ -356,7 +356,7 @@ class RuleQueue {
*
* 
* the root {@link RelSubset} has an importance of 1
-   * the importance of any other subset is the sum of its importance to
+   * the importance of any other subset is the max of its importance to
* its parents
* The importance of children is pro-rated according to the cost of the
* children. Consider a node which has a cost of 3, and children with costs
@@ -368,7 +368,7 @@ class RuleQueue {
*
* The formula for the importance I of node n is:
*
-   * In = Sumparents p of n{Ip .
+   * In = Maxparents p of n{Ip .
* W n, p}
*
* where Wn, p, the weight of n within its parent p, is



[GitHub] [calcite] zhztheplayer commented on issue #1111: [CALCITE-2927] The Javadoc and implement of RuleQueue.computeImportance() is inconsistent

2019-03-27 Thread GitBox
zhztheplayer commented on issue #: [CALCITE-2927] The Javadoc and implement 
of RuleQueue.computeImportance() is inconsistent
URL: https://github.com/apache/calcite/pull/#issuecomment-477447304
 
 
   I'll help do the merge due to lack of the contributor suffix in the commit 
message. Thanks for the review, @asereda-gs .


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [calcite] hsyuan commented on issue #921: [CALCITE-2658] Add ExchangeRemoveConstantKeysRule that removes consta…

2019-03-27 Thread GitBox
hsyuan commented on issue #921: [CALCITE-2658] Add 
ExchangeRemoveConstantKeysRule that removes consta…
URL: https://github.com/apache/calcite/pull/921#issuecomment-477446432
 
 
   You have to resolve conflicts.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [calcite] hsyuan merged pull request #912: [CALCITE-2729] introducing WindowReduceExpressionsRule

2019-03-27 Thread GitBox
hsyuan merged pull request #912: [CALCITE-2729] introducing 
WindowReduceExpressionsRule
URL: https://github.com/apache/calcite/pull/912
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[calcite] branch master updated: [CALCITE-2729] Introducing WindowReduceExpressionsRule (Chunwei Lei)

2019-03-27 Thread hyuan
This is an automated email from the ASF dual-hosted git repository.

hyuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/calcite.git


The following commit(s) were added to refs/heads/master by this push:
 new aafdc52  [CALCITE-2729] Introducing WindowReduceExpressionsRule 
(Chunwei Lei)
aafdc52 is described below

commit aafdc5219682e535144b1f25e2e41884f793d514
Author: chunwei.lcw 
AuthorDate: Sun Nov 11 13:55:43 2018 +0800

[CALCITE-2729] Introducing WindowReduceExpressionsRule (Chunwei Lei)
---
 .../apache/calcite/prepare/CalcitePrepareImpl.java |  1 +
 .../calcite/rel/rules/ReduceExpressionsRule.java   | 88 ++
 .../org/apache/calcite/test/RelOptRulesTest.java   | 19 +
 .../org/apache/calcite/test/RelOptRulesTest.xml| 28 +++
 4 files changed, 136 insertions(+)

diff --git 
a/core/src/main/java/org/apache/calcite/prepare/CalcitePrepareImpl.java 
b/core/src/main/java/org/apache/calcite/prepare/CalcitePrepareImpl.java
index a7181a0..d5fee2d 100644
--- a/core/src/main/java/org/apache/calcite/prepare/CalcitePrepareImpl.java
+++ b/core/src/main/java/org/apache/calcite/prepare/CalcitePrepareImpl.java
@@ -241,6 +241,7 @@ public class CalcitePrepareImpl implements CalcitePrepare {
   ReduceExpressionsRule.PROJECT_INSTANCE,
   ReduceExpressionsRule.FILTER_INSTANCE,
   ReduceExpressionsRule.CALC_INSTANCE,
+  ReduceExpressionsRule.WINDOW_INSTANCE,
   ReduceExpressionsRule.JOIN_INSTANCE,
   ValuesReduceRule.FILTER_INSTANCE,
   ValuesReduceRule.PROJECT_FILTER_INSTANCE,
diff --git 
a/core/src/main/java/org/apache/calcite/rel/rules/ReduceExpressionsRule.java 
b/core/src/main/java/org/apache/calcite/rel/rules/ReduceExpressionsRule.java
index 48ed3cd..e55c417 100644
--- a/core/src/main/java/org/apache/calcite/rel/rules/ReduceExpressionsRule.java
+++ b/core/src/main/java/org/apache/calcite/rel/rules/ReduceExpressionsRule.java
@@ -21,6 +21,9 @@ import org.apache.calcite.plan.RelOptPredicateList;
 import org.apache.calcite.plan.RelOptRule;
 import org.apache.calcite.plan.RelOptRuleCall;
 import org.apache.calcite.plan.RelOptUtil;
+import org.apache.calcite.rel.RelCollation;
+import org.apache.calcite.rel.RelCollations;
+import org.apache.calcite.rel.RelFieldCollation;
 import org.apache.calcite.rel.RelNode;
 import org.apache.calcite.rel.core.Calc;
 import org.apache.calcite.rel.core.EquiJoin;
@@ -29,9 +32,11 @@ import org.apache.calcite.rel.core.Join;
 import org.apache.calcite.rel.core.JoinInfo;
 import org.apache.calcite.rel.core.Project;
 import org.apache.calcite.rel.core.RelFactories;
+import org.apache.calcite.rel.core.Window;
 import org.apache.calcite.rel.logical.LogicalCalc;
 import org.apache.calcite.rel.logical.LogicalFilter;
 import org.apache.calcite.rel.logical.LogicalProject;
+import org.apache.calcite.rel.logical.LogicalWindow;
 import org.apache.calcite.rel.metadata.RelMetadataQuery;
 import org.apache.calcite.rel.type.RelDataType;
 import org.apache.calcite.rel.type.RelDataTypeFactory;
@@ -55,6 +60,7 @@ import org.apache.calcite.rex.RexSubQuery;
 import org.apache.calcite.rex.RexUnknownAs;
 import org.apache.calcite.rex.RexUtil;
 import org.apache.calcite.rex.RexVisitorImpl;
+import org.apache.calcite.sql.SqlAggFunction;
 import org.apache.calcite.sql.SqlKind;
 import org.apache.calcite.sql.SqlOperator;
 import org.apache.calcite.sql.fun.SqlRowOperator;
@@ -76,6 +82,7 @@ import java.util.Deque;
 import java.util.List;
 import java.util.Map;
 import java.util.regex.Pattern;
+import java.util.stream.Collectors;
 
 /**
  * Collection of planner rules that apply various simplifying transformations 
on
@@ -131,6 +138,14 @@ public abstract class ReduceExpressionsRule extends 
RelOptRule {
   new CalcReduceExpressionsRule(LogicalCalc.class, true,
   RelFactories.LOGICAL_BUILDER);
 
+  /**
+   * Singleton rule that reduces constants inside a
+   * {@link org.apache.calcite.rel.logical.LogicalWindow}.
+   */
+  public static final ReduceExpressionsRule WINDOW_INSTANCE =
+  new WindowReduceExpressionsRule(LogicalWindow.class, true,
+  RelFactories.LOGICAL_BUILDER);
+
   protected final boolean matchNullability;
 
   /**
@@ -453,6 +468,79 @@ public abstract class ReduceExpressionsRule extends 
RelOptRule {
 }
   }
 
+  /**
+   * Rule that reduces constants inside a {@link 
org.apache.calcite.rel.core.Window}.
+   */
+  public static class WindowReduceExpressionsRule
+  extends ReduceExpressionsRule {
+
+public WindowReduceExpressionsRule(Class windowClass,
+boolean matchNullability, RelBuilderFactory relBuilderFactory) {
+  super(windowClass, matchNullability, relBuilderFactory,
+  "ReduceExpressionsRule(Window)");
+}
+
+@Override public void onMatch(RelOptRuleCall call) {
+  LogicalWindow window = call.rel(0);
+  RexBuilder rexBuilder = window.getCluster().getRexBuilder();
+  final RelMetadataQuery mq = 

[GitHub] [calcite] zhztheplayer closed pull request #1070: [CALCITE-2808] Add the JSON_LENGTH function

2019-03-27 Thread GitBox
zhztheplayer closed pull request #1070: [CALCITE-2808] Add the JSON_LENGTH 
function
URL: https://github.com/apache/calcite/pull/1070
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[calcite] branch master updated: [CALCITE-2808] Add the JSON_LENGTH function (xuqianjin)

2019-03-27 Thread hongze
This is an automated email from the ASF dual-hosted git repository.

hongze pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/calcite.git


The following commit(s) were added to refs/heads/master by this push:
 new 2d33c57  [CALCITE-2808] Add the JSON_LENGTH function (xuqianjin)
2d33c57 is described below

commit 2d33c57bff41b6ea473f8f60505a10b196ea79d7
Author: XuQianJin-Stars 
AuthorDate: Tue Mar 5 18:35:24 2019 +0800

[CALCITE-2808] Add the JSON_LENGTH function (xuqianjin)

Close apache/calcite#1070
---
 babel/src/main/codegen/config.fmpp |   5 +-
 core/src/main/codegen/config.fmpp  |   1 +
 core/src/main/codegen/templates/Parser.jj  |  50 
 .../calcite/adapter/enumerable/RexImpTable.java|   7 ++-
 .../apache/calcite/runtime/.SqlFunctions.java.swp  | Bin 0 -> 16384 bytes
 .../apache/calcite/runtime/CalciteResource.java|  14 +++--
 .../org/apache/calcite/runtime/SqlFunctions.java   |  62 ++--
 .../sql/fun/SqlJsonApiCommonSyntaxOperator.java|  34 ---
 .../calcite/sql/fun/SqlJsonLengthFunction.java |  65 +
 .../calcite/sql/fun/SqlStdOperatorTable.java   |   7 ++-
 .../org/apache/calcite/util/BuiltInMethod.java |   3 +
 .../calcite/runtime/CalciteResource.properties |   6 +-
 core/src/test/codegen/config.fmpp  |   1 +
 .../calcite/rel/rel2sql/RelToSqlConverterTest.java |   9 +++
 .../apache/calcite/sql/parser/SqlParserTest.java   |  11 
 .../calcite/sql/test/SqlOperatorBaseTest.java  |  54 -
 .../java/org/apache/calcite/test/JdbcTest.java |  25 +---
 .../apache/calcite/test/SqlJsonFunctionsTest.java  |  36 
 .../org/apache/calcite/test/SqlValidatorTest.java  |   9 +++
 server/src/main/codegen/config.fmpp|   1 +
 site/_docs/reference.md|  21 +++
 21 files changed, 378 insertions(+), 43 deletions(-)

diff --git a/babel/src/main/codegen/config.fmpp 
b/babel/src/main/codegen/config.fmpp
index dab4251..5439d14 100644
--- a/babel/src/main/codegen/config.fmpp
+++ b/babel/src/main/codegen/config.fmpp
@@ -141,6 +141,8 @@ data: {
 "JSON"
 "JSON_TYPE"
 "JSON_DEPTH"
+"JSON_LENGTH"
+"JSON_PRETTY"
 "K"
 "KEY"
 "KEY_MEMBER"
@@ -555,9 +557,6 @@ data: {
 "JSON_ARRAYAGG",
 "JSON_EXISTS",
 "JSON_VALUE",
-"JSON_TYPE",
-"JSON_DEPTH"
-"JSON_PRETTY",
 "JSON_OBJECT",
 "JSON_OBJECTAGG",
 "JSON_QUERY",
diff --git a/core/src/main/codegen/config.fmpp 
b/core/src/main/codegen/config.fmpp
index c8f9ec8..7b3fca2 100644
--- a/core/src/main/codegen/config.fmpp
+++ b/core/src/main/codegen/config.fmpp
@@ -161,6 +161,7 @@ data: {
 "JSON"
 "JSON_TYPE"
 "JSON_DEPTH"
+"JSON_LENGTH"
 "JSON_PRETTY"
 "K"
 "KEY"
diff --git a/core/src/main/codegen/templates/Parser.jj 
b/core/src/main/codegen/templates/Parser.jj
index 98e3f1b..5dfa66e 100644
--- a/core/src/main/codegen/templates/Parser.jj
+++ b/core/src/main/codegen/templates/Parser.jj
@@ -4864,6 +4864,8 @@ SqlNode BuiltinFunctionCall() :
 |
 node = JsonDepthFunctionCall() { return node; }
 |
+node = JsonLengthFunctionCall() { return node; }
+|
 node = JsonObjectAggFunctionCall() { return node; }
 |
 node = JsonArrayFunctionCall() { return node; }
@@ -4958,21 +4960,32 @@ SqlNode JsonPathSpec() :
 }
 }
 
-SqlNode JsonApiCommonSyntax() :
+SqlNode JsonApiCommonSyntax(boolean acceptNonPath) :
 {
 SqlNode e;
 List args = new ArrayList();
 Span span;
+SqlOperator op;
 }
 {
 e = JsonValueExpression(true) {
 args.add(e);
 span = Span.of(e);
 }
-
-e = Expression(ExprContext.ACCEPT_NON_QUERY) {
-args.add(e);
-}
+(
+
+e = Expression(ExprContext.ACCEPT_NON_QUERY) {
+op = SqlStdOperatorTable.JSON_API_COMMON_SYNTAX;
+args.add(e);
+}
+|
+{
+if (!acceptNonPath) {
+  throw new 
ParseException(RESOURCE.jsonPathMustBeSpecified().str());
+}
+op = SqlStdOperatorTable.JSON_API_COMMON_SYNTAX_WITHOUT_PATH;
+}
+)
 [
  e = JsonValueExpression(false) {
 args.add(e);
@@ -4991,9 +5004,8 @@ SqlNode JsonApiCommonSyntax() :
 )*
 ]
 {
-return 
SqlStdOperatorTable.JSON_API_COMMON_SYNTAX.createCall(span.end(this), args);
+return op.createCall(span.end(this), args);
 }
-
 }
 
 SqlJsonExistsErrorBehavior JsonExistsErrorBehavior() :
@@ -5019,7 +5031,7 @@ SqlCall JsonExistsFunctionCall() :
 }
 {
  { span = span(); }
- e = JsonApiCommonSyntax() {
+ e = JsonApiCommonSyntax(false) {
 args = new ArrayList();
 args.add(e);
 }
@@ -5076,7 +5088,7 @@ SqlCall 

[GitHub] [calcite] wangzzu commented on issue #1111: [CALCITE-2927] The Javadoc and implement of RuleQueue.computeImportance() is inconsistent

2019-03-27 Thread GitBox
wangzzu commented on issue #: [CALCITE-2927] The Javadoc and implement of 
RuleQueue.computeImportance() is inconsistent
URL: https://github.com/apache/calcite/pull/#issuecomment-477425904
 
 
   @asereda-gs I have added Full Name to my github account.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [calcite] chunweilei commented on issue #1102: [CALCITE-1515] RelBuilder supports creating TableFunctionScan

2019-03-27 Thread GitBox
chunweilei commented on issue #1102: [CALCITE-1515] RelBuilder supports 
creating TableFunctionScan
URL: https://github.com/apache/calcite/pull/1102#issuecomment-477425234
 
 
   Force-pushed to rebase on master.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [calcite] chunweilei commented on issue #912: [CALCITE-2729] introducing WindowReduceExpressionsRule

2019-03-27 Thread GitBox
chunweilei commented on issue #912: [CALCITE-2729] introducing 
WindowReduceExpressionsRule
URL: https://github.com/apache/calcite/pull/912#issuecomment-477422663
 
 
   @hsyuan I have rebased on master. Thank you very much.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [calcite] hsyuan commented on issue #1126: CalciteCatalogReader now uses config.caseSensitive() to get functions…

2019-03-27 Thread GitBox
hsyuan commented on issue #1126: CalciteCatalogReader now uses 
config.caseSensitive() to get functions…
URL: https://github.com/apache/calcite/pull/1126#issuecomment-477422178
 
 
   Yes, no matter how simple the code change is, we need a JIRA logged for it.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [calcite] chunweilei commented on issue #921: [CALCITE-2658] Add ExchangeRemoveConstantKeysRule that removes consta…

2019-03-27 Thread GitBox
chunweilei commented on issue #921: [CALCITE-2658] Add 
ExchangeRemoveConstantKeysRule that removes consta…
URL: https://github.com/apache/calcite/pull/921#issuecomment-477421947
 
 
   @hsyuan I have rebased on master. Thank you very much.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [calcite] asereda-gs commented on issue #1111: [CALCITE-2927] The Javadoc and implement of RuleQueue.computeImportance() is inconsistent

2019-03-27 Thread GitBox
asereda-gs commented on issue #: [CALCITE-2927] The Javadoc and implement 
of RuleQueue.computeImportance() is inconsistent
URL: https://github.com/apache/calcite/pull/#issuecomment-477409037
 
 
   Pls add your Full Name `(First Last)` to commit message.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[calcite] branch master updated: [CALCITE-2903] Exception thrown when decorrelating query with TEMPORAL TABLE

2019-03-27 Thread hyuan
This is an automated email from the ASF dual-hosted git repository.

hyuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/calcite.git


The following commit(s) were added to refs/heads/master by this push:
 new 8d81495  [CALCITE-2903] Exception thrown when decorrelating query with 
TEMPORAL TABLE
8d81495 is described below

commit 8d81495967533c556d861cfda8de5adcb9fd912c
Author: Haisheng Yuan 
AuthorDate: Fri Mar 8 21:20:14 2019 -0600

[CALCITE-2903] Exception thrown when decorrelating query with TEMPORAL TABLE

Close apache/calcite#1098
---
 .../apache/calcite/sql2rel/RelDecorrelator.java| 13 +
 .../apache/calcite/test/SqlToRelConverterTest.java | 44 
 .../apache/calcite/test/SqlToRelConverterTest.xml  | 61 ++
 3 files changed, 118 insertions(+)

diff --git a/core/src/main/java/org/apache/calcite/sql2rel/RelDecorrelator.java 
b/core/src/main/java/org/apache/calcite/sql2rel/RelDecorrelator.java
index da674d9..1846a18 100644
--- a/core/src/main/java/org/apache/calcite/sql2rel/RelDecorrelator.java
+++ b/core/src/main/java/org/apache/calcite/sql2rel/RelDecorrelator.java
@@ -46,6 +46,7 @@ import org.apache.calcite.rel.logical.LogicalCorrelate;
 import org.apache.calcite.rel.logical.LogicalFilter;
 import org.apache.calcite.rel.logical.LogicalJoin;
 import org.apache.calcite.rel.logical.LogicalProject;
+import org.apache.calcite.rel.logical.LogicalSnapshot;
 import org.apache.calcite.rel.logical.LogicalSort;
 import org.apache.calcite.rel.metadata.RelMdUtil;
 import org.apache.calcite.rel.metadata.RelMetadataQuery;
@@ -989,6 +990,18 @@ public class RelDecorrelator implements ReflectiveVisitor {
   }
 
   /**
+   * Rewrite LogicalSnapshot.
+   *
+   * @param rel the snapshot rel to rewrite
+   */
+  public Frame decorrelateRel(LogicalSnapshot rel) {
+if (RexUtil.containsCorrelation(rel.getPeriod())) {
+  return null;
+}
+return decorrelateRel((RelNode) rel);
+  }
+
+  /**
* Rewrite LogicalFilter.
*
* @param rel the filter rel to rewrite
diff --git 
a/core/src/test/java/org/apache/calcite/test/SqlToRelConverterTest.java 
b/core/src/test/java/org/apache/calcite/test/SqlToRelConverterTest.java
index d416eb8..b5749b1 100644
--- a/core/src/test/java/org/apache/calcite/test/SqlToRelConverterTest.java
+++ b/core/src/test/java/org/apache/calcite/test/SqlToRelConverterTest.java
@@ -1084,6 +1084,50 @@ public class SqlToRelConverterTest extends 
SqlToRelTestBase {
 sql(sql).ok();
   }
 
+  /**
+   * Lateral join with temporal table, both snapshot's input scan
+   * and snapshot's period reference outer columns. Should not
+   * decorrelate join.
+   */
+  @Test public void testCrossJoinTemporalTable1() {
+final String sql = "select stream *\n"
++ "from orders\n"
++ "cross join lateral (\n"
++ "  select * from products_temporal for system_time\n"
++ "  as of orders.rowtime\n"
++ "  where orders.productid = products_temporal.productid)\n";
+sql(sql).ok();
+  }
+
+  /**
+   * Lateral join with temporal table, snapshot's input scan
+   * reference outer columns, but snapshot's period is static.
+   * Should be able to decorrelate join.
+   */
+  @Test public void testCrossJoinTemporalTable2() {
+final String sql = "select stream *\n"
++ "from orders\n"
++ "cross join lateral (\n"
++ "  select * from products_temporal for system_time\n"
++ "  as of TIMESTAMP '2011-01-02 00:00:00'\n"
++ "  where orders.productid = products_temporal.productid)\n";
+sql(sql).ok();
+  }
+
+  /**
+   * Lateral join with temporal table, snapshot's period reference
+   * outer columns. Should not decorrelate join.
+   */
+  @Test public void testCrossJoinTemporalTable3() {
+final String sql = "select stream *\n"
++ "from orders\n"
++ "cross join lateral (\n"
++ "  select * from products_temporal for system_time\n"
++ "  as of orders.rowtime\n"
++ "  where products_temporal.productid > 1)\n";
+sql(sql).ok();
+  }
+
   /** Test case for
* https://issues.apache.org/jira/browse/CALCITE-1732;>[CALCITE-1732]
* IndexOutOfBoundsException when using LATERAL TABLE with more than one
diff --git 
a/core/src/test/resources/org/apache/calcite/test/SqlToRelConverterTest.xml 
b/core/src/test/resources/org/apache/calcite/test/SqlToRelConverterTest.xml
index 24289d3..dc4219c 100644
--- a/core/src/test/resources/org/apache/calcite/test/SqlToRelConverterTest.xml
+++ b/core/src/test/resources/org/apache/calcite/test/SqlToRelConverterTest.xml
@@ -285,6 +285,67 @@ LogicalDelta
 ]]>
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 



[GitHub] [calcite] hsyuan closed pull request #1098: [CALCITE-2903] Exception thrown when decorrelating query with TEMPORAL TABLE

2019-03-27 Thread GitBox
hsyuan closed pull request #1098: [CALCITE-2903] Exception thrown when 
decorrelating query with TEMPORAL TABLE
URL: https://github.com/apache/calcite/pull/1098
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[calcite] branch master updated: Update instructions for publishing site; we previously used subversion, now we use git

2019-03-27 Thread jhyde
This is an automated email from the ASF dual-hosted git repository.

jhyde pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/calcite.git


The following commit(s) were added to refs/heads/master by this push:
 new 7887465  Update instructions for publishing site; we previously used 
subversion, now we use git
7887465 is described below

commit 78874654979eeb9240261f48cf6ff3a994559975
Author: Julian Hyde 
AuthorDate: Wed Mar 27 16:31:46 2019 -0700

Update instructions for publishing site; we previously used subversion, now 
we use git
---
 site/README.md | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/site/README.md b/site/README.md
index 831f220..7f8e2b1 100644
--- a/site/README.md
+++ b/site/README.md
@@ -31,7 +31,7 @@ You can build the site manually using your environment or use 
the docker compose
 Site generation currently works best with ruby-2.5.1.
 
 1. `cd site`
-2. `svn co https://svn.apache.org/repos/asf/calcite/site target`
+2. `git clone https://gitbox.apache.org/repos/asf/calcite-site.git target`
 3. `sudo apt-get install rubygems ruby2.5-dev zlib1g-dev` (linux)
`Use RubyInstaller to install rubygems as recommended at 
https://www.ruby-lang.org/en/downloads/` (Windows)
 4. `sudo gem install bundler`
@@ -63,14 +63,17 @@ running from within the directory:
 2. Install [docker-compose](https://docs.docker.com/compose/install/)
 
 ### Build site
+
 1. `cd site`
 2. `docker-compose run build-site`
 
 ### Generate javadoc
+
 1. `cd site`
 2. `docker-compose run generate-javadoc`
 
 ### Running development mode locally
+
 You can preview your work while working on the site.
 
 1. `cd site`
@@ -88,12 +91,14 @@ As you make changes to the site, the site will 
automatically rebuild.
 4. `git reset origin/master --soft`
 
 If you have not regenerated the javadoc and they are missing, restore them:
+
 6. `git reset -- apidocs/`
 7. `git reset -- testapidocs/`
 8. `git checkout -- apidocs/`
 9. `git checkout -- testapidocs/`
 
 Restore the avatica site
+
 10. `git reset -- avatica/`
 11. `git checkout -- avatica/`
 
@@ -125,7 +130,7 @@ sync with "master". Immediately after a release, the 
release manager
 will publish the site, including all of the features that have just
 been released. When making an edit to the site, a Calcite committer
 must commit the change to the git "master" branch (as well as
-subversion, to publish the site, of course). If the edit is to appear
+git, to publish the site, of course). If the edit is to appear
 on the site immediately, the committer should then cherry-pick the
 change into the "site" branch.  If there have been no feature-related
 changes on the site since the release, then "site" should be a



[calcite] 01/01: Update instructions for publishing site; we previously used subversion, now we use git

2019-03-27 Thread jhyde
This is an automated email from the ASF dual-hosted git repository.

jhyde pushed a commit to branch site
in repository https://gitbox.apache.org/repos/asf/calcite.git

commit f971492a98cdd9ed6203f29c374fc1dc8b99483d
Author: Julian Hyde 
AuthorDate: Wed Mar 27 16:31:46 2019 -0700

Update instructions for publishing site; we previously used subversion, now 
we use git
---
 site/README.md | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/site/README.md b/site/README.md
index 831f220..7f8e2b1 100644
--- a/site/README.md
+++ b/site/README.md
@@ -31,7 +31,7 @@ You can build the site manually using your environment or use 
the docker compose
 Site generation currently works best with ruby-2.5.1.
 
 1. `cd site`
-2. `svn co https://svn.apache.org/repos/asf/calcite/site target`
+2. `git clone https://gitbox.apache.org/repos/asf/calcite-site.git target`
 3. `sudo apt-get install rubygems ruby2.5-dev zlib1g-dev` (linux)
`Use RubyInstaller to install rubygems as recommended at 
https://www.ruby-lang.org/en/downloads/` (Windows)
 4. `sudo gem install bundler`
@@ -63,14 +63,17 @@ running from within the directory:
 2. Install [docker-compose](https://docs.docker.com/compose/install/)
 
 ### Build site
+
 1. `cd site`
 2. `docker-compose run build-site`
 
 ### Generate javadoc
+
 1. `cd site`
 2. `docker-compose run generate-javadoc`
 
 ### Running development mode locally
+
 You can preview your work while working on the site.
 
 1. `cd site`
@@ -88,12 +91,14 @@ As you make changes to the site, the site will 
automatically rebuild.
 4. `git reset origin/master --soft`
 
 If you have not regenerated the javadoc and they are missing, restore them:
+
 6. `git reset -- apidocs/`
 7. `git reset -- testapidocs/`
 8. `git checkout -- apidocs/`
 9. `git checkout -- testapidocs/`
 
 Restore the avatica site
+
 10. `git reset -- avatica/`
 11. `git checkout -- avatica/`
 
@@ -125,7 +130,7 @@ sync with "master". Immediately after a release, the 
release manager
 will publish the site, including all of the features that have just
 been released. When making an edit to the site, a Calcite committer
 must commit the change to the git "master" branch (as well as
-subversion, to publish the site, of course). If the edit is to appear
+git, to publish the site, of course). If the edit is to appear
 on the site immediately, the committer should then cherry-pick the
 change into the "site" branch.  If there have been no feature-related
 changes on the site since the release, then "site" should be a



[calcite] branch site updated (2850379 -> f971492)

2019-03-27 Thread jhyde
This is an automated email from the ASF dual-hosted git repository.

jhyde pushed a change to branch site
in repository https://gitbox.apache.org/repos/asf/calcite.git.


 discard 2850379  Update instructions for publishing site; we previously used 
subversion, now we use git
 new f971492  Update instructions for publishing site; we previously used 
subversion, now we use git

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (2850379)
\
 N -- N -- N   refs/heads/site (f971492)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 site/README.md | 5 +
 1 file changed, 5 insertions(+)



[calcite] branch site updated: Update instructions for publishing site; we previously used subversion, now we use git

2019-03-27 Thread jhyde
This is an automated email from the ASF dual-hosted git repository.

jhyde pushed a commit to branch site
in repository https://gitbox.apache.org/repos/asf/calcite.git


The following commit(s) were added to refs/heads/site by this push:
 new 2850379  Update instructions for publishing site; we previously used 
subversion, now we use git
2850379 is described below

commit 2850379f6d0fbb3c43ce21fdff91da7582510db0
Author: Julian Hyde 
AuthorDate: Wed Mar 27 16:31:46 2019 -0700

Update instructions for publishing site; we previously used subversion, now 
we use git
---
 site/README.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/site/README.md b/site/README.md
index 831f220..2c02b54 100644
--- a/site/README.md
+++ b/site/README.md
@@ -31,7 +31,7 @@ You can build the site manually using your environment or use 
the docker compose
 Site generation currently works best with ruby-2.5.1.
 
 1. `cd site`
-2. `svn co https://svn.apache.org/repos/asf/calcite/site target`
+2. `git clone https://gitbox.apache.org/repos/asf/calcite-site.git target`
 3. `sudo apt-get install rubygems ruby2.5-dev zlib1g-dev` (linux)
`Use RubyInstaller to install rubygems as recommended at 
https://www.ruby-lang.org/en/downloads/` (Windows)
 4. `sudo gem install bundler`
@@ -125,7 +125,7 @@ sync with "master". Immediately after a release, the 
release manager
 will publish the site, including all of the features that have just
 been released. When making an edit to the site, a Calcite committer
 must commit the change to the git "master" branch (as well as
-subversion, to publish the site, of course). If the edit is to appear
+git, to publish the site, of course). If the edit is to appear
 on the site immediately, the committer should then cherry-pick the
 change into the "site" branch.  If there have been no feature-related
 changes on the site since the release, then "site" should be a



[calcite-site] branch master updated: Add Alibaba to powered-by, remove LAST_DAY, tweak 1.19 release notes

2019-03-27 Thread jhyde
This is an automated email from the ASF dual-hosted git repository.

jhyde pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/calcite-site.git


The following commit(s) were added to refs/heads/master by this push:
 new 21254f6  Add Alibaba to powered-by, remove LAST_DAY, tweak 1.19 
release notes
21254f6 is described below

commit 21254f61b3d5d290f031f25ac0bf19f6bdc7f6a7
Author: Julian Hyde 
AuthorDate: Wed Mar 27 16:26:24 2019 -0700

Add Alibaba to powered-by, remove LAST_DAY, tweak 1.19 release notes
---
 docs/history.html| 184 +--
 docs/powered_by.html |   8 +++
 docs/reference.html  |   4 --
 img/powered-by.png   | Bin 101285 -> 104148 bytes
 4 files changed, 113 insertions(+), 83 deletions(-)

diff --git a/docs/history.html b/docs/history.html
index e5d4ceb..036a0eb 100644
--- a/docs/history.html
+++ b/docs/history.html
@@ -109,7 +109,7 @@
 Downloads are available on the
 downloads page.
 
-https://github.com/apache/calcite/releases/tag/calcite-1.19.0;>1.19.0 
/ 2019-03-18
+https://github.com/apache/calcite/releases/tag/calcite-1.19.0;>1.19.0 
/ 2019-03-25
 
 This release comes three months after 1.18.0. It includes more than 80 
resolved
 issues, comprising of a few new features as well as general improvements
@@ -124,6 +124,7 @@ Druid version 0.11.0;
 other software versions as specified in pom.xml.
 
 New features
+
 
   [https://issues.apache.org/jira/browse/CALCITE-1912;>CALCITE-1912]
 Support FOR SYSTEM_TIME AS OF in 
regular queries
@@ -135,96 +136,108 @@ Add the JSON_TYPE 
function
 Add the JSON_DEPTH function
   [https://issues.apache.org/jira/browse/CALCITE-2881;>CALCITE-2881]
 Add the JSON_PRETTY function
+  [https://issues.apache.org/jira/browse/CALCITE-2770;>CALCITE-2770]
+Add bitwise aggregate functions BIT_AND, BIT_OR
+  [https://issues.apache.org/jira/browse/CALCITE-2799;>CALCITE-2799]
+Allow alias in HAVING clause for 
aggregate functions
 
 
 Bug-fixes, API changes 
and minor enhancements
+
 
   [https://issues.apache.org/jira/browse/CALCITE-1513;>CALCITE-1513]
-Correlated NOT IN query throws AssertionError
+Correlated NOT IN query throws AssertionError
   [https://issues.apache.org/jira/browse/CALCITE-1726;>CALCITE-1726]
-Subquery in FILTER is left untransformed
+Sub-query in FILTER is left 
untransformed
   [https://issues.apache.org/jira/browse/CALCITE-2249;>CALCITE-2249]
-AggregateJoinTransposeRule generates inequivalent nodes if Aggregate relNode 
contains distinct aggregate function.
+AggregateJoinTransposeRule generates 
non-equivalent nodes if Aggregate
+contains a DISTINCT aggregate 
function
   [https://issues.apache.org/jira/browse/CALCITE-2288;>CALCITE-2288]
-Type assertion error when reducing partially constant expression
+Type assertion error when reducing partially-constant expression
   [https://issues.apache.org/jira/browse/CALCITE-2290;>CALCITE-2290]
 Type mismatch during flattening
   [https://issues.apache.org/jira/browse/CALCITE-2301;>CALCITE-2301]
 JDBC adapter: use query timeout from the top-level statement
   [https://issues.apache.org/jira/browse/CALCITE-2338;>CALCITE-2338]
-Make Simplification API more conservative
+Make simplification API more conservative
   [https://issues.apache.org/jira/browse/CALCITE-2344;>CALCITE-2344]
-Avoid inferring $0=null predicate from $0 IS NULL when… … $0 is not 
nullable
+Avoid inferring $0 = null predicate 
from $0 IS NULL when $0 is not
+nullable
   [https://issues.apache.org/jira/browse/CALCITE-2375;>CALCITE-2375]
 EnumerableDefaults.join_() leaks 
connections
   [https://issues.apache.org/jira/browse/CALCITE-2437;>CALCITE-2437]
-FilterMultiJoinMergeRule doesn’t combine postFilterCondition
+FilterMultiJoinMergeRule doesn’t 
combine postFilterCondition
   [https://issues.apache.org/jira/browse/CALCITE-2454;>CALCITE-2454]
-Avoid treating Project(x=1) and Project(x=1) equal in case the type of 1 is 
int in the first rel and long in the second one
+Avoid treating Project(x=1) and Project(x=1) equal when the type of 1 is
+int in the first rel and long in the second
   [https://issues.apache.org/jira/browse/CALCITE-2463;>CALCITE-2463]
-Silence ERROR logs from CalciteException, SqlValidatorException
+Silence ERROR logs from CalciteException, SqlValidatorException
   [https://issues.apache.org/jira/browse/CALCITE-2464;>CALCITE-2464]
 Allow to set nullability for columns of structured types
   [https://issues.apache.org/jira/browse/CALCITE-2471;>CALCITE-2471]
-RelNode description includes all tree when recomputed
+RelNode description includes all tree 
when recomputed
   [https://issues.apache.org/jira/browse/CALCITE-2554;>CALCITE-2554]
-Enrich enumerable join operators with order preserving information
+Enrich enumerable join operators with order-preserving information
   [https://issues.apache.org/jira/browse/CALCITE-2582;>CALCITE-2582]
-FilterProjectTransposeRule does not always simplify the new filter 
condition

[GitHub] [calcite] asereda-gs commented on issue #1101: [CALCITE-2909] Optimize Enumerable SemiJoin with lazy computation of innerLookup (Ruben Quesada Lopez)

2019-03-27 Thread GitBox
asereda-gs commented on issue #1101: [CALCITE-2909] Optimize Enumerable 
SemiJoin with lazy computation of innerLookup (Ruben Quesada Lopez)
URL: https://github.com/apache/calcite/pull/1101#issuecomment-477384957
 
 
   Aslo pls append your name `(First Last)` to commit message.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [calcite] asereda-gs commented on issue #1101: [CALCITE-2909] Optimize Enumerable SemiJoin with lazy computation of innerLookup (Ruben Quesada Lopez)

2019-03-27 Thread GitBox
asereda-gs commented on issue #1101: [CALCITE-2909] Optimize Enumerable 
SemiJoin with lazy computation of innerLookup (Ruben Quesada Lopez)
URL: https://github.com/apache/calcite/pull/1101#issuecomment-477384758
 
 
   @rubenada can you pls squash and rebase against master ? I see a merge commit


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[calcite] branch master updated: [CALCITE-2877] Make GeodeSchema constructor public to pass client cache object (Sandeep Chada)

2019-03-27 Thread sereda
This is an automated email from the ASF dual-hosted git repository.

sereda pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/calcite.git


The following commit(s) were added to refs/heads/master by this push:
 new 62fc0e6  [CALCITE-2877] Make GeodeSchema constructor public to pass 
client cache object (Sandeep Chada)
62fc0e6 is described below

commit 62fc0e649c460e9f4ca10b302a9c260206914c72
Author: chadasa <44845836+chad...@users.noreply.github.com>
AuthorDate: Wed Feb 27 09:51:57 2019 +0530

[CALCITE-2877] Make GeodeSchema constructor public to pass client cache 
object (Sandeep Chada)
---
 .../java/org/apache/calcite/adapter/geode/rel/GeodeSchema.java | 10 +-
 .../apache/calcite/adapter/geode/rel/GeodeSchemaFactory.java   |  7 +--
 .../java/org/apache/calcite/adapter/geode/util/GeodeUtils.java |  6 --
 3 files changed, 10 insertions(+), 13 deletions(-)

diff --git 
a/geode/src/main/java/org/apache/calcite/adapter/geode/rel/GeodeSchema.java 
b/geode/src/main/java/org/apache/calcite/adapter/geode/rel/GeodeSchema.java
index 0a099a2..bd56a8c 100644
--- a/geode/src/main/java/org/apache/calcite/adapter/geode/rel/GeodeSchema.java
+++ b/geode/src/main/java/org/apache/calcite/adapter/geode/rel/GeodeSchema.java
@@ -30,8 +30,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 
-import static 
org.apache.calcite.adapter.geode.util.GeodeUtils.createClientCache;
-
 /**
  * Schema mapped onto a Geode Region.
  */
@@ -41,13 +39,7 @@ public class GeodeSchema extends AbstractSchema {
   private final List regionNames;
   private ImmutableMap tableMap;
 
-  GeodeSchema(String locatorHost, int locatorPort,
-  Iterable regionNames, String pdxAutoSerializerPackageExp) {
-this(createClientCache(locatorHost, locatorPort, 
pdxAutoSerializerPackageExp, true),
-regionNames);
-  }
-
-  GeodeSchema(final GemFireCache cache, final Iterable regionNames) {
+  public GeodeSchema(final GemFireCache cache, final Iterable 
regionNames) {
 super();
 this.cache = Objects.requireNonNull(cache, "clientCache");
 this.regionNames = 
ImmutableList.copyOf(Objects.requireNonNull(regionNames, "regionNames"));
diff --git 
a/geode/src/main/java/org/apache/calcite/adapter/geode/rel/GeodeSchemaFactory.java
 
b/geode/src/main/java/org/apache/calcite/adapter/geode/rel/GeodeSchemaFactory.java
index e436ff1..1066511 100644
--- 
a/geode/src/main/java/org/apache/calcite/adapter/geode/rel/GeodeSchemaFactory.java
+++ 
b/geode/src/main/java/org/apache/calcite/adapter/geode/rel/GeodeSchemaFactory.java
@@ -27,6 +27,8 @@ import com.google.common.collect.ImmutableList;
 import java.util.Arrays;
 import java.util.Map;
 
+import static 
org.apache.calcite.adapter.geode.util.GeodeUtils.createClientCache;
+
 /**
  * Factory that creates a {@link GeodeSchema}.
  */
@@ -62,8 +64,9 @@ public class GeodeSchemaFactory implements SchemaFactory {
   GeoFunctions.class.getName(), "*", true);
 }
 
-return new GeodeSchema(locatorHost, locatorPort, 
Arrays.asList(regionNames),
-pbxSerializablePackagePath);
+return new GeodeSchema(
+createClientCache(locatorHost, locatorPort, 
pbxSerializablePackagePath, true),
+Arrays.asList(regionNames));
   }
 }
 
diff --git 
a/geode/src/main/java/org/apache/calcite/adapter/geode/util/GeodeUtils.java 
b/geode/src/main/java/org/apache/calcite/adapter/geode/util/GeodeUtils.java
index e49be07..34f9e88 100644
--- a/geode/src/main/java/org/apache/calcite/adapter/geode/util/GeodeUtils.java
+++ b/geode/src/main/java/org/apache/calcite/adapter/geode/util/GeodeUtils.java
@@ -26,6 +26,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.apache.geode.cache.CacheClosedException;
 import org.apache.geode.cache.GemFireCache;
 import org.apache.geode.cache.Region;
+import org.apache.geode.cache.RegionExistsException;
 import org.apache.geode.cache.client.ClientCache;
 import org.apache.geode.cache.client.ClientCacheFactory;
 import org.apache.geode.cache.client.ClientRegionShortcut;
@@ -131,8 +132,9 @@ public class GeodeUtils {
 region = ((ClientCache) cache)
 .createClientRegionFactory(ClientRegionShortcut.PROXY)
 .create(regionName);
-  } catch (IllegalStateException e) {
-// means this is a server cache (probably part of embedded testing)
+  } catch (IllegalStateException | RegionExistsException e) {
+// means this is a server cache (probably part of embedded testing
+// or clientCache is passed directly)
 region = cache.getRegion(regionName);
   }
 



[calcite] 04/04: Site: Add Alibaba MaxCompute to powered-by page

2019-03-27 Thread jhyde
This is an automated email from the ASF dual-hosted git repository.

jhyde pushed a commit to branch site
in repository https://gitbox.apache.org/repos/asf/calcite.git

commit 42dce0928ffea48b3d159c0ee50538a7e1069495
Author: Haisheng Yuan 
AuthorDate: Mon Mar 18 13:31:02 2019 -0700

Site: Add Alibaba MaxCompute to powered-by page

Close apache/calcite#1113
---
 site/_docs/powered_by.md |   7 +++
 site/img/powered-by.png  | Bin 101285 -> 104148 bytes
 2 files changed, 7 insertions(+)

diff --git a/site/_docs/powered_by.md b/site/_docs/powered_by.md
index d36c731..f900b41 100644
--- a/site/_docs/powered_by.md
+++ b/site/_docs/powered_by.md
@@ -39,6 +39,13 @@ on your site.
 
 ![Powered By]({{ site.baseurl }}/img/pb-calcite-240.png)
 
+### Alibaba MaxCompute
+
+https://www.alibabacloud.com;>Alibaba's
+https://www.alibabacloud.com/product/maxcompute;>MaxCompute
+big data computing and storage platform
+uses Calcite for cost-based query optimization.
+
 ### Apache Apex
 
 https://apex.apache.org;>Apache Apex
diff --git a/site/img/powered-by.png b/site/img/powered-by.png
index eb4e331..79c6dba 100644
Binary files a/site/img/powered-by.png and b/site/img/powered-by.png differ



[calcite] 03/04: Suppress deprecation warning, and remove unicode character from Java source file

2019-03-27 Thread jhyde
This is an automated email from the ASF dual-hosted git repository.

jhyde pushed a commit to branch site
in repository https://gitbox.apache.org/repos/asf/calcite.git

commit 1939f9c68e80fb2162b181e3a390dd8f6ada3414
Author: Julian Hyde 
AuthorDate: Sun Mar 10 20:57:27 2019 -0700

Suppress deprecation warning, and remove unicode character from Java source 
file

Re-format and re-order change log in 1.19 release notes, and fix release 
date.
---
 .../calcite/adapter/enumerable/PhysType.java   |   6 +-
 .../calcite/adapter/enumerable/PhysTypeImpl.java   |   1 +
 .../calcite/sql/test/SqlOperatorBaseTest.java  |   2 +-
 site/_docs/history.md  | 184 -
 .../AbstractRelNodeGetRelTypeNameBenchmark.java|   9 +-
 5 files changed, 114 insertions(+), 88 deletions(-)

diff --git 
a/core/src/main/java/org/apache/calcite/adapter/enumerable/PhysType.java 
b/core/src/main/java/org/apache/calcite/adapter/enumerable/PhysType.java
index 4381d32..25baa83 100644
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/PhysType.java
+++ b/core/src/main/java/org/apache/calcite/adapter/enumerable/PhysType.java
@@ -200,12 +200,12 @@ public interface PhysType {
   /** Converts an enumerable of this physical type to an enumerable that uses a
* given physical type for its rows.
*
-   * @deprecated As of 1.19, use {@link #convertTo(Expression, JavaRowFormat)}.
+   * @deprecated Use {@link #convertTo(Expression, JavaRowFormat)}.
* The use of PhysType as a second parameter is misleading since only the row
* format of the expression is affected by the conversion. Moreover it 
requires
* to have at hand a PhysType object which is not really necessary for 
achieving
-   * the desired result.*/
-  @Deprecated
+   * the desired result. */
+  @Deprecated // to be removed before 2.0
   Expression convertTo(Expression expression, PhysType targetPhysType);
 
   /** Converts an enumerable of this physical type to an enumerable that uses
diff --git 
a/core/src/main/java/org/apache/calcite/adapter/enumerable/PhysTypeImpl.java 
b/core/src/main/java/org/apache/calcite/adapter/enumerable/PhysTypeImpl.java
index 790f441..402f4ac 100644
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/PhysTypeImpl.java
+++ b/core/src/main/java/org/apache/calcite/adapter/enumerable/PhysTypeImpl.java
@@ -235,6 +235,7 @@ public class PhysTypeImpl implements PhysType {
 Primitive.box(javaRowClass), format);
   }
 
+  @SuppressWarnings("deprecation")
   public Expression convertTo(Expression exp, PhysType targetPhysType) {
 return convertTo(exp, targetPhysType.getFormat());
   }
diff --git 
a/core/src/test/java/org/apache/calcite/sql/test/SqlOperatorBaseTest.java 
b/core/src/test/java/org/apache/calcite/sql/test/SqlOperatorBaseTest.java
index fcf7fe9..59f59de 100644
--- a/core/src/test/java/org/apache/calcite/sql/test/SqlOperatorBaseTest.java
+++ b/core/src/test/java/org/apache/calcite/sql/test/SqlOperatorBaseTest.java
@@ -4256,7 +4256,7 @@ public abstract class SqlOperatorBaseTest {
 tester.checkScalarExact("ASCII('ABC')", "65");
 tester.checkScalarExact("ASCII(_UTF8'\u0082')", "130");
 tester.checkScalarExact("ASCII(_UTF8'\u5B57')", "23383");
-tester.checkScalarExact("ASCII(_UTF8'Ω')", "937");
+tester.checkScalarExact("ASCII(_UTF8'\u03a9')", "937"); // omega
 tester.checkNull("ASCII(cast(null as varchar(1)))");
   }
 
diff --git a/site/_docs/history.md b/site/_docs/history.md
index eb0b9cd..4bd0851 100644
--- a/site/_docs/history.md
+++ b/site/_docs/history.md
@@ -28,7 +28,7 @@ For a full list of releases, see
 Downloads are available on the
 [downloads page]({{ site.baseurl }}/downloads/).
 
-## https://github.com/apache/calcite/releases/tag/calcite-1.19.0;>1.19.0 
/ 2019-03-18
+## https://github.com/apache/calcite/releases/tag/calcite-1.19.0;>1.19.0 
/ 2019-03-25
 {: #v1-19-0}
 
 This release comes three months after 1.18.0. It includes more than 80 resolved
@@ -44,6 +44,7 @@ Druid version 0.11.0;
 other software versions as specified in `pom.xml`.
 
  New features
+
 * [CALCITE-1912]
   Support `FOR SYSTEM_TIME AS OF` in regular queries
 * [CALCITE-2786]
@@ -54,94 +55,106 @@ other software versions as specified in `pom.xml`.
   Add the `JSON_DEPTH` function
 * [CALCITE-2881]
   Add the `JSON_PRETTY` function
+* [CALCITE-2770]
+  Add bitwise aggregate functions `BIT_AND`, `BIT_OR`
+* [CALCITE-2799]
+  Allow alias in `HAVING` clause for aggregate functions
 
  Bug-fixes, API changes and minor enhancements
+
 * [CALCITE-1513]
-  Correlated NOT IN query throws AssertionError
+  Correlated `NOT IN` query throws `AssertionError`
 * [CALCITE-1726]
-  Subquery in FILTER is left untransformed
+  Sub-query in `FILTER` is left untransformed
 * [CALCITE-2249]
-  AggregateJoinTransposeRule generates inequivalent nodes if Aggregate relNode 
contains distinct aggregate function.
+  `AggregateJoinTransposeRule` generates 

[calcite] 02/04: Site: Add new committers (Haisheng Yuan, Hongze Zhang and Stamatis Zampetakis)

2019-03-27 Thread jhyde
This is an automated email from the ASF dual-hosted git repository.

jhyde pushed a commit to branch site
in repository https://gitbox.apache.org/repos/asf/calcite.git

commit 819722500b1a9393b45c0451fcbcc3064adc275b
Author: Francis Chuang 
AuthorDate: Wed Mar 27 08:54:49 2019 +1100

Site: Add new committers (Haisheng Yuan, Hongze Zhang and Stamatis 
Zampetakis)
---
 site/_data/contributors.yml | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/site/_data/contributors.yml b/site/_data/contributors.yml
index f403272..ee89ae4 100644
--- a/site/_data/contributors.yml
+++ b/site/_data/contributors.yml
@@ -63,6 +63,16 @@
   githubId: gianm
   org: Imply
   role: Committer
+- name: Haisheng Yuan
+  apacheId: hyuan
+  githubId: hsyuan
+  org: Alibaba
+  role: Committer
+- name: Hongze Zhang
+  apacheId: hongze
+  githubId: zhztheplayer
+  org: Tencent
+  role: Committer
 - name: James R. Taylor
   apacheId: jamestaylor
   githubId: JamesRTaylor
@@ -167,6 +177,11 @@
   githubId: b-slim
   org: Hortonworks
   role: Committer
+- name: Stamatis Zampetakis
+  apacheId: zabetak
+  githubId: zabetak
+  org: TIBCO EBX
+  role: Committer
 - name: Steven Noels
   apacheId: stevenn
   githubId: stevenn



[calcite] 01/04: [CALCITE-2952] Add JDK 12 as tested to 1.19.0 history

2019-03-27 Thread jhyde
This is an automated email from the ASF dual-hosted git repository.

jhyde pushed a commit to branch site
in repository https://gitbox.apache.org/repos/asf/calcite.git

commit a5530e5fb4356074efeb3326950335e3d173c216
Author: Kevin Risden 
AuthorDate: Tue Mar 26 08:27:49 2019 -0400

[CALCITE-2952] Add JDK 12 as tested to 1.19.0 history

Signed-off-by: Kevin Risden 
---
 site/_docs/history.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/site/_docs/history.md b/site/_docs/history.md
index 3ce8023..eb0b9cd 100644
--- a/site/_docs/history.md
+++ b/site/_docs/history.md
@@ -38,7 +38,7 @@ query support.
 
 Compatibility: This release is tested
 on Linux, macOS, Microsoft Windows;
-using Oracle JDK 8, 9, 10, 11 and OpenJDK 10, 11;
+using Oracle JDK 8, 9, 10, 11, 12 and OpenJDK 8, 9, 10, 11, 12;
 Guava versions 19.0 to 27.1-jre;
 Druid version 0.11.0;
 other software versions as specified in `pom.xml`.



[calcite] branch site updated (07fcedb -> a9687de)

2019-03-27 Thread zabetak
This is an automated email from the ASF dual-hosted git repository.

zabetak pushed a change to branch site
in repository https://gitbox.apache.org/repos/asf/calcite.git.


 discard 07fcedb  Site: Add new committers (Haisheng Yuan, Hongze Zhang and 
Stamatis Zampetakis)
 discard 27706dd  Site: News item for release 1.19.0
 discard 3ac7039  Merge branch 'master' into site
 discard a96db91  Site: [CALCITE-2734] Update mongo documentation to reflect 
filename changes
 discard d561dba  Site: Add commit message guidelines for contributors 
(Stamatis Zampetakis)
 discard 15a6d38  Site: Add Zoltan Haindrich as committer
 discard 2afea1f  Site: Elastic query example on _MAP
 add 06b1894  Site: News item for release 1.19.0
 add 79f4324  [CALCITE-2942] Materialized view rewriting logic instantiates 
RelMetadataQuery each time the rule is triggered
 add ecc100e  [CALCITE-2943] Materialized view rewriting logic calls 
getApplicableMaterializations each time the rule is triggered
 add 2fa7fd7  [CALCITE-2946] RelBuilder wrongly skips creation of Aggregate 
that prunes columns if input produces one row at most
 add 406129b  [CALCITE-2951] Support decorrelate subquery that has 
aggregate with grouping sets (Haisheng Yuan)
 add 25ffeb4  [CALCITE-2908] Implement SQL LAST_DAY function (Chunwei Lei)
 add 81143c8  [CALCITE-589] Extend unifyAggregates method to work with 
Grouping Sets
 add 1b43072  [CALCITE-574] Remove 
org.apache.calcite.util.Bug.CALCITE_461_FIXED
 add 35ab6c7  [CALCITE-2952] Add JDK 12 as tested to 1.19.0 history
 add 11c067f  Site: Add new committers (Haisheng Yuan, Hongze Zhang and 
Stamatis Zampetakis)
 add 90e69d4  [CALCITE-2953] LatticeTest.testTileAlgorithm2 and 
LatticeTest.testTileAlgorithm3 fail intermittently
 add 4fdf241  In RelFieldCollation, add a "withX" copy method for each 
attribute "X", and deprecate "copy"
 add 1f4b619  [CALCITE-2796] JDBC adapter should convert 'GROUP BY 
ROLLUP(x, y)' to 'GROUP BY x, y WITH ROLLUP' for MySQL 5
 add ddbcd39  Suppress deprecation warning, and remove unicode character 
from Java source file
 add 650d24b  Site: Add Alibaba MaxCompute to powered-by page
 add a9687de  [CALCITE-2958] Upgrade SQLLine to 1.7.0

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (07fcedb)
\
 N -- N -- N   refs/heads/site (a9687de)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

No new revisions were added by this update.

Summary of changes:
 .../calcite/adapter/enumerable/PhysType.java   |   6 +-
 .../calcite/adapter/enumerable/PhysTypeImpl.java   |   1 +
 .../calcite/adapter/enumerable/RexImpTable.java|   3 +
 .../java/org/apache/calcite/plan/RelOptUtil.java   |  13 +-
 .../apache/calcite/plan/SubstitutionVisitor.java   |  29 +-
 .../calcite/plan/volcano/VolcanoPlanner.java   |   2 +-
 .../java/org/apache/calcite/rel/RelCollations.java |   4 +-
 .../org/apache/calcite/rel/RelFieldCollation.java  |  29 +-
 .../org/apache/calcite/rel/core/Aggregate.java |  74 ++-
 .../calcite/rel/metadata/RelMdCollation.java   |   2 +-
 .../calcite/rel/mutable/MutableAggregate.java  |   3 +-
 .../calcite/rel/rel2sql/RelToSqlConverter.java | 135 -
 .../rel/rules/AbstractMaterializedViewRule.java| 585 +++--
 .../rel/rules/ProjectWindowTransposeRule.java  |   2 +-
 .../java/org/apache/calcite/rex/RexProgram.java|   3 +-
 .../main/java/org/apache/calcite/rex/RexUtil.java  |   2 +-
 .../org/apache/calcite/runtime/SqlFunctions.java   |  27 +
 .../main/java/org/apache/calcite/sql/SqlCall.java  |   5 +-
 .../java/org/apache/calcite/sql/SqlDialect.java|  39 +-
 .../main/java/org/apache/calcite/sql/SqlNode.java  |   3 +-
 .../calcite/sql/dialect/MysqlSqlDialect.java   |  11 +
 .../apache/calcite/sql/fun/SqlRollupOperator.java  |  18 +
 .../calcite/sql/fun/SqlStdOperatorTable.java   |   9 +
 .../org/apache/calcite/sql/type/ReturnTypes.java   |   8 +
 .../apache/calcite/sql2rel/RelDecorrelator.java|  16 +-
 .../java/org/apache/calcite/tools/Programs.java|   6 +
 .../java/org/apache/calcite/tools/RelBuilder.java  |   8 +-
 .../src/main/java/org/apache/calcite/util/Bug.java |   9 -
 .../org/apache/calcite/util/BuiltInMethod.java |   1 +
 .../main/java/org/apache/calcite/util/Util.java|  14 +
 .../calcite/rel/rel2sql/RelToSqlConverterTest.java | 145 +
 .../calcite/sql/test/SqlOperatorBaseTest.java  |  79 ++-
 

[GitHub] [calcite] asfgit closed pull request #1113: Site: Add Alibaba MaxCompute to powered-by page

2019-03-27 Thread GitBox
asfgit closed pull request #1113: Site: Add Alibaba MaxCompute to powered-by 
page
URL: https://github.com/apache/calcite/pull/1113
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [calcite] asfgit closed pull request #1136: [CALCITE-2958] Upgrade SQLLine to 1.7.0

2019-03-27 Thread GitBox
asfgit closed pull request #1136: [CALCITE-2958] Upgrade SQLLine to 1.7.0
URL: https://github.com/apache/calcite/pull/1136
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[calcite] 01/05: In RelFieldCollation, add a "withX" copy method for each attribute "X", and deprecate "copy"

2019-03-27 Thread jhyde
This is an automated email from the ASF dual-hosted git repository.

jhyde pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/calcite.git

commit 4fdf241dfb8cc555ab28c6cba7a152e4cc4ec169
Author: Julian Hyde 
AuthorDate: Tue Jan 22 12:30:47 2019 -0800

In RelFieldCollation, add a "withX" copy method for each attribute "X", and 
deprecate "copy"

Annotate SqlNode.getKind() and SqlCall.getOperandList() as Nonnull.
---
 .../java/org/apache/calcite/rel/RelCollations.java |  4 ++--
 .../org/apache/calcite/rel/RelFieldCollation.java  | 26 +-
 .../calcite/rel/metadata/RelMdCollation.java   |  2 +-
 .../rel/rules/ProjectWindowTransposeRule.java  |  2 +-
 .../java/org/apache/calcite/rex/RexProgram.java|  3 +--
 .../main/java/org/apache/calcite/rex/RexUtil.java  |  2 +-
 .../main/java/org/apache/calcite/sql/SqlCall.java  |  5 +++--
 .../main/java/org/apache/calcite/sql/SqlNode.java  |  3 ++-
 8 files changed, 32 insertions(+), 15 deletions(-)

diff --git a/core/src/main/java/org/apache/calcite/rel/RelCollations.java 
b/core/src/main/java/org/apache/calcite/rel/RelCollations.java
index 5d7c7bb..97bd2f9 100644
--- a/core/src/main/java/org/apache/calcite/rel/RelCollations.java
+++ b/core/src/main/java/org/apache/calcite/rel/RelCollations.java
@@ -195,7 +195,7 @@ public class RelCollations {
   Map mapping) {
 return of(
 Util.transform(collation.getFieldCollations(),
-fc -> fc.copy(mapping.get(fc.getFieldIndex();
+fc -> fc.withFieldIndex(mapping.get(fc.getFieldIndex();
   }
 
   /** Creates a copy of this collation that changes the ordinals of input
@@ -204,7 +204,7 @@ public class RelCollations {
   Mappings.TargetMapping mapping) {
 return of(
 Util.transform(collation.getFieldCollations(),
-fc -> fc.copy(mapping.getTarget(fc.getFieldIndex();
+fc -> fc.withFieldIndex(mapping.getTarget(fc.getFieldIndex();
   }
 }
 
diff --git a/core/src/main/java/org/apache/calcite/rel/RelFieldCollation.java 
b/core/src/main/java/org/apache/calcite/rel/RelFieldCollation.java
index 64f3484..f837474 100644
--- a/core/src/main/java/org/apache/calcite/rel/RelFieldCollation.java
+++ b/core/src/main/java/org/apache/calcite/rel/RelFieldCollation.java
@@ -216,11 +216,27 @@ public class RelFieldCollation {
   /**
* Creates a copy of this RelFieldCollation against a different field.
*/
+  public RelFieldCollation withFieldIndex(int fieldIndex) {
+return this.fieldIndex == fieldIndex ? this
+: new RelFieldCollation(fieldIndex, direction, nullDirection);
+  }
+
+  @Deprecated // to be removed before 2.0
   public RelFieldCollation copy(int target) {
-if (target == fieldIndex) {
-  return this;
-}
-return new RelFieldCollation(target, direction, nullDirection);
+return withFieldIndex(target);
+  }
+
+  /** Creates a copy of this RelFieldCollation with a different direction. */
+  public RelFieldCollation withDirection(Direction direction) {
+return this.direction == direction ? this
+: new RelFieldCollation(fieldIndex, direction, nullDirection);
+  }
+
+  /** Creates a copy of this RelFieldCollation with a different null
+   * direction. */
+  public RelFieldCollation withNullDirection(NullDirection nullDirection) {
+return this.nullDirection == nullDirection ? this
+: new RelFieldCollation(fieldIndex, direction, nullDirection);
   }
 
   /**
@@ -228,7 +244,7 @@ public class RelFieldCollation {
* {@code offset} to the right.
*/
   public RelFieldCollation shift(int offset) {
-return copy(fieldIndex + offset);
+return withFieldIndex(fieldIndex + offset);
   }
 
   @Override public boolean equals(Object o) {
diff --git 
a/core/src/main/java/org/apache/calcite/rel/metadata/RelMdCollation.java 
b/core/src/main/java/org/apache/calcite/rel/metadata/RelMdCollation.java
index 529a405..b5f5751 100644
--- a/core/src/main/java/org/apache/calcite/rel/metadata/RelMdCollation.java
+++ b/core/src/main/java/org/apache/calcite/rel/metadata/RelMdCollation.java
@@ -276,7 +276,7 @@ public class RelMdCollation
 if (integers.isEmpty()) {
   continue loop; // cannot do this collation
 }
-fieldCollations.add(ifc.copy(integers.iterator().next()));
+fieldCollations.add(ifc.withFieldIndex(integers.iterator().next()));
   }
   assert !fieldCollations.isEmpty();
   collations.add(RelCollations.of(fieldCollations));
diff --git 
a/core/src/main/java/org/apache/calcite/rel/rules/ProjectWindowTransposeRule.java
 
b/core/src/main/java/org/apache/calcite/rel/rules/ProjectWindowTransposeRule.java
index 10afd40..b7cc9f6 100644
--- 
a/core/src/main/java/org/apache/calcite/rel/rules/ProjectWindowTransposeRule.java
+++ 
b/core/src/main/java/org/apache/calcite/rel/rules/ProjectWindowTransposeRule.java
@@ -148,7 +148,7 @@ public class ProjectWindowTransposeRule extends RelOptRule {
   

[calcite] 05/05: [CALCITE-2958] Upgrade SQLLine to 1.7.0

2019-03-27 Thread jhyde
This is an automated email from the ASF dual-hosted git repository.

jhyde pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/calcite.git

commit a9687de8145de35262c34288c27961585c141ca7
Author: Julian Hyde 
AuthorDate: Tue Mar 26 21:55:52 2019 -0700

[CALCITE-2958] Upgrade SQLLine to 1.7.0

Close apache/calcite#1136
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 0d84511..b5f6161 100644
--- a/pom.xml
+++ b/pom.xml
@@ -135,7 +135,7 @@ limitations under the License.
 1.7.25
 2.11.0
 2.2.0
-1.6.0
+1.7.0
 1.2
 2.7.1
 2.9.1



[calcite] 02/05: [CALCITE-2796] JDBC adapter should convert 'GROUP BY ROLLUP(x, y)' to 'GROUP BY x, y WITH ROLLUP' for MySQL 5

2019-03-27 Thread jhyde
This is an automated email from the ASF dual-hosted git repository.

jhyde pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/calcite.git

commit 1f4b61989faec2a4b5a4a8eac58cd621843cf2b3
Author: Julian Hyde 
AuthorDate: Tue Jan 22 10:44:29 2019 -0800

[CALCITE-2796] JDBC adapter should convert 'GROUP BY ROLLUP(x, y)' to 
'GROUP BY x, y WITH ROLLUP' for MySQL 5

Add 'Util.select(List, List)'.

In Aggregate.Group, broaden patterns of grouping sets that are
considered a "rollup". Previously [{}, {0}, {0,1}] would have been
considered a rollup, but [{}, {1}, {0, 1}] would not, because of bit
order. Now they are both considered rollups. Add Group.getRollup(),
which generates the sequence of bits, for example [0, 1] and [1, 0]
for the previous examples.
---
 .../java/org/apache/calcite/plan/RelOptUtil.java   |  11 +-
 .../org/apache/calcite/rel/RelFieldCollation.java  |   3 +-
 .../org/apache/calcite/rel/core/Aggregate.java |  70 --
 .../calcite/rel/rel2sql/RelToSqlConverter.java | 135 +--
 .../java/org/apache/calcite/sql/SqlDialect.java|  39 +-
 .../calcite/sql/dialect/MysqlSqlDialect.java   |  11 ++
 .../apache/calcite/sql/fun/SqlRollupOperator.java  |  18 +++
 .../java/org/apache/calcite/tools/Programs.java|   6 +
 .../java/org/apache/calcite/tools/RelBuilder.java  |   6 +-
 .../main/java/org/apache/calcite/util/Util.java|  14 ++
 .../calcite/rel/rel2sql/RelToSqlConverterTest.java | 145 +
 .../calcite/test/InduceGroupingTypeTest.java   |  74 +--
 .../java/org/apache/calcite/util/UtilTest.java |  34 +
 .../calcite/adapter/geode/rel/GeodeRules.java  |  14 +-
 14 files changed, 520 insertions(+), 60 deletions(-)

diff --git a/core/src/main/java/org/apache/calcite/plan/RelOptUtil.java 
b/core/src/main/java/org/apache/calcite/plan/RelOptUtil.java
index c7f9048..52a9ef2 100644
--- a/core/src/main/java/org/apache/calcite/plan/RelOptUtil.java
+++ b/core/src/main/java/org/apache/calcite/plan/RelOptUtil.java
@@ -3014,16 +3014,7 @@ public abstract class RelOptUtil {
 return relBuilder.getRexBuilder().makeInputRef(child, pos);
   }
 };
-final List names = new AbstractList() {
-  public int size() {
-return posList.size();
-  }
-
-  public String get(int index) {
-final int pos = posList.get(index);
-return fieldNames.get(pos);
-  }
-};
+final List names = Util.select(fieldNames, posList);
 return relBuilder
 .push(child)
 .projectNamed(exprs, names, false)
diff --git a/core/src/main/java/org/apache/calcite/rel/RelFieldCollation.java 
b/core/src/main/java/org/apache/calcite/rel/RelFieldCollation.java
index f837474..fd897d6 100644
--- a/core/src/main/java/org/apache/calcite/rel/RelFieldCollation.java
+++ b/core/src/main/java/org/apache/calcite/rel/RelFieldCollation.java
@@ -19,6 +19,7 @@ package org.apache.calcite.rel;
 import org.apache.calcite.sql.validate.SqlMonotonicity;
 
 import java.util.Objects;
+import javax.annotation.Nonnull;
 
 /**
  * Definition of the ordering of one field of a {@link RelNode} whose
@@ -125,7 +126,7 @@ public class RelFieldCollation {
 
 /** Returns the null direction if not specified. Consistent with Oracle,
  * NULLS are sorted as if they were positive infinity. */
-public NullDirection defaultNullDirection() {
+public @Nonnull NullDirection defaultNullDirection() {
   switch (this) {
   case ASCENDING:
   case STRICTLY_ASCENDING:
diff --git a/core/src/main/java/org/apache/calcite/rel/core/Aggregate.java 
b/core/src/main/java/org/apache/calcite/rel/core/Aggregate.java
index 16dc5fa..82b4f70 100644
--- a/core/src/main/java/org/apache/calcite/rel/core/Aggregate.java
+++ b/core/src/main/java/org/apache/calcite/rel/core/Aggregate.java
@@ -48,6 +48,7 @@ import com.google.common.collect.ImmutableList;
 import com.google.common.math.IntMath;
 
 import java.util.HashSet;
+import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Objects;
 import java.util.Set;
@@ -476,20 +477,69 @@ public abstract class Aggregate extends SingleRel {
   if (groupSets.size() == IntMath.pow(2, groupSet.cardinality())) {
 return CUBE;
   }
-checkRollup:
-  if (groupSets.size() == groupSet.cardinality() + 1) {
-ImmutableBitSet g = groupSet;
-for (ImmutableBitSet bitSet : groupSets) {
-  if (!bitSet.equals(g)) {
-break checkRollup;
-  }
-  g = g.clear(g.length() - 1);
-}
-assert g.isEmpty();
+  if (isRollup(groupSet, groupSets)) {
 return ROLLUP;
   }
   return OTHER;
 }
+
+/** Returns whether a list of sets is a rollup.
+ *
+ * For example, if {@code groupSet} is {2, 4, 5}, then
+ * [{2, 4, 5], {2, 5}, {5}, {}] is a rollup. The first item is
+ * equal to {@code groupSet}, and each subsequent 

[GitHub] [calcite] hsyuan commented on issue #912: [CALCITE-2729] introducing WindowReduceExpressionsRule

2019-03-27 Thread GitBox
hsyuan commented on issue #912: [CALCITE-2729] introducing 
WindowReduceExpressionsRule
URL: https://github.com/apache/calcite/pull/912#issuecomment-477365431
 
 
   @risdenk @asereda-gs  Thanks, I will sync my apache/calcite account 
following the guide.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [calcite-avatica] risdenk commented on issue #40: [CALCITE-2269] Enable errorprone checking

2019-03-27 Thread GitBox
risdenk commented on issue #40: [CALCITE-2269] Enable errorprone checking
URL: https://github.com/apache/calcite-avatica/pull/40#issuecomment-477363357
 
 
   Travis is having a few issues today. Will wait to merge after Travis 
finishes to make sure the Error Prone profile is triggered correctly for JDK 11.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [calcite] risdenk commented on issue #912: [CALCITE-2729] introducing WindowReduceExpressionsRule

2019-03-27 Thread GitBox
risdenk commented on issue #912: [CALCITE-2729] introducing 
WindowReduceExpressionsRule
URL: https://github.com/apache/calcite/pull/912#issuecomment-477347597
 
 
   @asereda-gs @hsyuan doesn't look to be part of the 
https://github.com/orgs/apache/teams/calcite-committers/members
   
   @hsyuan https://reference.apache.org/committer/github has details about how 
to setup the sync
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [calcite] asereda-gs commented on issue #912: [CALCITE-2729] introducing WindowReduceExpressionsRule

2019-03-27 Thread GitBox
asereda-gs commented on issue #912: [CALCITE-2729] introducing 
WindowReduceExpressionsRule
URL: https://github.com/apache/calcite/pull/912#issuecomment-477345487
 
 
   @hsyuan do you have github permissions ? Do you see "rebase and merge" 
button ? Are you synced as apache/calcite committer ? 


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [calcite-avatica] risdenk commented on issue #40: [CALCITE-2269] Enable errorprone checking

2019-03-27 Thread GitBox
risdenk commented on issue #40: [CALCITE-2269] Enable errorprone checking
URL: https://github.com/apache/calcite-avatica/pull/40#issuecomment-477340440
 
 
   Added profile `ErrorProne` that will enable the Error Prone checking on 
demand. I did not add the JDK 8 stuff since we will eventually move away from 
JDK 8. Added to `.travis.yml` to check error prone on JDK 11 only.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [calcite-avatica] zabetak merged pull request #88: Improve exception message in AbstractService

2019-03-27 Thread GitBox
zabetak merged pull request #88: Improve exception message in AbstractService
URL: https://github.com/apache/calcite-avatica/pull/88
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[calcite-avatica] branch master updated: Improve exception message in AbstractService

2019-03-27 Thread zabetak
This is an automated email from the ASF dual-hosted git repository.

zabetak pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/calcite-avatica.git


The following commit(s) were added to refs/heads/master by this push:
 new e070185  Improve exception message in AbstractService
e070185 is described below

commit e070185f0b5fcd5ea52d9bc50d79b3e94ae84059
Author: leesf <490081...@qq.com>
AuthorDate: Wed Mar 27 09:09:47 2019 +0800

Improve exception message in AbstractService
---
 .../main/java/org/apache/calcite/avatica/remote/AbstractService.java   | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git 
a/core/src/main/java/org/apache/calcite/avatica/remote/AbstractService.java 
b/core/src/main/java/org/apache/calcite/avatica/remote/AbstractService.java
index ffaa360..a082f43 100644
--- a/core/src/main/java/org/apache/calcite/avatica/remote/AbstractService.java
+++ b/core/src/main/java/org/apache/calcite/avatica/remote/AbstractService.java
@@ -89,7 +89,8 @@ public abstract class AbstractService implements Service {
   case PROTOBUF:
 return column;
   default:
-throw new IllegalStateException("Unhadled case statement");
+throw new IllegalStateException("Unhandled case statement with 
serializationType: "
++ getSerializationType());
   }
 case Types.DECIMAL:
 case Types.NUMERIC:



[GitHub] [calcite] hsyuan commented on issue #1126: CalciteCatalogReader now uses config.caseSensitive() to get functions…

2019-03-27 Thread GitBox
hsyuan commented on issue #1126: CalciteCatalogReader now uses 
config.caseSensitive() to get functions…
URL: https://github.com/apache/calcite/pull/1126#issuecomment-477311907
 
 
   Hi @LaiZhou, Any JIRA opened for this?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [calcite] hsyuan commented on issue #912: [CALCITE-2729] introducing WindowReduceExpressionsRule

2019-03-27 Thread GitBox
hsyuan commented on issue #912: [CALCITE-2729] introducing 
WindowReduceExpressionsRule
URL: https://github.com/apache/calcite/pull/912#issuecomment-477303707
 
 
   @asereda-gs How to add label `LGTM-will-merge-soon` on it? I am not able to 
add label to the PR.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [calcite-avatica] julianhyde commented on issue #88: Improve exception message in AbstractService

2019-03-27 Thread GitBox
julianhyde commented on issue #88: Improve exception message in AbstractService
URL: https://github.com/apache/calcite-avatica/pull/88#issuecomment-477283526
 
 
   I agree with both of you. @zabetak I'm glad the discussion was useful, in an 
ideal world it would have happened somewhere else. As @vlsi says, an expedited 
review process, especially for less important/dangerous PRs, is useful.
   
   An Apache principle is "JFDI" (just *** do it). Which means trust that 
everyone is acting in good faith, and choose the action which is most 
efficient. I, too, will squash, rebase and fix up commits as I am reviewing 
them. (I often need to add author name and the 'close #' comment.) I encourage 
others to do the same.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [calcite] asfgit closed pull request #1134: [CALCITE-2953] LatticeTest.testTileAlgorithm2 and LatticeTest.testTil…

2019-03-27 Thread GitBox
asfgit closed pull request #1134: [CALCITE-2953] LatticeTest.testTileAlgorithm2 
and LatticeTest.testTil…
URL: https://github.com/apache/calcite/pull/1134
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[calcite] branch master updated: [CALCITE-2953] LatticeTest.testTileAlgorithm2 and LatticeTest.testTileAlgorithm3 fail intermittently

2019-03-27 Thread jcamacho
This is an automated email from the ASF dual-hosted git repository.

jcamacho pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/calcite.git


The following commit(s) were added to refs/heads/master by this push:
 new 90e69d4  [CALCITE-2953] LatticeTest.testTileAlgorithm2 and 
LatticeTest.testTileAlgorithm3 fail intermittently
90e69d4 is described below

commit 90e69d4188c02420027b51b11c315330759ec2ea
Author: Jesus Camacho Rodriguez 
AuthorDate: Wed Mar 27 07:35:54 2019 -0700

[CALCITE-2953] LatticeTest.testTileAlgorithm2 and 
LatticeTest.testTileAlgorithm3 fail intermittently

Close apache/calcite#1134
---
 .../java/org/apache/calcite/test/LatticeTest.java  | 33 ++
 1 file changed, 27 insertions(+), 6 deletions(-)

diff --git a/core/src/test/java/org/apache/calcite/test/LatticeTest.java 
b/core/src/test/java/org/apache/calcite/test/LatticeTest.java
index c23a0de..ca7cacd 100644
--- a/core/src/test/java/org/apache/calcite/test/LatticeTest.java
+++ b/core/src/test/java/org/apache/calcite/test/LatticeTest.java
@@ -20,9 +20,12 @@ import org.apache.calcite.jdbc.CalciteSchema;
 import org.apache.calcite.materialize.Lattice;
 import org.apache.calcite.materialize.Lattices;
 import org.apache.calcite.materialize.MaterializationService;
+import org.apache.calcite.plan.RelOptPlanner;
 import org.apache.calcite.plan.RelOptUtil;
+import org.apache.calcite.rel.rules.AbstractMaterializedViewRule;
 import org.apache.calcite.runtime.Hook;
 import org.apache.calcite.schema.SchemaPlus;
+import org.apache.calcite.test.CalciteAssert.AssertQuery;
 import org.apache.calcite.util.ImmutableBitSet;
 import org.apache.calcite.util.TestUtil;
 
@@ -501,15 +504,33 @@ public class LatticeTest {
   String expectedExplain) {
 MaterializationService.setThreadLocal();
 MaterializationService.instance().clear();
-foodmartLatticeModel(statisticProvider)
+AssertQuery that = foodmartLatticeModel(statisticProvider)
 .query("select distinct t.\"the_year\", t.\"quarter\"\n"
 + "from \"foodmart\".\"sales_fact_1997\" as s\n"
 + "join \"foodmart\".\"time_by_day\" as t using (\"time_id\")\n")
-.enableMaterializations(true)
-// disable for MySQL; times out running star-join query
-// disable for H2; it thinks our generated SQL has invalid syntax
-.enable(CalciteAssert.DB != CalciteAssert.DatabaseInstance.MYSQL
-&& CalciteAssert.DB != CalciteAssert.DatabaseInstance.H2)
+.enableMaterializations(true);
+
+// Disable materialization rules from this test. For some reason, there is
+// a weird interaction between these rules and the lattice rewriting that
+// produces non-deterministic rewriting (even when only lattices are 
present).
+// For more context, see
+// https://issues.apache.org/jira/browse/CALCITE-2953;>[CALCITE-2953].
+that.withHook(Hook.PLANNER, (Consumer) planner -> {
+  ImmutableList
+  .of(
+  AbstractMaterializedViewRule.INSTANCE_PROJECT_FILTER,
+  AbstractMaterializedViewRule.INSTANCE_FILTER,
+  AbstractMaterializedViewRule.INSTANCE_PROJECT_JOIN,
+  AbstractMaterializedViewRule.INSTANCE_JOIN,
+  AbstractMaterializedViewRule.INSTANCE_PROJECT_AGGREGATE,
+  AbstractMaterializedViewRule.INSTANCE_AGGREGATE)
+  .forEach(planner::removeRule);
+});
+
+// disable for MySQL; times out running star-join query
+// disable for H2; it thinks our generated SQL has invalid syntax
+that.enable(CalciteAssert.DB != CalciteAssert.DatabaseInstance.MYSQL
+&& CalciteAssert.DB != CalciteAssert.DatabaseInstance.H2)
 .explainContains(expectedExplain)
 .returnsUnordered("the_year=1997; quarter=Q1",
 "the_year=1997; quarter=Q2",



[GitHub] [calcite-avatica] julianhyde commented on issue #90: [CALCITE-2950] Avatica DriverVersion.load leaks InputStream

2019-03-27 Thread GitBox
julianhyde commented on issue #90: [CALCITE-2950] Avatica DriverVersion.load 
leaks InputStream
URL: https://github.com/apache/calcite-avatica/pull/90#issuecomment-477277706
 
 
   I'll go further. That kind of problem should be a java.lang.Error.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [calcite-avatica] joshelser commented on issue #90: [CALCITE-2950] Avatica DriverVersion.load leaks InputStream

2019-03-27 Thread GitBox
joshelser commented on issue #90: [CALCITE-2950] Avatica DriverVersion.load 
leaks InputStream
URL: https://github.com/apache/calcite-avatica/pull/90#issuecomment-477214905
 
 
   > The code implements a fallback logic if Exception happens, so exception 
should not be re-thrown?
   
   I'm more worried because I can't think of a "normal" reason that we should 
ever get an IOException thrown when reading a file like this. I would want to 
know that it happened via a hard-fail (unchecked exception).


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [calcite] yuqi1129 commented on a change in pull request #1057: [CALCITE-2854] code gen error for UNARY_MINUS operator call with deci…

2019-03-27 Thread GitBox
yuqi1129 commented on a change in pull request #1057: [CALCITE-2854] code gen 
error for UNARY_MINUS operator call with deci…
URL: https://github.com/apache/calcite/pull/1057#discussion_r269541808
 
 

 ##
 File path: core/src/test/java/org/apache/calcite/test/ReflectiveSchemaTest.java
 ##
 @@ -625,6 +637,12 @@ private void check(ResultSetMetaData metaData, String 
columnName,
   private void checkOp(CalciteAssert.AssertThat with, String fn) {
 for (Field field : EveryType.numericFields()) {
   for (Field field2 : EveryType.numericFields()) {
+//Decimal +-*/ others types has bug see CALCITE-2861
+//when CALCITE-2861 was solved, remove this code logic
 
 Review comment:
   OK


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [calcite] yuqi1129 commented on a change in pull request #1057: [CALCITE-2854] code gen error for UNARY_MINUS operator call with deci…

2019-03-27 Thread GitBox
yuqi1129 commented on a change in pull request #1057: [CALCITE-2854] code gen 
error for UNARY_MINUS operator call with deci…
URL: https://github.com/apache/calcite/pull/1057#discussion_r269527965
 
 

 ##
 File path: core/src/test/java/org/apache/calcite/test/ReflectiveSchemaTest.java
 ##
 @@ -625,6 +637,12 @@ private void check(ResultSetMetaData metaData, String 
columnName,
   private void checkOp(CalciteAssert.AssertThat with, String fn) {
 for (Field field : EveryType.numericFields()) {
   for (Field field2 : EveryType.numericFields()) {
+//Decimal +-*/ others types has bug see CALCITE-2861
 
 Review comment:
   Thanks for your suggestion, i will make a change


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [calcite] zhztheplayer commented on a change in pull request #1057: [CALCITE-2854] code gen error for UNARY_MINUS operator call with deci…

2019-03-27 Thread GitBox
zhztheplayer commented on a change in pull request #1057: [CALCITE-2854] code 
gen error for UNARY_MINUS operator call with deci…
URL: https://github.com/apache/calcite/pull/1057#discussion_r269524420
 
 

 ##
 File path: 
core/src/main/java/org/apache/calcite/adapter/enumerable/RexImpTable.java
 ##
 @@ -2168,7 +2167,14 @@ public Expression implement(
 RexCall call,
 List translatedOperands) {
   final Expression operand = translatedOperands.get(0);
-  final UnaryExpression e = Expressions.makeUnary(expressionType, operand);
+
+  final Expression e;
+  if (expressionType == ExpressionType.Negate && operand.type == 
BigDecimal.class) {
+e = Expressions.call(BuiltInMethod.UNARY_MINUS.method, operand);
 
 Review comment:
   The class `BinaryImplementor`'s constructor has a parameter 
`backupMethodName`:
   
https://github.com/apache/calcite/blob/280642a02a4bcfd1fb9cbe8c5ab672d3619860e7/core/src/main/java/org/apache/calcite/adapter/enumerable/RexImpTable.java#L2088-L2093
   
   My suggestion is to change the `UnaryImplementor` to include a similar 
argument, e.g.
   ```java
   UnaryImplementor(ExpressionType expressionType, String backupMethodName) {
 this.expressionType = expressionType;
 this.backupMethodName = backupMethodName; 
   }
   ```
   
   Then you can specify `BuiltInMethod.UNARY_MINUS.method` as a backup method 
of the implementor of the operator `UNARY_MINUS`.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [calcite] yuqi1129 commented on a change in pull request #1057: [CALCITE-2854] code gen error for UNARY_MINUS operator call with deci…

2019-03-27 Thread GitBox
yuqi1129 commented on a change in pull request #1057: [CALCITE-2854] code gen 
error for UNARY_MINUS operator call with deci…
URL: https://github.com/apache/calcite/pull/1057#discussion_r269522882
 
 

 ##
 File path: core/src/test/java/org/apache/calcite/test/ReflectiveSchemaTest.java
 ##
 @@ -953,13 +974,13 @@ public IntAndString(int id, String value) {
 false, (byte) 0, (char) 0, (short) 0, 0, 0L, 0F, 0D,
 false, (byte) 0, (char) 0, (short) 0, 0, 0L, 0F, 0D,
 new java.sql.Date(0), new Time(0), new Timestamp(0),
-new Date(0), "1"),
+new Date(0), "1", BigDecimal.valueOf(-1)),
 new EveryType(
 true, Byte.MAX_VALUE, Character.MAX_VALUE, Short.MAX_VALUE,
 Integer.MAX_VALUE, Long.MAX_VALUE, Float.MAX_VALUE,
 Double.MAX_VALUE,
 null, null, null, null, null, null, null, null,
-null, null, null, null, null),
+null, null, null, null, null, new BigDecimal("1.2")),
 
 Review comment:
   Yes, we should consider the null corner case


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [calcite] yuqi1129 commented on a change in pull request #1057: [CALCITE-2854] code gen error for UNARY_MINUS operator call with deci…

2019-03-27 Thread GitBox
yuqi1129 commented on a change in pull request #1057: [CALCITE-2854] code gen 
error for UNARY_MINUS operator call with deci…
URL: https://github.com/apache/calcite/pull/1057#discussion_r269519787
 
 

 ##
 File path: 
core/src/main/java/org/apache/calcite/adapter/enumerable/RexImpTable.java
 ##
 @@ -2168,7 +2167,14 @@ public Expression implement(
 RexCall call,
 List translatedOperands) {
   final Expression operand = translatedOperands.get(0);
-  final UnaryExpression e = Expressions.makeUnary(expressionType, operand);
+
+  final Expression e;
+  if (expressionType == ExpressionType.Negate && operand.type == 
BigDecimal.class) {
+e = Expressions.call(BuiltInMethod.UNARY_MINUS.method, operand);
 
 Review comment:
   BinaryImplementor ? As far as i known, it only be used in binary operator 
and problem is unary minus. If I understand it incorrectly, please correct me. 
thanks
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [calcite-avatica] vlsi commented on issue #88: Improve exception message in AbstractService

2019-03-27 Thread GitBox
vlsi commented on issue #88: Improve exception message in AbstractService
URL: https://github.com/apache/calcite-avatica/pull/88#issuecomment-477048459
 
 
   @zabetak , I'm afraid I'm with Julian.
   Each message generates GitHub notification, and it does create disruptions. 
It forces everybody to spend time on opening the discussion.
   
   As you can see, Julian even navigated here and created a comment. Do you 
think it is the first time he "reviewed this PR"?
   
   Of course the PR is trivial, and in my opinion committer should just commit 
the change and that's it.
   
   "Please rebase and squash" generates extreme amount of notifications (see 
https://github.com/apache/calcite-avatica/watchers ) which is really sad.
   
   That is why I prefer to just rebase/squash/etc on my own when I commit PRs.
   
   > There a was a fruitful discussion on if we want to have default case in 
enumerations
   
   Those cases should probably be discussed on the mailing list.
   
   PS. Really sorry to pile up the notifications.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [calcite-avatica] zabetak commented on issue #88: Improve exception message in AbstractService

2019-03-27 Thread GitBox
zabetak commented on issue #88: Improve exception message in AbstractService
URL: https://github.com/apache/calcite-avatica/pull/88#issuecomment-477037657
 
 
   I don't believe it is a waste of time. There a was a fruitful discussion on 
if we want to have default case in enumerations in general and I learned that 
the policy of the project is to always pair default with throws. In general, I 
think the throw can happen (it should be very very rare) if you happen to mix 
new and old binaries (classes). 


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [calcite-avatica] julianhyde commented on issue #88: Improve exception message in AbstractService

2019-03-27 Thread GitBox
julianhyde commented on issue #88: Improve exception message in AbstractService
URL: https://github.com/apache/calcite-avatica/pull/88#issuecomment-477031898
 
 
   I can't believe how much time we've wasted on this PR. The switch is 
exhaustive. The throw will never happen. So it doesn't matter what the text is. 
It's a cosmetic change and not worth the effort.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [calcite] julianhyde commented on issue #1071: [CALCITE-2877] Make GeodeSchema constructor public to pass client cache object

2019-03-27 Thread GitBox
julianhyde commented on issue #1071: [CALCITE-2877] Make GeodeSchema 
constructor public to pass client cache object
URL: https://github.com/apache/calcite/pull/1071#issuecomment-477024050
 
 
   The Schema should have no more functionality than the SchemaFactory - it is 
just allowed to accept arguments in "hydrated" form. Unless you have a plan for 
how to represent a Predicate as a string, you are straying away from that 
principle.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [calcite] chunweilei commented on a change in pull request #912: [CALCITE-2729] introducing WindowReduceExpressionsRule

2019-03-27 Thread GitBox
chunweilei commented on a change in pull request #912: [CALCITE-2729] 
introducing WindowReduceExpressionsRule
URL: https://github.com/apache/calcite/pull/912#discussion_r269429047
 
 

 ##
 File path: core/src/test/resources/org/apache/calcite/test/RelOptRulesTest.xml
 ##
 @@ -8674,4 +8674,32 @@ LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], 
MGR=[$3], HIREDATE=[$4], SAL=[$
 
 
 
+
+
+
+
+
+

[GitHub] [calcite] chunweilei commented on a change in pull request #1102: [CALCITE-1515] RelBuilder supports creating TableFunctionScan

2019-03-27 Thread GitBox
chunweilei commented on a change in pull request #1102: [CALCITE-1515] 
RelBuilder supports creating TableFunctionScan
URL: https://github.com/apache/calcite/pull/1102#discussion_r269426050
 
 

 ##
 File path: 
core/src/main/java/org/apache/calcite/rel/core/TableFunctionScan.java
 ##
 @@ -64,6 +64,7 @@
*
* @param clusterCluster that this relational expression belongs to
* @param inputs 0 or more relational inputs
+   * @param traitSet   Traits
 
 Review comment:
   Done.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [calcite] chunweilei commented on a change in pull request #1102: [CALCITE-1515] RelBuilder supports creating TableFunctionScan

2019-03-27 Thread GitBox
chunweilei commented on a change in pull request #1102: [CALCITE-1515] 
RelBuilder supports creating TableFunctionScan
URL: https://github.com/apache/calcite/pull/1102#discussion_r269426080
 
 

 ##
 File path: 
core/src/main/java/org/apache/calcite/rel/logical/LogicalTableFunctionScan.java
 ##
 @@ -45,11 +45,12 @@
*
* @param clusterCluster that this relational expression belongs to
* @param inputs 0 or more relational inputs
-   * @param rexCallfunction invocation expression
-   * @param elementTypeelement type of the collection that will implement
+   * @param traitSet   Traits
 
 Review comment:
   Done.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [calcite] leesf opened a new pull request #1136: [CALCITE-2958] Upgrade SQLLine to 1.7.0

2019-03-27 Thread GitBox
leesf opened a new pull request #1136: [CALCITE-2958] Upgrade SQLLine to 1.7.0
URL: https://github.com/apache/calcite/pull/1136
 
 
   Upgrade SQLLine to 1.7.0


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services