You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by jh...@apache.org on 2016/09/27 20:05:47 UTC

[3/3] calcite git commit: [CALCITE-1381] SqlCall.clone should retain function quantifier (zhengdong)

[CALCITE-1381] SqlCall.clone should retain function quantifier (zhengdong)


Project: http://git-wip-us.apache.org/repos/asf/calcite/repo
Commit: http://git-wip-us.apache.org/repos/asf/calcite/commit/8d9a5d24
Tree: http://git-wip-us.apache.org/repos/asf/calcite/tree/8d9a5d24
Diff: http://git-wip-us.apache.org/repos/asf/calcite/diff/8d9a5d24

Branch: refs/heads/master
Commit: 8d9a5d241e489657845e0e5ba59c96a024386117
Parents: d2b6ffb
Author: zhengdong <zh...@outlook.com>
Authored: Mon Sep 26 13:28:50 2016 -0700
Committer: Julian Hyde <jh...@apache.org>
Committed: Tue Sep 27 13:04:34 2016 -0700

----------------------------------------------------------------------
 avatica/site/_includes/docs_ul.html             | 24 ++++++++++----------
 avatica/site/_includes/news_contents.html       |  8 +++----
 .../org/apache/calcite/sql/SqlBasicCall.java    |  5 ++++
 .../java/org/apache/calcite/sql/SqlCall.java    |  6 +++--
 core/src/test/resources/sql/agg.iq              | 18 +++++++++++++++
 5 files changed, 43 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/calcite/blob/8d9a5d24/avatica/site/_includes/docs_ul.html
----------------------------------------------------------------------
diff --git a/avatica/site/_includes/docs_ul.html b/avatica/site/_includes/docs_ul.html
index 8181e74..1010531 100644
--- a/avatica/site/_includes/docs_ul.html
+++ b/avatica/site/_includes/docs_ul.html
@@ -13,18 +13,18 @@
     {% assign c = "" %}
   {% endif %}
 
-  {% for p in site.docs %}
-    {% capture p_url %}{{site.baseurl}}{{p.url}}{% endcapture %}
-    {% if p.sidebar_title != nil %}
-      {% assign anchor_text = p.sidebar_title %}
-    {% else %}
-      {% assign anchor_text = p.title %}
-    {% endif %}
-    {% if p_url == item_url or p_url == item_url2 %}
-      <li class="{{ c }}"><a href="{{ p_url }}">{{ anchor_text }}</a></li>
-      {% break %}
-    {% endif %}
-  {% endfor %}
+  {% for p in site.docs %}{% comment %}
+    {% endcomment %}{% capture p_url %}{{site.baseurl}}{{p.url}}{% endcapture %}{% comment %}
+    {% endcomment %}{% if p.sidebar_title != nil %}{% comment %}
+      {% endcomment %}{% assign anchor_text = p.sidebar_title %}{% comment %}
+    {% endcomment %}{% else %}{% comment %}
+      {% endcomment %}{% assign anchor_text = p.title %}{% comment %}
+    {% endcomment %}{% endif %}{% comment %}
+    {% endcomment %}{% if p_url == item_url or p_url == item_url2 %}{% comment %}
+      {% endcomment %}<li class="{{ c }}"><a href="{{ p_url }}">{{ anchor_text }}</a></li>{% comment %}
+      {% endcomment %}{% break %}{% comment %}
+    {% endcomment %}{% endif %}{% comment %}
+  {% endcomment %}{% endfor %}
 
 {% endfor %}
 </ul>

http://git-wip-us.apache.org/repos/asf/calcite/blob/8d9a5d24/avatica/site/_includes/news_contents.html
----------------------------------------------------------------------
diff --git a/avatica/site/_includes/news_contents.html b/avatica/site/_includes/news_contents.html
index 09176b8..ad6b7a4 100644
--- a/avatica/site/_includes/news_contents.html
+++ b/avatica/site/_includes/news_contents.html
@@ -18,13 +18,13 @@
     </ul>
     <h4>Other News</h4>
     <ul>
-        {% for post in site.posts %}
-        {% unless post.categories contains 'release' %}
+        {% for post in site.posts %}{% comment %}
+          {% endcomment %}{% unless post.categories contains 'release' %}
         <li class="{% if page.title == post.title %}current{% endif %}">
           <a href="{{ site.baseurl }}{{ post.url }}">{{ post.title }}</a>
         </li>
-        {% endunless %}
-        {% endfor %}
+          {% endunless %}{% comment %}
+        {% endcomment %}{% endfor %}
     </ul>
   </aside>
 </div>

http://git-wip-us.apache.org/repos/asf/calcite/blob/8d9a5d24/core/src/main/java/org/apache/calcite/sql/SqlBasicCall.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/SqlBasicCall.java b/core/src/main/java/org/apache/calcite/sql/SqlBasicCall.java
old mode 100644
new mode 100755
index 2e5bf00..5e303e5
--- a/core/src/main/java/org/apache/calcite/sql/SqlBasicCall.java
+++ b/core/src/main/java/org/apache/calcite/sql/SqlBasicCall.java
@@ -90,6 +90,11 @@ public class SqlBasicCall extends SqlCall {
   @Override public SqlLiteral getFunctionQuantifier() {
     return functionQuantifier;
   }
+
+  @Override public SqlNode clone(SqlParserPos pos) {
+    return getOperator().createCall(getFunctionQuantifier(), pos, operands);
+  }
+
 }
 
 // End SqlBasicCall.java

http://git-wip-us.apache.org/repos/asf/calcite/blob/8d9a5d24/core/src/main/java/org/apache/calcite/sql/SqlCall.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/SqlCall.java b/core/src/main/java/org/apache/calcite/sql/SqlCall.java
old mode 100644
new mode 100755
index 542420c..18a2160
--- a/core/src/main/java/org/apache/calcite/sql/SqlCall.java
+++ b/core/src/main/java/org/apache/calcite/sql/SqlCall.java
@@ -81,8 +81,10 @@ public abstract class SqlCall extends SqlNode {
     return getOperandList().size();
   }
 
-  public SqlNode clone(SqlParserPos pos) {
-    return getOperator().createCall(pos, getOperandList());
+  @Override public SqlNode clone(SqlParserPos pos) {
+    final List<SqlNode> operandList = getOperandList();
+    return getOperator().createCall(getFunctionQuantifier(), pos,
+        operandList.toArray(new SqlNode[operandList.size()]));
   }
 
   public void unparse(

http://git-wip-us.apache.org/repos/asf/calcite/blob/8d9a5d24/core/src/test/resources/sql/agg.iq
----------------------------------------------------------------------
diff --git a/core/src/test/resources/sql/agg.iq b/core/src/test/resources/sql/agg.iq
old mode 100644
new mode 100755
index 9390b02..ec08dcb
--- a/core/src/test/resources/sql/agg.iq
+++ b/core/src/test/resources/sql/agg.iq
@@ -1619,4 +1619,22 @@ group by grouping sets(CURRENT_USER);
 
 !ok
 
+# [CALCITE-1381] SqlCall.clone should retain function quantifier
+select nullif(count(distinct '1'),0)
+from (values (1,2),(3,4));
++--------+
+| EXPR$0 |
++--------+
+|      1 |
++--------+
+(1 row)
+
+!ok
+EnumerableCalc(expr#0=[{inputs}], expr#1=[0], expr#2=[=($t0, $t1)], expr#3=[null], expr#4=[CAST($t0):BIGINT], expr#5=[CASE($t2, $t3, $t4)], EXPR$0=[$t5])
+  EnumerableAggregate(group=[{}], agg#0=[COUNT($0)])
+    EnumerableAggregate(group=[{0}])
+      EnumerableCalc(expr#0..1=[{inputs}], expr#2=['1'], $f0=[$t2])
+        EnumerableValues(tuples=[[{ 1, 2 }, { 3, 4 }]])
+!plan
+
 # End agg.iq