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/03/23 09:11:45 UTC

[1/8] incubator-calcite git commit: Update history

Repository: incubator-calcite
Updated Branches:
  refs/heads/master 7d5c9a5a8 -> 60789a572


Update history


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

Branch: refs/heads/master
Commit: 3ee9b3a4ff6192c47590eff4d31e5cbe5e9ced8f
Parents: 7d5c9a5
Author: Julian Hyde <jh...@apache.org>
Authored: Tue Mar 10 23:23:33 2015 -0700
Committer: Julian Hyde <jh...@apache.org>
Committed: Fri Mar 13 11:33:28 2015 -0700

----------------------------------------------------------------------
 README         |  2 +-
 README.md      |  2 +-
 doc/HISTORY.md | 98 +++++++++++++++++++++++++++++++++++++++++++++++------
 doc/HOWTO.md   |  9 +++--
 4 files changed, 93 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/3ee9b3a4/README
----------------------------------------------------------------------
diff --git a/README b/README
index 2626fd2..be442ea 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-Apache Calcite release 1.0.0 (incubating)
+Apache Calcite release 1.1.0 (incubating)
 
 This is a source or binary distribution of Apache Calcite.
 

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/3ee9b3a4/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 40458ec..0f4f2a7 100644
--- a/README.md
+++ b/README.md
@@ -21,7 +21,7 @@ with the following Maven coordinates:
 <dependency>
   <groupId>org.apache.calcite</groupId>
   <artifactId>calcite-core</artifactId>
-  <version>1.0.0-incubating</version>
+  <version>1.1.0-incubating</version>
 </dependency>
 ```
 

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/3ee9b3a4/doc/HISTORY.md
----------------------------------------------------------------------
diff --git a/doc/HISTORY.md b/doc/HISTORY.md
index 9c7746b..f475529 100644
--- a/doc/HISTORY.md
+++ b/doc/HISTORY.md
@@ -3,13 +3,45 @@
 For a full list of releases, see
 <a href="https://github.com/apache/incubator-calcite/releases">github</a>.
 
-## Since the last release
+## <a href="https://github.com/apache/incubator-calcite/releases/tag/calcite-1.1.0-incubating">1.1.0-incubating</a> / 2015-03-13
 
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-586">CALCITE-586</a>]
-  Prevent JSON serialization of `Signature.internalParameters`
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-573">CALCITE-573</a>]
-  Use user-given names in `RelOptUtil.createProject` and `createRename`
-* Collation as a trait:
+This Calcite release makes it possible to exploit physical properties
+of relational expressions to produce more efficient plans, introducing
+collation and distribution as traits, `Exchange` relational operator,
+and several new forms of metadata.
+
+We add experimental support for streaming SQL.
+
+This release drops support for JDK 1.6; Calcite now requires 1.7 or
+later.
+
+We have introduced static `create` methods for many sub-classes of
+`RelNode`. We strongly suggest that you use these rather than
+calling constructors directly.
+
+New features
+* SQL
+  * [<a href="https://issues.apache.org/jira/browse/CALCITE-602">CALCITE-602</a>]
+    Streaming queries (experimental)
+  * [<a href="https://issues.apache.org/jira/browse/CALCITE-588">CALCITE-588</a>]
+    Allow `TableMacro` to consume maps and collections
+  * [<a href="https://issues.apache.org/jira/browse/CALCITE-583">CALCITE-583</a>]
+    Operator `||` mishandles `ANY` type (Sean Hsuan-Yi Chu)
+* Planner rule improvements
+  * [<a href="https://issues.apache.org/jira/browse/CALCITE-445">CALCITE-445</a>]
+    Pull up filters rejected by a `ProjectableFilterableTable`
+  * [<a href="https://issues.apache.org/jira/browse/CALCITE-600">CALCITE-600</a>]
+    Use `SetOpFactory` in rules containing `Union` operator (Jesus
+    Camacho Rodriguez)
+  * [<a href="https://issues.apache.org/jira/browse/CALCITE-603">CALCITE-603</a>]
+    Metadata providers for size, memory, parallelism
+    * [<a href="https://issues.apache.org/jira/browse/CALCITE-607">CALCITE-607</a>]
+      Change visibility of constructor in metadata providers for size,
+      memory, parallelism (Jesus Camacho Rodriguez)
+    * [<a href="https://issues.apache.org/jira/browse/CALCITE-608">CALCITE-608</a>]
+      Exception is thrown when `RelMdDistribution` for `Project`
+      operator is called (Jesus Camacho Rodriguez)
+* Collation and distribution as traits
   * [<a href="https://issues.apache.org/jira/browse/CALCITE-88">CALCITE-88</a>]
     Add collation as a trait and a kind of `RelNode` metadata
   * [<a href="https://issues.apache.org/jira/browse/CALCITE-569">CALCITE-569</a>]
@@ -17,17 +49,61 @@ For a full list of releases, see
   * [<a href="https://issues.apache.org/jira/browse/CALCITE-581">CALCITE-581</a>]
     Add `LogicalSort` relational expression, and make `Sort` abstract
   * [<a href="https://issues.apache.org/jira/browse/CALCITE-526">CALCITE-526</a>]
-    Add EnumerableMergeJoin, which exploits sorted inputs
+    Add `EnumerableMergeJoin`, which exploits sorted inputs
   * [<a href="https://issues.apache.org/jira/browse/CALCITE-71">CALCITE-71</a>]
     Provide a way to declare that tables are sorted
   * [<a href="https://issues.apache.org/jira/browse/CALCITE-576">CALCITE-576</a>]
-    Make RelCollation trait and AbstractRelNode.getCollationList consistent
+    Make `RelCollation` trait and `AbstractRelNode.getCollationList` consistent
   * [<a href="https://issues.apache.org/jira/browse/CALCITE-254">CALCITE-254</a>]
-    [CALCITE-254] Propagate RelCollation on aliased columns in JoinRule
+    Propagate `RelCollation` on aliased columns in `JoinRule`
   * [<a href="https://issues.apache.org/jira/browse/CALCITE-569">CALCITE-569</a>]
-    [CALCITE-569] ArrayIndexOutOfBoundsException when deducing collation
+    `ArrayIndexOutOfBoundsException` when deducing collation
+  * [<a href="https://issues.apache.org/jira/browse/CALCITE-594">CALCITE-594</a>]
+    Add `RelDistribution` trait and `Exchange` relational expression
+
+API changes
+* Many sub-classes of `RelNode` now have a static `create` method
+  which automatically sets up traits such as collation and
+  distribution. The constructors are not marked deprecated, but we
+  strongly suggest that you use the `create` method if it exists.
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-591">CALCITE-591</a>]
+  Drop support for Java 1.6 (and JDBC 4.0)
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-587">CALCITE-587</a>]
+  Upgrade `jetty-server` to 9.2.7.v20150116 and port avatica-server `HttpServer`
+  (Trevor Hartman)
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-577">CALCITE-577</a>]
+  Revert temporary API changes introduced in
+  [<a href="https://issues.apache.org/jira/browse/CALCITE-575">CALCITE-575</a>]
+* Add means to create `Context` instances by wrapping objects and by chaining
+  contexts
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-599">CALCITE-599</a>]
+  `EquiJoin` in wrong package (Jesus Camacho Rodriguez)
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-573">CALCITE-573</a>]
+  Use user-given names in `RelOptUtil.createProject` and `createRename`
 * [<a href="https://issues.apache.org/jira/browse/CALCITE-572">CALCITE-572</a>]
-  Remove `Project.flags`
+  Remove `Project.flags` (methods are deprecated, to be removed before 2.0)
+
+Bug-fixes and internal changes
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-615">CALCITE-615</a>]
+  AvaticaParameter should be Jackson serializable (Nick Dimiduk)
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-612">CALCITE-612</a>]
+  Update AvaticaStatement to handle cancelled queries (Parth Chandra)
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-605">CALCITE-605</a>]
+  Reduce dependency on third-party maven repositories
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-611">CALCITE-611</a>]
+  Method `setAggChildKeys` should take into account indicator columns of
+  `Aggregate` operator (Jesus Camacho Rodriguez)
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-566">CALCITE-566</a>]
+  `ReduceExpressionsRule` requires planner to have an `Executor`
+* Refactor `TableScanNode.create` method
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-593">CALCITE-593</a>]
+  Validator in `Frameworks` should expand identifiers (Jinfeng Ni)
+* Australian time-zones changed in `tzdata2014f`, Java 1.8.0_31
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-580">CALCITE-580</a>]
+  Average aggregation on an `Integer` column throws `ClassCastException`
+* In Travis, ask Surefire to print results to screen
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-586">CALCITE-586</a>]
+  Prevent JSON serialization of `Signature.internalParameters`
 
 ## <a href="https://github.com/apache/incubator-calcite/releases/tag/calcite-1.0.0-incubating">1.0.0-incubating</a> / 2015-01-31
 

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/3ee9b3a4/doc/HOWTO.md
----------------------------------------------------------------------
diff --git a/doc/HOWTO.md b/doc/HOWTO.md
index b4d69d0..a62ae5f 100644
--- a/doc/HOWTO.md
+++ b/doc/HOWTO.md
@@ -13,8 +13,8 @@ Unpack the source distribution `.tar.gz` or `.zip` file,
 then build using maven:
 
 ```bash
-$ tar xvfz calcite-1.0.0-incubating-source.tar.gz
-$ cd calcite-1.0.0-incubating
+$ tar xvfz calcite-1.1.0-incubating-source.tar.gz
+$ cd calcite-1.1.0-incubating
 $ mvn install
 ```
 
@@ -287,10 +287,10 @@ Before you start:
 * Make sure build and tests succeed with `-Dcalcite.test.db=hsqldb` (the default)
 
 ```bash
-# set passphrase variable without putting it into shell history
+# Set passphrase variable without putting it into shell history
 read -s GPG_PASSPHRASE
 
-# make sure that there are no junk files in the sandbox
+# Make sure that there are no junk files in the sandbox
 git clean -xn
 mvn clean
 
@@ -334,7 +334,6 @@ git clean -xn
 mvn clean
 
 # Do a dry run of the release:prepare step, which sets version numbers.
-mvn clean
 mvn -DdryRun=true -DskipTests -DreleaseVersion=X.Y.Z-incubating -DdevelopmentVersion=X.Y.Z+1-incubating-SNAPSHOT -Papache-release -Darguments="-Dgpg.passphrase=${GPG_PASSPHRASE}" release:prepare 2>&1 | tee /tmp/prepare-dry.log
 ```
 


[4/8] incubator-calcite git commit: [maven-release-plugin] prepare for next development iteration

Posted by jh...@apache.org.
[maven-release-plugin] prepare for next development iteration


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

Branch: refs/heads/master
Commit: 22f42e465b354da80843b5e8c101dc956a3be164
Parents: f10ea36
Author: Julian Hyde <jh...@apache.org>
Authored: Fri Mar 13 13:17:24 2015 -0700
Committer: Julian Hyde <jh...@apache.org>
Committed: Fri Mar 13 13:17:24 2015 -0700

----------------------------------------------------------------------
 avatica-server/pom.xml | 4 ++--
 avatica/pom.xml        | 4 ++--
 core/pom.xml           | 4 ++--
 example/csv/pom.xml    | 4 ++--
 example/pom.xml        | 4 ++--
 linq4j/pom.xml         | 4 ++--
 mongodb/pom.xml        | 4 ++--
 plus/pom.xml           | 4 ++--
 pom.xml                | 4 ++--
 spark/pom.xml          | 4 ++--
 splunk/pom.xml         | 4 ++--
 ubenchmark/pom.xml     | 2 +-
 12 files changed, 23 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/22f42e46/avatica-server/pom.xml
----------------------------------------------------------------------
diff --git a/avatica-server/pom.xml b/avatica-server/pom.xml
index 25ba46a..4b35978 100644
--- a/avatica-server/pom.xml
+++ b/avatica-server/pom.xml
@@ -20,12 +20,12 @@ limitations under the License.
   <parent>
     <groupId>org.apache.calcite</groupId>
     <artifactId>calcite</artifactId>
-    <version>1.1.0-incubating</version>
+    <version>1.2.0-incubating-SNAPSHOT</version>
   </parent>
 
   <artifactId>calcite-avatica-server</artifactId>
   <packaging>jar</packaging>
-  <version>1.1.0-incubating</version>
+  <version>1.2.0-incubating-SNAPSHOT</version>
   <name>Calcite Avatica Server</name>
   <description>JDBC server.</description>
 

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/22f42e46/avatica/pom.xml
----------------------------------------------------------------------
diff --git a/avatica/pom.xml b/avatica/pom.xml
index 3a54bea..071e1b1 100644
--- a/avatica/pom.xml
+++ b/avatica/pom.xml
@@ -20,12 +20,12 @@ limitations under the License.
   <parent>
     <groupId>org.apache.calcite</groupId>
     <artifactId>calcite</artifactId>
-    <version>1.1.0-incubating</version>
+    <version>1.2.0-incubating-SNAPSHOT</version>
   </parent>
 
   <artifactId>calcite-avatica</artifactId>
   <packaging>jar</packaging>
-  <version>1.1.0-incubating</version>
+  <version>1.2.0-incubating-SNAPSHOT</version>
   <name>Calcite Avatica</name>
   <description>JDBC driver framework.</description>
 

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/22f42e46/core/pom.xml
----------------------------------------------------------------------
diff --git a/core/pom.xml b/core/pom.xml
index 062477c..8c0c235 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -20,12 +20,12 @@ limitations under the License.
   <parent>
     <groupId>org.apache.calcite</groupId>
     <artifactId>calcite</artifactId>
-    <version>1.1.0-incubating</version>
+    <version>1.2.0-incubating-SNAPSHOT</version>
   </parent>
 
   <artifactId>calcite-core</artifactId>
   <packaging>jar</packaging>
-  <version>1.1.0-incubating</version>
+  <version>1.2.0-incubating-SNAPSHOT</version>
   <name>Calcite Core</name>
   <description>Core Calcite APIs and engine.</description>
 

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/22f42e46/example/csv/pom.xml
----------------------------------------------------------------------
diff --git a/example/csv/pom.xml b/example/csv/pom.xml
index 0e994bb..1704f0b 100644
--- a/example/csv/pom.xml
+++ b/example/csv/pom.xml
@@ -20,12 +20,12 @@ limitations under the License.
   <parent>
     <groupId>org.apache.calcite</groupId>
     <artifactId>calcite-example</artifactId>
-    <version>1.1.0-incubating</version>
+    <version>1.2.0-incubating-SNAPSHOT</version>
   </parent>
 
   <artifactId>calcite-example-csv</artifactId>
   <packaging>jar</packaging>
-  <version>1.1.0-incubating</version>
+  <version>1.2.0-incubating-SNAPSHOT</version>
   <name>Calcite Example CSV</name>
   <description>An example Calcite provider that reads CSV files</description>
 

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/22f42e46/example/pom.xml
----------------------------------------------------------------------
diff --git a/example/pom.xml b/example/pom.xml
index b8259c5..0d08d0f 100644
--- a/example/pom.xml
+++ b/example/pom.xml
@@ -20,13 +20,13 @@ limitations under the License.
   <parent>
     <groupId>org.apache.calcite</groupId>
     <artifactId>calcite</artifactId>
-    <version>1.1.0-incubating</version>
+    <version>1.2.0-incubating-SNAPSHOT</version>
   </parent>
 
   <!-- The basics. -->
   <artifactId>calcite-example</artifactId>
   <packaging>pom</packaging>
-  <version>1.1.0-incubating</version>
+  <version>1.2.0-incubating-SNAPSHOT</version>
   <name>Calcite Examples</name>
   <description>Calcite examples</description>
 

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/22f42e46/linq4j/pom.xml
----------------------------------------------------------------------
diff --git a/linq4j/pom.xml b/linq4j/pom.xml
index fc2e4cd..382f3ee 100644
--- a/linq4j/pom.xml
+++ b/linq4j/pom.xml
@@ -20,12 +20,12 @@ limitations under the License.
   <parent>
     <groupId>org.apache.calcite</groupId>
     <artifactId>calcite</artifactId>
-    <version>1.1.0-incubating</version>
+    <version>1.2.0-incubating-SNAPSHOT</version>
   </parent>
 
   <artifactId>calcite-linq4j</artifactId>
   <packaging>jar</packaging>
-  <version>1.1.0-incubating</version>
+  <version>1.2.0-incubating-SNAPSHOT</version>
   <name>Calcite Linq4j</name>
   <description>Calcite APIs for LINQ (Language-Integrated Query) in Java</description>
 

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/22f42e46/mongodb/pom.xml
----------------------------------------------------------------------
diff --git a/mongodb/pom.xml b/mongodb/pom.xml
index 9023fd0..b229e51 100644
--- a/mongodb/pom.xml
+++ b/mongodb/pom.xml
@@ -20,12 +20,12 @@ limitations under the License.
   <parent>
     <groupId>org.apache.calcite</groupId>
     <artifactId>calcite</artifactId>
-    <version>1.1.0-incubating</version>
+    <version>1.2.0-incubating-SNAPSHOT</version>
   </parent>
 
   <artifactId>calcite-mongodb</artifactId>
   <packaging>jar</packaging>
-  <version>1.1.0-incubating</version>
+  <version>1.2.0-incubating-SNAPSHOT</version>
   <name>Calcite MongoDB</name>
   <description>MongoDB adapter for Calcite</description>
 

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/22f42e46/plus/pom.xml
----------------------------------------------------------------------
diff --git a/plus/pom.xml b/plus/pom.xml
index 4466902..6eca39a 100644
--- a/plus/pom.xml
+++ b/plus/pom.xml
@@ -20,12 +20,12 @@ limitations under the License.
   <parent>
     <groupId>org.apache.calcite</groupId>
     <artifactId>calcite</artifactId>
-    <version>1.1.0-incubating</version>
+    <version>1.2.0-incubating-SNAPSHOT</version>
   </parent>
 
   <artifactId>calcite-plus</artifactId>
   <packaging>jar</packaging>
-  <version>1.1.0-incubating</version>
+  <version>1.2.0-incubating-SNAPSHOT</version>
   <name>Calcite Plus</name>
   <description>Miscellaneous extras for Calcite</description>
 

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/22f42e46/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 19208bc..28b9153 100644
--- a/pom.xml
+++ b/pom.xml
@@ -27,7 +27,7 @@ limitations under the License.
   <groupId>org.apache.calcite</groupId>
   <artifactId>calcite</artifactId>
   <packaging>pom</packaging>
-  <version>1.1.0-incubating</version>
+  <version>1.2.0-incubating-SNAPSHOT</version>
 
   <!-- More project information. -->
   <name>Calcite</name>
@@ -61,7 +61,7 @@ limitations under the License.
     <connection>scm:git:https://git-wip-us.apache.org/repos/asf/incubator-calcite.git</connection>
     <developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/incubator-calcite.git</developerConnection>
     <url>https://github.com/apache/incubator-calcite</url>
-    <tag>calcite-1.1.0-incubating</tag>
+    <tag>HEAD</tag>
   </scm>
 
   <modules>

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/22f42e46/spark/pom.xml
----------------------------------------------------------------------
diff --git a/spark/pom.xml b/spark/pom.xml
index 36d27eb..8d86d9a 100644
--- a/spark/pom.xml
+++ b/spark/pom.xml
@@ -20,12 +20,12 @@ limitations under the License.
   <parent>
     <groupId>org.apache.calcite</groupId>
     <artifactId>calcite</artifactId>
-    <version>1.1.0-incubating</version>
+    <version>1.2.0-incubating-SNAPSHOT</version>
   </parent>
 
   <artifactId>calcite-spark</artifactId>
   <packaging>jar</packaging>
-  <version>1.1.0-incubating</version>
+  <version>1.2.0-incubating-SNAPSHOT</version>
   <name>Calcite Spark</name>
 
   <properties>

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/22f42e46/splunk/pom.xml
----------------------------------------------------------------------
diff --git a/splunk/pom.xml b/splunk/pom.xml
index 588c54c..3d331f4 100644
--- a/splunk/pom.xml
+++ b/splunk/pom.xml
@@ -20,12 +20,12 @@ limitations under the License.
   <parent>
     <groupId>org.apache.calcite</groupId>
     <artifactId>calcite</artifactId>
-    <version>1.1.0-incubating</version>
+    <version>1.2.0-incubating-SNAPSHOT</version>
   </parent>
 
   <artifactId>calcite-splunk</artifactId>
   <packaging>jar</packaging>
-  <version>1.1.0-incubating</version>
+  <version>1.2.0-incubating-SNAPSHOT</version>
   <name>Calcite Splunk</name>
   <description>Splunk adapter for Calcite; also a JDBC driver for Splunk</description>
 

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/22f42e46/ubenchmark/pom.xml
----------------------------------------------------------------------
diff --git a/ubenchmark/pom.xml b/ubenchmark/pom.xml
index 378830b..9b46595 100644
--- a/ubenchmark/pom.xml
+++ b/ubenchmark/pom.xml
@@ -20,7 +20,7 @@ limitations under the License.
   <parent>
     <groupId>org.apache.calcite</groupId>
     <artifactId>calcite</artifactId>
-    <version>1.1.0-incubating</version>
+    <version>1.2.0-incubating-SNAPSHOT</version>
   </parent>
 
   <properties>


[7/8] incubator-calcite git commit: [CALCITE-633] WITH ... ORDER BY cannot find table

Posted by jh...@apache.org.
[CALCITE-633] WITH ... ORDER BY cannot find table


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

Branch: refs/heads/master
Commit: 3807827b849dbdb8e58f8319e04823c69bfe7256
Parents: 321217d
Author: Julian Hyde <jh...@apache.org>
Authored: Thu Mar 19 16:17:37 2015 -0700
Committer: Julian Hyde <jh...@apache.org>
Committed: Thu Mar 19 16:17:37 2015 -0700

----------------------------------------------------------------------
 .../calcite/sql/validate/SqlValidatorImpl.java     | 15 +++++++++++++++
 .../org/apache/calcite/test/SqlValidatorTest.java  | 14 ++++++++++++++
 .../apache/calcite/test/SqlToRelConverterTest.xml  |  3 +--
 core/src/test/resources/sql/sort.oq                | 17 +++++++++++++++++
 4 files changed, 47 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/3807827b/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java b/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java
index 44147ba..a0e7fdd 100644
--- a/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java
+++ b/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java
@@ -1039,6 +1039,21 @@ public class SqlValidatorImpl implements SqlValidatorWithHints {
           return select;
         }
       }
+      if (orderBy.query instanceof SqlWith
+          && ((SqlWith) orderBy.query).body instanceof SqlSelect) {
+        SqlWith with = (SqlWith) orderBy.query;
+        SqlSelect select = (SqlSelect) with.body;
+
+        // Don't clobber existing ORDER BY.  It may be needed for
+        // an order-sensitive function like RANK.
+        if (select.getOrderList() == null) {
+          // push ORDER BY into existing select
+          select.setOrderBy(orderBy.orderList);
+          select.setOffset(orderBy.offset);
+          select.setFetch(orderBy.fetch);
+          return with;
+        }
+      }
       final SqlNodeList selectList = new SqlNodeList(SqlParserPos.ZERO);
       selectList.add(new SqlIdentifier("*", SqlParserPos.ZERO));
       final SqlNodeList orderList;

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/3807827b/core/src/test/java/org/apache/calcite/test/SqlValidatorTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/test/SqlValidatorTest.java b/core/src/test/java/org/apache/calcite/test/SqlValidatorTest.java
index d304ff5..157e12e 100644
--- a/core/src/test/java/org/apache/calcite/test/SqlValidatorTest.java
+++ b/core/src/test/java/org/apache/calcite/test/SqlValidatorTest.java
@@ -5619,6 +5619,20 @@ public class SqlValidatorTest extends SqlValidatorTestCase {
         "(?s)Cannot apply '\\+' to arguments of type '<CHAR\\(3\\)> \\+ <INTEGER>'\\..*");
   }
 
+  @Test public void testOrderJoin() {
+    sql("select * from emp as e, dept as d order by e.empno").ok();
+  }
+
+  /** Test case for
+   * <a href="https://issues.apache.org/jira/browse/CALCITE-633">[CALCITE-633],
+   * WITH ... ORDER BY cannot find table</a>. */
+  @Test public void testWithOrder() {
+    sql("with e as (select * from emp)\n"
+            + "select * from e as e1 order by e1.empno").ok();
+    sql("with e as (select * from emp)\n"
+            + "select * from e as e1, e as e2 order by e1.empno").ok();
+  }
+
   @Test public void testOrderUnion() {
     check("select empno, sal from emp "
         + "union all "

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/3807827b/core/src/test/resources/org/apache/calcite/test/SqlToRelConverterTest.xml
----------------------------------------------------------------------
diff --git a/core/src/test/resources/org/apache/calcite/test/SqlToRelConverterTest.xml b/core/src/test/resources/org/apache/calcite/test/SqlToRelConverterTest.xml
index 3cfde9d..2d85361 100644
--- a/core/src/test/resources/org/apache/calcite/test/SqlToRelConverterTest.xml
+++ b/core/src/test/resources/org/apache/calcite/test/SqlToRelConverterTest.xml
@@ -1910,8 +1910,7 @@ select * from emp2 order by deptno]]>
 LogicalSort(sort0=[$7], dir0=[ASC])
   LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])
     LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])
-      LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])
-        LogicalTableScan(table=[[CATALOG, SALES, EMP]])
+      LogicalTableScan(table=[[CATALOG, SALES, EMP]])
 ]]>
         </Resource>
     </TestCase>

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/3807827b/core/src/test/resources/sql/sort.oq
----------------------------------------------------------------------
diff --git a/core/src/test/resources/sql/sort.oq b/core/src/test/resources/sql/sort.oq
index df6e385..7d445dc 100644
--- a/core/src/test/resources/sql/sort.oq
+++ b/core/src/test/resources/sql/sort.oq
@@ -68,4 +68,21 @@ EnumerableCalc(expr#0..1=[{inputs}], expr#2=[2], expr#3=[>=($t0, $t2)], expr#4=[
   EnumerableTableScan(table=[[foodmart2, days]])
 !plan
 
+!use post
+
+# [CALCITE-603] WITH ... ORDER BY cannot find table
+with e as (select "empid" as empid from "hr"."emps" where "empid" < 120)
+select * from e as e1, e as e2 order by e1.empid + e2.empid, e1.empid;
++-------+--------+
+| EMPID | EMPID0 |
++-------+--------+
+|   100 |    100 |
+|   100 |    110 |
+|   110 |    100 |
+|   110 |    110 |
++-------+--------+
+(4 rows)
+
+!ok
+
 # End sort.oq


[6/8] incubator-calcite git commit: [CALCITE-614] IN clause in CASE in GROUP BY gives AssertionError

Posted by jh...@apache.org.
[CALCITE-614] IN clause in CASE in GROUP BY gives AssertionError


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

Branch: refs/heads/master
Commit: 321217ddd6629fda3e2620c39283c415724c123e
Parents: 119a399
Author: Julian Hyde <jh...@apache.org>
Authored: Mon Mar 16 13:40:35 2015 -0700
Committer: Julian Hyde <jh...@apache.org>
Committed: Tue Mar 17 19:44:13 2015 -0700

----------------------------------------------------------------------
 .../calcite/sql2rel/SqlToRelConverter.java      | 38 ++++++++------------
 .../calcite/test/SqlToRelConverterTest.java     | 27 ++++++++++----
 .../calcite/test/SqlToRelConverterTest.xml      | 33 ++++++++++-------
 3 files changed, 56 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/321217dd/core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java b/core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java
index 207b2dc..7fadfa0 100644
--- a/core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java
+++ b/core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java
@@ -4004,6 +4004,11 @@ public class SqlToRelConverter {
     }
 
     void registerSubquery(SqlNode node, RelOptUtil.Logic logic) {
+      for (SubQuery subQuery : subqueryList) {
+        if (node.equalsDeep(subQuery.node, false)) {
+          return;
+        }
+      }
       subqueryList.add(new SubQuery(node, logic));
     }
 
@@ -4039,14 +4044,19 @@ public class SqlToRelConverter {
         return rex;
       }
 
-      boolean needTruthTest;
-
       // Sub-queries and OVER expressions are not like ordinary
       // expressions.
       final SqlKind kind = expr.getKind();
       final SubQuery subQuery;
       switch (kind) {
       case CURSOR:
+      case IN:
+        subQuery = subqueryMap.get(expr);
+        assert subQuery != null;
+        rex = subQuery.expr;
+        assert rex != null : "rex != null";
+        return rex;
+
       case SELECT:
       case EXISTS:
       case SCALAR_QUERY:
@@ -4055,10 +4065,6 @@ public class SqlToRelConverter {
         rex = subQuery.expr;
         assert rex != null : "rex != null";
 
-        if (kind == SqlKind.CURSOR) {
-          // cursor reference is pre-baked
-          return rex;
-        }
         if (((kind == SqlKind.SCALAR_QUERY)
             || (kind == SqlKind.EXISTS))
             && isConvertedSubq(rex)) {
@@ -4067,11 +4073,8 @@ public class SqlToRelConverter {
           return rex;
         }
 
-        RexNode fieldAccess;
-        needTruthTest = false;
-
         // The indicator column is the last field of the subquery.
-        fieldAccess =
+        RexNode fieldAccess =
             rexBuilder.makeFieldAccess(
                 rex,
                 rex.getType().getFieldCount() - 1);
@@ -4079,13 +4082,8 @@ public class SqlToRelConverter {
         // The indicator column will be nullable if it comes from
         // the null-generating side of the join. For EXISTS, add an
         // "IS TRUE" check so that the result is "BOOLEAN NOT NULL".
-        if (fieldAccess.getType().isNullable()) {
-          if (kind == SqlKind.EXISTS) {
-            needTruthTest = true;
-          }
-        }
-
-        if (needTruthTest) {
+        if (fieldAccess.getType().isNullable()
+            && kind == SqlKind.EXISTS) {
           fieldAccess =
               rexBuilder.makeCall(
                   SqlStdOperatorTable.IS_NOT_NULL,
@@ -4093,12 +4091,6 @@ public class SqlToRelConverter {
         }
         return fieldAccess;
 
-      case IN:
-        subQuery = subqueryMap.get(expr);
-        assert subQuery != null;
-        assert subQuery.expr != null : "expr != null";
-        return subQuery.expr;
-
       case OVER:
         return convertOver(this, expr);
 

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/321217dd/core/src/test/java/org/apache/calcite/test/SqlToRelConverterTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/test/SqlToRelConverterTest.java b/core/src/test/java/org/apache/calcite/test/SqlToRelConverterTest.java
index 04fd420..c19ec03 100644
--- a/core/src/test/java/org/apache/calcite/test/SqlToRelConverterTest.java
+++ b/core/src/test/java/org/apache/calcite/test/SqlToRelConverterTest.java
@@ -97,8 +97,8 @@ public class SqlToRelConverterTest extends SqlToRelTestBase {
 
   /**
    * Test case for
-   * <a href="https://issues.apache.org/jira/browse/CALCITE-245">CALCITE-245</a>,
-   * "Off-by-one translation of ON clause of JOIN".
+   * <a href="https://issues.apache.org/jira/browse/CALCITE-245">[CALCITE-245]
+   * Off-by-one translation of ON clause of JOIN</a>.
    */
   @Test public void testConditionOffByOne() {
     // Bug causes the plan to contain
@@ -132,8 +132,9 @@ public class SqlToRelConverterTest extends SqlToRelTestBase {
   }
 
   /** Test case for
-   * <a href="https://issues.apache.org/jira/browse/CALCITE-74">CALCITE-74</a>,
-   * "JOIN ... USING fails in 3-way join with UnsupportedOperationException". */
+   * <a href="https://issues.apache.org/jira/browse/CALCITE-74">[CALCITE-74]
+   * JOIN ... USING fails in 3-way join with
+   * UnsupportedOperationException</a>. */
   @Test public void testJoinUsingThreeWay() {
     check(
         "select *\n"
@@ -1081,9 +1082,9 @@ public class SqlToRelConverterTest extends SqlToRelTestBase {
   }
 
   /** Test case for
-   * <a href="https://issues.apache.org/jira/browse/CALCITE-412">CALCITE-412</a>,
-   * "RelFieldTrimmer: when trimming Sort, the collation and trait set don't
-   * match". */
+   * <a href="https://issues.apache.org/jira/browse/CALCITE-412">[CALCITE-412]
+   * RelFieldTrimmer: when trimming Sort, the collation and trait set don't
+   * match</a>. */
   @Test public void testSortWithTrim() {
     tester.assertConvertsTo(
         "select ename from (select * from emp order by sal) a", "${plan}",
@@ -1124,6 +1125,18 @@ public class SqlToRelConverterTest extends SqlToRelTestBase {
   }
 
   /**
+   * Test case for
+   * <a href="https://issues.apache.org/jira/browse/CALCITE-614">[CALCITE-614]
+   * IN within CASE within GROUP BY gives AssertionError</a>.
+   */
+  @Test public void testGroupByCaseIn() {
+    sql("select (CASE WHEN (deptno IN (10, 20)) THEN 0 ELSE deptno END),\n"
+        + " min(empno) from EMP\n"
+        + "group by (CASE WHEN (deptno IN (10, 20)) THEN 0 ELSE deptno END)")
+        .convertsTo("${plan}");
+  }
+
+  /**
    * Visitor that checks that every {@link RelNode} in a tree is valid.
    *
    * @see RelNode#isValid(boolean)

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/321217dd/core/src/test/resources/org/apache/calcite/test/SqlToRelConverterTest.xml
----------------------------------------------------------------------
diff --git a/core/src/test/resources/org/apache/calcite/test/SqlToRelConverterTest.xml b/core/src/test/resources/org/apache/calcite/test/SqlToRelConverterTest.xml
index 6566401..3cfde9d 100644
--- a/core/src/test/resources/org/apache/calcite/test/SqlToRelConverterTest.xml
+++ b/core/src/test/resources/org/apache/calcite/test/SqlToRelConverterTest.xml
@@ -2342,18 +2342,13 @@ FROM emp]]>
         </Resource>
         <Resource name="plan">
             <![CDATA[
-LogicalProject(EXPR$0=[$0])
-  LogicalJoin(condition=[true], joinType=[left])
-    LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])
-      LogicalProject(EXPR$0=[$9])
-        LogicalJoin(condition=[true], joinType=[left])
-          LogicalTableScan(table=[[CATALOG, SALES, EMP]])
-          LogicalAggregate(group=[{}], EXPR$0=[MIN($0)])
-            LogicalProject(DEPTNO=[$0])
-              LogicalTableScan(table=[[CATALOG, SALES, DEPT]])
-    LogicalAggregate(group=[{}], EXPR$0=[MIN($0)])
-      LogicalProject(DEPTNO=[$0])
-        LogicalTableScan(table=[[CATALOG, SALES, DEPT]])
+LogicalAggregate(group=[{}], EXPR$0=[SUM($0)])
+  LogicalProject(EXPR$0=[$9])
+    LogicalJoin(condition=[true], joinType=[left])
+      LogicalTableScan(table=[[CATALOG, SALES, EMP]])
+      LogicalAggregate(group=[{}], EXPR$0=[MIN($0)])
+        LogicalProject(DEPTNO=[$0])
+          LogicalTableScan(table=[[CATALOG, SALES, DEPT]])
 ]]>
         </Resource>
     </TestCase>
@@ -2401,4 +2396,18 @@ LogicalDelta
 ]]>
         </Resource>
     </TestCase>
+    <TestCase name="testGroupByCaseIn">
+        <Resource name="sql">
+            <![CDATA[select (CASE WHEN (deptno IN (10, 20)) THEN 0 ELSE deptno END),
+ min(empno) from EMP
+group by (CASE WHEN (deptno IN (10, 20)) THEN 0 ELSE deptno END)]]>
+        </Resource>
+        <Resource name="plan">
+            <![CDATA[
+LogicalAggregate(group=[{0}], EXPR$1=[MIN($1)])
+  LogicalProject(EXPR$0=[CASE(OR(=($7, 10), =($7, 20)), 0, $7)], EMPNO=[$0])
+    LogicalTableScan(table=[[CATALOG, SALES, EMP]])
+]]>
+        </Resource>
+    </TestCase>
 </Root>


[2/8] incubator-calcite git commit: Remove the LICENSE file of example-csv (formerly optiq-csv) and move its history into main history

Posted by jh...@apache.org.
Remove the LICENSE file of example-csv (formerly optiq-csv) and move its history into main history


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

Branch: refs/heads/master
Commit: 4494272696521f5cd97e58933b2e8d155de9ddaf
Parents: 3ee9b3a
Author: Julian Hyde <jh...@apache.org>
Authored: Fri Mar 13 12:20:52 2015 -0700
Committer: Julian Hyde <jh...@apache.org>
Committed: Fri Mar 13 13:10:33 2015 -0700

----------------------------------------------------------------------
 doc/HISTORY.md         |  62 ++++++++++++++
 example/csv/HISTORY.md |  53 ------------
 example/csv/LICENSE    | 202 --------------------------------------------
 3 files changed, 62 insertions(+), 255 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/44942726/doc/HISTORY.md
----------------------------------------------------------------------
diff --git a/doc/HISTORY.md b/doc/HISTORY.md
index f475529..c4bb741 100644
--- a/doc/HISTORY.md
+++ b/doc/HISTORY.md
@@ -84,6 +84,8 @@ API changes
   Remove `Project.flags` (methods are deprecated, to be removed before 2.0)
 
 Bug-fixes and internal changes
+* Remove the `LICENSE` file of calcite-example-csv (the former
+  optiq-csv) and move its history into main history
 * [<a href="https://issues.apache.org/jira/browse/CALCITE-615">CALCITE-615</a>]
   AvaticaParameter should be Jackson serializable (Nick Dimiduk)
 * [<a href="https://issues.apache.org/jira/browse/CALCITE-612">CALCITE-612</a>]
@@ -1198,6 +1200,66 @@ Other
   <a href="REFERENCE.md">SQL language reference</a> and
   <a href="MODEL.md">JSON model reference</a>.
 
+# Optiq-csv release history
+
+Optiq-csv-0.3 was the last independent release of optiq-csv. From
+calcite-0.9.2 onwards, the code was included as the
+calcite-example-csv module.
+
+* Upgrade to calcite-0.9.1
+* Support gzip-compressed CSV and JSON files (recognized by '.gz' suffix)
+* Cleanup, and fix minor timezone issue in a test
+* Support for date types (date, time, timestamp) (Martijn van den Broek)
+* Upgrade to optiq-0.8, optiq-avatica-0.8, linq4j-0.4
+* Add support for JSON files (recognized by '.json' suffix)
+* Upgrade maven-release-plugin to version 2.4.2
+* Upgrade to optiq-0.6, linq4j-0.2
+* Add NOTICE and LICENSE files in generated JAR file
+
+## <a href="https://github.com/julianhyde/optiq-csv/releases/tag/optiq-csv-0.3">0.3</a> / 2014-03-21
+
+* Upgrade to optiq-0.5
+* Add workaround to
+  [<a href="https://github.com/jline/jline2/issues/62">JLINE2-62</a>]
+  to `sqlline.bat` (windows) and `sqlline` (windows using cygwin)
+* Fix classpath construction: `sqlline.bat` copies dependencies to
+  `target/dependencies`; `sqlline` constructs `target/classpath.txt`
+* Build, checkstyle and tests now succeed on windows (both native and cygwin)
+* Models can now contain comments
+* [<a href="https://github.com/julianhyde/optiq-csv/issues/2">OPTIQ-CSV-2</a>]
+  Update tutorial to reflect changes to Optiq's JDBC adapter
+
+## <a href="https://github.com/julianhyde/optiq-csv/releases/tag/optiq-csv-0.2">0.2</a> / 2014-02-18
+
+* Add test case for
+  [<a href="https://issues.apache.org/jira/browse/CALCITE-112">CALCITE-112</a>]
+* Add `sqlline.bat`, Windows SQL shell (based on fix for
+  [<a href="https://issues.apache.org/jira/browse/DRILL-338">DRILL-338</a>])
+* Upgrade to optiq-0.4.18, sqlline-1.1.7
+* Return a single object for single-col enumerator (Gabriel Reid)
+* Enable maven-checkstyle-plugin; fix checkstyle exceptions
+
+## <a href="https://github.com/julianhyde/optiq-csv/releases/tag/optiq-csv-0.1">0.1</a> / 2014-01-13
+
+* Add release notes and history
+* Enable maven-release-plugin
+* Upgrade to optiq-0.4.17, linq4j-0.1.12, sqlline-1.1.6
+* Upgrade tutorial for new Schema and Table SPIs
+* Fixes for optiq SPI changes in
+  [<a href="https://issues.apache.org/jira/browse/CALCITE-106">CALCITE-106</a>]
+* Enable oraclejdk8 in Travis CI
+* Fix bug where non-existent directory would give NPE; instead print warning
+* Add an example of a planner rule
+* Add `CsvTableFactory`, an example of a custom table
+* Add a view to tutorial
+* Split into scenario with a "simple" schema that generates tables
+  (`CsvTable`) that just execute and a "smart" schema that generates
+  tables (`CsvSmartTable`) that undergo optimization
+* Make `CsvEnumerator` a top-level class
+* Implement the algorithms to sniff names and types from the first
+  row, and to return an enumerator of all rows
+* Read column types from header of CSV file
+
 # Linq4j release history
 
 Linq4j-0.4 was the last independent release of linq4j. From

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/44942726/example/csv/HISTORY.md
----------------------------------------------------------------------
diff --git a/example/csv/HISTORY.md b/example/csv/HISTORY.md
deleted file mode 100644
index 3f77928..0000000
--- a/example/csv/HISTORY.md
+++ /dev/null
@@ -1,53 +0,0 @@
-# Optiq-csv release history
-
-For a full list of releases, see
-<a href="https://github.com/julianhyde/optiq-csv/releases">github</a>.
-
-## HEAD
-
-* Upgrade to calcite-0.9.1.
-* Support gzip-compressed CSV and JSON files (recognized by '.gz' suffix).
-* Cleanup, and fix minor timezone issue in a test.
-* Support for date types (date, time, timestamp) (Martijn van den Broek)
-* Upgrade to optiq-0.8, optiq-avatica-0.8, linq4j-0.4.
-* Add support for JSON files (recognized by '.json' suffix).
-* Upgrade maven-release-plugin to version 2.4.2.
-* Upgrade to optiq-0.6, linq4j-0.2.
-* Add NOTICE and LICENSE files in generated JAR file.
-
-## <a href="https://github.com/julianhyde/optiq-csv/releases/tag/optiq-csv-0.3">0.3</a> / 2014-03-21
-
-* Upgrade to optiq-0.5.
-* Add workaround to
-  <a href="https://github.com/jline/jline2/issues/62">jline2 #62</a>
-  to `sqlline.bat` (windows) and `sqlline` (windows using cygwin).
-* Fix classpath construction: `sqlline.bat` copies dependencies to `target/dependencies`; `sqlline` constructs `target/classpath.txt`.
-* Build, checkstyle and tests now succeed on windows (both native and cygwin).
-* Models can now contain comments.
-* Fix <a href="https://github.com/julianhyde/optiq-csv/issues/2">#2</a>,
-  "Update tutorial to reflect changes to Optiq's JDBC adapter".
-
-## <a href="https://github.com/julianhyde/optiq-csv/releases/tag/optiq-csv-0.2">0.2</a> / 2014-02-18
-
-* Add test case for <a href="https://github.com/julianhyde/optiq/issues/112">optiq-112</a>.
-* Add `sqlline.bat`, Windows SQL shell. (Based on fix for <a href="https://issues.apache.org/jira/browse/DRILL-338">DRILL-338</a>.)
-* Upgrade to optiq-0.4.18, sqlline-1.1.7.
-* Return a single object for single-col enumerator (Gabriel Reid)
-* Enable maven-checkstyle-plugin; fix checkstyle exceptions.
-
-## <a href="https://github.com/julianhyde/optiq-csv/releases/tag/optiq-csv-0.1">0.1</a> / 2014-01-13
-
-* Add release notes and history.
-* Enable maven-release-plugin.
-* Upgrade to optiq-0.4.17, linq4j-0.1.12, sqlline-1.1.6.
-* Upgrade tutorial for new Schema and Table SPIs.
-* Fixes for optiq SPI changes in <a href="https://github.com/julianhyde/optiq/issues/106">optiq-106</a>.
-* Enable oraclejdk8 in Travis CI.
-* Fix bug where non-existent directory would give NPE. Instead print warning.
-* Add an example of a planner rule.
-* Add CsvTableFactory, an example of a custom table.
-* Add a view to tutorial.
-* Split into scenario with a "simple" schema that generates tables (CsvTable) that just execute and a "smart" schema that generates tables (CsvSmartTable) that undergo optimization.
-* Make CsvEnumerator a top-level class.
-* Implement the algorithms to sniff names and types from the first row, and to return an enumerator of all rows.
-* Read column types from header of CSV file.

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/44942726/example/csv/LICENSE
----------------------------------------------------------------------
diff --git a/example/csv/LICENSE b/example/csv/LICENSE
deleted file mode 100644
index d645695..0000000
--- a/example/csv/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   Licensed 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.


[5/8] incubator-calcite git commit: [CALCITE-619] Slim down dependencies in parent POM

Posted by jh...@apache.org.
[CALCITE-619] Slim down dependencies in parent POM

Remove dependency of Avatica on Guava


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

Branch: refs/heads/master
Commit: 119a39931df38e92cacc25973c46154549247061
Parents: 22f42e4
Author: Julian Hyde <jh...@apache.org>
Authored: Fri Mar 13 15:43:08 2015 -0700
Committer: Julian Hyde <jh...@apache.org>
Committed: Tue Mar 17 19:44:00 2015 -0700

----------------------------------------------------------------------
 avatica/pom.xml                                 |  14 ++
 .../calcite/avatica/AvaticaConnection.java      |  11 +-
 .../apache/calcite/avatica/AvaticaFactory.java  |   5 +-
 .../calcite/avatica/AvaticaStatement.java       |   5 +-
 core/pom.xml                                    |  56 ++++++
 example/csv/pom.xml                             |  18 +-
 linq4j/pom.xml                                  |  12 ++
 mongodb/pom.xml                                 |  13 ++
 plus/pom.xml                                    |  13 ++
 pom.xml                                         | 175 +++++++++----------
 spark/pom.xml                                   |   8 +
 splunk/pom.xml                                  |  13 ++
 ubenchmark/pom.xml                              |   4 +
 13 files changed, 236 insertions(+), 111 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/119a3993/avatica/pom.xml
----------------------------------------------------------------------
diff --git a/avatica/pom.xml b/avatica/pom.xml
index 071e1b1..58aec3c 100644
--- a/avatica/pom.xml
+++ b/avatica/pom.xml
@@ -33,6 +33,20 @@ limitations under the License.
     <top.dir>${project.basedir}/..</top.dir>
   </properties>
 
+  <dependencies>
+    <!-- Make sure that there are no dependencies on other calcite modules,
+         or on libraries other than Jackson. -->
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-databind</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
   <build>
     <plugins>
       <plugin>

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/119a3993/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 e7c4a5f..492ec5f 100644
--- a/avatica/src/main/java/org/apache/calcite/avatica/AvaticaConnection.java
+++ b/avatica/src/main/java/org/apache/calcite/avatica/AvaticaConnection.java
@@ -16,9 +16,6 @@
  */
 package org.apache.calcite.avatica;
 
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Maps;
-
 import java.sql.Array;
 import java.sql.Blob;
 import java.sql.CallableStatement;
@@ -38,6 +35,7 @@ import java.sql.Struct;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Properties;
 import java.util.TimeZone;
 import java.util.concurrent.Executor;
@@ -67,9 +65,8 @@ public abstract class AvaticaConnection implements Connection {
   private String schema;
   protected final AvaticaDatabaseMetaData metaData;
   public final Helper helper = Helper.INSTANCE;
-  public final Map<InternalProperty, Object> properties =
-      new HashMap<InternalProperty, Object>();
-  public final Map<Integer, AvaticaStatement> statementMap = Maps.newHashMap();
+  public final Map<InternalProperty, Object> properties = new HashMap<>();
+  public final Map<Integer, AvaticaStatement> statementMap = new HashMap<>();
 
   private static int nextId;
 
@@ -483,7 +480,7 @@ public abstract class AvaticaConnection implements Connection {
       return statement;
     }
     //noinspection MagicConstant
-    return factory.newStatement(this, Preconditions.checkNotNull(h),
+    return factory.newStatement(this, Objects.requireNonNull(h),
         ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, holdability);
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/119a3993/avatica/src/main/java/org/apache/calcite/avatica/AvaticaFactory.java
----------------------------------------------------------------------
diff --git a/avatica/src/main/java/org/apache/calcite/avatica/AvaticaFactory.java b/avatica/src/main/java/org/apache/calcite/avatica/AvaticaFactory.java
index 34ed9ed..0139ef3 100644
--- a/avatica/src/main/java/org/apache/calcite/avatica/AvaticaFactory.java
+++ b/avatica/src/main/java/org/apache/calcite/avatica/AvaticaFactory.java
@@ -20,7 +20,6 @@ import java.sql.ResultSetMetaData;
 import java.sql.SQLException;
 import java.util.Properties;
 import java.util.TimeZone;
-import javax.annotation.Nullable;
 
 /**
  * Factory for JDBC objects.
@@ -39,11 +38,11 @@ public interface AvaticaFactory {
       Properties info) throws SQLException;
 
   AvaticaStatement newStatement(AvaticaConnection connection,
-      @Nullable Meta.StatementHandle h, int resultSetType,
+      /*@Nullable*/ Meta.StatementHandle h, int resultSetType,
       int resultSetConcurrency, int resultSetHoldability) throws SQLException;
 
   AvaticaPreparedStatement newPreparedStatement(AvaticaConnection connection,
-      @Nullable Meta.StatementHandle h, Meta.Signature signature,
+      /*@Nullable*/ Meta.StatementHandle h, Meta.Signature signature,
       int resultSetType, int resultSetConcurrency, int resultSetHoldability)
       throws SQLException;
 

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/119a3993/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 37242c2..fb0a6f5 100644
--- a/avatica/src/main/java/org/apache/calcite/avatica/AvaticaStatement.java
+++ b/avatica/src/main/java/org/apache/calcite/avatica/AvaticaStatement.java
@@ -16,14 +16,13 @@
  */
 package org.apache.calcite.avatica;
 
-import com.google.common.base.Preconditions;
-
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.SQLWarning;
 import java.sql.Statement;
 import java.util.Collections;
 import java.util.List;
+import java.util.Objects;
 
 /**
  * Implementation of {@link java.sql.Statement}
@@ -68,7 +67,7 @@ public abstract class AvaticaStatement
   protected AvaticaStatement(AvaticaConnection connection,
       Meta.StatementHandle h, int resultSetType, int resultSetConcurrency,
       int resultSetHoldability) {
-    this.connection = Preconditions.checkNotNull(connection);
+    this.connection = Objects.requireNonNull(connection);
     this.resultSetType = resultSetType;
     this.resultSetConcurrency = resultSetConcurrency;
     this.resultSetHoldability = resultSetHoldability;

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/119a3993/core/pom.xml
----------------------------------------------------------------------
diff --git a/core/pom.xml b/core/pom.xml
index 8c0c235..36a88f5 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -50,6 +50,62 @@ limitations under the License.
       <artifactId>calcite-avatica-server</artifactId>
       <scope>test</scope>
     </dependency>
+
+    <dependency>
+      <groupId>commons-dbcp</groupId>
+      <artifactId>commons-dbcp</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-databind</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>mysql</groupId>
+      <artifactId>mysql-connector-java</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>net.hydromatic</groupId>
+      <artifactId>eigenbase-properties</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>net.hydromatic</groupId>
+      <artifactId>foodmart-data-hsqldb</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>net.hydromatic</groupId>
+      <artifactId>foodmart-queries</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>net.hydromatic</groupId>
+      <artifactId>quidem</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.janino</groupId>
+      <artifactId>janino</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.janino</groupId>
+      <artifactId>commons-compiler</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.hsqldb</groupId>
+      <artifactId>hsqldb</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.incava</groupId>
+      <artifactId>java-diff</artifactId>
+      <scope>test</scope>
+    </dependency>
     <dependency>
       <groupId>org.pentaho</groupId>
       <artifactId>pentaho-aggdesigner-algorithm</artifactId>

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/119a3993/example/csv/pom.xml
----------------------------------------------------------------------
diff --git a/example/csv/pom.xml b/example/csv/pom.xml
index 1704f0b..ed6a457 100644
--- a/example/csv/pom.xml
+++ b/example/csv/pom.xml
@@ -37,25 +37,29 @@ limitations under the License.
   <dependencies>
     <dependency>
       <groupId>org.apache.calcite</groupId>
+      <artifactId>calcite-avatica</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.calcite</groupId>
       <artifactId>calcite-core</artifactId>
     </dependency>
     <dependency>
       <groupId>org.apache.calcite</groupId>
-      <artifactId>calcite-avatica</artifactId>
+      <artifactId>calcite-linq4j</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
     </dependency>
-    <!--<dependency>-->
-      <!--<groupId>org.apache.calcite</groupId>-->
-      <!--<artifactId>calcite-linq4j</artifactId>-->
-    <!--</dependency>-->
     <dependency>
       <groupId>net.sf.opencsv</groupId>
       <artifactId>opencsv</artifactId>
-      <version>2.3</version>
     </dependency>
     <dependency>
       <groupId>org.apache.commons</groupId>
       <artifactId>commons-lang3</artifactId>
-      <version>3.2</version>
     </dependency>
   </dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/119a3993/linq4j/pom.xml
----------------------------------------------------------------------
diff --git a/linq4j/pom.xml b/linq4j/pom.xml
index 382f3ee..528df06 100644
--- a/linq4j/pom.xml
+++ b/linq4j/pom.xml
@@ -34,6 +34,18 @@ limitations under the License.
     <build.timestamp>${maven.build.timestamp}</build.timestamp>
   </properties>
 
+  <dependencies>
+    <dependency>
+      <groupId>com.google.guava</groupId>
+      <artifactId>guava</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
   <build>
     <plugins>
       <!-- Parent module has the same plugin and does the work of

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/119a3993/mongodb/pom.xml
----------------------------------------------------------------------
diff --git a/mongodb/pom.xml b/mongodb/pom.xml
index b229e51..58ee276 100644
--- a/mongodb/pom.xml
+++ b/mongodb/pom.xml
@@ -38,6 +38,10 @@ limitations under the License.
          in dependencyManagement in the root POM, not here. -->
     <dependency>
       <groupId>org.apache.calcite</groupId>
+      <artifactId>calcite-avatica</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.calcite</groupId>
       <artifactId>calcite-core</artifactId>
       <type>jar</type>
     </dependency>
@@ -47,8 +51,17 @@ limitations under the License.
       <type>test-jar</type>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.calcite</groupId>
+      <artifactId>calcite-linq4j</artifactId>
+    </dependency>
 
     <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
       <groupId>org.mongodb</groupId>
       <artifactId>mongo-java-driver</artifactId>
     </dependency>

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/119a3993/plus/pom.xml
----------------------------------------------------------------------
diff --git a/plus/pom.xml b/plus/pom.xml
index 6eca39a..f951be2 100644
--- a/plus/pom.xml
+++ b/plus/pom.xml
@@ -38,6 +38,10 @@ limitations under the License.
          in dependencyManagement in the root POM, not here. -->
     <dependency>
       <groupId>org.apache.calcite</groupId>
+      <artifactId>calcite-avatica</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.calcite</groupId>
       <artifactId>calcite-core</artifactId>
       <type>jar</type>
     </dependency>
@@ -47,6 +51,10 @@ limitations under the License.
       <type>test-jar</type>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.calcite</groupId>
+      <artifactId>calcite-linq4j</artifactId>
+    </dependency>
 
     <dependency>
       <groupId>com.google.guava</groupId>
@@ -60,6 +68,11 @@ limitations under the License.
       <type>jar</type>
     </dependency>
     <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
       <groupId>net.hydromatic</groupId>
       <artifactId>tpcds</artifactId>
       <type>jar</type>

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/119a3993/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 28b9153..54fd593 100644
--- a/pom.xml
+++ b/pom.xml
@@ -49,7 +49,7 @@ limitations under the License.
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <top.dir>${project.basedir}</top.dir>
     <version.major>1</version.major>
-    <version.minor>1</version.minor>
+    <version.minor>2</version.minor>
   </properties>
 
   <issueManagement>
@@ -77,90 +77,10 @@ limitations under the License.
     <module>ubenchmark</module>
   </modules>
 
-  <!-- Dependencies. -->
-  <dependencies>
-    <!-- Sorted by groupId, artifactId. -->
-    <dependency>
-      <groupId>commons-dbcp</groupId>
-      <artifactId>commons-dbcp</artifactId>
-      <version>1.4</version>
-    </dependency>
-    <dependency>
-      <groupId>com.fasterxml.jackson.core</groupId>
-      <artifactId>jackson-databind</artifactId>
-      <version>2.1.1</version>
-    </dependency>
-    <dependency>
-      <groupId>com.google.guava</groupId>
-      <artifactId>guava</artifactId>
-      <!-- We support versions as old as 11.0.2 (the version used by
-           Hadoop) but prefer more recent versions. -->
-      <version>11.0.2</version>
-    </dependency>
-    <dependency>
-      <groupId>net.hydromatic</groupId>
-      <artifactId>eigenbase-properties</artifactId>
-      <version>1.1.5</version>
-    </dependency>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>4.11</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>mysql</groupId>
-      <artifactId>mysql-connector-java</artifactId>
-      <version>5.1.20</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>net.hydromatic</groupId>
-      <artifactId>quidem</artifactId>
-      <version>0.3</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.codehaus.janino</groupId>
-      <artifactId>janino</artifactId>
-      <version>2.7.6</version>
-    </dependency>
-    <dependency>
-      <groupId>org.codehaus.janino</groupId>
-      <artifactId>commons-compiler</artifactId>
-      <version>2.7.6</version>
-    </dependency>
-    <dependency>
-      <groupId>org.hsqldb</groupId>
-      <artifactId>hsqldb</artifactId>
-      <version>2.3.1</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.incava</groupId>
-      <artifactId>java-diff</artifactId>
-      <version>1.1</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>net.hydromatic</groupId>
-      <artifactId>foodmart-data-hsqldb</artifactId>
-      <version>0.3</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>net.hydromatic</groupId>
-      <artifactId>foodmart-queries</artifactId>
-      <version>0.4.1</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>sqlline</groupId>
-      <artifactId>sqlline</artifactId>
-      <version>1.1.9</version>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
+  <!-- No dependencies here. Declare dependency VERSIONS in
+       dependencyManagement, below, and each dependency in the module that uses
+       it. -->
+  <dependencies />
 
   <dependencyManagement>
     <dependencies>
@@ -168,37 +88,105 @@ limitations under the License.
       <dependency>
         <groupId>org.apache.calcite</groupId>
         <artifactId>calcite-avatica</artifactId>
-        <version>${project.version}</version>
+        <version>1.2.0-incubating-SNAPSHOT</version>
       </dependency>
       <dependency>
         <groupId>org.apache.calcite</groupId>
         <artifactId>calcite-avatica-server</artifactId>
-        <version>${project.version}</version>
+        <version>1.2.0-incubating-SNAPSHOT</version>
       </dependency>
       <dependency>
         <groupId>org.apache.calcite</groupId>
         <artifactId>calcite-core</artifactId>
-        <version>${project.version}</version>
+        <version>1.2.0-incubating-SNAPSHOT</version>
       </dependency>
       <dependency>
         <groupId>org.apache.calcite</groupId>
         <artifactId>calcite-core</artifactId>
         <type>test-jar</type>
-        <version>${project.version}</version>
+        <version>1.2.0-incubating-SNAPSHOT</version>
       </dependency>
       <dependency>
         <groupId>org.apache.calcite</groupId>
         <artifactId>calcite-linq4j</artifactId>
-        <version>${project.version}</version>
+        <version>1.2.0-incubating-SNAPSHOT</version>
       </dependency>
 
-      <!-- Now third-party dependencies. -->
+      <!-- Now third-party dependencies, sorted by groupId and artifactId. -->
+      <dependency>
+        <groupId>commons-dbcp</groupId>
+        <artifactId>commons-dbcp</artifactId>
+        <version>1.4</version>
+      </dependency>
+      <dependency>
+        <groupId>com.fasterxml.jackson.core</groupId>
+        <artifactId>jackson-databind</artifactId>
+        <version>2.1.1</version>
+      </dependency>
+      <dependency>
+        <groupId>com.google.guava</groupId>
+        <artifactId>guava</artifactId>
+        <!-- We support versions as old as 11.0.2 (the version used by Hadoop)
+             but prefer more recent versions. -->
+        <version>11.0.2</version>
+      </dependency>
       <dependency>
         <groupId>io.airlift.tpch</groupId>
         <artifactId>tpch</artifactId>
         <version>0.1</version>
       </dependency>
       <dependency>
+        <groupId>mysql</groupId>
+        <artifactId>mysql-connector-java</artifactId>
+        <version>5.1.20</version>
+      </dependency>
+      <dependency>
+        <groupId>net.hydromatic</groupId>
+        <artifactId>eigenbase-properties</artifactId>
+        <version>1.1.5</version>
+      </dependency>
+      <dependency>
+        <groupId>net.hydromatic</groupId>
+        <artifactId>foodmart-data-hsqldb</artifactId>
+        <version>0.3</version>
+      </dependency>
+      <dependency>
+        <groupId>net.hydromatic</groupId>
+        <artifactId>foodmart-queries</artifactId>
+        <version>0.4.1</version>
+      </dependency>
+      <dependency>
+        <groupId>net.hydromatic</groupId>
+        <artifactId>quidem</artifactId>
+        <version>0.3</version>
+        <scope>test</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.commons</groupId>
+        <artifactId>commons-lang3</artifactId>
+        <version>3.2</version>
+      </dependency>
+      <dependency>
+        <groupId>org.codehaus.janino</groupId>
+        <artifactId>janino</artifactId>
+        <version>2.7.6</version>
+      </dependency>
+      <dependency>
+        <groupId>org.codehaus.janino</groupId>
+        <artifactId>commons-compiler</artifactId>
+        <version>2.7.6</version>
+      </dependency>
+      <dependency>
+        <groupId>org.hsqldb</groupId>
+        <artifactId>hsqldb</artifactId>
+        <version>2.3.1</version>
+      </dependency>
+      <dependency>
+        <groupId>org.incava</groupId>
+        <artifactId>java-diff</artifactId>
+        <version>1.1</version>
+      </dependency>
+      <dependency>
         <groupId>org.pentaho</groupId>
         <artifactId>pentaho-aggdesigner-algorithm</artifactId>
         <version>5.1.5-jhyde</version>
@@ -240,6 +228,11 @@ limitations under the License.
         <version>0.7.1</version>
       </dependency>
       <dependency>
+        <groupId>junit</groupId>
+        <artifactId>junit</artifactId>
+        <version>4.11</version>
+      </dependency>
+      <dependency>
         <groupId>xerces</groupId>
         <artifactId>xercesImpl</artifactId>
         <version>2.9.1</version>

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/119a3993/spark/pom.xml
----------------------------------------------------------------------
diff --git a/spark/pom.xml b/spark/pom.xml
index 8d86d9a..88370ff 100644
--- a/spark/pom.xml
+++ b/spark/pom.xml
@@ -37,6 +37,10 @@ limitations under the License.
          in dependencyManagement in the root POM, not here. -->
     <dependency>
       <groupId>org.apache.calcite</groupId>
+      <artifactId>calcite-avatica</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.calcite</groupId>
       <artifactId>calcite-core</artifactId>
     </dependency>
     <dependency>
@@ -45,6 +49,10 @@ limitations under the License.
       <type>test-jar</type>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.calcite</groupId>
+      <artifactId>calcite-linq4j</artifactId>
+    </dependency>
 
     <dependency>
       <groupId>org.apache.spark</groupId>

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/119a3993/splunk/pom.xml
----------------------------------------------------------------------
diff --git a/splunk/pom.xml b/splunk/pom.xml
index 3d331f4..5f6a805 100644
--- a/splunk/pom.xml
+++ b/splunk/pom.xml
@@ -38,6 +38,10 @@ limitations under the License.
          in dependencyManagement in the root POM, not here. -->
     <dependency>
       <groupId>org.apache.calcite</groupId>
+      <artifactId>calcite-avatica</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.calcite</groupId>
       <artifactId>calcite-core</artifactId>
     </dependency>
     <dependency>
@@ -46,8 +50,17 @@ limitations under the License.
       <type>test-jar</type>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.calcite</groupId>
+      <artifactId>calcite-linq4j</artifactId>
+    </dependency>
 
     <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
       <groupId>net.sf.opencsv</groupId>
       <artifactId>opencsv</artifactId>
     </dependency>

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/119a3993/ubenchmark/pom.xml
----------------------------------------------------------------------
diff --git a/ubenchmark/pom.xml b/ubenchmark/pom.xml
index 9b46595..3994425 100644
--- a/ubenchmark/pom.xml
+++ b/ubenchmark/pom.xml
@@ -45,6 +45,10 @@ limitations under the License.
       <groupId>org.apache.calcite</groupId>
       <artifactId>calcite-core</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.apache.calcite</groupId>
+      <artifactId>calcite-linq4j</artifactId>
+    </dependency>
 
     <dependency>
       <groupId>org.openjdk.jmh</groupId>


[8/8] incubator-calcite git commit: In linq4j, implement firstOrDefault, single, and singleOrDefault methods (Daniel Cooper)

Posted by jh...@apache.org.
In linq4j, implement firstOrDefault, single, and singleOrDefault methods (Daniel Cooper)

Close apache/incubator-calcite#60


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

Branch: refs/heads/master
Commit: 60789a572dcbac028197d3c2cc6b05a70ba0418d
Parents: 3807827
Author: Daniel Cooper <co...@gmail.com>
Authored: Tue Mar 17 13:30:21 2015 +0000
Committer: Julian Hyde <jh...@apache.org>
Committed: Fri Mar 20 12:46:47 2015 -0700

----------------------------------------------------------------------
 .../calcite/linq4j/EnumerableDefaults.java      |  89 +++++++++-
 .../apache/calcite/linq4j/test/Linq4jTest.java  | 177 ++++++++++++++++++-
 2 files changed, 255 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/60789a57/linq4j/src/main/java/org/apache/calcite/linq4j/EnumerableDefaults.java
----------------------------------------------------------------------
diff --git a/linq4j/src/main/java/org/apache/calcite/linq4j/EnumerableDefaults.java b/linq4j/src/main/java/org/apache/calcite/linq4j/EnumerableDefaults.java
index 8608b1c..e470032 100644
--- a/linq4j/src/main/java/org/apache/calcite/linq4j/EnumerableDefaults.java
+++ b/linq4j/src/main/java/org/apache/calcite/linq4j/EnumerableDefaults.java
@@ -530,7 +530,7 @@ public abstract class EnumerableDefaults {
         return o;
       }
     }
-    return null;
+    throw new NoSuchElementException();
   }
 
   /**
@@ -538,8 +538,16 @@ public abstract class EnumerableDefaults {
    * default value if the sequence contains no elements.
    */
   public static <TSource> TSource firstOrDefault(
-      Enumerable<TSource> enumerable) {
-    throw Extensions.todo();
+        Enumerable<TSource> enumerable) {
+    final Enumerator<TSource> os = enumerable.enumerator();
+    try {
+      if (os.moveNext()) {
+        return os.current();
+      }
+      return null;
+    } finally {
+      os.close();
+    }
   }
 
   /**
@@ -549,7 +557,12 @@ public abstract class EnumerableDefaults {
    */
   public static <TSource> TSource firstOrDefault(Enumerable<TSource> enumerable,
       Predicate1<TSource> predicate) {
-    throw Extensions.todo();
+    for (TSource o : enumerable) {
+      if (predicate.apply(o)) {
+        return o;
+      }
+    }
+    return null;
   }
 
   /**
@@ -1721,7 +1734,23 @@ public abstract class EnumerableDefaults {
    * sequence.
    */
   public static <TSource> TSource single(Enumerable<TSource> source) {
-    throw Extensions.todo();
+    final Enumerator<TSource> os = source.enumerator();
+    TSource toRet = null;
+    try {
+      if (os.moveNext()) {
+        toRet = os.current();
+
+        if (os.moveNext()) {
+          throw new IllegalStateException();
+        }
+      }
+      if (toRet != null) {
+        return toRet;
+      }
+      throw new IllegalStateException();
+    } finally {
+      os.close();
+    }
   }
 
   /**
@@ -1730,8 +1759,26 @@ public abstract class EnumerableDefaults {
    * more than one such element exists.
    */
   public static <TSource> TSource single(Enumerable<TSource> source,
-      Predicate1<TSource> predicate) {
-    throw Extensions.todo();
+                                         Predicate1<TSource> predicate) {
+    final Enumerator<TSource> os = source.enumerator();
+    TSource toRet = null;
+    try {
+      while (os.moveNext()) {
+        if (predicate.apply(os.current())) {
+          if (toRet == null) {
+            toRet = os.current();
+          } else {
+            throw new IllegalStateException();
+          }
+        }
+      }
+      if (toRet != null) {
+        return toRet;
+      }
+      throw new IllegalStateException();
+    } finally {
+      os.close();
+    }
   }
 
   /**
@@ -1741,7 +1788,21 @@ public abstract class EnumerableDefaults {
    * sequence.
    */
   public static <TSource> TSource singleOrDefault(Enumerable<TSource> source) {
-    throw Extensions.todo();
+    final Enumerator<TSource> os = source.enumerator();
+    TSource toRet = null;
+    try {
+      if (os.moveNext()) {
+        toRet = os.current();
+      }
+
+      if (os.moveNext()) {
+        return null;
+      }
+
+      return toRet;
+    } finally {
+      os.close();
+    }
   }
 
   /**
@@ -1752,7 +1813,17 @@ public abstract class EnumerableDefaults {
    */
   public static <TSource> TSource singleOrDefault(Enumerable<TSource> source,
       Predicate1<TSource> predicate) {
-    throw Extensions.todo();
+    TSource toRet = null;
+    for (TSource s : source) {
+      if (predicate.apply(s)) {
+        if (toRet != null) {
+          return null;
+        } else {
+          toRet = s;
+        }
+      }
+    }
+    return toRet;
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/60789a57/linq4j/src/test/java/org/apache/calcite/linq4j/test/Linq4jTest.java
----------------------------------------------------------------------
diff --git a/linq4j/src/test/java/org/apache/calcite/linq4j/test/Linq4jTest.java b/linq4j/src/test/java/org/apache/calcite/linq4j/test/Linq4jTest.java
index 4e133c1..7a4f65a 100644
--- a/linq4j/src/test/java/org/apache/calcite/linq4j/test/Linq4jTest.java
+++ b/linq4j/src/test/java/org/apache/calcite/linq4j/test/Linq4jTest.java
@@ -508,9 +508,182 @@ public class Linq4jTest {
     assertEquals(people[1], Linq4j.asEnumerable(people).first(startWithS));
     assertEquals(numbers[3], Linq4j.asEnumerable(numbers).first(numberGT15));
 
-    // FIXME: What we need return if no one element is satisfied?
-    assertNull(Linq4j.asEnumerable(peopleWithoutCharS).first(startWithS));
+    try {
+      String s = Linq4j.asEnumerable(peopleWithoutCharS).first(startWithS);
+      fail("expected exception, but got" + s);
+    } catch (NoSuchElementException e) {
+      // ok
+    }
+  }
+
+  @Test public void testFirstOrDefault() {
+
+    String[] people = {"Brill", "Smith", "Simpsom"};
+    String[] empty = {};
+    Integer[] numbers = {5, 10, 15, 20, 25};
+
+    assertEquals(people[0], Linq4j.asEnumerable(people).firstOrDefault());
+    assertEquals(numbers[0], Linq4j.asEnumerable(numbers).firstOrDefault());
+
+    assertNull(Linq4j.asEnumerable(empty).firstOrDefault());
+  }
+
+  @Test public void testFirstOrDefaultPredicate1() {
+    Predicate1<String> startWithS = new Predicate1<String>() {
+      public boolean apply(String s) {
+        return s != null && Character.toString(s.charAt(0)).equals("S");
+      }
+    };
+
+    Predicate1<Integer> numberGT15 = new Predicate1<Integer>() {
+      public boolean apply(Integer i) {
+        return i > 15;
+      }
+    };
+
+    String[] people = {"Brill", "Smith", "Simpsom"};
+    String[] peopleWithoutCharS = {"Brill", "Andrew", "Alice"};
+    Integer[] numbers = {5, 10, 15, 20, 25};
+
+    assertEquals(people[1], Linq4j.asEnumerable(people)
+          .firstOrDefault(startWithS));
+    assertEquals(numbers[3], Linq4j.asEnumerable(numbers)
+          .firstOrDefault(numberGT15));
+
+    assertNull(Linq4j.asEnumerable(peopleWithoutCharS)
+          .firstOrDefault(startWithS));
+  }
+
+  @Test public void testSingle() {
+
+    String[] person = {"Smith"};
+    String[] people = {"Brill", "Smith", "Simpson"};
+    Integer[] number = {20};
+    Integer[] numbers = {5, 10, 15, 20};
+
+    assertEquals(person[0], Linq4j.asEnumerable(person).single());
+    assertEquals(number[0], Linq4j.asEnumerable(number).single());
+
+    try {
+      String s = Linq4j.asEnumerable(people).single();
+      fail("expected exception, but got" + s);
+    } catch (IllegalStateException e) {
+      // ok
+    }
+
+    try {
+      int i = Linq4j.asEnumerable(numbers).single();
+      fail("expected exception, but got" + i);
+    } catch (IllegalStateException e) {
+      // ok
+    }
+  }
+
+  @Test public void testSingleOrDefault() {
+
+    String[] person = {"Smith"};
+    String[] people = {"Brill", "Smith", "Simpson"};
+    Integer[] number = {20};
+    Integer[] numbers = {5, 10, 15, 20};
+
+    assertEquals(person[0], Linq4j.asEnumerable(person).singleOrDefault());
+    assertEquals(number[0], Linq4j.asEnumerable(number).singleOrDefault());
+
+    assertNull(Linq4j.asEnumerable(people).singleOrDefault());
+    assertNull(Linq4j.asEnumerable(numbers).singleOrDefault());
+  }
+
+  @Test public void testSinglePredicate1() {
+    Predicate1<String> startWithS = new Predicate1<String>() {
+      public boolean apply(String s) {
+        return s != null && Character.toString(s.charAt(0)).equals("S");
+      }
+    };
+
+    Predicate1<Integer> numberGT15 = new Predicate1<Integer>() {
+      public boolean apply(Integer i) {
+        return i > 15;
+      }
+    };
+
+    String[] people = {"Brill", "Smith"};
+    String[] twoPeopleWithCharS = {"Brill", "Smith", "Simpson"};
+    String[] peopleWithoutCharS = {"Brill", "Andrew", "Alice"};
+    Integer[] numbers = {5, 10, 15, 20};
+    Integer[] numbersWithoutGT15 = {5, 10, 15};
+    Integer[] numbersWithTwoGT15 = {5, 10, 15, 20, 25};
+
+    assertEquals(people[1], Linq4j.asEnumerable(people).single(startWithS));
+    assertEquals(numbers[3], Linq4j.asEnumerable(numbers).single(numberGT15));
+
+
+    try {
+      String s = Linq4j.asEnumerable(twoPeopleWithCharS).single(startWithS);
+      fail("expected exception, but got" + s);
+    } catch (IllegalStateException e) {
+      // ok
+    }
+
+    try {
+      int i = Linq4j.asEnumerable(numbersWithTwoGT15).single(numberGT15);
+      fail("expected exception, but got" + i);
+    } catch (IllegalStateException e) {
+      // ok
+    }
+
+    try {
+      String s = Linq4j.asEnumerable(peopleWithoutCharS).single(startWithS);
+      fail("expected exception, but got" + s);
+    } catch (IllegalStateException e) {
+      // ok
+    }
+
+    try {
+      int i = Linq4j.asEnumerable(numbersWithoutGT15).single(numberGT15);
+      fail("expected exception, but got" + i);
+    } catch (IllegalStateException e) {
+      // ok
+    }
+  }
+
+  @Test
+  public void testSingleOrDefaultPredicate1() {
+    Predicate1<String> startWithS = new Predicate1<String>() {
+      public boolean apply(String s) {
+        return s != null && Character.toString(s.charAt(0)).equals("S");
+      }
+    };
+
+    Predicate1<Integer> numberGT15 = new Predicate1<Integer>() {
+      public boolean apply(Integer i) {
+        return i > 15;
+      }
+    };
+
+    String[] people = {"Brill", "Smith"};
+    String[] twoPeopleWithCharS = {"Brill", "Smith", "Simpson"};
+    String[] peopleWithoutCharS = {"Brill", "Andrew", "Alice"};
+    Integer[] numbers = {5, 10, 15, 20};
+    Integer[] numbersWithTwoGT15 = {5, 10, 15, 20, 25};
+    Integer[] numbersWithoutGT15 = {5, 10, 15};
+
+    assertEquals(people[1], Linq4j.asEnumerable(people)
+          .singleOrDefault(startWithS));
+
+    assertEquals(numbers[3], Linq4j.asEnumerable(numbers)
+          .singleOrDefault(numberGT15));
+
+    assertNull(Linq4j.asEnumerable(twoPeopleWithCharS)
+          .singleOrDefault(startWithS));
+
+    assertNull(Linq4j.asEnumerable(numbersWithTwoGT15)
+          .singleOrDefault(numberGT15));
+
+    assertNull(Linq4j.asEnumerable(peopleWithoutCharS)
+          .singleOrDefault(startWithS));
 
+    assertNull(Linq4j.asEnumerable(numbersWithoutGT15)
+          .singleOrDefault(numberGT15));
   }
 
   @SuppressWarnings("UnnecessaryBoxing")


[3/8] incubator-calcite git commit: [maven-release-plugin] prepare release calcite-1.1.0-incubating

Posted by jh...@apache.org.
[maven-release-plugin] prepare release calcite-1.1.0-incubating


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

Branch: refs/heads/master
Commit: f10ea367ff1cc25497f50f149ef0c91b3ae03031
Parents: 4494272
Author: Julian Hyde <jh...@apache.org>
Authored: Fri Mar 13 13:16:39 2015 -0700
Committer: Julian Hyde <jh...@apache.org>
Committed: Fri Mar 13 13:16:39 2015 -0700

----------------------------------------------------------------------
 avatica-server/pom.xml | 4 ++--
 avatica/pom.xml        | 4 ++--
 core/pom.xml           | 4 ++--
 example/csv/pom.xml    | 4 ++--
 example/pom.xml        | 4 ++--
 linq4j/pom.xml         | 4 ++--
 mongodb/pom.xml        | 4 ++--
 plus/pom.xml           | 4 ++--
 pom.xml                | 4 ++--
 spark/pom.xml          | 4 ++--
 splunk/pom.xml         | 4 ++--
 ubenchmark/pom.xml     | 2 +-
 12 files changed, 23 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/f10ea367/avatica-server/pom.xml
----------------------------------------------------------------------
diff --git a/avatica-server/pom.xml b/avatica-server/pom.xml
index 26955e4..25ba46a 100644
--- a/avatica-server/pom.xml
+++ b/avatica-server/pom.xml
@@ -20,12 +20,12 @@ limitations under the License.
   <parent>
     <groupId>org.apache.calcite</groupId>
     <artifactId>calcite</artifactId>
-    <version>1.1.0-incubating-SNAPSHOT</version>
+    <version>1.1.0-incubating</version>
   </parent>
 
   <artifactId>calcite-avatica-server</artifactId>
   <packaging>jar</packaging>
-  <version>1.1.0-incubating-SNAPSHOT</version>
+  <version>1.1.0-incubating</version>
   <name>Calcite Avatica Server</name>
   <description>JDBC server.</description>
 

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/f10ea367/avatica/pom.xml
----------------------------------------------------------------------
diff --git a/avatica/pom.xml b/avatica/pom.xml
index b786e5a..3a54bea 100644
--- a/avatica/pom.xml
+++ b/avatica/pom.xml
@@ -20,12 +20,12 @@ limitations under the License.
   <parent>
     <groupId>org.apache.calcite</groupId>
     <artifactId>calcite</artifactId>
-    <version>1.1.0-incubating-SNAPSHOT</version>
+    <version>1.1.0-incubating</version>
   </parent>
 
   <artifactId>calcite-avatica</artifactId>
   <packaging>jar</packaging>
-  <version>1.1.0-incubating-SNAPSHOT</version>
+  <version>1.1.0-incubating</version>
   <name>Calcite Avatica</name>
   <description>JDBC driver framework.</description>
 

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/f10ea367/core/pom.xml
----------------------------------------------------------------------
diff --git a/core/pom.xml b/core/pom.xml
index 0395a61..062477c 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -20,12 +20,12 @@ limitations under the License.
   <parent>
     <groupId>org.apache.calcite</groupId>
     <artifactId>calcite</artifactId>
-    <version>1.1.0-incubating-SNAPSHOT</version>
+    <version>1.1.0-incubating</version>
   </parent>
 
   <artifactId>calcite-core</artifactId>
   <packaging>jar</packaging>
-  <version>1.1.0-incubating-SNAPSHOT</version>
+  <version>1.1.0-incubating</version>
   <name>Calcite Core</name>
   <description>Core Calcite APIs and engine.</description>
 

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/f10ea367/example/csv/pom.xml
----------------------------------------------------------------------
diff --git a/example/csv/pom.xml b/example/csv/pom.xml
index 6f4fe16..0e994bb 100644
--- a/example/csv/pom.xml
+++ b/example/csv/pom.xml
@@ -20,12 +20,12 @@ limitations under the License.
   <parent>
     <groupId>org.apache.calcite</groupId>
     <artifactId>calcite-example</artifactId>
-    <version>1.1.0-incubating-SNAPSHOT</version>
+    <version>1.1.0-incubating</version>
   </parent>
 
   <artifactId>calcite-example-csv</artifactId>
   <packaging>jar</packaging>
-  <version>1.1.0-incubating-SNAPSHOT</version>
+  <version>1.1.0-incubating</version>
   <name>Calcite Example CSV</name>
   <description>An example Calcite provider that reads CSV files</description>
 

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/f10ea367/example/pom.xml
----------------------------------------------------------------------
diff --git a/example/pom.xml b/example/pom.xml
index c37c11e..b8259c5 100644
--- a/example/pom.xml
+++ b/example/pom.xml
@@ -20,13 +20,13 @@ limitations under the License.
   <parent>
     <groupId>org.apache.calcite</groupId>
     <artifactId>calcite</artifactId>
-    <version>1.1.0-incubating-SNAPSHOT</version>
+    <version>1.1.0-incubating</version>
   </parent>
 
   <!-- The basics. -->
   <artifactId>calcite-example</artifactId>
   <packaging>pom</packaging>
-  <version>1.1.0-incubating-SNAPSHOT</version>
+  <version>1.1.0-incubating</version>
   <name>Calcite Examples</name>
   <description>Calcite examples</description>
 

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/f10ea367/linq4j/pom.xml
----------------------------------------------------------------------
diff --git a/linq4j/pom.xml b/linq4j/pom.xml
index 9e20c1b..fc2e4cd 100644
--- a/linq4j/pom.xml
+++ b/linq4j/pom.xml
@@ -20,12 +20,12 @@ limitations under the License.
   <parent>
     <groupId>org.apache.calcite</groupId>
     <artifactId>calcite</artifactId>
-    <version>1.1.0-incubating-SNAPSHOT</version>
+    <version>1.1.0-incubating</version>
   </parent>
 
   <artifactId>calcite-linq4j</artifactId>
   <packaging>jar</packaging>
-  <version>1.1.0-incubating-SNAPSHOT</version>
+  <version>1.1.0-incubating</version>
   <name>Calcite Linq4j</name>
   <description>Calcite APIs for LINQ (Language-Integrated Query) in Java</description>
 

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/f10ea367/mongodb/pom.xml
----------------------------------------------------------------------
diff --git a/mongodb/pom.xml b/mongodb/pom.xml
index f0e1800..9023fd0 100644
--- a/mongodb/pom.xml
+++ b/mongodb/pom.xml
@@ -20,12 +20,12 @@ limitations under the License.
   <parent>
     <groupId>org.apache.calcite</groupId>
     <artifactId>calcite</artifactId>
-    <version>1.1.0-incubating-SNAPSHOT</version>
+    <version>1.1.0-incubating</version>
   </parent>
 
   <artifactId>calcite-mongodb</artifactId>
   <packaging>jar</packaging>
-  <version>1.1.0-incubating-SNAPSHOT</version>
+  <version>1.1.0-incubating</version>
   <name>Calcite MongoDB</name>
   <description>MongoDB adapter for Calcite</description>
 

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/f10ea367/plus/pom.xml
----------------------------------------------------------------------
diff --git a/plus/pom.xml b/plus/pom.xml
index e27f41f..4466902 100644
--- a/plus/pom.xml
+++ b/plus/pom.xml
@@ -20,12 +20,12 @@ limitations under the License.
   <parent>
     <groupId>org.apache.calcite</groupId>
     <artifactId>calcite</artifactId>
-    <version>1.1.0-incubating-SNAPSHOT</version>
+    <version>1.1.0-incubating</version>
   </parent>
 
   <artifactId>calcite-plus</artifactId>
   <packaging>jar</packaging>
-  <version>1.1.0-incubating-SNAPSHOT</version>
+  <version>1.1.0-incubating</version>
   <name>Calcite Plus</name>
   <description>Miscellaneous extras for Calcite</description>
 

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/f10ea367/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 7b9119b..19208bc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -27,7 +27,7 @@ limitations under the License.
   <groupId>org.apache.calcite</groupId>
   <artifactId>calcite</artifactId>
   <packaging>pom</packaging>
-  <version>1.1.0-incubating-SNAPSHOT</version>
+  <version>1.1.0-incubating</version>
 
   <!-- More project information. -->
   <name>Calcite</name>
@@ -61,7 +61,7 @@ limitations under the License.
     <connection>scm:git:https://git-wip-us.apache.org/repos/asf/incubator-calcite.git</connection>
     <developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/incubator-calcite.git</developerConnection>
     <url>https://github.com/apache/incubator-calcite</url>
-    <tag>HEAD</tag>
+    <tag>calcite-1.1.0-incubating</tag>
   </scm>
 
   <modules>

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/f10ea367/spark/pom.xml
----------------------------------------------------------------------
diff --git a/spark/pom.xml b/spark/pom.xml
index b0c21a2..36d27eb 100644
--- a/spark/pom.xml
+++ b/spark/pom.xml
@@ -20,12 +20,12 @@ limitations under the License.
   <parent>
     <groupId>org.apache.calcite</groupId>
     <artifactId>calcite</artifactId>
-    <version>1.1.0-incubating-SNAPSHOT</version>
+    <version>1.1.0-incubating</version>
   </parent>
 
   <artifactId>calcite-spark</artifactId>
   <packaging>jar</packaging>
-  <version>1.1.0-incubating-SNAPSHOT</version>
+  <version>1.1.0-incubating</version>
   <name>Calcite Spark</name>
 
   <properties>

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/f10ea367/splunk/pom.xml
----------------------------------------------------------------------
diff --git a/splunk/pom.xml b/splunk/pom.xml
index d8546b2..588c54c 100644
--- a/splunk/pom.xml
+++ b/splunk/pom.xml
@@ -20,12 +20,12 @@ limitations under the License.
   <parent>
     <groupId>org.apache.calcite</groupId>
     <artifactId>calcite</artifactId>
-    <version>1.1.0-incubating-SNAPSHOT</version>
+    <version>1.1.0-incubating</version>
   </parent>
 
   <artifactId>calcite-splunk</artifactId>
   <packaging>jar</packaging>
-  <version>1.1.0-incubating-SNAPSHOT</version>
+  <version>1.1.0-incubating</version>
   <name>Calcite Splunk</name>
   <description>Splunk adapter for Calcite; also a JDBC driver for Splunk</description>
 

http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/f10ea367/ubenchmark/pom.xml
----------------------------------------------------------------------
diff --git a/ubenchmark/pom.xml b/ubenchmark/pom.xml
index cc5859f..378830b 100644
--- a/ubenchmark/pom.xml
+++ b/ubenchmark/pom.xml
@@ -20,7 +20,7 @@ limitations under the License.
   <parent>
     <groupId>org.apache.calcite</groupId>
     <artifactId>calcite</artifactId>
-    <version>1.1.0-incubating-SNAPSHOT</version>
+    <version>1.1.0-incubating</version>
   </parent>
 
   <properties>