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 2015/06/05 19:04:45 UTC

[1/6] incubator-calcite git commit: For web site files, add license headers where possible, apache-rat exclusions otherwise

Repository: incubator-calcite
Updated Branches:
  refs/heads/master 83707f720 -> ec9d96604


For web site files, add license headers where possible, apache-rat exclusions otherwise


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

Branch: refs/heads/master
Commit: a45d542380d376b538dd0ffc456a2223326fcfab
Parents: 83707f7
Author: Julian Hyde <jh...@apache.org>
Authored: Wed Jun 3 14:47:24 2015 -0700
Committer: Julian Hyde <jh...@apache.org>
Committed: Wed Jun 3 17:39:11 2015 -0700

----------------------------------------------------------------------
 NOTICE                                          |  4 ++-
 README.md                                       |  4 +--
 pom.xml                                         | 37 ++++++++++++++++++++
 site/Gemfile                                    | 18 +++++++++-
 site/README.md                                  | 17 +++++++++
 site/_config.yml                                | 16 +++++++++
 site/_data/contributors.yml                     | 19 ++++++++++
 site/_data/docs.yml                             | 18 ++++++++++
 site/_docs/adapter.md                           | 16 ++++++++-
 site/_docs/algebra.md                           | 16 +++++++++
 site/_docs/index.md                             | 16 +++++++++
 site/_includes/news_item.html                   | 16 +++++++++
 .../2014-06-27-release-0.8.0-incubating.md      | 16 +++++++++
 .../2014-08-19-release-0.9.0-incubating.md      | 16 +++++++++
 .../2014-10-02-release-0.9.1-incubating.md      | 16 +++++++++
 .../2014-11-05-release-0.9.2-incubating.md      | 16 +++++++++
 .../2015-01-31-release-1.0.0-incubating.md      | 16 +++++++++
 .../2015-03-13-release-1.1.0-incubating.md      | 16 +++++++++
 .../2015-04-07-release-1.2.0-incubating.md      | 16 +++++++++
 site/_posts/2015-04-24-new-committers.md        | 16 +++++++++
 .../2015-05-30-release-1.3.0-incubating.md      | 16 +++++++++
 site/develop/index.md                           | 16 +++++++++
 site/help/index.md                              | 16 +++++++++
 site/index.html                                 | 16 +++++++++
 site/news/index.html                            | 18 +++++++++-
 site/news/releases/index.html                   | 16 +++++++++
 site/talks/index.md                             | 16 +++++++++
 27 files changed, 433 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a45d5423/NOTICE
----------------------------------------------------------------------
diff --git a/NOTICE b/NOTICE
index 4bff842..12e3133 100644
--- a/NOTICE
+++ b/NOTICE
@@ -7,4 +7,6 @@ The Apache Software Foundation (http://www.apache.org/).
 This product is based on source code originally developed
 by DynamoBI Corporation, LucidEra Inc., SQLstream Inc. and others
 under the auspices of the Eigenbase Foundation
-and released as the LucidDB project.
\ No newline at end of file
+and released as the LucidDB project.
+
+The web site includes files generated by Jekyll.

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a45d5423/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index fe4e10e..7a154a8 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-<!--
+{% comment %}
 Licensed to the Apache Software Foundation (ASF) under one or more
 contributor license agreements.  See the NOTICE file distributed with
 this work for additional information regarding copyright ownership.
@@ -13,7 +13,7 @@ distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
--->
+{% endcomment %}
 [![Build Status](https://travis-ci.org/julianhyde/incubator-calcite.svg?branch=master)](https://travis-ci.org/julianhyde/incubator-calcite)
 
 # Apache Calcite

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a45d5423/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 81bd926..b44db5b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -594,9 +594,46 @@ limitations under the License.
             <artifactId>apache-rat-plugin</artifactId>
             <configuration>
               <excludes>
+                <!-- The following files have file formats that do not
+                     admit comments, and therefore cannot contain
+                     license notices. -->
                 <exclude>src/main/resources/META-INF/services/java.sql.Driver</exclude>
                 <exclude>**/src/test/resources/**/*.csv</exclude>
                 <exclude>**/src/test/resources/bug/archers.json</exclude>
+
+                <!-- Files generated by Jekyll. -->
+                <exclude>site/.sass-cache/**</exclude>
+                <exclude>site/_includes/anchor_links.html</exclude>
+                <exclude>site/_includes/docs_contents.html</exclude>
+                <exclude>site/_includes/docs_contents_mobile.html</exclude>
+                <exclude>site/_includes/docs_option.html</exclude>
+                <exclude>site/_includes/docs_ul.html</exclude>
+                <exclude>site/_includes/footer.html</exclude>
+                <exclude>site/_includes/header.html</exclude>
+                <exclude>site/_includes/news_contents.html</exclude>
+                <exclude>site/_includes/news_contents_mobile.html</exclude>
+                <exclude>site/_includes/news_item.html</exclude>
+                <exclude>site/_includes/primary-nav-items.html</exclude>
+                <exclude>site/_includes/section_nav.html</exclude>
+                <exclude>site/_includes/top.html</exclude>
+                <exclude>site/_layouts/default.html</exclude>
+                <exclude>site/_layouts/docs.html</exclude>
+                <exclude>site/_layouts/external.html</exclude>
+                <exclude>site/_layouts/news.html</exclude>
+                <exclude>site/_layouts/news_item.html</exclude>
+                <exclude>site/_layouts/page.html</exclude>
+                <exclude>site/_sass/**</exclude>
+                <exclude>site/css/screen.scss</exclude>
+                <exclude>site/fonts/**</exclude>
+                <exclude>site/js/**</exclude>
+
+                <!-- Images -->
+                <exclude>site/img/*.png</exclude>
+                <exclude>site/favicon.ico</exclude>
+
+                <!-- Do not exclude site/target; it should not exist
+                     in any sandbox from which you are making a
+                     release. -->
               </excludes>
             </configuration>
             <executions>

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a45d5423/site/Gemfile
----------------------------------------------------------------------
diff --git a/site/Gemfile b/site/Gemfile
index 77ef869..c5179f1 100644
--- a/site/Gemfile
+++ b/site/Gemfile
@@ -1,3 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to you under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
 source 'https://rubygems.org'
 gem 'github-pages'
-gem 'rouge'
\ No newline at end of file
+gem 'rouge'
+# End Gemfile

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a45d5423/site/README.md
----------------------------------------------------------------------
diff --git a/site/README.md b/site/README.md
index 85efa1d..ae957c3 100644
--- a/site/README.md
+++ b/site/README.md
@@ -1,3 +1,20 @@
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
+
 # Apache Calcite docs site
 
 This directory contains the code for the Apache Calcite (incubating) web site,

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a45d5423/site/_config.yml
----------------------------------------------------------------------
diff --git a/site/_config.yml b/site/_config.yml
index a47de15..bde7c38 100644
--- a/site/_config.yml
+++ b/site/_config.yml
@@ -1,3 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to you under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
 markdown: kramdown
 permalink: /news/:year/:month/:day/:title/
 excerpt_separator: ""
@@ -10,3 +25,4 @@ keep_files: [".git", ".svn", "apidocs"]
 collections:
   docs:
     output: true
+# End _config.yml

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a45d5423/site/_data/contributors.yml
----------------------------------------------------------------------
diff --git a/site/_data/contributors.yml b/site/_data/contributors.yml
index fc44c1e..48f8750 100644
--- a/site/_data/contributors.yml
+++ b/site/_data/contributors.yml
@@ -1,3 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to you under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# Database of contributors to Apache Calcite.
+# Pages such as developer.md use this data.
+#
 - name: Alan Gates
   apacheId: gates
   githubId: alanfgates
@@ -56,3 +74,4 @@
   apacheId: vladimirsitnikov
   githubId: vlsi
   role: PMC
+# End contributors.yml

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a45d5423/site/_data/docs.yml
----------------------------------------------------------------------
diff --git a/site/_data/docs.yml b/site/_data/docs.yml
index d016b2d..d6641e0 100644
--- a/site/_data/docs.yml
+++ b/site/_data/docs.yml
@@ -1,3 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to you under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# Data that defines menu structure
+#
 - title: Overview
   docs:
   - index
@@ -23,3 +40,4 @@
   - history
   - contributing
   - api
+# End docs.yml

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a45d5423/site/_docs/adapter.md
----------------------------------------------------------------------
diff --git a/site/_docs/adapter.md b/site/_docs/adapter.md
index af0d66c..271b91a 100644
--- a/site/_docs/adapter.md
+++ b/site/_docs/adapter.md
@@ -3,8 +3,22 @@ layout: docs
 title: Adapters
 permalink: /docs/adapter.html
 ---
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
 
-## Adapters
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
 
 * <a href="https://github.com/apache/incubator-drill">Apache Drill adapter</a>
 * Cascading adapter (<a href="https://github.com/Cascading/lingual">Lingual</a>)

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a45d5423/site/_docs/algebra.md
----------------------------------------------------------------------
diff --git a/site/_docs/algebra.md b/site/_docs/algebra.md
index f14f114..a69ca7b 100644
--- a/site/_docs/algebra.md
+++ b/site/_docs/algebra.md
@@ -3,6 +3,22 @@ layout: docs
 title: Algebra
 permalink: /docs/algebra.html
 ---
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
 
 Relational algebra is at the heart of Calcite. Every query is
 represented as a tree of relational operators. You can translate from

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a45d5423/site/_docs/index.md
----------------------------------------------------------------------
diff --git a/site/_docs/index.md b/site/_docs/index.md
index d53aa47..60f439d 100644
--- a/site/_docs/index.md
+++ b/site/_docs/index.md
@@ -3,6 +3,22 @@ layout: docs
 title: Background
 permalink: /docs/index.html
 ---
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
 
 Apache Calcite is a dynamic data management framework.
 

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a45d5423/site/_includes/news_item.html
----------------------------------------------------------------------
diff --git a/site/_includes/news_item.html b/site/_includes/news_item.html
index e543bc6..a057f83 100644
--- a/site/_includes/news_item.html
+++ b/site/_includes/news_item.html
@@ -1,3 +1,19 @@
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
 <article>
   <h2>
     <a href="{{ post.url }}">

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a45d5423/site/_posts/2014-06-27-release-0.8.0-incubating.md
----------------------------------------------------------------------
diff --git a/site/_posts/2014-06-27-release-0.8.0-incubating.md b/site/_posts/2014-06-27-release-0.8.0-incubating.md
index 32188eb..49fbbe7 100644
--- a/site/_posts/2014-06-27-release-0.8.0-incubating.md
+++ b/site/_posts/2014-06-27-release-0.8.0-incubating.md
@@ -7,5 +7,21 @@ tag: v0-8
 sha: 3da850a1
 categories: [release]
 ---
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
 
 This is the first release under the Apache incubator process.

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a45d5423/site/_posts/2014-08-19-release-0.9.0-incubating.md
----------------------------------------------------------------------
diff --git a/site/_posts/2014-08-19-release-0.9.0-incubating.md b/site/_posts/2014-08-19-release-0.9.0-incubating.md
index 1826487..5855529 100644
--- a/site/_posts/2014-08-19-release-0.9.0-incubating.md
+++ b/site/_posts/2014-08-19-release-0.9.0-incubating.md
@@ -8,5 +8,21 @@ tag: v0-9-0
 sha: 45e5269b
 categories: [release]
 ---
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
 
 This is the first release under the Apache incubator process.

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a45d5423/site/_posts/2014-10-02-release-0.9.1-incubating.md
----------------------------------------------------------------------
diff --git a/site/_posts/2014-10-02-release-0.9.1-incubating.md b/site/_posts/2014-10-02-release-0.9.1-incubating.md
index ce0d6d0..7c35516 100644
--- a/site/_posts/2014-10-02-release-0.9.1-incubating.md
+++ b/site/_posts/2014-10-02-release-0.9.1-incubating.md
@@ -7,5 +7,21 @@ tag: v0-9-1
 sha: 68012573
 categories: [release]
 ---
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
 
 This is the first release as Calcite. (The project was previously called Optiq.)

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a45d5423/site/_posts/2014-11-05-release-0.9.2-incubating.md
----------------------------------------------------------------------
diff --git a/site/_posts/2014-11-05-release-0.9.2-incubating.md b/site/_posts/2014-11-05-release-0.9.2-incubating.md
index ef0746b..1658145 100644
--- a/site/_posts/2014-11-05-release-0.9.2-incubating.md
+++ b/site/_posts/2014-11-05-release-0.9.2-incubating.md
@@ -7,6 +7,22 @@ tag: v0-9-2
 sha: 0404fd23
 categories: [release]
 ---
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
 
 A fairly minor release, and last release before we rename all of the
 packages and lots of classes, in what we expect to call 1.0. If you

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a45d5423/site/_posts/2015-01-31-release-1.0.0-incubating.md
----------------------------------------------------------------------
diff --git a/site/_posts/2015-01-31-release-1.0.0-incubating.md b/site/_posts/2015-01-31-release-1.0.0-incubating.md
index ef9467f..ff219c9 100644
--- a/site/_posts/2015-01-31-release-1.0.0-incubating.md
+++ b/site/_posts/2015-01-31-release-1.0.0-incubating.md
@@ -7,6 +7,22 @@ tag: v1-0-0
 sha: 2dd83f2
 categories: [release]
 ---
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
 
 Calcite's first major release.
 

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a45d5423/site/_posts/2015-03-13-release-1.1.0-incubating.md
----------------------------------------------------------------------
diff --git a/site/_posts/2015-03-13-release-1.1.0-incubating.md b/site/_posts/2015-03-13-release-1.1.0-incubating.md
index e921459..6661894 100644
--- a/site/_posts/2015-03-13-release-1.1.0-incubating.md
+++ b/site/_posts/2015-03-13-release-1.1.0-incubating.md
@@ -7,6 +7,22 @@ tag: v1-1-0
 sha: f10ea367
 categories: [release]
 ---
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
 
 This Calcite release makes it possible to exploit physical properties
 of relational expressions to produce more efficient plans, introducing

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a45d5423/site/_posts/2015-04-07-release-1.2.0-incubating.md
----------------------------------------------------------------------
diff --git a/site/_posts/2015-04-07-release-1.2.0-incubating.md b/site/_posts/2015-04-07-release-1.2.0-incubating.md
index 43bb6e3..c89b74f 100644
--- a/site/_posts/2015-04-07-release-1.2.0-incubating.md
+++ b/site/_posts/2015-04-07-release-1.2.0-incubating.md
@@ -7,6 +7,22 @@ tag: v1-2-0
 sha: d60f2aa
 categories: [release]
 ---
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
 
 A short release, less than a month after 1.1.
 

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a45d5423/site/_posts/2015-04-24-new-committers.md
----------------------------------------------------------------------
diff --git a/site/_posts/2015-04-24-new-committers.md b/site/_posts/2015-04-24-new-committers.md
index a0798c2..305209b 100644
--- a/site/_posts/2015-04-24-new-committers.md
+++ b/site/_posts/2015-04-24-new-committers.md
@@ -5,6 +5,22 @@ date: "2015-04-24 19:03:07 -0800"
 author: jhyde
 categories: [team]
 ---
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
 
 The Calcite project management committee today added five new
 committers for their work on Calcite. Welcome all!

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a45d5423/site/_posts/2015-05-30-release-1.3.0-incubating.md
----------------------------------------------------------------------
diff --git a/site/_posts/2015-05-30-release-1.3.0-incubating.md b/site/_posts/2015-05-30-release-1.3.0-incubating.md
index 3ea81ba..254f661 100644
--- a/site/_posts/2015-05-30-release-1.3.0-incubating.md
+++ b/site/_posts/2015-05-30-release-1.3.0-incubating.md
@@ -7,6 +7,22 @@ categories: [release]
 tag: v1-3-0
 sha: 495f1859
 ---
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
 
 Mainly bug-fixes, but this release adds support for
 <a href="https://issues.apache.org/jira/browse/CALCITE-505">modifiable views</a>

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a45d5423/site/develop/index.md
----------------------------------------------------------------------
diff --git a/site/develop/index.md b/site/develop/index.md
index efcd0c3..1a93bcd 100644
--- a/site/develop/index.md
+++ b/site/develop/index.md
@@ -2,6 +2,22 @@
 layout: page
 title: Developing
 ---
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
 
 Want to help add a feature or fix a bug?
 

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a45d5423/site/help/index.md
----------------------------------------------------------------------
diff --git a/site/help/index.md b/site/help/index.md
index 599e926..8157c12 100644
--- a/site/help/index.md
+++ b/site/help/index.md
@@ -2,6 +2,22 @@
 layout: page
 title: Getting Help
 ---
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
 
 Need help with Calcite? Try these resources.
 

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a45d5423/site/index.html
----------------------------------------------------------------------
diff --git a/site/index.html b/site/index.html
index da560c5..9a10d81 100644
--- a/site/index.html
+++ b/site/index.html
@@ -3,6 +3,22 @@ layout: default
 title: Apache Calcite &bull; Dynamic data management framework
 overview: true
 ---
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
 
 <section class="intro">
   <div class="grid">

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a45d5423/site/news/index.html
----------------------------------------------------------------------
diff --git a/site/news/index.html b/site/news/index.html
index 4a6490f..66d4dcd 100644
--- a/site/news/index.html
+++ b/site/news/index.html
@@ -4,6 +4,22 @@ title: News
 permalink: /news/
 author: all
 ---
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
 
 {% for post in site.posts %}
   {% include news_item.html %}
@@ -13,7 +29,7 @@ author: all
 
 <h2>Calcite Twitter</h2>
 
-<p>The official <a href="https://twitter.com/apachecalcite">@ApacheCalcite</a>
+<p>The official <a href="https://twitter.com/ApacheCalcite">@ApacheCalcite</a>
 Twitter account pushes announcements about Calcite. If you give a talk about
 Calcite, let us know and we'll tweet it out and add it to the news section
 of the website.</p>

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a45d5423/site/news/releases/index.html
----------------------------------------------------------------------
diff --git a/site/news/releases/index.html b/site/news/releases/index.html
index 153d022..c6c9fa6 100644
--- a/site/news/releases/index.html
+++ b/site/news/releases/index.html
@@ -4,6 +4,22 @@ title: Releases
 permalink: /news/releases/
 author: all
 ---
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
 
 {% for post in site.categories.release %}
   {% include news_item.html %}

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a45d5423/site/talks/index.md
----------------------------------------------------------------------
diff --git a/site/talks/index.md b/site/talks/index.md
index 5744db7..2d24014 100644
--- a/site/talks/index.md
+++ b/site/talks/index.md
@@ -2,6 +2,22 @@
 layout: page
 title: Calcite Talks
 ---
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
 
 Want to learn more about Calcite?
 


[4/6] incubator-calcite git commit: Add LoggingLocalJsonService, to make it easier to test that JDBC requests cause the right RPCs

Posted by jh...@apache.org.
Add LoggingLocalJsonService, to make it easier to test that JDBC requests cause the right RPCs


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

Branch: refs/heads/master
Commit: f0471a1df237517e0adf361201c6bbd60c09b2f8
Parents: 79b1bf0
Author: Julian Hyde <jh...@apache.org>
Authored: Wed Jun 3 16:38:04 2015 -0700
Committer: Julian Hyde <jh...@apache.org>
Committed: Fri Jun 5 01:10:36 2015 -0700

----------------------------------------------------------------------
 .../calcite/avatica/RemoteDriverTest.java       | 64 +++++++++++++++++++-
 1 file changed, 63 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/f0471a1d/avatica-server/src/test/java/org/apache/calcite/avatica/RemoteDriverTest.java
----------------------------------------------------------------------
diff --git a/avatica-server/src/test/java/org/apache/calcite/avatica/RemoteDriverTest.java b/avatica-server/src/test/java/org/apache/calcite/avatica/RemoteDriverTest.java
index 2e0f04b..79b2b9c 100644
--- a/avatica-server/src/test/java/org/apache/calcite/avatica/RemoteDriverTest.java
+++ b/avatica-server/src/test/java/org/apache/calcite/avatica/RemoteDriverTest.java
@@ -43,7 +43,9 @@ import java.sql.SQLException;
 import java.sql.Statement;
 import java.sql.Time;
 import java.sql.Timestamp;
+import java.util.ArrayList;
 import java.util.Calendar;
+import java.util.List;
 import java.util.Map;
 import java.util.TimeZone;
 import java.util.concurrent.TimeUnit;
@@ -588,7 +590,12 @@ public class RemoteDriverTest {
     if (JDK17) {
       return;
     }
+    LoggingLocalJsonService.THREAD_LOG.get().enableAndClear();
     checkPrepareBindExecuteFetch(ljs());
+    List<String[]> x = LoggingLocalJsonService.THREAD_LOG.get().getAndDisable();
+    for (String[] pair : x) {
+      System.out.println(pair[0] + "=" + pair[1]);
+    }
   }
 
   private void checkPrepareBindExecuteFetch(Connection connection)
@@ -781,7 +788,7 @@ public class RemoteDriverTest {
         final JdbcMeta jdbcMeta = new JdbcMeta(CONNECTION_SPEC.url,
             CONNECTION_SPEC.username, CONNECTION_SPEC.password);
         final LocalService localService = new LocalService(jdbcMeta);
-        service = new LocalJsonService(localService);
+        service = new LoggingLocalJsonService(localService);
       } catch (SQLException e) {
         throw new RuntimeException(e);
       }
@@ -847,6 +854,61 @@ public class RemoteDriverTest {
     }
   }
 
+  /** Extension to {@link LocalJsonService} that writes requests and responses
+   * into a thread-local. */
+  private static class LoggingLocalJsonService extends LocalJsonService {
+    private static final ThreadLocal<RequestLogger> THREAD_LOG =
+        new ThreadLocal<RequestLogger>() {
+          @Override protected RequestLogger initialValue() {
+            return new RequestLogger();
+          }
+        };
+
+    public LoggingLocalJsonService(LocalService localService) {
+      super(localService);
+    }
+
+    @Override public String apply(String request) {
+      final RequestLogger logger = THREAD_LOG.get();
+      logger.requestStart(request);
+      final String response = super.apply(request);
+      logger.requestEnd(request, response);
+      return response;
+    }
+  }
+
+  /** Logs request and response strings if enabled. */
+  private static class RequestLogger {
+    final List<String[]> requestResponses = new ArrayList<>();
+    boolean enabled;
+
+    void enableAndClear() {
+      enabled = true;
+      requestResponses.clear();
+    }
+
+    void requestStart(String request) {
+      if (enabled) {
+        requestResponses.add(new String[]{request, null});
+      }
+    }
+
+    void requestEnd(String request, String response) {
+      if (enabled) {
+        String[] last = requestResponses.get(requestResponses.size() - 1);
+        if (!request.equals(last[0])) {
+          throw new AssertionError();
+        }
+        last[1] = response;
+      }
+    }
+
+    List<String[]> getAndDisable() {
+      enabled = false;
+      return new ArrayList<>(requestResponses);
+    }
+  }
+
   /** Information necessary to create a JDBC connection. Specify one to run
    * tests against a different database. (hsqldb is the default.) */
   public static class ConnectionSpec {


[5/6] incubator-calcite git commit: [CALCITE-712] Obey setMaxRows for statement execute (Xavier Leong)

Posted by jh...@apache.org.
[CALCITE-712] Obey setMaxRows for statement execute (Xavier Leong)


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

Branch: refs/heads/master
Commit: e8c3cccded6fbeb4e4e82bc2dabdcd3babc0c986
Parents: f0471a1
Author: Xavier Leong <le...@persistent.my>
Authored: Tue May 5 17:22:38 2015 +0800
Committer: Julian Hyde <jh...@apache.org>
Committed: Fri Jun 5 01:10:45 2015 -0700

----------------------------------------------------------------------
 .../apache/calcite/avatica/jdbc/JdbcMeta.java   |  9 ++++--
 .../calcite/avatica/jdbc/JdbcResultSet.java     |  8 +++++-
 .../calcite/avatica/RemoteDriverTest.java       | 24 +++++++++++++---
 .../calcite/avatica/remote/RemoteMetaTest.java  | 30 ++++++++++++++++++++
 .../avatica/AvaticaPreparedStatement.java       |  2 +-
 .../calcite/avatica/AvaticaStatement.java       |  2 +-
 .../apache/calcite/jdbc/CalciteMetaImpl.java    |  2 ++
 .../calcite/jdbc/CalciteRemoteDriverTest.java   | 12 ++++++++
 8 files changed, 79 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/e8c3cccd/avatica-server/src/main/java/org/apache/calcite/avatica/jdbc/JdbcMeta.java
----------------------------------------------------------------------
diff --git a/avatica-server/src/main/java/org/apache/calcite/avatica/jdbc/JdbcMeta.java b/avatica-server/src/main/java/org/apache/calcite/avatica/jdbc/JdbcMeta.java
index cbaab45..3fe1c2a 100644
--- a/avatica-server/src/main/java/org/apache/calcite/avatica/jdbc/JdbcMeta.java
+++ b/avatica-server/src/main/java/org/apache/calcite/avatica/jdbc/JdbcMeta.java
@@ -718,11 +718,14 @@ public class JdbcMeta implements Meta {
       int maxRowCount, PrepareCallback callback) {
     try {
       final Connection connection = getConnection(ch.id);
-      final PreparedStatement statement = connection.prepareStatement(sql);
+      final Statement statement = connection.createStatement();
       final int id = System.identityHashCode(statement);
       final StatementInfo info = new StatementInfo(statement);
       statementCache.put(id, info); // TODO: must we retain a statement in all cases?
-      boolean ret = statement.execute();
+      if (maxRowCount > 0) {
+        statement.setMaxRows(maxRowCount);
+      }
+      boolean ret = statement.execute(sql);
       info.resultSet = statement.getResultSet();
       assert ret || info.resultSet == null;
       final List<MetaResultSet> resultSets = new ArrayList<>();
@@ -731,7 +734,7 @@ public class JdbcMeta implements Meta {
         resultSets.add(
             MetaResultSet.count(ch.id, id, statement.getUpdateCount()));
       } else {
-        resultSets.add(JdbcResultSet.create(ch.id, id, info.resultSet));
+        resultSets.add(JdbcResultSet.create(ch.id, id, info.resultSet, maxRowCount));
       }
       if (LOG.isTraceEnabled()) {
         StatementHandle h = new StatementHandle(ch.id, id, null);

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/e8c3cccd/avatica-server/src/main/java/org/apache/calcite/avatica/jdbc/JdbcResultSet.java
----------------------------------------------------------------------
diff --git a/avatica-server/src/main/java/org/apache/calcite/avatica/jdbc/JdbcResultSet.java b/avatica-server/src/main/java/org/apache/calcite/avatica/jdbc/JdbcResultSet.java
index b1a67ac..3f6678f 100644
--- a/avatica-server/src/main/java/org/apache/calcite/avatica/jdbc/JdbcResultSet.java
+++ b/avatica-server/src/main/java/org/apache/calcite/avatica/jdbc/JdbcResultSet.java
@@ -43,10 +43,16 @@ class JdbcResultSet extends Meta.MetaResultSet {
   /** Creates a result set. */
   public static JdbcResultSet create(String connectionId, int statementId,
       ResultSet resultSet) {
+    return create(connectionId, statementId, resultSet, -1);
+  }
+
+  /** Creates a result set with maxRowCount. */
+  public static JdbcResultSet create(String connectionId, int statementId,
+      ResultSet resultSet, int maxRowCount) {
     try {
       Meta.Signature sig = JdbcMeta.signature(resultSet.getMetaData());
       final Calendar calendar = Calendar.getInstance(DateTimeUtils.GMT_ZONE);
-      final Meta.Frame firstFrame = frame(resultSet, 0, -1, calendar);
+      final Meta.Frame firstFrame = frame(resultSet, 0, maxRowCount, calendar);
       resultSet.close();
       return new JdbcResultSet(connectionId, statementId, true, sig,
           firstFrame);

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/e8c3cccd/avatica-server/src/test/java/org/apache/calcite/avatica/RemoteDriverTest.java
----------------------------------------------------------------------
diff --git a/avatica-server/src/test/java/org/apache/calcite/avatica/RemoteDriverTest.java b/avatica-server/src/test/java/org/apache/calcite/avatica/RemoteDriverTest.java
index 79b2b9c..4dd740b 100644
--- a/avatica-server/src/test/java/org/apache/calcite/avatica/RemoteDriverTest.java
+++ b/avatica-server/src/test/java/org/apache/calcite/avatica/RemoteDriverTest.java
@@ -285,11 +285,25 @@ public class RemoteDriverTest {
     checkStatementExecute(ljs(), false);
   }
 
+  @Test public void testStatementExecuteLocalMaxRow() throws Exception {
+    checkStatementExecute(ljs(), false, 2);
+  }
+
+  @Ignore("CALCITE-719: Refactor PreparedStatement to support setMaxRows")
+  @Test public void testStatementPrepareExecuteLocalMaxRow() throws Exception {
+    checkStatementExecute(ljs(), true, 2);
+  }
+
   @Test public void testPrepareExecuteLocal() throws Exception {
     checkStatementExecute(ljs(), true);
   }
 
-  private void checkStatementExecute(Connection connection, boolean prepare) throws SQLException {
+  private void checkStatementExecute(Connection connection,
+      boolean prepare) throws SQLException {
+    checkStatementExecute(connection, prepare, 0);
+  }
+  private void checkStatementExecute(Connection connection,
+      boolean prepare, int maxRowCount) throws SQLException {
     final String sql = "select * from (\n"
         + "  values (1, 'a'), (null, 'b'), (3, 'c')) as t (c1, c2)";
     final Statement statement;
@@ -298,11 +312,13 @@ public class RemoteDriverTest {
     if (prepare) {
       final PreparedStatement ps = connection.prepareStatement(sql);
       statement = ps;
+      ps.setMaxRows(maxRowCount);
       parameterMetaData = ps.getParameterMetaData();
       assertTrue(ps.execute());
       resultSet = ps.getResultSet();
     } else {
       statement = connection.createStatement();
+      statement.setMaxRows(maxRowCount);
       parameterMetaData = null;
       assertTrue(statement.execute(sql));
       resultSet = statement.getResultSet();
@@ -314,9 +330,9 @@ public class RemoteDriverTest {
     assertEquals(2, metaData.getColumnCount());
     assertEquals("C1", metaData.getColumnName(1));
     assertEquals("C2", metaData.getColumnName(2));
-    assertTrue(resultSet.next());
-    assertTrue(resultSet.next());
-    assertTrue(resultSet.next());
+    for (int i = 0; i < maxRowCount || (maxRowCount == 0 && i < 3); i++) {
+      assertTrue(resultSet.next());
+    }
     assertFalse(resultSet.next());
     resultSet.close();
     statement.close();

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/e8c3cccd/avatica-server/src/test/java/org/apache/calcite/avatica/remote/RemoteMetaTest.java
----------------------------------------------------------------------
diff --git a/avatica-server/src/test/java/org/apache/calcite/avatica/remote/RemoteMetaTest.java b/avatica-server/src/test/java/org/apache/calcite/avatica/remote/RemoteMetaTest.java
index 890a78a..2439ac3 100644
--- a/avatica-server/src/test/java/org/apache/calcite/avatica/remote/RemoteMetaTest.java
+++ b/avatica-server/src/test/java/org/apache/calcite/avatica/remote/RemoteMetaTest.java
@@ -17,6 +17,7 @@
 package org.apache.calcite.avatica.remote;
 
 import org.apache.calcite.avatica.AvaticaConnection;
+import org.apache.calcite.avatica.AvaticaStatement;
 import org.apache.calcite.avatica.ConnectionPropertiesImpl;
 import org.apache.calcite.avatica.Meta;
 import org.apache.calcite.avatica.RemoteDriverTest;
@@ -31,8 +32,10 @@ import org.junit.BeforeClass;
 import org.junit.Test;
 
 import java.lang.reflect.Field;
+import java.lang.reflect.Method;
 import java.sql.Connection;
 import java.sql.DriverManager;
+import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Statement;
 import java.util.List;
@@ -90,6 +93,14 @@ public class RemoteMetaTest {
     return (Meta) f.get(conn);
   }
 
+  private static Meta.ExecuteResult prepareAndExecuteInternal(AvaticaConnection conn,
+    final AvaticaStatement statement, String sql, int maxRowCount) throws Exception {
+    Method m = AvaticaConnection.class.getDeclaredMethod("prepareAndExecuteInternal",
+      AvaticaStatement.class, String.class, int.class);
+    m.setAccessible(true);
+    return (Meta.ExecuteResult) m.invoke(conn, statement, sql, new Integer(maxRowCount));
+  }
+
   private static Connection getConnection(JdbcMeta m, String id) throws Exception {
     Field f = JdbcMeta.class.getDeclaredField("connectionCache");
     f.setAccessible(true);
@@ -98,6 +109,25 @@ public class RemoteMetaTest {
     return connectionCache.getIfPresent(id);
   }
 
+  @Test public void testRemoteExecuteMaxRowCount() throws Exception {
+    try (AvaticaConnection conn = (AvaticaConnection) DriverManager.getConnection(url)) {
+      final AvaticaStatement statement = conn.createStatement();
+      prepareAndExecuteInternal(conn, statement,
+        "select * from (values ('a', 1), ('b', 2))", 0);
+      ResultSet rs = statement.getResultSet();
+      int count = 0;
+      while (rs.next()) {
+        count++;
+      }
+      assertEquals("Check maxRowCount=0 and ResultSets is 0 row", count, 0);
+      assertEquals("Check result set meta is still there",
+        rs.getMetaData().getColumnCount(), 2);
+      rs.close();
+      statement.close();
+      conn.close();
+    }
+  }
+
   @Test public void testRemoteConnectionProperties() throws Exception {
     try (AvaticaConnection conn = (AvaticaConnection) DriverManager.getConnection(url)) {
       String id = conn.id;

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/e8c3cccd/avatica/src/main/java/org/apache/calcite/avatica/AvaticaPreparedStatement.java
----------------------------------------------------------------------
diff --git a/avatica/src/main/java/org/apache/calcite/avatica/AvaticaPreparedStatement.java b/avatica/src/main/java/org/apache/calcite/avatica/AvaticaPreparedStatement.java
index 0410cfe..e489c07 100644
--- a/avatica/src/main/java/org/apache/calcite/avatica/AvaticaPreparedStatement.java
+++ b/avatica/src/main/java/org/apache/calcite/avatica/AvaticaPreparedStatement.java
@@ -48,7 +48,7 @@ import java.util.List;
 public abstract class AvaticaPreparedStatement
     extends AvaticaStatement
     implements PreparedStatement, ParameterMetaData {
-  private final Meta.Signature signature;
+  private Meta.Signature signature;
   private final ResultSetMetaData resultSetMetaData;
   private Calendar calendar;
   protected final TypedValue[] slots;

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/e8c3cccd/avatica/src/main/java/org/apache/calcite/avatica/AvaticaStatement.java
----------------------------------------------------------------------
diff --git a/avatica/src/main/java/org/apache/calcite/avatica/AvaticaStatement.java b/avatica/src/main/java/org/apache/calcite/avatica/AvaticaStatement.java
index 7c6d3c2..78ec1cc 100644
--- a/avatica/src/main/java/org/apache/calcite/avatica/AvaticaStatement.java
+++ b/avatica/src/main/java/org/apache/calcite/avatica/AvaticaStatement.java
@@ -36,7 +36,7 @@ public abstract class AvaticaStatement
     implements Statement {
   public final AvaticaConnection connection;
   /** Statement id; unique within connection. */
-  public final Meta.StatementHandle handle;
+  public Meta.StatementHandle handle;
   protected boolean closed;
 
   /**

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/e8c3cccd/core/src/main/java/org/apache/calcite/jdbc/CalciteMetaImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/jdbc/CalciteMetaImpl.java b/core/src/main/java/org/apache/calcite/jdbc/CalciteMetaImpl.java
index 1fca967..c466819 100644
--- a/core/src/main/java/org/apache/calcite/jdbc/CalciteMetaImpl.java
+++ b/core/src/main/java/org/apache/calcite/jdbc/CalciteMetaImpl.java
@@ -539,6 +539,7 @@ public class CalciteMetaImpl extends MetaImpl {
       int maxRowCount) {
     final StatementHandle h = createStatement(ch);
     final CalciteConnectionImpl calciteConnection = getConnection();
+
     CalciteServerStatement statement = calciteConnection.server.getStatement(h);
     h.signature =
         calciteConnection.parseQuery(sql, statement.createPrepareContext(),
@@ -551,6 +552,7 @@ public class CalciteMetaImpl extends MetaImpl {
       String sql, int maxRowCount, PrepareCallback callback) {
     final CalcitePrepare.CalciteSignature<Object> signature;
     final StatementHandle h = createStatement(ch);
+
     try {
       synchronized (callback.getMonitor()) {
         callback.clear();

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/e8c3cccd/core/src/test/java/org/apache/calcite/jdbc/CalciteRemoteDriverTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/jdbc/CalciteRemoteDriverTest.java b/core/src/test/java/org/apache/calcite/jdbc/CalciteRemoteDriverTest.java
index c8a39f6..f7aba8c 100644
--- a/core/src/test/java/org/apache/calcite/jdbc/CalciteRemoteDriverTest.java
+++ b/core/src/test/java/org/apache/calcite/jdbc/CalciteRemoteDriverTest.java
@@ -469,6 +469,18 @@ public class CalciteRemoteDriverTest {
     assertTrue(count > 0);
   }
 
+  @Test public void testRemoteExecuteMaxRow() throws Exception {
+    Statement statement = remoteConnection.createStatement();
+    statement.setMaxRows(2);
+    ResultSet resultSet = statement.executeQuery(
+            "select * from \"hr\".\"emps\"");
+    int count = 0;
+    while (resultSet.next()) {
+      ++count;
+    }
+    assertThat(count, equalTo(2));
+  }
+
   /** Test case for
    * <a href="https://issues.apache.org/jira/browse/CALCITE-661">[CALCITE-661]
    * Remote fetch in Calcite JDBC driver</a>. */


[2/6] incubator-calcite git commit: How to release

Posted by jh...@apache.org.
How to release


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

Branch: refs/heads/master
Commit: 79b1bf0891421afaf8cbb49229cd91bdc6c1845c
Parents: 918df43
Author: Julian Hyde <jh...@apache.org>
Authored: Mon Jun 1 11:38:40 2015 -0700
Committer: Julian Hyde <jh...@apache.org>
Committed: Wed Jun 3 17:39:19 2015 -0700

----------------------------------------------------------------------
 site/_docs/howto.md | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/79b1bf08/site/_docs/howto.md
----------------------------------------------------------------------
diff --git a/site/_docs/howto.md b/site/_docs/howto.md
index 9aabeda..7443262 100644
--- a/site/_docs/howto.md
+++ b/site/_docs/howto.md
@@ -750,11 +750,13 @@ Julian
 After a successful release vote, we need to push the release
 out to mirrors, and other tasks.
 
-In JIRA, search for all issues resolved in this release,
+In JIRA, search for
+[all issues resolved in this release](https://issues.apache.org/jira/issues/?jql=project%20%3D%20CALCITE%20and%20fixVersion%20%3D%201.3.0-incubating%20and%20status%20%3D%20Resolved%20and%20resolution%20%3D%20Fixed),
 and do a bulk update changing their status to "Closed",
 with a change comment
 "Resolved in release X.Y.Z-incubating (YYYY-MM-DD)"
 (fill in release number and date appropriately).
+Uncheck "Send mail for this update".
 
 Promote the staged nexus artifacts.
 


[3/6] incubator-calcite git commit: Move disclaimer out of every page's footer and into home page and downloads page

Posted by jh...@apache.org.
Move disclaimer out of every page's footer and into home page and downloads page


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

Branch: refs/heads/master
Commit: 918df436fa95fcacf06f0ec8a1354b33e318f2d8
Parents: a45d542
Author: Julian Hyde <jh...@apache.org>
Authored: Mon Jun 1 16:40:45 2015 -0700
Committer: Julian Hyde <jh...@apache.org>
Committed: Wed Jun 3 17:39:19 2015 -0700

----------------------------------------------------------------------
 site/_docs/downloads.md    | 15 ++++++++++++++-
 site/_includes/footer.html | 11 -----------
 site/_sass/_style.scss     |  9 +++++++++
 site/index.html            | 21 +++++++++++++++++++++
 4 files changed, 44 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/918df436/site/_docs/downloads.md
----------------------------------------------------------------------
diff --git a/site/_docs/downloads.md b/site/_docs/downloads.md
index efcff43..74d1acd 100644
--- a/site/_docs/downloads.md
+++ b/site/_docs/downloads.md
@@ -50,4 +50,17 @@ Add the following to the dependencies section of your `pom.xml` file:
 
 Also include `<dependency>` elements for any extension modules you
 need: `calcite-mongodb`, `calcite-spark`, `calcite-splunk`, and so
-forth.
\ No newline at end of file
+forth.
+
+# Disclaimer
+
+Apache Calcite is an effort undergoing incubation at
+[The Apache Software Foundation (ASF)](http://www.apache.org),
+sponsored by the [Apache Incubator](http://incubator.apache.org/).
+Incubation is required of all newly accepted projects
+until a further review indicates that the infrastructure,
+communications, and decision making process have stabilized in a
+manner consistent with other successful ASF projects. While
+incubation status is not necessarily a reflection of the
+completeness or stability of the code, it does indicate that the
+project has yet to be fully endorsed by the ASF.

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/918df436/site/_includes/footer.html
----------------------------------------------------------------------
diff --git a/site/_includes/footer.html b/site/_includes/footer.html
index 1eb6b11..d077112 100644
--- a/site/_includes/footer.html
+++ b/site/_includes/footer.html
@@ -5,15 +5,4 @@
      the <a href="https://www.apache.org/licenses/LICENSE-2.0.html">
      Apache&nbsp;License&nbsp;v2</a>. Apache Calcite and its logo are
      trademarks of the Apache Software Foundation.</p>
-
-  <p>Apache Calcite is an effort undergoing incubation at The Apache
-      Software Foundation (ASF), sponsored by the Apache
-      Incubator. Incubation is required of all newly accepted projects
-      until a further review indicates that the infrastructure,
-      communications, and decision making process have stabilized in a
-      manner consistent with other successful ASF projects. While
-      incubation status is not necessarily a reflection of the
-      completeness or stability of the code, it does indicate that the
-      project has yet to be fully endorsed by the ASF.</p>
-  
 </footer>

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/918df436/site/_sass/_style.scss
----------------------------------------------------------------------
diff --git a/site/_sass/_style.scss b/site/_sass/_style.scss
index d6e832a..5edcedb 100644
--- a/site/_sass/_style.scss
+++ b/site/_sass/_style.scss
@@ -222,6 +222,15 @@ footer {
   .intro p { font-size: 3.2em; }
 }
 
+.disclaimer {
+  h3 {
+    font-size: 16px;
+  }
+  p {
+    font-size: 14px;
+  }
+}
+
 /* Quickstart */
 
 .quickstart {

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/918df436/site/index.html
----------------------------------------------------------------------
diff --git a/site/index.html b/site/index.html
index 9a10d81..0e27346 100644
--- a/site/index.html
+++ b/site/index.html
@@ -47,4 +47,25 @@ limitations under the License.
     </div>
     <div class="clear"></div>
   </div>
+  <div class="unit whole"><p>&nbsp;</p></div>
+</section>
+<section class="disclaimer">
+  <div class="grid">
+    <div class="unit whole">
+      <article>
+        <h3>Disclaimer</h3>
+        <p>Apache Calcite is an effort undergoing incubation at
+          <a href="http://www.apache.org">The Apache Software Foundation</a>,
+          sponsored by the
+          <a href="http://incubator.apache.org/">Apache Incubator</a>.
+          Incubation is required of all newly accepted projects
+          until a further review indicates that the infrastructure,
+          communications, and decision making process have stabilized in a
+          manner consistent with other successful ASF projects. While
+          incubation status is not necessarily a reflection of the
+          completeness or stability of the code, it does indicate that the
+          project has yet to be fully endorsed by the ASF.</p>
+      </article>
+    </div>
+  </div>
 </section>


[6/6] incubator-calcite git commit: [CALCITE-718] Enable fetch to work for Statement.execute() for Avatica (Xavier Leong)

Posted by jh...@apache.org.
[CALCITE-718] Enable fetch to work for Statement.execute() for Avatica (Xavier Leong)

Close apache/incubator-calcite#88

Close apache/incubator-calcite#87 (forgot to close it in recent commit)


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

Branch: refs/heads/master
Commit: ec9d966042f870c70593fca9e8bf55f8f74317e9
Parents: e8c3ccc
Author: Xavier Leong <le...@persistent.my>
Authored: Fri May 29 15:06:01 2015 +0800
Committer: Julian Hyde <jh...@apache.org>
Committed: Fri Jun 5 01:37:57 2015 -0700

----------------------------------------------------------------------
 .../apache/calcite/avatica/jdbc/JdbcMeta.java   | 50 +++++++++++---------
 .../calcite/avatica/jdbc/JdbcResultSet.java     | 12 +++--
 .../calcite/avatica/RemoteDriverTest.java       | 41 ++++++++++++++++
 .../calcite/avatica/AvaticaConnection.java      |  2 +-
 .../java/org/apache/calcite/avatica/Meta.java   |  6 +--
 .../calcite/avatica/remote/LocalService.java    |  9 ++--
 .../calcite/avatica/remote/RemoteMeta.java      |  9 ++--
 .../apache/calcite/avatica/remote/Service.java  |  5 +-
 .../apache/calcite/jdbc/CalciteMetaImpl.java    |  5 +-
 9 files changed, 98 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/ec9d9660/avatica-server/src/main/java/org/apache/calcite/avatica/jdbc/JdbcMeta.java
----------------------------------------------------------------------
diff --git a/avatica-server/src/main/java/org/apache/calcite/avatica/jdbc/JdbcMeta.java b/avatica-server/src/main/java/org/apache/calcite/avatica/jdbc/JdbcMeta.java
index 3fe1c2a..d1a2049 100644
--- a/avatica-server/src/main/java/org/apache/calcite/avatica/jdbc/JdbcMeta.java
+++ b/avatica-server/src/main/java/org/apache/calcite/avatica/jdbc/JdbcMeta.java
@@ -714,16 +714,20 @@ public class JdbcMeta implements Meta {
     }
   }
 
-  public ExecuteResult prepareAndExecute(ConnectionHandle ch, String sql,
+  public ExecuteResult prepareAndExecute(StatementHandle h, String sql,
       int maxRowCount, PrepareCallback callback) {
     try {
-      final Connection connection = getConnection(ch.id);
-      final Statement statement = connection.createStatement();
-      final int id = System.identityHashCode(statement);
-      final StatementInfo info = new StatementInfo(statement);
-      statementCache.put(id, info); // TODO: must we retain a statement in all cases?
+      final StatementInfo info = statementCache.getIfPresent(h.id);
+      if (info == null) {
+        throw new RuntimeException("Statement not found, potentially expired. "
+            + h);
+      }
+      final Statement statement = info.statement;
+      // Special handling of maxRowCount as JDBC 0 is unlimited, our meta 0 row
       if (maxRowCount > 0) {
         statement.setMaxRows(maxRowCount);
+      } else if (maxRowCount < 0) {
+        statement.setMaxRows(0);
       }
       boolean ret = statement.execute(sql);
       info.resultSet = statement.getResultSet();
@@ -732,12 +736,14 @@ public class JdbcMeta implements Meta {
       if (info.resultSet == null) {
         // Create a special result set that just carries update count
         resultSets.add(
-            MetaResultSet.count(ch.id, id, statement.getUpdateCount()));
+            MetaResultSet.count(h.connectionId, h.id,
+                statement.getUpdateCount()));
       } else {
-        resultSets.add(JdbcResultSet.create(ch.id, id, info.resultSet, maxRowCount));
+        resultSets.add(
+            JdbcResultSet.create(h.connectionId, h.id, info.resultSet,
+                maxRowCount));
       }
       if (LOG.isTraceEnabled()) {
-        StatementHandle h = new StatementHandle(ch.id, id, null);
         LOG.trace("prepAndExec statement " + h);
       }
       // TODO: review client to ensure statementId is updated when appropriate
@@ -750,26 +756,26 @@ public class JdbcMeta implements Meta {
   public Frame fetch(StatementHandle h, List<TypedValue> parameterValues,
       int offset, int fetchMaxRowCount) {
     if (LOG.isTraceEnabled()) {
-      LOG.trace("fetching " + h + " offset:" + offset + " fetchMaxRowCount:" + fetchMaxRowCount);
+      LOG.trace("fetching " + h + " offset:" + offset + " fetchMaxRowCount:"
+          + fetchMaxRowCount);
     }
     try {
       final StatementInfo statementInfo = Objects.requireNonNull(
           statementCache.getIfPresent(h.id),
           "Statement not found, potentially expired. " + h);
       if (statementInfo.resultSet == null || parameterValues != null) {
-        if (statementInfo.resultSet != null) {
-          statementInfo.resultSet.close();
-        }
-        final PreparedStatement preparedStatement =
-            (PreparedStatement) statementInfo.statement;
-        if (parameterValues != null) {
-          for (int i = 0; i < parameterValues.size(); i++) {
-            TypedValue o = parameterValues.get(i);
-            preparedStatement.setObject(i + 1, o.toJdbc(calendar));
+        if (statementInfo.statement instanceof PreparedStatement) {
+          final PreparedStatement preparedStatement =
+              (PreparedStatement) statementInfo.statement;
+          if (parameterValues != null) {
+            for (int i = 0; i < parameterValues.size(); i++) {
+              TypedValue o = parameterValues.get(i);
+              preparedStatement.setObject(i + 1, o.toJdbc(calendar));
+            }
+          }
+          if (preparedStatement.execute()) {
+            statementInfo.resultSet = preparedStatement.getResultSet();
           }
-        }
-        if (preparedStatement.execute()) {
-          statementInfo.resultSet = preparedStatement.getResultSet();
         }
       }
       if (statementInfo.resultSet == null) {

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/ec9d9660/avatica-server/src/main/java/org/apache/calcite/avatica/jdbc/JdbcResultSet.java
----------------------------------------------------------------------
diff --git a/avatica-server/src/main/java/org/apache/calcite/avatica/jdbc/JdbcResultSet.java b/avatica-server/src/main/java/org/apache/calcite/avatica/jdbc/JdbcResultSet.java
index 3f6678f..ae67b50 100644
--- a/avatica-server/src/main/java/org/apache/calcite/avatica/jdbc/JdbcResultSet.java
+++ b/avatica-server/src/main/java/org/apache/calcite/avatica/jdbc/JdbcResultSet.java
@@ -52,8 +52,12 @@ class JdbcResultSet extends Meta.MetaResultSet {
     try {
       Meta.Signature sig = JdbcMeta.signature(resultSet.getMetaData());
       final Calendar calendar = Calendar.getInstance(DateTimeUtils.GMT_ZONE);
-      final Meta.Frame firstFrame = frame(resultSet, 0, maxRowCount, calendar);
-      resultSet.close();
+      final int fetchRowCount =
+        (maxRowCount == -1 || maxRowCount > 100) ? 100 : maxRowCount;
+      final Meta.Frame firstFrame = frame(resultSet, 0, fetchRowCount, calendar);
+      if (firstFrame.done) {
+        resultSet.close();
+      }
       return new JdbcResultSet(connectionId, statementId, true, sig,
           firstFrame);
     } catch (SQLException e) {
@@ -72,10 +76,12 @@ class JdbcResultSet extends Meta.MetaResultSet {
       types[i] = metaData.getColumnType(i + 1);
     }
     final List<Object> rows = new ArrayList<>();
-    boolean done = false;
+    // Meta prepare/prepareAndExecute 0 return 0 row and done
+    boolean done = fetchMaxRowCount == 0 ? true : false;
     for (int i = 0; fetchMaxRowCount < 0 || i < fetchMaxRowCount; i++) {
       if (!resultSet.next()) {
         done = true;
+        resultSet.close();
         break;
       }
       Object[] columns = new Object[columnCount];

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/ec9d9660/avatica-server/src/test/java/org/apache/calcite/avatica/RemoteDriverTest.java
----------------------------------------------------------------------
diff --git a/avatica-server/src/test/java/org/apache/calcite/avatica/RemoteDriverTest.java b/avatica-server/src/test/java/org/apache/calcite/avatica/RemoteDriverTest.java
index 4dd740b..e022ddc 100644
--- a/avatica-server/src/test/java/org/apache/calcite/avatica/RemoteDriverTest.java
+++ b/avatica-server/src/test/java/org/apache/calcite/avatica/RemoteDriverTest.java
@@ -285,6 +285,47 @@ public class RemoteDriverTest {
     checkStatementExecute(ljs(), false);
   }
 
+  @Test public void testStatementExecuteFetch() throws Exception {
+    // Creating a > 100 rows queries to enable fetch request
+    String sql = "select * from emp cross join emp";
+    checkExecuteFetch(ljs(), sql, false, 1);
+    // PreparedStatement needed an extra fetch, as the execute will
+    // trigger the 1st fetch. Where statement execute will execute direct
+    // with results back.
+    checkExecuteFetch(ljs(), sql, true, 2);
+  }
+
+  private void checkExecuteFetch(Connection conn, String sql, boolean isPrepare,
+    int fetchCountMatch) throws SQLException {
+    final Statement exeStatement;
+    final ResultSet results;
+    LoggingLocalJsonService.THREAD_LOG.get().enableAndClear();
+    if (isPrepare) {
+      PreparedStatement statement = conn.prepareStatement(sql);
+      exeStatement = statement;
+      results = statement.executeQuery();
+    } else {
+      Statement statement = conn.createStatement();
+      exeStatement = statement;
+      results = statement.executeQuery(sql);
+    }
+    int count = 0;
+    int fetchCount = 0;
+    while (results.next()) {
+      count++;
+    }
+    results.close();
+    exeStatement.close();
+    List<String[]> x = LoggingLocalJsonService.THREAD_LOG.get().getAndDisable();
+    for (String[] pair : x) {
+      if (pair[0].contains("\"request\":\"fetch")) {
+        fetchCount++;
+      }
+    }
+    assertEquals(count, 196);
+    assertEquals(fetchCount, fetchCountMatch);
+  }
+
   @Test public void testStatementExecuteLocalMaxRow() throws Exception {
     checkStatementExecute(ljs(), false, 2);
   }

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/ec9d9660/avatica/src/main/java/org/apache/calcite/avatica/AvaticaConnection.java
----------------------------------------------------------------------
diff --git a/avatica/src/main/java/org/apache/calcite/avatica/AvaticaConnection.java b/avatica/src/main/java/org/apache/calcite/avatica/AvaticaConnection.java
index 1a6ea44..1ed561c 100644
--- a/avatica/src/main/java/org/apache/calcite/avatica/AvaticaConnection.java
+++ b/avatica/src/main/java/org/apache/calcite/avatica/AvaticaConnection.java
@@ -474,7 +474,7 @@ public abstract class AvaticaConnection implements Connection {
             }
           }
         };
-    return meta.prepareAndExecute(handle, sql, maxRowCount, callback);
+    return meta.prepareAndExecute(statement.handle, sql, maxRowCount, callback);
   }
 
   protected ResultSet createResultSet(Meta.MetaResultSet metaResultSet)

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/ec9d9660/avatica/src/main/java/org/apache/calcite/avatica/Meta.java
----------------------------------------------------------------------
diff --git a/avatica/src/main/java/org/apache/calcite/avatica/Meta.java b/avatica/src/main/java/org/apache/calcite/avatica/Meta.java
index e98c7f1..5dd59f0 100644
--- a/avatica/src/main/java/org/apache/calcite/avatica/Meta.java
+++ b/avatica/src/main/java/org/apache/calcite/avatica/Meta.java
@@ -168,15 +168,15 @@ public interface Meta {
 
   /** Prepares and executes a statement.
    *
-   * @param ch Connection handle
+   * @param h Statement handle
    * @param sql SQL query
    * @param maxRowCount Negative for no limit (different meaning than JDBC)
    * @param callback Callback to lock, clear and assign cursor
    *
    * @return Result containing statement ID, and if a query, a result set and
-   * first frame of data
+   *     first frame of data
    */
-  ExecuteResult prepareAndExecute(ConnectionHandle ch, String sql,
+  ExecuteResult prepareAndExecute(StatementHandle h, String sql,
       int maxRowCount, PrepareCallback callback);
 
   /** Returns a frame of rows.

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/ec9d9660/avatica/src/main/java/org/apache/calcite/avatica/remote/LocalService.java
----------------------------------------------------------------------
diff --git a/avatica/src/main/java/org/apache/calcite/avatica/remote/LocalService.java b/avatica/src/main/java/org/apache/calcite/avatica/remote/LocalService.java
index ae4c9d0..f03d55b 100644
--- a/avatica/src/main/java/org/apache/calcite/avatica/remote/LocalService.java
+++ b/avatica/src/main/java/org/apache/calcite/avatica/remote/LocalService.java
@@ -67,7 +67,6 @@ public class LocalService implements Service {
       }
     } else {
       //noinspection unchecked
-      list = (List<Object>) (List) list2(resultSet);
       cursorFactory = Meta.CursorFactory.LIST;
     }
     Meta.Signature signature = resultSet.signature;
@@ -75,7 +74,7 @@ public class LocalService implements Service {
       signature = signature.setCursorFactory(cursorFactory);
     }
     return new ResultSetResponse(resultSet.connectionId, resultSet.statementId,
-        resultSet.ownStatement, signature, new Meta.Frame(0, true, list), -1);
+        resultSet.ownStatement, signature, resultSet.firstFrame, -1);
   }
 
   private List<List<Object>> list2(Meta.MetaResultSet resultSet) {
@@ -136,10 +135,10 @@ public class LocalService implements Service {
   }
 
   public ExecuteResponse apply(PrepareAndExecuteRequest request) {
-    final Meta.ConnectionHandle ch =
-        new Meta.ConnectionHandle(request.connectionId);
+    final Meta.StatementHandle sh =
+        new Meta.StatementHandle(request.connectionId, request.statementId, null);
     final Meta.ExecuteResult executeResult =
-        meta.prepareAndExecute(ch, request.sql, request.maxRowCount,
+        meta.prepareAndExecute(sh, request.sql, request.maxRowCount,
             new Meta.PrepareCallback() {
               @Override public Object getMonitor() {
                 return LocalService.class;

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/ec9d9660/avatica/src/main/java/org/apache/calcite/avatica/remote/RemoteMeta.java
----------------------------------------------------------------------
diff --git a/avatica/src/main/java/org/apache/calcite/avatica/remote/RemoteMeta.java b/avatica/src/main/java/org/apache/calcite/avatica/remote/RemoteMeta.java
index 456cf08..f0abe2d 100644
--- a/avatica/src/main/java/org/apache/calcite/avatica/remote/RemoteMeta.java
+++ b/avatica/src/main/java/org/apache/calcite/avatica/remote/RemoteMeta.java
@@ -165,15 +165,18 @@ class RemoteMeta extends MetaImpl {
     return response.statement;
   }
 
-  @Override public ExecuteResult prepareAndExecute(ConnectionHandle ch,
+  @Override public ExecuteResult prepareAndExecute(StatementHandle h,
       String sql, int maxRowCount, PrepareCallback callback) {
-    connectionSync(ch, new ConnectionPropertiesImpl()); // sync connection state if necessary
+    // sync connection state if necessary
+    connectionSync(new ConnectionHandle(h.connectionId),
+      new ConnectionPropertiesImpl());
     final Service.ExecuteResponse response;
     try {
       synchronized (callback.getMonitor()) {
         callback.clear();
         response = service.apply(
-            new Service.PrepareAndExecuteRequest(ch.id, sql, maxRowCount));
+            new Service.PrepareAndExecuteRequest(h.connectionId,
+              h.id, sql, maxRowCount));
         if (response.results.size() > 0) {
           final Service.ResultSetResponse result = response.results.get(0);
           callback.assign(result.signature, result.firstFrame,

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/ec9d9660/avatica/src/main/java/org/apache/calcite/avatica/remote/Service.java
----------------------------------------------------------------------
diff --git a/avatica/src/main/java/org/apache/calcite/avatica/remote/Service.java b/avatica/src/main/java/org/apache/calcite/avatica/remote/Service.java
index 951b34e..9a8b5da 100644
--- a/avatica/src/main/java/org/apache/calcite/avatica/remote/Service.java
+++ b/avatica/src/main/java/org/apache/calcite/avatica/remote/Service.java
@@ -241,18 +241,21 @@ public interface Service {
   }
 
   /** Request for
-   * {@link org.apache.calcite.avatica.Meta#prepareAndExecute(org.apache.calcite.avatica.Meta.ConnectionHandle, String, int, org.apache.calcite.avatica.Meta.PrepareCallback)}. */
+   * {@link org.apache.calcite.avatica.Meta#prepareAndExecute(Meta.StatementHandle, String, int, Meta.PrepareCallback)}. */
   class PrepareAndExecuteRequest extends Request {
     public final String connectionId;
     public final String sql;
     public final int maxRowCount;
+    public final int statementId;
 
     @JsonCreator
     public PrepareAndExecuteRequest(
         @JsonProperty("connectionId") String connectionId,
+        @JsonProperty("statementId") int statementId,
         @JsonProperty("sql") String sql,
         @JsonProperty("maxRowCount") int maxRowCount) {
       this.connectionId = connectionId;
+      this.statementId = statementId;
       this.sql = sql;
       this.maxRowCount = maxRowCount;
     }

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/ec9d9660/core/src/main/java/org/apache/calcite/jdbc/CalciteMetaImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/jdbc/CalciteMetaImpl.java b/core/src/main/java/org/apache/calcite/jdbc/CalciteMetaImpl.java
index c466819..332ed40 100644
--- a/core/src/main/java/org/apache/calcite/jdbc/CalciteMetaImpl.java
+++ b/core/src/main/java/org/apache/calcite/jdbc/CalciteMetaImpl.java
@@ -548,11 +548,9 @@ public class CalciteMetaImpl extends MetaImpl {
     return h;
   }
 
-  @Override public ExecuteResult prepareAndExecute(ConnectionHandle ch,
+  @Override public ExecuteResult prepareAndExecute(StatementHandle h,
       String sql, int maxRowCount, PrepareCallback callback) {
     final CalcitePrepare.CalciteSignature<Object> signature;
-    final StatementHandle h = createStatement(ch);
-
     try {
       synchronized (callback.getMonitor()) {
         callback.clear();
@@ -561,6 +559,7 @@ public class CalciteMetaImpl extends MetaImpl {
             calciteConnection.server.getStatement(h);
         signature = calciteConnection.parseQuery(sql,
             statement.createPrepareContext(), maxRowCount);
+        statement.setSignature(signature);
         callback.assign(signature, null, -1);
       }
       callback.execute();