Skip to content

Commit

Permalink
[CALCITE-1381] SqlCall.clone should retain function quantifier (zheng…
Browse files Browse the repository at this point in the history
…dong)
  • Loading branch information
zhengd authored and julianhyde committed Sep 27, 2016
1 parent d2b6ffb commit 8d9a5d2
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 18 deletions.
24 changes: 12 additions & 12 deletions avatica/site/_includes/docs_ul.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
8 changes: 4 additions & 4 deletions avatica/site/_includes/news_contents.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ <h4>Recent Releases</h4>
</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>
5 changes: 5 additions & 0 deletions core/src/main/java/org/apache/calcite/sql/SqlBasicCall.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ public List<SqlNode> getOperandList() {
@Override public SqlLiteral getFunctionQuantifier() {
return functionQuantifier;
}

@Override public SqlNode clone(SqlParserPos pos) {
return getOperator().createCall(getFunctionQuantifier(), pos, operands);
}

}

// End SqlBasicCall.java
6 changes: 4 additions & 2 deletions core/src/main/java/org/apache/calcite/sql/SqlCall.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,10 @@ public int operandCount() {
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(
Expand Down
18 changes: 18 additions & 0 deletions core/src/test/resources/sql/agg.iq
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 8d9a5d2

Please sign in to comment.