[GitHub] [calcite] ritesh-kapoor commented on a change in pull request #1640: [CALCITE-3552] Support MySQL ExtractValue function

2019-12-08 Thread GitBox
ritesh-kapoor commented on a change in pull request #1640: [CALCITE-3552] 
Support MySQL ExtractValue function
URL: https://github.com/apache/calcite/pull/1640#discussion_r355286469
 
 

 ##
 File path: 
core/src/main/java/org/apache/calcite/adapter/enumerable/RexImpTable.java
 ##
 @@ -526,6 +527,9 @@ public Expression implement(RexToLixTranslator translator, 
RexCall call,
 defineMethod(CURRENT_VALUE, BuiltInMethod.SEQUENCE_CURRENT_VALUE.method, 
NullPolicy.STRICT);
 defineMethod(NEXT_VALUE, BuiltInMethod.SEQUENCE_NEXT_VALUE.method, 
NullPolicy.STRICT);
 
+//Xml Operators
+defineMethod(EXTRACTVALUE, BuiltInMethod.EXTRACTVALUE.method, 
NullPolicy.ARG0);
 
 Review comment:
   Sure, 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] ritesh-kapoor commented on a change in pull request #1640: [CALCITE-3552] Support MySQL ExtractValue function

2019-12-08 Thread GitBox
ritesh-kapoor commented on a change in pull request #1640: [CALCITE-3552] 
Support MySQL ExtractValue function
URL: https://github.com/apache/calcite/pull/1640#discussion_r355286596
 
 

 ##
 File path: core/src/main/java/org/apache/calcite/runtime/CalciteResource.java
 ##
 @@ -900,6 +900,11 @@
 
   @BaseMessage("Not a valid input for REGEXP_REPLACE: ''{0}''")
   ExInst invalidInputForRegexpReplace(String value);
+
+  @BaseMessage("Illegal error behavior ''{0}'' EXTRACTVALUE: document: 
''{1}'', xpath expression:"
+  + " ''{2}''")
+  ExInst illegalErrorBehaviorInExtractValueFunc(String 
value, String xpath,
+  String errorBehavior);
 }
 
 Review comment:
   Actually I referred IllegalErrorBehaviorInJsonQueryFunc, I have incorporated 
the changes :)


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 #1565: [CALCITE-3481] Support convert TableFunctionScan to SqlNode

2019-12-08 Thread GitBox
chunweilei commented on issue #1565: [CALCITE-3481] Support convert 
TableFunctionScan to SqlNode
URL: https://github.com/apache/calcite/pull/1565#issuecomment-563055108
 
 
   LGTM.


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] DonnyZone commented on a change in pull request #1347: [CALCITE-3224] New RexNode-to-Expression CodeGen Implementation

2019-12-08 Thread GitBox
DonnyZone commented on a change in pull request #1347: [CALCITE-3224] New 
RexNode-to-Expression CodeGen Implementation
URL: https://github.com/apache/calcite/pull/1347#discussion_r355251665
 
 

 ##
 File path: core/src/test/java/org/apache/calcite/test/ReflectiveSchemaTest.java
 ##
 @@ -585,10 +585,9 @@ private void check(ResultSetMetaData metaData, String 
columnName,
 with.query("select \"wrapperLong\" / \"primitiveLong\" as c\n"
 + " from \"s\".\"everyTypes\" where \"primitiveLong\" <> 0")
 .planContains(
-"final Long inp13_ = current.wrapperLong;")
+"final Long input_value = current.wrapperLong;")
 .planContains(
-"return inp13_ == null ? (Long) null "
-+ ": Long.valueOf(inp13_.longValue() / 
current.primitiveLong);")
+"return input_value == null ? (Long) null : 
Long.valueOf(input_value / Long.valueOf(current.primitiveLong));")
 
 Review comment:
   The difference is 
   ```
   old: inp13_.longValue() / current.primitiveLong)
   new: input_value / Long.valueOf(current.primitiveLong)
   ```
   We can conduct unboxing optimization before operands entering into 
`BinaryImplementor`.
   Thanks, let me change 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] DonnyZone commented on a change in pull request #1347: [CALCITE-3224] New RexNode-to-Expression CodeGen Implementation

2019-12-08 Thread GitBox
DonnyZone commented on a change in pull request #1347: [CALCITE-3224] New 
RexNode-to-Expression CodeGen Implementation
URL: https://github.com/apache/calcite/pull/1347#discussion_r355250676
 
 

 ##
 File path: core/src/test/java/org/apache/calcite/test/JdbcTest.java
 ##
 @@ -2451,12 +2451,14 @@ private void 
checkNullableTimestamp(CalciteAssert.Config config) {
 CalciteAssert.hr()
 .query(
 "select upper((case when \"empid\">\"deptno\"*10 then 'y' else 
null end)) T from \"hr\".\"emps\"")
-.planContains("static final String "
-+ "$L4J$C$org_apache_calcite_runtime_SqlFunctions_upper_y_ = "
-+ "org.apache.calcite.runtime.SqlFunctions.upper(\"y\");")
-.planContains("return current.empid <= current.deptno * 10 "
-+ "? (String) null "
-+ ": $L4J$C$org_apache_calcite_runtime_SqlFunctions_upper_y_;")
+.planContains("  String case_when_value;\n"
 
 Review comment:
   The new codegen framework can naturally reuses expressions, due to:
   It removes the mutable state (i.e., `Map 
exprNullableMap`), and generates code strictly corresonding to RexNode in 
one-to-one manner. 
   
   Therefore, the redundant code (including `null` checking) caused by 
tranversing with mutable state will not be produced again in the new codegen. 
On the other hand, we also keep a map in `RexToLixTranslator` for same 
RexNode's code reuse.


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] DonnyZone commented on a change in pull request #1347: [CALCITE-3224] New RexNode-to-Expression CodeGen Implementation

2019-12-08 Thread GitBox
DonnyZone commented on a change in pull request #1347: [CALCITE-3224] New 
RexNode-to-Expression CodeGen Implementation
URL: https://github.com/apache/calcite/pull/1347#discussion_r355250676
 
 

 ##
 File path: core/src/test/java/org/apache/calcite/test/JdbcTest.java
 ##
 @@ -2451,12 +2451,14 @@ private void 
checkNullableTimestamp(CalciteAssert.Config config) {
 CalciteAssert.hr()
 .query(
 "select upper((case when \"empid\">\"deptno\"*10 then 'y' else 
null end)) T from \"hr\".\"emps\"")
-.planContains("static final String "
-+ "$L4J$C$org_apache_calcite_runtime_SqlFunctions_upper_y_ = "
-+ "org.apache.calcite.runtime.SqlFunctions.upper(\"y\");")
-.planContains("return current.empid <= current.deptno * 10 "
-+ "? (String) null "
-+ ": $L4J$C$org_apache_calcite_runtime_SqlFunctions_upper_y_;")
+.planContains("  String case_when_value;\n"
 
 Review comment:
   The new codegen framework can naturally reuses expressions, due to:
   It removes the mutable state (i.e., `Map 
exprNullableMap`), and generates code strictly corresonding to RexNode in 
one-to-one manner. 
   
   Therefore, the redundant code vaused by tranversing with mutable state will 
not be produced again in the new codegen. On the other hand, we also keep a map 
in `RexToLixTranslator` for same RexNode's code reuse.


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] yanlin-Lynn commented on issue #1565: [CALCITE-3481] Support convert TableFunctionScan to SqlNode

2019-12-08 Thread GitBox
yanlin-Lynn commented on issue #1565: [CALCITE-3481] Support convert 
TableFunctionScan to SqlNode
URL: https://github.com/apache/calcite/pull/1565#issuecomment-563046208
 
 
   hi, @chunweilei , I have updated the PR according to your comment.
   Anything else to do 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] DonnyZone commented on a change in pull request #1347: [CALCITE-3224] New RexNode-to-Expression CodeGen Implementation

2019-12-08 Thread GitBox
DonnyZone commented on a change in pull request #1347: [CALCITE-3224] New 
RexNode-to-Expression CodeGen Implementation
URL: https://github.com/apache/calcite/pull/1347#discussion_r355247414
 
 

 ##
 File path: core/src/test/java/org/apache/calcite/test/JdbcTest.java
 ##
 @@ -2544,35 +2556,117 @@ private void 
checkNullableTimestamp(CalciteAssert.Config config) {
 + "from\n"
 + "\"hr\".\"emps\"")
 .planContains(
-"final String inp2_ = current.name;")
-.planContains(
-"final int inp1_ = current.deptno;")
-.planContains(
-"static final int $L4J$C$5_2 = 5 - 2;")
-.planContains(
-"static final Integer $L4J$C$Integer_valueOf_5_2_ = 
Integer.valueOf($L4J$C$5_2);")
-.planContains(
-"static final int $L4J$C$Integer_valueOf_5_2_intValue_ = 
$L4J$C$Integer_valueOf_5_2_.intValue();")
-.planContains("static final boolean "
-+ "$L4J$C$org_apache_calcite_runtime_SqlFunctions_eq_ = "
-+ "org.apache.calcite.runtime.SqlFunctions.eq(\"\", \"\");")
-.planContains("static final boolean "
-+ "$L4J$C$_org_apache_calcite_runtime_SqlFunctions_eq_ = "
-+ "!$L4J$C$org_apache_calcite_runtime_SqlFunctions_eq_;")
-.planContains("return inp2_ == null "
-+ "|| $L4J$C$_org_apache_calcite_runtime_SqlFunctions_eq_ "
-+ "|| current.empid <= inp1_ && inp1_ * 8 <= 8 "
-+ "? (String) null "
-+ ": org.apache.calcite.runtime.SqlFunctions.substring("
-+ "org.apache.calcite.runtime.SqlFunctions.trim(true, true, \" \", 
"
-+ "org.apache.calcite.runtime.SqlFunctions.substring(inp2_, "
-+ "Integer.valueOf(inp1_ * 0 + 1).intValue()), true), 
$L4J$C$Integer_valueOf_5_2_intValue_);")
+  "  final org.apache.calcite.test.JdbcTest.Employee 
current = (org.apache.calcite.test.JdbcTest.Employee) 
inputEnumerator.current();\n"
++ "  final String input_value = current.name;\n"
++ "  final int input_value0 = current.deptno;\n"
++ "  Integer case_when_value;\n"
++ "  if 
($L4J$C$org_apache_calcite_runtime_SqlFunctions_eq_) {\n"
++ "case_when_value = $L4J$C$Integer_valueOf_1_;\n"
++ "  } else {\n"
++ "case_when_value = (Integer) null;\n"
++ "  }\n"
++ "  final Integer binary_call_value1 = 
case_when_value == null ? (Integer) null : 
Integer.valueOf(Integer.valueOf(input_value0 * 0) + case_when_value);\n"
++ "  final String method_call_value = input_value == 
null || binary_call_value1 == null ? (String) null : 
org.apache.calcite.runtime.SqlFunctions.substring(input_value, 
binary_call_value1.intValue());\n"
++ "  final String trim_value = method_call_value == 
null ? (String) null : org.apache.calcite.runtime.SqlFunctions.trim(true, true, 
\" \", method_call_value, true);\n"
++ "  Integer case_when_value0;\n"
++ "  if (current.empid > input_value0) {\n"
++ "case_when_value0 = $L4J$C$Integer_valueOf_5_;\n"
++ "  } else {\n"
++ "Integer case_when_value1;\n"
++ "if (current.deptno * 8 > 8) {\n"
++ "  case_when_value1 = 
$L4J$C$Integer_valueOf_5_;\n"
++ "} else {\n"
++ "  case_when_value1 = (Integer) null;\n"
++ "}\n"
++ "case_when_value0 = case_when_value1;\n"
++ "  }\n"
++ "  final Integer binary_call_value3 = 
case_when_value0 == null ? (Integer) null : Integer.valueOf(case_when_value0 - 
$L4J$C$Integer_valueOf_2_);\n"
++ "  return trim_value == null || binary_call_value3 
== null ? (String) null : 
org.apache.calcite.runtime.SqlFunctions.substring(trim_value, 
binary_call_value3.intValue());"
+)
 .returns("T=ll\n"
 + "T=ic\n"
 + "T=bastian\n"
 + "T=eodore\n");
   }
 
+  /** Test case for
+   * https://issues.apache.org/jira/browse/CALCITE-3142;>[CALCITE-3142]
+   * An NPE when rounding a nullable numeric. */
+  @Test public void testRoundingNPE() {
+CalciteAssert.that()
+.query("SELECT ROUND(CAST((X/Y) AS NUMERIC), 2) "
++ "FROM (VALUES (1, 2), (NULLIF(5, 5), NULLIF(5, 5))) A(X, Y)")
+.planContains("  final Object[] current = (Object[]) 
inputEnumerator.current();\n"
 
 Review comment:
   No particular reason, just provide the generated code as @vlsi 's request.


This 

[GitHub] [calcite] DonnyZone commented on a change in pull request #1609: [CALCITE-3520] Type cast from primitive to box is not correct

2019-12-08 Thread GitBox
DonnyZone commented on a change in pull request #1609: [CALCITE-3520] Type cast 
from primitive to box is not correct
URL: https://github.com/apache/calcite/pull/1609#discussion_r355245385
 
 

 ##
 File path: 
core/src/main/java/org/apache/calcite/adapter/enumerable/EnumUtils.java
 ##
 @@ -400,8 +400,11 @@ public static Expression convert(Expression operand, Type 
fromType,
   if (operand instanceof UnaryExpression) {
 UnaryExpression una = (UnaryExpression) operand;
 if (una.nodeType == ExpressionType.Convert
-|| Primitive.of(una.getType()) == toBox) {
-  return Expressions.box(una.expression, toBox);
+&& Primitive.of(una.getType()) == toBox) {
+  Primitive origin = Primitive.of(una.expression.type);
 
 Review comment:
   According to the comment, "Eliminate primitive casts like 
Long.valueOf((long) x), Generate Long.valueOf(x)", we should satiesfy all these 
conditions.


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 #1636: [CALCITE-3568] BigQuery, Hive, Spark SQL dialects don't support nested aggregates

2019-12-08 Thread GitBox
chunweilei commented on issue #1636: [CALCITE-3568] BigQuery, Hive, Spark SQL 
dialects don't support nested aggregates
URL: https://github.com/apache/calcite/pull/1636#issuecomment-563038173
 
 
   Could you please resolve the 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] jinxing64 commented on a change in pull request #1554: [CALCITE-3462] Add method in RelBuilder for conveniently projecting out expressions

2019-12-08 Thread GitBox
jinxing64 commented on a change in pull request #1554: [CALCITE-3462] Add 
method in RelBuilder for conveniently projecting out expressions
URL: https://github.com/apache/calcite/pull/1554#discussion_r355243183
 
 

 ##
 File path: core/src/main/java/org/apache/calcite/tools/RelBuilder.java
 ##
 @@ -1259,15 +1255,33 @@ public RelBuilder projectPlus(RexNode... nodes) {
 return projectPlus(ImmutableList.copyOf(nodes));
   }
 
-  /** Creates a {@link Project} of all original fields, plus the given list of
+  /** Creates a {@link Project} of all original fields, plus the given
* expressions. */
   public RelBuilder projectPlus(Iterable nodes) {
 final ImmutableList.Builder builder = ImmutableList.builder();
 return project(builder.addAll(fields()).addAll(nodes).build());
   }
 
-  /** Creates a {@link Project} of the given list
-   * of expressions, using the given names.
+  /** Creates a {@link Project} of all original fields, except the given
+   * expressions. */
+  public RelBuilder projectExcept(RexNode... expressions) {
+return projectExcept(ImmutableList.copyOf(expressions));
+  }
+
+  /** Creates a {@link Project} of all original fields, except the given
+   * expressions. */
+  public RelBuilder projectExcept(Iterable expressions) {
+List allExpressions = new ArrayList<>(fields());
+for (RexNode excludeExp : expressions) {
+  if (!allExpressions.remove(excludeExp)) {
+throw RESOURCE.expressionNotFound(excludeExp.toString()).ex();
 
 Review comment:
   The thing is that it makes no sense that `expressions` contains duplicates. 
It's better to have a way to let users know 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] chunweilei commented on a change in pull request #1640: [CALCITE-3552] Support MySQL ExtractValue function

2019-12-08 Thread GitBox
chunweilei commented on a change in pull request #1640: [CALCITE-3552] Support 
MySQL ExtractValue function
URL: https://github.com/apache/calcite/pull/1640#discussion_r355241884
 
 

 ##
 File path: 
core/src/main/java/org/apache/calcite/adapter/enumerable/RexImpTable.java
 ##
 @@ -526,6 +527,9 @@ public Expression implement(RexToLixTranslator translator, 
RexCall call,
 defineMethod(CURRENT_VALUE, BuiltInMethod.SEQUENCE_CURRENT_VALUE.method, 
NullPolicy.STRICT);
 defineMethod(NEXT_VALUE, BuiltInMethod.SEQUENCE_NEXT_VALUE.method, 
NullPolicy.STRICT);
 
+//Xml Operators
+defineMethod(EXTRACTVALUE, BuiltInMethod.EXTRACTVALUE.method, 
NullPolicy.ARG0);
 
 Review comment:
   Please add a space between // and xml


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 #1640: [CALCITE-3552] Support MySQL ExtractValue function

2019-12-08 Thread GitBox
chunweilei commented on a change in pull request #1640: [CALCITE-3552] Support 
MySQL ExtractValue function
URL: https://github.com/apache/calcite/pull/1640#discussion_r355242549
 
 

 ##
 File path: core/src/main/java/org/apache/calcite/runtime/CalciteResource.java
 ##
 @@ -900,6 +900,11 @@
 
   @BaseMessage("Not a valid input for REGEXP_REPLACE: ''{0}''")
   ExInst invalidInputForRegexpReplace(String value);
+
+  @BaseMessage("Illegal error behavior ''{0}'' EXTRACTVALUE: document: 
''{1}'', xpath expression:"
+  + " ''{2}''")
+  ExInst illegalErrorBehaviorInExtractValueFunc(String 
value, String xpath,
+  String errorBehavior);
 }
 
 Review comment:
   Both `illegal` and `error` are negative, which seems redundant. Do you mean 
illegal xml path?


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] danny0405 commented on a change in pull request #1554: [CALCITE-3462] Add method in RelBuilder for conveniently projecting out expressions

2019-12-08 Thread GitBox
danny0405 commented on a change in pull request #1554: [CALCITE-3462] Add 
method in RelBuilder for conveniently projecting out expressions
URL: https://github.com/apache/calcite/pull/1554#discussion_r355238662
 
 

 ##
 File path: core/src/test/java/org/apache/calcite/test/RelBuilderTest.java
 ##
 @@ -2024,6 +2025,103 @@ private RelNode 
buildRelWithDuplicateAggregates(RelBuilder builder,
 assertThat(root, hasTree(expected));
   }
 
+  /** Test case for
+   * https://issues.apache.org/jira/browse/CALCITE-3462;>[CALCITE-3462]
+   * Add projectExcept method in RelBuilder for projecting out 
expressions. */
+  @Test public void testProjectExceptWithOrdinal() {
+final RelBuilder builder = RelBuilder.create(config().build());
+RelNode root =
+builder.scan("EMP")
+.projectExcept(
+builder.field(2),
+builder.field(3))
+.build();
+final String expected = ""
++ "LogicalProject(EMPNO=[$0], ENAME=[$1], HIREDATE=[$4], SAL=[$5], 
COMM=[$6], DEPTNO=[$7])\n"
++ "  LogicalTableScan(table=[[scott, EMP]])\n";
+assertThat(root, hasTree(expected));
+  }
+
+  /** Test case for
+   * https://issues.apache.org/jira/browse/CALCITE-3462;>[CALCITE-3462]
+   * Add projectExcept method in RelBuilder for projecting out 
expressions. */
+  @Test public void testProjectExceptWithName() {
+final RelBuilder builder = RelBuilder.create(config().build());
+RelNode root =
+builder.scan("EMP")
+.projectExcept(
+builder.field("MGR"),
+builder.field("JOB"))
+.build();
+final String expected = ""
++ "LogicalProject(EMPNO=[$0], ENAME=[$1], HIREDATE=[$4], SAL=[$5], 
COMM=[$6], DEPTNO=[$7])\n"
++ "  LogicalTableScan(table=[[scott, EMP]])\n";
+assertThat(root, hasTree(expected));
+  }
+
+  /** Test case for
+   * https://issues.apache.org/jira/browse/CALCITE-3462;>[CALCITE-3462]
+   * Add projectExcept method in RelBuilder for projecting out 
expressions. */
+  @Test public void testProjectExceptWithExplicitAliasAndName() {
+final RelBuilder builder = RelBuilder.create(config().build());
+RelNode root =
+builder.scan("EMP")
+.as("e")
+.projectExcept(
+builder.field("e", "MGR"),
+builder.field("e", "JOB"))
+.build();
+final String expected = ""
++ "LogicalProject(EMPNO=[$0], ENAME=[$1], HIREDATE=[$4], SAL=[$5], 
COMM=[$6], DEPTNO=[$7])\n"
++ "  LogicalTableScan(table=[[scott, EMP]])\n";
+assertThat(root, hasTree(expected));
+  }
+
+  /** Test case for
+   * https://issues.apache.org/jira/browse/CALCITE-3462;>[CALCITE-3462]
+   * Add projectExcept method in RelBuilder for projecting out 
expressions. */
+  @Test public void testProjectExceptWithImplicitAliasAndName() {
+final RelBuilder builder = RelBuilder.create(config().build());
+RelNode root =
+builder.scan("EMP")
+.projectExcept(
+builder.field("EMP", "MGR"),
+builder.field("EMP", "JOB"))
+.build();
+final String expected = ""
++ "LogicalProject(EMPNO=[$0], ENAME=[$1], HIREDATE=[$4], SAL=[$5], 
COMM=[$6], DEPTNO=[$7])\n"
++ "  LogicalTableScan(table=[[scott, EMP]])\n";
+assertThat(root, hasTree(expected));
+  }
+
+  /** Test case for
+   * https://issues.apache.org/jira/browse/CALCITE-3462;>[CALCITE-3462]
+   * Add projectExcept method in RelBuilder for projecting out 
expressions. */
+  @Test public void testProjectExceptWithDuplicateField() {
+final RelBuilder builder = RelBuilder.create(config().build());
+assertThrows(CalciteException.class, () -> {
+  builder.scan("EMP")
+  .projectExcept(
+builder.field("EMP", "MGR"),
+builder.field("EMP", "MGR"));
+}, "Project should fail since we are trying to remove the same field two 
times.");
+  }
+
+  /** Test case for
+   * https://issues.apache.org/jira/browse/CALCITE-3462;>[CALCITE-3462]
+   * Add projectExcept method in RelBuilder for projecting out 
expressions. */
+  @Test public void testProjectExceptWithMissingField() {
+final RelBuilder builder = RelBuilder.create(config().build());
+builder.scan("EMP");
+RexNode deptnoField = builder.field("DEPTNO");
+assertThrows(CalciteException.class, () -> {
+  builder.project(
 
 Review comment:
   It would be nice if we can also check the error message of the `Throwable`.


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] danny0405 commented on a change in pull request #1554: [CALCITE-3462] Add method in RelBuilder for conveniently projecting out expressions

2019-12-08 Thread GitBox
danny0405 commented on a change in pull request #1554: [CALCITE-3462] Add 
method in RelBuilder for conveniently projecting out expressions
URL: https://github.com/apache/calcite/pull/1554#discussion_r355238474
 
 

 ##
 File path: core/src/main/java/org/apache/calcite/tools/RelBuilder.java
 ##
 @@ -1189,8 +1187,8 @@ public RelBuilder filter(Iterable 
predicates) {
 return filter(ImmutableSet.of(), predicates);
   }
 
-  /** Creates a {@link Filter} of a list of correlation variables
-   * and an array of predicates.
+  /** Creates a {@link Filter} with the specified correlation variables
+   * and predicates.
 
 Review comment:
   Great, thanks for your explanation.


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] danny0405 commented on a change in pull request #1554: [CALCITE-3462] Add method in RelBuilder for conveniently projecting out expressions

2019-12-08 Thread GitBox
danny0405 commented on a change in pull request #1554: [CALCITE-3462] Add 
method in RelBuilder for conveniently projecting out expressions
URL: https://github.com/apache/calcite/pull/1554#discussion_r355238346
 
 

 ##
 File path: core/src/main/java/org/apache/calcite/tools/RelBuilder.java
 ##
 @@ -1259,15 +1255,33 @@ public RelBuilder projectPlus(RexNode... nodes) {
 return projectPlus(ImmutableList.copyOf(nodes));
   }
 
-  /** Creates a {@link Project} of all original fields, plus the given list of
+  /** Creates a {@link Project} of all original fields, plus the given
* expressions. */
   public RelBuilder projectPlus(Iterable nodes) {
 final ImmutableList.Builder builder = ImmutableList.builder();
 return project(builder.addAll(fields()).addAll(nodes).build());
   }
 
-  /** Creates a {@link Project} of the given list
-   * of expressions, using the given names.
+  /** Creates a {@link Project} of all original fields, except the given
+   * expressions. */
+  public RelBuilder projectExcept(RexNode... expressions) {
+return projectExcept(ImmutableList.copyOf(expressions));
+  }
+
+  /** Creates a {@link Project} of all original fields, except the given
+   * expressions. */
+  public RelBuilder projectExcept(Iterable expressions) {
+List allExpressions = new ArrayList<>(fields());
+for (RexNode excludeExp : expressions) {
+  if (!allExpressions.remove(excludeExp)) {
+throw RESOURCE.expressionNotFound(excludeExp.toString()).ex();
 
 Review comment:
   -1 to pass a `Set`, this would just make the interface complex, use can pass 
in any expression collections they like, what we need to do is to give the 
user-friendly validation.


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] danny0405 commented on a change in pull request #1554: [CALCITE-3462] Add method in RelBuilder for conveniently projecting out expressions

2019-12-08 Thread GitBox
danny0405 commented on a change in pull request #1554: [CALCITE-3462] Add 
method in RelBuilder for conveniently projecting out expressions
URL: https://github.com/apache/calcite/pull/1554#discussion_r355238346
 
 

 ##
 File path: core/src/main/java/org/apache/calcite/tools/RelBuilder.java
 ##
 @@ -1259,15 +1255,33 @@ public RelBuilder projectPlus(RexNode... nodes) {
 return projectPlus(ImmutableList.copyOf(nodes));
   }
 
-  /** Creates a {@link Project} of all original fields, plus the given list of
+  /** Creates a {@link Project} of all original fields, plus the given
* expressions. */
   public RelBuilder projectPlus(Iterable nodes) {
 final ImmutableList.Builder builder = ImmutableList.builder();
 return project(builder.addAll(fields()).addAll(nodes).build());
   }
 
-  /** Creates a {@link Project} of the given list
-   * of expressions, using the given names.
+  /** Creates a {@link Project} of all original fields, except the given
+   * expressions. */
+  public RelBuilder projectExcept(RexNode... expressions) {
+return projectExcept(ImmutableList.copyOf(expressions));
+  }
+
+  /** Creates a {@link Project} of all original fields, except the given
+   * expressions. */
+  public RelBuilder projectExcept(Iterable expressions) {
+List allExpressions = new ArrayList<>(fields());
+for (RexNode excludeExp : expressions) {
+  if (!allExpressions.remove(excludeExp)) {
+throw RESOURCE.expressionNotFound(excludeExp.toString()).ex();
 
 Review comment:
   -1 to pass a `Set`, this would just make the interface complex, user can 
pass in any expression collections they like, what we need to do is to give the 
user-friendly validation.


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


svn commit: r37139 - /dev/calcite/apache-calcite-avatica-1.16.0-rc0/

2019-12-08 Thread francischuang
Author: francischuang
Date: Sun Dec  8 22:07:16 2019
New Revision: 37139

Log:
Uploading release candidate Apache Calcite Avatica avatica-1.16.0-rc0 to dev 
area

Added:
dev/calcite/apache-calcite-avatica-1.16.0-rc0/

dev/calcite/apache-calcite-avatica-1.16.0-rc0/apache-calcite-avatica-1.16.0-src.tar.gz

dev/calcite/apache-calcite-avatica-1.16.0-rc0/apache-calcite-avatica-1.16.0-src.tar.gz.asc

dev/calcite/apache-calcite-avatica-1.16.0-rc0/apache-calcite-avatica-1.16.0-src.tar.gz.sha512

dev/calcite/apache-calcite-avatica-1.16.0-rc0/apache-calcite-avatica-1.16.0-src.zip

dev/calcite/apache-calcite-avatica-1.16.0-rc0/apache-calcite-avatica-1.16.0-src.zip.asc

dev/calcite/apache-calcite-avatica-1.16.0-rc0/apache-calcite-avatica-1.16.0-src.zip.sha512

Added: 
dev/calcite/apache-calcite-avatica-1.16.0-rc0/apache-calcite-avatica-1.16.0-src.tar.gz
==
Binary files 
dev/calcite/apache-calcite-avatica-1.16.0-rc0/apache-calcite-avatica-1.16.0-src.tar.gz
 (added) and 
dev/calcite/apache-calcite-avatica-1.16.0-rc0/apache-calcite-avatica-1.16.0-src.tar.gz
 Sun Dec  8 22:07:16 2019 differ

Added: 
dev/calcite/apache-calcite-avatica-1.16.0-rc0/apache-calcite-avatica-1.16.0-src.tar.gz.asc
==
--- 
dev/calcite/apache-calcite-avatica-1.16.0-rc0/apache-calcite-avatica-1.16.0-src.tar.gz.asc
 (added)
+++ 
dev/calcite/apache-calcite-avatica-1.16.0-rc0/apache-calcite-avatica-1.16.0-src.tar.gz.asc
 Sun Dec  8 22:07:16 2019
@@ -0,0 +1,17 @@
+-BEGIN PGP SIGNATURE-
+Version: BCPG v1.63
+
+iQIzBAABCgAdFiEEY1Zl4L4/clUpEMt0u+ROkjqXCrcFAl3tc/oACgkQu+ROkjqX
+Cre0fRAArWzQQc85iLvHCgZ7hGEqwXNsJU7JUSRRUe40JXqfF2lnXCv/YleFf/tv
+VkyzsXrdZhwzmuJSpQXExU5f8yD2ssiTHbHhgFfS72ls8LGBME63lO3GJozxpxuN
+zy6LavvE9ypD0gJmpmtjZ4Gt89ywwg/TU2ANETTi9tFp5OhlZR1cx5COvBMTEIdz
+HwpVIgy/HkWNNBW+0F2yw586MhkPAn1xWlOTCgLXs3uTwtsVKog3ITO8MtKuQFW0
+voWxyH1GNgUkv16JrMxvm+2G+PZR+6rvfFyN9E/gFAkPSxy+/ojxJ3sppyEU5OEe
+12HvbRYv2r5XNFF7Dza2IUvANpoP059x7N6O18sjGbklBuIbopF8yPfL96SImwvc
+zAoRdLmu6mkipPCH3tsgbM320rHybn8TiUAKIg+mb9eGU5JkzcUAuC3d4xJdTswD
+m8YAfpGfW+RvHGtfwcKcpY/Kc11QQPp3//RxgP8ePGLe8EZyHyjJYAse/KBr6OVn
+JSDhF2rjaLtGEjMEqblLZ6IDuw0RJY3kxrdAPoSGenZY9As0Q/vCFKVsJJ2ezAlh
+KU8E7WhYwLn/osbegiBmyvOmfm2yRUuqb6vCIH/9jXQhsvZSg/PKJd35/mtDgl93
+mipmayz7sSO4yPG1o74HZ+u94puQOHi6dVLUr0apj6kcw4zinfo=
+=WkTX
+-END PGP SIGNATURE-

Added: 
dev/calcite/apache-calcite-avatica-1.16.0-rc0/apache-calcite-avatica-1.16.0-src.tar.gz.sha512
==
--- 
dev/calcite/apache-calcite-avatica-1.16.0-rc0/apache-calcite-avatica-1.16.0-src.tar.gz.sha512
 (added)
+++ 
dev/calcite/apache-calcite-avatica-1.16.0-rc0/apache-calcite-avatica-1.16.0-src.tar.gz.sha512
 Sun Dec  8 22:07:16 2019
@@ -0,0 +1 @@
+b54066d3b67e1f47d8f3af74466155350bfa92e938f0f442383efd8abb49993c8aee3aca258a9cc2ebb347a6b2f9473c05221da52dd56971478e7989952a7393
 *apache-calcite-avatica-1.16.0-src.tar.gz

Added: 
dev/calcite/apache-calcite-avatica-1.16.0-rc0/apache-calcite-avatica-1.16.0-src.zip
==
Binary files 
dev/calcite/apache-calcite-avatica-1.16.0-rc0/apache-calcite-avatica-1.16.0-src.zip
 (added) and 
dev/calcite/apache-calcite-avatica-1.16.0-rc0/apache-calcite-avatica-1.16.0-src.zip
 Sun Dec  8 22:07:16 2019 differ

Added: 
dev/calcite/apache-calcite-avatica-1.16.0-rc0/apache-calcite-avatica-1.16.0-src.zip.asc
==
--- 
dev/calcite/apache-calcite-avatica-1.16.0-rc0/apache-calcite-avatica-1.16.0-src.zip.asc
 (added)
+++ 
dev/calcite/apache-calcite-avatica-1.16.0-rc0/apache-calcite-avatica-1.16.0-src.zip.asc
 Sun Dec  8 22:07:16 2019
@@ -0,0 +1,17 @@
+-BEGIN PGP SIGNATURE-
+Version: BCPG v1.63
+
+iQIzBAABCgAdFiEEY1Zl4L4/clUpEMt0u+ROkjqXCrcFAl3tc/oACgkQu+ROkjqX
+Crc5CA/+Ko2nEW3OPl0ufFNiYkUHZGFsCza2jJ/Khb447YOgNeoH/d5gDAUiSSwR
+7xlgSoELcsWbnROt80KPmBkCsW7Xl3ea88CF7iPJ8HVQe95q/52GTNn8nJRFKZkc
+amywJaIRNpzDJp17GPrNl4o4bJOIN/vwRUQEq7tJLZ4N/5+z3zFbdbXJzCKfkJkc
+1KyMhmp+SamuFb+hVg+cCH4bmI/9hIfOzOwz1Ea3wMw/KFUuajQ8hAKEfJ2uMiym
+8hElZK9fAmI0qZVR7BBUmuYhaLgyEeSnGVYhQonstikDHQRjXmAcuqy8mBzjyVLh
+PgCiK5Ytwi2utC7KKN3WVY4fpN145B9Hg4RHMb+bajWNYSL6huJpyLxPVm4T9waD
+aE6Z1flwoIr/HIJYochVSWBlg2xzQj/jLfSMPPvZYmMPb142u2e6zU+1Gl5jeY6i
+kwtscmVtZ5jawXFchsSLR2KxJIna9lUuhkEXGVe9H8RkuFL69025iRhkcRCcAQBT
+PnOH2+GlLyQCilY1N3IZQYbYFpIHkFA3nOnfOVGjCComPljAyAbGwYqd+CZ04eSe
+XyZcOmzx4TDBGIkqWMPXco+dpw039WY8D8BC2BqC4qpI3e5xZBlAo/vIR3m+wcvM
+ALrtBl/YUkU6miMonMImSMN74cfDIv3NXAWMK2rkeQJTgVNgGK0=
+=mHSX
+-END PGP SIGNATURE-

Added: 
dev/calcite/apache-calcite-avatica-1.16.0-rc0/apache-calcite-avatica-1.16.0-src.zip.sha512
==
--- 

[calcite-avatica] annotated tag avatica-1.16.0-rc0 created (now a9d6f6c)

2019-12-08 Thread francischuang
This is an automated email from the ASF dual-hosted git repository.

francischuang pushed a change to annotated tag avatica-1.16.0-rc0
in repository https://gitbox.apache.org/repos/asf/calcite-avatica.git.


  at a9d6f6c  (tag)
 tagging 204d58849ecdf2ef639308edba74f416311f7d88 (commit)
 replaces avatica-1.15.0-rc0
  by Francis Chuang
  on Sun Dec 8 22:06:53 2019 +

- Log -
---

No new revisions were added by this update.



[calcite-avatica] 02/02: Update documentation and history for 1.16.0

2019-12-08 Thread francischuang
This is an automated email from the ASF dual-hosted git repository.

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

commit 204d58849ecdf2ef639308edba74f416311f7d88
Author: Francis Chuang 
AuthorDate: Mon Dec 9 08:56:03 2019 +1100

Update documentation and history for 1.16.0
---
 README  |  2 +-
 site/_docs/docker_images.md | 28 
 site/_docs/history.md   | 79 +
 site/_docs/howto.md |  4 +--
 4 files changed, 96 insertions(+), 17 deletions(-)

diff --git a/README b/README
index ec2fc88..87cca50 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-Apache Calcite Avatica release 1.15.0
+Apache Calcite Avatica release 1.16.0
 
 This is a source or binary distribution of Avatica, a framework for
 building database drivers. Avatica is a sub-project of Apache Calcite.
diff --git a/site/_docs/docker_images.md b/site/_docs/docker_images.md
index cf21a3b..a20c168 100644
--- a/site/_docs/docker_images.md
+++ b/site/_docs/docker_images.md
@@ -70,22 +70,22 @@ file will start an instance of PostgreSQL and an instance 
of the Avatica server,
 exposing an Avatica server configured against a "real" PostgreSQL database.
 
 All of the `Dockerfile` and `docker-compose.yml` files are conveniently 
provided in an archive for
-each release. Here is the layout for release 1.15.0:
+each release. Here is the layout for release 1.16.0:
 
 ```
-avatica-docker-1.15.0/
-avatica-docker-1.15.0/hypersql/
-avatica-docker-1.15.0/mysql/
-avatica-docker-1.15.0/postgresql/
-avatica-docker-1.15.0/Dockerfile
-avatica-docker-1.15.0/hypersql/build.sh
-avatica-docker-1.15.0/hypersql/Dockerfile
-avatica-docker-1.15.0/mysql/build.sh
-avatica-docker-1.15.0/mysql/docker-compose.yml
-avatica-docker-1.15.0/mysql/Dockerfile
-avatica-docker-1.15.0/postgresql/build.sh
-avatica-docker-1.15.0/postgresql/docker-compose.yml
-avatica-docker-1.15.0/postgresql/Dockerfile
+avatica-docker-1.16.0/
+avatica-docker-1.16.0/hypersql/
+avatica-docker-1.16.0/mysql/
+avatica-docker-1.16.0/postgresql/
+avatica-docker-1.16.0/Dockerfile
+avatica-docker-1.16.0/hypersql/build.sh
+avatica-docker-1.16.0/hypersql/Dockerfile
+avatica-docker-1.16.0/mysql/build.sh
+avatica-docker-1.16.0/mysql/docker-compose.yml
+avatica-docker-1.16.0/mysql/Dockerfile
+avatica-docker-1.16.0/postgresql/build.sh
+avatica-docker-1.16.0/postgresql/docker-compose.yml
+avatica-docker-1.16.0/postgresql/Dockerfile
 ```
 
  Running
diff --git a/site/_docs/history.md b/site/_docs/history.md
index 19e1150..e05cc58 100644
--- a/site/_docs/history.md
+++ b/site/_docs/history.md
@@ -28,6 +28,85 @@ For a full list of releases, see
 Downloads are available on the
 [downloads page]({{ site.baseurl }}/downloads/avatica.html).
 
+## https://github.com/apache/calcite-avatica/releases/tag/rel/avatica-1.16.0;>1.16.0
 / 2019-12-XX
+{: #v1-16-0}
+
+Apache Calcite Avatica 1.16.0 replaces the maven with gradle. This release 
adds support for Kerberos authentication
+using SPNEGO over HTTPS. In addition, there were also a few dependency updates 
and bug fixes. Github Actions was also
+enabled in the repository for running tests.
+
+Compatibility: This release is tested
+on Linux, macOS, Microsoft Windows;
+using Oracle JDK 8, 9, 10, 11, 12, 13;
+using IBM Java 8;
+Guava versions 14.0 to 23.0;
+other software versions as specified in `gradle.properties`.
+
+Features and bug fixes
+
+* [https://issues.apache.org/jira/browse/CALCITE-3059;>CALCITE-3059]
+  Fix release script to use correct release branch name when merging to master 
and to use the correct variable when generating the vote email
+* [https://issues.apache.org/jira/browse/CALCITE-3090;>CALCITE-3090]
+  Remove the Central configuration
+* Update owsap-dependency-check from 4.0.2 to 5.0.0
+* [https://issues.apache.org/jira/browse/CALCITE-3104;>CALCITE-3104]
+  Bump httpcore from 4.4.10 to 4.4.11 (Fokko Driesprong)
+* [https://issues.apache.org/jira/browse/CALCITE-3105;>CALCITE-3105]
+  Bump Jackson from 2.9.8 to 2.9.9 (Fokko Driesprong)
+* [https://issues.apache.org/jira/browse/CALCITE-3180;>CALCITE-3180]
+  Bump httpclient from 4.5.6 to 4.5.9 (Fokko Driesprong)
+* [https://issues.apache.org/jira/browse/CALCITE-3324;>CALCITE-3324]
+  Add create method in MetaResultSet (Robert Yokota)
+* [https://issues.apache.org/jira/browse/CALCITE-3384;>CALCITE-3384]
+  Support Kerberos-authentication using SPNEGO over HTTPS (Istvan Toth)
+* [https://issues.apache.org/jira/browse/CALCITE-3199;>CALCITE-3199]
+  DateTimeUtils.unixDateCeil should not return the same value as unixDateFloor 
(Zhenghua Gao)
+* [https://issues.apache.org/jira/browse/CALCITE-3412;>CALCITE-3412]
+  FLOOR(timestamp TO WEEK) gives wrong result: Fix 
DateTimeUtils.julianDateFloor so that unixDateFloor etc. give the right result
+* Implement Gradle-based build scripts
+* Sign release artifacts only, skip signing for -SNAPSHOT
+* Add source=1.8 to 

[calcite-avatica] branch master updated (6ff9911 -> 204d588)

2019-12-08 Thread francischuang
This is an automated email from the ASF dual-hosted git repository.

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


 discard 6ff9911  Configure Git tags to be pushed to calcite-avatica repository 
not calcite
 discard f330e7e  Update documentation and history for 1.16.0
 new 6755f4c  Configure Git tags to be pushed to calcite-avatica repository 
not calcite
 new 204d588  Update documentation and history for 1.16.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   (6ff9911)
\
 N -- N -- N   refs/heads/master (204d588)

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 2 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/_docs/history.md | 1 +
 1 file changed, 1 insertion(+)



[calcite-avatica] 01/02: Configure Git tags to be pushed to calcite-avatica repository not calcite

2019-12-08 Thread francischuang
This is an automated email from the ASF dual-hosted git repository.

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

commit 6755f4c1a108b80905ecace5da67514c66a03812
Author: Vladimir Sitnikov 
AuthorDate: Sat Dec 7 22:38:21 2019 +0300

Configure Git tags to be pushed to calcite-avatica repository not calcite
---
 build.gradle.kts  | 1 +
 gradle.properties | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/build.gradle.kts b/build.gradle.kts
index 3953296..deb8857 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -110,6 +110,7 @@ releaseArtifacts {
 // Configures URLs to SVN and Nexus
 releaseParams {
 tlp.set("Calcite")
+gitRepoName.set("calcite-avatica")
 componentName.set("Apache Calcite Avatica")
 releaseTag.set("rel/avatica-$buildVersion")
 rcTag.set(rc.map { "avatica-$buildVersion-rc$it" })
diff --git a/gradle.properties b/gradle.properties
index de2b840..bdf9f32 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -35,7 +35,7 @@ calcite.avatica.version=1.16.0
 com.diffplug.gradle.spotless.version=3.25.0
 com.github.johnrengelman.shadow.version=5.1.0
 com.github.spotbugs.version=2.0.0
-com.github.vlsi.vlsi-release-plugins.version=1.48.0
+com.github.vlsi.vlsi-release-plugins.version=1.50
 com.google.protobuf.version=0.8.10
 de.thetaphi.forbiddenapis.version=2.7
 org.jetbrains.gradle.plugin.idea-ext.version=0.5



[GitHub] [calcite] jinxing64 commented on a change in pull request #1554: [CALCITE-3462] Add method in RelBuilder for conveniently projecting out expressions

2019-12-08 Thread GitBox
jinxing64 commented on a change in pull request #1554: [CALCITE-3462] Add 
method in RelBuilder for conveniently projecting out expressions
URL: https://github.com/apache/calcite/pull/1554#discussion_r355182882
 
 

 ##
 File path: core/src/main/java/org/apache/calcite/tools/RelBuilder.java
 ##
 @@ -1259,15 +1255,31 @@ public RelBuilder projectPlus(RexNode... nodes) {
 return projectPlus(ImmutableList.copyOf(nodes));
   }
 
-  /** Creates a {@link Project} of all original fields, plus the given list of
+  /** Creates a {@link Project} of all original fields, plus the given
* expressions. */
   public RelBuilder projectPlus(Iterable nodes) {
 final ImmutableList.Builder builder = ImmutableList.builder();
 return project(builder.addAll(fields()).addAll(nodes).build());
   }
 
-  /** Creates a {@link Project} of the given list
-   * of expressions, using the given names.
+  /** Creates a {@link Project} of all original fields, minus the given
+   * expressions. */
+  public RelBuilder projectMinus(RexNode... expressions) {
+return projectMinus(ImmutableList.copyOf(expressions));
+  }
+
+  /** Creates a {@link Project} of all original fields, minus the given
+   * expressions. */
+  public RelBuilder projectMinus(Iterable expressions) {
+List allExpressions = new ArrayList<>(fields());
 
 Review comment:
   I'm referring to `RESOURCE.expressionNotFound(excludeExp.toString())`. 
   Yes we need at least one when duplicates


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] jinxing64 commented on a change in pull request #1554: [CALCITE-3462] Add method in RelBuilder for conveniently projecting out expressions

2019-12-08 Thread GitBox
jinxing64 commented on a change in pull request #1554: [CALCITE-3462] Add 
method in RelBuilder for conveniently projecting out expressions
URL: https://github.com/apache/calcite/pull/1554#discussion_r355182819
 
 

 ##
 File path: core/src/main/java/org/apache/calcite/tools/RelBuilder.java
 ##
 @@ -1259,15 +1255,33 @@ public RelBuilder projectPlus(RexNode... nodes) {
 return projectPlus(ImmutableList.copyOf(nodes));
   }
 
-  /** Creates a {@link Project} of all original fields, plus the given list of
+  /** Creates a {@link Project} of all original fields, plus the given
* expressions. */
   public RelBuilder projectPlus(Iterable nodes) {
 final ImmutableList.Builder builder = ImmutableList.builder();
 return project(builder.addAll(fields()).addAll(nodes).build());
   }
 
-  /** Creates a {@link Project} of the given list
-   * of expressions, using the given names.
+  /** Creates a {@link Project} of all original fields, except the given
+   * expressions. */
+  public RelBuilder projectExcept(RexNode... expressions) {
+return projectExcept(ImmutableList.copyOf(expressions));
+  }
+
+  /** Creates a {@link Project} of all original fields, except the given
+   * expressions. */
+  public RelBuilder projectExcept(Iterable expressions) {
+List allExpressions = new ArrayList<>(fields());
+for (RexNode excludeExp : expressions) {
+  if (!allExpressions.remove(excludeExp)) {
+throw RESOURCE.expressionNotFound(excludeExp.toString()).ex();
 
 Review comment:
   +1 to pass a `Set`


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] zabetak closed pull request #1638: [CALCITE-3540] FoodmartTest produces many warnings due to incorrect use of CalciteAssert.pooled()

2019-12-08 Thread GitBox
zabetak closed pull request #1638: [CALCITE-3540] FoodmartTest produces many 
warnings due to incorrect use of CalciteAssert.pooled()
URL: https://github.com/apache/calcite/pull/1638
 
 
   


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 (d934d12 -> 4f70978)

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

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


from d934d12  [CALCITE-3565] Explicitly cast assignable operand types to 
decimal for udf (DonnyZone)
 add 4f70978  [CALCITE-3540] FoodmartTest produces many warnings due to 
incorrect use of CalciteAssert.pooled()

No new revisions were added by this update.

Summary of changes:
 .../org/apache/calcite/test/FoodMartQuerySet.java  |  4 +++
 .../java/org/apache/calcite/test/FoodmartTest.java | 35 +++---
 2 files changed, 29 insertions(+), 10 deletions(-)



[GitHub] [calcite] zabetak commented on a change in pull request #1554: [CALCITE-3462] Add method in RelBuilder for conveniently projecting out expressions

2019-12-08 Thread GitBox
zabetak commented on a change in pull request #1554: [CALCITE-3462] Add method 
in RelBuilder for conveniently projecting out expressions
URL: https://github.com/apache/calcite/pull/1554#discussion_r355169117
 
 

 ##
 File path: core/src/main/java/org/apache/calcite/tools/RelBuilder.java
 ##
 @@ -1259,15 +1255,33 @@ public RelBuilder projectPlus(RexNode... nodes) {
 return projectPlus(ImmutableList.copyOf(nodes));
   }
 
-  /** Creates a {@link Project} of all original fields, plus the given list of
+  /** Creates a {@link Project} of all original fields, plus the given
* expressions. */
   public RelBuilder projectPlus(Iterable nodes) {
 final ImmutableList.Builder builder = ImmutableList.builder();
 return project(builder.addAll(fields()).addAll(nodes).build());
   }
 
-  /** Creates a {@link Project} of the given list
-   * of expressions, using the given names.
+  /** Creates a {@link Project} of all original fields, except the given
+   * expressions. */
+  public RelBuilder projectExcept(RexNode... expressions) {
+return projectExcept(ImmutableList.copyOf(expressions));
+  }
+
+  /** Creates a {@link Project} of all original fields, except the given
+   * expressions. */
+  public RelBuilder projectExcept(Iterable expressions) {
+List allExpressions = new ArrayList<>(fields());
+for (RexNode excludeExp : expressions) {
+  if (!allExpressions.remove(excludeExp)) {
+throw RESOURCE.expressionNotFound(excludeExp.toString()).ex();
 
 Review comment:
   We can avoid the `redundant expression` exception by forcing the caller to 
pass a `Set` instead of an `Iterable`. If we are so concerned about duplicates 
then maybe this is a good alternative. Otherwise I can make the check and throw 
a new exception I have no strong preference over the two options so let me know 
what you prefer. 


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 #1406: [CALCITE-3243] Incomplete validation of operands in JSON functions

2019-12-08 Thread GitBox
zhztheplayer commented on a change in pull request #1406: [CALCITE-3243] 
Incomplete validation of operands in JSON functions
URL: https://github.com/apache/calcite/pull/1406#discussion_r355168982
 
 

 ##
 File path: 
core/src/main/java/org/apache/calcite/sql/fun/SqlJsonExistsFunction.java
 ##
 @@ -34,14 +34,15 @@ public SqlJsonExistsFunction() {
 super("JSON_EXISTS", SqlKind.OTHER_FUNCTION,
 ReturnTypes.cascade(ReturnTypes.BOOLEAN, 
SqlTypeTransforms.FORCE_NULLABLE), null,
 OperandTypes.or(
-OperandTypes.family(SqlTypeFamily.ANY, SqlTypeFamily.CHARACTER),
 
 Review comment:
   Right. In our code base JSON functions usually accepts both character string 
and JSON inputs. We don't have a individual data type for JSON so we use `ANY` 
instead. See a ticket of JSON data type support:
   
   https://issues.apache.org/jira/browse/CALCITE-2869


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] zabetak commented on a change in pull request #1554: [CALCITE-3462] Add method in RelBuilder for conveniently projecting out expressions

2019-12-08 Thread GitBox
zabetak commented on a change in pull request #1554: [CALCITE-3462] Add method 
in RelBuilder for conveniently projecting out expressions
URL: https://github.com/apache/calcite/pull/1554#discussion_r355168637
 
 

 ##
 File path: core/src/main/java/org/apache/calcite/tools/RelBuilder.java
 ##
 @@ -1259,15 +1255,31 @@ public RelBuilder projectPlus(RexNode... nodes) {
 return projectPlus(ImmutableList.copyOf(nodes));
   }
 
-  /** Creates a {@link Project} of all original fields, plus the given list of
+  /** Creates a {@link Project} of all original fields, plus the given
* expressions. */
   public RelBuilder projectPlus(Iterable nodes) {
 final ImmutableList.Builder builder = ImmutableList.builder();
 return project(builder.addAll(fields()).addAll(nodes).build());
   }
 
-  /** Creates a {@link Project} of the given list
-   * of expressions, using the given names.
+  /** Creates a {@link Project} of all original fields, minus the given
+   * expressions. */
+  public RelBuilder projectMinus(RexNode... expressions) {
+return projectMinus(ImmutableList.copyOf(expressions));
+  }
+
+  /** Creates a {@link Project} of all original fields, minus the given
+   * expressions. */
+  public RelBuilder projectMinus(Iterable expressions) {
+List allExpressions = new ArrayList<>(fields());
 
 Review comment:
   In which exception are you referring to? Aren't we gonna need at least one?


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] zabetak commented on a change in pull request #1554: [CALCITE-3462] Add method in RelBuilder for conveniently projecting out expressions

2019-12-08 Thread GitBox
zabetak commented on a change in pull request #1554: [CALCITE-3462] Add method 
in RelBuilder for conveniently projecting out expressions
URL: https://github.com/apache/calcite/pull/1554#discussion_r355168485
 
 

 ##
 File path: core/src/main/java/org/apache/calcite/tools/RelBuilder.java
 ##
 @@ -1189,8 +1187,8 @@ public RelBuilder filter(Iterable 
predicates) {
 return filter(ImmutableSet.of(), predicates);
   }
 
-  /** Creates a {@link Filter} of a list of correlation variables
-   * and an array of predicates.
+  /** Creates a {@link Filter} with the specified correlation variables
+   * and predicates.
 
 Review comment:
   I would say yes for the two reasons below:
   1. `a list of` implies a specific implementation (List) but the method can 
accept many more since it takes an Iterable.
   2. `specified argument` is used extensively in the doc of JDK. 
   Bu still if you believe that it was better before I can rollback the 
changes, I don't mind.


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] zabetak commented on a change in pull request #1554: [CALCITE-3462] Add method in RelBuilder for conveniently projecting out expressions

2019-12-08 Thread GitBox
zabetak commented on a change in pull request #1554: [CALCITE-3462] Add method 
in RelBuilder for conveniently projecting out expressions
URL: https://github.com/apache/calcite/pull/1554#discussion_r355168485
 
 

 ##
 File path: core/src/main/java/org/apache/calcite/tools/RelBuilder.java
 ##
 @@ -1189,8 +1187,8 @@ public RelBuilder filter(Iterable 
predicates) {
 return filter(ImmutableSet.of(), predicates);
   }
 
-  /** Creates a {@link Filter} of a list of correlation variables
-   * and an array of predicates.
+  /** Creates a {@link Filter} with the specified correlation variables
+   * and predicates.
 
 Review comment:
   I would say yes for the two reasons below:
   1. - `a list of` implies a specific implementation (List) but the method can 
accept many more since it takes an Iterable.
   2. - `specified argument` is used extensively in the doc of JDK. 
   Bu still if you believe that it was better before I can rollback the 
changes, I don't mind.


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