You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by el...@apache.org on 2016/03/07 19:27:57 UTC

[19/59] [partial] calcite git commit: [CALCITE-1078] Detach avatica from the core calcite Maven project

http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/_docs/tutorial.md
----------------------------------------------------------------------
diff --git a/avatica/site/_docs/tutorial.md b/avatica/site/_docs/tutorial.md
new file mode 100644
index 0000000..73f8f8f
--- /dev/null
+++ b/avatica/site/_docs/tutorial.md
@@ -0,0 +1,760 @@
+---
+layout: docs
+title: Tutorial
+permalink: /docs/tutorial.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 %}
+-->
+
+This is a step-by-step tutorial that shows how to build and connect to
+Calcite. It uses a simple adapter that makes a directory of CSV files
+appear to be a schema containing tables. Calcite does the rest, and
+provides a full SQL interface.
+
+Calcite-example-CSV is a fully functional adapter for
+Calcite that reads
+text files in
+<a href="http://en.wikipedia.org/wiki/Comma-separated_values">CSV
+(comma-separated values)</a> format. It is remarkable that a couple of
+hundred lines of Java code are sufficient to provide full SQL query
+capability.
+
+CSV also serves as a template for building adapters to other
+data formats. Even though there are not many lines of code, it covers
+several important concepts:
+
+* user-defined schema using SchemaFactory and Schema interfaces;
+* declaring schemas in a model JSON file;
+* declaring views in a model JSON file;
+* user-defined table using the Table interface;
+* determining the record type of a table;
+* a simple implementation of Table, using the ScannableTable interface, that
+  enumerates all rows directly;
+* a more advanced implementation that implements FilterableTable, and can
+  filter out rows according to simple predicates;
+* advanced implementation of Table, using TranslatableTable, that translates
+  to relational operators using planner rules.
+
+## Download and build
+
+You need Java (1.7 or higher; 1.8 preferred), git and maven (3.2.1 or later).
+
+{% highlight bash %}
+$ git clone https://github.com/apache/calcite.git
+$ cd calcite
+$ mvn install -DskipTests -Dcheckstyle.skip=true
+$ cd example/csv
+{% endhighlight %}
+
+## First queries
+
+Now let's connect to Calcite using
+<a href="https://github.com/julianhyde/sqlline">sqlline</a>, a SQL shell
+that is included in this project.
+
+{% highlight bash %}
+$ ./sqlline
+sqlline> !connect jdbc:calcite:model=target/test-classes/model.json admin admin
+{% endhighlight %}
+
+(If you are running Windows, the command is `sqlline.bat`.)
+
+Execute a metadata query:
+
+{% highlight bash %}
+sqlline> !tables
++------------+--------------+-------------+---------------+----------+------+
+| TABLE_CAT  | TABLE_SCHEM  | TABLE_NAME  |  TABLE_TYPE   | REMARKS  | TYPE |
++------------+--------------+-------------+---------------+----------+------+
+| null       | SALES        | DEPTS       | TABLE         | null     | null |
+| null       | SALES        | EMPS        | TABLE         | null     | null |
+| null       | SALES        | HOBBIES     | TABLE         | null     | null |
+| null       | metadata     | COLUMNS     | SYSTEM_TABLE  | null     | null |
+| null       | metadata     | TABLES      | SYSTEM_TABLE  | null     | null |
++------------+--------------+-------------+---------------+----------+------+
+{% endhighlight %}
+
+(JDBC experts, note: sqlline's <code>!tables</code> command is just executing
+<a href="http://docs.oracle.com/javase/7/docs/api/java/sql/DatabaseMetaData.html#getTables(java.lang.String, java.lang.String, java.lang.String, java.lang.String[])"><code>DatabaseMetaData.getTables()</code></a>
+behind the scenes.
+It has other commands to query JDBC metadata, such as <code>!columns</code> and <code>!describe</code>.)
+
+As you can see there are 5 tables in the system: tables
+<code>EMPS</code>, <code>DEPTS</code> and <code>HOBBIES</code> in the current
+<code>SALES</code> schema, and <code>COLUMNS</code> and
+<code>TABLES</code> in the system <code>metadata</code> schema. The
+system tables are always present in Calcite, but the other tables are
+provided by the specific implementation of the schema; in this case,
+the <code>EMPS</code> and <code>DEPTS</code> tables are based on the
+<code>EMPS.csv</code> and <code>DEPTS.csv</code> files in the
+<code>target/test-classes</code> directory.
+
+Let's execute some queries on those tables, to show that Calcite is providing
+a full implementation of SQL. First, a table scan:
+
+{% highlight bash %}
+sqlline> SELECT * FROM emps;
++--------+--------+---------+---------+----------------+--------+-------+---+
+| EMPNO  |  NAME  | DEPTNO  | GENDER  |      CITY      | EMPID  |  AGE  | S |
++--------+--------+---------+---------+----------------+--------+-------+---+
+| 100    | Fred   | 10      |         |                | 30     | 25    | t |
+| 110    | Eric   | 20      | M       | San Francisco  | 3      | 80    | n |
+| 110    | John   | 40      | M       | Vancouver      | 2      | null  | f |
+| 120    | Wilma  | 20      | F       |                | 1      | 5     | n |
+| 130    | Alice  | 40      | F       | Vancouver      | 2      | null  | f |
++--------+--------+---------+---------+----------------+--------+-------+---+
+{% endhighlight %}
+
+Now JOIN and GROUP BY:
+
+{% highlight bash %}
+sqlline> SELECT d.name, COUNT(*)
+. . . .> FROM emps AS e JOIN depts AS d ON e.deptno = d.deptno
+. . . .> GROUP BY d.name;
++------------+---------+
+|    NAME    | EXPR$1  |
++------------+---------+
+| Sales      | 1       |
+| Marketing  | 2       |
++------------+---------+
+{% endhighlight %}
+
+Last, the VALUES operator generates a single row, and is a convenient
+way to test expressions and SQL built-in functions:
+
+{% highlight bash %}
+sqlline> VALUES CHAR_LENGTH('Hello, ' || 'world!');
++---------+
+| EXPR$0  |
++---------+
+| 13      |
++---------+
+{% endhighlight %}
+
+Calcite has many other SQL features. We don't have time to cover them
+here. Write some more queries to experiment.
+
+## Schema discovery
+
+Now, how did Calcite find these tables? Remember, core Calcite does not
+know anything about CSV files. (As a "database without a storage
+layer", Calcite doesn't know about any file formats.) Calcite knows about
+those tables because we told it to run code in the calcite-example-csv
+project.
+
+There are a couple of steps in that chain. First, we define a schema
+based on a schema factory class in a model file. Then the schema
+factory creates a schema, and the schema creates several tables, each
+of which knows how to get data by scanning a CSV file. Last, after
+Calcite has parsed the query and planned it to use those tables, Calcite
+invokes the tables to read the data as the query is being
+executed. Now let's look at those steps in more detail.
+
+On the JDBC connect string we gave the path of a model in JSON
+format. Here is the model:
+
+{% highlight json %}
+{
+  version: '1.0',
+  defaultSchema: 'SALES',
+  schemas: [
+    {
+      name: 'SALES',
+      type: 'custom',
+      factory: 'org.apache.calcite.adapter.csv.CsvSchemaFactory',
+      operand: {
+        directory: 'target/test-classes/sales'
+      }
+    }
+  ]
+}
+{% endhighlight %}
+
+The model defines a single schema called 'SALES'. The schema is
+powered by a plugin class,
+<a href="{{ site.sourceRoot }}/example/csv/src/main/java/org/apache/calcite/adapter/csv/CsvSchemaFactory.java">org.apache.calcite.adapter.csv.CsvSchemaFactory</a>,
+which is part of the
+calcite-example-csv project and implements the Calcite interface
+<a href="{{ site.apiRoot }}/org/apache/calcite/schema/SchemaFactory.html">SchemaFactory</a>.
+Its <code>create</code> method instantiates a
+schema, passing in the <code>directory</code> argument from the model file:
+
+{% highlight java %}
+public Schema create(SchemaPlus parentSchema, String name,
+    Map<String, Object> operand) {
+  String directory = (String) operand.get("directory");
+  String flavorName = (String) operand.get("flavor");
+  CsvTable.Flavor flavor;
+  if (flavorName == null) {
+    flavor = CsvTable.Flavor.SCANNABLE;
+  } else {
+    flavor = CsvTable.Flavor.valueOf(flavorName.toUpperCase());
+  }
+  return new CsvSchema(
+      new File(directory),
+      flavor);
+}
+{% endhighlight %}
+
+Driven by the model, the schema factory instantiates a single schema
+called 'SALES'.  The schema is an instance of
+<a href="{{ site.sourceRoot }}/example/csv/src/main/java/org/apache/calcite/adapter/csv/CsvSchema.java">org.apache.calcite.adapter.csv.CsvSchema</a>
+and implements the Calcite interface
+<a href="{{ site.apiRoot }}/org/apache/calcite/schema/Schema.html">Schema</a>.
+
+A schema's job is to produce a list of tables. (It can also list sub-schemas and
+table-functions, but these are advanced features and calcite-example-csv does
+not support them.) The tables implement Calcite's
+<a href="{{ site.apiRoot }}/org/apache/calcite/schema/Table.html">Table</a>
+interface. <code>CsvSchema</code> produces tables that are instances of
+<a href="{{ site.sourceRoot }}/example/csv/src/main/java/org/apache/calcite/adapter/csv/CsvTable.java">CsvTable</a>
+and its sub-classes.
+
+Here is the relevant code from <code>CsvSchema</code>, overriding the
+<code><a href="{{ site.apiRoot }}/org/apache/calcite/schema/impl/AbstractSchema.html#getTableMap()">getTableMap()</a></code>
+method in the <code>AbstractSchema</code> base class.
+
+{% highlight java %}
+protected Map<String, Table> getTableMap() {
+  // Look for files in the directory ending in ".csv", ".csv.gz", ".json",
+  // ".json.gz".
+  File[] files = directoryFile.listFiles(
+      new FilenameFilter() {
+        public boolean accept(File dir, String name) {
+          final String nameSansGz = trim(name, ".gz");
+          return nameSansGz.endsWith(".csv")
+              || nameSansGz.endsWith(".json");
+        }
+      });
+  if (files == null) {
+    System.out.println("directory " + directoryFile + " not found");
+    files = new File[0];
+  }
+  // Build a map from table name to table; each file becomes a table.
+  final ImmutableMap.Builder<String, Table> builder = ImmutableMap.builder();
+  for (File file : files) {
+    String tableName = trim(file.getName(), ".gz");
+    final String tableNameSansJson = trimOrNull(tableName, ".json");
+    if (tableNameSansJson != null) {
+      JsonTable table = new JsonTable(file);
+      builder.put(tableNameSansJson, table);
+      continue;
+    }
+    tableName = trim(tableName, ".csv");
+    final Table table = createTable(file);
+    builder.put(tableName, table);
+  }
+  return builder.build();
+}
+
+/** Creates different sub-type of table based on the "flavor" attribute. */
+private Table createTable(File file) {
+  switch (flavor) {
+  case TRANSLATABLE:
+    return new CsvTranslatableTable(file, null);
+  case SCANNABLE:
+    return new CsvScannableTable(file, null);
+  case FILTERABLE:
+    return new CsvFilterableTable(file, null);
+  default:
+    throw new AssertionError("Unknown flavor " + flavor);
+  }
+}
+{% endhighlight %}
+
+The schema scans the directory and finds all files whose name ends
+with ".csv" and creates tables for them. In this case, the directory
+is <code>target/test-classes/sales</code> and contains files
+<code>EMPS.csv</code> and <code>DEPTS.csv</code>, which these become
+the tables <code>EMPS</code> and <code>DEPTS</code>.
+
+## Tables and views in schemas
+
+Note how we did not need to define any tables in the model; the schema
+generated the tables automatically.
+
+You can define extra tables,
+beyond those that are created automatically,
+using the <code>tables</code> property of a schema.
+
+Let's see how to create
+an important and useful type of table, namely a view.
+
+A view looks like a table when you are writing a query, but it doesn't store data.
+It derives its result by executing a query.
+The view is expanded while the query is being planned, so the query planner
+can often perform optimizations like removing expressions from the SELECT
+clause that are not used in the final result.
+
+Here is a schema that defines a view:
+
+{% highlight json %}
+{
+  version: '1.0',
+  defaultSchema: 'SALES',
+  schemas: [
+    {
+      name: 'SALES',
+      type: 'custom',
+      factory: 'org.apache.calcite.adapter.csv.CsvSchemaFactory',
+      operand: {
+        directory: 'target/test-classes/sales'
+      },
+      tables: [
+        {
+          name: 'FEMALE_EMPS',
+          type: 'view',
+          sql: 'SELECT * FROM emps WHERE gender = \'F\''
+        }
+      ]
+    }
+  ]
+}
+{% endhighlight %}
+
+The line <code>type: 'view'</code> tags <code>FEMALE_EMPS</code> as a view,
+as opposed to a regular table or a custom table.
+Note that single-quotes within the view definition are escaped using a
+back-slash, in the normal way for JSON.
+
+JSON doesn't make it easy to author long strings, so Calcite supports an
+alternative syntax. If your view has a long SQL statement, you can instead
+supply a list of lines rather than a single string:
+
+{% highlight json %}
+{
+  name: 'FEMALE_EMPS',
+  type: 'view',
+  sql: [
+    'SELECT * FROM emps',
+    'WHERE gender = \'F\''
+  ]
+}
+{% endhighlight %}
+
+Now we have defined a view, we can use it in queries just as if it were a table:
+
+{% highlight sql %}
+sqlline> SELECT e.name, d.name FROM female_emps AS e JOIN depts AS d on e.deptno = d.deptno;
++--------+------------+
+|  NAME  |    NAME    |
++--------+------------+
+| Wilma  | Marketing  |
++--------+------------+
+{% endhighlight %}
+
+## Custom tables
+
+Custom tables are tables whose implementation is driven by user-defined code.
+They don't need to live in a custom schema.
+
+There is an example in <code>model-with-custom-table.json</code>:
+
+{% highlight json %}
+{
+  version: '1.0',
+  defaultSchema: 'CUSTOM_TABLE',
+  schemas: [
+    {
+      name: 'CUSTOM_TABLE',
+      tables: [
+        {
+          name: 'EMPS',
+          type: 'custom',
+          factory: 'org.apache.calcite.adapter.csv.CsvTableFactory',
+          operand: {
+            file: 'target/test-classes/sales/EMPS.csv.gz',
+            flavor: "scannable"
+          }
+        }
+      ]
+    }
+  ]
+}
+{% endhighlight %}
+
+We can query the table in the usual way:
+
+{% highlight sql %}
+sqlline> !connect jdbc:calcite:model=target/test-classes/model-with-custom-table.json admin admin
+sqlline> SELECT empno, name FROM custom_table.emps;
++--------+--------+
+| EMPNO  |  NAME  |
++--------+--------+
+| 100    | Fred   |
+| 110    | Eric   |
+| 110    | John   |
+| 120    | Wilma  |
+| 130    | Alice  |
++--------+--------+
+{% endhighlight %}
+
+The schema is a regular one, and contains a custom table powered by
+<a href="{{ site.sourceRoot }}/example/csv/src/main/java/org/apache/calcite/adapter/csv/CsvTableFactory.java">org.apache.calcite.adapter.csv.CsvTableFactory</a>,
+which implements the Calcite interface
+<a href="{{ site.apiRoot }}/org/apache/calcite/schema/TableFactory.html">TableFactory</a>.
+Its <code>create</code> method instantiates a <code>CsvScannableTable</code>,
+passing in the <code>file</code> argument from the model file:
+
+{% highlight java %}
+public CsvTable create(SchemaPlus schema, String name,
+    Map<String, Object> map, RelDataType rowType) {
+  String fileName = (String) map.get("file");
+  final File file = new File(fileName);
+  final RelProtoDataType protoRowType =
+      rowType != null ? RelDataTypeImpl.proto(rowType) : null;
+  return new CsvScannableTable(file, protoRowType);
+}
+{% endhighlight %}
+
+Implementing a custom table is often a simpler alternative to implementing
+a custom schema. Both approaches might end up creating a similar implementation
+of the <code>Table</code> interface, but for the custom table you don't
+need to implement metadata discovery. (<code>CsvTableFactory</code>
+creates a <code>CsvScannableTable</code>, just as <code>CsvSchema</code> does,
+but the table implementation does not scan the filesystem for .csv files.)
+
+Custom tables require more work for the author of the model (the author
+needs to specify each table and its file explicitly) but also give the author
+more control (say, providing different parameters for each table).
+
+## Comments in models
+
+Models can include comments using `/* ... */` and `//` syntax:
+
+{% highlight json %}
+{
+  version: '1.0',
+  /* Multi-line
+     comment. */
+  defaultSchema: 'CUSTOM_TABLE',
+  // Single-line comment.
+  schemas: [
+    ..
+  ]
+}
+{% endhighlight %}
+
+(Comments are not standard JSON, but are a harmless extension.)
+
+## Optimizing queries using planner rules
+
+The table implementations we have seen so far are fine as long as the tables
+don't contain a great deal of data. But if your customer table has, say, a
+hundred columns and a million rows, you would rather that the system did not
+retrieve all of the data for every query. You would like Calcite to negotiate
+with the adapter and find a more efficient way of accessing the data.
+
+This negotiation is a simple form of query optimization. Calcite supports query
+optimization by adding <i>planner rules</i>. Planner rules operate by
+looking for patterns in the query parse tree (for instance a project on top
+of a certain kind of table), and
+
+Planner rules are also extensible, like schemas and tables. So, if you have a
+data store that you want to access via SQL, you first define a custom table or
+schema, and then you define some rules to make the access efficient.
+
+To see this in action, let's use a planner rule to access
+a subset of columns from a CSV file. Let's run the same query against two very
+similar schemas:
+
+{% highlight sql %}
+sqlline> !connect jdbc:calcite:model=target/test-classes/model.json admin admin
+sqlline> explain plan for select name from emps;
++-----------------------------------------------------+
+| PLAN                                                |
++-----------------------------------------------------+
+| EnumerableCalcRel(expr#0..9=[{inputs}], NAME=[$t1]) |
+|   EnumerableTableAccessRel(table=[[SALES, EMPS]])   |
++-----------------------------------------------------+
+sqlline> !connect jdbc:calcite:model=target/test-classes/smart.json admin admin
+sqlline> explain plan for select name from emps;
++-----------------------------------------------------+
+| PLAN                                                |
++-----------------------------------------------------+
+| EnumerableCalcRel(expr#0..9=[{inputs}], NAME=[$t1]) |
+|   CsvTableScan(table=[[SALES, EMPS]])               |
++-----------------------------------------------------+
+{% endhighlight %}
+
+What causes the difference in plan? Let's follow the trail of evidence. In the
+<code>smart.json</code> model file, there is just one extra line:
+
+{% highlight json %}
+flavor: "translatable"
+{% endhighlight %}
+
+This causes a <code>CsvSchema</code> to be created with
+<code>flavor = TRANSLATABLE</code>,
+and its <code>createTable</code> method creates instances of
+<a href="{{ site.sourceRoot }}/example/csv/src/main/java/org/apache/calcite/adapter/csv/CsvTranslatableTable.java">CsvTranslatableTable</a>
+rather than a <code>CsvScannableTable</code>.
+
+<code>CsvTranslatableTable</code> implements the
+<code><a href="{{ site.apiRoot }}/org/apache/calcite/schema/TranslatableTable.html#toRel()">TranslatableTable.toRel()</a></code>
+method to create
+<a href="{{ site.sourceRoot }}/example/csv/src/main/java/org/apache/calcite/adapter/csv/CsvTableScan.java">CsvTableScan</a>.
+Table scans are the leaves of a query operator tree.
+The usual implementation is
+<code><a href="{{ site.apiRoot }}/org/apache/calcite/adapter/enumerable/EnumerableTableScan.html">EnumerableTableScan</a></code>,
+but we have created a distinctive sub-type that will cause rules to fire.
+
+Here is the rule in its entirety:
+
+{% highlight java %}
+public class CsvProjectTableScanRule extends RelOptRule {
+  public static final CsvProjectTableScanRule INSTANCE =
+      new CsvProjectTableScanRule();
+
+  private CsvProjectTableScanRule() {
+    super(
+        operand(Project.class,
+            operand(CsvTableScan.class, none())),
+        "CsvProjectTableScanRule");
+  }
+
+  @Override
+  public void onMatch(RelOptRuleCall call) {
+    final Project project = call.rel(0);
+    final CsvTableScan scan = call.rel(1);
+    int[] fields = getProjectFields(project.getProjects());
+    if (fields == null) {
+      // Project contains expressions more complex than just field references.
+      return;
+    }
+    call.transformTo(
+        new CsvTableScan(
+            scan.getCluster(),
+            scan.getTable(),
+            scan.csvTable,
+            fields));
+  }
+
+  private int[] getProjectFields(List<RexNode> exps) {
+    final int[] fields = new int[exps.size()];
+    for (int i = 0; i < exps.size(); i++) {
+      final RexNode exp = exps.get(i);
+      if (exp instanceof RexInputRef) {
+        fields[i] = ((RexInputRef) exp).getIndex();
+      } else {
+        return null; // not a simple projection
+      }
+    }
+    return fields;
+  }
+}
+{% endhighlight %}
+
+The constructor declares the pattern of relational expressions that will cause
+the rule to fire.
+
+The <code>onMatch</code> method generates a new relational expression and calls
+<code><a href="{{ site.apiRoot }}/org/apache/calcite/plan/RelOptRuleCall.html#transformTo(org.apache.calcite.rel.RelNode)">RelOptRuleCall.transformTo()</a></code>
+to indicate that the rule has fired successfully.
+
+## The query optimization process
+
+There's a lot to say about how clever Calcite's query planner is, but we won't
+say it here. The cleverness is designed to take the burden off you, the writer
+of planner rules.
+
+First, Calcite doesn't fire rules in a prescribed order. The query optimization
+process follows many branches of a branching tree, just like a chess playing
+program examines many possible sequences of moves. If rules A and B both match a
+given section of the query operator tree, then Calcite can fire both.
+
+Second, Calcite uses cost in choosing between plans, but the cost model doesn't
+prevent rules from firing which may seem to be more expensive in the short term.
+
+Many optimizers have a linear optimization scheme. Faced with a choice between
+rule A and rule B, as above, such an optimizer needs to choose immediately. It
+might have a policy such as "apply rule A to the whole tree, then apply rule B
+to the whole tree", or apply a cost-based policy, applying the rule that
+produces the cheaper result.
+
+Calcite doesn't require such compromises.
+This makes it simple to combine various sets of rules.
+If, say you want to combine rules to recognize materialized views with rules to
+read from CSV and JDBC source systems, you just give Calcite the set of all
+rules and tell it to go at it.
+
+Calcite does use a cost model. The cost model decides which plan to ultimately
+use, and sometimes to prune the search tree to prevent the search space from
+exploding, but it never forces you to choose between rule A and rule B. This is
+important, because it avoids falling into local minima in the search space that
+are not actually optimal.
+
+Also (you guessed it) the cost model is pluggable, as are the table and query
+operator statistics it is based upon. But that can be a subject for later.
+
+## JDBC adapter
+
+The JDBC adapter maps a schema in a JDBC data source as a Calcite schema.
+
+For example, this schema reads from a MySQL "foodmart" database:
+
+{% highlight json %}
+{
+  version: '1.0',
+  defaultSchema: 'FOODMART',
+  schemas: [
+    {
+      name: 'FOODMART',
+      type: 'custom',
+      factory: 'org.apache.calcite.adapter.jdbc.JdbcSchema$Factory',
+      operand: {
+        jdbcDriver: 'com.mysql.jdbc.Driver',
+        jdbcUrl: 'jdbc:mysql://localhost/foodmart',
+        jdbcUser: 'foodmart',
+        jdbcPassword: 'foodmart'
+      }
+    }
+  ]
+}
+{% endhighlight %}
+
+(The FoodMart database will be familiar to those of you who have used
+the Mondrian OLAP engine, because it is Mondrian's main test data
+set. To load the data set, follow <a
+href="http://mondrian.pentaho.com/documentation/installation.php#2_Set_up_test_data">Mondrian's
+installation instructions</a>.)
+
+<b>Current limitations</b>: The JDBC adapter currently only pushes
+down table scan operations; all other processing (filtering, joins,
+aggregations and so forth) occurs within Calcite. Our goal is to push
+down as much processing as possible to the source system, translating
+syntax, data types and built-in functions as we go. If a Calcite query
+is based on tables from a single JDBC database, in principle the whole
+query should go to that database. If tables are from multiple JDBC
+sources, or a mixture of JDBC and non-JDBC, Calcite will use the most
+efficient distributed query approach that it can.
+
+## The cloning JDBC adapter
+
+The cloning JDBC adapter creates a hybrid database. The data is
+sourced from a JDBC database but is read into in-memory tables the
+first time each table is accessed. Calcite evaluates queries based on
+those in-memory tables, effectively a cache of the database.
+
+For example, the following model reads tables from a MySQL
+"foodmart" database:
+
+{% highlight json %}
+{
+  version: '1.0',
+  defaultSchema: 'FOODMART_CLONE',
+  schemas: [
+    {
+      name: 'FOODMART_CLONE',
+      type: 'custom',
+      factory: 'org.apache.calcite.adapter.clone.CloneSchema$Factory',
+      operand: {
+        jdbcDriver: 'com.mysql.jdbc.Driver',
+        jdbcUrl: 'jdbc:mysql://localhost/foodmart',
+        jdbcUser: 'foodmart',
+        jdbcPassword: 'foodmart'
+      }
+    }
+  ]
+}
+{% endhighlight %}
+
+Another technique is to build a clone schema on top of an existing
+schema. You use the <code>source</code> property to reference a schema
+defined earlier in the model, like this:
+
+{% highlight json %}
+{
+  version: '1.0',
+  defaultSchema: 'FOODMART_CLONE',
+  schemas: [
+    {
+      name: 'FOODMART',
+      type: 'custom',
+      factory: 'org.apache.calcite.adapter.jdbc.JdbcSchema$Factory',
+      operand: {
+        jdbcDriver: 'com.mysql.jdbc.Driver',
+        jdbcUrl: 'jdbc:mysql://localhost/foodmart',
+        jdbcUser: 'foodmart',
+        jdbcPassword: 'foodmart'
+      }
+    },
+    {
+      name: 'FOODMART_CLONE',
+      type: 'custom',
+      factory: 'org.apache.calcite.adapter.clone.CloneSchema$Factory',
+      operand: {
+        source: 'FOODMART'
+      }
+    }
+  ]
+}
+{% endhighlight %}
+
+You can use this approach to create a clone schema on any type of
+schema, not just JDBC.
+
+The cloning adapter isn't the be-all and end-all. We plan to develop
+more sophisticated caching strategies, and a more complete and
+efficient implementation of in-memory tables, but for now the cloning
+JDBC adapter shows what is possible and allows us to try out our
+initial implementations.
+
+## Further topics
+
+### Defining a custom schema
+
+(To be written.)
+
+### Modifying data
+
+How to enable DML operations (INSERT, UPDATE and DELETE) on your schema.
+
+(To be written.)
+
+### Calling conventions
+
+(To be written.)
+
+### Statistics and cost
+
+(To be written.)
+
+### Defining and using user-defined functions
+
+(To be written.)
+
+###  Defining tables in a schema
+
+(To be written.)
+
+### Defining custom tables
+
+(To be written.)
+
+### Built-in SQL implementation
+
+How does Calcite implement SQL, if an adapter does not implement all of the core
+relational operators?
+
+(To be written.)
+
+### Table functions
+
+(To be written.)

http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/_includes/anchor_links.html
----------------------------------------------------------------------
diff --git a/avatica/site/_includes/anchor_links.html b/avatica/site/_includes/anchor_links.html
new file mode 100644
index 0000000..c584ce5
--- /dev/null
+++ b/avatica/site/_includes/anchor_links.html
@@ -0,0 +1,33 @@
+<script>
+  var anchorForId = function (id) {
+    var anchor = document.createElement("a");
+    anchor.className = "header-link";
+    anchor.href      = "#" + id;
+    anchor.innerHTML = "<span class=\"sr-only\">Permalink</span><i class=\"fa fa-link\"></i>";
+    anchor.title = "Permalink";
+    return anchor;
+  };
+
+  var linkifyAnchors = function (level, containingElement) {
+    var headers = containingElement.getElementsByTagName("h" + level);
+    for (var h = 0; h < headers.length; h++) {
+      var header = headers[h];
+
+      if (typeof header.id !== "undefined" && header.id !== "") {
+        header.appendChild(anchorForId(header.id));
+      }
+    }
+  };
+
+  document.onreadystatechange = function () {
+    if (this.readyState === "complete") {
+      var contentBlock = document.getElementsByClassName("docs")[0] || document.getElementsByClassName("news")[0];
+      if (!contentBlock) {
+        return;
+      }
+      for (var level = 1; level <= 6; level++) {
+        linkifyAnchors(level, contentBlock);
+      }
+    }
+  };
+</script>

http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/_includes/docs_contents.html
----------------------------------------------------------------------
diff --git a/avatica/site/_includes/docs_contents.html b/avatica/site/_includes/docs_contents.html
new file mode 100644
index 0000000..2ac64bb
--- /dev/null
+++ b/avatica/site/_includes/docs_contents.html
@@ -0,0 +1,8 @@
+<div class="unit one-fifth hide-on-mobiles">
+  <aside>
+    {% for section in site.data.docs %}
+    <h4>{{ section.title }}</h4>
+    {% include docs_ul.html items=section.docs %}
+    {% endfor %}
+  </aside>
+</div>

http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/_includes/docs_contents_mobile.html
----------------------------------------------------------------------
diff --git a/avatica/site/_includes/docs_contents_mobile.html b/avatica/site/_includes/docs_contents_mobile.html
new file mode 100644
index 0000000..b3e0110
--- /dev/null
+++ b/avatica/site/_includes/docs_contents_mobile.html
@@ -0,0 +1,10 @@
+<div class="docs-nav-mobile unit whole show-on-mobiles">
+  <select onchange="if (this.value) window.location.href=this.value">
+    <option value="">Navigate the docs…</option>
+    {% for section in site.data.docs %}
+    <optgroup label="{{ section.title }}">
+      {% include docs_option.html items=section.docs %}
+    </optgroup>
+    {% endfor %}
+  </select>
+</div>

http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/_includes/docs_option.html
----------------------------------------------------------------------
diff --git a/avatica/site/_includes/docs_option.html b/avatica/site/_includes/docs_option.html
new file mode 100644
index 0000000..8c61578
--- /dev/null
+++ b/avatica/site/_includes/docs_option.html
@@ -0,0 +1,11 @@
+{% assign items = include.items %}
+
+{% for item in items %}
+  {% assign item_url = item | prepend:"{{ site.baseurl }}/docs/" | append:".html" %}
+
+  {% for p in site.docs %}
+    {% if p.url == item_url %}
+      <option value="{{ site.url }}{{ p.url }}">{{ p.title }}</option>
+    {% endif %}
+  {% endfor %}
+{% endfor %}

http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/_includes/docs_ul.html
----------------------------------------------------------------------
diff --git a/avatica/site/_includes/docs_ul.html b/avatica/site/_includes/docs_ul.html
new file mode 100644
index 0000000..768259c
--- /dev/null
+++ b/avatica/site/_includes/docs_ul.html
@@ -0,0 +1,29 @@
+{% assign items = include.items %}
+
+<ul>
+{% for item in items %}
+  {% comment %} Account for the baseurl to make sure we compare the full URI. {% endcomment %}
+  {% capture item_url %}{{site.baseurl}}{{ item | prepend:"/docs/" | append:".html" }}{% endcapture %}
+  {% capture current_url %}{{ site.baseurl }}{{ page.url }}{% endcapture %}
+
+  {% if item_url == current_url %}
+    {% assign c = "current" %}
+  {% else %}
+    {% assign c = "" %}
+  {% endif %}
+
+  {% for p in site.docs %}
+    {% capture p_url %}{{site.baseurl}}{{p.url}}{% endcapture %}
+    {% if p.sidebar_title != nil %}
+      {% assign anchor_text = p.sidebar_title %}
+    {% else %}
+      {% assign anchor_text = p.title %}
+    {% endif %}
+    {% if p_url == item_url %}
+      <li class="{{ c }}"><a href="{{ p_url }}">{{ anchor_text }}</a></li>
+      {% break %}
+    {% endif %}
+  {% endfor %}
+
+{% endfor %}
+</ul>

http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/_includes/footer.html
----------------------------------------------------------------------
diff --git a/avatica/site/_includes/footer.html b/avatica/site/_includes/footer.html
new file mode 100644
index 0000000..f965817
--- /dev/null
+++ b/avatica/site/_includes/footer.html
@@ -0,0 +1,15 @@
+<footer role="contentinfo">
+  <div id="poweredby">
+    <a href="http://www.apache.org/">
+      <span class="sr-only">Apache</span>
+      <img src="{{ site.baseurl }}/img/feather.png" width="190" height="77" alt="Apache Logo"></a>
+  </div>
+  <div id="copyright">
+  <p>The contents of this website are &copy;&nbsp;{{ site.time | date: '%Y' }}
+     <a href="https://www.apache.org/">Apache Software Foundation</a>
+     under the terms of
+     the <a href="https://www.apache.org/licenses/LICENSE-2.0.html">
+     Apache&nbsp;License&nbsp;v2</a>. Apache Calcite and its logo are
+     trademarks of the Apache Software Foundation.</p>
+  </div>
+</footer>

http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/_includes/header.html
----------------------------------------------------------------------
diff --git a/avatica/site/_includes/header.html b/avatica/site/_includes/header.html
new file mode 100644
index 0000000..7d42786
--- /dev/null
+++ b/avatica/site/_includes/header.html
@@ -0,0 +1,18 @@
+<header role="banner">
+  <nav class="mobile-nav show-on-mobiles">
+    {% include primary-nav-items.html %}
+  </nav>
+  <div class="grid">
+    <div class="unit one-third center-on-mobiles">
+      <h1>
+        <a href="{{ site.baseurl }}/">
+          <span class="sr-only">Apache Calcite</span>
+          <img src="{{ site.baseurl }}/img/logo.png" width="226" height="140" alt="Calcite Logo">
+        </a>
+      </h1>
+    </div>
+    <nav class="main-nav unit two-thirds hide-on-mobiles">
+      {% include primary-nav-items.html %}
+    </nav>
+  </div>
+</header>

http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/_includes/news_contents.html
----------------------------------------------------------------------
diff --git a/avatica/site/_includes/news_contents.html b/avatica/site/_includes/news_contents.html
new file mode 100644
index 0000000..d1481e7
--- /dev/null
+++ b/avatica/site/_includes/news_contents.html
@@ -0,0 +1,30 @@
+<div class="unit one-fifth hide-on-mobiles">
+  <aside>
+    <ul>
+      <li class="{% if page.title == 'News' %}current{% endif %}">
+        <a href="{{ site.baseurl }}/news/">All News</a>
+      </li>
+      <li class="{% if page.title == 'Releases' %}current{% endif %}">
+        <a href="{{ site.baseurl }}/news/releases/">Calcite Releases</a>
+      </li>
+    </ul>
+    <h4>Recent Releases</h4>
+    <ul>
+      {% for post in site.categories.release limit:5 %}
+      <li class="{% if page.title == post.title %}current{% endif %}">
+        <a href="{{ site.baseurl }}{{ post.url }}">{{ post.version }}</a>
+      </li>
+      {% endfor %}
+    </ul>
+    <h4>Other News</h4>
+    <ul>
+        {% for post in site.posts %}
+        {% unless post.categories contains 'release' %}
+        <li class="{% if page.title == post.title %}current{% endif %}">
+          <a href="{{ site.baseurl }}{{ post.url }}">{{ post.title }}</a>
+        </li>
+        {% endunless %}
+        {% endfor %}
+    </ul>
+  </aside>
+</div>

http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/_includes/news_contents_mobile.html
----------------------------------------------------------------------
diff --git a/avatica/site/_includes/news_contents_mobile.html b/avatica/site/_includes/news_contents_mobile.html
new file mode 100644
index 0000000..094da46
--- /dev/null
+++ b/avatica/site/_includes/news_contents_mobile.html
@@ -0,0 +1,11 @@
+<div class="docs-nav-mobile unit whole show-on-mobiles">
+  <select onchange="if (this.value) window.location.href=this.value">
+    <option value="">Navigate the blog…</option>
+    <option value="{{ site.baseurl }}/news/">Home</option>
+    <optgroup label="v1.x">
+      {% for post in site.posts %}
+      <option value="{{ post.url }}">{{ post.title }}</option>
+      {% endfor %}
+    </optgroup>
+  </select>
+</div>

http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/_includes/news_item.html
----------------------------------------------------------------------
diff --git a/avatica/site/_includes/news_item.html b/avatica/site/_includes/news_item.html
new file mode 100644
index 0000000..34eea0b
--- /dev/null
+++ b/avatica/site/_includes/news_item.html
@@ -0,0 +1,62 @@
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
+<article>
+  <h2>
+    <a href="{{ site.baseurl }}{{ post.url }}">
+      {{ post.title }}
+    </a>
+  </h2>
+  <span class="post-category">
+    <span class="label">
+      {{ post.categories | array_to_sentence_string }}
+    </span>
+  </span>
+  <div class="post-meta">
+    <span class="post-date">
+      {{ post.date | date_to_string }}
+    </span>
+    {% capture homepage %}http://people.apache.org/~{{ post.author }}{% endcapture %}
+    {% capture avatar %}http://people.apache.org/~{{ post.author }}/{{ post.author }}.jpg{% endcapture %}
+    {% for c in site.data.contributors %}
+      {% if c.apacheId == post.author %}
+        {% if c.homepage %}
+          {% assign homepage = c.homepage %}
+        {% else %}
+          {% capture homepage %}http://github.com/{{ c.githubId }}{% endcapture %}
+        {% endif %}
+        {% if c.avatar %}
+          {% assign avatar = c.avatar %}
+        {% else %}
+          {% capture avatar %}http://github.com/{{ c.githubId }}.png{% endcapture %}
+        {% endif %}
+      {% endif %}
+    {% endfor %}
+    <a href="{{ homepage }}" class="post-author">
+      <img src="{{ avatar }}"
+           class="avatar" alt="{{ post.author }} avatar"
+           width="24" height="24">
+      {{ post.author }}
+    </a>
+  </div>
+  <div class="post-content">
+    {{ post.content }}
+    {% if post.categories contains 'release' %}
+    <p>See the <a href="{{ site.baseurl }}/docs/history.html#{{ post.tag }}">release notes</a>;
+      <a href="{{ site.baseurl }}/downloads#source-releases">download</a> the release.</p>
+    {% endif %}
+  </div>
+</article>

http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/_includes/primary-nav-items.html
----------------------------------------------------------------------
diff --git a/avatica/site/_includes/primary-nav-items.html b/avatica/site/_includes/primary-nav-items.html
new file mode 100644
index 0000000..687cdd2
--- /dev/null
+++ b/avatica/site/_includes/primary-nav-items.html
@@ -0,0 +1,20 @@
+<ul>
+  <li class="{% if page.overview %}current{% endif %}">
+    <a href="{{ site.baseurl }}/">Home</a>
+  </li>
+  <li class="{% if page.url contains '/downloads/' %}current{% endif %}">
+    <a href="{{ site.baseurl }}/downloads/">Download</a>
+  </li>
+  <li class="{% if page.url contains '/community/' %}current{% endif %}">
+    <a href="{{ site.baseurl }}/community/">Community</a>
+  </li>
+  <li class="{% if page.url contains '/develop/' %}current{% endif %}">
+    <a href="{{ site.baseurl }}/develop/">Develop</a>
+  </li>
+  <li class="{% if page.url contains '/news/' %}current{% endif %}">
+    <a href="{{ site.baseurl }}/news/">News</a>
+  </li>
+  <li class="{% if page.url contains '/docs/' %}current{% endif %}">
+    <a href="{{ site.baseurl }}/docs/">Docs</a>
+  </li>
+</ul>

http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/_includes/section_nav.html
----------------------------------------------------------------------
diff --git a/avatica/site/_includes/section_nav.html b/avatica/site/_includes/section_nav.html
new file mode 100644
index 0000000..b025a70
--- /dev/null
+++ b/avatica/site/_includes/section_nav.html
@@ -0,0 +1,39 @@
+{% comment %}
+Map grabs the doc sections, giving us an array of arrays. Join, flattens all
+the items to a comma delimited string. Split turns it into an array again.
+{% endcomment %}
+{% assign docs = site.data.docs | map: 'docs' | join: ',' | split: ',' %}
+
+{% comment %}
+Because this is built for every page, lets find where we are in the ordered
+document list by comparing url strings. Then if there's something previous or
+next, lets build a link to it.
+{% endcomment %}
+
+{% for document in docs %}
+  {% assign document_url = document | prepend:"/docs/" | append:".html" %}
+  {% if document_url == page.url %}
+    <div class="section-nav">
+      <div class="left align-right">
+          {% if forloop.first %}
+            <span class="prev disabled">Previous</span>
+          {% else %}
+            {% assign previous = forloop.index0 | minus: 1 %}
+            {% capture previous_page %}{{ site.baseurl }}{{docs[previous] | prepend:"/docs/" | append:".html" }}{% endcapture %}
+            <a href="{{ previous_page }}" class="prev">Previous</a>
+          {% endif %}
+      </div>
+      <div class="right align-left">
+          {% if forloop.last %}
+            <span class="next disabled">Next</span>
+          {% else %}
+            {% assign next = forloop.index0 | plus: 1 %}
+            {% capture next_page %}{{ site.baseurl }}{{ docs[next] | prepend:"/docs/" | append:".html" }}{% endcapture %}
+            <a href="{{ next_page }}" class="next">Next</a>
+          {% endif %}
+      </div>
+    </div>
+    <div class="clear"></div>
+    {% break %}
+  {% endif %}
+{% endfor %}

http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/_includes/top.html
----------------------------------------------------------------------
diff --git a/avatica/site/_includes/top.html b/avatica/site/_includes/top.html
new file mode 100644
index 0000000..6eab814
--- /dev/null
+++ b/avatica/site/_includes/top.html
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML>
+<html lang="en-US">
+<head>
+  <meta charset="UTF-8">
+  <title>{{ page.title }}</title>
+  <meta name="viewport" content="width=device-width,initial-scale=1">
+  <meta name="generator" content="Jekyll v{{ jekyll.version }}">
+  <link rel="stylesheet" href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic,900">
+  <link rel="stylesheet" href="{{ site.baseurl }}/css/screen.css">
+  <link rel="icon" type="image/x-icon" href="{{ site.baseurl }}/favicon.ico">
+  <!--[if lt IE 9]>
+  <script src="/js/html5shiv.min.js"></script>
+  <script src="/js/respond.min.js"></script>
+  <![endif]-->
+</head>

http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/_layouts/default.html
----------------------------------------------------------------------
diff --git a/avatica/site/_layouts/default.html b/avatica/site/_layouts/default.html
new file mode 100644
index 0000000..f734c79
--- /dev/null
+++ b/avatica/site/_layouts/default.html
@@ -0,0 +1,12 @@
+{% include top.html %}
+
+<body class="wrap">
+  {% include header.html %}
+
+  {{ content }}
+
+  {% include footer.html %}
+  {% include anchor_links.html %}
+
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/_layouts/docs.html
----------------------------------------------------------------------
diff --git a/avatica/site/_layouts/docs.html b/avatica/site/_layouts/docs.html
new file mode 100644
index 0000000..a0a8a5c
--- /dev/null
+++ b/avatica/site/_layouts/docs.html
@@ -0,0 +1,23 @@
+---
+layout: default
+---
+
+  <section class="docs">
+    <div class="grid">
+
+      {% include docs_contents_mobile.html %}
+
+      <div class="unit four-fifths">
+        <article>
+          <h1>{{ page.title }}</h1>
+          {{ content }}
+          {% include section_nav.html %}
+        </article>
+      </div>
+
+      {% include docs_contents.html %}
+
+      <div class="clear"></div>
+
+    </div>
+  </section>

http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/_layouts/external.html
----------------------------------------------------------------------
diff --git a/avatica/site/_layouts/external.html b/avatica/site/_layouts/external.html
new file mode 100644
index 0000000..b934309
--- /dev/null
+++ b/avatica/site/_layouts/external.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <title>{{ page.title }}</title>
+
+    <meta http-equiv="refresh" content="0;url={{ page.external_url }}">
+  </head>
+  <body><!-- Google Analytics JavaScript --></body>
+</html>

http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/_layouts/news.html
----------------------------------------------------------------------
diff --git a/avatica/site/_layouts/news.html b/avatica/site/_layouts/news.html
new file mode 100644
index 0000000..8f7945f
--- /dev/null
+++ b/avatica/site/_layouts/news.html
@@ -0,0 +1,19 @@
+---
+layout: default
+---
+
+  <section class="news">
+    <div class="grid">
+
+      {% include news_contents_mobile.html %}
+
+      <div class="unit four-fifths">
+        {{ content }}
+      </div>
+
+      {% include news_contents.html %}
+
+      <div class="clear"></div>
+
+    </div>
+  </section>

http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/_layouts/news_item.html
----------------------------------------------------------------------
diff --git a/avatica/site/_layouts/news_item.html b/avatica/site/_layouts/news_item.html
new file mode 100644
index 0000000..e91e9e5
--- /dev/null
+++ b/avatica/site/_layouts/news_item.html
@@ -0,0 +1,49 @@
+---
+layout: news
+---
+
+<article>
+  <h2>
+    {{ page.title }}
+    <a href="{{ page.url }}" class="permalink" title="Permalink">∞</a>
+  </h2>
+  <span class="post-category">
+    <span class="label">
+      {{ page.categories | array_to_sentence_string }}
+    </span>
+  </span>
+  <div class="post-meta">
+    <span class="post-date">
+      {{ page.date | date_to_string }}
+    </span>
+    {% capture homepage %}http://people.apache.org/~{{ page.author }}{% endcapture %}
+    {% capture avatar %}http://people.apache.org/~{{ page.author }}/{{ page.author }}.jpg{% endcapture %}
+    {% for c in site.data.contributors %}
+      {% if c.apacheId == page.author %}
+        {% if c.homepage %}
+          {% assign homepage = c.homepage %}
+        {% else %}
+          {% capture homepage %}http://github.com/{{ c.githubId }}{% endcapture %}
+        {% endif %}
+        {% if c.avatar %}
+          {% assign avatar = c.avatar %}
+        {% else %}
+          {% capture avatar %}http://github.com/{{ c.githubId }}.png{% endcapture %}
+        {% endif %}
+      {% endif %}
+    {% endfor %}
+    <a href="{{ homepage }}" class="post-author">
+      <img src="{{ avatar }}"
+           class="avatar" alt="{{ page.author }} avatar"
+           width="24" height="24">
+      {{ page.author }}
+    </a>
+  </div>
+  <div class="post-content">
+    {{ content }}
+    {% if page.categories contains 'release' %}
+    <p>See the <a href="{{ site.baseurl }}/docs/history.html#{{ page.tag }}">release notes</a>;
+      <a href="{{ site.baseurl }}/downloads#source-releases">download</a> the release.</p>
+    {% endif %}
+  </div>
+</article>

http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/_layouts/page.html
----------------------------------------------------------------------
diff --git a/avatica/site/_layouts/page.html b/avatica/site/_layouts/page.html
new file mode 100644
index 0000000..bae31bb
--- /dev/null
+++ b/avatica/site/_layouts/page.html
@@ -0,0 +1,18 @@
+---
+layout: default
+---
+
+<section class="standalone">
+  <div class="grid">
+
+    <div class="unit whole">
+      <article>
+        <h1>{{ page.title }}</h1>
+        {{ content }}
+      </article>
+    </div>
+
+    <div class="clear"></div>
+
+  </div>
+</section>

http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/_plugins/bundler.rb
----------------------------------------------------------------------
diff --git a/avatica/site/_plugins/bundler.rb b/avatica/site/_plugins/bundler.rb
new file mode 100644
index 0000000..1cdec10
--- /dev/null
+++ b/avatica/site/_plugins/bundler.rb
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to you under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+require "rubygems"
+require "bundler/setup"
+Bundler.require(:default)
+
+# End bundler.rb

http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/_posts/2014-06-27-release-0.8.0-incubating.md
----------------------------------------------------------------------
diff --git a/avatica/site/_posts/2014-06-27-release-0.8.0-incubating.md b/avatica/site/_posts/2014-06-27-release-0.8.0-incubating.md
new file mode 100644
index 0000000..83f975d
--- /dev/null
+++ b/avatica/site/_posts/2014-06-27-release-0.8.0-incubating.md
@@ -0,0 +1,31 @@
+---
+layout: news_item
+date: "2014-06-27 00:00:00 -0800"
+author: jhyde
+version: 0.8
+tag: v0-8
+sha: 3da850a1
+categories: [release]
+---
+<!--
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
+-->
+
+Several new features, including a heuristic rule to plan queries with
+a large number of joins, a number of windowed aggregate functions, and
+new utility, `SqlRun`.

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

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

http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/_posts/2014-11-05-release-0.9.2-incubating.md
----------------------------------------------------------------------
diff --git a/avatica/site/_posts/2014-11-05-release-0.9.2-incubating.md b/avatica/site/_posts/2014-11-05-release-0.9.2-incubating.md
new file mode 100644
index 0000000..47741c0
--- /dev/null
+++ b/avatica/site/_posts/2014-11-05-release-0.9.2-incubating.md
@@ -0,0 +1,32 @@
+---
+layout: news_item
+date: "2014-11-05 00:00:00 -0800"
+author: jhyde
+version: 0.9.2-incubating
+tag: v0-9-2
+sha: 0404fd23
+categories: [release]
+---
+<!--
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
+-->
+
+A fairly minor release, and last release before we rename all of the
+packages and lots of classes, in what we expect to call 1.0. If you
+have an existing application, it's worth upgrading to this first,
+before you move on to 1.0.

http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/_posts/2015-01-31-release-1.0.0-incubating.md
----------------------------------------------------------------------
diff --git a/avatica/site/_posts/2015-01-31-release-1.0.0-incubating.md b/avatica/site/_posts/2015-01-31-release-1.0.0-incubating.md
new file mode 100644
index 0000000..ad60205
--- /dev/null
+++ b/avatica/site/_posts/2015-01-31-release-1.0.0-incubating.md
@@ -0,0 +1,42 @@
+---
+layout: news_item
+date: "2015-01-31 19:03:07 -0800"
+author: jhyde
+version: 1.0.0-incubating
+tag: v1-0-0
+sha: 2dd83f2
+categories: [release]
+---
+<!--
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
+-->
+
+Calcite's first major release.
+
+Since the previous release we have re-organized the into the `org.apache.calcite`
+namespace. To make migration of your code easier, we have described the
+<a href="https://issues.apache.org/jira/secure/attachment/12681620/mapping.txt">mapping from old to new class names</a>
+as an attachment to
+[<a href="https://issues.apache.org/jira/browse/CALCITE-296">CALCITE-296</a>].
+
+The release adds SQL support for `GROUPING SETS`, `EXTEND`, `UPSERT` and sequences;
+a remote JDBC driver;
+improvements to the planner engine and built-in planner rules;
+improvements to the algorithms that implement the relational algebra,
+including an interpreter that can evaluate queries without compilation;
+and fixes about 30 bugs.

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

http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/_posts/2015-04-07-release-1.2.0-incubating.md
----------------------------------------------------------------------
diff --git a/avatica/site/_posts/2015-04-07-release-1.2.0-incubating.md b/avatica/site/_posts/2015-04-07-release-1.2.0-incubating.md
new file mode 100644
index 0000000..8332063
--- /dev/null
+++ b/avatica/site/_posts/2015-04-07-release-1.2.0-incubating.md
@@ -0,0 +1,41 @@
+---
+layout: news_item
+date: "2015-04-07 19:03:07 -0800"
+author: jhyde
+version: 1.2.0-incubating
+tag: v1-2-0
+sha: d60f2aa
+categories: [release]
+---
+<!--
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
+-->
+
+A short release, less than a month after 1.1.
+
+There have been many changes to Avatica, hugely improving its coverage of the
+JDBC API and overall robustness. A new provider, `JdbcMeta`, allows
+you to remote an existing JDBC driver.
+
+[<a href="https://issues.apache.org/jira/browse/CALCITE-606">CALCITE-606</a>]
+improves how the planner propagates traits such as collation and
+distribution among relational expressions.
+
+[<a href="https://issues.apache.org/jira/browse/CALCITE-613">CALCITE-613</a>]
+and [<a href="https://issues.apache.org/jira/browse/CALCITE-307">CALCITE-307</a>]
+improve implicit and explicit conversions in SQL.

http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/_posts/2015-04-24-new-committers.md
----------------------------------------------------------------------
diff --git a/avatica/site/_posts/2015-04-24-new-committers.md b/avatica/site/_posts/2015-04-24-new-committers.md
new file mode 100644
index 0000000..92a2466
--- /dev/null
+++ b/avatica/site/_posts/2015-04-24-new-committers.md
@@ -0,0 +1,34 @@
+---
+layout: news_item
+title: "Calcite adds 5 committers"
+date: "2015-04-24 19:03:07 -0800"
+author: jhyde
+categories: [team]
+---
+<!--
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
+-->
+
+The Calcite project management committee today added five new
+committers for their work on Calcite. Welcome all!
+
+* Aman Sinha
+* Jesús Camacho-Rodríguez
+* Jinfeng Ni
+* John Pullokkaran
+* Nick Dimiduk

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

http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/_posts/2015-06-05-algebra-builder.md
----------------------------------------------------------------------
diff --git a/avatica/site/_posts/2015-06-05-algebra-builder.md b/avatica/site/_posts/2015-06-05-algebra-builder.md
new file mode 100644
index 0000000..ddf3377
--- /dev/null
+++ b/avatica/site/_posts/2015-06-05-algebra-builder.md
@@ -0,0 +1,87 @@
+---
+layout: news_item
+title: "Algebra builder"
+date: "2015-06-05 19:29:07 -0800"
+author: jhyde
+categories: ["new features"]
+---
+<!--
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
+-->
+
+Calcite's foundation is a comprehensive implementation of relational
+algebra (together with transformation rules, cost model, and metadata)
+but to create algebra expressions you had to master a complex API.
+
+We're solving this problem by introducing an
+[algebra builder]({{ site.apiRoot }}/org/apache/calcite/tools/RelBuilder.html),
+a single class with all the methods you need to build any relational
+expression.
+
+For example,
+
+{% highlight java %}
+final FrameworkConfig config;
+final RelBuilder builder = RelBuilder.create(config);
+final RelNode node = builder
+  .scan("EMP")
+  .aggregate(builder.groupKey("DEPTNO"),
+      builder.count(false, "C"),
+      builder.sum(false, "S", builder.field("SAL")))
+  .filter(
+      builder.call(SqlStdOperatorTable.GREATER_THAN,
+          builder.field("C"),
+          builder.literal(10)))
+  .build();
+System.out.println(RelOptUtil.toString(node));
+{% endhighlight %}
+
+creates the algebra
+
+{% highlight text %}
+LogicalFilter(condition=[>($1, 10)])
+  LogicalAggregate(group=[{7}], C=[COUNT()], S=[SUM($5)])
+    LogicalTableScan(table=[[scott, EMP]])
+{% endhighlight %}
+
+which is equivalent to the SQL
+
+{% highlight sql %}
+SELECT deptno, count(*) AS c, sum(sal) AS s
+FROM emp
+GROUP BY deptno
+HAVING count(*) > 10
+{% endhighlight %}
+
+The [algebra builder documentation]({{ site.baseurl }}/docs/algebra.html) describes the
+full API and has lots of examples.
+
+We're still working on the algebra builder, but plan to release it
+with Calcite 1.4 (see
+[[CALCITE-748](https://issues.apache.org/jira/browse/CALCITE-748)]).
+
+The algebra builder will make some existing tasks easier (such as
+writing planner rules), but will also enable new things, such as
+writing applications directly on top of Calcite, or implementing
+non-SQL query languages. These applications and languages will be able
+to take advantage of Calcite's existing back-ends (including
+Hive-on-Tez, Drill, MongoDB, Splunk, Spark, JDBC data sources) and
+extensive set of query-optimization rules.
+
+If you have questions or comments, please post to the
+[mailing list]({{ site.baseurl }}/develop).

http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/_posts/2015-07-31-xldb-best-lightning-talk.md
----------------------------------------------------------------------
diff --git a/avatica/site/_posts/2015-07-31-xldb-best-lightning-talk.md b/avatica/site/_posts/2015-07-31-xldb-best-lightning-talk.md
new file mode 100644
index 0000000..b0e1f46
--- /dev/null
+++ b/avatica/site/_posts/2015-07-31-xldb-best-lightning-talk.md
@@ -0,0 +1,41 @@
+---
+layout: news_item
+title: "XLDB 2015 best lightning talk"
+date: "2015-07-31 11:53:00 -0800"
+author: jhyde
+categories: ["talks"]
+---
+<!--
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
+-->
+
+Julian Hyde's talk Apache Calcite: One planner fits all won
+[Best Lightning Talk](http://www.xldb.org/archives/2015/05/best-lightning-talks-selected/)
+at the XLDB-2015 conference (with Eric Tschetter's talk "Sketchy
+Approximations").
+
+XLDB is an annual conference that brings together experts from
+science, industry and academia to find practical solutions to problems
+involving extremely large data sets.
+
+As a result of winning Best Lightning Talk, Julian will get a 30
+minute keynote speaking slot at XLDB-2016.
+
+The talk is available in
+[slides](http://www.slideshare.net/julianhyde/apache-calcite-one-planner-fits-all)
+and [video](https://www.youtube.com/watch?v=5_MyORYjq3w).

http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/_posts/2015-09-02-release-1.4.0-incubating.md
----------------------------------------------------------------------
diff --git a/avatica/site/_posts/2015-09-02-release-1.4.0-incubating.md b/avatica/site/_posts/2015-09-02-release-1.4.0-incubating.md
new file mode 100644
index 0000000..6a2bde4
--- /dev/null
+++ b/avatica/site/_posts/2015-09-02-release-1.4.0-incubating.md
@@ -0,0 +1,39 @@
+---
+layout: news_item
+date: "2015-09-02 12:00:00 +0000"
+author: jhyde
+version: 1.4.0-incubating
+categories: [release]
+tag: v1-4-0
+sha: 0c0c203d
+---
+<!--
+{% 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 %}
+-->
+
+In addition to a large number of bug fixes and minor enhancements,
+this release includes improvements to
+<a href="https://issues.apache.org/jira/browse/CALCITE-758">lattices</a> and
+<a href="https://issues.apache.org/jira/browse/CALCITE-761">materialized views</a>,
+and adds a
+<a href="https://issues.apache.org/jira/browse/CALCITE-748">builder API</a>
+so that you can easily create relational algebra expressions.
+
+Read more about the [builder]({{ site.baseurl }}/news/2015/06/05/algebra-builder/),
+[relational algebra]({{ site.baseurl }}/docs/algebra.html), and
+[lattices]({{ site.baseurl }}/docs/lattice.html).

http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/_posts/2015-10-22-calcite-graduates.md
----------------------------------------------------------------------
diff --git a/avatica/site/_posts/2015-10-22-calcite-graduates.md b/avatica/site/_posts/2015-10-22-calcite-graduates.md
new file mode 100644
index 0000000..fb954cb
--- /dev/null
+++ b/avatica/site/_posts/2015-10-22-calcite-graduates.md
@@ -0,0 +1,63 @@
+---
+layout: news_item
+date: "2015-10-22 12:00:00 +0000"
+author: jhyde
+categories: [milestones]
+tag: v1-4-0
+sha: 0c0c203d
+---
+<!--
+{% 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 %}
+-->
+
+On October 21st, 2015 the board of the
+[Apache Software Foundation](http://www.apache.org)
+voted to establish Calcite as a top-level Apache project.
+
+![Calcite's graduation cake]({{ site.baseurl }}/img/cake.jpg)
+
+Describing itself as "the foundation for your next high-performance
+database", Calcite is a
+[framework for building data management systems]({{ site.baseurl }}/docs/).
+Calcite includes a comprehensive implementation of relational algebra
+and an extensible cost-based query optimizer. It also includes an
+optional SQL parser and JDBC driver.
+
+Calcite joined Apache as an incubator project in May, 2014. To
+graduate from the incubator, projects have to prove that they can
+create high quality releases, form a diverse community, and operate as
+a meritocracy.
+
+Calcite's committers have delivered eight releases during incubation
+(roughly one every two months) including the
+[milestone 1.0 release in January, 2015]({{ site.baseurl }}/news/2015/01/31/release-1.0.0-incubating/).
+
+The project has become a key component in many high-performance
+databases, including the
+[Apache Drill](http://drill.apache.org),
+[Apache Hive](http://hive.apache.org),
+[Apache Kylin](http://kylin.apache.org) and
+[Apache Phoenix](http://phoenix.apache.org) open source projects,
+and several commercial products.
+
+Also, in collaboration with [Apache Samza](http://samza.apache.org) and
+[Apache Storm](http://storm.apache.org), Calcite is developing
+[streaming extensions to standard SQL]({{ site.baseurl }}/docs/stream.html).
+
+The Calcite community met at a hangout on October 27th, 2015, and
+celebrated with a graduation cake.

http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/_posts/2015-11-08-new-committers.md
----------------------------------------------------------------------
diff --git a/avatica/site/_posts/2015-11-08-new-committers.md b/avatica/site/_posts/2015-11-08-new-committers.md
new file mode 100644
index 0000000..8946fc5
--- /dev/null
+++ b/avatica/site/_posts/2015-11-08-new-committers.md
@@ -0,0 +1,31 @@
+---
+layout: news_item
+title: "Calcite adds 2 committers"
+date: "2015-11-08 19:03:07 -0800"
+author: jhyde
+categories: [team]
+---
+<!--
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
+-->
+
+The Calcite project management committee today added two new
+committers for their work on Calcite. Welcome!
+
+* [Josh Elser](http://mail-archives.apache.org/mod_mbox/incubator-calcite-dev/201511.mbox/%3CCAPSgeEQ4%2Bj8MNjYFaa%3D15QjJV%2BiVDwG6bAhW1muk8Gdo0UAYWg%40mail.gmail.com%3E)
+* [Maryann Xue](http://mail-archives.apache.org/mod_mbox/incubator-calcite-dev/201511.mbox/%3CCAPSgeEQg7ACNWfPXiPY69PNPqA9ov%2BKGzzrNe7t7mMyOEV7hYQ%40mail.gmail.com%3E)

http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/_posts/2015-11-10-release-1.5.0.md
----------------------------------------------------------------------
diff --git a/avatica/site/_posts/2015-11-10-release-1.5.0.md b/avatica/site/_posts/2015-11-10-release-1.5.0.md
new file mode 100644
index 0000000..e4bb8d1
--- /dev/null
+++ b/avatica/site/_posts/2015-11-10-release-1.5.0.md
@@ -0,0 +1,33 @@
+---
+layout: news_item
+date: "2015-11-10 12:00:00 +0000"
+author: jcamacho
+version: 1.5.0
+categories: [release]
+tag: v1-5-0
+sha: ba6e43c
+---
+<!--
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
+-->
+
+This is our first release as a top-level Apache project! Thanks to everyone who has contributed to it.
+
+In addition to a large number of bug fixes and minor enhancements, this release includes major improvements to Avatica, planner rules, and RelBuilder.
+
+Further, we built Piglet, a subset of the classic Hadoop language Pig. Pig is particularly interesting because it makes heavy use of nested multi-sets. You can follow this example to implement your own query language, and immediately taking advantage of Calcite's back-ends and optimizer rules.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/_posts/2016-01-22-release-1.6.0.md
----------------------------------------------------------------------
diff --git a/avatica/site/_posts/2016-01-22-release-1.6.0.md b/avatica/site/_posts/2016-01-22-release-1.6.0.md
new file mode 100644
index 0000000..beb5267
--- /dev/null
+++ b/avatica/site/_posts/2016-01-22-release-1.6.0.md
@@ -0,0 +1,59 @@
+---
+layout: news_item
+date: "2016-01-22 12:00:00 +0000"
+author: jhyde
+version: 1.6.0
+categories: [release]
+tag: v1-6-0
+sha: c4d346b
+---
+<!--
+{% 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 %}
+-->
+
+As usual in this release, there are new SQL features, improvements to
+planning rules and Avatica, and lots of bug fixes. We'll spotlight a
+couple of features make it easier to handle complex queries.
+
+[<a href="https://issues.apache.org/jira/browse/CALCITE-816">CALCITE-816</a>]
+allows you to represent sub-queries (`EXISTS`, `IN` and scalar) as
+<a href="{{ site.apiRoot }}/org/apache/calcite/rex/RexSubQuery.html">RexSubQuery</a>,
+a kind of expression in the relational algebra. Until
+now, the sql-to-rel converter was burdened with expanding sub-queries,
+and people creating relational algebra directly (or via
+<a href="{{ site.apiRoot }}/org/apache/calcite/tools/RelBuilder.html">RelBuilder</a>)
+could only create 'flat' relational expressions. Now we have planner
+rules to expand and de-correlate sub-queries.
+
+Metadata is the fuel that powers query planning. It includes
+traditional query-planning statistics such as cost and row-count
+estimates, but also information such as which columns form unique
+keys, unique and what predicates are known to apply to a relational
+expression's output rows. From the predicates we can deduce which
+columns are constant, and following
+[<a href="https://issues.apache.org/jira/browse/CALCITE-1023">CALCITE-1023</a>]
+we can now remove constant columns from `GROUP BY` keys.
+
+Metadata is often computed recursively, and it is hard to safely and
+efficiently calculate metadata on a graph of `RelNode`s that is large,
+frequently cyclic, and constantly changing.
+[<a href="https://issues.apache.org/jira/browse/CALCITE-794">CALCITE-794</a>]
+introduces a context to each metadata call. That context can detect
+cyclic metadata calls and produce a safe answer to the metadata
+request. It will also allow us to add finer-grained caching and
+further tune the metadata layer.

http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/_posts/2016-02-17-elser-pmc.md
----------------------------------------------------------------------
diff --git a/avatica/site/_posts/2016-02-17-elser-pmc.md b/avatica/site/_posts/2016-02-17-elser-pmc.md
new file mode 100644
index 0000000..960fe79
--- /dev/null
+++ b/avatica/site/_posts/2016-02-17-elser-pmc.md
@@ -0,0 +1,33 @@
+---
+layout: news_item
+title: "Calcite appoints Josh Elser to PMC"
+date: "2016-02-17 10:30:00 -0800"
+author: jhyde
+categories: [team]
+---
+<!--
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
+-->
+
+The Apache Calcite project management committee (PMC) today announced the
+appointment of [Josh Elser](https://mail-archives.apache.org/mod_mbox/calcite-dev/201602.mbox/%3C12AA8D09-BBF8-470B-8933-5B672162546C%40apache.org%3E)
+to the committee.
+
+Josh has only been a committer for a few months, but has become a prominent
+member of the Calcite project, and has taken leadership in several areas,
+not least in discussing [the future of Avatica](https://mail-archives.apache.org/mod_mbox/calcite-dev/201601.mbox/%3C56ABCCFF.3010205%40gmail.com%3E).

http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/_posts/2016-02-17-streaming-sql-talk.md
----------------------------------------------------------------------
diff --git a/avatica/site/_posts/2016-02-17-streaming-sql-talk.md b/avatica/site/_posts/2016-02-17-streaming-sql-talk.md
new file mode 100644
index 0000000..9c5d55a
--- /dev/null
+++ b/avatica/site/_posts/2016-02-17-streaming-sql-talk.md
@@ -0,0 +1,40 @@
+---
+layout: news_item
+title: "Streaming SQL in Samza"
+date: "2016-02-17 11:53:00 -0800"
+author: jhyde
+categories: ["talks"]
+---
+<!--
+{% comment %}
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
+-->
+
+Julian Hyde gave a talk at the [Apache Samza](http://samza.apache.org/)
+meetup in Mountain View, CA.
+
+His talk asked the questions:
+
+* What is [SamzaSQL](https://github.com/milinda/samza-sql),
+  and what might I use it for?
+* Does this mean that Samza is turning into a database?
+* What is a query optimizer, and what can it do for my streaming queries?
+
+The talk is available in
+[[slides](http://www.slideshare.net/julianhyde/streaming-sql)]
+and
+[[video](http://www.ustream.tv/recorded/83322450#to00:55:48)].

http://git-wip-us.apache.org/repos/asf/calcite/blob/5cee486f/avatica/site/_sass/_font-awesome.scss
----------------------------------------------------------------------
diff --git a/avatica/site/_sass/_font-awesome.scss b/avatica/site/_sass/_font-awesome.scss
new file mode 100644
index 0000000..d90676c
--- /dev/null
+++ b/avatica/site/_sass/_font-awesome.scss
@@ -0,0 +1,25 @@
+/*!
+ *  Font Awesome 4.2.0 by @davegandy - http://fontawesome.io - @fontawesome
+ *  License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)
+ */
+@font-face {
+  font-family: 'FontAwesome';
+  src: url('../fonts/fontawesome-webfont.eot?v=4.2.0');
+  src: url('../fonts/fontawesome-webfont.eot?#iefix&v=4.2.0') format('embedded-opentype'), url('../fonts/fontawesome-webfont.woff?v=4.2.0') format('woff'), url('../fonts/fontawesome-webfont.ttf?v=4.2.0') format('truetype'), url('../fonts/fontawesome-webfont.svg?v=4.2.0#fontawesomeregular') format('svg');
+  font-weight: normal;
+  font-style: normal;
+}
+.fa {
+  display: inline-block;
+  font: normal normal normal 14px/1 FontAwesome;
+  font-size: inherit;
+  text-rendering: auto;
+  -webkit-font-smoothing: antialiased;
+  -moz-osx-font-smoothing: grayscale;
+}
+.fa-link:before {
+  content: "\f0c1";
+}
+.fa-pencil:before {
+  content: "\f040";
+}