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 2017/03/17 19:26:08 UTC

[1/4] calcite git commit: [CALCITE-1706] Disable DruidAggregateFilterTransposeRule, because it causes fine-grained aggregations to be pushed to Druid

Repository: calcite
Updated Branches:
  refs/heads/branch-1.12 [created] 447a8f396


[CALCITE-1706] Disable DruidAggregateFilterTransposeRule, because it causes fine-grained aggregations to be pushed to Druid

Also remove some more CAST calls erroneously introduced by [CALCITE-1684].


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

Branch: refs/heads/branch-1.12
Commit: 6b54b6ec1718040980ed9ea60faa0e1814ae3ea4
Parents: 7f46cd5
Author: Julian Hyde <jh...@apache.org>
Authored: Fri Mar 17 11:47:00 2017 -0700
Committer: Julian Hyde <jh...@apache.org>
Committed: Fri Mar 17 11:47:00 2017 -0700

----------------------------------------------------------------------
 .../calcite/adapter/druid/DruidRules.java       | 16 ++++++++---
 .../org/apache/calcite/test/DruidAdapterIT.java | 29 ++++++++++++--------
 2 files changed, 29 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/calcite/blob/6b54b6ec/druid/src/main/java/org/apache/calcite/adapter/druid/DruidRules.java
----------------------------------------------------------------------
diff --git a/druid/src/main/java/org/apache/calcite/adapter/druid/DruidRules.java b/druid/src/main/java/org/apache/calcite/adapter/druid/DruidRules.java
index bb15921..b22809c 100644
--- a/druid/src/main/java/org/apache/calcite/adapter/druid/DruidRules.java
+++ b/druid/src/main/java/org/apache/calcite/adapter/druid/DruidRules.java
@@ -92,10 +92,18 @@ public class DruidRules {
   public static final DruidFilterAggregateTransposeRule FILTER_AGGREGATE_TRANSPOSE_RULE =
       new DruidFilterAggregateTransposeRule();
 
-  public static final List<RelOptRule> RULES = ImmutableList.of(FILTER,
-      PROJECT_FILTER_TRANSPOSE_RULE, AGGREGATE_FILTER_TRANSPOSE_RULE, PROJECT_AGGREGATE,
-      PROJECT, AGGREGATE, FILTER_AGGREGATE_TRANSPOSE_RULE, FILTER_PROJECT_TRANSPOSE_RULE,
-      PROJECT_SORT, SORT, SORT_PROJECT);
+  public static final List<RelOptRule> RULES =
+      ImmutableList.of(FILTER,
+          PROJECT_FILTER_TRANSPOSE_RULE,
+          // Disabled, per
+          //   [CALCITE-1706] DruidAggregateFilterTransposeRule
+          //   causes very fine-grained aggregations to be pushed to Druid
+          // AGGREGATE_FILTER_TRANSPOSE_RULE,
+          PROJECT_AGGREGATE,
+          PROJECT, AGGREGATE,
+          FILTER_AGGREGATE_TRANSPOSE_RULE,
+          FILTER_PROJECT_TRANSPOSE_RULE,
+          PROJECT_SORT, SORT, SORT_PROJECT);
 
   /** Predicate that returns whether Druid can not handle an aggregate. */
   private static final Predicate<Aggregate> BAD_AGG =

http://git-wip-us.apache.org/repos/asf/calcite/blob/6b54b6ec/druid/src/test/java/org/apache/calcite/test/DruidAdapterIT.java
----------------------------------------------------------------------
diff --git a/druid/src/test/java/org/apache/calcite/test/DruidAdapterIT.java b/druid/src/test/java/org/apache/calcite/test/DruidAdapterIT.java
index bcce57e..4ee32a5 100644
--- a/druid/src/test/java/org/apache/calcite/test/DruidAdapterIT.java
+++ b/druid/src/test/java/org/apache/calcite/test/DruidAdapterIT.java
@@ -89,7 +89,7 @@ public class DruidAdapterIT {
       Util.getBooleanProperty("calcite.test.druid", true);
 
   private static final String VARCHAR_TYPE =
-      "VARCHAR(1) CHARACTER SET \"ISO-8859-1\" COLLATE \"ISO-8859-1$en_US$primary\"";
+      "VARCHAR CHARACTER SET \"ISO-8859-1\" COLLATE \"ISO-8859-1$en_US$primary\"";
 
   /** Whether to run this test. */
   protected boolean enabled() {
@@ -132,7 +132,9 @@ public class DruidAdapterIT {
   @Test public void testSelectDistinctWiki() {
     final String explain = "PLAN="
         + "EnumerableInterpreter\n"
-        + "  DruidQuery(table=[[wiki, wiki]], intervals=[[1900-01-09T00:00:00.000/2992-01-10T00:00:00.000]], filter=[=(CAST($13):VARCHAR(13) CHARACTER SET \"ISO-8859-1\" COLLATE \"ISO-8859-1$en_US$primary\", 'Jeremy Corbyn')], groups=[{5}], aggs=[[]])\n";
+        + "  DruidQuery(table=[[wiki, wiki]], "
+        + "intervals=[[1900-01-09T00:00:00.000/2992-01-10T00:00:00.000]], "
+        + "filter=[=($13, 'Jeremy Corbyn')], groups=[{5}], aggs=[[]])\n";
     checkSelectDistinctWiki(WIKI, "wiki")
         .explainContains(explain);
   }
@@ -140,7 +142,9 @@ public class DruidAdapterIT {
   @Test public void testSelectDistinctWikiNoColumns() {
     final String explain = "PLAN="
         + "EnumerableInterpreter\n"
-        + "  DruidQuery(table=[[wiki, wiki]], intervals=[[1900-01-09T00:00:00.000/2992-01-10T00:00:00.000]], filter=[=(CAST($17):VARCHAR(13) CHARACTER SET \"ISO-8859-1\" COLLATE \"ISO-8859-1$en_US$primary\", 'Jeremy Corbyn')], groups=[{7}], aggs=[[]])\n";
+        + "  DruidQuery(table=[[wiki, wiki]], "
+        + "intervals=[[1900-01-09T00:00:00.000/2992-01-10T00:00:00.000]], "
+        + "filter=[=($17, 'Jeremy Corbyn')], groups=[{7}], aggs=[[]])\n";
     checkSelectDistinctWiki(WIKI_AUTO, "wiki")
         .explainContains(explain);
   }
@@ -154,8 +158,10 @@ public class DruidAdapterIT {
         + "from \"wikiticker\"\n"
         + "where \"page\" = 'Jeremy Corbyn'";
     final String explain = "PLAN="
-            + "EnumerableInterpreter\n"
-            + "  DruidQuery(table=[[wiki, wikiticker]], intervals=[[1900-01-01T00:00:00.000/3000-01-01T00:00:00.000]], filter=[=(CAST($17):VARCHAR(13) CHARACTER SET \"ISO-8859-1\" COLLATE \"ISO-8859-1$en_US$primary\", 'Jeremy Corbyn')], groups=[{7}], aggs=[[]])\n";
+        + "EnumerableInterpreter\n"
+        + "  DruidQuery(table=[[wiki, wikiticker]], "
+        + "intervals=[[1900-01-01T00:00:00.000/3000-01-01T00:00:00.000]], "
+        + "filter=[=($17, 'Jeremy Corbyn')], groups=[{7}], aggs=[[]])\n";
     final String druidQuery = "{'queryType':'groupBy',"
         + "'dataSource':'wikiticker','granularity':'all',"
         + "'dimensions':['countryName'],'limitSpec':{'type':'default'},"
@@ -1302,12 +1308,11 @@ public class DruidAdapterIT {
         + "'granularity':'all',"
         + "'pagingSpec':{'threshold':16384,'fromNext':true},'context':{'druid.query.fetch':false}}";
     final String explain = "PLAN=EnumerableInterpreter\n"
-        + "  DruidQuery(table=[[foodmart, foodmart]], intervals=[[1900-01-09T00:00:00.000/2992-01-10T00:00:00.000]],"
-        + " filter=[AND(=(CAST($3):VARCHAR(24) CHARACTER SET \"ISO-8859-1\" COLLATE \"ISO-8859-1$en_US$primary\", 'High Top Dried Mushrooms'),"
-        + " OR(=($87, 'Q2'),"
-        + " =($87, 'Q3')),"
-        + " =(CAST($30):VARCHAR(2) CHARACTER SET \"ISO-8859-1\" COLLATE \"ISO-8859-1$en_US$primary\", 'WA'))],"
-        + " projects=[[$30, $29, $3]])\n";
+        + "  DruidQuery(table=[[foodmart, foodmart]], "
+        + "intervals=[[1900-01-09T00:00:00.000/2992-01-10T00:00:00.000]], "
+        + "filter=[AND(=($3, 'High Top Dried Mushrooms'), "
+        + "OR(=($87, 'Q2'), =($87, 'Q3')), =($30, 'WA'))], "
+        + "projects=[[$30, $29, $3]])\n";
     sql(sql)
         .queryContains(druidChecker(druidQuery))
         .explainContains(explain)
@@ -1354,7 +1359,7 @@ public class DruidAdapterIT {
         + "from \"foodmart\"\n"
         + "where 'High Top Dried Mushrooms' = \"product_name\"";
     final String explain = "EnumerableInterpreter\n"
-        + "  DruidQuery(table=[[foodmart, foodmart]], intervals=[[1900-01-09T00:00:00.000/2992-01-10T00:00:00.000]], filter=[=('High Top Dried Mushrooms', CAST($3):VARCHAR(24) CHARACTER SET \"ISO-8859-1\" COLLATE \"ISO-8859-1$en_US$primary\")], projects=[[$30]])";
+        + "  DruidQuery(table=[[foodmart, foodmart]], intervals=[[1900-01-09T00:00:00.000/2992-01-10T00:00:00.000]], filter=[=('High Top Dried Mushrooms', $3)], projects=[[$30]])";
     final String druidQuery = "'filter':{'type':'selector','dimension':'product_name',"
         + "'value':'High Top Dried Mushrooms'}";
     sql(sql)


[4/4] calcite git commit: [CALCITE-1657] Release Calcite 1.12.0

Posted by jh...@apache.org.
[CALCITE-1657] Release Calcite 1.12.0


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

Branch: refs/heads/branch-1.12
Commit: 447a8f396eb99873baa7d5306a6ca7f9123050eb
Parents: 24eae87
Author: Julian Hyde <jh...@apache.org>
Authored: Fri Feb 24 11:49:46 2017 -0800
Committer: Julian Hyde <jh...@apache.org>
Committed: Fri Mar 17 12:25:09 2017 -0700

----------------------------------------------------------------------
 README                |   2 +-
 pom.xml               |   2 +-
 site/_docs/history.md | 242 +++++++++++++++++++++++++++++++++++++++++++--
 site/_docs/howto.md   |   6 +-
 4 files changed, 241 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/calcite/blob/447a8f39/README
----------------------------------------------------------------------
diff --git a/README b/README
index be0c63b..985f675 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-Apache Calcite release 1.11.0
+Apache Calcite release 1.12.0
 
 This is a source or binary distribution of Apache Calcite.
 

http://git-wip-us.apache.org/repos/asf/calcite/blob/447a8f39/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 76c27b0..577773c 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>11</version.minor>
+    <version.minor>12</version.minor>
 
     <!-- This list is in alphabetical order. -->
     <airlift-tpch.version>0.1</airlift-tpch.version>

http://git-wip-us.apache.org/repos/asf/calcite/blob/447a8f39/site/_docs/history.md
----------------------------------------------------------------------
diff --git a/site/_docs/history.md b/site/_docs/history.md
index 2e1a157..761eb49 100644
--- a/site/_docs/history.md
+++ b/site/_docs/history.md
@@ -28,9 +28,18 @@ For a full list of releases, see
 Downloads are available on the
 [downloads page]({{ site.baseurl }}/downloads/).
 
-## <a href="https://github.com/apache/calcite/releases/tag/calcite-1.12.0">1.12.0</a> / under development
+## <a href="https://github.com/apache/calcite/releases/tag/calcite-1.12.0">1.12.0</a> / 2017-03-23
 {: #v1-12-0}
 
+Features of note this release are JDK9 support,
+the new file/web and Apache Pig adapters,
+general improvements to the Druid adapter,
+more helpful error messages if you get a table or column name wrong,
+improved the plans for correlated sub-queries,
+support for `TUMBLE`, `HOP` and `SESSION` window functions in streaming and regular queries,
+experimental support for `MATCH_RECOGNIZE` clause for complex-event processing (CEP),
+several new built-in functions to comply with the ODBC/JDBC standard.
+
 Compatibility: This release is tested
 on Linux, macOS, Microsoft Windows;
 using Oracle JDK 1.7, 1.8, 9;
@@ -40,18 +49,239 @@ other software versions as specified in `pom.xml`.
 
 ### New features
 
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1666">CALCITE-1666</a>]
+  Support for modifiable views with extended columns (Kevin Liew)
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1655">CALCITE-1655</a>]
+  Druid adapter: add `IN` filter (Slim Bouguerra)
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1641">CALCITE-1641</a>]
+  Add parser and validator support for `MATCH_RECOGNIZE`, a new clause for
+  complex-event processing (CEP) (Zhiqiang-He)
+  * [<a href="https://issues.apache.org/jira/browse/CALCITE-1686">CALCITE-1686</a>]
+    Only allow `FINAL` and other functions inside `MATCH_RECOGNIZE` (Zhiqiang-He)
+  * [<a href="https://issues.apache.org/jira/browse/CALCITE-1689">CALCITE-1689</a>]
+    Remove `PATTERN_DEFINE_AS` in SqlStdOperatorTable; `MATCH_RECOGNIZE` now uses
+    `AS` (Zhiqiang-He)
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1668">CALCITE-1668</a>]
+  Simplify `1 = 1` to `TRUE`, `1 > 2` to `FALSE` (Kevin Risden)
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1598">CALCITE-1598</a>]
+  Pig adapter (Eli Levine)
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1661">CALCITE-1661</a>]
+  Druid adapter: Support aggregation functions on `DECIMAL` columns
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1615">CALCITE-1615</a>]
+  Support `HOP` and `SESSION` functions in the `GROUP BY` clause
+  (Julian Hyde and Haohui Mai)
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1494">CALCITE-1494</a>]
+  More efficient plan for correlated sub-queries, omitting value-generating
+  scans where possible
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1638">CALCITE-1638</a>]
+  Simplify `$x = $x` to `$x is not null`
 * [<a href="https://issues.apache.org/jira/browse/CALCITE-884">CALCITE-884</a>]
   File adapter (Henry Olson)
+  * [<a href="https://issues.apache.org/jira/browse/CALCITE-1704">CALCITE-1704</a>]
+    Execute queries on CSV files using simple `sqlline` command
+  * [<a href="https://issues.apache.org/jira/browse/CALCITE-1676">CALCITE-1676</a>]
+    Scan directory for .csv, .json and .gz files
   * Allow multiple Calcite columns to be derived from one HTML column,
     e.g. Location &rarr; Lat, Lon
   * Improved pattern match: added `matchSeq` to allow selection of
     <i>n</i>th match
   * Add replace patterns to cell parsing logic
-  * Add handling for tables without `&lt;TH&gt;` elements
-  * Unit tests using local files; URL tests are contingent on network
-    access
-  * Ability to parse HTML from local files
-  * Derived from CSV adapter
+  * Add handling for tables without `<TH>` elements
+  * Unit tests using local files (URL tests are contingent on network
+    access)
+  * Ability to parse HTML, CSV and JSON from local files
+  * Combine the <a href="https://github.com/HenryOlson/optiq-web">optiq-web</a>
+    project with code from the
+    <a href="{{ site.apiroot }}/org/apache/calcite/adapter/csv/package-summary.html">CSV adapter</a>
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1652">CALCITE-1652</a>]
+  Allow `GROUPING` function to have multiple arguments, like `GROUPING_ID`
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1634">CALCITE-1634</a>]
+  Make `RelBuilder.distinct` no-op if input is already distinct; use it in
+  `RelDecorrelator`
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1635">CALCITE-1635</a>]
+  Add `MinRowCount` metadata
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1628">CALCITE-1628</a>]
+  Add an alternative match pattern for `SemiJoinRule`
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1618">CALCITE-1618</a>]
+  `SortProjectTransposeRule` should check for monotonicity preserving `CAST`
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1510">CALCITE-1510</a>]
+  In `INSERT`/`UPSERT` without an explicit target column list, allow fewer source
+  columns than table (Kevin Liew)
+  * Check for default value only when target field is null
+    (Rajeshbabu Chintaguntla)
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1603">CALCITE-1603</a>]
+  Support `TUMBLE` window function in the `GROUP BY` clause (Julian Hyde and
+  Haohui Mai)
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1606">CALCITE-1606</a>]
+  Add datetime scalar functions (Laurent Goujon)
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1604">CALCITE-1604</a>]
+  Add JDBC/ODBC scalar functions `DATABASE`, `IFNULL`, `USER` (Laurent Goujon)
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1549">CALCITE-1549</a>]
+  More helpful error message when schema, table or column not found
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-420">CALCITE-420</a>]
+  Add `REPLACE` function, callable with and without JDBC escape syntax (Riccardo
+  Tommasini)
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1557">CALCITE-1557</a>]
+  Add numeric scalar functions (Laurent Goujon)
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1258">CALCITE-1258</a>]
+  JDK9
+
+#### Bug-fixes, API changes and minor enhancements
+
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1706">CALCITE-1706</a>]
+  Disable `DruidAggregateFilterTransposeRule`, because it causes fine-grained
+  aggregations to be pushed to Druid
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1695">CALCITE-1695</a>]
+  Add class `RexSimplify`, providing an explicit `RexExecutor` for methods to
+  simplify `RexNode`s
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1694">CALCITE-1694</a>]
+  Pig adapter: Use the shaded Avatica dependency instead
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1561">CALCITE-1561</a>]
+  Make `PigTest` cluster aware of data files; hopefully this will prevent
+  intermittent test failures (Eli Levine)
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1696">CALCITE-1696</a>]
+  Support `RexLocalRef` for `EXPLAIN PLAN AS JSON`
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1683">CALCITE-1683</a>]
+  Druid-specific rules to transpose `Filter` with other relations
+  (Nishant Bangarwa)
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1684">CALCITE-1684</a>]
+  Change default precision of `VARCHAR` and `VARBINARY` types from 1 to
+  "unspecified" (Kevin Liew)
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1691">CALCITE-1691</a>]
+  `ClassCastException` in `RelOptUtil.containsNullableFields`, attempting to
+  convert executor to `RexExecutorImpl`
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1688">CALCITE-1688</a>]
+  Infinite loop during materialization substitution if query contains `Union`,
+  `Minus` or `Intersect`
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1665">CALCITE-1665</a>]
+  `HAVING` support in `RelToSqlConverter` (Zhiqiang He)
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1673">CALCITE-1673</a>]
+  In CSV adapter, query with `ORDER BY` or `GROUP BY` on `TIMESTAMP` column
+  throws CompileException (Gangadhar Kairi)
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1674">CALCITE-1674</a>]
+  `LIKE` does not match value that contains newline (Mark Payne)
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1675">CALCITE-1675</a>]
+  Two-level column name cannot be resolved in `ORDER BY`
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1667">CALCITE-1667</a>]
+  Forbid calls to JDK APIs that use the default locale, time zone or character
+  set
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1656">CALCITE-1656</a>]
+  Improve cost function in `DruidQuery` to encourage early column pruning
+  (Nishant Bangarwa)
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1664">CALCITE-1664</a>]
+  `CAST('<string>' as TIMESTAMP)` wrongly adds part of sub-second fraction to the
+  value
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1659">CALCITE-1659</a>]
+  Simplifying `CAST('YYYY-MM-DD hh:mm:ss.SSS' as TIMESTAMP)` should round the
+  sub-second fraction (Remus Rusanu)
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1439">CALCITE-1439</a>]
+  Handle errors during constant reduction
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1653">CALCITE-1653</a>]
+  Pass an expression executor to `RexUtil.simplify` for constant reduction (Remus
+  Rusanu)
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1601">CALCITE-1601</a>]
+  `DateRangeRules` loses OR filters
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1637">CALCITE-1637</a>]
+  Add mutable equivalents for all relational expressions (e.g. `MutableFilter`)
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1621">CALCITE-1621</a>]
+  Add a cast around the NULL literal in aggregate rules (Anton Mushin)
+  * Add `RexBuilder.makeNullLiteral(RelDataType)`
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1649">CALCITE-1649</a>]
+  Data type mismatch in `EnumerableMergeJoin`
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1636">CALCITE-1636</a>]
+  JDBC adapter generates wrong SQL for self join with sub-query (Zhiqiang-He)
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1633">CALCITE-1633</a>]
+  In plans, output `Correlate.joinType` attribute in lower-case, same as
+  `Join.joinType`
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1632">CALCITE-1632</a>]
+  Return type of "datetime + interval" expression
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-365">CALCITE-365</a>]
+  `AssertionError` while translating query with `WITH` and correlated sub-query
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1623">CALCITE-1623</a>]
+  Make sure `DATE`, `TIME` and `TIMESTAMP` literals have `Calendar` with GMT
+  timezone
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1619">CALCITE-1619</a>]
+  `CAST` is ignored by rules pushing operators into `DruidQuery`
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1617">CALCITE-1617</a>]
+  Druid adapter: Send timestamp literals to Druid as local time, not UTC
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1500">CALCITE-1500</a>]
+  Decouple materialization and lattice substitution from `VolcanoPlanner`
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1589">CALCITE-1589</a>]
+  Druid adapter: `timeseries` query shows all days, even if no data
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1572">CALCITE-1572</a>]
+  `JdbcSchema` throws exception when detecting nullable columns (Wu Xiang)
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1610">CALCITE-1610</a>]
+  `RelBuilder` sort-combining optimization treats aliases incorrectly (Jess
+  Balint)
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1595">CALCITE-1595</a>]
+  `RelBuilder.call` throws `NullPointerException` if argument types are invalid
+  (Jess Balint)
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1602">CALCITE-1602</a>]
+  Remove uses of deprecated APIs
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1569">CALCITE-1569</a>]
+  Code generation for fields of type `java.sql.Date` (Zhen Wang)
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1582">CALCITE-1582</a>]
+  `RelToSqlConverter` doesn't handle cartesian join (Jess Balint)
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1597">CALCITE-1597</a>]
+  Obsolete `Util.newInternal`, `.pre`, `.post`, `.permAssert` and
+  `Throwables.propagate`
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1586">CALCITE-1586</a>]
+  JDBC adapter generates wrong SQL if `UNION` has more than two inputs (Zhiqiang
+  He)
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1535">CALCITE-1535</a>]
+  Give error if column referenced in `ORDER BY` is ambiguous (Zhen Wang)
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1594">CALCITE-1594</a>]
+  `ConventionTraitDef.getConversionData()` is not thread-safe
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1577">CALCITE-1577</a>]
+  Druid adapter: Incorrect result - limit on timestamp disappears
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1587">CALCITE-1587</a>]
+  Druid adapter: `topN` query returns approximate results
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1578">CALCITE-1578</a>]
+  Druid adapter: wrong semantics of `topN` query limit with granularity
+* Druid adapter: Add `enum Granularity`
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1592">CALCITE-1592</a>]
+  `SqlToRelConverter` throws `UnsupportedOperationException` if query has
+  `NOT ... NOT IN`
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1590">CALCITE-1590</a>]
+  Support Guava version 21.0
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1575">CALCITE-1575</a>]
+  Literals may lose precision during expression reduction
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1546">CALCITE-1546</a>]
+  Wrong plan for `NOT IN` sub-queries with disjunction
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1574">CALCITE-1574</a>]
+  Memory leak in maven
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1571">CALCITE-1571</a>]
+  Could not resolve view with `SimpleCalciteSchema`
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1558">CALCITE-1558</a>]
+  `AggregateExpandDistinctAggregatesRule` gets field mapping wrong if group key
+  is used in aggregate function (Zhenghua Gao)
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1562">CALCITE-1562</a>]
+  Update jsr305 from 1.3.9 to 3.0.1
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1563">CALCITE-1563</a>]
+  In case-insensitive connection, non-existent tables use alphabetically
+  preceding table
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1544">CALCITE-1544</a>]
+  `AggregateJoinTransposeRule` fails to preserve row type (Kurt Young)
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1543">CALCITE-1543</a>]
+  Correlated scalar sub-query with multiple aggregates gives `AssertionError`
+  (Kurt Young)
+
+#### Web site and documentation
+
+* Maryann Xue joins PMC
+* Add 3 new committers (Gian Merlino, Jess Balint, Laurent Goujon)
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1657">CALCITE-1657</a>]
+  Release Calcite 1.12.0
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1677">CALCITE-1677</a>]
+  Replace duplicate avatica docs with a redirect
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1685">CALCITE-1685</a>]
+  Site: `defaultNullCollation` key listed as `materializationsEnabled`
+  (Kevin Liew)
+* Add MapD to <a href="{{ site.baseurl }}/docs/powered_by.html">Powered by
+  Calcite</a> page (Todd Mostak)
+* Diagram of logos of projects and products powered by Calcite
+* [<a href="https://issues.apache.org/jira/browse/CALCITE-1622">CALCITE-1622</a>]
+  Bugs in website example code (Damjan Jovanovic)
 
 ## <a href="https://github.com/apache/calcite/releases/tag/calcite-1.11.0">1.11.0</a> / 2017-01-09
 {: #v1-11-0}

http://git-wip-us.apache.org/repos/asf/calcite/blob/447a8f39/site/_docs/howto.md
----------------------------------------------------------------------
diff --git a/site/_docs/howto.md b/site/_docs/howto.md
index 5a89cc4..9ab75ef 100644
--- a/site/_docs/howto.md
+++ b/site/_docs/howto.md
@@ -39,8 +39,8 @@ Unpack the source distribution `.tar.gz` or `.zip` file,
 then build using maven:
 
 {% highlight bash %}
-$ tar xvfz calcite-1.11.0-source.tar.gz
-$ cd calcite-1.11.0
+$ tar xvfz calcite-1.12.0-source.tar.gz
+$ cd calcite-1.12.0
 $ mvn install
 {% endhighlight %}
 
@@ -404,7 +404,7 @@ the `KEYS` file.
 Before you start:
 
 * Set up signing keys as described above.
-* Make sure you are using JDK 1.7 (not 1.8).
+* Make sure you are using JDK 1.8 (not 1.6 or 9).
 * Make sure build and tests succeed with `-Dcalcite.test.db=hsqldb` (the default)
 
 {% highlight bash %}


[3/4] calcite git commit: Add file headers; fix rat, assembly and checkstyle warnings

Posted by jh...@apache.org.
Add file headers; fix rat, assembly and checkstyle warnings

Rename a few private Druid rule classes to be consistent with naming
convention, and fix javadoc.


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

Branch: refs/heads/branch-1.12
Commit: 24eae878d6267c1fc2ba4d826f9a0f129a4f9ded
Parents: 0e11746
Author: Julian Hyde <jh...@apache.org>
Authored: Wed Mar 15 11:36:20 2017 -0700
Committer: Julian Hyde <jh...@apache.org>
Committed: Fri Mar 17 12:23:30 2017 -0700

----------------------------------------------------------------------
 .../calcite/adapter/druid/DruidRules.java       | 132 +++++++++++--------
 pom.xml                                         |   3 +
 site/_docs/avatica_json_reference.md            |  18 +++
 site/_docs/avatica_overview.md                  |  19 +++
 site/_docs/avatica_protobuf_reference.md        |  19 +++
 site/_docs/avatica_roadmap.md                   |  19 +++
 src/main/config/assemblies/source-assembly.xml  |   6 +-
 7 files changed, 160 insertions(+), 56 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/calcite/blob/24eae878/druid/src/main/java/org/apache/calcite/adapter/druid/DruidRules.java
----------------------------------------------------------------------
diff --git a/druid/src/main/java/org/apache/calcite/adapter/druid/DruidRules.java b/druid/src/main/java/org/apache/calcite/adapter/druid/DruidRules.java
index b22809c..2054c11 100644
--- a/druid/src/main/java/org/apache/calcite/adapter/druid/DruidRules.java
+++ b/druid/src/main/java/org/apache/calcite/adapter/druid/DruidRules.java
@@ -75,35 +75,37 @@ public class DruidRules {
   public static final DruidFilterRule FILTER = new DruidFilterRule();
   public static final DruidProjectRule PROJECT = new DruidProjectRule();
   public static final DruidAggregateRule AGGREGATE = new DruidAggregateRule();
-  public static final DruidProjectAggregateRule PROJECT_AGGREGATE = new DruidProjectAggregateRule();
+  public static final DruidAggregateProjectRule AGGREGATE_PROJECT =
+      new DruidAggregateProjectRule();
   public static final DruidSortRule SORT = new DruidSortRule();
-  public static final DruidProjectSortRule PROJECT_SORT = new DruidProjectSortRule();
-  public static final DruidSortProjectRule SORT_PROJECT = new DruidSortProjectRule();
-
-  public static final DruidProjectFilterTransposeRule PROJECT_FILTER_TRANSPOSE_RULE =
+  public static final DruidSortProjectTransposeRule SORT_PROJECT_TRANSPOSE =
+      new DruidSortProjectTransposeRule();
+  public static final DruidProjectSortTransposeRule PROJECT_SORT_TRANSPOSE =
+      new DruidProjectSortTransposeRule();
+  public static final DruidProjectFilterTransposeRule PROJECT_FILTER_TRANSPOSE =
       new DruidProjectFilterTransposeRule();
-
-  public static final DruidFilterProjectTransposeRule FILTER_PROJECT_TRANSPOSE_RULE =
+  public static final DruidFilterProjectTransposeRule FILTER_PROJECT_TRANSPOSE =
       new DruidFilterProjectTransposeRule();
-
-  public static final DruidAggregateFilterTransposeRule AGGREGATE_FILTER_TRANSPOSE_RULE =
+  public static final DruidAggregateFilterTransposeRule AGGREGATE_FILTER_TRANSPOSE =
       new DruidAggregateFilterTransposeRule();
-
-  public static final DruidFilterAggregateTransposeRule FILTER_AGGREGATE_TRANSPOSE_RULE =
+  public static final DruidFilterAggregateTransposeRule FILTER_AGGREGATE_TRANSPOSE =
       new DruidFilterAggregateTransposeRule();
 
   public static final List<RelOptRule> RULES =
       ImmutableList.of(FILTER,
-          PROJECT_FILTER_TRANSPOSE_RULE,
+          PROJECT_FILTER_TRANSPOSE,
           // Disabled, per
           //   [CALCITE-1706] DruidAggregateFilterTransposeRule
           //   causes very fine-grained aggregations to be pushed to Druid
-          // AGGREGATE_FILTER_TRANSPOSE_RULE,
-          PROJECT_AGGREGATE,
-          PROJECT, AGGREGATE,
-          FILTER_AGGREGATE_TRANSPOSE_RULE,
-          FILTER_PROJECT_TRANSPOSE_RULE,
-          PROJECT_SORT, SORT, SORT_PROJECT);
+          // AGGREGATE_FILTER_TRANSPOSE,
+          AGGREGATE_PROJECT,
+          PROJECT,
+          AGGREGATE,
+          FILTER_AGGREGATE_TRANSPOSE,
+          FILTER_PROJECT_TRANSPOSE,
+          PROJECT_SORT_TRANSPOSE,
+          SORT,
+          SORT_PROJECT_TRANSPOSE);
 
   /** Predicate that returns whether Druid can not handle an aggregate. */
   private static final Predicate<Aggregate> BAD_AGG =
@@ -201,10 +203,10 @@ public class DruidRules {
       call.transformTo(newDruidQuery);
     }
 
-    /* Splits the filter condition in two groups: those that filter on the timestamp column
-     * and those that filter on other fields */
+    /** Splits the filter condition in two groups: those that filter on the timestamp column
+     * and those that filter on other fields. */
     private static Pair<List<RexNode>, List<RexNode>> splitFilters(final RexBuilder rexBuilder,
-            final DruidQuery input, RexNode cond, final int timestampFieldIdx) {
+        final DruidQuery input, RexNode cond, final int timestampFieldIdx) {
       final List<RexNode> timeRangeNodes = new ArrayList<>();
       final List<RexNode> otherNodes = new ArrayList<>();
       List<RexNode> conjs = RelOptUtil.conjunctions(cond);
@@ -370,9 +372,12 @@ public class DruidRules {
    * Rule to push an {@link org.apache.calcite.rel.core.Aggregate} and
    * {@link org.apache.calcite.rel.core.Project} into a {@link DruidQuery}.
    */
-  private static class DruidProjectAggregateRule extends RelOptRule {
-    private DruidProjectAggregateRule() {
-      super(operand(Aggregate.class, operand(Project.class, operand(DruidQuery.class, none()))));
+  private static class DruidAggregateProjectRule extends RelOptRule {
+    private DruidAggregateProjectRule() {
+      super(
+          operand(Aggregate.class,
+              operand(Project.class,
+                  operand(DruidQuery.class, none()))));
     }
 
     public void onMatch(RelOptRuleCall call) {
@@ -465,9 +470,12 @@ public class DruidRules {
    * {@link org.apache.calcite.rel.core.Project}. Useful to transform
    * to complex Druid queries.
    */
-  private static class DruidProjectSortRule extends SortProjectTransposeRule {
-    private DruidProjectSortRule() {
-      super(operand(Sort.class, operand(Project.class, operand(DruidQuery.class, none()))));
+  private static class DruidSortProjectTransposeRule
+      extends SortProjectTransposeRule {
+    private DruidSortProjectTransposeRule() {
+      super(
+          operand(Sort.class,
+              operand(Project.class, operand(DruidQuery.class, none()))));
     }
   }
 
@@ -476,14 +484,18 @@ public class DruidRules {
    * {@link org.apache.calcite.rel.core.Sort}. Useful if after pushing Sort,
    * we could not push it inside DruidQuery.
    */
-  private static class DruidSortProjectRule extends ProjectSortTransposeRule {
-    private DruidSortProjectRule() {
-      super(operand(Project.class, operand(Sort.class, operand(DruidQuery.class, none()))));
+  private static class DruidProjectSortTransposeRule
+      extends ProjectSortTransposeRule {
+    private DruidProjectSortTransposeRule() {
+      super(
+          operand(Project.class,
+              operand(Sort.class, operand(DruidQuery.class, none()))));
     }
   }
 
   /**
-   * Rule to push an {@link org.apache.calcite.rel.core.Aggregate} into a {@link DruidQuery}.
+   * Rule to push a {@link org.apache.calcite.rel.core.Sort}
+   * into a {@link DruidQuery}.
    */
   private static class DruidSortRule extends RelOptRule {
     private DruidSortRule() {
@@ -510,7 +522,7 @@ public class DruidRules {
       call.transformTo(DruidQuery.extendQuery(query, newSort));
     }
 
-    /* Check sort valid */
+    /** Checks whether sort is valid. */
     private static boolean validSortLimit(Sort sort, DruidQuery query) {
       if (sort.offset != null && RexLiteral.intValue(sort.offset) != 0) {
         // offset not supported by Druid
@@ -557,7 +569,7 @@ public class DruidRules {
     }
   }
 
-  /* Check if any of the references leads to the timestamp column */
+  /** Checks whether any of the references leads to the timestamp column. */
   private static boolean checkTimestampRefOnQuery(ImmutableBitSet set, RelNode top,
       DruidQuery query) {
     if (top instanceof Project) {
@@ -589,52 +601,66 @@ public class DruidRules {
   }
 
   /**
-   * Rule to push an {@link org.apache.calcite.rel.core.Project} past a
-   * {@link org.apache.calcite.rel.core.Filter} when filter is on top of {@link org.apache.calcite.adapter.druid.DruidQuery}
+   * Rule to push a {@link org.apache.calcite.rel.core.Project}
+   * past a {@link org.apache.calcite.rel.core.Filter}
+   * when {@code Filter} is on top of a {@link DruidQuery}.
    */
-  private static class DruidProjectFilterTransposeRule extends ProjectFilterTransposeRule {
+  private static class DruidProjectFilterTransposeRule
+      extends ProjectFilterTransposeRule {
     private DruidProjectFilterTransposeRule() {
       super(
-          operand(Project.class, operand(Filter.class, any())), PushProjector.ExprCondition.FALSE,
+          operand(Project.class,
+              operand(Filter.class, any())),
+          PushProjector.ExprCondition.FALSE,
           RelFactories.LOGICAL_BUILDER);
     }
   }
 
   /**
-   * Rule to push an {@link org.apache.calcite.rel.core.Filter} past a
-   * {@link org.apache.calcite.rel.core.Project} when project is on top of {@link org.apache.calcite.adapter.druid.DruidQuery}
+   * Rule to push a {@link org.apache.calcite.rel.core.Filter}
+   * past a {@link org.apache.calcite.rel.core.Project}
+   * when {@code Project} is on top of a {@link DruidQuery}.
    */
-  private static class DruidFilterProjectTransposeRule extends FilterProjectTransposeRule {
+  private static class DruidFilterProjectTransposeRule
+      extends FilterProjectTransposeRule {
     private DruidFilterProjectTransposeRule() {
       super(
-          operand(Filter.class, operand(Project.class, operand(DruidQuery.class, none()))), true,
-          true, RelFactories.LOGICAL_BUILDER
-      );
+          operand(Filter.class,
+              operand(Project.class,
+                  operand(DruidQuery.class, none()))),
+          true, true, RelFactories.LOGICAL_BUILDER);
     }
   }
 
   /**
-   * Rule to push an {@link org.apache.calcite.rel.core.Filter} past a
-   * {@link org.apache.calcite.rel.core.Project} when project is on top of {@link org.apache.calcite.adapter.druid.DruidQuery}
+   * Rule to push an {@link org.apache.calcite.rel.core.Aggregate}
+   * past a {@link org.apache.calcite.rel.core.Filter}
+   * when {@code Filter} is on top of a {@link DruidQuery}.
    */
-  private static class DruidAggregateFilterTransposeRule extends AggregateFilterTransposeRule {
+  private static class DruidAggregateFilterTransposeRule
+      extends AggregateFilterTransposeRule {
     private DruidAggregateFilterTransposeRule() {
       super(
-          operand(Aggregate.class, operand(Filter.class, operand(DruidQuery.class, none()))),
+          operand(Aggregate.class,
+              operand(Filter.class,
+                  operand(DruidQuery.class, none()))),
           RelFactories.LOGICAL_BUILDER);
     }
   }
 
   /**
-   * Rule to push an {@link org.apache.calcite.rel.core.Aggregate} past a
-   * {@link org.apache.calcite.rel.core.Filter} when filter is on top of {@link org.apache.calcite.adapter.druid.DruidQuery}
+   * Rule to push an {@link org.apache.calcite.rel.core.Filter}
+   * past an {@link org.apache.calcite.rel.core.Aggregate}
+   * when {@code Aggregate} is on top of a {@link DruidQuery}.
    */
-  private static class DruidFilterAggregateTransposeRule extends FilterAggregateTransposeRule {
+  private static class DruidFilterAggregateTransposeRule
+      extends FilterAggregateTransposeRule {
     private DruidFilterAggregateTransposeRule() {
       super(
-          operand(Filter.class, operand(Aggregate.class, operand(DruidQuery.class, none()))),
-          RelFactories.LOGICAL_BUILDER
-      );
+          operand(Filter.class,
+              operand(Aggregate.class,
+                  operand(DruidQuery.class, none()))),
+          RelFactories.LOGICAL_BUILDER);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/calcite/blob/24eae878/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index f93f80e..76c27b0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -513,8 +513,11 @@ limitations under the License.
                  license notices. -->
             <exclude>src/main/resources/META-INF/services/java.sql.Driver</exclude>
             <exclude>**/src/test/resources/**/*.csv</exclude>
+            <exclude>**/src/test/resources/**/*.txt</exclude>
             <exclude>**/src/test/resources/bug/archers.json</exclude>
             <exclude>**/src/test/resources/foodmart-schema.spec</exclude>
+            <exclude>**/data.txt</exclude>
+            <exclude>**/data2.txt</exclude>
 
             <!-- Exclude all of avatica, RAT is run in Avatica -->
             <exclude>avatica/**</exclude>

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

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

http://git-wip-us.apache.org/repos/asf/calcite/blob/24eae878/site/_docs/avatica_protobuf_reference.md
----------------------------------------------------------------------
diff --git a/site/_docs/avatica_protobuf_reference.md b/site/_docs/avatica_protobuf_reference.md
index 9335558..250b6cd 100644
--- a/site/_docs/avatica_protobuf_reference.md
+++ b/site/_docs/avatica_protobuf_reference.md
@@ -5,3 +5,22 @@ sidebar_title: Protobuf Reference
 redirect_to: /avatica/docs/protobuf_reference.html
 permalink: /docs/avatica_protobuf_reference.html
 ---
+
+<!--
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
+-->

http://git-wip-us.apache.org/repos/asf/calcite/blob/24eae878/site/_docs/avatica_roadmap.md
----------------------------------------------------------------------
diff --git a/site/_docs/avatica_roadmap.md b/site/_docs/avatica_roadmap.md
index d98ff02..54d3f18 100644
--- a/site/_docs/avatica_roadmap.md
+++ b/site/_docs/avatica_roadmap.md
@@ -5,3 +5,22 @@ sidebar_title: Roadmap
 permalink: /docs/avatica_roadmap.html
 redirect_to: /avatica/docs/roadmap.html
 ---
+
+<!--
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
+-->

http://git-wip-us.apache.org/repos/asf/calcite/blob/24eae878/src/main/config/assemblies/source-assembly.xml
----------------------------------------------------------------------
diff --git a/src/main/config/assemblies/source-assembly.xml b/src/main/config/assemblies/source-assembly.xml
index bb38693..d4148de 100644
--- a/src/main/config/assemblies/source-assembly.xml
+++ b/src/main/config/assemblies/source-assembly.xml
@@ -25,7 +25,7 @@ limitations under the License.
     <!-- main project directory structure -->
     <fileSet>
       <directory>.</directory>
-      <outputDirectory>/</outputDirectory>
+      <outputDirectory/>
       <useDefaultExcludes>true</useDefaultExcludes>
       <excludes>
         <!-- build output -->
@@ -93,14 +93,14 @@ limitations under the License.
     <fileSet>
       <directory>${project.build.directory}/maven-shared-archive-resources/META-INF
       </directory>
-      <outputDirectory>/</outputDirectory>
+      <outputDirectory/>
     </fileSet>
     <fileSet>
       <directory>${project.build.directory}</directory>
       <includes>
         <include>git.properties</include>
       </includes>
-      <outputDirectory>/</outputDirectory>
+      <outputDirectory/>
     </fileSet>
   </fileSets>
 </assembly>


[2/4] calcite git commit: [CALCITE-1704] Execute queries on CSV files using simple sqlline command

Posted by jh...@apache.org.
[CALCITE-1704] Execute queries on CSV files using simple sqlline command

Document how to use file adapter without an explicit model;
make sure that baseDirectory is set even without explicit model.


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

Branch: refs/heads/branch-1.12
Commit: 0e11746aca3e0abf4e60fd1545eb89ecf174ca95
Parents: 6b54b6e
Author: Julian Hyde <jh...@apache.org>
Authored: Thu Mar 16 11:24:06 2017 -0700
Committer: Julian Hyde <jh...@apache.org>
Committed: Fri Mar 17 11:48:45 2017 -0700

----------------------------------------------------------------------
 .../org/apache/calcite/model/ModelHandler.java  | 10 ++--
 site/_docs/file_adapter.md                      | 56 +++++++++++++++++---
 2 files changed, 56 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/calcite/blob/0e11746a/core/src/main/java/org/apache/calcite/model/ModelHandler.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/model/ModelHandler.java b/core/src/main/java/org/apache/calcite/model/ModelHandler.java
index bd8bcac..adfdd07 100644
--- a/core/src/main/java/org/apache/calcite/model/ModelHandler.java
+++ b/core/src/main/java/org/apache/calcite/model/ModelHandler.java
@@ -236,13 +236,15 @@ public class ModelHandler {
           builder.put(extraOperand.camelName, modelUri);
           break;
         case BASE_DIRECTORY:
+          File f = null;
           if (!modelUri.startsWith("inline:")) {
             final File file = new File(modelUri);
-            final File parentFile = file.getParentFile();
-            if (parentFile != null) {
-              builder.put(extraOperand.camelName, parentFile);
-            }
+            f = file.getParentFile();
           }
+          if (f == null) {
+            f = new File("");
+          }
+          builder.put(extraOperand.camelName, f);
           break;
         case TABLES:
           if (jsonSchema instanceof JsonCustomSchema) {

http://git-wip-us.apache.org/repos/asf/calcite/blob/0e11746a/site/_docs/file_adapter.md
----------------------------------------------------------------------
diff --git a/site/_docs/file_adapter.md b/site/_docs/file_adapter.md
index b47d72a..57e9de4 100644
--- a/site/_docs/file_adapter.md
+++ b/site/_docs/file_adapter.md
@@ -22,7 +22,7 @@ limitations under the License.
 {% endcomment %}
 -->
 
-# Overview
+## Overview
 
 The file adapter is able to read files in a variety of formats,
 and can also read files over various protocols, such as HTTP.
@@ -53,7 +53,11 @@ comprising almost 1/2 of the state's population:
 +---------------------+----------------------+
 ```
 
-# A simple example
+For simple file formats such as CSV, the file is self-describing and
+you don't even need a model.
+See [CSV files and model-free browsing](#csv_files_and_model_free_browsing).
+
+## A simple example
 
 Let's start with a simple example. First, we need a
 [model definition]({{ site.baseurl }}/docs/model.html),
@@ -151,7 +155,7 @@ sqlline> select * from sales.emps;
 5 rows selected
 {% endhighlight %}
 
-# Mapping tables
+## Mapping tables
 
 Now for a more complex example. This time we connect to Wikipedia via
 HTTP, read pages for US states and cities, and extract data from HTML
@@ -208,7 +212,7 @@ navigation; selectors for both tables and fields follow the
 Field definitions may be used to rename or skip source fields, to
 select and condition the cell contents and to set a data type.
 
-# Parsing cell contents
+### Parsing cell contents
 
 The file adapter can select DOM nodes within a cell, replace text
 within the selected element, match within the selected text, and
@@ -217,7 +221,7 @@ steps are applied in the order described and replace and match
 patterns are based on
 [Java regular expressions](http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html).
 
-# Further examples
+### Further examples
 
 There are more examples in the form of a script:
 
@@ -229,7 +233,47 @@ $ ./sqlline -f file/src/test/resources/webjoin.sql
 each query containing a join.  These are expected and do not affect
 query results.  These messages will be suppressed in the next release.)
 
-# Future improvements
+## CSV files and model-free browsing
+
+Some files are describe their own schema, and for these files, we do not need a model. For example, `DEPTS.csv` has an
+integer `DEPTNO` column and a string `NAME` column:
+
+{% highlight json %}
+DEPTNO:int,NAME:string
+10,"Sales"
+20,"Marketing"
+30,"Accounts"
+{% endhighlight %}
+
+You can launch `sqlline`, and pointing the file adapter that directory,
+and every CSV file becomes a table:
+
+{% highlight bash %}
+$ ls file/src/test/resources/sales-csv
+ -rw-r--r-- 1 jhyde jhyde  62 Mar 15 10:16 DEPTS.csv
+ -rw-r--r-- 1 jhyde jhyde 262 Mar 15 10:16 EMPS.csv.gz
+
+$ ./sqlline -u "jdbc:calcite:schemaFactory=org.apache.calcite.adapter.file.FileSchemaFactory;schema.directory=file/src/test/resources/sales-csv"
+sqlline> !tables
++-----------+-------------+------------+------------+
+| TABLE_CAT | TABLE_SCHEM | TABLE_NAME | TABLE_TYPE |
++-----------+-------------+------------+------------+
+|           | adhoc       | DEPTS      | TABLE      |
+|           | adhoc       | EMPS       | TABLE      |
++-----------+-------------+------------+------------+
+
+sqlline> select distinct deptno from depts;
++--------+
+| DEPTNO |
++--------+
+| 20     |
+| 10     |
+| 30     |
++--------+
+3 rows selected (0.985 seconds)
+{% endhighlight %}
+
+## Future improvements
 
 We are continuing to enhance the adapter, and would welcome
 contributions of new parsing capabilities (for example parsing JSON