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 2017/04/01 20:35:53 UTC

[01/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Repository: calcite-avatica
Updated Branches:
  refs/heads/master 8a1a287de -> fc7b26c8b


http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/avatica/AvaticaDatabaseMetaData.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/avatica/AvaticaDatabaseMetaData.java b/core/src/main/java/org/apache/calcite/avatica/AvaticaDatabaseMetaData.java
new file mode 100644
index 0000000..7182968
--- /dev/null
+++ b/core/src/main/java/org/apache/calcite/avatica/AvaticaDatabaseMetaData.java
@@ -0,0 +1,1460 @@
+/*
+ * 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.
+ */
+package org.apache.calcite.avatica;
+
+import org.apache.calcite.avatica.AvaticaConnection.CallableWithoutException;
+import org.apache.calcite.avatica.Meta.DatabaseProperty;
+import org.apache.calcite.avatica.remote.MetaDataOperation;
+import org.apache.calcite.avatica.util.Casing;
+import org.apache.calcite.avatica.util.Quoting;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.RowIdLifetime;
+import java.sql.SQLException;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Properties;
+
+import static org.apache.calcite.avatica.InternalProperty.CASE_SENSITIVE;
+import static org.apache.calcite.avatica.InternalProperty.NULL_SORTING;
+import static org.apache.calcite.avatica.InternalProperty.NullSorting;
+import static org.apache.calcite.avatica.InternalProperty.QUOTED_CASING;
+import static org.apache.calcite.avatica.InternalProperty.QUOTING;
+import static org.apache.calcite.avatica.InternalProperty.UNQUOTED_CASING;
+
+/**
+ * Implementation of {@link java.sql.DatabaseMetaData}
+ * for the Avatica engine.
+ *
+ * <p>This class has sub-classes which implement JDBC 3.0 and JDBC 4.0 APIs;
+ * it is instantiated using {@link AvaticaFactory#newDatabaseMetaData}.</p>
+ */
+public class AvaticaDatabaseMetaData implements AvaticaSpecificDatabaseMetaData {
+  private final AvaticaConnection connection;
+
+  protected  AvaticaDatabaseMetaData(AvaticaConnection connection) {
+    this.connection = connection;
+  }
+
+  // Helper methods
+
+  private NullSorting nullSorting() {
+    return NULL_SORTING.getEnum(getProperties(), NullSorting.class);
+  }
+
+  private Quoting quoting() {
+    return QUOTING.getEnum(getProperties(), Quoting.class);
+  }
+
+  private Casing unquotedCasing() {
+    return UNQUOTED_CASING.getEnum(getProperties(), Casing.class);
+  }
+
+  private Casing quotedCasing() {
+    return QUOTED_CASING.getEnum(getProperties(), Casing.class);
+  }
+
+  private boolean caseSensitive() {
+    return CASE_SENSITIVE.getBoolean(getProperties());
+  }
+
+  // JDBC methods
+
+  public boolean allProceduresAreCallable() throws SQLException {
+    return true;
+  }
+
+  public boolean allTablesAreSelectable() throws SQLException {
+    return true;
+  }
+
+  public String getURL() throws SQLException {
+    return connection.url;
+  }
+
+  public String getUserName() throws SQLException {
+    return connection.info.getProperty("user");
+  }
+
+  public boolean isReadOnly() throws SQLException {
+    return true;
+  }
+
+  public boolean nullsAreSortedHigh() throws SQLException {
+    return nullSorting() == NullSorting.HIGH;
+  }
+
+  public boolean nullsAreSortedLow() throws SQLException {
+    return nullSorting() == NullSorting.LOW;
+  }
+
+  public boolean nullsAreSortedAtStart() throws SQLException {
+    return nullSorting() == NullSorting.START;
+  }
+
+  public boolean nullsAreSortedAtEnd() throws SQLException {
+    return nullSorting() == NullSorting.END;
+  }
+
+  public String getDatabaseProductName() throws SQLException {
+    return connection.driver.version.productName;
+  }
+
+  public String getDatabaseProductVersion() throws SQLException {
+    return connection.driver.version.productVersion;
+  }
+
+  public String getDriverName() throws SQLException {
+    return connection.driver.version.name;
+  }
+
+  public String getDriverVersion() throws SQLException {
+    return connection.driver.version.versionString;
+  }
+
+  public int getDriverMajorVersion() {
+    return connection.driver.getMajorVersion();
+  }
+
+  public int getDriverMinorVersion() {
+    return connection.driver.getMinorVersion();
+  }
+
+  public boolean usesLocalFiles() throws SQLException {
+    return false;
+  }
+
+  public boolean usesLocalFilePerTable() throws SQLException {
+    return false;
+  }
+
+  public boolean storesMixedCaseIdentifiers() throws SQLException {
+    return !caseSensitive() && unquotedCasing() == Casing.UNCHANGED;
+  }
+
+  public boolean supportsMixedCaseIdentifiers() throws SQLException {
+    return caseSensitive() && unquotedCasing() == Casing.UNCHANGED;
+  }
+
+  public boolean storesUpperCaseIdentifiers() throws SQLException {
+    return unquotedCasing() == Casing.TO_UPPER;
+  }
+
+  public boolean storesLowerCaseIdentifiers() throws SQLException {
+    return unquotedCasing() == Casing.TO_LOWER;
+  }
+
+  public boolean storesMixedCaseQuotedIdentifiers() throws SQLException {
+    return !caseSensitive() && quotedCasing() == Casing.UNCHANGED;
+  }
+
+  public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException {
+    return caseSensitive() && quotedCasing() == Casing.UNCHANGED;
+  }
+
+  public boolean storesUpperCaseQuotedIdentifiers() throws SQLException {
+    return quotedCasing() == Casing.TO_UPPER;
+  }
+
+  public boolean storesLowerCaseQuotedIdentifiers() throws SQLException {
+    return quotedCasing() == Casing.TO_LOWER;
+  }
+
+  public String getIdentifierQuoteString() throws SQLException {
+    return quoting().string;
+  }
+
+  private Map<InternalProperty, Object> getProperties() {
+    return connection.properties;
+  }
+
+  public String getSQLKeywords() throws SQLException {
+    return connection.invokeWithRetries(
+        new CallableWithoutException<String>() {
+          public String call() {
+            return Meta.DatabaseProperty.GET_S_Q_L_KEYWORDS
+                .getProp(connection.meta, connection.handle, String.class);
+          }
+        });
+  }
+
+  public String getNumericFunctions() throws SQLException {
+    return connection.invokeWithRetries(
+        new CallableWithoutException<String>() {
+          public String call() {
+            return Meta.DatabaseProperty.GET_NUMERIC_FUNCTIONS
+                .getProp(connection.meta, connection.handle, String.class);
+          }
+        });
+  }
+
+  public String getStringFunctions() throws SQLException {
+    return connection.invokeWithRetries(
+        new CallableWithoutException<String>() {
+          public String call() {
+            return Meta.DatabaseProperty.GET_STRING_FUNCTIONS
+                .getProp(connection.meta, connection.handle, String.class);
+          }
+        });
+  }
+
+  public String getSystemFunctions() throws SQLException {
+    return connection.invokeWithRetries(
+        new CallableWithoutException<String>() {
+          public String call() {
+            return Meta.DatabaseProperty.GET_SYSTEM_FUNCTIONS
+                .getProp(connection.meta, connection.handle, String.class);
+          }
+        });
+  }
+
+  public String getTimeDateFunctions() throws SQLException {
+    return connection.invokeWithRetries(
+        new CallableWithoutException<String>() {
+          public String call() {
+            return Meta.DatabaseProperty.GET_TIME_DATE_FUNCTIONS
+                .getProp(connection.meta, connection.handle, String.class);
+          }
+        });
+  }
+
+  public String getSearchStringEscape() throws SQLException {
+    return "\\";
+  }
+
+  public String getExtraNameCharacters() throws SQLException {
+    return "";
+  }
+
+  public boolean supportsAlterTableWithAddColumn() throws SQLException {
+    return false;
+  }
+
+  public boolean supportsAlterTableWithDropColumn() throws SQLException {
+    return false;
+  }
+
+  public boolean supportsColumnAliasing() throws SQLException {
+    return true;
+  }
+
+  public boolean nullPlusNonNullIsNull() throws SQLException {
+    return true;
+  }
+
+  public boolean supportsConvert() throws SQLException {
+    return true;
+  }
+
+  public boolean supportsConvert(int fromType, int toType) throws SQLException {
+    return false; // TODO: more detail
+  }
+
+  public boolean supportsTableCorrelationNames() throws SQLException {
+    return true;
+  }
+
+  public boolean supportsDifferentTableCorrelationNames() throws SQLException {
+    return true;
+  }
+
+  public boolean supportsExpressionsInOrderBy() throws SQLException {
+    return true;
+  }
+
+  public boolean supportsOrderByUnrelated() throws SQLException {
+    return true;
+  }
+
+  public boolean supportsGroupBy() throws SQLException {
+    return true;
+  }
+
+  public boolean supportsGroupByUnrelated() throws SQLException {
+    return true;
+  }
+
+  public boolean supportsGroupByBeyondSelect() throws SQLException {
+    return true;
+  }
+
+  public boolean supportsLikeEscapeClause() throws SQLException {
+    return true;
+  }
+
+  public boolean supportsMultipleResultSets() throws SQLException {
+    return false;
+  }
+
+  public boolean supportsMultipleTransactions() throws SQLException {
+    return false;
+  }
+
+  public boolean supportsNonNullableColumns() throws SQLException {
+    return true;
+  }
+
+  public boolean supportsMinimumSQLGrammar() throws SQLException {
+    return true;
+  }
+
+  public boolean supportsCoreSQLGrammar() throws SQLException {
+    return true;
+  }
+
+  public boolean supportsExtendedSQLGrammar() throws SQLException {
+    return true;
+  }
+
+  public boolean supportsANSI92EntryLevelSQL() throws SQLException {
+    return true;
+  }
+
+  public boolean supportsANSI92IntermediateSQL() throws SQLException {
+    return true;
+  }
+
+  public boolean supportsANSI92FullSQL() throws SQLException {
+    return true;
+  }
+
+  public boolean supportsIntegrityEnhancementFacility() throws SQLException {
+    return false;
+  }
+
+  public boolean supportsOuterJoins() throws SQLException {
+    return true;
+  }
+
+  public boolean supportsFullOuterJoins() throws SQLException {
+    return true;
+  }
+
+  public boolean supportsLimitedOuterJoins() throws SQLException {
+    return true;
+  }
+
+  public String getSchemaTerm() throws SQLException {
+    return "schema";
+  }
+
+  public String getProcedureTerm() throws SQLException {
+    return "procedure";
+  }
+
+  public String getCatalogTerm() throws SQLException {
+    return "catalog";
+  }
+
+  public boolean isCatalogAtStart() throws SQLException {
+    return true;
+  }
+
+  public String getCatalogSeparator() throws SQLException {
+    return ".";
+  }
+
+  public boolean supportsSchemasInDataManipulation() throws SQLException {
+    return true;
+  }
+
+  public boolean supportsSchemasInProcedureCalls() throws SQLException {
+    return true;
+  }
+
+  public boolean supportsSchemasInTableDefinitions() throws SQLException {
+    return true;
+  }
+
+  public boolean supportsSchemasInIndexDefinitions() throws SQLException {
+    return true; // except that we don't support index definitions
+  }
+
+  public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException {
+    return true; // except that we don't support privilege definitions
+  }
+
+  public boolean supportsCatalogsInDataManipulation() throws SQLException {
+    return true;
+  }
+
+  public boolean supportsCatalogsInProcedureCalls() throws SQLException {
+    return true;
+  }
+
+  public boolean supportsCatalogsInTableDefinitions() throws SQLException {
+    return true;
+  }
+
+  public boolean supportsCatalogsInIndexDefinitions() throws SQLException {
+    return true; // except that we don't support index definitions
+  }
+
+  public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException {
+    return true; // except that we don't support privilege definitions
+  }
+
+  public boolean supportsPositionedDelete() throws SQLException {
+    return false;
+  }
+
+  public boolean supportsPositionedUpdate() throws SQLException {
+    return false;
+  }
+
+  public boolean supportsSelectForUpdate() throws SQLException {
+    return false;
+  }
+
+  public boolean supportsStoredProcedures() throws SQLException {
+    return false;
+  }
+
+  public boolean supportsSubqueriesInComparisons() throws SQLException {
+    return true;
+  }
+
+  public boolean supportsSubqueriesInExists() throws SQLException {
+    return true;
+  }
+
+  public boolean supportsSubqueriesInIns() throws SQLException {
+    return true;
+  }
+
+  public boolean supportsSubqueriesInQuantifieds() throws SQLException {
+    return false;
+  }
+
+  public boolean supportsCorrelatedSubqueries() throws SQLException {
+    return true;
+  }
+
+  public boolean supportsUnion() throws SQLException {
+    return true;
+  }
+
+  public boolean supportsUnionAll() throws SQLException {
+    return true;
+  }
+
+  public boolean supportsOpenCursorsAcrossCommit() throws SQLException {
+    return false;
+  }
+
+  public boolean supportsOpenCursorsAcrossRollback() throws SQLException {
+    return false;
+  }
+
+  public boolean supportsOpenStatementsAcrossCommit() throws SQLException {
+    return false;
+  }
+
+  public boolean supportsOpenStatementsAcrossRollback() throws SQLException {
+    return false;
+  }
+
+  public int getMaxBinaryLiteralLength() throws SQLException {
+    return 0;
+  }
+
+  public int getMaxCharLiteralLength() throws SQLException {
+    return 0;
+  }
+
+  public int getMaxColumnNameLength() throws SQLException {
+    return 0;
+  }
+
+  public int getMaxColumnsInGroupBy() throws SQLException {
+    return 0;
+  }
+
+  public int getMaxColumnsInIndex() throws SQLException {
+    return 0;
+  }
+
+  public int getMaxColumnsInOrderBy() throws SQLException {
+    return 0;
+  }
+
+  public int getMaxColumnsInSelect() throws SQLException {
+    return 0;
+  }
+
+  public int getMaxColumnsInTable() throws SQLException {
+    return 0;
+  }
+
+  public int getMaxConnections() throws SQLException {
+    return 0;
+  }
+
+  public int getMaxCursorNameLength() throws SQLException {
+    return 0;
+  }
+
+  public int getMaxIndexLength() throws SQLException {
+    return 0;
+  }
+
+  public int getMaxSchemaNameLength() throws SQLException {
+    return 0;
+  }
+
+  public int getMaxProcedureNameLength() throws SQLException {
+    return 0;
+  }
+
+  public int getMaxCatalogNameLength() throws SQLException {
+    return 0;
+  }
+
+  public int getMaxRowSize() throws SQLException {
+    return 0;
+  }
+
+  public boolean doesMaxRowSizeIncludeBlobs() throws SQLException {
+    return false;
+  }
+
+  public int getMaxStatementLength() throws SQLException {
+    return 0;
+  }
+
+  public int getMaxStatements() throws SQLException {
+    return 0;
+  }
+
+  public int getMaxTableNameLength() throws SQLException {
+    return 0;
+  }
+
+  public int getMaxTablesInSelect() throws SQLException {
+    return 0;
+  }
+
+  public int getMaxUserNameLength() throws SQLException {
+    return 0;
+  }
+
+  public int getDefaultTransactionIsolation() throws SQLException {
+    return connection.invokeWithRetries(
+        new CallableWithoutException<Integer>() {
+          public Integer call() {
+            return Meta.DatabaseProperty.GET_DEFAULT_TRANSACTION_ISOLATION
+                .getProp(connection.meta, connection.handle, Integer.class);
+          }
+        });
+  }
+
+  public boolean supportsTransactions() throws SQLException {
+    return false;
+  }
+
+  public boolean supportsTransactionIsolationLevel(int level)
+      throws SQLException {
+    return level == Connection.TRANSACTION_NONE;
+  }
+
+  public boolean supportsDataDefinitionAndDataManipulationTransactions()
+      throws SQLException {
+    return false;
+  }
+
+  public boolean supportsDataManipulationTransactionsOnly()
+      throws SQLException {
+    return true;
+  }
+
+  public boolean dataDefinitionCausesTransactionCommit() throws SQLException {
+    return true;
+  }
+
+  public boolean dataDefinitionIgnoredInTransactions() throws SQLException {
+    return false;
+  }
+
+  public ResultSet getProcedures(
+      final String catalog,
+      final String schemaPattern,
+      final String procedureNamePattern) throws SQLException {
+    try {
+      return connection.invokeWithRetries(
+          new CallableWithoutException<ResultSet>() {
+            public ResultSet call() {
+              try {
+                return connection.createResultSet(
+                    connection.meta.getProcedures(connection.handle, catalog, pat(schemaPattern),
+                        pat(procedureNamePattern)),
+                    new QueryState(MetaDataOperation.GET_PROCEDURES, catalog, schemaPattern,
+                        procedureNamePattern));
+              } catch (SQLException e) {
+                throw new RuntimeException(e);
+              }
+            }
+          });
+    } catch (RuntimeException e) {
+      Throwable cause = e.getCause();
+      if (cause instanceof SQLException) {
+        throw (SQLException) cause;
+      }
+      throw e;
+    }
+  }
+
+  public ResultSet getProcedureColumns(
+      final String catalog,
+      final String schemaPattern,
+      final String procedureNamePattern,
+      final String columnNamePattern) throws SQLException {
+    try {
+      return connection.invokeWithRetries(
+          new CallableWithoutException<ResultSet>() {
+            public ResultSet call() {
+              try {
+                return connection.createResultSet(
+                    connection.meta.getProcedureColumns(connection.handle, catalog,
+                        pat(schemaPattern), pat(procedureNamePattern), pat(columnNamePattern)),
+                    new QueryState(MetaDataOperation.GET_PROCEDURE_COLUMNS, catalog, schemaPattern,
+                        procedureNamePattern, columnNamePattern));
+              } catch (SQLException e) {
+                throw new RuntimeException(e);
+              }
+            }
+          });
+    } catch (RuntimeException e) {
+      Throwable cause = e.getCause();
+      if (cause instanceof SQLException) {
+        throw (SQLException) cause;
+      }
+      throw e;
+    }
+  }
+
+  public ResultSet getTables(
+      final String catalog,
+      final String schemaPattern,
+      final String tableNamePattern,
+      final String[] types) throws SQLException {
+    final List<String> typeList = types == null ? null : Arrays.asList(types);
+    try {
+      return connection.invokeWithRetries(
+          new CallableWithoutException<ResultSet>() {
+            public ResultSet call() {
+              try {
+                return connection.createResultSet(
+                    connection.meta.getTables(connection.handle, catalog, pat(schemaPattern),
+                        pat(tableNamePattern), typeList),
+                    new QueryState(MetaDataOperation.GET_TABLES, catalog, schemaPattern,
+                        tableNamePattern, types));
+              } catch (SQLException e) {
+                throw new RuntimeException(e);
+              }
+            }
+          });
+    } catch (RuntimeException e) {
+      Throwable cause = e.getCause();
+      if (cause instanceof SQLException) {
+        throw (SQLException) cause;
+      }
+      throw e;
+    }
+  }
+
+  private static Meta.Pat pat(String schemaPattern) {
+    return Meta.Pat.of(schemaPattern);
+  }
+
+  public ResultSet getSchemas(
+      final String catalog, final String schemaPattern) throws SQLException {
+    // TODO: add a 'catch ... throw new SQLException' logic to this and other
+    // getXxx methods. Right now any error will throw a RuntimeException
+    try {
+      return connection.invokeWithRetries(
+          new CallableWithoutException<ResultSet>() {
+            public ResultSet call() {
+              try {
+                return connection.createResultSet(
+                    connection.meta.getSchemas(connection.handle, catalog, pat(schemaPattern)),
+                    new QueryState(MetaDataOperation.GET_SCHEMAS_WITH_ARGS, catalog,
+                        schemaPattern));
+              } catch (SQLException e) {
+                throw new RuntimeException(e);
+              }
+            }
+          });
+    } catch (RuntimeException e) {
+      Throwable cause = e.getCause();
+      if (cause instanceof SQLException) {
+        throw (SQLException) cause;
+      }
+      throw e;
+    }
+  }
+
+  public ResultSet getSchemas() throws SQLException {
+    return getSchemas(null, null);
+  }
+
+  public ResultSet getCatalogs() throws SQLException {
+    try {
+      return connection.invokeWithRetries(
+          new CallableWithoutException<ResultSet>() {
+            public ResultSet call() {
+              try {
+                return connection.createResultSet(connection.meta.getCatalogs(connection.handle),
+                    new QueryState(MetaDataOperation.GET_CATALOGS));
+              } catch (SQLException e) {
+                throw new RuntimeException(e);
+              }
+            }
+          });
+    } catch (RuntimeException e) {
+      Throwable cause = e.getCause();
+      if (cause instanceof SQLException) {
+        throw (SQLException) cause;
+      }
+      throw e;
+    }
+  }
+
+  public ResultSet getTableTypes() throws SQLException {
+    try {
+      return connection.invokeWithRetries(
+          new CallableWithoutException<ResultSet>() {
+            public ResultSet call() {
+              try {
+                return connection.createResultSet(connection.meta.getTableTypes(connection.handle),
+                    new QueryState(MetaDataOperation.GET_TABLE_TYPES));
+              } catch (SQLException e) {
+                throw new RuntimeException(e);
+              }
+            }
+          });
+    } catch (RuntimeException e) {
+      Throwable cause = e.getCause();
+      if (cause instanceof SQLException) {
+        throw (SQLException) cause;
+      }
+      throw e;
+    }
+  }
+
+  public ResultSet getColumns(
+      final String catalog,
+      final String schemaPattern,
+      final String tableNamePattern,
+      final String columnNamePattern) throws SQLException {
+    try {
+      return connection.invokeWithRetries(
+          new CallableWithoutException<ResultSet>() {
+            public ResultSet call() {
+              try {
+                return connection.createResultSet(
+                    connection.meta.getColumns(connection.handle, catalog, pat(schemaPattern),
+                        pat(tableNamePattern), pat(columnNamePattern)),
+                    new QueryState(MetaDataOperation.GET_COLUMNS, catalog, schemaPattern,
+                        tableNamePattern, columnNamePattern));
+              } catch (SQLException e) {
+                throw new RuntimeException(e);
+              }
+            }
+          });
+    } catch (RuntimeException e) {
+      Throwable cause = e.getCause();
+      if (cause instanceof SQLException) {
+        throw (SQLException) cause;
+      }
+      throw e;
+    }
+  }
+
+  public ResultSet getColumnPrivileges(
+      final String catalog,
+      final String schema,
+      final String table,
+      final String columnNamePattern) throws SQLException {
+    try {
+      return connection.invokeWithRetries(
+          new CallableWithoutException<ResultSet>() {
+            public ResultSet call() {
+              try {
+                return connection.createResultSet(
+                    connection.meta.getColumnPrivileges(connection.handle, catalog, schema, table,
+                        pat(columnNamePattern)),
+                    new QueryState(MetaDataOperation.GET_COLUMN_PRIVILEGES, catalog, schema, table,
+                        columnNamePattern));
+              } catch (SQLException e) {
+                throw new RuntimeException(e);
+              }
+            }
+          });
+    } catch (RuntimeException e) {
+      Throwable cause = e.getCause();
+      if (cause instanceof SQLException) {
+        throw (SQLException) cause;
+      }
+      throw e;
+    }
+  }
+
+  public ResultSet getTablePrivileges(
+      final String catalog,
+      final String schemaPattern,
+      final String tableNamePattern) throws SQLException {
+    try {
+      return connection.invokeWithRetries(
+          new CallableWithoutException<ResultSet>() {
+            public ResultSet call() {
+              try {
+                return connection.createResultSet(
+                    connection.meta.getTablePrivileges(connection.handle, catalog,
+                        pat(schemaPattern), pat(tableNamePattern)),
+                    new QueryState(MetaDataOperation.GET_TABLE_PRIVILEGES, catalog, schemaPattern,
+                        tableNamePattern));
+              } catch (SQLException e) {
+                throw new RuntimeException(e);
+              }
+            }
+          });
+    } catch (RuntimeException e) {
+      Throwable cause = e.getCause();
+      if (cause instanceof SQLException) {
+        throw (SQLException) cause;
+      }
+      throw e;
+    }
+  }
+
+  public ResultSet getBestRowIdentifier(
+      final String catalog,
+      final String schema,
+      final String table,
+      final int scope,
+      final boolean nullable) throws SQLException {
+    try {
+      return connection.invokeWithRetries(
+          new CallableWithoutException<ResultSet>() {
+            public ResultSet call() {
+              try {
+                return connection.createResultSet(
+                    connection.meta.getBestRowIdentifier(connection.handle, catalog, schema, table,
+                        scope, nullable),
+                    new QueryState(MetaDataOperation.GET_BEST_ROW_IDENTIFIER, catalog, table, scope,
+                        nullable));
+              } catch (SQLException e) {
+                throw new RuntimeException(e);
+              }
+            }
+          });
+    } catch (RuntimeException e) {
+      Throwable cause = e.getCause();
+      if (cause instanceof SQLException) {
+        throw (SQLException) cause;
+      }
+      throw e;
+    }
+  }
+
+  public ResultSet getVersionColumns(
+      final String catalog, final String schema, final String table) throws SQLException {
+    try {
+      return connection.invokeWithRetries(
+          new CallableWithoutException<ResultSet>() {
+            public ResultSet call() {
+              try {
+                return connection.createResultSet(
+                    connection.meta.getVersionColumns(connection.handle, catalog, schema, table),
+                    new QueryState(MetaDataOperation.GET_VERSION_COLUMNS, catalog, schema, table));
+              } catch (SQLException e) {
+                throw new RuntimeException(e);
+              }
+            }
+          });
+    } catch (RuntimeException e) {
+      Throwable cause = e.getCause();
+      if (cause instanceof SQLException) {
+        throw (SQLException) cause;
+      }
+      throw e;
+    }
+  }
+
+  public ResultSet getPrimaryKeys(
+      final String catalog, final String schema, final String table) throws SQLException {
+    try {
+      return connection.invokeWithRetries(
+          new CallableWithoutException<ResultSet>() {
+            public ResultSet call() {
+              try {
+                return connection.createResultSet(
+                    connection.meta.getPrimaryKeys(connection.handle, catalog, schema, table),
+                    new QueryState(MetaDataOperation.GET_PRIMARY_KEYS, catalog, schema, table));
+              } catch (SQLException e) {
+                throw new RuntimeException(e);
+              }
+            }
+          });
+    } catch (RuntimeException e) {
+      Throwable cause = e.getCause();
+      if (cause instanceof SQLException) {
+        throw (SQLException) cause;
+      }
+      throw e;
+    }
+  }
+
+  public ResultSet getImportedKeys(
+      final String catalog, final String schema, final String table) throws SQLException {
+    try {
+      return connection.invokeWithRetries(
+          new CallableWithoutException<ResultSet>() {
+            public ResultSet call() {
+              try {
+                return connection.createResultSet(
+                    connection.meta.getImportedKeys(connection.handle, catalog, schema, table),
+                    new QueryState(MetaDataOperation.GET_IMPORTED_KEYS, catalog, schema, table));
+              } catch (SQLException e) {
+                throw new RuntimeException(e);
+              }
+            }
+          });
+    } catch (RuntimeException e) {
+      Throwable cause = e.getCause();
+      if (cause instanceof SQLException) {
+        throw (SQLException) cause;
+      }
+      throw e;
+    }
+  }
+
+  public ResultSet getExportedKeys(
+      final String catalog, final String schema, final String table) throws SQLException {
+    try {
+      return connection.invokeWithRetries(
+          new CallableWithoutException<ResultSet>() {
+            public ResultSet call() {
+              try {
+                return connection.createResultSet(
+                    connection.meta.getExportedKeys(connection.handle, catalog, schema, table),
+                    new QueryState(MetaDataOperation.GET_EXPORTED_KEYS, catalog, schema, table));
+              } catch (SQLException e) {
+                throw new RuntimeException(e);
+              }
+            }
+          });
+    } catch (RuntimeException e) {
+      Throwable cause = e.getCause();
+      if (cause instanceof SQLException) {
+        throw (SQLException) cause;
+      }
+      throw e;
+    }
+  }
+
+  public ResultSet getCrossReference(
+      final String parentCatalog,
+      final String parentSchema,
+      final String parentTable,
+      final String foreignCatalog,
+      final String foreignSchema,
+      final String foreignTable) throws SQLException {
+    try {
+      return connection.invokeWithRetries(
+          new CallableWithoutException<ResultSet>() {
+            public ResultSet call() {
+              try {
+                return connection.createResultSet(
+                    connection.meta.getCrossReference(connection.handle, parentCatalog,
+                        parentSchema, parentTable, foreignCatalog, foreignSchema, foreignTable),
+                    new QueryState(MetaDataOperation.GET_CROSS_REFERENCE, parentCatalog,
+                        parentSchema, parentTable, foreignCatalog, foreignSchema, foreignTable));
+              } catch (SQLException e) {
+                throw new RuntimeException(e);
+              }
+            }
+          });
+    } catch (RuntimeException e) {
+      Throwable cause = e.getCause();
+      if (cause instanceof SQLException) {
+        throw (SQLException) cause;
+      }
+      throw e;
+    }
+  }
+
+  public ResultSet getTypeInfo() throws SQLException {
+    try {
+      return connection.invokeWithRetries(
+          new CallableWithoutException<ResultSet>() {
+            public ResultSet call() {
+              try {
+                return connection.createResultSet(connection.meta.getTypeInfo(connection.handle),
+                    new QueryState(MetaDataOperation.GET_TYPE_INFO));
+              } catch (SQLException e) {
+                throw new RuntimeException(e);
+              }
+            }
+          });
+    } catch (RuntimeException e) {
+      Throwable cause = e.getCause();
+      if (cause instanceof SQLException) {
+        throw (SQLException) cause;
+      }
+      throw e;
+    }
+  }
+
+  public ResultSet getIndexInfo(
+      final String catalog,
+      final String schema,
+      final String table,
+      final boolean unique,
+      final boolean approximate) throws SQLException {
+    try {
+      return connection.invokeWithRetries(
+          new CallableWithoutException<ResultSet>() {
+            public ResultSet call() {
+              try {
+                return connection.createResultSet(
+                    connection.meta.getIndexInfo(connection.handle, catalog, schema, table, unique,
+                        approximate),
+                    new QueryState(MetaDataOperation.GET_INDEX_INFO, catalog, schema, table, unique,
+                        approximate));
+              } catch (SQLException e) {
+                throw new RuntimeException(e);
+              }
+            }
+          });
+    } catch (RuntimeException e) {
+      Throwable cause = e.getCause();
+      if (cause instanceof SQLException) {
+        throw (SQLException) cause;
+      }
+      throw e;
+    }
+  }
+
+  public boolean supportsResultSetType(int type) throws SQLException {
+    return type == ResultSet.TYPE_FORWARD_ONLY;
+  }
+
+  public boolean supportsResultSetConcurrency(
+      int type, int concurrency) throws SQLException {
+    return type == ResultSet.TYPE_FORWARD_ONLY
+        && concurrency == ResultSet.CONCUR_READ_ONLY;
+  }
+
+  public boolean ownUpdatesAreVisible(int type) throws SQLException {
+    throw connection.helper.todo();
+  }
+
+  public boolean ownDeletesAreVisible(int type) throws SQLException {
+    throw connection.helper.todo();
+  }
+
+  public boolean ownInsertsAreVisible(int type) throws SQLException {
+    throw connection.helper.todo();
+  }
+
+  public boolean othersUpdatesAreVisible(int type) throws SQLException {
+    throw connection.helper.todo();
+  }
+
+  public boolean othersDeletesAreVisible(int type) throws SQLException {
+    throw connection.helper.todo();
+  }
+
+  public boolean othersInsertsAreVisible(int type) throws SQLException {
+    throw connection.helper.todo();
+  }
+
+  public boolean updatesAreDetected(int type) throws SQLException {
+    throw connection.helper.todo();
+  }
+
+  public boolean deletesAreDetected(int type) throws SQLException {
+    throw connection.helper.todo();
+  }
+
+  public boolean insertsAreDetected(int type) throws SQLException {
+    throw connection.helper.todo();
+  }
+
+  public boolean supportsBatchUpdates() throws SQLException {
+    return true;
+  }
+
+  public ResultSet getUDTs(
+      final String catalog,
+      final String schemaPattern,
+      final String typeNamePattern,
+      final int[] types) throws SQLException {
+    try {
+      return connection.invokeWithRetries(
+          new CallableWithoutException<ResultSet>() {
+            public ResultSet call() {
+              try {
+                return connection.createResultSet(
+                    connection.meta.getUDTs(connection.handle, catalog, pat(schemaPattern),
+                        pat(typeNamePattern), types),
+                    new QueryState(MetaDataOperation.GET_UDTS, catalog, schemaPattern,
+                        typeNamePattern, types));
+              } catch (SQLException e) {
+                throw new RuntimeException(e);
+              }
+            }
+          });
+    } catch (RuntimeException e) {
+      Throwable cause = e.getCause();
+      if (cause instanceof SQLException) {
+        throw (SQLException) cause;
+      }
+      throw e;
+    }
+  }
+
+  public Connection getConnection() throws SQLException {
+    return connection;
+  }
+
+  public boolean supportsSavepoints() throws SQLException {
+    return false;
+  }
+
+  public boolean supportsNamedParameters() throws SQLException {
+    return false;
+  }
+
+  public boolean supportsMultipleOpenResults() throws SQLException {
+    return false;
+  }
+
+  public boolean supportsGetGeneratedKeys() throws SQLException {
+    return false;
+  }
+
+  public ResultSet getSuperTypes(
+      final String catalog,
+      final String schemaPattern,
+      final String typeNamePattern) throws SQLException {
+    try {
+      return connection.invokeWithRetries(
+          new CallableWithoutException<ResultSet>() {
+            public ResultSet call() {
+              try {
+                return connection.createResultSet(
+                    connection.meta.getSuperTypes(connection.handle, catalog, pat(schemaPattern),
+                        pat(typeNamePattern)),
+                    new QueryState(MetaDataOperation.GET_SUPER_TYPES, catalog, schemaPattern,
+                        typeNamePattern));
+              } catch (SQLException e) {
+                throw new RuntimeException(e);
+              }
+            }
+          });
+    } catch (RuntimeException e) {
+      Throwable cause = e.getCause();
+      if (cause instanceof SQLException) {
+        throw (SQLException) cause;
+      }
+      throw e;
+    }
+  }
+
+  public ResultSet getSuperTables(
+      final String catalog,
+      final String schemaPattern,
+      final String tableNamePattern) throws SQLException {
+    try {
+      return connection.invokeWithRetries(
+          new CallableWithoutException<ResultSet>() {
+            public ResultSet call() {
+              try {
+                return connection.createResultSet(
+                    connection.meta.getSuperTables(connection.handle, catalog, pat(schemaPattern),
+                        pat(tableNamePattern)),
+                    new QueryState(MetaDataOperation.GET_SUPER_TABLES, catalog, schemaPattern,
+                        tableNamePattern));
+              } catch (SQLException e) {
+                throw new RuntimeException(e);
+              }
+            }
+          });
+    } catch (RuntimeException e) {
+      Throwable cause = e.getCause();
+      if (cause instanceof SQLException) {
+        throw (SQLException) cause;
+      }
+      throw e;
+    }
+  }
+
+  public ResultSet getAttributes(
+      final String catalog,
+      final String schemaPattern,
+      final String typeNamePattern,
+      final String attributeNamePattern) throws SQLException {
+    try {
+      return connection.invokeWithRetries(
+          new CallableWithoutException<ResultSet>() {
+            public ResultSet call() {
+              try {
+                return connection.createResultSet(
+                    connection.meta.getAttributes(connection.handle, catalog, pat(schemaPattern),
+                        pat(typeNamePattern), pat(attributeNamePattern)),
+                    new QueryState(MetaDataOperation.GET_ATTRIBUTES, catalog, schemaPattern,
+                        typeNamePattern, attributeNamePattern));
+              } catch (SQLException e) {
+                throw new RuntimeException(e);
+              }
+            }
+          });
+    } catch (RuntimeException e) {
+      Throwable cause = e.getCause();
+      if (cause instanceof SQLException) {
+        throw (SQLException) cause;
+      }
+      throw e;
+    }
+  }
+
+  public boolean supportsResultSetHoldability(int holdability)
+      throws SQLException {
+    throw connection.helper.todo();
+  }
+
+  public int getResultSetHoldability() {
+    return ResultSet.HOLD_CURSORS_OVER_COMMIT;
+  }
+
+  public int getDatabaseMajorVersion() throws SQLException {
+    return connection.driver.version.databaseMajorVersion;
+  }
+
+  public int getDatabaseMinorVersion() throws SQLException {
+    return connection.driver.version.databaseMinorVersion;
+  }
+
+  public int getJDBCMajorVersion() throws SQLException {
+    return connection.factory.getJdbcMajorVersion();
+  }
+
+  public int getJDBCMinorVersion() throws SQLException {
+    return connection.factory.getJdbcMinorVersion();
+  }
+
+  public int getSQLStateType() throws SQLException {
+    return sqlStateSQL;
+  }
+
+  public boolean locatorsUpdateCopy() throws SQLException {
+    return true;
+  }
+
+  public boolean supportsStatementPooling() throws SQLException {
+    return false;
+  }
+
+  public RowIdLifetime getRowIdLifetime() throws SQLException {
+    return RowIdLifetime.ROWID_UNSUPPORTED;
+  }
+
+  public boolean supportsStoredFunctionsUsingCallSyntax()
+      throws SQLException {
+    return true;
+  }
+
+  public boolean autoCommitFailureClosesAllResultSets() throws SQLException {
+    return false;
+  }
+
+  public ResultSet getClientInfoProperties() throws SQLException {
+    try {
+      return connection.invokeWithRetries(
+          new CallableWithoutException<ResultSet>() {
+            public ResultSet call() {
+              try {
+                return connection.createResultSet(
+                    connection.meta.getClientInfoProperties(connection.handle),
+                    new QueryState(MetaDataOperation.GET_CLIENT_INFO_PROPERTIES));
+              } catch (SQLException e) {
+                throw new RuntimeException(e);
+              }
+            }
+          });
+    } catch (RuntimeException e) {
+      Throwable cause = e.getCause();
+      if (cause instanceof SQLException) {
+        throw (SQLException) cause;
+      }
+      throw e;
+    }
+  }
+
+  public ResultSet getFunctions(
+      final String catalog,
+      final String schemaPattern,
+      final String functionNamePattern) throws SQLException {
+    try {
+      return connection.invokeWithRetries(
+          new CallableWithoutException<ResultSet>() {
+            public ResultSet call() {
+              try {
+                return connection.createResultSet(
+                    connection.meta.getFunctions(connection.handle, catalog, pat(schemaPattern),
+                        pat(functionNamePattern)),
+                    new QueryState(MetaDataOperation.GET_FUNCTIONS, catalog, schemaPattern,
+                        functionNamePattern));
+              } catch (SQLException e) {
+                throw new RuntimeException(e);
+              }
+            }
+          });
+    } catch (RuntimeException e) {
+      Throwable cause = e.getCause();
+      if (cause instanceof SQLException) {
+        throw (SQLException) cause;
+      }
+      throw e;
+    }
+  }
+
+  public ResultSet getFunctionColumns(
+      final String catalog,
+      final String schemaPattern,
+      final String functionNamePattern,
+      final String columnNamePattern) throws SQLException {
+    try {
+      return connection.invokeWithRetries(
+          new CallableWithoutException<ResultSet>() {
+            public ResultSet call() {
+              try {
+                return connection.createResultSet(
+                    connection.meta.getFunctionColumns(connection.handle, catalog,
+                        pat(schemaPattern), pat(functionNamePattern), pat(columnNamePattern)),
+                    new QueryState(MetaDataOperation.GET_FUNCTION_COLUMNS, catalog,
+                        schemaPattern, functionNamePattern, columnNamePattern));
+              } catch (SQLException e) {
+                throw new RuntimeException(e);
+              }
+            }
+          });
+    } catch (RuntimeException e) {
+      Throwable cause = e.getCause();
+      if (cause instanceof SQLException) {
+        throw (SQLException) cause;
+      }
+      throw e;
+    }
+  }
+
+  public ResultSet getPseudoColumns(
+      final String catalog,
+      final String schemaPattern,
+      final String tableNamePattern,
+      final String columnNamePattern) throws SQLException {
+    try {
+      return connection.invokeWithRetries(
+          new CallableWithoutException<ResultSet>() {
+            public ResultSet call() {
+              try {
+                return connection.createResultSet(
+                    connection.meta.getPseudoColumns(connection.handle, catalog, pat(schemaPattern),
+                        pat(tableNamePattern), pat(columnNamePattern)),
+                    new QueryState(MetaDataOperation.GET_PSEUDO_COLUMNS, catalog, schemaPattern,
+                        tableNamePattern, columnNamePattern));
+              } catch (SQLException e) {
+                throw new RuntimeException(e);
+              }
+            }
+          });
+    } catch (RuntimeException e) {
+      Throwable cause = e.getCause();
+      if (cause instanceof SQLException) {
+        throw (SQLException) cause;
+      }
+      throw e;
+    }
+  }
+
+  public boolean generatedKeyAlwaysReturned() throws SQLException {
+    return false;
+  }
+
+  // implement Wrapper
+
+  @Override public <T> T unwrap(Class<T> iface) throws SQLException {
+    if (iface.isInstance(this)) {
+      return iface.cast(this);
+    }
+
+    if (Properties.class.equals(iface)) {
+      return iface.cast(getRemoteAvaticaProperties());
+    }
+
+    throw connection.helper.createException(
+        "does not implement '" + iface + "'");
+  }
+
+  @Override public boolean isWrapperFor(Class<?> iface) throws SQLException {
+    return iface.isInstance(this) || Properties.class.equals(iface);
+  }
+
+  // Not JDBC Methods
+
+  @Override public Properties getRemoteAvaticaProperties() {
+    Map<DatabaseProperty, Object> propertyMap = connection.invokeWithRetries(
+        new CallableWithoutException<Map<DatabaseProperty, Object>>() {
+          public Map<DatabaseProperty, Object> call() {
+            return connection.meta.getDatabaseProperties(connection.handle);
+          }
+        });
+
+    final Properties properties = new Properties();
+    for (Entry<DatabaseProperty, Object> entry: propertyMap.entrySet()) {
+      properties.setProperty(entry.getKey().name(), entry.getValue().toString());
+    }
+
+    return properties;
+  }
+
+  /**
+   * Fetches the Avatica version from the given server.
+   *
+   * @return The Avatica version string or null if the server did not provide the version.
+   */
+  @Override public String getAvaticaServerVersion() {
+    Map<DatabaseProperty, Object> properties = connection.invokeWithRetries(
+        new CallableWithoutException<Map<DatabaseProperty, Object>>() {
+          public Map<DatabaseProperty, Object> call() {
+            return connection.meta.getDatabaseProperties(connection.handle);
+          }
+        });
+    Object o = properties.get(DatabaseProperty.AVATICA_VERSION);
+    if (null == o) {
+      return null;
+    }
+    return (String) o;
+  }
+}
+
+// End AvaticaDatabaseMetaData.java


[23/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/server/src/test/java/org/apache/calcite/avatica/RemoteDriverTest.java
----------------------------------------------------------------------
diff --git a/avatica/server/src/test/java/org/apache/calcite/avatica/RemoteDriverTest.java b/avatica/server/src/test/java/org/apache/calcite/avatica/RemoteDriverTest.java
deleted file mode 100644
index 0823a12..0000000
--- a/avatica/server/src/test/java/org/apache/calcite/avatica/RemoteDriverTest.java
+++ /dev/null
@@ -1,2077 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import org.apache.calcite.avatica.Meta.DatabaseProperty;
-import org.apache.calcite.avatica.jdbc.JdbcMeta;
-import org.apache.calcite.avatica.remote.JsonService;
-import org.apache.calcite.avatica.remote.LocalJsonService;
-import org.apache.calcite.avatica.remote.LocalProtobufService;
-import org.apache.calcite.avatica.remote.LocalService;
-import org.apache.calcite.avatica.remote.ProtobufTranslation;
-import org.apache.calcite.avatica.remote.ProtobufTranslationImpl;
-import org.apache.calcite.avatica.remote.Service;
-import org.apache.calcite.avatica.remote.TypedValue;
-import org.apache.calcite.avatica.util.DateTimeUtils;
-
-import com.google.common.cache.Cache;
-
-import net.jcip.annotations.NotThreadSafe;
-
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.lang.reflect.Field;
-import java.math.BigDecimal;
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.Date;
-import java.sql.DriverManager;
-import java.sql.ParameterMetaData;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.sql.Types;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Properties;
-import java.util.TimeZone;
-import java.util.UUID;
-import java.util.concurrent.Callable;
-import java.util.concurrent.TimeUnit;
-
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.hamcrest.CoreMatchers.instanceOf;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.hamcrest.core.StringContains.containsString;
-import static org.hamcrest.core.StringStartsWith.startsWith;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-/**
- * Unit test for Avatica Remote JDBC driver.
- */
-@RunWith(Parameterized.class)
-@NotThreadSafe // for testConnectionIsolation
-public class RemoteDriverTest {
-  private static final Logger LOG = LoggerFactory.getLogger(RemoteDriverTest.class);
-
-  public static final String LJS =
-      LocalJdbcServiceFactory.class.getName();
-
-  public static final String QRJS =
-      QuasiRemoteJdbcServiceFactory.class.getName();
-
-  public static final String QRPBS =
-      QuasiRemotePBJdbcServiceFactory.class.getName();
-
-  private static final ConnectionSpec CONNECTION_SPEC = ConnectionSpec.HSQLDB;
-
-  private static Connection ljs() throws SQLException {
-    return DriverManager.getConnection("jdbc:avatica:remote:factory=" + QRJS);
-  }
-
-  private static Connection lpbs() throws SQLException {
-    return DriverManager.getConnection("jdbc:avatica:remote:factory=" + QRPBS);
-  }
-
-  private Connection canon() throws SQLException {
-    return DriverManager.getConnection(CONNECTION_SPEC.url,
-        CONNECTION_SPEC.username, CONNECTION_SPEC.password);
-  }
-
-  /**
-   * Interface that allows for alternate ways to access internals to the Connection for testing
-   * purposes.
-   */
-  interface ConnectionInternals {
-    /**
-     * Reaches into the guts of a quasi-remote connection and pull out the
-     * statement map from the other side.
-     *
-     * <p>TODO: refactor tests to replace reflection with package-local access
-     */
-    Cache<Integer, Object> getRemoteStatementMap(AvaticaConnection connection) throws Exception;
-
-    /**
-     * Reaches into the guts of a quasi-remote connection and pull out the
-     * connection map from the other side.
-     *
-     * <p>TODO: refactor tests to replace reflection with package-local access
-     */
-    Cache<String, Connection> getRemoteConnectionMap(AvaticaConnection connection) throws Exception;
-  }
-
-  // Run each test with the LocalJsonService and LocalProtobufService
-  @Parameters
-  public static List<Object[]> parameters() {
-    List<Object[]> connections = new ArrayList<>();
-
-    // Json and Protobuf operations should be equivalent -- tests against one work on the other
-    // Each test needs to get a fresh Connection and also access some internals on that Connection.
-
-    connections.add(
-      new Object[] {
-        new Callable<Connection>() {
-          public Connection call() {
-            try {
-              return ljs();
-            } catch (SQLException e) {
-              throw new RuntimeException(e);
-            }
-          }
-        },
-        new QuasiRemoteJdbcServiceInternals(),
-        new Callable<RequestInspection>() {
-          public RequestInspection call() throws Exception {
-            assert null != QuasiRemoteJdbcServiceFactory.requestInspection;
-            return QuasiRemoteJdbcServiceFactory.requestInspection;
-          }
-        } });
-
-    // TODO write the ConnectionInternals implementation
-    connections.add(
-      new Object[] {
-        new Callable<Connection>() {
-          public Connection call() {
-            try {
-              return lpbs();
-            } catch (SQLException e) {
-              throw new RuntimeException(e);
-            }
-          }
-        },
-        new QuasiRemoteProtobufJdbcServiceInternals(),
-        new Callable<RequestInspection>() {
-          public RequestInspection call() throws Exception {
-            assert null != QuasiRemotePBJdbcServiceFactory.requestInspection;
-            return QuasiRemotePBJdbcServiceFactory.requestInspection;
-          }
-        } });
-
-    return connections;
-  }
-
-  private final Callable<Connection> localConnectionCallable;
-  private final ConnectionInternals localConnectionInternals;
-  private final Callable<RequestInspection> requestInspectionCallable;
-
-  public RemoteDriverTest(Callable<Connection> localConnectionCallable,
-      ConnectionInternals internals, Callable<RequestInspection> requestInspectionCallable) {
-    this.localConnectionCallable = localConnectionCallable;
-    this.localConnectionInternals = internals;
-    this.requestInspectionCallable = requestInspectionCallable;
-  }
-
-  private Connection getLocalConnection() {
-    try {
-      return localConnectionCallable.call();
-    } catch (Exception e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  private ConnectionInternals getLocalConnectionInternals() {
-    return localConnectionInternals;
-  }
-
-  private RequestInspection getRequestInspection() {
-    try {
-      return requestInspectionCallable.call();
-    } catch (Exception e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  /** Executes a lambda for the canonical connection and the local
-   * connection. */
-  public void eachConnection(ConnectionFunction f, Connection localConn) throws Exception {
-    for (int i = 0; i < 2; i++) {
-      try (Connection connection = i == 0 ? canon() : localConn) {
-        f.apply(connection);
-      }
-    }
-  }
-
-  @Before
-  public void before() throws Exception {
-    QuasiRemoteJdbcServiceFactory.initService();
-    QuasiRemotePBJdbcServiceFactory.initService();
-  }
-
-  @Test public void testRegister() throws Exception {
-    final Connection connection = getLocalConnection();
-    assertThat(connection.isClosed(), is(false));
-    connection.close();
-    assertThat(connection.isClosed(), is(true));
-  }
-
-  @Test public void testDatabaseProperties() throws Exception {
-    ConnectionSpec.getDatabaseLock().lock();
-    try {
-      final Connection connection = getLocalConnection();
-      for (Meta.DatabaseProperty p : Meta.DatabaseProperty.values()) {
-        switch (p) {
-        case GET_NUMERIC_FUNCTIONS:
-          assertThat(connection.getMetaData().getNumericFunctions(),
-              equalTo("ABS,ACOS,ASIN,ATAN,ATAN2,BITAND,BITOR,BITXOR,"
-                  + "CEILING,COS,COT,DEGREES,EXP,FLOOR,LOG,LOG10,MOD,"
-                  + "PI,POWER,RADIANS,RAND,ROUND,ROUNDMAGIC,SIGN,SIN,"
-                  + "SQRT,TAN,TRUNCATE"));
-          break;
-        case GET_SYSTEM_FUNCTIONS:
-          assertThat(connection.getMetaData().getSystemFunctions(),
-              equalTo("DATABASE,IFNULL,USER"));
-          break;
-        case GET_TIME_DATE_FUNCTIONS:
-          assertThat(connection.getMetaData().getTimeDateFunctions(),
-              equalTo("CURDATE,CURTIME,DATEDIFF,DAYNAME,DAYOFMONTH,DAYOFWEEK,"
-                  + "DAYOFYEAR,HOUR,MINUTE,MONTH,MONTHNAME,NOW,QUARTER,SECOND,"
-                  + "SECONDS_SINCE_MIDNIGHT,TIMESTAMPADD,TIMESTAMPDIFF,"
-                  + "TO_CHAR,WEEK,YEAR"));
-          break;
-        case GET_S_Q_L_KEYWORDS:
-          assertThat(connection.getMetaData().getSQLKeywords(),
-              equalTo("")); // No SQL keywords return for HSQLDB
-          break;
-        case GET_STRING_FUNCTIONS:
-          assertThat(connection.getMetaData().getStringFunctions(),
-              equalTo("ASCII,CHAR,CONCAT,DIFFERENCE,HEXTORAW,INSERT,LCASE,"
-                  + "LEFT,LENGTH,LOCATE,LTRIM,RAWTOHEX,REPEAT,REPLACE,"
-                  + "RIGHT,RTRIM,SOUNDEX,SPACE,SUBSTR,UCASE"));
-          break;
-        default:
-        }
-      }
-      connection.close();
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  @Test public void testTypeInfo() throws Exception {
-    ConnectionSpec.getDatabaseLock().lock();
-    try {
-      final Connection connection = getLocalConnection();
-      final ResultSet resultSet =
-          connection.getMetaData().getTypeInfo();
-      assertTrue(resultSet.next());
-      final ResultSetMetaData metaData = resultSet.getMetaData();
-      assertTrue(metaData.getColumnCount() >= 18);
-      assertEquals("TYPE_NAME", metaData.getColumnName(1));
-      assertEquals("DATA_TYPE", metaData.getColumnName(2));
-      assertEquals("PRECISION", metaData.getColumnName(3));
-      assertEquals("SQL_DATA_TYPE", metaData.getColumnName(16));
-      assertEquals("SQL_DATETIME_SUB", metaData.getColumnName(17));
-      assertEquals("NUM_PREC_RADIX", metaData.getColumnName(18));
-      resultSet.close();
-      connection.close();
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  @Test public void testGetTables() throws Exception {
-    ConnectionSpec.getDatabaseLock().lock();
-    try {
-      final Connection connection = getLocalConnection();
-      final ResultSet resultSet =
-              connection.getMetaData().getTables(null, "SCOTT", null, null);
-      assertEquals(13, resultSet.getMetaData().getColumnCount());
-      assertTrue(resultSet.next());
-      assertEquals("DEPT", resultSet.getString(3));
-      assertTrue(resultSet.next());
-      assertEquals("EMP", resultSet.getString(3));
-      assertTrue(resultSet.next());
-      assertEquals("BONUS", resultSet.getString(3));
-      assertTrue(resultSet.next());
-      assertEquals("SALGRADE", resultSet.getString(3));
-      resultSet.close();
-      connection.close();
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  @Ignore
-  @Test public void testNoFactory() throws Exception {
-    final Connection connection =
-        DriverManager.getConnection("jdbc:avatica:remote:");
-    assertThat(connection.isClosed(), is(false));
-    final ResultSet resultSet = connection.getMetaData().getSchemas();
-    assertFalse(resultSet.next());
-    final ResultSetMetaData metaData = resultSet.getMetaData();
-    assertEquals(2, metaData.getColumnCount());
-    assertEquals("TABLE_SCHEM", metaData.getColumnName(1));
-    assertEquals("TABLE_CATALOG", metaData.getColumnName(2));
-    resultSet.close();
-    connection.close();
-    assertThat(connection.isClosed(), is(true));
-  }
-
-  @Test public void testStatementExecuteQueryLocal() throws Exception {
-    ConnectionSpec.getDatabaseLock().lock();
-    try {
-      checkStatementExecuteQuery(getLocalConnection(), false);
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  @Test public void testPrepareExecuteQueryLocal() throws Exception {
-    ConnectionSpec.getDatabaseLock().lock();
-    try {
-      checkStatementExecuteQuery(getLocalConnection(), true);
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  @Test public void testInsertDrop() throws Exception {
-    final String t = AvaticaUtils.unique("TEST_TABLE2");
-    final String create =
-        String.format(Locale.ROOT, "create table if not exists %s ("
-            + "id int not null, "
-            + "msg varchar(3) not null)", t);
-    final String insert = String.format(Locale.ROOT,
-        "insert into %s values(1, 'foo')", t);
-    Connection connection = ljs();
-    Statement statement = connection.createStatement();
-    statement.execute(create);
-
-    Statement stmt = connection.createStatement();
-    int count = stmt.executeUpdate(insert);
-    assertThat(count, is(1));
-    ResultSet resultSet = stmt.getResultSet();
-    assertThat(resultSet, nullValue());
-
-    PreparedStatement pstmt = connection.prepareStatement(insert);
-    boolean status = pstmt.execute();
-    assertThat(status, is(false));
-    int updateCount = pstmt.getUpdateCount();
-    assertThat(updateCount, is(1));
-  }
-
-  private void checkStatementExecuteQuery(Connection connection,
-      boolean prepare) throws SQLException {
-    final String sql = "select * from (\n"
-        + "  values (1, 'a'), (null, 'b'), (3, 'c')) as t (c1, c2)";
-    final Statement statement;
-    final ResultSet resultSet;
-    final ParameterMetaData parameterMetaData;
-    if (prepare) {
-      final PreparedStatement ps = connection.prepareStatement(sql);
-      statement = ps;
-      parameterMetaData = ps.getParameterMetaData();
-      resultSet = ps.executeQuery();
-    } else {
-      statement = connection.createStatement();
-      parameterMetaData = null;
-      resultSet = statement.executeQuery(sql);
-    }
-    if (parameterMetaData != null) {
-      assertThat(parameterMetaData.getParameterCount(), equalTo(0));
-    }
-    final ResultSetMetaData metaData = resultSet.getMetaData();
-    assertEquals(2, metaData.getColumnCount());
-    assertEquals("C1", metaData.getColumnName(1));
-    assertEquals("C2", metaData.getColumnName(2));
-    assertTrue(resultSet.next());
-    assertTrue(resultSet.next());
-    assertTrue(resultSet.next());
-    assertFalse(resultSet.next());
-    resultSet.close();
-    statement.close();
-    connection.close();
-  }
-
-  @Test public void testStatementExecuteLocal() throws Exception {
-    ConnectionSpec.getDatabaseLock().lock();
-    try {
-      checkStatementExecute(getLocalConnection(), false);
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  @Test public void testStatementExecuteFetch() throws Exception {
-    ConnectionSpec.getDatabaseLock().lock();
-    try {
-      // Creating a > 100 rows queries to enable fetch request
-      String sql = "select * from emp cross join emp";
-      checkExecuteFetch(getLocalConnection(), sql, false, 1);
-      // PreparedStatement needed an extra fetch, as the execute will
-      // trigger the 1st fetch. Where statement execute will execute direct
-      // with results back.
-      // 1 fetch, because execute did the first fetch
-      checkExecuteFetch(getLocalConnection(), sql, true, 1);
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  private void checkExecuteFetch(Connection conn, String sql, boolean isPrepare,
-    int fetchCountMatch) throws SQLException {
-    final Statement exeStatement;
-    final ResultSet results;
-    getRequestInspection().getRequestLogger().enableAndClear();
-    if (isPrepare) {
-      PreparedStatement statement = conn.prepareStatement(sql);
-      exeStatement = statement;
-      results = statement.executeQuery();
-    } else {
-      Statement statement = conn.createStatement();
-      exeStatement = statement;
-      results = statement.executeQuery(sql);
-    }
-    int count = 0;
-    int fetchCount = 0;
-    while (results.next()) {
-      count++;
-    }
-    results.close();
-    exeStatement.close();
-    List<String[]> x = getRequestInspection().getRequestLogger().getAndDisable();
-    for (String[] pair : x) {
-      if (pair[0].contains("\"request\":\"fetch")) {
-        fetchCount++;
-      }
-    }
-    assertEquals(count, 196);
-    assertEquals(fetchCountMatch, fetchCount);
-  }
-
-  @Test public void testStatementExecuteLocalMaxRow() throws Exception {
-    ConnectionSpec.getDatabaseLock().lock();
-    try {
-      checkStatementExecute(getLocalConnection(), false, 2);
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  @Test public void testFetchSize() throws Exception {
-    Connection connection = ljs();
-
-    Statement statement = connection.createStatement();
-    statement.setFetchSize(101);
-    assertEquals(statement.getFetchSize(), 101);
-
-    PreparedStatement preparedStatement =
-        connection.prepareStatement("select * from (values (1, 'a')) as tbl1 (c1, c2)");
-    preparedStatement.setFetchSize(1);
-    assertEquals(preparedStatement.getFetchSize(), 1);
-  }
-
-  @Ignore("CALCITE-719: Refactor PreparedStatement to support setMaxRows")
-  @Test public void testStatementPrepareExecuteLocalMaxRow() throws Exception {
-    ConnectionSpec.getDatabaseLock().lock();
-    try {
-      checkStatementExecute(getLocalConnection(), true, 2);
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  @Test public void testPrepareExecuteLocal() throws Exception {
-    ConnectionSpec.getDatabaseLock().lock();
-    try {
-      checkStatementExecute(getLocalConnection(), true);
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  private void checkStatementExecute(Connection connection,
-      boolean prepare) throws SQLException {
-    checkStatementExecute(connection, prepare, 0);
-  }
-  private void checkStatementExecute(Connection connection,
-      boolean prepare, int maxRowCount) throws SQLException {
-    final String sql = "select * from (\n"
-        + "  values (1, 'a'), (null, 'b'), (3, 'c')) as t (c1, c2)";
-    final Statement statement;
-    final ResultSet resultSet;
-    final ParameterMetaData parameterMetaData;
-    if (prepare) {
-      final PreparedStatement ps = connection.prepareStatement(sql);
-      statement = ps;
-      ps.setMaxRows(maxRowCount);
-      parameterMetaData = ps.getParameterMetaData();
-      assertTrue(ps.execute());
-      resultSet = ps.getResultSet();
-    } else {
-      statement = connection.createStatement();
-      statement.setMaxRows(maxRowCount);
-      parameterMetaData = null;
-      assertTrue(statement.execute(sql));
-      resultSet = statement.getResultSet();
-    }
-    if (parameterMetaData != null) {
-      assertThat(parameterMetaData.getParameterCount(), equalTo(0));
-    }
-    final ResultSetMetaData metaData = resultSet.getMetaData();
-    assertEquals(2, metaData.getColumnCount());
-    assertEquals("C1", metaData.getColumnName(1));
-    assertEquals("C2", metaData.getColumnName(2));
-    for (int i = 0; i < maxRowCount || (maxRowCount == 0 && i < 3); i++) {
-      assertTrue(resultSet.next());
-    }
-    assertFalse(resultSet.next());
-    resultSet.close();
-    statement.close();
-    connection.close();
-  }
-
-  @Test public void testCreateInsertUpdateDrop() throws Exception {
-    ConnectionSpec.getDatabaseLock().lock();
-    final String t = AvaticaUtils.unique("TEST_TABLE");
-    final String drop =
-        String.format(Locale.ROOT, "drop table %s if exists", t);
-    final String create =
-        String.format(Locale.ROOT, "create table %s("
-                + "id int not null, "
-                + "msg varchar(3) not null)",
-            t);
-    final String insert = String.format(Locale.ROOT,
-        "insert into %s values(1, 'foo')", t);
-    final String update =
-        String.format(Locale.ROOT, "update %s set msg='bar' where id=1", t);
-    try (Connection connection = getLocalConnection();
-        Statement statement = connection.createStatement();
-        PreparedStatement pstmt = connection.prepareStatement("values 1")) {
-      // drop
-      assertFalse(statement.execute(drop));
-      assertEquals(0, statement.getUpdateCount());
-      assertNull(statement.getResultSet());
-      try {
-        final ResultSet rs = statement.executeQuery(drop);
-        fail("expected error, got " + rs);
-      } catch (SQLException e) {
-        assertThat(e.getMessage(),
-            equalTo("Statement did not return a result set"));
-      }
-      assertEquals(0, statement.executeUpdate(drop));
-      assertEquals(0, statement.getUpdateCount());
-      assertNull(statement.getResultSet());
-
-      // create
-      assertFalse(statement.execute(create));
-      assertEquals(0, statement.getUpdateCount());
-      assertNull(statement.getResultSet());
-      assertFalse(statement.execute(drop)); // tidy up
-      try {
-        final ResultSet rs = statement.executeQuery(create);
-        fail("expected error, got " + rs);
-      } catch (SQLException e) {
-        assertThat(e.getMessage(),
-            equalTo("Statement did not return a result set"));
-      }
-      assertFalse(statement.execute(drop)); // tidy up
-      assertEquals(0, statement.executeUpdate(create));
-      assertEquals(0, statement.getUpdateCount());
-      assertNull(statement.getResultSet());
-
-      // insert
-      assertFalse(statement.execute(insert));
-      assertEquals(1, statement.getUpdateCount());
-      assertNull(statement.getResultSet());
-      try {
-        final ResultSet rs = statement.executeQuery(insert);
-        fail("expected error, got " + rs);
-      } catch (SQLException e) {
-        assertThat(e.getMessage(),
-            equalTo("Statement did not return a result set"));
-      }
-      assertEquals(1, statement.executeUpdate(insert));
-      assertEquals(1, statement.getUpdateCount());
-      assertNull(statement.getResultSet());
-
-      // update
-      assertFalse(statement.execute(update));
-      assertEquals(3, statement.getUpdateCount());
-      assertNull(statement.getResultSet());
-      try {
-        final ResultSet rs = statement.executeQuery(update);
-        fail("expected error, got " + rs);
-      } catch (SQLException e) {
-        assertThat(e.getMessage(),
-            equalTo("Statement did not return a result set"));
-      }
-      assertEquals(3, statement.executeUpdate(update));
-      assertEquals(3, statement.getUpdateCount());
-      assertNull(statement.getResultSet());
-
-      final String[] messages = {
-        "Cannot call executeQuery(String) on prepared or callable statement",
-        "Cannot call execute(String) on prepared or callable statement",
-        "Cannot call executeUpdate(String) on prepared or callable statement",
-      };
-      for (String sql : new String[]{drop, create, insert, update}) {
-        for (int i = 0; i <= 2; i++) {
-          try {
-            Object o;
-            switch (i) {
-            case 0:
-              o = pstmt.executeQuery(sql);
-              break;
-            case 1:
-              o = pstmt.execute(sql);
-              break;
-            default:
-              o = pstmt.executeUpdate(sql);
-            }
-            fail("expected error, got " + o);
-          } catch (SQLException e) {
-            assertThat(e.getMessage(), equalTo(messages[i]));
-          }
-        }
-      }
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  @Test public void testTypeHandling() throws Exception {
-    ConnectionSpec.getDatabaseLock().lock();
-    try {
-      final String query = "select * from EMP";
-      try (Connection cannon = canon();
-          Connection underTest = getLocalConnection();
-          Statement s1 = cannon.createStatement();
-          Statement s2 = underTest.createStatement()) {
-        assertTrue(s1.execute(query));
-        assertTrue(s2.execute(query));
-        assertResultSetsEqual(s1, s2);
-      }
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  private void assertResultSetsEqual(Statement s1, Statement s2)
-      throws SQLException {
-    final TimeZone moscowTz = TimeZone.getTimeZone("Europe/Moscow");
-    final Calendar moscowCalendar =
-        Calendar.getInstance(moscowTz, Locale.ROOT);
-    final TimeZone alaskaTz = TimeZone.getTimeZone("America/Anchorage");
-    final Calendar alaskaCalendar =
-        Calendar.getInstance(alaskaTz, Locale.ROOT);
-    try (ResultSet rs1 = s1.getResultSet();
-        ResultSet rs2 = s2.getResultSet()) {
-      assertEquals(rs1.getMetaData().getColumnCount(),
-          rs2.getMetaData().getColumnCount());
-      int colCount = rs1.getMetaData().getColumnCount();
-      while (rs1.next() && rs2.next()) {
-        for (int i = 0; i < colCount; i++) {
-          Object o1 = rs1.getObject(i + 1);
-          Object o2 = rs2.getObject(i + 1);
-          if (o1 instanceof Integer && o2 instanceof Short) {
-            // Hsqldb returns Integer for short columns; we prefer Short
-            o1 = ((Number) o1).shortValue();
-          }
-          if (o1 instanceof Integer && o2 instanceof Byte) {
-            // Hsqldb returns Integer for tinyint columns; we prefer Byte
-            o1 = ((Number) o1).byteValue();
-          }
-          if (o1 instanceof Date) {
-            Date d1 = rs1.getDate(i + 1, moscowCalendar);
-            Date d2 = rs2.getDate(i + 1, moscowCalendar);
-            assertEquals(d1, d2);
-            d1 = rs1.getDate(i + 1, alaskaCalendar);
-            d2 = rs2.getDate(i + 1, alaskaCalendar);
-            assertEquals(d1, d2);
-            d1 = rs1.getDate(i + 1, null);
-            d2 = rs2.getDate(i + 1, null);
-            assertEquals(d1, d2);
-            d1 = rs1.getDate(i + 1);
-            d2 = rs2.getDate(i + 1);
-            assertEquals(d1, d2);
-          }
-          if (o1 instanceof Timestamp) {
-            Timestamp d1 = rs1.getTimestamp(i + 1, moscowCalendar);
-            Timestamp d2 = rs2.getTimestamp(i + 1, moscowCalendar);
-            assertEquals(d1, d2);
-            d1 = rs1.getTimestamp(i + 1, alaskaCalendar);
-            d2 = rs2.getTimestamp(i + 1, alaskaCalendar);
-            assertEquals(d1, d2);
-            d1 = rs1.getTimestamp(i + 1, null);
-            d2 = rs2.getTimestamp(i + 1, null);
-            assertEquals(d1, d2);
-            d1 = rs1.getTimestamp(i + 1);
-            d2 = rs2.getTimestamp(i + 1);
-            assertEquals(d1, d2);
-          }
-          assertEquals(o1, o2);
-        }
-      }
-      assertEquals(rs1.next(), rs2.next());
-    }
-  }
-
-  /** Callback to set parameters on each prepared statement before
-   * each is executed and the result sets compared. */
-  interface PreparedStatementFunction {
-    void apply(PreparedStatement s1, PreparedStatement s2)
-        throws SQLException;
-  }
-
-  /** Callback to execute some code against a connection. */
-  interface ConnectionFunction {
-    void apply(Connection c1) throws Exception;
-  }
-
-  @Test public void testSetParameter() throws Exception {
-    ConnectionSpec.getDatabaseLock().lock();
-    try {
-      checkSetParameter("select ? from (values 1)",
-          new PreparedStatementFunction() {
-            public void apply(PreparedStatement s1, PreparedStatement s2)
-                throws SQLException {
-              final Date d = new Date(1234567890);
-              s1.setDate(1, d);
-              s2.setDate(1, d);
-            }
-          });
-      checkSetParameter("select ? from (values 1)",
-          new PreparedStatementFunction() {
-            public void apply(PreparedStatement s1, PreparedStatement s2)
-                throws SQLException {
-              final Timestamp ts = new Timestamp(123456789012L);
-              s1.setTimestamp(1, ts);
-              s2.setTimestamp(1, ts);
-            }
-          });
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  void checkSetParameter(String query, PreparedStatementFunction fn)
-      throws SQLException {
-    try (Connection cannon = canon();
-         Connection underTest = ljs();
-         PreparedStatement s1 = cannon.prepareStatement(query);
-         PreparedStatement s2 = underTest.prepareStatement(query)) {
-      fn.apply(s1, s2);
-      assertTrue(s1.execute());
-      assertTrue(s2.execute());
-      assertResultSetsEqual(s1, s2);
-    }
-  }
-
-  @Test public void testStatementLifecycle() throws Exception {
-    ConnectionSpec.getDatabaseLock().lock();
-    try (AvaticaConnection connection = (AvaticaConnection) getLocalConnection()) {
-      Map<Integer, AvaticaStatement> clientMap = connection.statementMap;
-      Cache<Integer, Object> serverMap = getLocalConnectionInternals()
-          .getRemoteStatementMap(connection);
-      // Other tests being run might leave statements in the cache.
-      // The lock guards against more statements being cached during the test.
-      serverMap.invalidateAll();
-      assertEquals(0, clientMap.size());
-      assertEquals(0, serverMap.size());
-      Statement stmt = connection.createStatement();
-      assertEquals(1, clientMap.size());
-      assertEquals(1, serverMap.size());
-      stmt.close();
-      assertEquals(0, clientMap.size());
-      assertEquals(0, serverMap.size());
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  @Test public void testConnectionIsolation() throws Exception {
-    ConnectionSpec.getDatabaseLock().lock();
-    try {
-      Cache<String, Connection> connectionMap = getLocalConnectionInternals()
-          .getRemoteConnectionMap((AvaticaConnection) getLocalConnection());
-      // Other tests being run might leave connections in the cache.
-      // The lock guards against more connections being cached during the test.
-      connectionMap.invalidateAll();
-
-      final String sql = "select * from (values (1, 'a'))";
-      assertEquals("connection cache should start empty",
-          0, connectionMap.size());
-      Connection conn1 = getLocalConnection();
-      Connection conn2 = getLocalConnection();
-      assertEquals("we now have two connections open",
-          2, connectionMap.size());
-      PreparedStatement conn1stmt1 = conn1.prepareStatement(sql);
-      assertEquals(
-          "creating a statement does not cause new connection",
-          2, connectionMap.size());
-      PreparedStatement conn2stmt1 = conn2.prepareStatement(sql);
-      assertEquals(
-          "creating a statement does not cause new connection",
-          2, connectionMap.size());
-      AvaticaPreparedStatement s1 = (AvaticaPreparedStatement) conn1stmt1;
-      AvaticaPreparedStatement s2 = (AvaticaPreparedStatement) conn2stmt1;
-      assertFalse("connection id's should be unique",
-          s1.handle.connectionId.equalsIgnoreCase(s2.handle.connectionId));
-      conn2.close();
-      assertEquals("closing a connection closes the server-side connection",
-          1, connectionMap.size());
-      conn1.close();
-      assertEquals("closing a connection closes the server-side connection",
-          0, connectionMap.size());
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  @Test public void testPrepareBindExecuteFetch() throws Exception {
-    ConnectionSpec.getDatabaseLock().lock();
-    try {
-      getRequestInspection().getRequestLogger().enableAndClear();
-      checkPrepareBindExecuteFetch(getLocalConnection());
-      List<String[]> x = getRequestInspection().getRequestLogger().getAndDisable();
-      for (String[] pair : x) {
-        System.out.println(pair[0] + "=" + pair[1]);
-      }
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  private void checkPrepareBindExecuteFetch(Connection connection)
-      throws SQLException {
-    final String sql = "select cast(? as integer) * 3 as c, 'x' as x\n"
-        + "from (values (1, 'a'))";
-    final PreparedStatement ps =
-        connection.prepareStatement(sql);
-    final ResultSetMetaData metaData = ps.getMetaData();
-    assertEquals(2, metaData.getColumnCount());
-    assertEquals("C", metaData.getColumnName(1));
-    assertEquals("X", metaData.getColumnName(2));
-    try {
-      final ResultSet resultSet = ps.executeQuery();
-      fail("expected error, got " + resultSet);
-    } catch (SQLException e) {
-      assertThat(e.getMessage(),
-          containsString("exception while executing query: unbound parameter"));
-    }
-
-    final ParameterMetaData parameterMetaData = ps.getParameterMetaData();
-    assertThat(parameterMetaData.getParameterCount(), equalTo(1));
-
-    ps.setInt(1, 10);
-    final ResultSet resultSet = ps.executeQuery();
-    assertTrue(resultSet.next());
-    assertThat(resultSet.getInt(1), equalTo(30));
-    assertFalse(resultSet.next());
-    resultSet.close();
-
-    ps.setInt(1, 20);
-    final ResultSet resultSet2 = ps.executeQuery();
-    assertFalse(resultSet2.isClosed());
-    assertTrue(resultSet2.next());
-    assertThat(resultSet2.getInt(1), equalTo(60));
-    assertThat(resultSet2.wasNull(), is(false));
-    assertFalse(resultSet2.next());
-    resultSet2.close();
-
-    ps.setObject(1, null);
-    final ResultSet resultSet3 = ps.executeQuery();
-    assertTrue(resultSet3.next());
-    assertThat(resultSet3.getInt(1), equalTo(0));
-    assertThat(resultSet3.wasNull(), is(true));
-    assertFalse(resultSet3.next());
-    resultSet3.close();
-
-    ps.close();
-    connection.close();
-  }
-
-  @Test public void testPrepareBindExecuteFetchVarbinary() throws Exception {
-    ConnectionSpec.getDatabaseLock().lock();
-    try {
-      final Connection connection = getLocalConnection();
-      final String sql = "select x'de' || ? as c from (values (1, 'a'))";
-      final PreparedStatement ps =
-          connection.prepareStatement(sql);
-      final ParameterMetaData parameterMetaData = ps.getParameterMetaData();
-      assertThat(parameterMetaData.getParameterCount(), equalTo(1));
-
-      ps.setBytes(1, new byte[]{65, 0, 66});
-      final ResultSet resultSet = ps.executeQuery();
-      assertTrue(resultSet.next());
-      assertThat(resultSet.getBytes(1),
-          equalTo(new byte[]{(byte) 0xDE, 65, 0, 66}));
-      resultSet.close();
-      ps.close();
-      connection.close();
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  @Test public void testPrepareBindExecuteFetchDate() throws Exception {
-    ConnectionSpec.getDatabaseLock().lock();
-    try {
-      eachConnection(
-          new ConnectionFunction() {
-            public void apply(Connection c1) throws Exception {
-              checkPrepareBindExecuteFetchDate(c1);
-            }
-          }, getLocalConnection());
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  private void checkPrepareBindExecuteFetchDate(Connection connection) throws Exception {
-    final String sql0 =
-        "select cast(? as varchar(20)) as c\n"
-            + "from (values (1, 'a'))";
-    final String sql1 = "select ? + interval '2' day as c from (values (1, 'a'))";
-
-    final Date date = Date.valueOf("2015-04-08");
-    final long time = date.getTime();
-
-    PreparedStatement ps;
-    ParameterMetaData parameterMetaData;
-    ResultSet resultSet;
-
-    ps = connection.prepareStatement(sql0);
-    parameterMetaData = ps.getParameterMetaData();
-    assertThat(parameterMetaData.getParameterCount(), equalTo(1));
-    ps.setDate(1, date);
-    resultSet = ps.executeQuery();
-    assertThat(resultSet.next(), is(true));
-    assertThat(resultSet.getString(1), is("2015-04-08"));
-
-    ps.setTimestamp(1, new Timestamp(time));
-    resultSet = ps.executeQuery();
-    assertThat(resultSet.next(), is(true));
-    assertThat(resultSet.getString(1), is("2015-04-08 00:00:00.0"));
-
-    ps.setTime(1, new Time(time));
-    resultSet = ps.executeQuery();
-    assertThat(resultSet.next(), is(true));
-    assertThat(resultSet.getString(1), is("00:00:00"));
-    ps.close();
-
-    ps = connection.prepareStatement(sql1);
-    parameterMetaData = ps.getParameterMetaData();
-    assertThat(parameterMetaData.getParameterCount(), equalTo(1));
-
-    ps.setDate(1, date);
-    resultSet = ps.executeQuery();
-    assertTrue(resultSet.next());
-    assertThat(resultSet.getDate(1),
-        equalTo(new Date(time + TimeUnit.DAYS.toMillis(2))));
-    assertThat(resultSet.getTimestamp(1),
-        equalTo(new Timestamp(time + TimeUnit.DAYS.toMillis(2))));
-
-    ps.setTimestamp(1, new Timestamp(time));
-    resultSet = ps.executeQuery();
-    assertTrue(resultSet.next());
-    assertThat(resultSet.getTimestamp(1),
-        equalTo(new Timestamp(time + TimeUnit.DAYS.toMillis(2))));
-    assertThat(resultSet.getTimestamp(1),
-        equalTo(new Timestamp(time + TimeUnit.DAYS.toMillis(2))));
-
-    ps.setObject(1, new java.util.Date(time));
-    resultSet = ps.executeQuery();
-    assertTrue(resultSet.next());
-    assertThat(resultSet.getDate(1),
-        equalTo(new Date(time + TimeUnit.DAYS.toMillis(2))));
-    assertThat(resultSet.getTimestamp(1),
-        equalTo(new Timestamp(time + TimeUnit.DAYS.toMillis(2))));
-
-    resultSet.close();
-    ps.close();
-    connection.close();
-  }
-
-  @Test public void testDatabaseProperty() throws Exception {
-    ConnectionSpec.getDatabaseLock().lock();
-    try {
-      eachConnection(
-          new ConnectionFunction() {
-            public void apply(Connection c1) throws Exception {
-              checkDatabaseProperty(c1);
-            }
-          }, getLocalConnection());
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  private void checkDatabaseProperty(Connection connection)
-      throws SQLException {
-    final DatabaseMetaData metaData = connection.getMetaData();
-    assertThat(metaData.getSQLKeywords(), equalTo(""));
-    assertThat(metaData.getStringFunctions(),
-        equalTo("ASCII,CHAR,CONCAT,DIFFERENCE,HEXTORAW,INSERT,LCASE,LEFT,"
-            + "LENGTH,LOCATE,LTRIM,RAWTOHEX,REPEAT,REPLACE,RIGHT,RTRIM,SOUNDEX,"
-            + "SPACE,SUBSTR,UCASE"));
-    assertThat(metaData.getDefaultTransactionIsolation(),
-        equalTo(Connection.TRANSACTION_READ_COMMITTED));
-  }
-
-  @Test public void testBatchExecute() throws Exception {
-    ConnectionSpec.getDatabaseLock().lock();
-    try {
-      eachConnection(
-          new ConnectionFunction() {
-            public void apply(Connection c1) throws Exception {
-              executeBatchUpdate(c1);
-            }
-          }, getLocalConnection());
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  private void executeBatchUpdate(Connection conn) throws Exception {
-    final int numRows = 10;
-    try (Statement stmt = conn.createStatement()) {
-      final String tableName = AvaticaUtils.unique("BATCH_EXECUTE");
-      LOG.info("Creating table {}", tableName);
-      final String createCommand = String.format(Locale.ROOT,
-          "create table if not exists %s ("
-              + "id int not null, "
-              + "msg varchar(10) not null)", tableName);
-      assertFalse("Failed to create table", stmt.execute(createCommand));
-
-      final String updatePrefix =
-          String.format(Locale.ROOT, "INSERT INTO %s values(", tableName);
-      for (int i = 0; i < numRows;  i++) {
-        stmt.addBatch(updatePrefix + i + ", '" + Integer.toString(i) + "')");
-      }
-
-      int[] updateCounts = stmt.executeBatch();
-      assertEquals("Unexpected number of update counts returned", numRows, updateCounts.length);
-      for (int i = 0; i < updateCounts.length; i++) {
-        assertEquals("Unexpected update count at index " + i, 1, updateCounts[i]);
-      }
-
-      ResultSet rs = stmt.executeQuery("SELECT * FROM " + tableName + " ORDER BY id asc");
-      assertNotNull("ResultSet was null", rs);
-      for (int i = 0; i < numRows; i++) {
-        assertTrue("ResultSet should have a result", rs.next());
-        assertEquals("Wrong integer value for row " + i, i, rs.getInt(1));
-        assertEquals("Wrong string value for row " + i, Integer.toString(i), rs.getString(2));
-      }
-      assertFalse("ResultSet should have no more records", rs.next());
-    }
-  }
-
-  @Test public void testPreparedBatches() throws Exception {
-    ConnectionSpec.getDatabaseLock().lock();
-    try {
-      eachConnection(
-          new ConnectionFunction() {
-            public void apply(Connection c1) throws Exception {
-              executePreparedBatchUpdate(c1);
-            }
-          }, getLocalConnection());
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  private void executePreparedBatchUpdate(Connection conn) throws Exception {
-    final int numRows = 10;
-    final String tableName = AvaticaUtils.unique("PREPARED_BATCH_EXECUTE");
-    LOG.info("Creating table {}", tableName);
-    try (Statement stmt = conn.createStatement()) {
-      final String createCommand =
-          String.format(Locale.ROOT, "create table if not exists %s ("
-              + "id int not null, "
-              + "msg varchar(10) not null)", tableName);
-      assertFalse("Failed to create table", stmt.execute(createCommand));
-    }
-
-    final String insertSql =
-        String.format(Locale.ROOT, "INSERT INTO %s values(?, ?)", tableName);
-    try (PreparedStatement pstmt = conn.prepareStatement(insertSql)) {
-      // Add batches with the prepared statement
-      for (int i = 0; i < numRows; i++) {
-        pstmt.setInt(1, i);
-        pstmt.setString(2, Integer.toString(i));
-        pstmt.addBatch();
-      }
-
-      int[] updateCounts = pstmt.executeBatch();
-      assertEquals("Unexpected number of update counts returned", numRows, updateCounts.length);
-      for (int i = 0; i < updateCounts.length; i++) {
-        assertEquals("Unexpected update count at index " + i, 1, updateCounts[i]);
-      }
-    }
-
-    try (Statement stmt = conn.createStatement()) {
-      ResultSet rs = stmt.executeQuery("SELECT * FROM " + tableName + " ORDER BY id asc");
-      assertNotNull("ResultSet was null", rs);
-      for (int i = 0; i < numRows; i++) {
-        assertTrue("ResultSet should have a result", rs.next());
-        assertEquals("Wrong integer value for row " + i, i, rs.getInt(1));
-        assertEquals("Wrong string value for row " + i, Integer.toString(i), rs.getString(2));
-      }
-      assertFalse("ResultSet should have no more records", rs.next());
-    }
-  }
-
-  @Test public void testPreparedInsert() throws Exception {
-    ConnectionSpec.getDatabaseLock().lock();
-    try {
-      eachConnection(
-          new ConnectionFunction() {
-            public void apply(Connection c1) throws Exception {
-              executePreparedInsert(c1);
-            }
-          }, getLocalConnection());
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  private void executePreparedInsert(Connection conn) throws Exception {
-    final int numRows = 10;
-    final String tableName = AvaticaUtils.unique("PREPARED_INSERT_EXECUTE");
-    LOG.info("Creating table {}", tableName);
-    try (Statement stmt = conn.createStatement()) {
-      final String createCommand =
-          String.format(Locale.ROOT, "create table if not exists %s ("
-              + "id int not null, "
-              + "msg varchar(10) not null)", tableName);
-      assertFalse("Failed to create table", stmt.execute(createCommand));
-    }
-
-    final String insertSql =
-        String.format(Locale.ROOT, "INSERT INTO %s values(?, ?)", tableName);
-    try (PreparedStatement pstmt = conn.prepareStatement(insertSql)) {
-      // Add batches with the prepared statement
-      for (int i = 0; i < numRows; i++) {
-        pstmt.setInt(1, i);
-        pstmt.setString(2, Integer.toString(i));
-        assertEquals(1, pstmt.executeUpdate());
-      }
-    }
-
-    try (Statement stmt = conn.createStatement()) {
-      ResultSet rs = stmt.executeQuery("SELECT * FROM " + tableName + " ORDER BY id asc");
-      assertNotNull("ResultSet was null", rs);
-      for (int i = 0; i < numRows; i++) {
-        assertTrue("ResultSet should have a result", rs.next());
-        assertEquals("Wrong integer value for row " + i, i, rs.getInt(1));
-        assertEquals("Wrong string value for row " + i, Integer.toString(i), rs.getString(2));
-      }
-      assertFalse("ResultSet should have no more records", rs.next());
-    }
-  }
-
-  @Test public void testPreparedInsertWithNulls() throws Exception {
-    ConnectionSpec.getDatabaseLock().lock();
-    try {
-      eachConnection(
-          new ConnectionFunction() {
-            public void apply(Connection c1) throws Exception {
-              executePreparedInsertWithNulls(c1);
-            }
-          }, getLocalConnection());
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  private void executePreparedInsertWithNulls(Connection conn) throws Exception {
-    final int numRows = 10;
-    final String tableName = AvaticaUtils.unique("PREPARED_INSERT_EXECUTE_NULLS");
-    LOG.info("Creating table {}", tableName);
-    try (Statement stmt = conn.createStatement()) {
-      final String createCommand =
-          String.format(Locale.ROOT, "create table if not exists %s ("
-              + "id int not null, "
-              + "msg varchar(10))", tableName);
-      assertFalse("Failed to create table", stmt.execute(createCommand));
-    }
-
-    final String insertSql =
-        String.format(Locale.ROOT, "INSERT INTO %s values(?, ?)", tableName);
-    try (PreparedStatement pstmt = conn.prepareStatement(insertSql)) {
-      // Add batches with the prepared statement
-      for (int i = 0; i < numRows; i++) {
-        pstmt.setInt(1, i);
-        // Even inserts are non-null, odd are null
-        if (0 == i % 2) {
-          pstmt.setString(2, Integer.toString(i));
-        } else {
-          pstmt.setNull(2, Types.VARCHAR);
-        }
-        assertEquals(1, pstmt.executeUpdate());
-      }
-    }
-
-    try (Statement stmt = conn.createStatement()) {
-      ResultSet rs = stmt.executeQuery("SELECT * FROM " + tableName + " ORDER BY id asc");
-      assertNotNull("ResultSet was null", rs);
-      for (int i = 0; i < numRows; i++) {
-        assertTrue("ResultSet should have a result", rs.next());
-        assertEquals("Wrong integer value for row " + i, i, rs.getInt(1));
-        if (0 == i % 2) {
-          assertEquals("Wrong string value for row " + i, Integer.toString(i), rs.getString(2));
-        } else {
-          assertNull("Expected null value for row " + i, rs.getString(2));
-        }
-      }
-      assertFalse("ResultSet should have no more records", rs.next());
-    }
-  }
-
-  @Test public void testBatchInsertWithNulls() throws Exception {
-    ConnectionSpec.getDatabaseLock().lock();
-    try {
-      eachConnection(
-          new ConnectionFunction() {
-            public void apply(Connection c1) throws Exception {
-              executeBatchInsertWithNulls(c1);
-            }
-          }, getLocalConnection());
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  private void executeBatchInsertWithNulls(Connection conn) throws Exception {
-    final int numRows = 10;
-    final String tableName = AvaticaUtils.unique("BATCH_INSERT_EXECUTE_NULLS");
-    LOG.info("Creating table {}", tableName);
-    try (Statement stmt = conn.createStatement()) {
-      final String createCommand =
-          String.format(Locale.ROOT, "create table if not exists %s ("
-              + "id int not null, "
-              + "msg varchar(10))", tableName);
-      assertFalse("Failed to create table", stmt.execute(createCommand));
-    }
-
-    final String insertSql =
-        String.format(Locale.ROOT, "INSERT INTO %s values(?, ?)", tableName);
-    try (PreparedStatement pstmt = conn.prepareStatement(insertSql)) {
-      // Add batches with the prepared statement
-      for (int i = 0; i < numRows; i++) {
-        pstmt.setInt(1, i);
-        // Even inserts are non-null, odd are null
-        if (0 == i % 2) {
-          pstmt.setString(2, Integer.toString(i));
-        } else {
-          pstmt.setNull(2, Types.VARCHAR);
-        }
-        pstmt.addBatch();
-      }
-      // Verify that all updates were successful
-      int[] updateCounts = pstmt.executeBatch();
-      assertEquals(numRows, updateCounts.length);
-      int[] expectedCounts = new int[numRows];
-      Arrays.fill(expectedCounts, 1);
-      assertArrayEquals(expectedCounts, updateCounts);
-    }
-
-    try (Statement stmt = conn.createStatement()) {
-      ResultSet rs = stmt.executeQuery("SELECT * FROM " + tableName + " ORDER BY id asc");
-      assertNotNull("ResultSet was null", rs);
-      for (int i = 0; i < numRows; i++) {
-        assertTrue("ResultSet should have a result", rs.next());
-        assertEquals("Wrong integer value for row " + i, i, rs.getInt(1));
-        if (0 == i % 2) {
-          assertEquals("Wrong string value for row " + i, Integer.toString(i), rs.getString(2));
-        } else {
-          assertNull("Expected null value for row " + i, rs.getString(2));
-        }
-      }
-      assertFalse("ResultSet should have no more records", rs.next());
-    }
-  }
-
-  @Test public void preparedStatementParameterCopies() throws Exception {
-    // When implementing the JDBC batch APIs, it's important that we are copying the
-    // TypedValues and caching them in the AvaticaPreparedStatement. Otherwise, when we submit
-    // the batch, the parameter values for the last update added will be reflected in all previous
-    // updates added to the batch.
-    ConnectionSpec.getDatabaseLock().lock();
-    try {
-      final String tableName = AvaticaUtils.unique("PREPAREDSTATEMENT_VALUES");
-      final Connection conn = getLocalConnection();
-      try (Statement stmt = conn.createStatement()) {
-        final String sql = "CREATE TABLE " + tableName
-            + " (id varchar(1) not null, col1 varchar(1) not null)";
-        assertFalse(stmt.execute(sql));
-      }
-      try (final PreparedStatement pstmt =
-          conn.prepareStatement("INSERT INTO " + tableName + " values(?, ?)")) {
-        pstmt.setString(1, "a");
-        pstmt.setString(2, "b");
-
-        @SuppressWarnings("resource")
-        AvaticaPreparedStatement apstmt = (AvaticaPreparedStatement) pstmt;
-        TypedValue[] slots = apstmt.slots;
-
-        assertEquals("Unexpected number of values", 2, slots.length);
-
-        List<TypedValue> valuesReference = apstmt.getParameterValues();
-        assertEquals(2, valuesReference.size());
-        assertEquals(slots[0], valuesReference.get(0));
-        assertEquals(slots[1], valuesReference.get(1));
-        List<TypedValue> copiedValues = apstmt.copyParameterValues();
-        assertEquals(2, valuesReference.size());
-        assertEquals(slots[0], copiedValues.get(0));
-        assertEquals(slots[1], copiedValues.get(1));
-
-        slots[0] = null;
-        slots[1] = null;
-
-        // Modifications to the array are reflected in the List from getParameterValues()
-        assertNull(valuesReference.get(0));
-        assertNull(valuesReference.get(1));
-        // copyParameterValues() copied the underlying array, so updates to slots is not reflected
-        assertNotNull(copiedValues.get(0));
-        assertNotNull(copiedValues.get(1));
-      }
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  @Test public void testBatchInsertWithDates() throws Exception {
-    ConnectionSpec.getDatabaseLock().lock();
-    try {
-      eachConnection(
-          new ConnectionFunction() {
-            public void apply(Connection c1) throws Exception {
-              executeBatchInsertWithDates(c1);
-            }
-          }, getLocalConnection());
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  private void executeBatchInsertWithDates(Connection conn) throws Exception {
-    final Calendar calendar = DateTimeUtils.calendar();
-    long now = calendar.getTime().getTime();
-    final int numRows = 10;
-    final String tableName = AvaticaUtils.unique("BATCH_INSERT_EXECUTE_DATES");
-    LOG.info("Creating table {}", tableName);
-    try (Statement stmt = conn.createStatement()) {
-      final String dropCommand =
-          String.format(Locale.ROOT, "drop table if exists %s", tableName);
-      assertFalse("Failed to drop table", stmt.execute(dropCommand));
-      final String createCommand =
-          String.format(Locale.ROOT, "create table %s ("
-              + "id char(15) not null, "
-              + "created_date date not null, "
-              + "val_string varchar)", tableName);
-      assertFalse("Failed to create table", stmt.execute(createCommand));
-    }
-
-    final String insertSql =
-        String.format(Locale.ROOT, "INSERT INTO %s values(?, ?, ?)", tableName);
-    try (PreparedStatement pstmt = conn.prepareStatement(insertSql)) {
-      // Add batches with the prepared statement
-      for (int i = 0; i < numRows; i++) {
-        pstmt.setString(1, Integer.toString(i));
-        pstmt.setDate(2, new Date(now + i), calendar);
-        pstmt.setString(3, UUID.randomUUID().toString());
-        pstmt.addBatch();
-      }
-      // Verify that all updates were successful
-      int[] updateCounts = pstmt.executeBatch();
-      assertEquals(numRows, updateCounts.length);
-      int[] expectedCounts = new int[numRows];
-      Arrays.fill(expectedCounts, 1);
-      assertArrayEquals(expectedCounts, updateCounts);
-    }
-
-    try (Statement stmt = conn.createStatement()) {
-      ResultSet rs = stmt.executeQuery("SELECT * FROM " + tableName + " ORDER BY id asc");
-      assertNotNull("ResultSet was null", rs);
-      for (int i = 0; i < numRows; i++) {
-        assertTrue("ResultSet should have a result", rs.next());
-        assertEquals("Wrong value for row " + i, Integer.toString(i), rs.getString(1).trim());
-
-        Date actual = rs.getDate(2);
-        calendar.setTime(actual);
-        int actualDay = calendar.get(Calendar.DAY_OF_MONTH);
-        int actualMonth = calendar.get(Calendar.MONTH);
-        int actualYear = calendar.get(Calendar.YEAR);
-
-        Date expected = new Date(now + i);
-        calendar.setTime(expected);
-        int expectedDay = calendar.get(Calendar.DAY_OF_MONTH);
-        int expectedMonth = calendar.get(Calendar.MONTH);
-        int expectedYear = calendar.get(Calendar.YEAR);
-        assertEquals("Wrong day for row " + i, expectedDay, actualDay);
-        assertEquals("Wrong month for row " + i, expectedMonth, actualMonth);
-        assertEquals("Wrong year for row " + i, expectedYear, actualYear);
-
-        assertNotNull("Non-null string for row " + i, rs.getString(3));
-      }
-      assertFalse("ResultSet should have no more records", rs.next());
-    }
-  }
-
-  @Test public void testDatabaseMetaData() throws Exception {
-    ConnectionSpec.getDatabaseLock().lock();
-    try (Connection conn = getLocalConnection()) {
-      DatabaseMetaData metadata = conn.getMetaData();
-      assertTrue(metadata.isWrapperFor(AvaticaSpecificDatabaseMetaData.class));
-      assertTrue(metadata.isWrapperFor(Properties.class));
-      Properties props = metadata.unwrap(Properties.class);
-      assertNotNull(props);
-
-      final Object productName = props.get(DatabaseProperty.GET_DATABASE_PRODUCT_NAME.name());
-      assertThat(productName, instanceOf(String.class));
-      assertThat((String) productName, startsWith("HSQL"));
-
-      final Object driverName = props.get(DatabaseProperty.GET_DRIVER_NAME.name());
-      assertThat(driverName, instanceOf(String.class));
-      assertThat((String) driverName, startsWith("HSQL"));
-
-      final Object driverVersion = props.get(DatabaseProperty.GET_DRIVER_VERSION.name());
-      final Object driverMinVersion = props.get(DatabaseProperty.GET_DRIVER_MINOR_VERSION.name());
-      final Object driverMajVersion = props.get(DatabaseProperty.GET_DRIVER_MAJOR_VERSION.name());
-      assertThat(driverVersion, instanceOf(String.class));
-      assertThat(driverMinVersion, instanceOf(String.class));
-      assertThat(driverMajVersion, instanceOf(String.class));
-      assertThat((String) driverVersion, startsWith(driverMajVersion + "." + driverMinVersion));
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  @Test public void testUnicodeColumnNames() throws Exception {
-    final String tableName = "unicodeColumn";
-    final String columnName = "\u041d\u043e\u043c\u0435\u0440\u0422\u0435\u043b"
-        + "\u0435\u0444\u043e\u043d\u0430"; // PhoneNumber in Russian
-    ConnectionSpec.getDatabaseLock().lock();
-    try (Connection conn = getLocalConnection();
-        Statement stmt = conn.createStatement()) {
-      assertFalse(stmt.execute("DROP TABLE IF EXISTS " + tableName));
-      final String sql = "CREATE TABLE " + tableName + "(" + columnName + " integer)";
-      assertFalse(stmt.execute(sql));
-      final ResultSet results = stmt.executeQuery("SELECT * FROM " + tableName);
-      assertNotNull(results);
-      ResultSetMetaData metadata = results.getMetaData();
-      assertNotNull(metadata);
-      String actualColumnName = metadata.getColumnName(1);
-      // HSQLDB is going to upper-case the column name
-      assertEquals(columnName.toUpperCase(Locale.ROOT), actualColumnName);
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  @Test public void testBigDecimalPrecision() throws Exception {
-    final String tableName = "decimalPrecision";
-    // DECIMAL(25,5), 20 before, 5 after
-    BigDecimal decimal = new BigDecimal("12345123451234512345.09876");
-    try (Connection conn = getLocalConnection();
-        Statement stmt = conn.createStatement()) {
-      assertFalse(stmt.execute("DROP TABLE IF EXISTS " + tableName));
-      assertFalse(stmt.execute("CREATE TABLE " + tableName + " (col1 DECIMAL(25,5))"));
-
-      // Insert a single decimal
-      try (PreparedStatement pstmt = conn.prepareStatement("INSERT INTO " + tableName
-          + " values (?)")) {
-        pstmt.setBigDecimal(1, decimal);
-        assertEquals(1, pstmt.executeUpdate());
-      }
-
-      ResultSet results = stmt.executeQuery("SELECT * FROM " + tableName);
-      assertNotNull(results);
-      assertTrue(results.next());
-      BigDecimal actualDecimal = results.getBigDecimal(1);
-      assertEquals(decimal, actualDecimal);
-    }
-  }
-
-  @Test public void testPreparedClearBatches() throws Exception {
-    ConnectionSpec.getDatabaseLock().lock();
-    try {
-      eachConnection(
-          new ConnectionFunction() {
-            public void apply(Connection c1) throws Exception {
-              executePreparedBatchClears(c1);
-            }
-          }, getLocalConnection());
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  private void executePreparedBatchClears(Connection conn) throws Exception {
-    final int numRows = 10;
-    final String tableName = AvaticaUtils.unique("BATCH_CLEARS");
-    LOG.info("Creating table {}", tableName);
-    try (Statement stmt = conn.createStatement()) {
-      final String createCommand =
-          String.format(Locale.ROOT, "create table if not exists %s ("
-              + "id int not null, "
-              + "msg varchar(10) not null)", tableName);
-      assertFalse("Failed to create table", stmt.execute(createCommand));
-    }
-
-    final String insertSql =
-        String.format(Locale.ROOT, "INSERT INTO %s values(?, ?)", tableName);
-    try (PreparedStatement pstmt = conn.prepareStatement(insertSql)) {
-      // Add batches with the prepared statement
-      for (int i = 0; i < numRows; i++) {
-        pstmt.setInt(1, i);
-        pstmt.setString(2, Integer.toString(i));
-        pstmt.addBatch();
-
-        if (numRows / 2 - 1 == i) {
-          // Clear the first 5 entries in the batch
-          pstmt.clearBatch();
-        }
-      }
-
-      int[] updateCounts = pstmt.executeBatch();
-      assertEquals("Unexpected number of update counts returned", numRows / 2, updateCounts.length);
-      for (int i = 0; i < updateCounts.length; i++) {
-        assertEquals("Unexpected update count at index " + i, 1, updateCounts[i]);
-      }
-    }
-
-    try (Statement stmt = conn.createStatement()) {
-      ResultSet rs = stmt.executeQuery("SELECT * FROM " + tableName + " ORDER BY id asc");
-      assertNotNull("ResultSet was null", rs);
-      for (int i = 0 + (numRows / 2); i < numRows; i++) {
-        assertTrue("ResultSet should have a result", rs.next());
-        assertEquals("Wrong integer value for row " + i, i, rs.getInt(1));
-        assertEquals("Wrong string value for row " + i, Integer.toString(i), rs.getString(2));
-      }
-      assertFalse("ResultSet should have no more records", rs.next());
-    }
-  }
-
-  @Test public void testBatchClear() throws Exception {
-    ConnectionSpec.getDatabaseLock().lock();
-    try {
-      eachConnection(
-          new ConnectionFunction() {
-            public void apply(Connection c1) throws Exception {
-              executeBatchClear(c1);
-            }
-          }, getLocalConnection());
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  private void executeBatchClear(Connection conn) throws Exception {
-    final int numRows = 10;
-    try (Statement stmt = conn.createStatement()) {
-      final String tableName = AvaticaUtils.unique("BATCH_EXECUTE");
-      LOG.info("Creating table {}", tableName);
-      final String createCommand =
-          String.format(Locale.ROOT, "create table if not exists %s ("
-              + "id int not null, "
-              + "msg varchar(10) not null)", tableName);
-      assertFalse("Failed to create table", stmt.execute(createCommand));
-
-      final String updatePrefix =
-          String.format(Locale.ROOT, "INSERT INTO %s values(", tableName);
-      for (int i = 0; i < numRows;  i++) {
-        stmt.addBatch(updatePrefix + i + ", '" + Integer.toString(i) + "')");
-        if (numRows / 2 - 1 == i) {
-          stmt.clearBatch();
-        }
-      }
-
-      int[] updateCounts = stmt.executeBatch();
-      assertEquals("Unexpected number of update counts returned", numRows / 2, updateCounts.length);
-      for (int i = 0; i < updateCounts.length; i++) {
-        assertEquals("Unexpected update count at index " + i, 1, updateCounts[i]);
-      }
-
-      ResultSet rs = stmt.executeQuery("SELECT * FROM " + tableName + " ORDER BY id asc");
-      assertNotNull("ResultSet was null", rs);
-      for (int i = 0 + (numRows / 2); i < numRows; i++) {
-        assertTrue("ResultSet should have a result", rs.next());
-        assertEquals("Wrong integer value for row " + i, i, rs.getInt(1));
-        assertEquals("Wrong string value for row " + i, Integer.toString(i), rs.getString(2));
-      }
-      assertFalse("ResultSet should have no more records", rs.next());
-    }
-  }
-
-  @Test public void testDecimalParameters() throws Exception {
-    final String tableName = "decimalParameters";
-    BigDecimal decimal = new BigDecimal("123451234512345");
-    try (Connection conn = getLocalConnection();
-        Statement stmt = conn.createStatement()) {
-      assertFalse(stmt.execute("DROP TABLE IF EXISTS " + tableName));
-      String sql = "CREATE TABLE " + tableName + " (keycolumn VARCHAR(5), column1 DECIMAL(15,0))";
-      assertFalse(stmt.execute(sql));
-
-      // Insert a single decimal
-      try (PreparedStatement pstmt = conn.prepareStatement("INSERT INTO " + tableName
-          + " values (?, ?)")) {
-        ParameterMetaData metadata = pstmt.getParameterMetaData();
-        assertNotNull(metadata);
-        assertEquals(5, metadata.getPrecision(1));
-        assertEquals(0, metadata.getScale(1));
-        assertEquals(15, metadata.getPrecision(2));
-        assertEquals(0, metadata.getScale(2));
-
-        pstmt.setString(1, "asdfg");
-        pstmt.setBigDecimal(2, decimal);
-        assertEquals(1, pstmt.executeUpdate());
-      }
-
-      ResultSet results = stmt.executeQuery("SELECT * FROM " + tableName);
-      assertNotNull(results);
-      assertTrue(results.next());
-      BigDecimal actualDecimal = results.getBigDecimal(2);
-      assertEquals(decimal, actualDecimal);
-
-      ResultSetMetaData resultMetadata = results.getMetaData();
-      assertNotNull(resultMetadata);
-      assertEquals(15, resultMetadata.getPrecision(2));
-      assertEquals(0, resultMetadata.getScale(2));
-    }
-  }
-
-  @Test public void testSignedParameters() throws Exception {
-    final String tableName = "signedParameters";
-    try (Connection conn = getLocalConnection();
-        Statement stmt = conn.createStatement()) {
-      assertFalse(stmt.execute("DROP TABLE IF EXISTS " + tableName));
-      String sql = "CREATE TABLE " + tableName + " (keycolumn VARCHAR(5), column1 integer)";
-      assertFalse(stmt.execute(sql));
-
-      // Insert a single decimal
-      try (PreparedStatement pstmt = conn.prepareStatement("INSERT INTO " + tableName
-          + " values (?, ?)")) {
-        ParameterMetaData metadata = pstmt.getParameterMetaData();
-        assertNotNull(metadata);
-        assertFalse("Varchar should not be signed", metadata.isSigned(1));
-        assertTrue("Integer should be signed", metadata.isSigned(2));
-
-        pstmt.setString(1, "asdfg");
-        pstmt.setInt(2, 10);
-        assertEquals(1, pstmt.executeUpdate());
-      }
-
-      ResultSet results = stmt.executeQuery("SELECT * FROM " + tableName);
-      assertNotNull(results);
-      assertTrue(results.next());
-      assertEquals("asdfg", results.getString(1));
-      assertEquals(10, results.getInt(2));
-
-      ResultSetMetaData resultMetadata = results.getMetaData();
-      assertNotNull(resultMetadata);
-      assertFalse("Varchar should not be signed", resultMetadata.isSigned(1));
-      assertTrue("Integer should be signed", resultMetadata.isSigned(2));
-    }
-  }
-
-  @Test public void testDateParameterWithGMT0() throws Exception {
-    final String tableName = "dateParameters";
-    try (Connection conn = getLocalConnection();
-         Statement stmt = conn.createStatement()) {
-      assertFalse(stmt.execute("DROP TABLE IF EXISTS " + tableName));
-      String sql = "CREATE TABLE " + tableName + " (keycolumn VARCHAR(5), column1 date)";
-      assertFalse(stmt.execute(sql));
-      TimeZone tzUtc = TimeZone.getTimeZone("UTC");
-      Calendar cUtc = Calendar.getInstance(tzUtc, Locale.ROOT);
-      cUtc.set(Calendar.YEAR, 1970);
-      cUtc.set(Calendar.MONTH, Calendar.JANUARY);
-      cUtc.set(Calendar.DAY_OF_MONTH, 1);
-      cUtc.set(Calendar.HOUR_OF_DAY, 0);
-      cUtc.set(Calendar.MINUTE, 0);
-      cUtc.set(Calendar.SECOND, 0);
-      cUtc.set(Calendar.MILLISECOND, 0);
-      Date inputDate = new Date(cUtc.getTimeInMillis());
-      // Insert a single date
-      try (PreparedStatement pstmt = conn.prepareStatement("INSERT INTO " + tableName
-              + " values (?, ?)")) {
-        ParameterMetaData metadata = pstmt.getParameterMetaData();
-        assertNotNull(metadata);
-
-        pstmt.setString(1, "asdfg");
-        pstmt.setDate(2, inputDate, cUtc);
-        assertEquals(1, pstmt.executeUpdate());
-      }
-
-      ResultSet results = stmt.executeQuery("SELECT * FROM " + tableName);
-      assertNotNull(results);
-      assertTrue(results.next());
-      assertEquals("asdfg", results.getString(1));
-      Date outputDate = results.getDate(2, cUtc);
-      assertEquals(inputDate.getTime(), outputDate.getTime());
-      assertEquals(0, outputDate.getTime());
-    }
-  }
-
-  @Test public void testDateParameterWithGMTN() throws Exception {
-    final String tableName = "dateParameters";
-    try (Connection conn = getLocalConnection();
-         Statement stmt = conn.createStatement()) {
-      assertFalse(stmt.execute("DROP TABLE IF EXISTS " + tableName));
-      String sql = "CREATE TABLE " + tableName + " (keycolumn VARCHAR(5), column1 date)";
-      assertFalse(stmt.execute(sql));
-      TimeZone tzUtc = TimeZone.getTimeZone("GMT+8");
-      Calendar cUtc = Calendar.getInstance(tzUtc, Locale.ROOT);
-      cUtc.set(Calendar.YEAR, 1970);
-      cUtc.set(Calendar.MONTH, Calendar.JANUARY);
-      cUtc.set(Calendar.DAY_OF_MONTH, 1);
-      cUtc.set(Calendar.HOUR_OF_DAY, 0);
-      cUtc.set(Calendar.MINUTE, 0);
-      cUtc.set(Calendar.SECOND, 0);
-      cUtc.set(Calendar.MILLISECOND, 0);
-      Date inputDate = new Date(cUtc.getTimeInMillis());
-      // Insert a single date
-      try (PreparedStatement pstmt = conn.prepareStatement("INSERT INTO " + tableName
-              + " values (?, ?)")) {
-        ParameterMetaData metadata = pstmt.getParameterMetaData();
-        assertNotNull(metadata);
-
-        pstmt.setString(1, "gfdsa");
-        pstmt.setDate(2, inputDate, cUtc);
-        assertEquals(1, pstmt.executeUpdate());
-      }
-
-      ResultSet results = stmt.executeQuery("SELECT * FROM " + tableName);
-      assertNotNull(results);
-      assertTrue(results.next());
-      assertEquals("gfdsa", results.getString(1));
-      Date outputDate = results.getDate(2, cUtc);
-      assertEquals(inputDate.getTime(), outputDate.getTime());
-      assertEquals(-28800000, outputDate.getTime());
-    }
-  }
-
-  /**
-   * Factory that creates a service based on a local JDBC connection.
-   */
-  public static class LocalJdbcServiceFactory implements Service.Factory {
-    @Override public Service create(AvaticaConnection connection) {
-      try {
-        return new LocalService(
-            new JdbcMeta(CONNECTION_SPEC.url, CONNECTION_SPEC.username,
-                CONNECTION_SPEC.password));
-      } catch (SQLException e) {
-        throw new RuntimeException(e);
-      }
-    }
-  }
-
-  /**
-   * Factory that creates a fully-local Protobuf service.
-   */
-  public static class QuasiRemotePBJdbcServiceFactory implements Service.Factory {
-    private static Service service;
-
-    private static RequestInspection requestInspection;
-
-    static void initService() {
-      try {
-        final JdbcMeta jdbcMeta = new JdbcMeta(CONNECTION_SPEC.url,
-            CONNECTION_SPEC.username, CONNECTION_SPEC.password);
-        final LocalService localService = new LocalService(jdbcMeta);
-        service = new LoggingLocalProtobufService(localService, new ProtobufTranslationImpl());
-        requestInspection = (RequestInspection) service;
-      } catch (SQLException e) {
-        throw new RuntimeException(e);
-      }
-    }
-
-    @Override public Service create(AvaticaConnection connection) {
-      assert null != service;
-      return service;
-    }
-  }
-
-  /**
-   * Proxy that logs all requests passed into the {@link LocalProtobufService}.
-   */
-  public static class LoggingLocalProtobufService extends LocalProtobufService
-      implements RequestInspection {
-    private static final ThreadLocal<RequestLogger> THREAD_LOG =
-        new ThreadLocal<RequestLogger>() {
-          @Override protected RequestLogger initialValue() {
-            return new RequestLogger();
-          }
-        };
-
-    public LoggingLocalProtobufService(Service service, ProtobufTranslation translation) {
-      super(service, translation);
-    }
-
-    @Override public RequestLogger getRequestLogger() {
-      return THREAD_LOG.get();
-    }
-
-    @Override public Response _apply(Request request) {
-      final RequestLogger logger = THREAD_LOG.get();
-      try {
-        String jsonRequest = JsonService.MAPPER.writeValueAsString(request);
-        logger.requestStart(jsonRequest);
-
-        Response response = super._apply(request);
-
-        String jsonResponse = JsonService.MAPPER.writeValueAsString(response);
-        logger.requestEnd(jsonRequest, jsonResponse);
-
-        return response;
-      } catch (Exception e) {
-        throw new RuntimeException(e);
-      }
-    }
-  }
-
-  /**
-   * Factory that creates a service based on a local JDBC connection.
-   */
-  public static class QuasiRemoteJdbcServiceFactory implements Service.Factory {
-
-    /** a singleton instance that is recreated for each test */
-    private static Service service;
-
-    private static RequestInspection requestInspection;
-
-    static void initService() {
-      try {
-        final JdbcMeta jdbcMeta = new JdbcMeta(CONNECTION_SPEC.url,
-            CONNECTION_SPEC.username, CONNECTION_SPEC.password);
-        final LocalService localService = new LocalService(jdbcMeta);
-        service = new LoggingLocalJsonService(localService);
-        requestInspection = (RequestInspection) service;
-      } catch (SQLException e) {
-        throw new RuntimeException(e);
-      }
-    }
-
-    @Override public Service create(AvaticaConnection connection) {
-      assert service != null;
-      return service;
-    }
-  }
-
-  /**
-   * Implementation that reaches into current connection state via reflection to extract certain
-   * internal information.
-   */
-  public static class QuasiRemoteJdbcServiceInternals implements ConnectionInternals {
-
-    @Override public Cache<Integer, Object>
-    getRemoteStatementMap(AvaticaConnection connection) throws Exception {
-      Field metaF = AvaticaConnection.class.getDeclaredField("meta");
-      metaF.setAccessible(true);
-      Meta clientMeta = (Meta) metaF.get(connection);
-      Field remoteMetaServiceF = clientMeta.getClass().getDeclaredField("service");
-      remoteMetaServiceF.setAccessible(true);
-      LocalJsonService remoteMetaService = (LocalJsonService) remoteMetaServiceF.get(clientMeta);
-      // Use the explicitly class to avoid issues with LoggingLocalJsonService
-      Field remoteMetaServiceServiceF = LocalJsonService.class.getDeclaredField("service");
-      remoteMetaServiceServiceF.setAccessible(true);
-      LocalService remoteMetaServiceService =
-          (LocalService) remoteMetaServiceServiceF.get(remoteMetaService);
-      Field remoteMetaServiceServiceMetaF =
-          remoteMetaServiceService.getClass().getDeclaredField("meta");
-      remoteMetaServiceServiceMetaF.setAccessible(true);
-      JdbcMeta serverMeta = (JdbcMeta) remoteMetaServiceServiceMetaF.get(remoteMetaServiceService);
-      Field jdbcMetaStatementMapF = JdbcMeta.class.getDeclaredField("statementCache");
-      jdbcMetaStatementMapF.setAccessible(true);
-      //noinspection unchecked
-      @SuppressWarnings("unchecked")
-      Cache<Integer, Object> cache = (Cache<Integer, Object>) jdbcMetaStatementMapF.get(serverMeta);
-      return cache;
-    }
-
-    @Override public Cache<String, Connection>
-    getRemoteConnectionMap(AvaticaConnection connection) throws Exception {
-      Field metaF = AvaticaConnection.class.getDeclaredField("meta");
-      metaF.setAccessible(true);
-      Meta clientMeta = (Meta) metaF.get(connection);
-      Field remoteMetaServiceF = clientMeta.getClass().getDeclaredField("service");
-      remoteMetaServiceF.setAccessible(true);
-      LocalJsonService remoteMetaService = (LocalJsonService) remoteMetaServiceF.get(clientMeta);
-      // Get the field explicitly off the correct class to avoid LocalLoggingJsonService.class
-      Field remoteMetaServiceServiceF = LocalJsonService.class.getDeclaredField("service");
-      remoteMetaServiceServiceF.setAccessible(true);
-      LocalService remoteMetaServiceService =
-          (LocalService) remoteMetaServiceServiceF.get(remoteMetaService);
-      Field remoteMetaServiceServiceMetaF =
-          remoteMetaServiceService.getClass().getDeclaredField("meta");
-      remoteMetaServiceServiceMetaF.setAccessible(true);
-      JdbcMeta serverMeta = (JdbcMeta) remoteMetaServiceServiceMetaF.get(remoteMetaServiceService);
-      Field jdbcMetaConnectionCacheF = JdbcMeta.class.getDeclaredField("connectionCache");
-      jdbcMetaConnectionCacheF.setAccessible(true);
-      //noinspection unchecked
-      @SuppressWarnings("unchecked")
-      Cache<String, Connection> cache =
-          (Cache<String, Connection>) jdbcMetaConnectionCacheF.get(serverMeta);
-      return cache;
-    }
-  }
-
-  /**
-   * Implementation that reaches into current connection state via reflection to extract certain
-   * internal information.
-   */
-  public static class QuasiRemoteProtobufJdbcServiceInternals implements ConnectionInternals {
-
-    @Override public Cache<Integer, Object>
-    getRemoteStatementMap(AvaticaConnection connection) throws Exception {
-      Field metaF = AvaticaConnection.class.getDeclaredField("meta");
-      metaF.setAccessible(true);
-      Meta clientMeta = (Meta) metaF.get(connection);
-      Field remoteMetaServiceF = clientMeta.getClass().getDeclaredField("service");
-      remoteMetaServiceF.setAccessible(true);
-      LocalProtobufService remoteMetaService =
-          (LocalProtobufService) remoteMetaServiceF.get(clientMeta);
-      // Use the explicitly class to avoid issues with LoggingLocalJsonService
-      Field remoteMetaServiceServiceF = LocalProtobufService.class.getDeclaredField("service");
-      remoteMetaServiceServiceF.setAccessible(true);
-      LocalService remoteMetaServiceService =
-          (LocalService) remoteMetaServiceServiceF.get(remoteMetaService);
-      Field remoteMetaServiceServiceMetaF =
-          remoteMetaServiceService.getClass().getDeclaredField("meta");
-      remoteMetaServiceServiceMetaF.setAccessible(true);
-      JdbcMeta serverMeta = (JdbcMeta) remoteMetaServiceServiceMetaF.get(remoteMetaServiceService);
-      Field jdbcMetaStatementMapF = JdbcMeta.class.getDeclaredField("statementCache");
-      jdbcMetaStatementMapF.setAccessible(true);
-      //noinspection unchecked
-      @SuppressWarnings("unchecked")
-      Cache<Integer, Object> cache = (Cache<Integer, Object>) jdbcMetaStatementMapF.get(serverMeta);
-      return cache;
-    }
-
-    @Override public Cache<String, Connection>
-    getRemoteConnectionMap(AvaticaConnection connection) throws Exception {
-      Field metaF = AvaticaConnection.class.getDeclaredField("meta");
-      metaF.setAccessible(true);
-      Meta clientMeta = (Meta) metaF.get(connection);
-      Field remoteMetaServiceF = clientMeta.getClass().getDeclaredField("service");
-      remoteMetaServiceF.setAccessible(true);
-      LocalProtobufService remoteMetaService =
-          (LocalProtobufService) remoteMetaServiceF.get(clientMeta);
-      // Get the field explicitly off the correct class to avoid LocalLoggingJsonService.class
-      Field remoteMetaServiceServiceF = LocalProtobufService.class.getDeclaredField("service");
-      remoteMetaServiceServiceF.setAccessible(true);
-      LocalService remoteMetaServiceService =
-          (LocalService) remoteMetaServiceServiceF.get(remoteMetaService);
-      Field remoteMetaServiceServiceMetaF =
-          remoteMetaServiceService.getClass().getDeclaredField("meta");
-      remoteMetaServiceServiceMetaF.setAccessible(true);
-      JdbcMeta serverMeta = (JdbcMeta) remoteMetaServiceServiceMetaF.get(remoteMetaServiceService);
-      Field jdbcMetaConnectionCacheF = JdbcMeta.class.getDeclaredField("connectionCache");
-      jdbcMetaConnectionCacheF.setAccessible(true);
-      //noinspection unchecked
-      @SuppressWarnings("unchecked")
-      Cache<String, Connection> cache =
-          (Cache<String, Connection>) jdbcMetaConnectionCacheF.get(serverMeta);
-      return cache;
-    }
-  }
-
-  /**
-   * Provides access to a log of requests.
-   */
-  interface RequestInspection {
-    RequestLogger getRequestLogger();
-  }
-
-  /** Extension to {@link LocalJsonService} that writes requests and responses
-   * into a thread-local. */
-  private static class LoggingLocalJsonService extends LocalJsonService
-      implements RequestInspection {
-    private static final ThreadLocal<RequestLogger> THREAD_LOG =
-        new ThreadLocal<RequestLogger>() {
-          @Override protected RequestLogger initialValue() {
-            return new RequestLogger();
-          }
-        };
-
-    public LoggingLocalJsonService(LocalService localService) {
-      super(localService);
-    }
-
-    @Override public String apply(String request) {
-      final RequestLogger logger = THREAD_LOG.get();
-      logger.requestStart(request);
-      final String response = super.apply(request);
-      logger.requestEnd(request, response);
-      return response;
-    }
-
-    @Override public RequestLogger getRequestLogger() {
-      return THREAD_LOG.get();
-    }
-  }
-
-  /** Logs request and response strings if enabled. */
-  private static class RequestLogger {
-    final List<String[]> requestResponses = new ArrayList<>();
-    boolean enabled;
-
-    void enableAndClear() {
-      enabled = true;
-      requestResponses.clear();
-    }
-
-    void requestStart(String request) {
-      if (enabled) {
-        requestResponses.add(new String[]{request, null});
-      }
-    }
-
-    void requestEnd(String request, String response) {
-      if (enabled) {
-        String[] last = requestResponses.get(requestResponses.size() - 1);
-        if (!request.equals(last[0])) {
-          throw new AssertionError();
-        }
-        last[1] = response;
-      }
-    }
-
-    List<String[]> getAndDisable() {
-      enabled = false;
-      return new ArrayList<>(requestResponses);
-    }
-  }
-}
-
-// End RemoteDriverTest.java


[43/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/UnregisteredDriver.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/UnregisteredDriver.java b/avatica/core/src/main/java/org/apache/calcite/avatica/UnregisteredDriver.java
deleted file mode 100644
index 4118fd7..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/UnregisteredDriver.java
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.DriverPropertyInfo;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Implementation of JDBC driver that does not register itself.
- *
- * <p>You can easily create a "vanity driver" that recognizes its own
- * URL prefix as a sub-class of this class. Per the JDBC specification it
- * must register itself when the class is loaded.</p>
- *
- * <p>Derived classes must implement {@link #createDriverVersion()} and
- * {@link #getConnectStringPrefix()}, and may override
- * {@link #createFactory()}.</p>
- *
- * <p>The provider must implement:</p>
- * <ul>
- *   <li>{@link Meta#prepare(Meta.ConnectionHandle, String, long)}
- *   <li>{@link Meta#createIterable(org.apache.calcite.avatica.Meta.StatementHandle, org.apache.calcite.avatica.QueryState, org.apache.calcite.avatica.Meta.Signature, java.util.List, Meta.Frame)}
- * </ul>
- */
-public abstract class UnregisteredDriver implements java.sql.Driver {
-  final DriverVersion version;
-  protected final AvaticaFactory factory;
-  public final Handler handler;
-
-  protected UnregisteredDriver() {
-    this.factory = createFactory();
-    this.version = createDriverVersion();
-    this.handler = createHandler();
-  }
-
-  /**
-   * Creates a factory for JDBC objects (connection, statement).
-   * Called from the driver constructor.
-   *
-   * <p>The default implementation calls {@link JdbcVersion#current},
-   * then {@link #getFactoryClassName} with that version,
-   * then passes that class name to {@link #instantiateFactory(String)}.
-   * This approach is recommended it does not include in the code references
-   * to classes that may not be instantiable in all JDK versions.
-   * But drivers are free to do it their own way.</p>
-   *
-   * @return JDBC object factory
-   */
-  protected AvaticaFactory createFactory() {
-    return instantiateFactory(getFactoryClassName(JdbcVersion.current()));
-  }
-
-  /** Creates a Handler. */
-  protected Handler createHandler() {
-    return new HandlerImpl();
-  }
-
-  /**
-   * Returns the name of a class to be factory for JDBC objects
-   * (connection, statement) appropriate for the current JDBC version.
-   */
-  protected String getFactoryClassName(JdbcVersion jdbcVersion) {
-    switch (jdbcVersion) {
-    case JDBC_30:
-    case JDBC_40:
-      throw new IllegalArgumentException("JDBC version not supported: "
-          + jdbcVersion);
-    case JDBC_41:
-    default:
-      return "org.apache.calcite.avatica.AvaticaJdbc41Factory";
-    }
-  }
-
-  /**
-   * Creates an object describing the name and version of this driver.
-   * Called from the driver constructor.
-   */
-  protected abstract DriverVersion createDriverVersion();
-
-  /**
-   * Returns the connection properties supported by this driver.
-   */
-  protected Collection<ConnectionProperty> getConnectionProperties() {
-    return Arrays.<ConnectionProperty>asList(
-        BuiltInConnectionProperty.values());
-  }
-
-  /** Helper method for creating factories. */
-  protected static AvaticaFactory instantiateFactory(String factoryClassName) {
-    try {
-      final Class<?> clazz = Class.forName(factoryClassName);
-      return (AvaticaFactory) clazz.getConstructor().newInstance();
-    } catch (Throwable e) {
-      // It is not usually good to catch Throwable. But class loading can fail
-      // with serious errors such as java.lang.NoClassDefFoundError
-      throw handle("Error loading factory " + factoryClassName, e);
-    }
-  }
-
-  private static RuntimeException handle(String msg, Throwable e) {
-    Logger.getLogger("").log(Level.SEVERE, msg, e);
-    throw new RuntimeException(msg, e);
-  }
-
-  public Connection connect(String url, Properties info) throws SQLException {
-    if (!acceptsURL(url)) {
-      return null;
-    }
-    final String prefix = getConnectStringPrefix();
-    assert url.startsWith(prefix);
-    final String urlSuffix = url.substring(prefix.length());
-    final Properties info2 = ConnectStringParser.parse(urlSuffix, info);
-    final AvaticaConnection connection =
-        factory.newConnection(this, factory, url, info2);
-    handler.onConnectionInit(connection);
-    return connection;
-  }
-
-  public boolean acceptsURL(String url) throws SQLException {
-    return url.startsWith(getConnectStringPrefix());
-  }
-
-  /** Returns the prefix of the connect string that this driver will recognize
-   * as its own. For example, "jdbc:calcite:". */
-  protected abstract String getConnectStringPrefix();
-
-  public DriverPropertyInfo[] getPropertyInfo(
-      String url, Properties info) throws SQLException {
-    List<DriverPropertyInfo> list = new ArrayList<DriverPropertyInfo>();
-
-    // First, add the contents of info
-    for (Map.Entry<Object, Object> entry : info.entrySet()) {
-      list.add(
-          new DriverPropertyInfo(
-              (String) entry.getKey(),
-              (String) entry.getValue()));
-    }
-    // Next, add property definitions not mentioned in info
-    for (ConnectionProperty p : getConnectionProperties()) {
-      if (info.containsKey(p.name())) {
-        continue;
-      }
-      list.add(new DriverPropertyInfo(p.name(), null));
-    }
-    return list.toArray(new DriverPropertyInfo[list.size()]);
-  }
-
-  // JDBC 4.1 support (JDK 1.7 and higher)
-  public Logger getParentLogger() {
-    return Logger.getLogger("");
-  }
-
-  /**
-   * Returns the driver version object. Not in the JDBC API.
-   *
-   * @return Driver version
-   */
-  public DriverVersion getDriverVersion() {
-    return version;
-  }
-
-  public final int getMajorVersion() {
-    return version.majorVersion;
-  }
-
-  public final int getMinorVersion() {
-    return version.minorVersion;
-  }
-
-  public boolean jdbcCompliant() {
-    return version.jdbcCompliant;
-  }
-
-  /**
-   * Registers this driver with the driver manager.
-   */
-  protected void register() {
-    try {
-      DriverManager.registerDriver(this);
-    } catch (SQLException e) {
-      System.out.println(
-          "Error occurred while registering JDBC driver "
-          + this + ": " + e.toString());
-    }
-  }
-
-  /** Creates a service handler that will give connections from this Driver
-   * their behavior. */
-  public abstract Meta createMeta(AvaticaConnection connection);
-
-  /** JDBC version. */
-  protected enum JdbcVersion {
-    /** Unknown JDBC version. */
-    JDBC_UNKNOWN,
-    /** JDBC version 3.0. Generally associated with JDK 1.5. */
-    JDBC_30,
-    /** JDBC version 4.0. Generally associated with JDK 1.6. */
-    JDBC_40,
-    /** JDBC version 4.1. Generally associated with JDK 1.7. */
-    JDBC_41;
-
-    /** Deduces the current JDBC version. */
-    public static JdbcVersion current() {
-      try {
-        // If java.sql.PseudoColumnUsage is present, we are running JDBC
-        // 4.1 or later.
-        Class.forName("java.sql.PseudoColumnUsage");
-        return JDBC_41;
-      } catch (ClassNotFoundException e) {
-        // java.sql.PseudoColumnUsage is not present. This means we are
-        // running JDBC 4.0 or earlier.
-        try {
-          Class.forName("java.sql.Wrapper");
-          return JDBC_40;
-        } catch (ClassNotFoundException e2) {
-          // java.sql.Wrapper is not present. This means we are
-          // running JDBC 3.0 or earlier (probably JDK 1.5).
-          return JDBC_30;
-        }
-      }
-    }
-  }
-}
-
-// End UnregisteredDriver.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/package-info.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/package-info.java b/avatica/core/src/main/java/org/apache/calcite/avatica/package-info.java
deleted file mode 100644
index 89a9fbb..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/package-info.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * Avatica JDBC framework.
- */
-@PackageMarker
-package org.apache.calcite.avatica;
-
-import org.apache.calcite.avatica.util.PackageMarker;
-
-// End package-info.java


[10/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumUtils.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumUtils.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumUtils.java
deleted file mode 100644
index 60408c6..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumUtils.java
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.adapter.java.JavaTypeFactory;
-import org.apache.calcite.linq4j.Ord;
-import org.apache.calcite.linq4j.function.Function2;
-import org.apache.calcite.linq4j.tree.BlockStatement;
-import org.apache.calcite.linq4j.tree.ConstantUntypedNull;
-import org.apache.calcite.linq4j.tree.Expression;
-import org.apache.calcite.linq4j.tree.Expressions;
-import org.apache.calcite.linq4j.tree.MethodDeclaration;
-import org.apache.calcite.linq4j.tree.ParameterExpression;
-import org.apache.calcite.linq4j.tree.Primitive;
-import org.apache.calcite.rel.core.JoinRelType;
-import org.apache.calcite.rel.type.RelDataType;
-import org.apache.calcite.rel.type.RelDataTypeField;
-import org.apache.calcite.rex.RexNode;
-import org.apache.calcite.util.BuiltInMethod;
-
-import com.google.common.base.Function;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.lang.reflect.Type;
-import java.util.AbstractList;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Utilities for generating programs in the Enumerable (functional)
- * style.
- */
-public class EnumUtils {
-
-  private static final Function<RexNode, Type> REX_TO_INTERNAL_TYPE =
-      new Function<RexNode, Type>() {
-        public Type apply(RexNode node) {
-          return toInternal(node.getType());
-        }
-      };
-
-  private EnumUtils() {}
-
-  static final boolean BRIDGE_METHODS = true;
-
-  static final List<ParameterExpression> NO_PARAMS =
-      ImmutableList.of();
-
-  static final List<Expression> NO_EXPRS =
-      ImmutableList.of();
-
-  public static final List<String> LEFT_RIGHT =
-      ImmutableList.of("left", "right");
-
-  /** Declares a method that overrides another method. */
-  public static MethodDeclaration overridingMethodDecl(Method method,
-      Iterable<ParameterExpression> parameters,
-      BlockStatement body) {
-    return Expressions.methodDecl(
-        method.getModifiers() & ~Modifier.ABSTRACT,
-        method.getReturnType(),
-        method.getName(),
-        parameters,
-        body);
-  }
-
-  static Type javaClass(
-      JavaTypeFactory typeFactory, RelDataType type) {
-    final Type clazz = typeFactory.getJavaClass(type);
-    return clazz instanceof Class ? clazz : Object[].class;
-  }
-
-  static Class javaRowClass(
-      JavaTypeFactory typeFactory, RelDataType type) {
-    if (type.isStruct() && type.getFieldCount() == 1) {
-      type = type.getFieldList().get(0).getType();
-    }
-    final Type clazz = typeFactory.getJavaClass(type);
-    return clazz instanceof Class ? (Class) clazz : Object[].class;
-  }
-
-  static List<Type> fieldTypes(
-      final JavaTypeFactory typeFactory,
-      final List<? extends RelDataType> inputTypes) {
-    return new AbstractList<Type>() {
-      public Type get(int index) {
-        return EnumUtils.javaClass(typeFactory, inputTypes.get(index));
-      }
-      public int size() {
-        return inputTypes.size();
-      }
-    };
-  }
-
-  static List<RelDataType> fieldRowTypes(
-      final RelDataType inputRowType,
-      final List<? extends RexNode> extraInputs,
-      final List<Integer> argList) {
-    final List<RelDataTypeField> inputFields = inputRowType.getFieldList();
-    return new AbstractList<RelDataType>() {
-      public RelDataType get(int index) {
-        final int arg = argList.get(index);
-        return arg < inputFields.size()
-            ? inputFields.get(arg).getType()
-            : extraInputs.get(arg - inputFields.size()).getType();
-      }
-      public int size() {
-        return argList.size();
-      }
-    };
-  }
-
-  static Expression joinSelector(JoinRelType joinType, PhysType physType,
-      List<PhysType> inputPhysTypes) {
-    // A parameter for each input.
-    final List<ParameterExpression> parameters = new ArrayList<>();
-
-    // Generate all fields.
-    final List<Expression> expressions = new ArrayList<>();
-    final int outputFieldCount = physType.getRowType().getFieldCount();
-    for (Ord<PhysType> ord : Ord.zip(inputPhysTypes)) {
-      final PhysType inputPhysType =
-          ord.e.makeNullable(joinType.generatesNullsOn(ord.i));
-      // If input item is just a primitive, we do not generate specialized
-      // primitive apply override since it won't be called anyway
-      // Function<T> always operates on boxed arguments
-      final ParameterExpression parameter =
-          Expressions.parameter(Primitive.box(inputPhysType.getJavaRowType()),
-              EnumUtils.LEFT_RIGHT.get(ord.i));
-      parameters.add(parameter);
-      if (expressions.size() == outputFieldCount) {
-        // For instance, if semi-join needs to return just the left inputs
-        break;
-      }
-      final int fieldCount = inputPhysType.getRowType().getFieldCount();
-      for (int i = 0; i < fieldCount; i++) {
-        Expression expression =
-            inputPhysType.fieldReference(parameter, i,
-                physType.getJavaFieldType(expressions.size()));
-        if (joinType.generatesNullsOn(ord.i)) {
-          expression =
-              Expressions.condition(
-                  Expressions.equal(parameter, Expressions.constant(null)),
-                  Expressions.constant(null),
-                  expression);
-        }
-        expressions.add(expression);
-      }
-    }
-    return Expressions.lambda(
-        Function2.class,
-        physType.record(expressions),
-        parameters);
-  }
-
-  /** Converts from internal representation to JDBC representation used by
-   * arguments of user-defined functions. For example, converts date values from
-   * {@code int} to {@link java.sql.Date}. */
-  static Expression fromInternal(Expression e, Class<?> targetType) {
-    if (e == ConstantUntypedNull.INSTANCE) {
-      return e;
-    }
-    if (!(e.getType() instanceof Class)) {
-      return e;
-    }
-    if (targetType.isAssignableFrom((Class) e.getType())) {
-      return e;
-    }
-    if (targetType == java.sql.Date.class) {
-      return Expressions.call(BuiltInMethod.INTERNAL_TO_DATE.method, e);
-    }
-    if (targetType == java.sql.Time.class) {
-      return Expressions.call(BuiltInMethod.INTERNAL_TO_TIME.method, e);
-    }
-    if (targetType == java.sql.Timestamp.class) {
-      return Expressions.call(BuiltInMethod.INTERNAL_TO_TIMESTAMP.method, e);
-    }
-    if (Primitive.is(e.type)
-        && Primitive.isBox(targetType)) {
-      // E.g. e is "int", target is "Long", generate "(long) e".
-      return Expressions.convert_(e,
-          Primitive.ofBox(targetType).primitiveClass);
-    }
-    return e;
-  }
-
-  static List<Expression> fromInternal(Class<?>[] targetTypes,
-      List<Expression> expressions) {
-    final List<Expression> list = new ArrayList<>();
-    for (int i = 0; i < expressions.size(); i++) {
-      list.add(fromInternal(expressions.get(i), targetTypes[i]));
-    }
-    return list;
-  }
-
-  static Type fromInternal(Type type) {
-    if (type == java.sql.Date.class || type == java.sql.Time.class) {
-      return int.class;
-    }
-    if (type == java.sql.Timestamp.class) {
-      return long.class;
-    }
-    return type;
-  }
-
-  static Type toInternal(RelDataType type) {
-    switch (type.getSqlTypeName()) {
-    case DATE:
-    case TIME:
-      return type.isNullable() ? Integer.class : int.class;
-    case TIMESTAMP:
-      return type.isNullable() ? Long.class : long.class;
-    default:
-      return null; // we don't care; use the default storage type
-    }
-  }
-
-  static List<Type> internalTypes(List<? extends RexNode> operandList) {
-    return Lists.transform(operandList, REX_TO_INTERNAL_TYPE);
-  }
-
-  static Expression enforce(final Type storageType,
-      final Expression e) {
-    if (storageType != null && e.type != storageType) {
-      if (e.type == java.sql.Date.class) {
-        if (storageType == int.class) {
-          return Expressions.call(BuiltInMethod.DATE_TO_INT.method, e);
-        }
-        if (storageType == Integer.class) {
-          return Expressions.call(BuiltInMethod.DATE_TO_INT_OPTIONAL.method, e);
-        }
-      } else if (e.type == java.sql.Time.class) {
-        if (storageType == int.class) {
-          return Expressions.call(BuiltInMethod.TIME_TO_INT.method, e);
-        }
-        if (storageType == Integer.class) {
-          return Expressions.call(BuiltInMethod.TIME_TO_INT_OPTIONAL.method, e);
-        }
-      } else if (e.type == java.sql.Timestamp.class) {
-        if (storageType == long.class) {
-          return Expressions.call(BuiltInMethod.TIMESTAMP_TO_LONG.method, e);
-        }
-        if (storageType == Long.class) {
-          return Expressions.call(BuiltInMethod.TIMESTAMP_TO_LONG_OPTIONAL.method, e);
-        }
-      }
-    }
-    return e;
-  }
-}
-
-// End EnumUtils.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableAggregate.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableAggregate.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableAggregate.java
deleted file mode 100644
index c6b74e2..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableAggregate.java
+++ /dev/null
@@ -1,468 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.adapter.enumerable.impl.AggAddContextImpl;
-import org.apache.calcite.adapter.enumerable.impl.AggResultContextImpl;
-import org.apache.calcite.adapter.java.JavaTypeFactory;
-import org.apache.calcite.jdbc.JavaTypeFactoryImpl;
-import org.apache.calcite.linq4j.Ord;
-import org.apache.calcite.linq4j.function.Function0;
-import org.apache.calcite.linq4j.function.Function1;
-import org.apache.calcite.linq4j.function.Function2;
-import org.apache.calcite.linq4j.tree.BlockBuilder;
-import org.apache.calcite.linq4j.tree.Expression;
-import org.apache.calcite.linq4j.tree.Expressions;
-import org.apache.calcite.linq4j.tree.ParameterExpression;
-import org.apache.calcite.linq4j.tree.Types;
-import org.apache.calcite.plan.RelOptCluster;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.prepare.CalcitePrepareImpl;
-import org.apache.calcite.rel.InvalidRelException;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.core.Aggregate;
-import org.apache.calcite.rel.core.AggregateCall;
-import org.apache.calcite.rel.type.RelDataType;
-import org.apache.calcite.rel.type.RelDataTypeField;
-import org.apache.calcite.rex.RexInputRef;
-import org.apache.calcite.rex.RexNode;
-import org.apache.calcite.sql.SqlAggFunction;
-import org.apache.calcite.util.BuiltInMethod;
-import org.apache.calcite.util.ImmutableBitSet;
-import org.apache.calcite.util.Pair;
-import org.apache.calcite.util.Util;
-
-import com.google.common.collect.Lists;
-
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/** Implementation of {@link org.apache.calcite.rel.core.Aggregate} in
- * {@link org.apache.calcite.adapter.enumerable.EnumerableConvention enumerable calling convention}. */
-public class EnumerableAggregate extends Aggregate implements EnumerableRel {
-  public EnumerableAggregate(
-      RelOptCluster cluster,
-      RelTraitSet traitSet,
-      RelNode child,
-      boolean indicator,
-      ImmutableBitSet groupSet,
-      List<ImmutableBitSet> groupSets,
-      List<AggregateCall> aggCalls)
-      throws InvalidRelException {
-    super(cluster, traitSet, child, indicator, groupSet, groupSets, aggCalls);
-    assert getConvention() instanceof EnumerableConvention;
-
-    for (AggregateCall aggCall : aggCalls) {
-      if (aggCall.isDistinct()) {
-        throw new InvalidRelException(
-            "distinct aggregation not supported");
-      }
-      AggImplementor implementor2 =
-          RexImpTable.INSTANCE.get(aggCall.getAggregation(), false);
-      if (implementor2 == null) {
-        throw new InvalidRelException(
-            "aggregation " + aggCall.getAggregation() + " not supported");
-      }
-    }
-  }
-
-  @Override public EnumerableAggregate copy(RelTraitSet traitSet, RelNode input,
-      boolean indicator, ImmutableBitSet groupSet,
-      List<ImmutableBitSet> groupSets, List<AggregateCall> aggCalls) {
-    try {
-      return new EnumerableAggregate(getCluster(), traitSet, input, indicator,
-          groupSet, groupSets, aggCalls);
-    } catch (InvalidRelException e) {
-      // Semantic error not possible. Must be a bug. Convert to
-      // internal error.
-      throw new AssertionError(e);
-    }
-  }
-
-  public Result implement(EnumerableRelImplementor implementor, Prefer pref) {
-    final JavaTypeFactory typeFactory = implementor.getTypeFactory();
-    final BlockBuilder builder = new BlockBuilder();
-    final EnumerableRel child = (EnumerableRel) getInput();
-    final Result result = implementor.visitChild(this, 0, child, pref);
-    Expression childExp =
-        builder.append(
-            "child",
-            result.block);
-    final RelDataType inputRowType = getInput().getRowType();
-
-    final PhysType physType =
-        PhysTypeImpl.of(
-            typeFactory, getRowType(), pref.preferCustom());
-
-    // final Enumerable<Employee> child = <<child adapter>>;
-    // Function1<Employee, Integer> keySelector =
-    //     new Function1<Employee, Integer>() {
-    //         public Integer apply(Employee a0) {
-    //             return a0.deptno;
-    //         }
-    //     };
-    // Function1<Employee, Object[]> accumulatorInitializer =
-    //     new Function1<Employee, Object[]>() {
-    //         public Object[] apply(Employee a0) {
-    //             return new Object[] {0, 0};
-    //         }
-    //     };
-    // Function2<Object[], Employee, Object[]> accumulatorAdder =
-    //     new Function2<Object[], Employee, Object[]>() {
-    //         public Object[] apply(Object[] a1, Employee a0) {
-    //              a1[0] = ((Integer) a1[0]) + 1;
-    //              a1[1] = ((Integer) a1[1]) + a0.salary;
-    //             return a1;
-    //         }
-    //     };
-    // Function2<Integer, Object[], Object[]> resultSelector =
-    //     new Function2<Integer, Object[], Object[]>() {
-    //         public Object[] apply(Integer a0, Object[] a1) {
-    //             return new Object[] { a0, a1[0], a1[1] };
-    //         }
-    //     };
-    // return childEnumerable
-    //     .groupBy(
-    //        keySelector, accumulatorInitializer, accumulatorAdder,
-    //        resultSelector);
-    //
-    // or, if key has 0 columns,
-    //
-    // return childEnumerable
-    //     .aggregate(
-    //       accumulatorInitializer.apply(),
-    //       accumulatorAdder,
-    //       resultSelector);
-    //
-    // with a slightly different resultSelector; or if there are no aggregate
-    // functions
-    //
-    // final Enumerable<Employee> child = <<child adapter>>;
-    // Function1<Employee, Integer> keySelector =
-    //     new Function1<Employee, Integer>() {
-    //         public Integer apply(Employee a0) {
-    //             return a0.deptno;
-    //         }
-    //     };
-    // EqualityComparer<Employee> equalityComparer =
-    //     new EqualityComparer<Employee>() {
-    //         boolean equal(Employee a0, Employee a1) {
-    //             return a0.deptno;
-    //         }
-    //     };
-    // return child
-    //     .distinct(equalityComparer);
-
-    final PhysType inputPhysType = result.physType;
-
-    ParameterExpression parameter =
-        Expressions.parameter(inputPhysType.getJavaRowType(), "a0");
-
-    final PhysType keyPhysType =
-        inputPhysType.project(groupSet.asList(), getGroupType() != Group.SIMPLE,
-            JavaRowFormat.LIST);
-    final int groupCount = getGroupCount();
-    final int indicatorCount = getIndicatorCount();
-
-    final List<AggImpState> aggs = new ArrayList<>(aggCalls.size());
-    for (Ord<AggregateCall> call : Ord.zip(aggCalls)) {
-      aggs.add(new AggImpState(call.i, call.e, false));
-    }
-
-    // Function0<Object[]> accumulatorInitializer =
-    //     new Function0<Object[]>() {
-    //         public Object[] apply() {
-    //             return new Object[] {0, 0};
-    //         }
-    //     };
-    final List<Expression> initExpressions = new ArrayList<>();
-    final BlockBuilder initBlock = new BlockBuilder();
-
-    final List<Type> aggStateTypes = new ArrayList<>();
-    for (final AggImpState agg : aggs) {
-      agg.context =
-          new AggContext() {
-            public SqlAggFunction aggregation() {
-              return agg.call.getAggregation();
-            }
-
-            public RelDataType returnRelType() {
-              return agg.call.type;
-            }
-
-            public Type returnType() {
-              return EnumUtils.javaClass(typeFactory, returnRelType());
-            }
-
-            public List<? extends RelDataType> parameterRelTypes() {
-              return EnumUtils.fieldRowTypes(inputRowType, null,
-                  agg.call.getArgList());
-            }
-
-            public List<? extends Type> parameterTypes() {
-              return EnumUtils.fieldTypes(typeFactory,
-                  parameterRelTypes());
-            }
-          };
-      List<Type> state =
-          agg.implementor.getStateType(agg.context);
-
-      if (state.isEmpty()) {
-        continue;
-      }
-
-      aggStateTypes.addAll(state);
-
-      final List<Expression> decls = new ArrayList<>(state.size());
-      for (int i = 0; i < state.size(); i++) {
-        String aggName = "a" + agg.aggIdx;
-        if (CalcitePrepareImpl.DEBUG) {
-          aggName = Util.toJavaId(agg.call.getAggregation().getName(), 0)
-              .substring("ID$0$".length()) + aggName;
-        }
-        Type type = state.get(i);
-        ParameterExpression pe =
-            Expressions.parameter(type,
-                initBlock.newName(aggName + "s" + i));
-        initBlock.add(Expressions.declare(0, pe, null));
-        decls.add(pe);
-      }
-      agg.state = decls;
-      initExpressions.addAll(decls);
-      agg.implementor.implementReset(agg.context,
-          new AggResultContextImpl(initBlock, decls));
-    }
-
-    final PhysType accPhysType =
-        PhysTypeImpl.of(
-            typeFactory,
-            typeFactory.createSyntheticType(aggStateTypes));
-
-
-    if (accPhysType.getJavaRowType() instanceof JavaTypeFactoryImpl.SyntheticRecordType) {
-      // We have to initialize the SyntheticRecordType instance this way, to avoid using
-      // class constructor with too many parameters.
-      JavaTypeFactoryImpl.SyntheticRecordType synType =
-        (JavaTypeFactoryImpl.SyntheticRecordType) accPhysType.getJavaRowType();
-      final ParameterExpression record0_ =
-        Expressions.parameter(accPhysType.getJavaRowType(), "record0");
-      initBlock.add(Expressions.declare(0, record0_, null));
-      initBlock.add(
-        Expressions.statement(
-          Expressions.assign(
-            record0_,
-            Expressions.new_(accPhysType.getJavaRowType()))));
-      List<Types.RecordField> fieldList = synType.getRecordFields();
-      for (int i = 0; i < initExpressions.size(); i++) {
-        Expression right = initExpressions.get(i);
-        initBlock.add(
-          Expressions.statement(
-            Expressions.assign(
-              Expressions.field(
-                record0_,
-                fieldList.get(i)),
-              right)));
-      }
-      initBlock.add(record0_);
-    } else {
-      initBlock.add(accPhysType.record(initExpressions));
-    }
-
-    final Expression accumulatorInitializer =
-        builder.append(
-            "accumulatorInitializer",
-            Expressions.lambda(
-                Function0.class,
-                initBlock.toBlock()));
-
-    // Function2<Object[], Employee, Object[]> accumulatorAdder =
-    //     new Function2<Object[], Employee, Object[]>() {
-    //         public Object[] apply(Object[] acc, Employee in) {
-    //              acc[0] = ((Integer) acc[0]) + 1;
-    //              acc[1] = ((Integer) acc[1]) + in.salary;
-    //             return acc;
-    //         }
-    //     };
-    final BlockBuilder builder2 = new BlockBuilder();
-    final ParameterExpression inParameter =
-        Expressions.parameter(inputPhysType.getJavaRowType(), "in");
-    final ParameterExpression acc_ =
-        Expressions.parameter(accPhysType.getJavaRowType(), "acc");
-    for (int i = 0, stateOffset = 0; i < aggs.size(); i++) {
-      final AggImpState agg = aggs.get(i);
-
-      final int stateSize = agg.state.size();
-      final List<Expression> accumulator = new ArrayList<>(stateSize);
-      for (int j = 0; j < stateSize; j++) {
-        accumulator.add(accPhysType.fieldReference(acc_, j + stateOffset));
-      }
-      agg.state = accumulator;
-
-      stateOffset += stateSize;
-
-      AggAddContext addContext =
-          new AggAddContextImpl(builder2, accumulator) {
-            public List<RexNode> rexArguments() {
-              List<RelDataTypeField> inputTypes =
-                  inputPhysType.getRowType().getFieldList();
-              List<RexNode> args = new ArrayList<>();
-              for (int index : agg.call.getArgList()) {
-                args.add(RexInputRef.of(index, inputTypes));
-              }
-              return args;
-            }
-
-            public RexNode rexFilterArgument() {
-              return agg.call.filterArg < 0
-                  ? null
-                  : RexInputRef.of(agg.call.filterArg,
-                      inputPhysType.getRowType());
-            }
-
-            public RexToLixTranslator rowTranslator() {
-              return RexToLixTranslator.forAggregation(typeFactory,
-                  currentBlock(),
-                  new RexToLixTranslator.InputGetterImpl(
-                      Collections.singletonList(
-                          Pair.of((Expression) inParameter, inputPhysType))))
-                  .setNullable(currentNullables());
-            }
-          };
-
-      agg.implementor.implementAdd(agg.context, addContext);
-    }
-    builder2.add(acc_);
-    final Expression accumulatorAdder =
-        builder.append(
-            "accumulatorAdder",
-            Expressions.lambda(
-                Function2.class,
-                builder2.toBlock(),
-                acc_,
-                inParameter));
-
-    // Function2<Integer, Object[], Object[]> resultSelector =
-    //     new Function2<Integer, Object[], Object[]>() {
-    //         public Object[] apply(Integer key, Object[] acc) {
-    //             return new Object[] { key, acc[0], acc[1] };
-    //         }
-    //     };
-    final BlockBuilder resultBlock = new BlockBuilder();
-    final List<Expression> results = Expressions.list();
-    final ParameterExpression key_;
-    if (groupCount == 0) {
-      key_ = null;
-    } else {
-      final Type keyType = keyPhysType.getJavaRowType();
-      key_ = Expressions.parameter(keyType, "key");
-      for (int j = 0; j < groupCount + indicatorCount; j++) {
-        results.add(
-            keyPhysType.fieldReference(key_, j));
-      }
-    }
-    for (final AggImpState agg : aggs) {
-      results.add(
-          agg.implementor.implementResult(agg.context,
-              new AggResultContextImpl(resultBlock, agg.state)));
-    }
-    resultBlock.add(physType.record(results));
-    if (getGroupType() != Group.SIMPLE) {
-      final List<Expression> list = Lists.newArrayList();
-      for (ImmutableBitSet set : groupSets) {
-        list.add(
-            inputPhysType.generateSelector(parameter, groupSet.asList(),
-                set.asList(), keyPhysType.getFormat()));
-      }
-      final Expression keySelectors_ =
-          builder.append("keySelectors",
-              Expressions.call(BuiltInMethod.ARRAYS_AS_LIST.method,
-                  list));
-      final Expression resultSelector =
-          builder.append("resultSelector",
-              Expressions.lambda(Function2.class,
-                  resultBlock.toBlock(),
-                  key_,
-                  acc_));
-      builder.add(
-          Expressions.return_(null,
-              Expressions.call(
-                  BuiltInMethod.GROUP_BY_MULTIPLE.method,
-                  Expressions.list(childExp,
-                      keySelectors_,
-                      accumulatorInitializer,
-                      accumulatorAdder,
-                      resultSelector)
-                      .appendIfNotNull(keyPhysType.comparer()))));
-    } else if (groupCount == 0) {
-      final Expression resultSelector =
-          builder.append(
-              "resultSelector",
-              Expressions.lambda(
-                  Function1.class,
-                  resultBlock.toBlock(),
-                  acc_));
-      builder.add(
-          Expressions.return_(
-              null,
-              Expressions.call(
-                  BuiltInMethod.SINGLETON_ENUMERABLE.method,
-                  Expressions.call(
-                      childExp,
-                      BuiltInMethod.AGGREGATE.method,
-                      Expressions.call(accumulatorInitializer, "apply"),
-                      accumulatorAdder,
-                      resultSelector))));
-    } else if (aggCalls.isEmpty()
-        && groupSet.equals(
-            ImmutableBitSet.range(child.getRowType().getFieldCount()))) {
-      builder.add(
-          Expressions.return_(
-              null,
-              Expressions.call(
-                  inputPhysType.convertTo(childExp, physType),
-                  BuiltInMethod.DISTINCT.method,
-                  Expressions.<Expression>list()
-                      .appendIfNotNull(physType.comparer()))));
-    } else {
-      final Expression keySelector_ =
-          builder.append("keySelector",
-              inputPhysType.generateSelector(parameter,
-                  groupSet.asList(),
-                  keyPhysType.getFormat()));
-      final Expression resultSelector_ =
-          builder.append("resultSelector",
-              Expressions.lambda(Function2.class,
-                  resultBlock.toBlock(),
-                  key_,
-                  acc_));
-      builder.add(
-          Expressions.return_(null,
-              Expressions.call(childExp,
-                  BuiltInMethod.GROUP_BY2.method,
-                  Expressions.list(keySelector_,
-                      accumulatorInitializer,
-                      accumulatorAdder,
-                      resultSelector_)
-                      .appendIfNotNull(keyPhysType.comparer()))));
-    }
-    return implementor.result(physType, builder.toBlock());
-  }
-}
-
-// End EnumerableAggregate.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableAggregateRule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableAggregateRule.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableAggregateRule.java
deleted file mode 100644
index e29b9fc..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableAggregateRule.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.plan.Convention;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.InvalidRelException;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.convert.ConverterRule;
-import org.apache.calcite.rel.logical.LogicalAggregate;
-
-/**
- * Rule to convert a {@link org.apache.calcite.rel.logical.LogicalAggregate}
- * to an {@link EnumerableAggregate}.
- */
-class EnumerableAggregateRule extends ConverterRule {
-  EnumerableAggregateRule() {
-    super(LogicalAggregate.class, Convention.NONE,
-        EnumerableConvention.INSTANCE, "EnumerableAggregateRule");
-  }
-
-  public RelNode convert(RelNode rel) {
-    final LogicalAggregate agg = (LogicalAggregate) rel;
-    final RelTraitSet traitSet =
-        agg.getTraitSet().replace(EnumerableConvention.INSTANCE);
-    try {
-      return new EnumerableAggregate(
-          rel.getCluster(),
-          traitSet,
-          convert(agg.getInput(), EnumerableConvention.INSTANCE),
-          agg.indicator,
-          agg.getGroupSet(),
-          agg.getGroupSets(),
-          agg.getAggCallList());
-    } catch (InvalidRelException e) {
-      EnumerableRules.LOGGER.debug(e.toString());
-      return null;
-    }
-  }
-}
-
-// End EnumerableAggregateRule.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableBindable.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableBindable.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableBindable.java
deleted file mode 100644
index 2ad069e..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableBindable.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.DataContext;
-import org.apache.calcite.interpreter.BindableConvention;
-import org.apache.calcite.interpreter.BindableRel;
-import org.apache.calcite.interpreter.Node;
-import org.apache.calcite.interpreter.Row;
-import org.apache.calcite.interpreter.Sink;
-import org.apache.calcite.linq4j.Enumerable;
-import org.apache.calcite.linq4j.Enumerator;
-import org.apache.calcite.plan.ConventionTraitDef;
-import org.apache.calcite.plan.RelOptCluster;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.convert.ConverterImpl;
-import org.apache.calcite.rel.convert.ConverterRule;
-import org.apache.calcite.runtime.ArrayBindable;
-import org.apache.calcite.runtime.Bindable;
-
-import com.google.common.collect.ImmutableMap;
-
-import java.util.List;
-
-/**
- * Relational expression that converts an enumerable input to interpretable
- * calling convention.
- *
- * @see org.apache.calcite.adapter.enumerable.EnumerableConvention
- * @see org.apache.calcite.interpreter.BindableConvention
- */
-public class EnumerableBindable extends ConverterImpl implements BindableRel {
-  protected EnumerableBindable(RelOptCluster cluster, RelNode input) {
-    super(cluster, ConventionTraitDef.INSTANCE,
-        cluster.traitSetOf(BindableConvention.INSTANCE), input);
-  }
-
-  @Override public EnumerableBindable copy(RelTraitSet traitSet,
-      List<RelNode> inputs) {
-    return new EnumerableBindable(getCluster(), sole(inputs));
-  }
-
-  public Class<Object[]> getElementType() {
-    return Object[].class;
-  }
-
-  public Enumerable<Object[]> bind(DataContext dataContext) {
-    final ImmutableMap<String, Object> map = ImmutableMap.of();
-    final Bindable bindable = EnumerableInterpretable.toBindable(map, null,
-        (EnumerableRel) getInput(), EnumerableRel.Prefer.ARRAY);
-    final ArrayBindable arrayBindable = EnumerableInterpretable.box(bindable);
-    return arrayBindable.bind(dataContext);
-  }
-
-  public Node implement(final InterpreterImplementor implementor) {
-    return new Node() {
-      public void run() throws InterruptedException {
-        final Sink sink =
-            implementor.relSinks.get(EnumerableBindable.this).get(0);
-        final Enumerable<Object[]> enumerable = bind(implementor.dataContext);
-        final Enumerator<Object[]> enumerator = enumerable.enumerator();
-        while (enumerator.moveNext()) {
-          sink.send(Row.asCopy(enumerator.current()));
-        }
-      }
-    };
-  }
-
-  /**
-   * Rule that converts any enumerable relational expression to bindable.
-   */
-  public static class EnumerableToBindableConverterRule extends ConverterRule {
-    public static final EnumerableToBindableConverterRule INSTANCE =
-        new EnumerableToBindableConverterRule();
-
-    private EnumerableToBindableConverterRule() {
-      super(EnumerableRel.class, EnumerableConvention.INSTANCE,
-          BindableConvention.INSTANCE, "EnumerableToBindableConverterRule");
-    }
-
-    @Override public RelNode convert(RelNode rel) {
-      return new EnumerableBindable(rel.getCluster(), rel);
-    }
-  }
-}
-
-// End EnumerableBindable.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableCalc.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableCalc.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableCalc.java
deleted file mode 100644
index a23dcfe..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableCalc.java
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.DataContext;
-import org.apache.calcite.adapter.java.JavaTypeFactory;
-import org.apache.calcite.linq4j.Enumerator;
-import org.apache.calcite.linq4j.tree.BlockBuilder;
-import org.apache.calcite.linq4j.tree.BlockStatement;
-import org.apache.calcite.linq4j.tree.Blocks;
-import org.apache.calcite.linq4j.tree.Expression;
-import org.apache.calcite.linq4j.tree.Expressions;
-import org.apache.calcite.linq4j.tree.MemberDeclaration;
-import org.apache.calcite.linq4j.tree.ParameterExpression;
-import org.apache.calcite.linq4j.tree.Types;
-import org.apache.calcite.plan.RelOptCluster;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.RelCollation;
-import org.apache.calcite.rel.RelCollationTraitDef;
-import org.apache.calcite.rel.RelDistribution;
-import org.apache.calcite.rel.RelDistributionTraitDef;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.core.Calc;
-import org.apache.calcite.rel.metadata.RelMdCollation;
-import org.apache.calcite.rel.metadata.RelMdDistribution;
-import org.apache.calcite.rel.metadata.RelMetadataQuery;
-import org.apache.calcite.rex.RexBuilder;
-import org.apache.calcite.rex.RexProgram;
-import org.apache.calcite.rex.RexSimplify;
-import org.apache.calcite.rex.RexUtil;
-import org.apache.calcite.util.BuiltInMethod;
-import org.apache.calcite.util.Pair;
-import org.apache.calcite.util.Util;
-
-import com.google.common.base.Supplier;
-import com.google.common.collect.ImmutableList;
-
-import java.lang.reflect.Modifier;
-import java.lang.reflect.Type;
-import java.util.Collections;
-import java.util.List;
-
-import static org.apache.calcite.adapter.enumerable.EnumUtils.BRIDGE_METHODS;
-import static org.apache.calcite.adapter.enumerable.EnumUtils.NO_EXPRS;
-import static org.apache.calcite.adapter.enumerable.EnumUtils.NO_PARAMS;
-
-/** Implementation of {@link org.apache.calcite.rel.core.Calc} in
- * {@link org.apache.calcite.adapter.enumerable.EnumerableConvention enumerable calling convention}. */
-public class EnumerableCalc extends Calc implements EnumerableRel {
-  /**
-   * Creates an EnumerableCalc.
-   *
-   * <p>Use {@link #create} unless you know what you're doing.
-   */
-  public EnumerableCalc(RelOptCluster cluster,
-      RelTraitSet traitSet,
-      RelNode input,
-      RexProgram program) {
-    super(cluster, traitSet, input, program);
-    assert getConvention() instanceof EnumerableConvention;
-    assert !program.containsAggs();
-  }
-
-  @Deprecated // to be removed before 2.0
-  public EnumerableCalc(
-      RelOptCluster cluster,
-      RelTraitSet traitSet,
-      RelNode input,
-      RexProgram program,
-      List<RelCollation> collationList) {
-    this(cluster, traitSet, input, program);
-    Util.discard(collationList);
-  }
-
-  /** Creates an EnumerableCalc. */
-  public static EnumerableCalc create(final RelNode input,
-      final RexProgram program) {
-    final RelOptCluster cluster = input.getCluster();
-    final RelMetadataQuery mq = RelMetadataQuery.instance();
-    final RelTraitSet traitSet = cluster.traitSet()
-        .replace(EnumerableConvention.INSTANCE)
-        .replaceIfs(RelCollationTraitDef.INSTANCE,
-            new Supplier<List<RelCollation>>() {
-              public List<RelCollation> get() {
-                return RelMdCollation.calc(mq, input, program);
-              }
-            })
-        .replaceIf(RelDistributionTraitDef.INSTANCE,
-            new Supplier<RelDistribution>() {
-              public RelDistribution get() {
-                return RelMdDistribution.calc(mq, input, program);
-              }
-            });
-    return new EnumerableCalc(cluster, traitSet, input, program);
-  }
-
-  @Override public EnumerableCalc copy(RelTraitSet traitSet, RelNode child,
-      RexProgram program) {
-    // we do not need to copy program; it is immutable
-    return new EnumerableCalc(getCluster(), traitSet, child, program);
-  }
-
-  public Result implement(EnumerableRelImplementor implementor, Prefer pref) {
-    final JavaTypeFactory typeFactory = implementor.getTypeFactory();
-    final BlockBuilder builder = new BlockBuilder();
-    final EnumerableRel child = (EnumerableRel) getInput();
-
-    final Result result =
-        implementor.visitChild(this, 0, child, pref);
-
-    final PhysType physType =
-        PhysTypeImpl.of(
-            typeFactory, getRowType(), pref.prefer(result.format));
-
-    // final Enumerable<Employee> inputEnumerable = <<child adapter>>;
-    // return new Enumerable<IntString>() {
-    //     Enumerator<IntString> enumerator() {
-    //         return new Enumerator<IntString>() {
-    //             public void reset() {
-    // ...
-    Type outputJavaType = physType.getJavaRowType();
-    final Type enumeratorType =
-        Types.of(
-            Enumerator.class, outputJavaType);
-    Type inputJavaType = result.physType.getJavaRowType();
-    ParameterExpression inputEnumerator =
-        Expressions.parameter(
-            Types.of(
-                Enumerator.class, inputJavaType),
-            "inputEnumerator");
-    Expression input =
-        RexToLixTranslator.convert(
-            Expressions.call(
-                inputEnumerator,
-                BuiltInMethod.ENUMERATOR_CURRENT.method),
-            inputJavaType);
-
-    final RexBuilder rexBuilder = getCluster().getRexBuilder();
-    final RexSimplify simplify =
-        new RexSimplify(rexBuilder, false, RexUtil.EXECUTOR);
-    final RexProgram program = this.program.normalize(rexBuilder, simplify);
-
-    BlockStatement moveNextBody;
-    if (program.getCondition() == null) {
-      moveNextBody =
-          Blocks.toFunctionBlock(
-              Expressions.call(
-                  inputEnumerator,
-                  BuiltInMethod.ENUMERATOR_MOVE_NEXT.method));
-    } else {
-      final BlockBuilder builder2 = new BlockBuilder();
-      Expression condition =
-          RexToLixTranslator.translateCondition(
-              program,
-              typeFactory,
-              builder2,
-              new RexToLixTranslator.InputGetterImpl(
-                  Collections.singletonList(
-                      Pair.of(input, result.physType))),
-              implementor.allCorrelateVariables);
-      builder2.add(
-          Expressions.ifThen(
-              condition,
-              Expressions.return_(
-                  null, Expressions.constant(true))));
-      moveNextBody =
-          Expressions.block(
-              Expressions.while_(
-                  Expressions.call(
-                      inputEnumerator,
-                      BuiltInMethod.ENUMERATOR_MOVE_NEXT.method),
-                  builder2.toBlock()),
-              Expressions.return_(
-                  null,
-                  Expressions.constant(false)));
-    }
-
-    final BlockBuilder builder3 = new BlockBuilder();
-    List<Expression> expressions =
-        RexToLixTranslator.translateProjects(
-            program,
-            typeFactory,
-            builder3,
-            physType,
-            DataContext.ROOT,
-            new RexToLixTranslator.InputGetterImpl(
-                Collections.singletonList(
-                    Pair.of(input, result.physType))),
-            implementor.allCorrelateVariables);
-    builder3.add(
-        Expressions.return_(
-            null, physType.record(expressions)));
-    BlockStatement currentBody =
-        builder3.toBlock();
-
-    final Expression inputEnumerable =
-        builder.append(
-            "inputEnumerable", result.block, false);
-    final Expression body =
-        Expressions.new_(
-            enumeratorType,
-            NO_EXPRS,
-            Expressions.list(
-                Expressions.fieldDecl(
-                    Modifier.PUBLIC
-                    | Modifier.FINAL,
-                    inputEnumerator,
-                    Expressions.call(
-                        inputEnumerable,
-                        BuiltInMethod.ENUMERABLE_ENUMERATOR.method)),
-                EnumUtils.overridingMethodDecl(
-                    BuiltInMethod.ENUMERATOR_RESET.method,
-                    NO_PARAMS,
-                    Blocks.toFunctionBlock(
-                        Expressions.call(
-                            inputEnumerator,
-                            BuiltInMethod.ENUMERATOR_RESET.method))),
-                EnumUtils.overridingMethodDecl(
-                    BuiltInMethod.ENUMERATOR_MOVE_NEXT.method,
-                    NO_PARAMS,
-                    moveNextBody),
-                EnumUtils.overridingMethodDecl(
-                    BuiltInMethod.ENUMERATOR_CLOSE.method,
-                    NO_PARAMS,
-                    Blocks.toFunctionBlock(
-                        Expressions.call(
-                            inputEnumerator,
-                            BuiltInMethod.ENUMERATOR_CLOSE.method))),
-                Expressions.methodDecl(
-                    Modifier.PUBLIC,
-                    BRIDGE_METHODS
-                        ? Object.class
-                        : outputJavaType,
-                    "current",
-                    NO_PARAMS,
-                    currentBody)));
-    builder.add(
-        Expressions.return_(
-            null,
-            Expressions.new_(
-                BuiltInMethod.ABSTRACT_ENUMERABLE_CTOR.constructor,
-                // TODO: generics
-                //   Collections.singletonList(inputRowType),
-                NO_EXPRS,
-                ImmutableList.<MemberDeclaration>of(
-                    Expressions.methodDecl(
-                        Modifier.PUBLIC,
-                        enumeratorType,
-                        BuiltInMethod.ENUMERABLE_ENUMERATOR.method.getName(),
-                        NO_PARAMS,
-                        Blocks.toFunctionBlock(body))))));
-    return implementor.result(physType, builder.toBlock());
-  }
-
-  public RexProgram getProgram() {
-    return program;
-  }
-}
-
-// End EnumerableCalc.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableCalcRule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableCalcRule.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableCalcRule.java
deleted file mode 100644
index b94ff57..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableCalcRule.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.plan.Convention;
-import org.apache.calcite.plan.RelOptUtil;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.convert.ConverterRule;
-import org.apache.calcite.rel.logical.LogicalCalc;
-
-/**
- * Rule to convert a {@link org.apache.calcite.rel.logical.LogicalCalc} to an
- * {@link EnumerableCalc}.
- */
-class EnumerableCalcRule extends ConverterRule {
-  EnumerableCalcRule() {
-    // The predicate ensures that if there's a multiset, FarragoMultisetSplitter
-    // will work on it first.
-    super(LogicalCalc.class, RelOptUtil.CALC_PREDICATE, Convention.NONE,
-        EnumerableConvention.INSTANCE, "EnumerableCalcRule");
-  }
-
-  public RelNode convert(RelNode rel) {
-    final LogicalCalc calc = (LogicalCalc) rel;
-    final RelNode input = calc.getInput();
-    return EnumerableCalc.create(
-        convert(input,
-            input.getTraitSet().replace(EnumerableConvention.INSTANCE)),
-        calc.getProgram());
-  }
-}
-
-// End EnumerableCalcRule.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableCollect.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableCollect.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableCollect.java
deleted file mode 100644
index 59c2776..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableCollect.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.linq4j.tree.BlockBuilder;
-import org.apache.calcite.linq4j.tree.Expression;
-import org.apache.calcite.linq4j.tree.Expressions;
-import org.apache.calcite.plan.RelOptCluster;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.core.Collect;
-import org.apache.calcite.util.BuiltInMethod;
-
-/** Implementation of {@link org.apache.calcite.rel.core.Collect} in
- * {@link org.apache.calcite.adapter.enumerable.EnumerableConvention enumerable calling convention}. */
-public class EnumerableCollect extends Collect implements EnumerableRel {
-  public EnumerableCollect(RelOptCluster cluster, RelTraitSet traitSet,
-      RelNode child, String fieldName) {
-    super(cluster, traitSet, child, fieldName);
-    assert getConvention() instanceof EnumerableConvention;
-    assert getConvention() == child.getConvention();
-  }
-
-  @Override public EnumerableCollect copy(RelTraitSet traitSet,
-      RelNode newInput) {
-    return new EnumerableCollect(getCluster(), traitSet, newInput, fieldName);
-  }
-
-  public Result implement(EnumerableRelImplementor implementor, Prefer pref) {
-    final BlockBuilder builder = new BlockBuilder();
-    final EnumerableRel child = (EnumerableRel) getInput();
-    final Result result = implementor.visitChild(this, 0, child, Prefer.ARRAY);
-    final PhysType physType =
-        PhysTypeImpl.of(
-            implementor.getTypeFactory(),
-            getRowType(),
-            JavaRowFormat.LIST);
-
-    // final Enumerable<Employee> child = <<child adapter>>;
-    // final List<Employee> list = child.toList();
-    Expression child_ =
-        builder.append(
-            "child", result.block);
-    Expression list_ =
-        builder.append("list",
-            Expressions.call(child_,
-                BuiltInMethod.ENUMERABLE_TO_LIST.method));
-
-    builder.add(
-        Expressions.return_(null,
-            Expressions.call(
-                BuiltInMethod.SINGLETON_ENUMERABLE.method, list_)));
-    return implementor.result(physType, builder.toBlock());
-  }
-}
-
-// End EnumerableCollect.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableCollectRule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableCollectRule.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableCollectRule.java
deleted file mode 100644
index 4ab49b4..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableCollectRule.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.plan.Convention;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.convert.ConverterRule;
-import org.apache.calcite.rel.core.Collect;
-
-/**
- * Rule to convert an {@link org.apache.calcite.rel.core.Collect} to an
- * {@link EnumerableCollect}.
- */
-class EnumerableCollectRule extends ConverterRule {
-  EnumerableCollectRule() {
-    super(Collect.class, Convention.NONE, EnumerableConvention.INSTANCE,
-        "EnumerableCollectRule");
-  }
-
-  public RelNode convert(RelNode rel) {
-    final Collect collect = (Collect) rel;
-    final RelTraitSet traitSet =
-        collect.getTraitSet().replace(EnumerableConvention.INSTANCE);
-    final RelNode input = collect.getInput();
-    return new EnumerableCollect(
-        rel.getCluster(),
-        traitSet,
-        convert(input,
-            input.getTraitSet().replace(EnumerableConvention.INSTANCE)),
-        collect.getFieldName());
-  }
-}
-
-// End EnumerableCollectRule.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableConvention.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableConvention.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableConvention.java
deleted file mode 100644
index ab3976f..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableConvention.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.plan.Convention;
-import org.apache.calcite.plan.ConventionTraitDef;
-import org.apache.calcite.plan.RelOptPlanner;
-import org.apache.calcite.plan.RelTrait;
-import org.apache.calcite.plan.RelTraitDef;
-import org.apache.calcite.plan.RelTraitSet;
-
-/**
- * Family of calling conventions that return results as an
- * {@link org.apache.calcite.linq4j.Enumerable}.
- */
-public enum EnumerableConvention implements Convention {
-  INSTANCE;
-
-  /** Cost of an enumerable node versus implementing an equivalent node in a
-   * "typical" calling convention. */
-  public static final double COST_MULTIPLIER = 1.0d;
-
-  @Override public String toString() {
-    return getName();
-  }
-
-  public Class getInterface() {
-    return EnumerableRel.class;
-  }
-
-  public String getName() {
-    return "ENUMERABLE";
-  }
-
-  public RelTraitDef getTraitDef() {
-    return ConventionTraitDef.INSTANCE;
-  }
-
-  public boolean satisfies(RelTrait trait) {
-    return this == trait;
-  }
-
-  public void register(RelOptPlanner planner) {}
-
-  public boolean canConvertConvention(Convention toConvention) {
-    return false;
-  }
-
-  public boolean useAbstractConvertersForConversion(RelTraitSet fromTraits,
-      RelTraitSet toTraits) {
-    return false;
-  }
-}
-
-// End EnumerableConvention.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableCorrelate.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableCorrelate.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableCorrelate.java
deleted file mode 100644
index 6085520..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableCorrelate.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.linq4j.tree.BlockBuilder;
-import org.apache.calcite.linq4j.tree.Expression;
-import org.apache.calcite.linq4j.tree.Expressions;
-import org.apache.calcite.linq4j.tree.ParameterExpression;
-import org.apache.calcite.linq4j.tree.Primitive;
-import org.apache.calcite.plan.RelOptCluster;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.core.Correlate;
-import org.apache.calcite.rel.core.CorrelationId;
-import org.apache.calcite.rel.core.JoinRelType;
-import org.apache.calcite.sql.SemiJoinType;
-import org.apache.calcite.util.BuiltInMethod;
-import org.apache.calcite.util.ImmutableBitSet;
-
-import com.google.common.collect.ImmutableList;
-
-import java.lang.reflect.Modifier;
-import java.lang.reflect.Type;
-
-/** Implementation of {@link org.apache.calcite.rel.core.Correlate} in
- * {@link org.apache.calcite.adapter.enumerable.EnumerableConvention enumerable calling convention}. */
-public class EnumerableCorrelate extends Correlate
-    implements EnumerableRel {
-
-  public EnumerableCorrelate(RelOptCluster cluster, RelTraitSet traits,
-      RelNode left, RelNode right,
-      CorrelationId correlationId,
-      ImmutableBitSet requiredColumns, SemiJoinType joinType) {
-    super(cluster, traits, left, right, correlationId, requiredColumns,
-        joinType);
-  }
-
-  @Override public EnumerableCorrelate copy(RelTraitSet traitSet,
-      RelNode left, RelNode right, CorrelationId correlationId,
-      ImmutableBitSet requiredColumns, SemiJoinType joinType) {
-    return new EnumerableCorrelate(getCluster(),
-        traitSet, left, right, correlationId, requiredColumns, joinType);
-  }
-
-  public Result implement(EnumerableRelImplementor implementor,
-      Prefer pref) {
-    final BlockBuilder builder = new BlockBuilder();
-    final Result leftResult =
-        implementor.visitChild(this, 0, (EnumerableRel) left, pref);
-    Expression leftExpression =
-        builder.append(
-            "left", leftResult.block);
-
-    final BlockBuilder corrBlock = new BlockBuilder();
-    Type corrVarType = leftResult.physType.getJavaRowType();
-    ParameterExpression corrRef; // correlate to be used in inner loop
-    ParameterExpression corrArg; // argument to correlate lambda (must be boxed)
-    if (!Primitive.is(corrVarType)) {
-      corrArg =
-          Expressions.parameter(Modifier.FINAL,
-              corrVarType, getCorrelVariable());
-      corrRef = corrArg;
-    } else {
-      corrArg =
-          Expressions.parameter(Modifier.FINAL,
-              Primitive.box(corrVarType), "$box" + getCorrelVariable());
-      corrRef = (ParameterExpression) corrBlock.append(getCorrelVariable(),
-          Expressions.unbox(corrArg));
-    }
-
-    implementor.registerCorrelVariable(getCorrelVariable(), corrRef,
-        corrBlock, leftResult.physType);
-
-    final Result rightResult =
-        implementor.visitChild(this, 1, (EnumerableRel) right, pref);
-
-    implementor.clearCorrelVariable(getCorrelVariable());
-
-    corrBlock.add(rightResult.block);
-
-    final PhysType physType =
-        PhysTypeImpl.of(
-            implementor.getTypeFactory(),
-            getRowType(),
-            pref.prefer(JavaRowFormat.CUSTOM));
-
-    Expression selector =
-        EnumUtils.joinSelector(
-            joinType.returnsJustFirstInput() ? joinType.toJoinType()
-                : JoinRelType.INNER, physType,
-            ImmutableList.of(leftResult.physType, rightResult.physType));
-
-    builder.append(
-        Expressions.call(leftExpression, BuiltInMethod.CORRELATE_JOIN.method,
-            Expressions.constant(joinType.toLinq4j()),
-        Expressions.lambda(corrBlock.toBlock(), corrArg),
-        selector));
-
-    return implementor.result(physType, builder.toBlock());
-  }
-}
-
-// End EnumerableCorrelate.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableCorrelateRule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableCorrelateRule.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableCorrelateRule.java
deleted file mode 100644
index eb08a27..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableCorrelateRule.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.plan.Convention;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.convert.ConverterRule;
-import org.apache.calcite.rel.logical.LogicalCorrelate;
-
-/**
- * Implementation of nested loops over enumerable inputs.
- */
-public class EnumerableCorrelateRule extends ConverterRule {
-  EnumerableCorrelateRule() {
-    super(LogicalCorrelate.class, Convention.NONE,
-        EnumerableConvention.INSTANCE, "EnumerableCorrelateRule");
-  }
-
-  public RelNode convert(RelNode rel) {
-    final LogicalCorrelate c = (LogicalCorrelate) rel;
-    final RelTraitSet traitSet =
-        c.getTraitSet().replace(EnumerableConvention.INSTANCE);
-    return new EnumerableCorrelate(
-        rel.getCluster(),
-        traitSet,
-        convert(c.getLeft(), c.getLeft().getTraitSet()
-            .replace(EnumerableConvention.INSTANCE)),
-        convert(c.getRight(), c.getRight().getTraitSet()
-            .replace(EnumerableConvention.INSTANCE)),
-        c.getCorrelationId(),
-        c.getRequiredColumns(),
-        c.getJoinType());
-  }
-}
-
-// End EnumerableCorrelateRule.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableFilter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableFilter.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableFilter.java
deleted file mode 100644
index 894ff16..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableFilter.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.plan.RelOptCluster;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.RelCollation;
-import org.apache.calcite.rel.RelCollationTraitDef;
-import org.apache.calcite.rel.RelDistribution;
-import org.apache.calcite.rel.RelDistributionTraitDef;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.core.Filter;
-import org.apache.calcite.rel.metadata.RelMdCollation;
-import org.apache.calcite.rel.metadata.RelMdDistribution;
-import org.apache.calcite.rel.metadata.RelMetadataQuery;
-import org.apache.calcite.rex.RexNode;
-
-import com.google.common.base.Supplier;
-
-import java.util.List;
-
-/** Implementation of {@link org.apache.calcite.rel.core.Filter} in
- * {@link org.apache.calcite.adapter.enumerable.EnumerableConvention enumerable calling convention}. */
-public class EnumerableFilter
-    extends Filter
-    implements EnumerableRel {
-  /** Creates an EnumerableFilter.
-   *
-   * <p>Use {@link #create} unless you know what you're doing. */
-  public EnumerableFilter(
-      RelOptCluster cluster,
-      RelTraitSet traitSet,
-      RelNode child,
-      RexNode condition) {
-    super(cluster, traitSet, child, condition);
-    assert getConvention() instanceof EnumerableConvention;
-  }
-
-  /** Creates an EnumerableFilter. */
-  public static EnumerableFilter create(final RelNode input,
-      RexNode condition) {
-    final RelOptCluster cluster = input.getCluster();
-    final RelMetadataQuery mq = RelMetadataQuery.instance();
-    final RelTraitSet traitSet =
-        cluster.traitSetOf(EnumerableConvention.INSTANCE)
-            .replaceIfs(
-                RelCollationTraitDef.INSTANCE,
-                new Supplier<List<RelCollation>>() {
-                  public List<RelCollation> get() {
-                    return RelMdCollation.filter(mq, input);
-                  }
-                })
-            .replaceIf(RelDistributionTraitDef.INSTANCE,
-                new Supplier<RelDistribution>() {
-                  public RelDistribution get() {
-                    return RelMdDistribution.filter(mq, input);
-                  }
-                });
-    return new EnumerableFilter(cluster, traitSet, input, condition);
-  }
-
-  public EnumerableFilter copy(RelTraitSet traitSet, RelNode input,
-      RexNode condition) {
-    return new EnumerableFilter(getCluster(), traitSet, input, condition);
-  }
-
-  public Result implement(EnumerableRelImplementor implementor, Prefer pref) {
-    // EnumerableCalc is always better
-    throw new UnsupportedOperationException();
-  }
-}
-
-// End EnumerableFilter.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableFilterRule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableFilterRule.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableFilterRule.java
deleted file mode 100644
index 51fcdd4..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableFilterRule.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.plan.Convention;
-import org.apache.calcite.plan.RelOptUtil;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.convert.ConverterRule;
-import org.apache.calcite.rel.logical.LogicalFilter;
-
-/**
- * Rule to convert a {@link org.apache.calcite.rel.logical.LogicalFilter} to an
- * {@link EnumerableFilter}.
- */
-class EnumerableFilterRule extends ConverterRule {
-  EnumerableFilterRule() {
-    super(LogicalFilter.class, RelOptUtil.FILTER_PREDICATE, Convention.NONE,
-        EnumerableConvention.INSTANCE, "EnumerableFilterRule");
-  }
-
-  public RelNode convert(RelNode rel) {
-    final LogicalFilter filter = (LogicalFilter) rel;
-    return new EnumerableFilter(rel.getCluster(),
-        rel.getTraitSet().replace(EnumerableConvention.INSTANCE),
-        convert(filter.getInput(),
-            filter.getInput().getTraitSet()
-                .replace(EnumerableConvention.INSTANCE)),
-        filter.getCondition());
-  }
-}
-
-// End EnumerableFilterRule.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableFilterToCalcRule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableFilterToCalcRule.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableFilterToCalcRule.java
deleted file mode 100644
index 9a61124..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableFilterToCalcRule.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.plan.RelOptRule;
-import org.apache.calcite.plan.RelOptRuleCall;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.type.RelDataType;
-import org.apache.calcite.rex.RexBuilder;
-import org.apache.calcite.rex.RexProgram;
-import org.apache.calcite.rex.RexProgramBuilder;
-
-/** Variant of {@link org.apache.calcite.rel.rules.FilterToCalcRule} for
- * {@link org.apache.calcite.adapter.enumerable.EnumerableConvention enumerable calling convention}. */
-public class EnumerableFilterToCalcRule extends RelOptRule {
-  EnumerableFilterToCalcRule() {
-    super(operand(EnumerableFilter.class, any()));
-  }
-
-  public void onMatch(RelOptRuleCall call) {
-    final EnumerableFilter filter = call.rel(0);
-    final RelNode input = filter.getInput();
-
-    // Create a program containing a filter.
-    final RexBuilder rexBuilder = filter.getCluster().getRexBuilder();
-    final RelDataType inputRowType = input.getRowType();
-    final RexProgramBuilder programBuilder =
-        new RexProgramBuilder(inputRowType, rexBuilder);
-    programBuilder.addIdentity();
-    programBuilder.addCondition(filter.getCondition());
-    final RexProgram program = programBuilder.getProgram();
-
-    final EnumerableCalc calc = EnumerableCalc.create(input, program);
-    call.transformTo(calc);
-  }
-}
-
-// End EnumerableFilterToCalcRule.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableInterpretable.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableInterpretable.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableInterpretable.java
deleted file mode 100644
index 19d5f2a..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableInterpretable.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.DataContext;
-import org.apache.calcite.avatica.Helper;
-import org.apache.calcite.interpreter.InterpretableConvention;
-import org.apache.calcite.interpreter.InterpretableRel;
-import org.apache.calcite.interpreter.Interpreter;
-import org.apache.calcite.interpreter.Node;
-import org.apache.calcite.interpreter.Row;
-import org.apache.calcite.interpreter.Sink;
-import org.apache.calcite.jdbc.CalcitePrepare;
-import org.apache.calcite.linq4j.AbstractEnumerable;
-import org.apache.calcite.linq4j.Enumerable;
-import org.apache.calcite.linq4j.Enumerator;
-import org.apache.calcite.linq4j.tree.ClassDeclaration;
-import org.apache.calcite.linq4j.tree.Expressions;
-import org.apache.calcite.plan.ConventionTraitDef;
-import org.apache.calcite.plan.RelOptCluster;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.prepare.CalcitePrepareImpl;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.convert.ConverterImpl;
-import org.apache.calcite.runtime.ArrayBindable;
-import org.apache.calcite.runtime.Bindable;
-import org.apache.calcite.runtime.Hook;
-import org.apache.calcite.runtime.Typed;
-import org.apache.calcite.runtime.Utilities;
-import org.apache.calcite.util.Util;
-
-import org.codehaus.commons.compiler.CompileException;
-import org.codehaus.commons.compiler.CompilerFactoryFactory;
-import org.codehaus.commons.compiler.IClassBodyEvaluator;
-import org.codehaus.commons.compiler.ICompilerFactory;
-
-import java.io.IOException;
-import java.io.StringReader;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Relational expression that converts an enumerable input to interpretable
- * calling convention.
- *
- * @see EnumerableConvention
- * @see org.apache.calcite.interpreter.BindableConvention
- */
-public class EnumerableInterpretable extends ConverterImpl
-    implements InterpretableRel {
-  protected EnumerableInterpretable(RelOptCluster cluster, RelNode input) {
-    super(cluster, ConventionTraitDef.INSTANCE,
-        cluster.traitSetOf(InterpretableConvention.INSTANCE), input);
-  }
-
-  @Override public EnumerableInterpretable copy(RelTraitSet traitSet,
-      List<RelNode> inputs) {
-    return new EnumerableInterpretable(getCluster(), sole(inputs));
-  }
-
-  public Node implement(final InterpreterImplementor implementor) {
-    final Bindable bindable = toBindable(implementor.internalParameters,
-            implementor.spark, (EnumerableRel) getInput(),
-        EnumerableRel.Prefer.ARRAY);
-    final ArrayBindable arrayBindable = box(bindable);
-    final Enumerable<Object[]> enumerable =
-        arrayBindable.bind(implementor.dataContext);
-    return new EnumerableNode(enumerable, implementor.interpreter, this);
-  }
-
-  public static Bindable toBindable(Map<String, Object> parameters,
-      CalcitePrepare.SparkHandler spark, EnumerableRel rel,
-      EnumerableRel.Prefer prefer) {
-    EnumerableRelImplementor relImplementor =
-        new EnumerableRelImplementor(rel.getCluster().getRexBuilder(),
-            parameters);
-
-    final ClassDeclaration expr = relImplementor.implementRoot(rel, prefer);
-    String s = Expressions.toString(expr.memberDeclarations, "\n", false);
-
-    if (CalcitePrepareImpl.DEBUG) {
-      Util.debugCode(System.out, s);
-    }
-
-    Hook.JAVA_PLAN.run(s);
-
-    try {
-      if (spark != null && spark.enabled()) {
-        return spark.compile(expr, s);
-      } else {
-        return getBindable(expr, s, rel.getRowType().getFieldCount());
-      }
-    } catch (Exception e) {
-      throw Helper.INSTANCE.wrap("Error while compiling generated Java code:\n"
-          + s, e);
-    }
-  }
-
-  static ArrayBindable getArrayBindable(ClassDeclaration expr, String s,
-      int fieldCount) throws CompileException, IOException {
-    Bindable bindable = getBindable(expr, s, fieldCount);
-    return box(bindable);
-  }
-
-  static Bindable getBindable(ClassDeclaration expr, String s, int fieldCount)
-      throws CompileException, IOException {
-    ICompilerFactory compilerFactory;
-    try {
-      compilerFactory = CompilerFactoryFactory.getDefaultCompilerFactory();
-    } catch (Exception e) {
-      throw new IllegalStateException(
-          "Unable to instantiate java compiler", e);
-    }
-    IClassBodyEvaluator cbe = compilerFactory.newClassBodyEvaluator();
-    cbe.setClassName(expr.name);
-    cbe.setExtendedClass(Utilities.class);
-    cbe.setImplementedInterfaces(
-        fieldCount == 1
-            ? new Class[] {Bindable.class, Typed.class}
-            : new Class[] {ArrayBindable.class});
-    cbe.setParentClassLoader(EnumerableInterpretable.class.getClassLoader());
-    if (CalcitePrepareImpl.DEBUG) {
-      // Add line numbers to the generated janino class
-      cbe.setDebuggingInformation(true, true, true);
-    }
-    return (Bindable) cbe.createInstance(new StringReader(s));
-  }
-
-  /** Converts a bindable over scalar values into an array bindable, with each
-   * row as an array of 1 element. */
-  static ArrayBindable box(final Bindable bindable) {
-    if (bindable instanceof ArrayBindable) {
-      return (ArrayBindable) bindable;
-    }
-    return new ArrayBindable() {
-      public Class<Object[]> getElementType() {
-        return Object[].class;
-      }
-
-      public Enumerable<Object[]> bind(DataContext dataContext) {
-        final Enumerable<?> enumerable = bindable.bind(dataContext);
-        return new AbstractEnumerable<Object[]>() {
-          public Enumerator<Object[]> enumerator() {
-            final Enumerator<?> enumerator = enumerable.enumerator();
-            return new Enumerator<Object[]>() {
-              public Object[] current() {
-                return new Object[] {enumerator.current()};
-              }
-
-              public boolean moveNext() {
-                return enumerator.moveNext();
-              }
-
-              public void reset() {
-                enumerator.reset();
-              }
-
-              public void close() {
-                enumerator.close();
-              }
-            };
-          }
-        };
-      }
-    };
-  }
-
-  /** Interpreter node that reads from an {@link Enumerable}.
-   *
-   * <p>From the interpreter's perspective, it is a leaf node. */
-  private static class EnumerableNode implements Node {
-    private final Enumerable<Object[]> enumerable;
-    private final Sink sink;
-
-    public EnumerableNode(Enumerable<Object[]> enumerable,
-        Interpreter interpreter, EnumerableInterpretable rel) {
-      this.enumerable = enumerable;
-      this.sink = interpreter.sink(rel);
-    }
-
-    public void run() throws InterruptedException {
-      final Enumerator<Object[]> enumerator = enumerable.enumerator();
-      while (enumerator.moveNext()) {
-        Object[] values = enumerator.current();
-        sink.send(Row.of(values));
-      }
-    }
-  }
-}
-
-// End EnumerableInterpretable.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableInterpreter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableInterpreter.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableInterpreter.java
deleted file mode 100644
index 1c53483..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableInterpreter.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.adapter.java.JavaTypeFactory;
-import org.apache.calcite.interpreter.Interpreter;
-import org.apache.calcite.linq4j.tree.BlockBuilder;
-import org.apache.calcite.linq4j.tree.Expression;
-import org.apache.calcite.linq4j.tree.Expressions;
-import org.apache.calcite.plan.RelOptCluster;
-import org.apache.calcite.plan.RelOptCost;
-import org.apache.calcite.plan.RelOptPlanner;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.SingleRel;
-import org.apache.calcite.rel.metadata.RelMetadataQuery;
-import org.apache.calcite.util.BuiltInMethod;
-
-import java.util.List;
-
-/** Relational expression that executes its children using an interpreter.
- *
- * <p>Although quite a few kinds of {@link org.apache.calcite.rel.RelNode} can
- * be interpreted, this is only created by default for
- * {@link org.apache.calcite.schema.FilterableTable} and
- * {@link org.apache.calcite.schema.ProjectableFilterableTable}.
- */
-public class EnumerableInterpreter extends SingleRel
-    implements EnumerableRel {
-  private final double factor;
-
-  /**
-   * Creates an EnumerableInterpreter.
-   *
-   * <p>Use {@link #create} unless you know what you're doing.
-   *
-   * @param cluster Cluster
-   * @param traitSet Traits
-   * @param input Input relation
-   * @param factor Cost multiply factor
-   */
-  public EnumerableInterpreter(RelOptCluster cluster, RelTraitSet traitSet,
-      RelNode input, double factor) {
-    super(cluster, traitSet, input);
-    assert getConvention() instanceof EnumerableConvention;
-    this.factor = factor;
-  }
-
-  /**
-   * Creates an EnumerableInterpreter.
-   *
-   * @param input Input relation
-   * @param factor Cost multiply factor
-   */
-  public static EnumerableInterpreter create(RelNode input, double factor) {
-    final RelTraitSet traitSet = input.getTraitSet()
-        .replace(EnumerableConvention.INSTANCE);
-    return new EnumerableInterpreter(input.getCluster(), traitSet, input,
-        factor);
-  }
-
-  @Override public RelOptCost computeSelfCost(RelOptPlanner planner,
-      RelMetadataQuery mq) {
-    return super.computeSelfCost(planner, mq).multiplyBy(factor);
-  }
-
-  @Override public RelNode copy(RelTraitSet traitSet, List<RelNode> inputs) {
-    return new EnumerableInterpreter(getCluster(), traitSet, sole(inputs),
-        factor);
-  }
-
-  public Result implement(EnumerableRelImplementor implementor, Prefer pref) {
-    final JavaTypeFactory typeFactory = implementor.getTypeFactory();
-    final BlockBuilder builder = new BlockBuilder();
-    final PhysType physType =
-        PhysTypeImpl.of(typeFactory, getRowType(), JavaRowFormat.ARRAY);
-    final Expression interpreter_ = builder.append("interpreter",
-        Expressions.new_(Interpreter.class,
-            implementor.getRootExpression(),
-            implementor.stash(getInput(), RelNode.class)));
-    final Expression sliced_ =
-        getRowType().getFieldCount() == 1
-            ? Expressions.call(BuiltInMethod.SLICE0.method, interpreter_)
-            : interpreter_;
-    builder.add(sliced_);
-    return implementor.result(physType, builder.toBlock());
-  }
-}
-
-// End EnumerableInterpreter.java


[19/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/site/_docs/protobuf_reference.md
----------------------------------------------------------------------
diff --git a/avatica/site/_docs/protobuf_reference.md b/avatica/site/_docs/protobuf_reference.md
deleted file mode 100644
index 31d31e0..0000000
--- a/avatica/site/_docs/protobuf_reference.md
+++ /dev/null
@@ -1,1304 +0,0 @@
----
-layout: docs
-title: Protocol Buffers Reference
-sidebar_title: Protobuf Reference
-permalink: /docs/protobuf_reference.html
-requests:
-  - { name: "CatalogsRequest" }
-  - { name: "CloseConnectionRequest" }
-  - { name: "CloseStatementRequest" }
-  - { name: "ColumnsRequest" }
-  - { name: "CommitRequest" }
-  - { name: "ConnectionSyncRequest" }
-  - { name: "CreateStatementRequest" }
-  - { name: "DatabasePropertyRequest" }
-  - { name: "ExecuteBatchRequest" }
-  - { name: "ExecuteRequest" }
-  - { name: "FetchRequest" }
-  - { name: "OpenConnectionRequest" }
-  - { name: "PrepareAndExecuteBatchRequest" }
-  - { name: "PrepareAndExecuteRequest" }
-  - { name: "PrepareRequest" }
-  - { name: "RollbackRequest" }
-  - { name: "SchemasRequest" }
-  - { name: "SyncResultsRequest" }
-  - { name: "TableTypesRequest" }
-  - { name: "TablesRequest" }
-  - { name: "TypeInfoRequest" }
-miscellaneous:
-  - { name: "AvaticaParameter" }
-  - { name: "AvaticaSeverity" }
-  - { name: "AvaticaType" }
-  - { name: "ColumnMetaData" }
-  - { name: "ColumnValue" }
-  - { name: "ConnectionProperties" }
-  - { name: "CursorFactory" }
-  - { name: "DatabaseProperty" }
-  - { name: "Frame" }
-  - { name: "QueryState" }
-  - { name: "Rep" }
-  - { name: "Row" }
-  - { name: "RpcMetadata" }
-  - { name: "Signature" }
-  - { name: "StateType" }
-  - { name: "StatementHandle" }
-  - { name: "StatementType" }
-  - { name: "Style" }
-  - { name: "TypedValue" }
-  - { name: "UpdateBatch" }
-  - { name: "WireMessage" }
-responses:
-  - { name: "CloseConnectionResponse" }
-  - { name: "CloseStatementResponse" }
-  - { name: "CommitResponse" }
-  - { name: "ConnectionSyncResponse" }
-  - { name: "CreateStatementResponse" }
-  - { name: "DatabasePropertyResponse" }
-  - { name: "ErrorResponse" }
-  - { name: "ExecuteBatchResponse" }
-  - { name: "ExecuteResponse" }
-  - { name: "FetchResponse" }
-  - { name: "OpenConnectionResponse" }
-  - { name: "PrepareResponse" }
-  - { name: "ResultSetResponse" }
-  - { name: "RollbackResponse" }
-  - { name: "SyncResultsResponse" }
----
-
-<!--
-{% 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 %}
--->
-
-Avatica also supports [Protocol Buffers](https://developers.google.com/protocol-buffers/)
-as a message format since version 1.5.0. The Protocol Buffer, or protobuf for
-short, implementation is extremely similar to the JSON implementation. Some
-differences include protobuf's expanded type support (such as native byte arrays)
-and inability to differentiate between the default value for a field and the
-absence of a value for a field.
-
-Other notable structural differences to JSON include the addition of a
-`WireMessage` message which is used to identify the type of the wrapped message
-returned by the server (synonymous with `request` or `response` attribute on the
-JSON messages) and a change to `TypedValue` containing an `Object` value to
-a collection of optional strongly-typed values (as protobuf does not natively
-support an `Object` type that is unwrapped at runtime).
-
-Unless otherwise specified with use of the `required` modifier, all fields in
-all protocol buffer messages are `optional` by default.
-
-## Index
-
-### Requests
-<ul>
-  {% for item in page.requests %}<li><a href="#{{ item.name | downcase }}">{{ item.name }}</a></li>{% endfor %}
-</ul>
-
-### Responses
-<ul>
-  {% for item in page.responses %}<li><a href="#{{ item.name | downcase }}">{{ item.name }}</a></li>{% endfor %}
-</ul>
-
-### Miscellaneous
-<ul>
-  {% for item in page.miscellaneous %}<li><a href="#{{ item.name | downcase }}">{{ item.name }}</a></li>{% endfor %}
-</ul>
-
-
-## Requests
-
-The collection of all protobuf objects accepted as requests to Avatica. All request
-objects should be wrapped in a `WireMessage` before being sent to Avatica.
-
-### CatalogsRequest
-
-This request is used to fetch the available catalog names in the database.
-
-{% highlight protobuf %}
-message CatalogsRequest {
-  string connection_id = 1;
-}
-{% endhighlight %}
-
-`connection_id` The identifier for the connection to use.
-
-### CloseConnectionRequest
-
-This request is used to close the Connection object in the Avatica server identified by the given IDs.
-
-{% highlight protobuf %}
-message CloseConnectionRequest {
-  string connection_id = 1;
-}
-{% endhighlight %}
-
-`connection_id` The identifier of the connection to close.
-
-### CloseStatementRequest
-
-This request is used to close the Statement object in the Avatica server identified by the given IDs.
-
-{% highlight protobuf %}
-message CloseStatementRequest {
-  string connection_id = 1;
-  uint32 statement_id = 2;
-}
-{% endhighlight %}
-
-`connection_id` The identifier of the connection to which the statement belongs.
-
-`statement_id` The identifier of the statement to close.
-
-### ColumnsRequest
-
-This request is used to fetch columns in the database given some optional filtering criteria.
-
-{% highlight protobuf %}
-message ColumnsRequest {
-  string catalog = 1;
-  string schema_pattern = 2;
-  string table_name_pattern = 3;
-  string column_name_pattern = 4;
-  string connection_id = 5;
-}
-{% endhighlight %}
-
-`catalog` The name of a catalog to limit returned columns.
-
-`schema_pattern` A Java Pattern against schemas to limit returned columns.
-
-`table_name_pattern` A Java Pattern against table names to limit returned columns.
-
-`column_name_pattern` A Java Pattern against column names to limit returned columns.
-
-`connection_id` The identifier of the connection which to use to fetch the columns.
-
-### CommitRequest
-
-This request is used to issue a `commit` on the Connection in the Avatica server identified by the given ID.
-
-{% highlight protobuf %}
-message CommitRequest {
-  string connection_id = 1;
-}
-{% endhighlight %}
-
-`connection_id` The identifier of the connection on which to invoke commit.
-
-### ConnectionSyncRequest
-
-This request is used to ensure that the client and server have a consistent view of the database properties.
-
-{% highlight protobuf %}
-message ConnectionSyncRequest {
-  string connection_id = 1;
-  ConnectionProperties conn_props = 2;
-}
-{% endhighlight %}
-
-`connection_id` The identifier of the connection to synchronize.
-
-`conn_props` A <a href="#connectionproperties">ConnectionProperties</a> object to synchronize between the client and server.
-
-### CreateStatementRequest
-
-This request is used to create a new Statement in the Avatica server.
-
-{% highlight protobuf %}
-message CreateStatementRequest {
-  string connection_id = 1;
-}
-{% endhighlight %}
-
-`connection_id` The identifier of the connection to use in creating a statement.
-
-### DatabasePropertyRequest
-
-This request is used to fetch all <a href="#databaseproperty">database properties</a>.
-
-{% highlight protobuf %}
-message DatabasePropertyRequest {
-  string connection_id = 1;
-}
-{% endhighlight %}
-
-`connection_id` The identifier of the connection to use when fetching the database properties.
-
-### ExecuteBatchRequest
-
-This request is used to execute a batch of updates against a PreparedStatement.
-
-{% highlight protobuf %}
-message ExecuteBatchRequest {
-  string connection_id = 1;
-  uint32 statement_id = 2;
-  repeated UpdateBatch updates = 3;
-}
-{% endhighlight %}
-
-`connection_id` A string which refers to a connection.
-
-`statement_id` An integer which refers to a statement.
-
-`updates` A list of <a href="#updatebatch">UpdateBatch</a>'s; the batch of updates.
-
-### ExecuteRequest
-
-This request is used to execute a PreparedStatement, optionally with values to bind to the parameters in the Statement.
-
-{% highlight protobuf %}
-message ExecuteRequest {
-  StatementHandle statementHandle = 1;
-  repeated TypedValue parameter_values = 2;
-  uint64 first_frame_max_size = 3;
-  bool has_parameter_values = 4;
-}
-{% endhighlight %}
-
-`statementHandle` A <a href="#statementhandle">StatementHandle</a> object.
-
-`parameter_values` The <a href="#typedvalue">TypedValue</a> for each parameter on the prepared statement.
-
-`first_frame_max_size` The maximum number of rows returned in the response.
-
-`has_parameter_values` A boolean which denotes if the user set a value for the `parameter_values` field.
-
-### FetchRequest
-
-This request is used to fetch a batch of rows from a Statement previously created.
-
-{% highlight protobuf %}
-message FetchRequest {
-  string connection_id = 1;
-  uint32 statement_id = 2;
-  uint64 offset = 3;
-  uint32 fetch_max_row_count = 4; // Deprecated!
-  int32 frame_max_size = 5;
-}
-{% endhighlight %}
-
-`connection_id` The identifier of the connection to use.
-
-`statement_id` The identifier of the statement created using the above connection.
-
-`offset` The positional offset into a result set to fetch.
-
-`fetch_match_row_count` The maximum number of rows to return in the response to this request. Negative means no limit. *Deprecated*, use `frame_max_size`.
-
-`frame_max_size` The maximum number of rows to return in the response. Negative means no limit.
-
-### OpenConnectionRequest
-
-This request is used to open a new Connection in the Avatica server.
-
-{% highlight protobuf %}
-message OpenConnectionRequest {
-  string connection_id = 1;
-  map<string, string> info = 2;
-}
-{% endhighlight %}
-
-`connection_id` The identifier of the connection to open in the server.
-
-`info` A Map containing properties to include when creating the Connection.
-
-### PrepareAndExecuteBatchRequest
-
-This request is used as short-hand to create a Statement and execute a batch of updates against that Statement.
-
-{% highlight protobuf %}
-message PrepareAndExecuteBatchRequest {
-  string connection_id = 1;
-  uint32 statement_id = 2;
-  repeated string sql_commands = 3;
-}
-{% endhighlight %}
-
-`connection_id` The identifier for the connection to use.
-
-`statement_id` The identifier for the statement created by the above connection to use.
-
-`sql_commands` A list of SQL commands to execute; a batch.
-
-### PrepareAndExecuteRequest
-
-This request is used as a short-hand for create a Statement and fetching the first batch of results in a single call without any parameter substitution.
-
-{% highlight protobuf %}
-message PrepareAndExecuteRequest {
-  string connection_id = 1;
-  uint32 statement_id = 4;
-  string sql = 2;
-  uint64 max_row_count = 3; // Deprecated!
-  int64 max_rows_total = 5;
-  int32 max_rows_in_first_frame = 6;
-}
-{% endhighlight %}
-
-`connection_id` The identifier for the connection to use.
-
-`statement_id` The identifier for the statement created by the above connection to use.
-
-`sql` A SQL statement
-
-`max_row_count` The maximum number of rows returned in the response. *Deprecated*, use `max_rows_total`.
-
-`max_rows_total` The maximum number of rows which this query should return (over all `Frame`s).
-
-`first_frame_max_size` The maximum number of rows which should be included in the first `Frame` in the `ExecuteResponse`.
-
-### PrepareRequest
-
-This request is used to create create a new Statement with the given query in the Avatica server.
-
-{% highlight protobuf %}
-message PrepareRequest {
-  string connection_id = 1;
-  string sql = 2;
-  uint64 max_row_count = 3; // Deprecated!
-  int64 max_rows_total = 4;
-}
-{% endhighlight %}
-
-`connection_id` The identifier for the connection to use.
-
-`sql` A SQL statement
-
-`max_row_count` The maximum number of rows returned in the response. *Deprecated*, use `max_rows_total` instead.
-
-`max_rows_total` The maximum number of rows returned for the query in total.
-
-### SyncResultsRequest
-
-This request is used to reset a ResultSet's iterator to a specific offset in the Avatica server.
-
-{% highlight protobuf %}
-message SyncResultsRequest {
-  string connection_id = 1;
-  uint32 statement_id = 2;
-  QueryState state = 3;
-  uint64 offset = 4;
-}
-{% endhighlight %}
-
-`connection_id` The identifier for the connection to use.
-
-`statement_id` The identifier for the statement to use.
-
-`state` The <a href="#querystate">QueryState</a> object.
-
-`offset` The offset into the ResultSet to seek to.
-
-### RollbackRequest
-
-This request is used to issue a `rollback` on the Connection in the Avatica server identified by the given ID.
-
-{% highlight protobuf %}
-message RollbackRequest {
-  string connection_id = 1;
-}
-{% endhighlight %}
-
-`connection_id` The identifier for the connection on which to invoke rollback.
-
-### SchemasRequest
-
-This request is used to fetch the schemas matching the provided criteria in the database.
-
-{% highlight protobuf %}
-message SchemasRequest {
-  string catalog = 1;
-  string schema_pattern = 2;
-  string connection_id = 3;
-}
-{% endhighlight %}
-
-`catalog` The name of the catalog to fetch the schema from.
-
-`schema_pattern` A Java pattern of schemas to fetch.
-
-`connection_id` The identifier for the connection to fetch schemas from.
-
-### TableTypesRequest
-
-This request is used to fetch the table types available in this database.
-
-{% highlight protobuf %}
-message TableTypesRequest {
-  string connection_id = 1;
-}
-{% endhighlight %}
-
-`connection_id` The identifier of the connection to fetch the table types from.
-
-### TablesRequest
-
-This request is used to fetch the tables available in this database filtered by the provided criteria.
-
-{% highlight protobuf %}
-message TablesRequest {
-  string catalog = 1;
-  string schema_pattern = 2;
-  string table_name_pattern = 3;
-  repeated string type_list = 4;
-  bool has_type_list = 6;
-  string connection_id = 7;
-}
-{% endhighlight %}
-
-`catalog` The name of a catalog to restrict fetched tables.
-
-`schema_pattern` A Java Pattern representing schemas to include in fetched tables.
-
-`table_name_pattern` A Java Pattern representing table names to include in fetched tables.
-
-`type_list` A list of table types used to restrict fetched tables.
-
-`has_type_list` A boolean which denotes if the field `type_list` was provided.
-
-`connection_id` The identifier of the connection to fetch the tables from.
-
-### TypeInfoRequest
-
-This request is used to fetch the types available in this database.
-
-{% highlight protobuf %}
-message TypeInfoRequest {
-  string connection_id = 1;
-}
-{% endhighlight %}
-
-`connection_id` The identifier of the connection to fetch the types from.
-
-## Responses
-
-The collection of all protobuf objects accepted as requests to Avatica. All response
-objects will be wrapped in a `WireMessage` before being returned from Avatica.
-
-### CloseConnectionResponse
-
-A response to the <a href="#closeconnectionrequest">CloseConnectionRequest</a>.
-
-{% highlight protobuf %}
-message CloseConnectionResponse {
-  RpcMetadata metadata = 1;
-}
-{% endhighlight %}
-
-`metadata` <a href="#rpcmetadata">Server metadata</a> about this call.
-
-### CloseStatementResponse
-
-A response to the <a href="#closestatementrequest">CloseStatementRequest</a>.
-
-{% highlight protobuf %}
-message CloseStatementResponse {
-  RpcMetadata metadata = 1;
-}
-{% endhighlight %}
-
-`metadata` <a href="#rpcmetadata">Server metadata</a> about this call.
-
-### CommitResponse
-
-A response to the <a href="#commitrequest">CommitRequest</a>.
-
-{% highlight protobuf %}
-message CommitResponse {
-
-}
-{% endhighlight %}
-
-There are no attributes on this Response.
-
-### ConnectionSyncResponse
-
-A response to the <a href="#connectionsyncrequest">ConnectionSyncRequest</a>. Properties included in the
-response are those of the Connection in the Avatica server.
-
-{% highlight protobuf %}
-message ConnectionSyncResponse {
-  ConnectionProperties conn_props = 1;
-  RpcMetadata metadata = 2;
-}
-{% endhighlight %}
-
-`conn_props` The <a href="#connectionproperties">ConnectionProperties</a> that were synchronized.
-
-`metadata` <a href="#rpcmetadata">Server metadata</a> about this call.
-
-### CreateStatementResponse
-
-A response to the <a href="#createstatementrequest">CreateStatementRequest</a>. The ID of the statement
-that was created is included in the response. Clients will use this `statement_id` in subsequent calls.
-
-{% highlight protobuf %}
-message CreateStatementResponse {
-  string connection_id = 1;
-  uint32 statement_id = 2;
-  RpcMetadata metadata = 3;
-}
-{% endhighlight %}
-
-`connection_id` The identifier for the connection used to create the statement.
-
-`statement_id` The identifier for the created statement.
-
-`metadata` <a href="#rpcmetadata">Server metadata</a> about this call.
-
-### DatabasePropertyResponse
-
-A response to the <a href="#databasepropertyrequest">DatabasePropertyRequest</a>. See <a hred="#databaseproperty">DatabaseProperty</a>
-for information on the available property keys.
-
-{% highlight protobuf %}
-message DatabasePropertyResponse {
-  repeated DatabasePropertyElement props = 1;
-  RpcMetadata metadata = 2;
-}
-{% endhighlight %}
-
-`props` A collection of <a href="#databaseproperty">DatabaseProperty</a>'s.
-
-`metadata` <a href="#rpcmetadata">Server metadata</a> about this call.
-
-### ErrorResponse
-
-A response when an error was caught executing a request. Any request may return this response.
-
-{% highlight protobuf %}
-message ErrorResponse {
-  repeated string exceptions = 1;
-  bool has_exceptions = 7;
-  string error_message = 2;
-  Severity severity = 3;
-  uint32 error_code = 4;
-  string sql_state = 5;
-  RpcMetadata metadata = 6;
-}
-{% endhighlight %}
-
-`exceptions` A list of stringified Java StackTraces.
-
-`has_exceptions` A boolean which denotes the presence of `exceptions`.
-
-`error_message` A human-readable error message.
-
-`error_code` A numeric code for this error.
-
-`sql_state` A five character alphanumeric code for this error.
-
-`severity` An <a href="#avaticaseverity">AvaticaSeverity</a> object which denotes how critical the error is.
-
-`metadata` <a href="#rpcmetadata">Server metadata</a> about this call.
-
-### ExecuteBatchResponse
-
-A response to the <a href="#executebatchrequest">ExecuteBatchRequest</a> and <a href="#prepareandexecutebatchrequest">PrepareAndExecuteBatchRequest</a>.
-
-{% highlight protobuf %}
-message ExecuteBatchResponse {
-  string connection_id = 1;
-  uint32 statement_id = 2;
-  repeated uint32 update_counts = 3;
-  bool missing_statement = 4;
-  RpcMetadata metadata = 5;
-}
-{% endhighlight %}
-
-`connection_id` The ID referring to the connection that was used.
-
-`statment_id` The ID referring to the statement that was used.
-
-`update_counts` An array of integer values corresponding to the update count for each update in the batch.
-
-`missing_statement` A boolean which denotes if the request failed due to a missing statement.
-
-`metadata` <a href="#rpcmetadata">Server metadata</a> about this call.
-
-### ExecuteResponse
-
-A response to the <a href="#executerequest">ExecuteRequest</a> which contains the results for a metadata query.
-
-{% highlight protobuf %}
-message ExecuteResponse {
-  repeated ResultSetResponse results = 1;
-  bool missing_statement = 2;
-  RpcMetadata metadata = 3;
-}
-{% endhighlight %}
-
-`results` An array of <a href="#resultsetresponse">ResultSetResponse</a>s.
-
-`missing_statement` A boolean which denotes if the request failed due to a missing statement.
-
-`metadata` <a href="#rpcmetadata">Server metadata</a> about this call.
-
-### FetchResponse
-
-A response to the <a href="#fetchrequest">FetchRequest</a> which contains the request for the query.
-
-{% highlight protobuf %}
-message FetchResponse {
-  Frame frame = 1;
-  bool missing_statement = 2;
-  bool missing_results = 3;
-  RpcMetadata metadata = 4;
-}
-{% endhighlight %}
-
-`frame` A <a href="#frame">Frame</a> containing the results of the fetch.
-
-`missing_statement` A boolean which denotes if the request failed due to a missing Statement.
-
-`missing_results` A boolean which denotes if the request failed due to a missing ResultSet.
-
-`metadata` <a href="#rpcmetadata">Server metadata</a> about this call.
-
-### OpenConnectionResponse
-
-A response to the <a href="#openconnectionrequest">OpenConnectionRequest</a>. The ID for the connection that
-the client should use in subsequent calls was provided by the client in the request.
-
-{% highlight protobuf %}
-message OpenConnectionResponse {
-  RpcMetadata metadata = 1;
-}
-
-{% endhighlight %}
-
-`metadata` <a href="#rpcmetadata">Server metadata</a> about this call.
-
-### PrepareResponse
-
-A response to the <a href="#preparerequest">PrepareRequest</a>. This response includes a <a href="#statementhandle">StatementHandle</a>
-which clients must use to fetch the results from the Statement.
-
-{% highlight protobuf %}
-message PrepareResponse {
-  StatementHandle statement = 1;
-  RpcMetadata metadata = 2;
-}
-{% endhighlight %}
-
-`statement` A <a href="#statementhandle">StatementHandle</a> object.
-
-`metadata` <a href="#rpcmetadata">Server metadata</a> about this call.
-
-### ResultSetResponse
-
-A response which contains the results and type details from a query.
-
-{% highlight protobuf %}
-message ResultSetResponse {
-  string connection_id = 1;
-  uint32 statement_id = 2;
-  bool own_statement = 3;
-  Signature signature = 4;
-  Frame first_frame = 5;
-  uint64 update_count = 6;
-  RpcMetadata metadata = 7;
-}
-{% endhighlight %}
-
-`connection_id` The identifier for the connection used to generate this response.
-
-`statement_id` The identifier for the statement used to generate this response.
-
-`own_statement` Whether the result set has its own dedicated statement. If true, the server must automatically close the
-statement when the result set is closed. This is used for JDBC metadata result sets, for instance.
-
-`signature` A non-optional nested object <a href="#signature">Signature</a>
-
-`first_frame` A optional nested object <a href="#frame">Frame</a>
-
-`update_count` A number which is always `-1` for normal result sets. Any other value denotes a "dummy" result set
-that only contains this count and no additional data.
-
-`metadata` <a href="#rpcmetadata">Server metadata</a> about this call.
-
-### RollbackResponse
-
-A response to the <a href="#rollbackrequest">RollBackRequest</a>.
-
-{% highlight protobuf %}
-message RollbackResponse {
-
-}
-{% endhighlight %}
-
-There are no attributes on this Response.
-
-### SyncResultsResponse
-
-A response to the <a href="#syncresultsrequest">SyncResultsRequest</a>. When `moreResults` is true, a <a href="#fetchrequest">FetchRequest</a>
-should be issued to get the next batch of records. When `missingStatement` is true, the statement must be re-created using <a href="#preparerequest">PrepareRequest</a>
-or the appropriate Request for a DDL request (e.g. <a href="#catalogsrequest">CatalogsRequest</a> or <a href="#schemasrequest">SchemasRequest</a>).
-
-{% highlight protobuf %}
-message SyncResultsResponse {
-  bool missing_statement = 1;
-  bool more_results = 2;
-  RpcMetadata metadata = 3;
-}
-{% endhighlight %}
-
-`more_results` A boolean which denotes if results exist for the ResultSet being "synced" per the request.
-
-`missing_statement` A boolean which denotes if the statement for the ResultSet still exists.
-
-`metadata` <a href="#rpcmetadata">Server metadata</a> about this call.
-
-## Miscellaneous
-
-### AvaticaParameter
-
-This object describes the "simple", or scalar, JDBC type representation of a column in a result. This does not include
-complex types such as arrays.
-
-{% highlight protobuf %}
-message AvaticaParameter {
-  bool signed = 1;
-  uint32 precision = 2;
-  uint32 scale = 3;
-  uint32 parameter_type = 4;
-  string class_name = 5;
-  string class_name = 6;
-  string name = 7;
-}
-{% endhighlight %}
-
-`signed` A boolean denoting whether the column is a signed numeric.
-
-`precision` The maximum numeric precision supported by this column.
-
-`scale` The maximum numeric scale supported by this column.
-
-`parameter_type` An integer corresponding to the JDBC Types class denoting the column's type.
-
-`type_name` The JDBC type name for this column.
-
-`class_name` The Java class backing the JDBC type for this column.
-
-`name` The name of the column.
-
-### AvaticaSeverity
-
-This enumeration describes the various levels of concern for an error in the Avatica server.
-
-{% highlight protobuf %}
-enum Severity {
-  UNKNOWN_SEVERITY = 0;
-  FATAL_SEVERITY = 1;
-  ERROR_SEVERITY = 2;
-  WARNING_SEVERITY = 3;
-}
-{% endhighlight %}
-
-### AvaticaType
-
-This object describes a simple or complex type for a column. Complex types will contain
-additional information in the `component` or `columns` attribute which describe the nested
-types of the complex parent type.
-
-{% highlight protobuf %}
-message AvaticaType {
-  uint32 id = 1;
-  string name = 2;
-  Rep rep = 3;
-  repeated ColumnMetaData columns = 4;
-  AvaticaType component = 5;
-}
-{% endhighlight %}
-
-`type` One of: `scalar`, `array`, `struct`.
-
-`id` A numeric value corresponding to the type of the object per the JDBC Types class.
-
-`name` The readable name of the JDBC type.
-
-`rep` A nested <a href="#rep">Rep</a> object used by Avatica to hold additional type information.
-
-`columns` For `STRUCT` types, a list of the columns contained in that `STRUCT`.
-
-`component` For `ARRAY` types, the type of the elements contained in that `ARRAY`.
-
-### ColumnMetaData
-
-This object represents the JDBC ResultSetMetaData for a column.
-
-{% highlight protobuf %}
-message ColumnMetaData {
-  uint32 ordinal = 1;
-  bool auto_increment = 2;
-  bool case_sensitive = 3;
-  bool searchable = 4;
-  bool currency = 5;
-  uint32 nullable = 6;
-  bool signed = 7;
-  uint32 display_size = 8;
-  string label = 9;
-  string column_name = 10;
-  string schema_name = 11;
-  uint32 precision = 12;
-  uint32 scale = 13;
-  string table_name = 14;
-  string catalog_name = 15;
-  bool read_only = 16;
-  bool writable = 17;
-  bool definitely_writable = 18;
-  string column_class_name = 19;
-  AvaticaType type = 20;
-}
-{% endhighlight %}
-
-`ordinal` A positional offset number.
-
-`auto_increment` A boolean denoting whether the column is automatically incremented.
-
-`case_sensitive` A boolean denoting whether the column is case sensitive.
-
-`searchable` A boolean denoting whether this column supports all WHERE search clauses.
-
-`currency` A boolean denoting whether this column represents currency.
-
-`nullable` A number denoting whether this column supports null values.
-
-* 0 = No null values are allowed
-* 1 = Null values are allowed
-* 2 = It is unknown if null values are allowed
-
-`signed` A boolean denoting whether the column is a signed numeric.
-
-`display_size` The character width of the column.
-
-`label` A description for this column.
-
-`column_name` The name of the column.
-
-`schema_name` The schema to which this column belongs.
-
-`precision` The maximum numeric precision supported by this column.
-
-`scale` The maximum numeric scale supported by this column.
-
-`table_name` The name of the table to which this column belongs.
-
-`catalog_name` The name of the catalog to which this column belongs.
-
-`type` A nested <a href="#avaticatype">AvaticaType</a> representing the type of the column.
-
-`read_only` A boolean denoting whether the column is read-only.
-
-`writable` A boolean denoting whether the column is possible to be updated.
-
-`definitely_writable` A boolean denoting whether the column definitely can be updated.
-
-`column_class_name` The name of the Java class backing the column's type.
-
-### ConnectionProperties
-
-This object represents the properties for a given JDBC Connection.
-
-{% highlight protobuf %}
-message ConnectionProperties {
-  bool is_dirty = 1;
-  bool auto_commit = 2;
-  bool has_auto_commit = 7;
-  bool read_only = 3;
-  bool has_read_only = 8;
-  uint32 transaction_isolation = 4;
-  string catalog = 5;
-  string schema = 6;
-}
-{% endhighlight %}
-
-`is_dirty` A boolean denoting if the properties have been altered.
-
-`auto_commit` A boolean denoting if autoCommit is enabled for transactions.
-
-`has_auto_commit` A boolean denoting if `auto_commit` was set.
-
-`read_only` A boolean denoting if a JDBC connection is read-only.
-
-`has_read_only` A boolean denoting if `read_only` was set.
-
-`transaction_isolation` An integer which denotes the level of transactions isolation per the JDBC
-specification. This value is analogous to the values defined in `java.sql.Connection`.
-
-* 0 = Transactions are not supported
-* 1 = Dirty reads, non-repeatable reads and phantom reads may occur.
-* 2 = Dirty reads are prevented, but non-repeatable reads and phantom reads may occur.
-* 4 = Dirty reads and non-repeatable reads are prevented, but phantom reads may occur.
-* 8 = Dirty reads, non-repeatable reads, and phantom reads are all prevented.
-
-`catalog` The name of a catalog to use when fetching connection properties.
-
-`schema` The name of the schema to use when fetching connection properties.
-
-### CursorFactory
-
-This object represents the information required to cast untyped objects into the necessary type for some results.
-
-{% highlight protobuf %}
-message CursorFactory {
-  enum Style {
-    OBJECT = 0;
-    RECORD = 1;
-    RECORD_PROJECTION = 2;
-    ARRAY = 3;
-    LIST = 4;
-    MAP = 5;
-  }
-
-  Style style = 1;
-  string class_name = 2;
-  repeated string field_names = 3;
-}
-{% endhighlight %}
-
-`style` A string denoting the <a href="#style">Style</a> of the contained objects.
-
-`class_name` The name of the for `RECORD` or `RECORD_PROJECTION`.
-
-### DatabaseProperty
-
-This object represents the exposed database properties for a Connection through the Avatica server.
-
-{% highlight protobuf %}
-message DatabaseProperty {
-  string name = 1;
-  repeated string functions = 2;
-}
-{% endhighlight %}
-
-`name` The name of the database property.
-
-`functions` A collection of values for the property.
-
-### Frame
-
-This object represents a batch of results, tracking the offset into the results and whether more results still exist
-to be fetched in the Avatica server.
-
-{% highlight protobuf %}
-message Frame {
-  uint64 offset = 1;
-  bool done = 2;
-  repeated Row rows = 3;
-}
-{% endhighlight %}
-
-`offset` The starting position of these `rows` in the encompassing result set.
-
-`done` A boolean denoting whether more results exist for this result set.
-
-`rows` A collection of <a href="#row">Row</a>s.
-
-### Row
-
-This object represents a row in a relational database table.
-
-{% highlight protobuf %}
-message Row {
-  repeated ColumnValue value = 1;
-}
-{% endhighlight %}
-
-`value` A collection of <a href="#columnvalue">ColumnValue</a>s, the columns in the row.
-
-### ColumnValue
-
-{% highlight protobuf %}
-message ColumnValue {
-  repeated TypedValue value = 1; // Deprecated!
-  repeated ColumnValue array_value = 2;
-  boolean has_array_value = 3;
-  TypedValue scalar_value = 4;
-}
-{% endhighlight %}
-
-`value` The pre Calcite-1.6 means of serializing <a href="#typedvalue">TypedValue</a>s. Not used anymore.
-
-`array_value` The value of this column if it is an array (not a scalar).
-
-`has_array_value` Should be set to true if `array_value` is set.
-
-`scalar_value` The value of this column if it is a scalar (not an array).
-
-### QueryState
-
-This object represents the way a ResultSet was created in the Avatica server. A ResultSet could be created by a user-provided
-SQL or by a DatabaseMetaData operation with arguments on that operation.
-
-{% highlight protobuf %}
-message QueryState {
-  StateType type = 1;
-  string sql = 2;
-  MetaDataOperation op = 3;
-  repeated MetaDataOperationArgument args = 4;
-  bool has_args = 5;
-  bool has_sql = 6;
-  bool has_op = 7;
-}
-{% endhighlight %}
-
-`type` A <a href="#statetype">StateType</a> object denoting what type of operation backs the ResultSet for this query.
-
-`sql` The SQL statement which created the ResultSet for this query. Required if the `type` is `SQL`.
-
-`op` The DML operation which created the ResultSet for this query. Required if the `type` is `METADATA`.
-
-`args` The arguments to the invoked DML operation. Required if the `type` is `METADATA`.
-
-`has_args` A boolean which denotes if the field `args` is provided.
-
-`has_sql` A boolean which denotes if the field `sql` is provided.
-
-`has_op` A boolean which denotes if the field `op` is provided.
-
-### Rep
-
-This enumeration represents the concrete Java type for some value.
-
-{% highlight protobuf %}
-enum Rep {
-  PRIMITIVE_BOOLEAN = 0;
-  PRIMITIVE_BYTE = 1;
-  PRIMITIVE_CHAR = 2;
-  PRIMITIVE_SHORT = 3;
-  PRIMITIVE_INT = 4;
-  PRIMITIVE_LONG = 5;
-  PRIMITIVE_FLOAT = 6;
-  PRIMITIVE_DOUBLE = 7;
-  BOOLEAN = 8;
-  BYTE = 9;
-  CHARACTER = 10;
-  SHORT = 11;
-  INTEGER = 12;
-  LONG = 13;
-  FLOAT = 14;
-  DOUBLE = 15;
-  BIG_INTEGER = 25;
-  BIG_DECIMAL = 26;
-  JAVA_SQL_TIME = 16;
-  JAVA_SQL_TIMESTAMP = 17;
-  JAVA_SQL_DATE = 18;
-  JAVA_UTIL_DATE = 19;
-  BYTE_STRING = 20;
-  STRING = 21;
-  NUMBER = 22;
-  OBJECT = 23;
-  NULL = 24;
-  ARRAY = 27;
-  STRUCT = 28;
-  MULTISET = 29;
-}
-{% endhighlight %}
-
-### RpcMetadata
-
-This object contains assorted per-call/contextual metadata returned by the Avatica server.
-
-{% highlight protobuf %}
-message RpcMetadata {
-  string server_address = 1;
-}
-{% endhighlight %}
-
-`serverAddress` The `host:port` of the server which created this object.
-
-### Signature
-
-This object represents the result of preparing a Statement in the Avatica server.
-
-{% highlight protobuf %}
-message Signature {
-  repeated ColumnMetaData columns = 1;
-  string sql = 2;
-  repeated AvaticaParameter parameters = 3;
-  CursorFactory cursor_factory = 4;
-  StatementType statementType = 5;
-}
-{% endhighlight %}
-
-`columns` An array of <a href="#columnmetadata">ColumnMetaData</a> objects denoting the schema of the result set.
-
-`sql` The SQL executed.
-
-`parameters` An array of <a href="#avaticaparameter">AvaticaParameter</a> objects denoting type-specific details.
-
-`cursor_factory` An <a href="#cursorfactory">CursorFactory</a> object representing the Java representation of the frame.
-
-`statementType` The type of the statement.
-
-### StateType
-
-This enumeration denotes whether user-provided SQL or a DatabaseMetaData operation was used to create some ResultSet.
-
-{% highlight protobuf %}
-enum StateType {
-  SQL = 0;
-  METADATA = 1;
-}
-{% endhighlight %}
-
-### StatementHandle
-
-This object encapsulates all of the information of a Statement created in the Avatica server.
-
-{% highlight protobuf %}
-message StatementHandle {
-  string connection_id = 1;
-  uint32 id = 2;
-  Signature signature = 3;
-}
-{% endhighlight %}
-
-`connection_id` The identifier of the connection to which this statement belongs.
-
-`id` The identifier of the statement.
-
-`signature` A <a href="#signature">Signature</a> object for the statement.
-
-### StatementType
-
-This message represents what kind the Statement is.
-
-{% highlight protobuf %}
-enum StatementType {
-  SELECT = 0;
-  INSERT = 1;
-  UPDATE = 2;
-  DELETE = 3;
-  UPSERT = 4;
-  MERGE = 5;
-  OTHER_DML = 6;
-  CREATE = 7;
-  DROP = 8;
-  ALTER = 9;
-  OTHER_DDL = 10;
-  CALL = 11;
-}
-{% endhighlight %}
-
-### Style
-
-This enumeration represents the generic "class" of type for a value. Defined within <a href="#cursorfactory">CursorFactory</a>.
-
-{% highlight protobuf %}
-enum Style {
-  OBJECT = 0;
-  RECORD = 1;
-  RECORD_PROJECTION = 2;
-  ARRAY = 3;
-  LIST = 4;
-  MAP = 5;
-}
-{% endhighlight %}
-
-### TypedValue
-
-This object encapsulates the type and value for a column in a row.
-
-{% highlight protobuf %}
-message TypedValue {
-  Rep type = 1;
-  bool bool_value = 2;
-  string string_value = 3;
-  sint64 number_value = 4;
-  bytes bytes_value = 5;
-  double double_value = 6;
-  bool null = 7;
-}
-{% endhighlight %}
-
-`type` A name referring to which attribute is populated with the column's value.
-
-`bool_value` A boolean value.
-
-`string_value` A character/string value.
-
-`number_value` A numeric value (non-`double`).
-
-`bytes_value` A byte-array value.
-
-`double_value` A `double` value.
-
-`null` A boolean which denotes if the value was null.
-
-The following chart documents how each <a href="#rep">Rep</a> value corresponds
-to the attributes in this message:
-
-| <a href="#rep">Rep</a> Value | <a href="#typedvalue">TypedValue</a> attribute | Description |
-| PRIMITIVE_BOOLEAN | `bool_value` ||
-| BOOLEAN | `bool_value` ||
-| PRIMITIVE_BYTE | `number_value` | The numeric value of the `byte`. |
-| BYTE | `number_value` ||
-| PRIMITIVE_CHAR | `string_value` ||
-| CHARACTER | `string_value` ||
-| PRIMITIVE_SHORT | `number_value` ||
-| SHORT | `number_value` ||
-| PRIMITIVE_INT | `number_value` ||
-| INTEGER | `number_value` ||
-| PRIMITIVE_LONG | `number_value` ||
-| LONG | `number_value` ||
-| PRIMITIVE_FLOAT | `number_value` ||
-| FLOAT | `number_value` | IEEE 754 floating-point "single format" bit layout. |
-| PRIMITIVE_DOUBLE | `number_value` ||
-| DOUBLE | `number_value` ||
-| BIG_INTEGER | `bytes_value` | The two's-complement representation of the BigInteger. See `BigInteger#toByteArray().` |
-| BIG_DECIMAL | `string_value` | A string-ified representation of the value. See `BigDecimal#toString()`. |
-| JAVA_SQL_TIME | `number_value` | As an integer, milliseconds since midnight. |
-| JAVA_SQL_DATE | `number_value` | As an integer, the number of days since the epoch. |
-| JAVA_SQL_TIMESTAMP | `number_value` | As a long, milliseconds since the epoch. |
-| JAVA_UTIL_DATE | `number_value` | As a long, milliseconds since the epoch. |
-| BYTE_STRING | `bytes_value` ||
-| STRING | `string_value` | This must be a UTF-8 string. |
-| NUMBER | `number_value` | A general number, unknown what concrete type. |
-| OBJECT | `null` | The only general Object we can serialize is "null". Non-null OBJECT's will throw an error. |
-| NULL | `null` ||
-| ARRAY | N/A | Unhandled. |
-| STRUCT | N/A | Unhandled. |
-| MULTISET | N/A | Unhandled. |
-
-### UpdateBatch
-
-This is a message which serves as a wrapper around a collection of <a href="#typedvalue">TypedValue</a>'s.
-
-{% highlight protobuf %}
-message UpdateBatch {
-  repeated TypedValue parameter_values = 1;
-}
-{% endhighlight %}
-
-`parameter_values` A collection of parameter values for one SQL command update.
-
-### WireMessage
-
-This message wraps all `Request`s and `Response`s.
-
-{% highlight protobuf %}
-message WireMessage {
-  string name = 1;
-  bytes wrapped_message = 2;
-}
-{% endhighlight %}
-
-`name` The Java class name of the wrapped message.
-
-`wrapped_message` A serialized representation of the wrapped message of the same type specified by `name`.

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/site/_docs/roadmap.md
----------------------------------------------------------------------
diff --git a/avatica/site/_docs/roadmap.md b/avatica/site/_docs/roadmap.md
deleted file mode 100644
index 30618ee..0000000
--- a/avatica/site/_docs/roadmap.md
+++ /dev/null
@@ -1,51 +0,0 @@
----
-layout: docs
-title: Roadmap
-sidebar_title: Roadmap
-permalink: /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 %}
--->
-
-## Status
-
-### Implemented
-
-* Create connection, create statement, metadata, prepare, bind, execute, fetch
-* RPC using JSON over HTTP
-* Local implementation
-* Implementation over an existing JDBC driver
-* Composite RPCs (combining several requests into one round trip)
-  * Execute-Fetch
-  * Metadata-Fetch (metadata calls such as getTables return all rows)
-
-### Not implemented
-
-* ODBC
-* RPCs
-  * CloseStatement
-  * CloseConnection
-* Composite RPCs
-  * CreateStatement-Prepare
-  * CloseStatement-CloseConnection
-  * Prepare-Execute-Fetch (Statement.executeQuery should fetch first N rows)
-* Remove statements from statement table
-* DML (INSERT, UPDATE, DELETE)
-* Statement.execute applied to SELECT statement

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/site/_docs/security.md
----------------------------------------------------------------------
diff --git a/avatica/site/_docs/security.md b/avatica/site/_docs/security.md
deleted file mode 100644
index 306ace0..0000000
--- a/avatica/site/_docs/security.md
+++ /dev/null
@@ -1,253 +0,0 @@
----
-layout: docs
-title: Security
-sidebar_title: Security
-permalink: /docs/security.html
-auth_types:
-  - { name: "HTTP Basic", anchor: "http-basic-authentication" }
-  - { name: "HTTP Digest", anchor: "http-digest-authentication" }
-  - { name: "Kerberos with SPNEGO", anchor: "kerberos-with-spnego-authentication" }
-  - { name: "Client implementation", anchor: "client-implementation" }
----
-<!--
-{% 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 %}
--->
-
-Security is an important topic between clients and the Avatica server. Most JDBC
-drivers and databases implement some level of authentication and authorization
-for limit what actions clients are allowed to perform.
-
-Similarly, Avatica must limit what users are allowed to connect and interact
-with the server. Avatica must primarily deal with authentication while authorization
-is deferred to the underlying database. By default, Avatica provides no authentication.
-Avatica does have the ability to perform client authentication using Kerberos,
-HTTP Basic, and HTTP Digest.
-
-The authentication and authorization provided by Avatica are designed for use
-*instead* of the authentication and authorization provided by the underlying database.
-The typical `user` and `password` JDBC properties are **always** passed through to
-the Avatica server which will cause the server to enforce those credentials. As such,
-Avatica's authentication types mentioned here only have relevance when the underlying database's authentication
-and authorization features are not used. (The Kerberos/SPNEGO integration is one difference as the impersonation feature
-is specifically designed to allow the Kerberos identity to be passed to the database -
-new advanced implementations could also follow this same approach if desired).
-
-## Table of Contents
-<ul>
-  {% for item in page.auth_types %}<li><a href="#{{ item.anchor }}">{{ item.name }}</a></li>{% endfor %}
-</ul>
-
-
-## HTTP Basic Authentication
-
-Avatica supports authentication over [HTTP Basic](https://en.wikipedia.org/wiki/Basic_access_authentication).
-This is simple username-password based authentication which is ultimately insecure when
-operating over an untrusted network. Basic authentication is only secure when the transport
-is encrypted (e.g. TLS) as the credentials are passed in the clear. This authentication is
-supplementary to the provided JDBC authentication. If credentials are passed to the database
-already, this authentication is unnecessary.
-
-### Enabling Basic Authentication
-
-{% highlight java %}
-String propertiesFile = "/path/to/jetty-users.properties";
-// All roles allowed
-String[] allowedRoles = new String[]  {"*"};
-// Only specific roles are allowed
-allowedRoles = new String[] { "users", "admins" };
-HttpServer server = new HttpServer.Builder()
-    .withPort(8765)
-    .withHandler(new LocalService(), Driver.Serialization.PROTOBUF)
-    .withBasicAuthentication(propertiesFile, allowedRoles)
-    .build();
-{% endhighlight %}
-
-The properties file must be in a form consumable by Jetty. Each line in this
-file is of the form: `username: password[,rolename ...]`
-
-For example:
-
-{% highlight properties %}
-bob: b0b5pA55w0rd,users
-steve: 5teve5pA55w0rd,users
-alice: Al1cepA55w0rd,admins
-{% endhighlight %}
-
-Passwords can also be obfuscated as MD5 hashes or oneway cryptography ("CRYPT").
-For more information, see the [official Jetty documentation](http://www.eclipse.org/jetty/documentation/current/configuring-security-secure-passwords.html).
-
-## HTTP Digest Authentication
-
-Avatica also supports [HTTP Digest](https://en.wikipedia.org/wiki/Digest_access_authentication).
-This is desirable for Avatica as it does not require the use of TLS to secure communication
-between the Avatica client and server. It is configured very similarly to HTTP Basic
-authentication. This authentication is supplementary to the provided JDBC authentication.
-If credentials are passed to the database already, this authentication is unnecessary.
-
-### Enabling Digest Authentication
-
-{% highlight java %}
-String propertiesFile = "/path/to/jetty-users.properties";
-// All roles allowed
-String[] allowedRoles = new String[]  {"*"};
-// Only specific roles are allowed
-allowedRoles = new String[] { "users", "admins" };
-HttpServer server = new HttpServer.Builder()
-    .withPort(8765)
-    .withHandler(new LocalService(), Driver.Serialization.PROTOBUF)
-    .withDigestAuthentication(propertiesFile, allowedRoles)
-    .build();
-{% endhighlight %}
-
-The properties file must be in a form consumable by Jetty. Each line in this
-file is of the form: `username: password[,rolename ...]`
-
-For example:
-
-{% highlight properties %}
-bob: b0b5pA55w0rd,users
-steve: 5teve5pA55w0rd,users
-alice: Al1cepA55w0rd,admins
-{% endhighlight %}
-
-Passwords can also be obfuscated as MD5 hashes or oneway cryptography ("CRYPT").
-For more information, see the [official Jetty documentation](http://www.eclipse.org/jetty/documentation/current/configuring-security-secure-passwords.html).
-
-## Kerberos with SPNEGO Authentication
-
-Because Avatica operates over an HTTP interface, the simple and protected GSSAPI
-negotiation mechanism ([SPNEGO](https://en.wikipedia.org/wiki/SPNEGO)) is a logical
-choice. This mechanism makes use of the "HTTP Negotiate" authentication extension to
-communicate with the Kerberos Key Distribution Center (KDC) to authenticate a client.
-
-### Enabling SPNEGO/Kerberos Authentication in servers
-
-The Avatica server can operate either by performing the login using
-a JAAS configuration file or login programmatically. By default, authenticated clients
-will have queries executed as the Avatica server's kerberos user. [Impersonation](#impersonation)
-is the feature which enables actions to be run in the server as the actual end-user.
-
-As a note, it is required that the Kerberos principal in use by the Avatica server
-**must** have an primary of `HTTP` (where Kerberos principals are of the form
-`primary[/instance]@REALM`). This is specified by [RFC-4559](https://tools.ietf.org/html/rfc4559).
-
-#### Programmatic Login
-
-This approach requires no external file configurations and only requires a
-keytab file for the principal.
-
-{% highlight java %}
-HttpServer server = new HttpServer.Builder()
-    .withPort(8765)
-    .withHandler(new LocalService(), Driver.Serialization.PROTOBUF)
-    .withSpnego("HTTP/host.domain.com@DOMAIN.COM")
-    .withAutomaticLogin(
-        new File("/etc/security/keytabs/avatica.spnego.keytab"))
-    .build();
-{% endhighlight %}
-
-#### JAAS Configuration File Login
-
-A JAAS configuration file can be set via the system property `java.security.auth.login.config`.
-The user must set this property when launching their Java application invoking the Avatica server.
-The presence of this file will automatically perform login as necessary in the first use
-of the Avatica server. The invocation is nearly the same as the programmatic login.
-
-{% highlight java %}
-HttpServer server = new HttpServer.Builder()
-    .withPort(8765)
-    .withHandler(new LocalService(), Driver.Serialization.PROTOBUF)
-    .withSpnego("HTTP/host.domain.com@DOMAIN.COM")
-    .build();
-{% endhighlight %}
-
-The contents of the JAAS configuration file are very specific:
-
-{% highlight java %}
-com.sun.security.jgss.accept  {
-  com.sun.security.auth.module.Krb5LoginModule required
-  storeKey=true
-  useKeyTab=true
-  keyTab=/etc/security/keytabs/avatica.spnego.keyTab
-  principal=HTTP/host.domain.com@DOMAIN.COM;
-};
-{% endhighlight %}
-
-Ensure the `keyTab` and `principal` attributes are set correctly for your system.
-
-### Impersonation
-
-Impersonation is a feature of the Avatica server which allows the Avatica clients
-to execute the server-side calls (e.g. the underlying JDBC calls). Because the details
-on what it means to execute such an operation are dependent on the actual system, a
-callback is exposed for downstream integrators to implement.
-
-For example, the following is an example for creating an Apache Hadoop `UserGroupInformation`
-"proxy user". This example takes a `UserGroupInformation` object representing the Avatica server's
-identity, creates a "proxy user" with the client's username, and performs the action as that
-client but using the server's identity.
-
-{% highlight java %}
-public class PhoenixDoAsCallback implements DoAsRemoteUserCallback {
-  private final UserGroupInformation serverUgi;
-
-  public PhoenixDoAsCallback(UserGroupInformation serverUgi) {
-    this.serverUgi = Objects.requireNonNull(serverUgi);
-  }
-
-  @Override
-  public <T> T doAsRemoteUser(String remoteUserName, String remoteAddress, final Callable<T> action) throws Exception {
-    // Proxy this user on top of the server's user (the real user)
-    UserGroupInformation proxyUser = UserGroupInformation.createProxyUser(remoteUserName, serverUgi);
-
-    // Check if this user is allowed to be impersonated.
-    // Will throw AuthorizationException if the impersonation as this user is not allowed
-    ProxyUsers.authorize(proxyUser, remoteAddress);
-
-    // Execute the actual call as this proxy user
-    return proxyUser.doAs(new PrivilegedExceptionAction<T>() {
-      @Override
-      public T run() throws Exception {
-        return action.call();
-      }
-    });
-  }
-}
-{% endhighlight %}
-
-## Client implementation
-
-Many HTTP client libraries, such as [Apache Commons HttpComponents](https://hc.apache.org/), already have
-support for performing Basic, Digest, and SPNEGO authentication. When in doubt, refer to one of
-these implementations as it is likely correct.
-
-### SPNEGO
-
-For information on building SPNEGO support by hand, consult [RFC-4559](https://tools.ietf.org/html/rfc4559)
-which describes how the authentication handshake, through use of the "WWW-authenticate=Negotiate"
-HTTP header, is used to authenticate a client.
-
-### Password-based
-
-For both HTTP Basic and Digest authentication, the [avatica_user]({{site.baseurl}}/docs/client_reference.html#avatica-user)
-and [avatica_password]({{site.baseurl}}/docs/client_reference.html#avatica-password)
-properties are used to identify the client with the server. If the underlying database
-(the JDBC driver inside the Avatica server) require their own user and password combination,
-these are set via the traditional "user" and "password" properties in the Avatica
-JDBC driver. This also implies that adding HTTP-level authentication in Avatica is likely
-superfluous.

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/site/_docs/testapi.md
----------------------------------------------------------------------
diff --git a/avatica/site/_docs/testapi.md b/avatica/site/_docs/testapi.md
deleted file mode 100644
index 6e86025..0000000
--- a/avatica/site/_docs/testapi.md
+++ /dev/null
@@ -1,28 +0,0 @@
----
-title: Test API
-layout: external
-external_url: /avatica/testapidocs
----
-{% comment %}
-Ideally, we want to use {{ site.apiRoot }} instead of hardcoding
-the above external_url value, but I don't believe there's a way to do that
-{% endcomment %}
-
-<!--
-{% 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-avatica/blob/fc7b26c8/avatica/site/_includes/anchor_links.html
----------------------------------------------------------------------
diff --git a/avatica/site/_includes/anchor_links.html b/avatica/site/_includes/anchor_links.html
deleted file mode 100644
index c584ce5..0000000
--- a/avatica/site/_includes/anchor_links.html
+++ /dev/null
@@ -1,33 +0,0 @@
-<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-avatica/blob/fc7b26c8/avatica/site/_includes/docs_contents.html
----------------------------------------------------------------------
diff --git a/avatica/site/_includes/docs_contents.html b/avatica/site/_includes/docs_contents.html
deleted file mode 100644
index 2ac64bb..0000000
--- a/avatica/site/_includes/docs_contents.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<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-avatica/blob/fc7b26c8/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
deleted file mode 100644
index b3e0110..0000000
--- a/avatica/site/_includes/docs_contents_mobile.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<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\u2026</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-avatica/blob/fc7b26c8/avatica/site/_includes/docs_option.html
----------------------------------------------------------------------
diff --git a/avatica/site/_includes/docs_option.html b/avatica/site/_includes/docs_option.html
deleted file mode 100644
index 8c61578..0000000
--- a/avatica/site/_includes/docs_option.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{% 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-avatica/blob/fc7b26c8/avatica/site/_includes/docs_ul.html
----------------------------------------------------------------------
diff --git a/avatica/site/_includes/docs_ul.html b/avatica/site/_includes/docs_ul.html
deleted file mode 100644
index 1010531..0000000
--- a/avatica/site/_includes/docs_ul.html
+++ /dev/null
@@ -1,30 +0,0 @@
-{% 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 item_url2 %}{{site.baseurl}}{{ item | prepend:"/docs/" | append:"/" }}{% 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 %}{% comment %}
-    {% endcomment %}{% capture p_url %}{{site.baseurl}}{{p.url}}{% endcapture %}{% comment %}
-    {% endcomment %}{% if p.sidebar_title != nil %}{% comment %}
-      {% endcomment %}{% assign anchor_text = p.sidebar_title %}{% comment %}
-    {% endcomment %}{% else %}{% comment %}
-      {% endcomment %}{% assign anchor_text = p.title %}{% comment %}
-    {% endcomment %}{% endif %}{% comment %}
-    {% endcomment %}{% if p_url == item_url or p_url == item_url2 %}{% comment %}
-      {% endcomment %}<li class="{{ c }}"><a href="{{ p_url }}">{{ anchor_text }}</a></li>{% comment %}
-      {% endcomment %}{% break %}{% comment %}
-    {% endcomment %}{% endif %}{% comment %}
-  {% endcomment %}{% endfor %}
-
-{% endfor %}
-</ul>

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/site/_includes/footer.html
----------------------------------------------------------------------
diff --git a/avatica/site/_includes/footer.html b/avatica/site/_includes/footer.html
deleted file mode 100644
index f965817..0000000
--- a/avatica/site/_includes/footer.html
+++ /dev/null
@@ -1,15 +0,0 @@
-<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-avatica/blob/fc7b26c8/avatica/site/_includes/header.html
----------------------------------------------------------------------
diff --git a/avatica/site/_includes/header.html b/avatica/site/_includes/header.html
deleted file mode 100644
index cff1a33..0000000
--- a/avatica/site/_includes/header.html
+++ /dev/null
@@ -1,18 +0,0 @@
-<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 Avatica</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-avatica/blob/fc7b26c8/avatica/site/_includes/news_contents.html
----------------------------------------------------------------------
diff --git a/avatica/site/_includes/news_contents.html b/avatica/site/_includes/news_contents.html
deleted file mode 100644
index ad6b7a4..0000000
--- a/avatica/site/_includes/news_contents.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<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/">Avatica 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 %}{% comment %}
-          {% endcomment %}{% unless post.categories contains 'release' %}
-        <li class="{% if page.title == post.title %}current{% endif %}">
-          <a href="{{ site.baseurl }}{{ post.url }}">{{ post.title }}</a>
-        </li>
-          {% endunless %}{% comment %}
-        {% endcomment %}{% endfor %}
-    </ul>
-  </aside>
-</div>

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/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
deleted file mode 100644
index 094da46..0000000
--- a/avatica/site/_includes/news_contents_mobile.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<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\u2026</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-avatica/blob/fc7b26c8/avatica/site/_includes/news_item.html
----------------------------------------------------------------------
diff --git a/avatica/site/_includes/news_item.html b/avatica/site/_includes/news_item.html
deleted file mode 100644
index 34eea0b..0000000
--- a/avatica/site/_includes/news_item.html
+++ /dev/null
@@ -1,62 +0,0 @@
-{% 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-avatica/blob/fc7b26c8/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
deleted file mode 100644
index 687cdd2..0000000
--- a/avatica/site/_includes/primary-nav-items.html
+++ /dev/null
@@ -1,20 +0,0 @@
-<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-avatica/blob/fc7b26c8/avatica/site/_includes/section_nav.html
----------------------------------------------------------------------
diff --git a/avatica/site/_includes/section_nav.html b/avatica/site/_includes/section_nav.html
deleted file mode 100644
index b025a70..0000000
--- a/avatica/site/_includes/section_nav.html
+++ /dev/null
@@ -1,39 +0,0 @@
-{% 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-avatica/blob/fc7b26c8/avatica/site/_includes/top.html
----------------------------------------------------------------------
diff --git a/avatica/site/_includes/top.html b/avatica/site/_includes/top.html
deleted file mode 100644
index 6eab814..0000000
--- a/avatica/site/_includes/top.html
+++ /dev/null
@@ -1,15 +0,0 @@
-<!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-avatica/blob/fc7b26c8/avatica/site/_layouts/default.html
----------------------------------------------------------------------
diff --git a/avatica/site/_layouts/default.html b/avatica/site/_layouts/default.html
deleted file mode 100644
index f734c79..0000000
--- a/avatica/site/_layouts/default.html
+++ /dev/null
@@ -1,12 +0,0 @@
-{% 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-avatica/blob/fc7b26c8/avatica/site/_layouts/docs.html
----------------------------------------------------------------------
diff --git a/avatica/site/_layouts/docs.html b/avatica/site/_layouts/docs.html
deleted file mode 100644
index a0a8a5c..0000000
--- a/avatica/site/_layouts/docs.html
+++ /dev/null
@@ -1,23 +0,0 @@
----
-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-avatica/blob/fc7b26c8/avatica/site/_layouts/external.html
----------------------------------------------------------------------
diff --git a/avatica/site/_layouts/external.html b/avatica/site/_layouts/external.html
deleted file mode 100644
index b934309..0000000
--- a/avatica/site/_layouts/external.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<!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-avatica/blob/fc7b26c8/avatica/site/_layouts/news.html
----------------------------------------------------------------------
diff --git a/avatica/site/_layouts/news.html b/avatica/site/_layouts/news.html
deleted file mode 100644
index 8f7945f..0000000
--- a/avatica/site/_layouts/news.html
+++ /dev/null
@@ -1,19 +0,0 @@
----
-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-avatica/blob/fc7b26c8/avatica/site/_layouts/news_item.html
----------------------------------------------------------------------
diff --git a/avatica/site/_layouts/news_item.html b/avatica/site/_layouts/news_item.html
deleted file mode 100644
index e91e9e5..0000000
--- a/avatica/site/_layouts/news_item.html
+++ /dev/null
@@ -1,49 +0,0 @@
----
-layout: news
----
-
-<article>
-  <h2>
-    {{ page.title }}
-    <a href="{{ page.url }}" class="permalink" title="Permalink">\u221e</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-avatica/blob/fc7b26c8/avatica/site/_layouts/page.html
----------------------------------------------------------------------
diff --git a/avatica/site/_layouts/page.html b/avatica/site/_layouts/page.html
deleted file mode 100644
index bae31bb..0000000
--- a/avatica/site/_layouts/page.html
+++ /dev/null
@@ -1,18 +0,0 @@
----
-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-avatica/blob/fc7b26c8/avatica/site/_plugins/bundler.rb
----------------------------------------------------------------------
diff --git a/avatica/site/_plugins/bundler.rb b/avatica/site/_plugins/bundler.rb
deleted file mode 100644
index 1cdec10..0000000
--- a/avatica/site/_plugins/bundler.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# 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-avatica/blob/fc7b26c8/avatica/site/_posts/2016-03-03-separate-project.md
----------------------------------------------------------------------
diff --git a/avatica/site/_posts/2016-03-03-separate-project.md b/avatica/site/_posts/2016-03-03-separate-project.md
deleted file mode 100644
index 518c69e..0000000
--- a/avatica/site/_posts/2016-03-03-separate-project.md
+++ /dev/null
@@ -1,34 +0,0 @@
----
-layout: news_item
-title: "Splitting Avatica from Calcite"
-date: "2016-03-03 23:57:33 -0500"
-author: elserj
-categories: [milestones]
----
-<!--
-{% 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 marks the separation of Avatica from its previous location as a sub-module
-of Apache Calcite's Maven build.
-
-This separation is not to remove Avatica from
-the governance of the Apache Calcite project, but to allow for even more rapid
-releases from both the Avatica and Calcite projects. We can confidently make new
-releases of each without having to worry about the current state of development
-features in the other.

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/site/_posts/2016-03-18-release-1.7.1.md
----------------------------------------------------------------------
diff --git a/avatica/site/_posts/2016-03-18-release-1.7.1.md b/avatica/site/_posts/2016-03-18-release-1.7.1.md
deleted file mode 100644
index 7ee678c..0000000
--- a/avatica/site/_posts/2016-03-18-release-1.7.1.md
+++ /dev/null
@@ -1,87 +0,0 @@
----
-layout: news_item
-date: "2016-03-18 12:00:00 +0000"
-author: elserj
-version: 1.7.1
-categories: [release]
-tag: v1-7-1
-sha: 11cb0a8
----
-<!--
-{% comment %}
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements.  See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License.  You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-{% endcomment %}
--->
-
-Apache Calcite's PMC has just released Avatica 1.7.1, the first
-release of [Avatica](http://calcite.apache.org/avatica/) as an
-independent project. We're excited because it makes Avatica easier to
-use, and allows us to be more agile in our release schedule.
-
-(Avatica was previously released as part of Calcite. Avatica is still
-governed by Apache Calcite's PMC, and stored in the same git
-repository as Calcite, but releases are no longer synchronized, and
-Avatica does not depend on any Calcite modules.)
-
-A significant portion of the work of this release was "Maven work" to
-separate the build and release processes, but there were several
-important bug fixes, including a security fix for Jetty (see below).
-
-Performance, specifically on the write path, was a big focus in this
-release.
-[[CALCITE-1091](https://issues.apache.org/jira/browse/CALCITE-1091)]
-contained a number of important changes. Some of these changes (e.g.
-[[CALCITE-1092](https://issues.apache.org/jira/browse/CALCITE-1092)]
-and
-[[CALCITE-1093](https://issues.apache.org/jira/browse/CALCITE-1093)])
-were related to heap usage in the Avatica server, while
-[[CALCITE-1094](https://issues.apache.org/jira/browse/CALCITE-1094)]
-and
-[[CALCITE-1117](https://issues.apache.org/jira/browse/CALCITE-1117)]
-were strictly performance-related.
-
-The latter improved performance the most. Switching to the
-[Apache Commons HttpComponents Client](http://hc.apache.org/)
-library instead of using the Java platform's built-in
-[HttpURLConnection](https://docs.oracle.com/javase/7/docs/api/java/net/HttpURLConnection.html),
-we noticed a 15% improvement in pure write workloads.
-
-Three dependent library upgrades:
-
-* We completely removed
-  [Commons Logging](https://commons.apache.org/proper/commons-logging/)
-  in favor of [SLF4J](http://slf4j.org/) in
-  [[CALCITE-669](https://issues.apache.org/jira/browse/CALCITE-669)].
-  This logging framework update will allow downstream integrators to
-  use the logging implementation of their choice instead of being
-  forced to inherit Commons Logging.
-* We upgraded Jackson from 2.1.1 to 2.6.3 in
-  [[CALCITE-1021](https://issues.apache.org/jira/browse/CALCITE-1021)].
-* We upgraded Jetty from 9.2.7.v20150116 to 9.2.15.v20160210 in
-  [[CALCITE-1156](https://issues.apache.org/jira/browse/CALCITE-1156)]
-  to fix a
-  [security issue](https://blog.gdssecurity.com/labs/2015/2/25/jetleak-vulnerability-remote-leakage-of-shared-buffers-in-je.html).
-
-Note that Avatica's Maven coordinates have changed. The `groupId` is
-now "org.apache.calcite.avatica" (previously "org.apache.calcite"),
-and `artifactId`s are
-"avatica",
-"avatica-metrics",
-"avatica-metrics-dropwizardmetrics3",
-"avatica-noop-driver",
-"avatica-server"
-(previously "calcite-avatica", etc.). Make sure to update these when
-upgrading to this version.


[03/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/impl/package-info.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/impl/package-info.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/impl/package-info.java
deleted file mode 100644
index b1b2aad..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/impl/package-info.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * Calcite-specific classes for implementation of regular and window aggregates.
- */
-@PackageMarker
-package org.apache.calcite.adapter.enumerable.impl;
-
-import org.apache.calcite.avatica.util.PackageMarker;
-
-// End package-info.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/package-info.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/package-info.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/package-info.java
deleted file mode 100644
index 5d29f8b..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/package-info.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * Query optimizer rules for Java calling convention.
- */
-@PackageMarker
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.avatica.util.PackageMarker;
-
-// End package-info.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/java/AbstractQueryableTable.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/java/AbstractQueryableTable.java b/core/src/main/java/org/apache/calcite/adapter/java/AbstractQueryableTable.java
deleted file mode 100644
index 5cb7b82..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/java/AbstractQueryableTable.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.java;
-
-import org.apache.calcite.linq4j.tree.Expression;
-import org.apache.calcite.schema.QueryableTable;
-import org.apache.calcite.schema.SchemaPlus;
-import org.apache.calcite.schema.Schemas;
-import org.apache.calcite.schema.impl.AbstractTable;
-
-import java.lang.reflect.Type;
-
-/**
- * Abstract base class for implementing {@link org.apache.calcite.schema.Table}.
- */
-public abstract class AbstractQueryableTable extends AbstractTable
-    implements QueryableTable {
-  protected final Type elementType;
-
-  protected AbstractQueryableTable(Type elementType) {
-    super();
-    this.elementType = elementType;
-  }
-
-  public Type getElementType() {
-    return elementType;
-  }
-
-  public Expression getExpression(SchemaPlus schema, String tableName,
-      Class clazz) {
-    return Schemas.tableExpression(schema, elementType, tableName, clazz);
-  }
-}
-
-// End AbstractQueryableTable.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/java/Array.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/java/Array.java b/core/src/main/java/org/apache/calcite/adapter/java/Array.java
deleted file mode 100644
index 07b75b6..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/java/Array.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.java;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.FIELD;
-
-/**
- * Annotation that indicates that a field is an array type.
- */
-@Target({FIELD })
-@Retention(RetentionPolicy.RUNTIME)
-public @interface Array {
-  /** Component type. */
-  Class component();
-
-  /** Whether components may be null. */
-  boolean componentIsNullable() default false;
-
-  /** Maximum number of elements in the array. -1 means no maximum. */
-  long maximumCardinality() default -1L;
-}
-
-// End Array.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/java/JavaTypeFactory.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/java/JavaTypeFactory.java b/core/src/main/java/org/apache/calcite/adapter/java/JavaTypeFactory.java
deleted file mode 100644
index 205b391..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/java/JavaTypeFactory.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.java;
-
-import org.apache.calcite.rel.type.RelDataType;
-import org.apache.calcite.rel.type.RelDataTypeFactory;
-
-import java.lang.reflect.Type;
-import java.util.List;
-
-/**
- * Type factory that can register Java classes as record types.
- */
-public interface JavaTypeFactory extends RelDataTypeFactory {
-  /**
-   * Creates a record type based upon the public fields of a Java class.
-   *
-   * @param clazz Java class
-   * @return Record type that remembers its Java class
-   */
-  RelDataType createStructType(Class clazz);
-
-  /**
-   * Creates a type, deducing whether a record, scalar or primitive type
-   * is needed.
-   *
-   * @param type Java type, such as a {@link Class}
-   * @return Record or scalar type
-   */
-  RelDataType createType(Type type);
-
-  Type getJavaClass(RelDataType type);
-
-  /** Creates a synthetic Java class whose fields have the given Java
-   * types. */
-  Type createSyntheticType(List<Type> types);
-
-  /** Converts a type in Java format to a SQL-oriented type. */
-  RelDataType toSql(RelDataType type);
-}
-
-// End JavaTypeFactory.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/java/Map.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/java/Map.java b/core/src/main/java/org/apache/calcite/adapter/java/Map.java
deleted file mode 100644
index 10bfa57..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/java/Map.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.java;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.FIELD;
-
-/**
- * Annotation that indicates that a field is a map type.
- */
-@Target({FIELD })
-@Retention(RetentionPolicy.RUNTIME)
-public @interface Map {
-  /** Key type. */
-  Class key();
-
-  /** Value type. */
-  Class value();
-
-  /** Whether keys may be null. */
-  boolean keyIsNullable() default true;
-
-  /** Whether values may be null. */
-  boolean valueIsNullable() default true;
-}
-
-// End Map.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/java/ReflectiveSchema.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/java/ReflectiveSchema.java b/core/src/main/java/org/apache/calcite/adapter/java/ReflectiveSchema.java
deleted file mode 100644
index 91fe3e7..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/java/ReflectiveSchema.java
+++ /dev/null
@@ -1,362 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.java;
-
-import org.apache.calcite.DataContext;
-import org.apache.calcite.linq4j.Enumerable;
-import org.apache.calcite.linq4j.Enumerator;
-import org.apache.calcite.linq4j.Linq4j;
-import org.apache.calcite.linq4j.QueryProvider;
-import org.apache.calcite.linq4j.Queryable;
-import org.apache.calcite.linq4j.function.Function1;
-import org.apache.calcite.linq4j.tree.Expression;
-import org.apache.calcite.linq4j.tree.Expressions;
-import org.apache.calcite.linq4j.tree.Primitive;
-import org.apache.calcite.linq4j.tree.Types;
-import org.apache.calcite.rel.type.RelDataType;
-import org.apache.calcite.rel.type.RelDataTypeFactory;
-import org.apache.calcite.schema.Function;
-import org.apache.calcite.schema.ScannableTable;
-import org.apache.calcite.schema.Schema;
-import org.apache.calcite.schema.SchemaFactory;
-import org.apache.calcite.schema.SchemaPlus;
-import org.apache.calcite.schema.Schemas;
-import org.apache.calcite.schema.Statistic;
-import org.apache.calcite.schema.Statistics;
-import org.apache.calcite.schema.Table;
-import org.apache.calcite.schema.TableMacro;
-import org.apache.calcite.schema.TranslatableTable;
-import org.apache.calcite.schema.impl.AbstractSchema;
-import org.apache.calcite.schema.impl.AbstractTableQueryable;
-import org.apache.calcite.schema.impl.ReflectiveFunctionBase;
-import org.apache.calcite.util.BuiltInMethod;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableMultimap;
-import com.google.common.collect.Multimap;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Type;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Implementation of {@link org.apache.calcite.schema.Schema} that exposes the
- * public fields and methods in a Java object.
- */
-public class ReflectiveSchema
-    extends AbstractSchema {
-  private final Class clazz;
-  private Object target;
-
-  /**
-   * Creates a ReflectiveSchema.
-   *
-   * @param target Object whose fields will be sub-objects of the schema
-   */
-  public ReflectiveSchema(Object target) {
-    super();
-    this.clazz = target.getClass();
-    this.target = target;
-  }
-
-  @Override public String toString() {
-    return "ReflectiveSchema(target=" + target + ")";
-  }
-
-  /** Returns the wrapped object.
-   *
-   * <p>May not appear to be used, but is used in generated code via
-   * {@link org.apache.calcite.util.BuiltInMethod#REFLECTIVE_SCHEMA_GET_TARGET}.
-   */
-  public Object getTarget() {
-    return target;
-  }
-
-  @Override protected Map<String, Table> getTableMap() {
-    final ImmutableMap.Builder<String, Table> builder = ImmutableMap.builder();
-    for (Field field : clazz.getFields()) {
-      final String fieldName = field.getName();
-      final Table table = fieldRelation(field);
-      if (table == null) {
-        continue;
-      }
-      builder.put(fieldName, table);
-    }
-    return builder.build();
-  }
-
-  @Override protected Multimap<String, Function> getFunctionMultimap() {
-    final ImmutableMultimap.Builder<String, Function> builder =
-        ImmutableMultimap.builder();
-    for (Method method : clazz.getMethods()) {
-      final String methodName = method.getName();
-      if (method.getDeclaringClass() == Object.class
-          || methodName.equals("toString")) {
-        continue;
-      }
-      if (TranslatableTable.class.isAssignableFrom(method.getReturnType())) {
-        final TableMacro tableMacro =
-            new MethodTableMacro(this, method);
-        builder.put(methodName, tableMacro);
-      }
-    }
-    return builder.build();
-  }
-
-  /** Returns an expression for the object wrapped by this schema (not the
-   * schema itself). */
-  Expression getTargetExpression(SchemaPlus parentSchema, String name) {
-    return Types.castIfNecessary(
-        target.getClass(),
-        Expressions.call(
-            Schemas.unwrap(
-                getExpression(parentSchema, name),
-                ReflectiveSchema.class),
-            BuiltInMethod.REFLECTIVE_SCHEMA_GET_TARGET.method));
-  }
-
-  /** Returns a table based on a particular field of this schema. If the
-   * field is not of the right type to be a relation, returns null. */
-  private <T> Table fieldRelation(final Field field) {
-    final Type elementType = getElementType(field.getType());
-    if (elementType == null) {
-      return null;
-    }
-    Object o;
-    try {
-      o = field.get(target);
-    } catch (IllegalAccessException e) {
-      throw new RuntimeException(
-          "Error while accessing field " + field, e);
-    }
-    @SuppressWarnings("unchecked")
-    final Enumerable<T> enumerable = toEnumerable(o);
-    return new FieldTable<>(field, elementType, enumerable);
-  }
-
-  /** Deduces the element type of a collection;
-   * same logic as {@link #toEnumerable} */
-  private static Type getElementType(Class clazz) {
-    if (clazz.isArray()) {
-      return clazz.getComponentType();
-    }
-    if (Iterable.class.isAssignableFrom(clazz)) {
-      return Object.class;
-    }
-    return null; // not a collection/array/iterable
-  }
-
-  private static Enumerable toEnumerable(final Object o) {
-    if (o.getClass().isArray()) {
-      if (o instanceof Object[]) {
-        return Linq4j.asEnumerable((Object[]) o);
-      } else {
-        return Linq4j.asEnumerable(Primitive.asList(o));
-      }
-    }
-    if (o instanceof Iterable) {
-      return Linq4j.asEnumerable((Iterable) o);
-    }
-    throw new RuntimeException(
-        "Cannot convert " + o.getClass() + " into a Enumerable");
-  }
-
-  /** Table that is implemented by reading from a Java object. */
-  private static class ReflectiveTable
-      extends AbstractQueryableTable
-      implements Table, ScannableTable {
-    private final Type elementType;
-    private final Enumerable enumerable;
-
-    ReflectiveTable(Type elementType, Enumerable enumerable) {
-      super(elementType);
-      this.elementType = elementType;
-      this.enumerable = enumerable;
-    }
-
-    public RelDataType getRowType(RelDataTypeFactory typeFactory) {
-      return ((JavaTypeFactory) typeFactory).createType(elementType);
-    }
-
-    public Statistic getStatistic() {
-      return Statistics.UNKNOWN;
-    }
-
-    public Enumerable<Object[]> scan(DataContext root) {
-      if (elementType == Object[].class) {
-        //noinspection unchecked
-        return enumerable;
-      } else {
-        //noinspection unchecked
-        return enumerable.select(new FieldSelector((Class) elementType));
-      }
-    }
-
-    public <T> Queryable<T> asQueryable(QueryProvider queryProvider,
-        SchemaPlus schema, String tableName) {
-      return new AbstractTableQueryable<T>(queryProvider, schema, this,
-          tableName) {
-        @SuppressWarnings("unchecked")
-        public Enumerator<T> enumerator() {
-          return (Enumerator<T>) enumerable.enumerator();
-        }
-      };
-    }
-  }
-
-  /** Factory that creates a schema by instantiating an object and looking at
-   * its public fields.
-   *
-   * <p>The following example instantiates a {@code FoodMart} object as a schema
-   * that contains tables called {@code EMPS} and {@code DEPTS} based on the
-   * object's fields.</p>
-   *
-   * <pre>
-   * {@code schemas: [
-   *     {
-   *       name: "foodmart",
-   *       type: "custom",
-   *       factory: "org.apache.calcite.adapter.java.ReflectiveSchema$Factory",
-   *       operand: {
-   *         class: "com.acme.FoodMart",
-   *         staticMethod: "instance"
-   *       }
-   *     }
-   *   ]
-   *
-   * class FoodMart {
-   *   public static final FoodMart instance() {
-   *     return new FoodMart();
-   *   }
-   *
-   *   Employee[] EMPS;
-   *   Department[] DEPTS;
-   * }
-   * }</pre>
-   * */
-  public static class Factory implements SchemaFactory {
-    public Schema create(SchemaPlus parentSchema, String name,
-        Map<String, Object> operand) {
-      Class<?> clazz;
-      Object target;
-      final Object className = operand.get("class");
-      if (className != null) {
-        try {
-          clazz = Class.forName((String) className);
-        } catch (ClassNotFoundException e) {
-          throw new RuntimeException("Error loading class " + className, e);
-        }
-      } else {
-        throw new RuntimeException("Operand 'class' is required");
-      }
-      final Object methodName = operand.get("staticMethod");
-      if (methodName != null) {
-        try {
-          //noinspection unchecked
-          Method method = clazz.getMethod((String) methodName);
-          target = method.invoke(null);
-        } catch (Exception e) {
-          throw new RuntimeException("Error invoking method " + methodName, e);
-        }
-      } else {
-        try {
-          final Constructor<?> constructor = clazz.getConstructor();
-          target = constructor.newInstance();
-        } catch (Exception e) {
-          throw new RuntimeException("Error instantiating class " + className,
-              e);
-        }
-      }
-      return new ReflectiveSchema(target);
-    }
-  }
-
-  /** Table macro based on a Java method. */
-  private static class MethodTableMacro extends ReflectiveFunctionBase
-      implements TableMacro {
-    private final ReflectiveSchema schema;
-
-    MethodTableMacro(ReflectiveSchema schema, Method method) {
-      super(method);
-      this.schema = schema;
-      assert TranslatableTable.class.isAssignableFrom(method.getReturnType())
-          : "Method should return TranslatableTable so the macro can be "
-          + "expanded";
-    }
-
-    public String toString() {
-      return "Member {method=" + method + "}";
-    }
-
-    public TranslatableTable apply(final List<Object> arguments) {
-      try {
-        final Object o = method.invoke(schema.getTarget(), arguments.toArray());
-        return (TranslatableTable) o;
-      } catch (IllegalAccessException | InvocationTargetException e) {
-        throw new RuntimeException(e);
-      }
-    }
-  }
-
-  /** Table based on a Java field. */
-  private static class FieldTable<T> extends ReflectiveTable {
-    private final Field field;
-
-    FieldTable(Field field, Type elementType, Enumerable<T> enumerable) {
-      super(elementType, enumerable);
-      this.field = field;
-    }
-
-    public String toString() {
-      return "Relation {field=" + field.getName() + "}";
-    }
-
-    @Override public Expression getExpression(SchemaPlus schema,
-        String tableName, Class clazz) {
-      return Expressions.field(
-          schema.unwrap(ReflectiveSchema.class).getTargetExpression(
-              schema.getParentSchema(), schema.getName()), field);
-    }
-  }
-
-  /** Function that returns an array of a given object's field values. */
-  private static class FieldSelector implements Function1<Object, Object[]> {
-    private final Field[] fields;
-
-    FieldSelector(Class elementType) {
-      this.fields = elementType.getFields();
-    }
-
-    public Object[] apply(Object o) {
-      try {
-        final Object[] objects = new Object[fields.length];
-        for (int i = 0; i < fields.length; i++) {
-          objects[i] = fields[i].get(o);
-        }
-        return objects;
-      } catch (IllegalAccessException e) {
-        throw new RuntimeException(e);
-      }
-    }
-  }
-}
-
-// End ReflectiveSchema.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/java/package-info.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/java/package-info.java b/core/src/main/java/org/apache/calcite/adapter/java/package-info.java
deleted file mode 100644
index 58da953..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/java/package-info.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * Query provider based on Java in-memory data
- * structures.
- */
-@PackageMarker
-package org.apache.calcite.adapter.java;
-
-import org.apache.calcite.avatica.util.PackageMarker;
-
-// End package-info.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcConvention.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcConvention.java b/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcConvention.java
deleted file mode 100644
index 670c6cd..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcConvention.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.jdbc;
-
-import org.apache.calcite.linq4j.tree.Expression;
-import org.apache.calcite.plan.Convention;
-import org.apache.calcite.plan.RelOptPlanner;
-import org.apache.calcite.plan.RelOptRule;
-import org.apache.calcite.rel.rules.FilterSetOpTransposeRule;
-import org.apache.calcite.rel.rules.ProjectRemoveRule;
-import org.apache.calcite.sql.SqlDialect;
-
-/**
- * Calling convention for relational operations that occur in a JDBC
- * database.
- *
- * <p>The convention is a slight misnomer. The operations occur in whatever
- * data-flow architecture the database uses internally. Nevertheless, the result
- * pops out in JDBC.</p>
- *
- * <p>This is the only convention, thus far, that is not a singleton. Each
- * instance contains a JDBC schema (and therefore a data source). If Calcite is
- * working with two different databases, it would even make sense to convert
- * from "JDBC#A" convention to "JDBC#B", even though we don't do it currently.
- * (That would involve asking database B to open a database link to database
- * A.)</p>
- *
- * <p>As a result, converter rules from and two this convention need to be
- * instantiated, at the start of planning, for each JDBC database in play.</p>
- */
-public class JdbcConvention extends Convention.Impl {
-  /** Cost of a JDBC node versus implementing an equivalent node in a "typical"
-   * calling convention. */
-  public static final double COST_MULTIPLIER = 0.8d;
-
-  public final SqlDialect dialect;
-  public final Expression expression;
-
-  public JdbcConvention(SqlDialect dialect, Expression expression,
-      String name) {
-    super("JDBC." + name, JdbcRel.class);
-    this.dialect = dialect;
-    this.expression = expression;
-  }
-
-  public static JdbcConvention of(SqlDialect dialect, Expression expression,
-      String name) {
-    return new JdbcConvention(dialect, expression, name);
-  }
-
-  @Override public void register(RelOptPlanner planner) {
-    for (RelOptRule rule : JdbcRules.rules(this)) {
-      planner.addRule(rule);
-    }
-    planner.addRule(FilterSetOpTransposeRule.INSTANCE);
-    planner.addRule(ProjectRemoveRule.INSTANCE);
-  }
-}
-
-// End JdbcConvention.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcImplementor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcImplementor.java b/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcImplementor.java
deleted file mode 100644
index 79ec62f..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcImplementor.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.jdbc;
-
-import org.apache.calcite.adapter.java.JavaTypeFactory;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.rel2sql.RelToSqlConverter;
-import org.apache.calcite.sql.SqlDialect;
-import org.apache.calcite.util.Util;
-
-import com.google.common.collect.ImmutableList;
-
-/**
- * State for generating a SQL statement.
- */
-public class JdbcImplementor extends RelToSqlConverter {
-  public JdbcImplementor(SqlDialect dialect, JavaTypeFactory typeFactory) {
-    super(dialect);
-    Util.discard(typeFactory);
-  }
-
-  /** @see #dispatch */
-  public Result visit(JdbcTableScan scan) {
-    return result(scan.jdbcTable.tableName(),
-        ImmutableList.of(Clause.FROM), scan, null);
-  }
-
-  public Result implement(RelNode node) {
-    return dispatch(node);
-  }
-}
-
-// End JdbcImplementor.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcQueryProvider.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcQueryProvider.java b/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcQueryProvider.java
deleted file mode 100644
index 14c9282..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcQueryProvider.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.jdbc;
-
-import org.apache.calcite.linq4j.Enumerator;
-import org.apache.calcite.linq4j.QueryProvider;
-import org.apache.calcite.linq4j.QueryProviderImpl;
-import org.apache.calcite.linq4j.Queryable;
-
-/**
- * Implementation of {@link QueryProvider} that talks to JDBC databases.
- */
-public final class JdbcQueryProvider extends QueryProviderImpl {
-  public static final JdbcQueryProvider INSTANCE = new JdbcQueryProvider();
-
-  private JdbcQueryProvider() {
-  }
-
-  public <T> Enumerator<T> executeQuery(Queryable<T> queryable) {
-    return null;
-  }
-}
-
-// End JdbcQueryProvider.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcRel.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcRel.java b/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcRel.java
deleted file mode 100644
index ba91d1b..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcRel.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.jdbc;
-
-import org.apache.calcite.rel.RelNode;
-
-/**
- * Relational expression that uses JDBC calling convention.
- */
-public interface JdbcRel extends RelNode {
-  JdbcImplementor.Result implement(JdbcImplementor implementor);
-}
-
-// End JdbcRel.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcRules.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcRules.java b/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcRules.java
deleted file mode 100644
index 885ff0c..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcRules.java
+++ /dev/null
@@ -1,813 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.jdbc;
-
-import org.apache.calcite.linq4j.Queryable;
-import org.apache.calcite.linq4j.tree.Expression;
-import org.apache.calcite.plan.Convention;
-import org.apache.calcite.plan.RelOptCluster;
-import org.apache.calcite.plan.RelOptCost;
-import org.apache.calcite.plan.RelOptPlanner;
-import org.apache.calcite.plan.RelOptRule;
-import org.apache.calcite.plan.RelOptTable;
-import org.apache.calcite.plan.RelTrait;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.prepare.Prepare;
-import org.apache.calcite.rel.InvalidRelException;
-import org.apache.calcite.rel.RelCollation;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.RelWriter;
-import org.apache.calcite.rel.SingleRel;
-import org.apache.calcite.rel.convert.ConverterRule;
-import org.apache.calcite.rel.core.Aggregate;
-import org.apache.calcite.rel.core.AggregateCall;
-import org.apache.calcite.rel.core.CorrelationId;
-import org.apache.calcite.rel.core.Filter;
-import org.apache.calcite.rel.core.Intersect;
-import org.apache.calcite.rel.core.Join;
-import org.apache.calcite.rel.core.JoinRelType;
-import org.apache.calcite.rel.core.Minus;
-import org.apache.calcite.rel.core.Project;
-import org.apache.calcite.rel.core.Sort;
-import org.apache.calcite.rel.core.TableModify;
-import org.apache.calcite.rel.core.Union;
-import org.apache.calcite.rel.core.Values;
-import org.apache.calcite.rel.logical.LogicalAggregate;
-import org.apache.calcite.rel.logical.LogicalCalc;
-import org.apache.calcite.rel.logical.LogicalFilter;
-import org.apache.calcite.rel.logical.LogicalIntersect;
-import org.apache.calcite.rel.logical.LogicalJoin;
-import org.apache.calcite.rel.logical.LogicalMinus;
-import org.apache.calcite.rel.logical.LogicalProject;
-import org.apache.calcite.rel.logical.LogicalTableModify;
-import org.apache.calcite.rel.logical.LogicalUnion;
-import org.apache.calcite.rel.logical.LogicalValues;
-import org.apache.calcite.rel.metadata.RelMdUtil;
-import org.apache.calcite.rel.metadata.RelMetadataQuery;
-import org.apache.calcite.rel.rel2sql.SqlImplementor;
-import org.apache.calcite.rel.type.RelDataType;
-import org.apache.calcite.rex.RexCall;
-import org.apache.calcite.rex.RexInputRef;
-import org.apache.calcite.rex.RexLiteral;
-import org.apache.calcite.rex.RexMultisetUtil;
-import org.apache.calcite.rex.RexNode;
-import org.apache.calcite.rex.RexProgram;
-import org.apache.calcite.schema.ModifiableTable;
-import org.apache.calcite.sql.SqlAggFunction;
-import org.apache.calcite.sql.SqlDialect;
-import org.apache.calcite.sql.SqlKind;
-import org.apache.calcite.util.ImmutableBitSet;
-import org.apache.calcite.util.Util;
-import org.apache.calcite.util.trace.CalciteTrace;
-
-import com.google.common.collect.ImmutableList;
-
-import org.slf4j.Logger;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-/**
- * Rules and relational operators for
- * {@link JdbcConvention}
- * calling convention.
- */
-public class JdbcRules {
-  private JdbcRules() {
-  }
-
-  protected static final Logger LOGGER = CalciteTrace.getPlannerTracer();
-
-  public static List<RelOptRule> rules(JdbcConvention out) {
-    return ImmutableList.<RelOptRule>of(
-        new JdbcToEnumerableConverterRule(out),
-        new JdbcJoinRule(out),
-        new JdbcCalcRule(out),
-        new JdbcProjectRule(out),
-        new JdbcFilterRule(out),
-        new JdbcAggregateRule(out),
-        new JdbcSortRule(out),
-        new JdbcUnionRule(out),
-        new JdbcIntersectRule(out),
-        new JdbcMinusRule(out),
-        new JdbcTableModificationRule(out),
-        new JdbcValuesRule(out));
-  }
-
-  static final ImmutableList<SqlKind> AGG_FUNCS;
-  static final ImmutableList<SqlKind> MYSQL_AGG_FUNCS;
-
-  static {
-    ImmutableList.Builder<SqlKind> builder = ImmutableList.builder();
-    builder.add(SqlKind.COUNT);
-    builder.add(SqlKind.SUM);
-    builder.add(SqlKind.SUM0);
-    builder.add(SqlKind.MIN);
-    builder.add(SqlKind.MAX);
-    AGG_FUNCS = builder.build();
-    builder.add(SqlKind.SINGLE_VALUE);
-    MYSQL_AGG_FUNCS = builder.build();
-  }
-
-  /** Abstract base class for rule that converts to JDBC. */
-  abstract static class JdbcConverterRule extends ConverterRule {
-    protected final JdbcConvention out;
-
-    public JdbcConverterRule(Class<? extends RelNode> clazz, RelTrait in,
-        JdbcConvention out, String description) {
-      super(clazz, in, out, description);
-      this.out = out;
-    }
-  }
-
-  /** Rule that converts a join to JDBC. */
-  private static class JdbcJoinRule extends JdbcConverterRule {
-    private JdbcJoinRule(JdbcConvention out) {
-      super(LogicalJoin.class, Convention.NONE, out, "JdbcJoinRule");
-    }
-
-    @Override public RelNode convert(RelNode rel) {
-      LogicalJoin join = (LogicalJoin) rel;
-      final List<RelNode> newInputs = new ArrayList<>();
-      for (RelNode input : join.getInputs()) {
-        if (!(input.getConvention() == getOutTrait())) {
-          input =
-              convert(input,
-                  input.getTraitSet().replace(out));
-        }
-        newInputs.add(input);
-      }
-      if (!canJoinOnCondition(join.getCondition())) {
-        return null;
-      }
-      try {
-        return new JdbcJoin(
-            join.getCluster(),
-            join.getTraitSet().replace(out),
-            newInputs.get(0),
-            newInputs.get(1),
-            join.getCondition(),
-            join.getVariablesSet(),
-            join.getJoinType());
-      } catch (InvalidRelException e) {
-        LOGGER.debug(e.toString());
-        return null;
-      }
-    }
-
-    /**
-     * Returns whether a condition is supported by {@link JdbcJoin}.
-     *
-     * <p>Corresponds to the capabilities of
-     * {@link SqlImplementor#convertConditionToSqlNode}.
-     *
-     * @param node Condition
-     * @return Whether condition is supported
-     */
-    private boolean canJoinOnCondition(RexNode node) {
-      final List<RexNode> operands;
-      switch (node.getKind()) {
-      case AND:
-      case OR:
-        operands = ((RexCall) node).getOperands();
-        for (RexNode operand : operands) {
-          if (!canJoinOnCondition(operand)) {
-            return false;
-          }
-        }
-        return true;
-
-      case EQUALS:
-      case IS_NOT_DISTINCT_FROM:
-      case NOT_EQUALS:
-      case GREATER_THAN:
-      case GREATER_THAN_OR_EQUAL:
-      case LESS_THAN:
-      case LESS_THAN_OR_EQUAL:
-        operands = ((RexCall) node).getOperands();
-        if ((operands.get(0) instanceof RexInputRef)
-            && (operands.get(1) instanceof RexInputRef)) {
-          return true;
-        }
-        // fall through
-
-      default:
-        return false;
-      }
-    }
-  }
-
-  /** Join operator implemented in JDBC convention. */
-  public static class JdbcJoin extends Join implements JdbcRel {
-    /** Creates a JdbcJoin. */
-    protected JdbcJoin(RelOptCluster cluster, RelTraitSet traitSet,
-        RelNode left, RelNode right, RexNode condition,
-        Set<CorrelationId> variablesSet, JoinRelType joinType)
-        throws InvalidRelException {
-      super(cluster, traitSet, left, right, condition, variablesSet, joinType);
-    }
-
-    @Deprecated // to be removed before 2.0
-    protected JdbcJoin(
-        RelOptCluster cluster,
-        RelTraitSet traitSet,
-        RelNode left,
-        RelNode right,
-        RexNode condition,
-        JoinRelType joinType,
-        Set<String> variablesStopped)
-        throws InvalidRelException {
-      this(cluster, traitSet, left, right, condition,
-          CorrelationId.setOf(variablesStopped), joinType);
-    }
-
-    @Override public JdbcJoin copy(RelTraitSet traitSet, RexNode condition,
-        RelNode left, RelNode right, JoinRelType joinType,
-        boolean semiJoinDone) {
-      try {
-        return new JdbcJoin(getCluster(), traitSet, left, right,
-            condition, variablesSet, joinType);
-      } catch (InvalidRelException e) {
-        // Semantic error not possible. Must be a bug. Convert to
-        // internal error.
-        throw new AssertionError(e);
-      }
-    }
-
-    @Override public RelOptCost computeSelfCost(RelOptPlanner planner,
-        RelMetadataQuery mq) {
-      // We always "build" the
-      double rowCount = mq.getRowCount(this);
-
-      return planner.getCostFactory().makeCost(rowCount, 0, 0);
-    }
-
-    @Override public double estimateRowCount(RelMetadataQuery mq) {
-      final double leftRowCount = left.estimateRowCount(mq);
-      final double rightRowCount = right.estimateRowCount(mq);
-      return Math.max(leftRowCount, rightRowCount);
-    }
-
-    public JdbcImplementor.Result implement(JdbcImplementor implementor) {
-      return implementor.implement(this);
-    }
-  }
-
-  /**
-   * Rule to convert a {@link org.apache.calcite.rel.logical.LogicalCalc} to an
-   * {@link org.apache.calcite.adapter.jdbc.JdbcRules.JdbcCalc}.
-   */
-  private static class JdbcCalcRule extends JdbcConverterRule {
-    private JdbcCalcRule(JdbcConvention out) {
-      super(LogicalCalc.class, Convention.NONE, out, "JdbcCalcRule");
-    }
-
-    public RelNode convert(RelNode rel) {
-      final LogicalCalc calc = (LogicalCalc) rel;
-
-      // If there's a multiset, let FarragoMultisetSplitter work on it
-      // first.
-      if (RexMultisetUtil.containsMultiset(calc.getProgram())) {
-        return null;
-      }
-
-      return new JdbcCalc(rel.getCluster(), rel.getTraitSet().replace(out),
-          convert(calc.getInput(), calc.getTraitSet().replace(out)),
-          calc.getProgram());
-    }
-  }
-
-  /** Calc operator implemented in JDBC convention.
-   *
-   * @see org.apache.calcite.rel.core.Calc */
-  public static class JdbcCalc extends SingleRel implements JdbcRel {
-    private final RexProgram program;
-
-    public JdbcCalc(RelOptCluster cluster,
-        RelTraitSet traitSet,
-        RelNode input,
-        RexProgram program) {
-      super(cluster, traitSet, input);
-      assert getConvention() instanceof JdbcConvention;
-      this.program = program;
-      this.rowType = program.getOutputRowType();
-    }
-
-    @Deprecated // to be removed before 2.0
-    public JdbcCalc(RelOptCluster cluster, RelTraitSet traitSet, RelNode input,
-        RexProgram program, int flags) {
-      this(cluster, traitSet, input, program);
-      Util.discard(flags);
-    }
-
-    public RelWriter explainTerms(RelWriter pw) {
-      return program.explainCalc(super.explainTerms(pw));
-    }
-
-    @Override public double estimateRowCount(RelMetadataQuery mq) {
-      return RelMdUtil.estimateFilteredRows(getInput(), program, mq);
-    }
-
-    public RelOptCost computeSelfCost(RelOptPlanner planner,
-        RelMetadataQuery mq) {
-      double dRows = mq.getRowCount(this);
-      double dCpu = mq.getRowCount(getInput())
-          * program.getExprCount();
-      double dIo = 0;
-      return planner.getCostFactory().makeCost(dRows, dCpu, dIo);
-    }
-
-    public RelNode copy(RelTraitSet traitSet, List<RelNode> inputs) {
-      return new JdbcCalc(getCluster(), traitSet, sole(inputs), program);
-    }
-
-    public JdbcImplementor.Result implement(JdbcImplementor implementor) {
-      return implementor.implement(this);
-    }
-  }
-
-  /**
-   * Rule to convert a {@link org.apache.calcite.rel.logical.LogicalProject} to
-   * an {@link org.apache.calcite.adapter.jdbc.JdbcRules.JdbcProject}.
-   */
-  private static class JdbcProjectRule extends JdbcConverterRule {
-    private JdbcProjectRule(JdbcConvention out) {
-      super(LogicalProject.class, Convention.NONE, out, "JdbcProjectRule");
-    }
-
-    public RelNode convert(RelNode rel) {
-      final LogicalProject project = (LogicalProject) rel;
-
-      return new JdbcProject(
-          rel.getCluster(),
-          rel.getTraitSet().replace(out),
-          convert(
-              project.getInput(),
-              project.getInput().getTraitSet().replace(out)),
-          project.getProjects(),
-          project.getRowType());
-    }
-  }
-
-  /** Implementation of {@link org.apache.calcite.rel.logical.LogicalProject} in
-   * {@link JdbcConvention jdbc calling convention}. */
-  public static class JdbcProject
-      extends Project
-      implements JdbcRel {
-    public JdbcProject(
-        RelOptCluster cluster,
-        RelTraitSet traitSet,
-        RelNode input,
-        List<? extends RexNode> projects,
-        RelDataType rowType) {
-      super(cluster, traitSet, input, projects, rowType);
-      assert getConvention() instanceof JdbcConvention;
-    }
-
-    @Deprecated // to be removed before 2.0
-    public JdbcProject(RelOptCluster cluster, RelTraitSet traitSet,
-        RelNode input, List<RexNode> projects, RelDataType rowType, int flags) {
-      this(cluster, traitSet, input, projects, rowType);
-      Util.discard(flags);
-    }
-
-    @Override public JdbcProject copy(RelTraitSet traitSet, RelNode input,
-        List<RexNode> projects, RelDataType rowType) {
-      return new JdbcProject(getCluster(), traitSet, input, projects, rowType);
-    }
-
-    @Override public RelOptCost computeSelfCost(RelOptPlanner planner,
-        RelMetadataQuery mq) {
-      return super.computeSelfCost(planner, mq)
-          .multiplyBy(JdbcConvention.COST_MULTIPLIER);
-    }
-
-    public JdbcImplementor.Result implement(JdbcImplementor implementor) {
-      return implementor.implement(this);
-    }
-  }
-
-  /**
-   * Rule to convert a {@link org.apache.calcite.rel.logical.LogicalFilter} to
-   * an {@link org.apache.calcite.adapter.jdbc.JdbcRules.JdbcFilter}.
-   */
-  private static class JdbcFilterRule extends JdbcConverterRule {
-    private JdbcFilterRule(JdbcConvention out) {
-      super(LogicalFilter.class, Convention.NONE, out, "JdbcFilterRule");
-    }
-
-    public RelNode convert(RelNode rel) {
-      final LogicalFilter filter = (LogicalFilter) rel;
-
-      return new JdbcFilter(
-          rel.getCluster(),
-          rel.getTraitSet().replace(out),
-          convert(filter.getInput(),
-              filter.getInput().getTraitSet().replace(out)),
-          filter.getCondition());
-    }
-  }
-
-  /** Implementation of {@link org.apache.calcite.rel.core.Filter} in
-   * {@link JdbcConvention jdbc calling convention}. */
-  public static class JdbcFilter extends Filter implements JdbcRel {
-    public JdbcFilter(
-        RelOptCluster cluster,
-        RelTraitSet traitSet,
-        RelNode input,
-        RexNode condition) {
-      super(cluster, traitSet, input, condition);
-      assert getConvention() instanceof JdbcConvention;
-    }
-
-    public JdbcFilter copy(RelTraitSet traitSet, RelNode input,
-        RexNode condition) {
-      return new JdbcFilter(getCluster(), traitSet, input, condition);
-    }
-
-    public JdbcImplementor.Result implement(JdbcImplementor implementor) {
-      return implementor.implement(this);
-    }
-  }
-
-  /**
-   * Rule to convert a {@link org.apache.calcite.rel.logical.LogicalAggregate}
-   * to a {@link org.apache.calcite.adapter.jdbc.JdbcRules.JdbcAggregate}.
-   */
-  private static class JdbcAggregateRule extends JdbcConverterRule {
-    private JdbcAggregateRule(JdbcConvention out) {
-      super(LogicalAggregate.class, Convention.NONE, out, "JdbcAggregateRule");
-    }
-
-    public RelNode convert(RelNode rel) {
-      final LogicalAggregate agg = (LogicalAggregate) rel;
-      if (agg.getGroupSets().size() != 1) {
-        // GROUPING SETS not supported; see
-        // [CALCITE-734] Push GROUPING SETS to underlying SQL via JDBC adapter
-        return null;
-      }
-      final RelTraitSet traitSet =
-          agg.getTraitSet().replace(out);
-      try {
-        return new JdbcAggregate(rel.getCluster(), traitSet,
-            convert(agg.getInput(), out), agg.indicator, agg.getGroupSet(),
-            agg.getGroupSets(), agg.getAggCallList());
-      } catch (InvalidRelException e) {
-        LOGGER.debug(e.toString());
-        return null;
-      }
-    }
-  }
-
-  /** Returns whether this JDBC data source can implement a given aggregate
-   * function. */
-  private static boolean canImplement(SqlAggFunction aggregation, SqlDialect sqlDialect) {
-    switch (sqlDialect.getDatabaseProduct()) {
-    case MYSQL:
-      return MYSQL_AGG_FUNCS.contains(aggregation.getKind());
-    default:
-      return AGG_FUNCS.contains(aggregation.getKind());
-    }
-  }
-
-  /** Aggregate operator implemented in JDBC convention. */
-  public static class JdbcAggregate extends Aggregate implements JdbcRel {
-    public JdbcAggregate(
-        RelOptCluster cluster,
-        RelTraitSet traitSet,
-        RelNode input,
-        boolean indicator,
-        ImmutableBitSet groupSet,
-        List<ImmutableBitSet> groupSets,
-        List<AggregateCall> aggCalls)
-        throws InvalidRelException {
-      super(cluster, traitSet, input, indicator, groupSet, groupSets, aggCalls);
-      assert getConvention() instanceof JdbcConvention;
-      assert this.groupSets.size() == 1 : "Grouping sets not supported";
-      assert !this.indicator;
-      final SqlDialect dialect = ((JdbcConvention) getConvention()).dialect;
-      for (AggregateCall aggCall : aggCalls) {
-        if (!canImplement(aggCall.getAggregation(), dialect)) {
-          throw new InvalidRelException("cannot implement aggregate function "
-              + aggCall.getAggregation());
-        }
-      }
-    }
-
-    @Override public JdbcAggregate copy(RelTraitSet traitSet, RelNode input,
-        boolean indicator, ImmutableBitSet groupSet,
-        List<ImmutableBitSet> groupSets, List<AggregateCall> aggCalls) {
-      try {
-        return new JdbcAggregate(getCluster(), traitSet, input, indicator,
-            groupSet, groupSets, aggCalls);
-      } catch (InvalidRelException e) {
-        // Semantic error not possible. Must be a bug. Convert to
-        // internal error.
-        throw new AssertionError(e);
-      }
-    }
-
-    public JdbcImplementor.Result implement(JdbcImplementor implementor) {
-      return implementor.implement(this);
-    }
-  }
-
-  /**
-   * Rule to convert a {@link org.apache.calcite.rel.core.Sort} to an
-   * {@link org.apache.calcite.adapter.jdbc.JdbcRules.JdbcSort}.
-   */
-  private static class JdbcSortRule extends JdbcConverterRule {
-    private JdbcSortRule(JdbcConvention out) {
-      super(Sort.class, Convention.NONE, out, "JdbcSortRule");
-    }
-
-    public RelNode convert(RelNode rel) {
-      final Sort sort = (Sort) rel;
-      if (sort.offset != null || sort.fetch != null) {
-        // Cannot implement "OFFSET n FETCH n" currently.
-        return null;
-      }
-      final RelTraitSet traitSet = sort.getTraitSet().replace(out);
-      return new JdbcSort(rel.getCluster(), traitSet,
-          convert(sort.getInput(), traitSet), sort.getCollation());
-    }
-  }
-
-  /** Sort operator implemented in JDBC convention. */
-  public static class JdbcSort
-      extends Sort
-      implements JdbcRel {
-    public JdbcSort(
-        RelOptCluster cluster,
-        RelTraitSet traitSet,
-        RelNode input,
-        RelCollation collation) {
-      super(cluster, traitSet, input, collation);
-      assert getConvention() instanceof JdbcConvention;
-      assert getConvention() == input.getConvention();
-    }
-
-    @Override public JdbcSort copy(RelTraitSet traitSet, RelNode newInput,
-        RelCollation newCollation, RexNode offset, RexNode fetch) {
-      if (offset != null || fetch != null) {
-        throw new IllegalArgumentException("not supported: offset or fetch");
-      }
-      return new JdbcSort(getCluster(), traitSet, newInput, newCollation);
-    }
-
-    public JdbcImplementor.Result implement(JdbcImplementor implementor) {
-      return implementor.implement(this);
-    }
-  }
-
-  /**
-   * Rule to convert an {@link org.apache.calcite.rel.logical.LogicalUnion} to a
-   * {@link org.apache.calcite.adapter.jdbc.JdbcRules.JdbcUnion}.
-   */
-  private static class JdbcUnionRule extends JdbcConverterRule {
-    private JdbcUnionRule(JdbcConvention out) {
-      super(LogicalUnion.class, Convention.NONE, out, "JdbcUnionRule");
-    }
-
-    public RelNode convert(RelNode rel) {
-      final LogicalUnion union = (LogicalUnion) rel;
-      final RelTraitSet traitSet =
-          union.getTraitSet().replace(out);
-      return new JdbcUnion(rel.getCluster(), traitSet,
-          convertList(union.getInputs(), out), union.all);
-    }
-  }
-
-  /** Union operator implemented in JDBC convention. */
-  public static class JdbcUnion extends Union implements JdbcRel {
-    public JdbcUnion(
-        RelOptCluster cluster,
-        RelTraitSet traitSet,
-        List<RelNode> inputs,
-        boolean all) {
-      super(cluster, traitSet, inputs, all);
-    }
-
-    public JdbcUnion copy(
-        RelTraitSet traitSet, List<RelNode> inputs, boolean all) {
-      return new JdbcUnion(getCluster(), traitSet, inputs, all);
-    }
-
-    @Override public RelOptCost computeSelfCost(RelOptPlanner planner,
-        RelMetadataQuery mq) {
-      return super.computeSelfCost(planner, mq).multiplyBy(.1);
-    }
-
-    public JdbcImplementor.Result implement(JdbcImplementor implementor) {
-      return implementor.implement(this);
-    }
-  }
-
-  /**
-   * Rule to convert a {@link org.apache.calcite.rel.logical.LogicalIntersect}
-   * to a {@link org.apache.calcite.adapter.jdbc.JdbcRules.JdbcIntersect}.
-   */
-  private static class JdbcIntersectRule extends JdbcConverterRule {
-    private JdbcIntersectRule(JdbcConvention out) {
-      super(LogicalIntersect.class, Convention.NONE, out, "JdbcIntersectRule");
-    }
-
-    public RelNode convert(RelNode rel) {
-      final LogicalIntersect intersect = (LogicalIntersect) rel;
-      if (intersect.all) {
-        return null; // INTERSECT ALL not implemented
-      }
-      final RelTraitSet traitSet =
-          intersect.getTraitSet().replace(out);
-      return new JdbcIntersect(rel.getCluster(), traitSet,
-          convertList(intersect.getInputs(), out), false);
-    }
-  }
-
-  /** Intersect operator implemented in JDBC convention. */
-  public static class JdbcIntersect
-      extends Intersect
-      implements JdbcRel {
-    public JdbcIntersect(
-        RelOptCluster cluster,
-        RelTraitSet traitSet,
-        List<RelNode> inputs,
-        boolean all) {
-      super(cluster, traitSet, inputs, all);
-      assert !all;
-    }
-
-    public JdbcIntersect copy(
-        RelTraitSet traitSet, List<RelNode> inputs, boolean all) {
-      return new JdbcIntersect(getCluster(), traitSet, inputs, all);
-    }
-
-    public JdbcImplementor.Result implement(JdbcImplementor implementor) {
-      return implementor.implement(this);
-    }
-  }
-
-  /**
-   * Rule to convert a {@link org.apache.calcite.rel.logical.LogicalMinus} to a
-   * {@link org.apache.calcite.adapter.jdbc.JdbcRules.JdbcMinus}.
-   */
-  private static class JdbcMinusRule extends JdbcConverterRule {
-    private JdbcMinusRule(JdbcConvention out) {
-      super(LogicalMinus.class, Convention.NONE, out, "JdbcMinusRule");
-    }
-
-    public RelNode convert(RelNode rel) {
-      final LogicalMinus minus = (LogicalMinus) rel;
-      if (minus.all) {
-        return null; // EXCEPT ALL not implemented
-      }
-      final RelTraitSet traitSet =
-          rel.getTraitSet().replace(out);
-      return new JdbcMinus(rel.getCluster(), traitSet,
-          convertList(minus.getInputs(), out), false);
-    }
-  }
-
-  /** Minus operator implemented in JDBC convention. */
-  public static class JdbcMinus extends Minus implements JdbcRel {
-    public JdbcMinus(RelOptCluster cluster, RelTraitSet traitSet,
-        List<RelNode> inputs, boolean all) {
-      super(cluster, traitSet, inputs, all);
-      assert !all;
-    }
-
-    public JdbcMinus copy(RelTraitSet traitSet, List<RelNode> inputs,
-        boolean all) {
-      return new JdbcMinus(getCluster(), traitSet, inputs, all);
-    }
-
-    public JdbcImplementor.Result implement(JdbcImplementor implementor) {
-      return implementor.implement(this);
-    }
-  }
-
-  /** Rule that converts a table-modification to JDBC. */
-  public static class JdbcTableModificationRule extends JdbcConverterRule {
-    private JdbcTableModificationRule(JdbcConvention out) {
-      super(
-          LogicalTableModify.class,
-          Convention.NONE,
-          out,
-          "JdbcTableModificationRule");
-    }
-
-    @Override public RelNode convert(RelNode rel) {
-      final LogicalTableModify modify =
-          (LogicalTableModify) rel;
-      final ModifiableTable modifiableTable =
-          modify.getTable().unwrap(ModifiableTable.class);
-      if (modifiableTable == null
-          /* || modifiableTable.getExpression(tableInSchema) == null */) {
-        return null;
-      }
-      final RelTraitSet traitSet =
-          modify.getTraitSet().replace(out);
-      return new JdbcTableModify(
-          modify.getCluster(), traitSet,
-          modify.getTable(),
-          modify.getCatalogReader(),
-          convert(modify.getInput(), traitSet),
-          modify.getOperation(),
-          modify.getUpdateColumnList(),
-          modify.getSourceExpressionList(),
-          modify.isFlattened());
-    }
-  }
-
-  /** Table-modification operator implemented in JDBC convention. */
-  public static class JdbcTableModify extends TableModify implements JdbcRel {
-    private final Expression expression;
-
-    public JdbcTableModify(RelOptCluster cluster,
-        RelTraitSet traitSet,
-        RelOptTable table,
-        Prepare.CatalogReader catalogReader,
-        RelNode input,
-        Operation operation,
-        List<String> updateColumnList,
-        List<RexNode> sourceExpressionList,
-        boolean flattened) {
-      super(cluster, traitSet, table, catalogReader, input, operation,
-          updateColumnList, sourceExpressionList, flattened);
-      assert input.getConvention() instanceof JdbcConvention;
-      assert getConvention() instanceof JdbcConvention;
-      final ModifiableTable modifiableTable =
-          table.unwrap(ModifiableTable.class);
-      if (modifiableTable == null) {
-        throw new AssertionError(); // TODO: user error in validator
-      }
-      this.expression = table.getExpression(Queryable.class);
-      if (expression == null) {
-        throw new AssertionError(); // TODO: user error in validator
-      }
-    }
-
-    @Override public RelOptCost computeSelfCost(RelOptPlanner planner,
-        RelMetadataQuery mq) {
-      return super.computeSelfCost(planner, mq).multiplyBy(.1);
-    }
-
-    @Override public RelNode copy(RelTraitSet traitSet, List<RelNode> inputs) {
-      return new JdbcTableModify(
-          getCluster(), traitSet, getTable(), getCatalogReader(),
-          sole(inputs), getOperation(), getUpdateColumnList(),
-          getSourceExpressionList(), isFlattened());
-    }
-
-    public JdbcImplementor.Result implement(JdbcImplementor implementor) {
-      return implementor.implement(this);
-    }
-  }
-
-  /** Rule that converts a values operator to JDBC. */
-  public static class JdbcValuesRule extends JdbcConverterRule {
-    private JdbcValuesRule(JdbcConvention out) {
-      super(LogicalValues.class, Convention.NONE, out, "JdbcValuesRule");
-    }
-
-    @Override public RelNode convert(RelNode rel) {
-      LogicalValues values = (LogicalValues) rel;
-      return new JdbcValues(values.getCluster(), values.getRowType(),
-          values.getTuples(), values.getTraitSet().replace(out));
-    }
-  }
-
-  /** Values operator implemented in JDBC convention. */
-  public static class JdbcValues extends Values implements JdbcRel {
-    JdbcValues(RelOptCluster cluster, RelDataType rowType,
-        ImmutableList<ImmutableList<RexLiteral>> tuples, RelTraitSet traitSet) {
-      super(cluster, rowType, tuples, traitSet);
-    }
-
-    @Override public RelNode copy(RelTraitSet traitSet, List<RelNode> inputs) {
-      assert inputs.isEmpty();
-      return new JdbcValues(getCluster(), rowType, tuples, traitSet);
-    }
-
-    public JdbcImplementor.Result implement(JdbcImplementor implementor) {
-      return implementor.implement(this);
-    }
-  }
-}
-
-// End JdbcRules.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcSchema.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcSchema.java b/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcSchema.java
deleted file mode 100644
index faf0e94..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcSchema.java
+++ /dev/null
@@ -1,440 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.jdbc;
-
-import org.apache.calcite.avatica.AvaticaUtils;
-import org.apache.calcite.avatica.SqlType;
-import org.apache.calcite.linq4j.tree.Expression;
-import org.apache.calcite.rel.type.RelDataType;
-import org.apache.calcite.rel.type.RelDataTypeFactory;
-import org.apache.calcite.rel.type.RelDataTypeImpl;
-import org.apache.calcite.rel.type.RelDataTypeSystem;
-import org.apache.calcite.rel.type.RelProtoDataType;
-import org.apache.calcite.schema.Function;
-import org.apache.calcite.schema.Schema;
-import org.apache.calcite.schema.SchemaFactory;
-import org.apache.calcite.schema.SchemaPlus;
-import org.apache.calcite.schema.Schemas;
-import org.apache.calcite.schema.Table;
-import org.apache.calcite.sql.SqlDialect;
-import org.apache.calcite.sql.type.SqlTypeFactoryImpl;
-import org.apache.calcite.sql.type.SqlTypeName;
-import org.apache.calcite.util.Util;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableMultimap;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Multimap;
-
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.Collection;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-import javax.sql.DataSource;
-
-/**
- * Implementation of {@link Schema} that is backed by a JDBC data source.
- *
- * <p>The tables in the JDBC data source appear to be tables in this schema;
- * queries against this schema are executed against those tables, pushing down
- * as much as possible of the query logic to SQL.</p>
- */
-public class JdbcSchema implements Schema {
-  final DataSource dataSource;
-  final String catalog;
-  final String schema;
-  public final SqlDialect dialect;
-  final JdbcConvention convention;
-  private ImmutableMap<String, JdbcTable> tableMap;
-
-  /**
-   * Creates a JDBC schema.
-   *
-   * @param dataSource Data source
-   * @param dialect SQL dialect
-   * @param convention Calling convention
-   * @param catalog Catalog name, or null
-   * @param schema Schema name pattern
-   */
-  public JdbcSchema(DataSource dataSource, SqlDialect dialect,
-      JdbcConvention convention, String catalog, String schema) {
-    super();
-    this.dataSource = dataSource;
-    this.dialect = dialect;
-    this.convention = convention;
-    this.catalog = catalog;
-    this.schema = schema;
-    assert dialect != null;
-    assert dataSource != null;
-  }
-
-  public static JdbcSchema create(
-      SchemaPlus parentSchema,
-      String name,
-      DataSource dataSource,
-      String catalog,
-      String schema) {
-    final Expression expression =
-        Schemas.subSchemaExpression(parentSchema, name, JdbcSchema.class);
-    final SqlDialect dialect = createDialect(dataSource);
-    final JdbcConvention convention =
-        JdbcConvention.of(dialect, expression, name);
-    return new JdbcSchema(dataSource, dialect, convention, catalog, schema);
-  }
-
-  /**
-   * Creates a JdbcSchema, taking credentials from a map.
-   *
-   * @param parentSchema Parent schema
-   * @param name Name
-   * @param operand Map of property/value pairs
-   * @return A JdbcSchema
-   */
-  public static JdbcSchema create(
-      SchemaPlus parentSchema,
-      String name,
-      Map<String, Object> operand) {
-    DataSource dataSource;
-    try {
-      final String dataSourceName = (String) operand.get("dataSource");
-      if (dataSourceName != null) {
-        dataSource =
-            AvaticaUtils.instantiatePlugin(DataSource.class, dataSourceName);
-      } else {
-        final String jdbcUrl = (String) operand.get("jdbcUrl");
-        final String jdbcDriver = (String) operand.get("jdbcDriver");
-        final String jdbcUser = (String) operand.get("jdbcUser");
-        final String jdbcPassword = (String) operand.get("jdbcPassword");
-        dataSource = dataSource(jdbcUrl, jdbcDriver, jdbcUser, jdbcPassword);
-      }
-    } catch (Exception e) {
-      throw new RuntimeException("Error while reading dataSource", e);
-    }
-    String jdbcCatalog = (String) operand.get("jdbcCatalog");
-    String jdbcSchema = (String) operand.get("jdbcSchema");
-    return JdbcSchema.create(
-        parentSchema, name, dataSource, jdbcCatalog, jdbcSchema);
-  }
-
-  /** Returns a suitable SQL dialect for the given data source. */
-  public static SqlDialect createDialect(DataSource dataSource) {
-    return JdbcUtils.DialectPool.INSTANCE.get(dataSource);
-  }
-
-  /** Creates a JDBC data source with the given specification. */
-  public static DataSource dataSource(String url, String driverClassName,
-      String username, String password) {
-    if (url.startsWith("jdbc:hsqldb:")) {
-      // Prevent hsqldb from screwing up java.util.logging.
-      System.setProperty("hsqldb.reconfig_logging", "false");
-    }
-    return JdbcUtils.DataSourcePool.INSTANCE.get(url, driverClassName, username,
-        password);
-  }
-
-  public boolean isMutable() {
-    return false;
-  }
-
-  public boolean contentsHaveChangedSince(long lastCheck, long now) {
-    return false;
-  }
-
-  // Used by generated code.
-  public DataSource getDataSource() {
-    return dataSource;
-  }
-
-  public Expression getExpression(SchemaPlus parentSchema, String name) {
-    return Schemas.subSchemaExpression(parentSchema, name, JdbcSchema.class);
-  }
-
-  protected Multimap<String, Function> getFunctions() {
-    // TODO: populate map from JDBC metadata
-    return ImmutableMultimap.of();
-  }
-
-  public final Collection<Function> getFunctions(String name) {
-    return getFunctions().get(name); // never null
-  }
-
-  public final Set<String> getFunctionNames() {
-    return getFunctions().keySet();
-  }
-
-  private ImmutableMap<String, JdbcTable> computeTables() {
-    Connection connection = null;
-    ResultSet resultSet = null;
-    try {
-      connection = dataSource.getConnection();
-      DatabaseMetaData metaData = connection.getMetaData();
-      resultSet = metaData.getTables(
-          catalog,
-          schema,
-          null,
-          null);
-      final ImmutableMap.Builder<String, JdbcTable> builder =
-          ImmutableMap.builder();
-      while (resultSet.next()) {
-        final String tableName = resultSet.getString(3);
-        final String catalogName = resultSet.getString(1);
-        final String schemaName = resultSet.getString(2);
-        final String tableTypeName = resultSet.getString(4);
-        // Clean up table type. In particular, this ensures that 'SYSTEM TABLE',
-        // returned by Phoenix among others, maps to TableType.SYSTEM_TABLE.
-        // We know enum constants are upper-case without spaces, so we can't
-        // make things worse.
-        //
-        // PostgreSQL returns tableTypeName==null for pg_toast* tables
-        // This can happen if you start JdbcSchema off a "public" PG schema
-        // The tables are not designed to be queried by users, however we do
-        // not filter them as we keep all the other table types.
-        final String tableTypeName2 =
-            tableTypeName == null
-            ? null
-            : tableTypeName.toUpperCase(Locale.ROOT).replace(' ', '_');
-        final TableType tableType =
-            Util.enumVal(TableType.OTHER, tableTypeName2);
-        if (tableType == TableType.OTHER  && tableTypeName2 != null) {
-          System.out.println("Unknown table type: " + tableTypeName2);
-        }
-        final JdbcTable table =
-            new JdbcTable(this, catalogName, schemaName, tableName, tableType);
-        builder.put(tableName, table);
-      }
-      return builder.build();
-    } catch (SQLException e) {
-      throw new RuntimeException(
-          "Exception while reading tables", e);
-    } finally {
-      close(connection, null, resultSet);
-    }
-  }
-
-  public Table getTable(String name) {
-    return getTableMap(false).get(name);
-  }
-
-  private synchronized ImmutableMap<String, JdbcTable> getTableMap(
-      boolean force) {
-    if (force || tableMap == null) {
-      tableMap = computeTables();
-    }
-    return tableMap;
-  }
-
-  RelProtoDataType getRelDataType(String catalogName, String schemaName,
-      String tableName) throws SQLException {
-    Connection connection = null;
-    try {
-      connection = dataSource.getConnection();
-      DatabaseMetaData metaData = connection.getMetaData();
-      return getRelDataType(metaData, catalogName, schemaName, tableName);
-    } finally {
-      close(connection, null, null);
-    }
-  }
-
-  RelProtoDataType getRelDataType(DatabaseMetaData metaData, String catalogName,
-      String schemaName, String tableName) throws SQLException {
-    final ResultSet resultSet =
-        metaData.getColumns(catalogName, schemaName, tableName, null);
-
-    // Temporary type factory, just for the duration of this method. Allowable
-    // because we're creating a proto-type, not a type; before being used, the
-    // proto-type will be copied into a real type factory.
-    final RelDataTypeFactory typeFactory =
-        new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT);
-    final RelDataTypeFactory.FieldInfoBuilder fieldInfo = typeFactory.builder();
-    while (resultSet.next()) {
-      final String columnName = resultSet.getString(4);
-      final int dataType = resultSet.getInt(5);
-      final String typeString = resultSet.getString(6);
-      final int precision;
-      final int scale;
-      switch (SqlType.valueOf(dataType)) {
-      case TIMESTAMP:
-      case TIME:
-        precision = resultSet.getInt(9); // SCALE
-        scale = 0;
-        break;
-      default:
-        precision = resultSet.getInt(7); // SIZE
-        scale = resultSet.getInt(9); // SCALE
-        break;
-      }
-      RelDataType sqlType =
-          sqlType(typeFactory, dataType, precision, scale, typeString);
-      boolean nullable = resultSet.getInt(11) != DatabaseMetaData.columnNoNulls;
-      fieldInfo.add(columnName, sqlType).nullable(nullable);
-    }
-    resultSet.close();
-    return RelDataTypeImpl.proto(fieldInfo.build());
-  }
-
-  private RelDataType sqlType(RelDataTypeFactory typeFactory, int dataType,
-      int precision, int scale, String typeString) {
-    // Fall back to ANY if type is unknown
-    final SqlTypeName sqlTypeName =
-        Util.first(SqlTypeName.getNameForJdbcType(dataType), SqlTypeName.ANY);
-    switch (sqlTypeName) {
-    case ARRAY:
-      RelDataType component = null;
-      if (typeString != null && typeString.endsWith(" ARRAY")) {
-        // E.g. hsqldb gives "INTEGER ARRAY", so we deduce the component type
-        // "INTEGER".
-        final String remaining = typeString.substring(0,
-            typeString.length() - " ARRAY".length());
-        component = parseTypeString(typeFactory, remaining);
-      }
-      if (component == null) {
-        component = typeFactory.createTypeWithNullability(
-            typeFactory.createSqlType(SqlTypeName.ANY), true);
-      }
-      return typeFactory.createArrayType(component, -1);
-    }
-    if (precision >= 0
-        && scale >= 0
-        && sqlTypeName.allowsPrecScale(true, true)) {
-      return typeFactory.createSqlType(sqlTypeName, precision, scale);
-    } else if (precision >= 0 && sqlTypeName.allowsPrecNoScale()) {
-      return typeFactory.createSqlType(sqlTypeName, precision);
-    } else {
-      assert sqlTypeName.allowsNoPrecNoScale();
-      return typeFactory.createSqlType(sqlTypeName);
-    }
-  }
-
-  /** Given "INTEGER", returns BasicSqlType(INTEGER).
-   * Given "VARCHAR(10)", returns BasicSqlType(VARCHAR, 10).
-   * Given "NUMERIC(10, 2)", returns BasicSqlType(NUMERIC, 10, 2). */
-  private RelDataType parseTypeString(RelDataTypeFactory typeFactory,
-      String typeString) {
-    int precision = -1;
-    int scale = -1;
-    int open = typeString.indexOf("(");
-    if (open >= 0) {
-      int close = typeString.indexOf(")", open);
-      if (close >= 0) {
-        String rest = typeString.substring(open + 1, close);
-        typeString = typeString.substring(0, open);
-        int comma = rest.indexOf(",");
-        if (comma >= 0) {
-          precision = Integer.parseInt(rest.substring(0, comma));
-          scale = Integer.parseInt(rest.substring(comma));
-        } else {
-          precision = Integer.parseInt(rest);
-        }
-      }
-    }
-    try {
-      final SqlTypeName typeName = SqlTypeName.valueOf(typeString);
-      return typeName.allowsPrecScale(true, true)
-          ? typeFactory.createSqlType(typeName, precision, scale)
-          : typeName.allowsPrecScale(true, false)
-          ? typeFactory.createSqlType(typeName, precision)
-          : typeFactory.createSqlType(typeName);
-    } catch (IllegalArgumentException e) {
-      return typeFactory.createTypeWithNullability(
-          typeFactory.createSqlType(SqlTypeName.ANY), true);
-    }
-  }
-
-  public Set<String> getTableNames() {
-    // This method is called during a cache refresh. We can take it as a signal
-    // that we need to re-build our own cache.
-    return getTableMap(true).keySet();
-  }
-
-  public Schema getSubSchema(String name) {
-    // JDBC does not support sub-schemas.
-    return null;
-  }
-
-  public Set<String> getSubSchemaNames() {
-    return ImmutableSet.of();
-  }
-
-  private static void close(
-      Connection connection, Statement statement, ResultSet resultSet) {
-    if (resultSet != null) {
-      try {
-        resultSet.close();
-      } catch (SQLException e) {
-        // ignore
-      }
-    }
-    if (statement != null) {
-      try {
-        statement.close();
-      } catch (SQLException e) {
-        // ignore
-      }
-    }
-    if (connection != null) {
-      try {
-        connection.close();
-      } catch (SQLException e) {
-        // ignore
-      }
-    }
-  }
-
-  /** Schema factory that creates a
-   * {@link org.apache.calcite.adapter.jdbc.JdbcSchema}.
-   * This allows you to create a jdbc schema inside a model.json file.
-   *
-   * <pre>{@code
-   * {
-   *   version: '1.0',
-   *   defaultSchema: 'FOODMART_CLONE',
-   *   schemas: [
-   *     {
-   *       name: 'FOODMART_CLONE',
-   *       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'
-   *       }
-   *     }
-   *   ]
-   * }
-   * }</pre>
-   */
-  public static class Factory implements SchemaFactory {
-    public static final Factory INSTANCE = new Factory();
-
-    private Factory() {}
-
-    public Schema create(
-        SchemaPlus parentSchema,
-        String name,
-        Map<String, Object> operand) {
-      return JdbcSchema.create(parentSchema, name, operand);
-    }
-  }
-}
-
-// End JdbcSchema.java


[22/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/server/src/test/java/org/apache/calcite/avatica/SpnegoTestUtil.java
----------------------------------------------------------------------
diff --git a/avatica/server/src/test/java/org/apache/calcite/avatica/SpnegoTestUtil.java b/avatica/server/src/test/java/org/apache/calcite/avatica/SpnegoTestUtil.java
deleted file mode 100644
index ab4491d..0000000
--- a/avatica/server/src/test/java/org/apache/calcite/avatica/SpnegoTestUtil.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import org.apache.calcite.avatica.remote.Service.RpcMetadataResponse;
-import org.apache.calcite.avatica.server.AvaticaHandler;
-
-import org.apache.kerby.kerberos.kerb.KrbException;
-import org.apache.kerby.kerberos.kerb.server.SimpleKdcServer;
-
-import org.eclipse.jetty.security.UserAuthentication;
-import org.eclipse.jetty.server.Authentication;
-import org.eclipse.jetty.server.Handler;
-import org.eclipse.jetty.server.Request;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.UserIdentity;
-import org.eclipse.jetty.server.handler.DefaultHandler;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.net.ServerSocket;
-import java.nio.charset.StandardCharsets;
-import java.security.AccessController;
-import java.security.Principal;
-import java.security.PrivilegedAction;
-
-import javax.security.auth.login.Configuration;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * Utility class for setting up SPNEGO
- */
-public class SpnegoTestUtil {
-
-  public static final String JGSS_KERBEROS_TICKET_OID = "1.2.840.113554.1.2.2";
-
-  public static final String REALM = "EXAMPLE.COM";
-  public static final String KDC_HOST = "localhost";
-  public static final String CLIENT_PRINCIPAL = "client@" + REALM;
-  public static final String SERVER_PRINCIPAL = "HTTP/" + KDC_HOST + "@" + REALM;
-
-  private SpnegoTestUtil() {}
-
-  public static int getFreePort() throws IOException {
-    ServerSocket s = new ServerSocket(0);
-    try {
-      s.setReuseAddress(true);
-      int port = s.getLocalPort();
-      return port;
-    } finally {
-      if (null != s) {
-        s.close();
-      }
-    }
-  }
-
-  public static void setupUser(SimpleKdcServer kdc, File keytab, String principal)
-      throws KrbException {
-    kdc.createPrincipal(principal);
-    kdc.exportPrincipal(principal, keytab);
-  }
-
-  /**
-   * Recursively deletes a {@link File}.
-   */
-  public static void deleteRecursively(File d) {
-    if (d.isDirectory()) {
-      for (String name : d.list()) {
-        File child = new File(d, name);
-        if (child.isFile()) {
-          child.delete();
-        } else {
-          deleteRecursively(d);
-        }
-      }
-    }
-    d.delete();
-  }
-
-  /**
-   * Creates the SPNEGO JAAS configuration file for the Jetty server
-   */
-  public static void writeSpnegoConf(File configFile, File serverKeytab)
-      throws Exception {
-    try (BufferedWriter writer =
-             new BufferedWriter(
-                 new OutputStreamWriter(
-                     new FileOutputStream(configFile),
-                     StandardCharsets.UTF_8))) {
-      // Server login
-      writer.write("com.sun.security.jgss.accept {\n");
-      writer.write(" com.sun.security.auth.module.Krb5LoginModule required\n");
-      writer.write(" principal=\"" + SERVER_PRINCIPAL + "\"\n");
-      writer.write(" useKeyTab=true\n");
-      writer.write(" keyTab=\"" + serverKeytab.toURI() + "\"\n");
-      writer.write(" storeKey=true \n");
-      // Some extra debug information from JAAS
-      //writer.write(" debug=true\n");
-      writer.write(" isInitiator=false;\n");
-      writer.write("};\n");
-    }
-  }
-
-  public static void refreshJaasConfiguration() {
-    // This is *extremely* important to make sure we get the right Configuration instance.
-    // Configuration keeps a static instance of Configuration that it will return once it
-    // has been initialized. We need to nuke that static instance to make sure our
-    // serverSpnegoConfigFile gets read.
-    AccessController.doPrivileged(new PrivilegedAction<Configuration>() {
-      public Configuration run() {
-        return Configuration.getConfiguration();
-      }
-    }).refresh();
-  }
-
-  /**
-   * A simple handler which returns "OK " with the client's authenticated name and HTTP/200 or
-   * HTTP/401 and the message "Not authenticated!".
-   */
-  public static class AuthenticationRequiredAvaticaHandler implements AvaticaHandler {
-    private final Handler handler = new DefaultHandler();
-
-    @Override public void handle(String target, Request baseRequest, HttpServletRequest request,
-        HttpServletResponse response) throws IOException, ServletException {
-      Authentication auth = baseRequest.getAuthentication();
-      if (Authentication.UNAUTHENTICATED == auth) {
-        throw new AssertionError("Unauthenticated users should not reach here!");
-      }
-
-      baseRequest.setHandled(true);
-      UserAuthentication userAuth = (UserAuthentication) auth;
-      UserIdentity userIdentity = userAuth.getUserIdentity();
-      Principal userPrincipal = userIdentity.getUserPrincipal();
-
-      response.getWriter().print("OK " + userPrincipal.getName());
-      response.setStatus(200);
-    }
-
-    @Override public void setServer(Server server) {
-      handler.setServer(server);
-    }
-
-    @Override public Server getServer() {
-      return handler.getServer();
-    }
-
-    @Override public void destroy() {
-      handler.destroy();
-    }
-
-    @Override public void start() throws Exception {
-      handler.start();
-    }
-
-    @Override public void stop() throws Exception {
-      handler.stop();
-    }
-
-    @Override public boolean isRunning() {
-      return handler.isRunning();
-    }
-
-    @Override public boolean isStarted() {
-      return handler.isStarted();
-    }
-
-    @Override public boolean isStarting() {
-      return handler.isStarting();
-    }
-
-    @Override public boolean isStopping() {
-      return handler.isStopping();
-    }
-
-    @Override public boolean isStopped() {
-      return handler.isStopped();
-    }
-
-    @Override public boolean isFailed() {
-      return handler.isFailed();
-    }
-
-    @Override public void addLifeCycleListener(Listener listener) {
-      handler.addLifeCycleListener(listener);
-    }
-
-    @Override public void removeLifeCycleListener(Listener listener) {
-      handler.removeLifeCycleListener(listener);
-    }
-
-    @Override public void setServerRpcMetadata(RpcMetadataResponse metadata) {}
-  }
-}
-
-// End SpnegoTestUtil.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/server/src/test/java/org/apache/calcite/avatica/SslDriverTest.java
----------------------------------------------------------------------
diff --git a/avatica/server/src/test/java/org/apache/calcite/avatica/SslDriverTest.java b/avatica/server/src/test/java/org/apache/calcite/avatica/SslDriverTest.java
deleted file mode 100644
index e3b89f5..0000000
--- a/avatica/server/src/test/java/org/apache/calcite/avatica/SslDriverTest.java
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import org.apache.calcite.avatica.jdbc.JdbcMeta;
-import org.apache.calcite.avatica.remote.Driver;
-import org.apache.calcite.avatica.remote.LocalService;
-import org.apache.calcite.avatica.server.HttpServer;
-import org.apache.calcite.avatica.util.DateTimeUtils;
-
-import org.bouncycastle.asn1.x500.X500Name;
-import org.bouncycastle.asn1.x500.style.IETFUtils;
-import org.bouncycastle.asn1.x500.style.RFC4519Style;
-import org.bouncycastle.asn1.x509.BasicConstraints;
-import org.bouncycastle.asn1.x509.Extension;
-import org.bouncycastle.asn1.x509.KeyUsage;
-import org.bouncycastle.cert.CertIOException;
-import org.bouncycastle.cert.X509CertificateHolder;
-import org.bouncycastle.cert.jcajce.JcaX509ExtensionUtils;
-import org.bouncycastle.cert.jcajce.JcaX509v3CertificateBuilder;
-import org.bouncycastle.jce.provider.BouncyCastleProvider;
-import org.bouncycastle.jce.provider.X509CertificateObject;
-import org.bouncycastle.operator.OperatorCreationException;
-import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder;
-import org.junit.AfterClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.math.BigInteger;
-import java.security.KeyPair;
-import java.security.KeyPairGenerator;
-import java.security.KeyStore;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-import java.security.PrivateKey;
-import java.security.PublicKey;
-import java.security.Security;
-import java.security.cert.Certificate;
-import java.security.cert.CertificateException;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.ResultSet;
-import java.sql.Statement;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.List;
-import java.util.Objects;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-/**
- * Test case for Avatica with TLS connectors.
- */
-@RunWith(Parameterized.class)
-public class SslDriverTest {
-  private static final Logger LOG = LoggerFactory.getLogger(SslDriverTest.class);
-
-  private static File keystore;
-  private static final String KEYSTORE_PASSWORD = "avaticasecret";
-  private static final ConnectionSpec CONNECTION_SPEC = ConnectionSpec.HSQLDB;
-  private static final List<HttpServer> SERVERS_TO_STOP = new ArrayList<>();
-
-  @Parameters public static List<Object[]> parameters() throws Exception {
-    final ArrayList<Object[]> parameters = new ArrayList<>();
-
-    // Create a self-signed cert
-    File target = new File(System.getProperty("user.dir"), "target");
-    keystore = new File(target, "avatica-test.jks");
-    if (keystore.isFile()) {
-      assertTrue("Failed to delete keystore: " + keystore, keystore.delete());
-    }
-    new CertTool().createSelfSignedCert(keystore, "avatica", KEYSTORE_PASSWORD);
-
-    // Create a LocalService around HSQLDB
-    final JdbcMeta jdbcMeta = new JdbcMeta(CONNECTION_SPEC.url,
-        CONNECTION_SPEC.username, CONNECTION_SPEC.password);
-    final LocalService localService = new LocalService(jdbcMeta);
-
-    for (Driver.Serialization serialization : new Driver.Serialization[] {
-      Driver.Serialization.JSON, Driver.Serialization.PROTOBUF}) {
-      // Build and start the server, using TLS
-      HttpServer httpServer = new HttpServer.Builder()
-          .withPort(0)
-          .withTLS(keystore, KEYSTORE_PASSWORD, keystore, KEYSTORE_PASSWORD)
-          .withHandler(localService, serialization)
-          .build();
-      httpServer.start();
-      SERVERS_TO_STOP.add(httpServer);
-
-      final String url = "jdbc:avatica:remote:url=https://localhost:" + httpServer.getPort()
-          + ";serialization=" + serialization + ";truststore=" + keystore.getAbsolutePath()
-          + ";truststore_password=" + KEYSTORE_PASSWORD;
-      LOG.info("JDBC URL {}", url);
-
-      parameters.add(new Object[] {url});
-    }
-
-    return parameters;
-  }
-
-  @AfterClass public static void stopKdc() throws Exception {
-    for (HttpServer server : SERVERS_TO_STOP) {
-      server.stop();
-    }
-  }
-
-  private final String jdbcUrl;
-
-  public SslDriverTest(String jdbcUrl) {
-    this.jdbcUrl = Objects.requireNonNull(jdbcUrl);
-  }
-
-  @Test
-  public void testReadWrite() throws Exception {
-    final String tableName = "testReadWrite";
-    try (Connection conn = DriverManager.getConnection(jdbcUrl);
-        Statement stmt = conn.createStatement()) {
-      assertFalse(stmt.execute("DROP TABLE IF EXISTS " + tableName));
-      assertFalse(stmt.execute("CREATE TABLE " + tableName + "(pk integer)"));
-      assertEquals(1, stmt.executeUpdate("INSERT INTO " + tableName + " VALUES(1)"));
-      assertEquals(1, stmt.executeUpdate("INSERT INTO " + tableName + " VALUES(2)"));
-      assertEquals(1, stmt.executeUpdate("INSERT INTO " + tableName + " VALUES(3)"));
-
-      ResultSet results = stmt.executeQuery("SELECT count(1) FROM " + tableName);
-      assertTrue(results.next());
-      assertEquals(3, results.getInt(1));
-    }
-  }
-
-  /**
-   * Utility class for creating certificates for testing.
-   */
-  private static class CertTool {
-    private static final String SIGNING_ALGORITHM = "SHA256WITHRSA";
-    private static final String ENC_ALGORITHM = "RSA";
-
-    static {
-      Security.addProvider(new BouncyCastleProvider());
-    }
-
-    private void createSelfSignedCert(File targetKeystore, String keyName,
-        String keystorePassword) {
-      if (targetKeystore.exists()) {
-        throw new RuntimeException("Keystore already exists: " + targetKeystore);
-      }
-
-      try {
-        KeyPair kp = generateKeyPair();
-
-        X509CertificateObject cert = generateCert(keyName, kp, true, kp.getPublic(),
-            kp.getPrivate());
-
-        char[] password = keystorePassword.toCharArray();
-        KeyStore keystore = KeyStore.getInstance("JKS");
-        keystore.load(null, null);
-        keystore.setCertificateEntry(keyName + "Cert", cert);
-        keystore.setKeyEntry(keyName + "Key", kp.getPrivate(), password, new Certificate[] {cert});
-        try (FileOutputStream fos = new FileOutputStream(targetKeystore)) {
-          keystore.store(fos, password);
-        }
-      } catch (Exception e) {
-        throw new RuntimeException(e);
-      }
-    }
-
-    private KeyPair generateKeyPair() throws NoSuchAlgorithmException, NoSuchProviderException {
-      KeyPairGenerator gen = KeyPairGenerator.getInstance(ENC_ALGORITHM);
-      gen.initialize(2048);
-      return gen.generateKeyPair();
-    }
-
-    private X509CertificateObject generateCert(String keyName, KeyPair kp, boolean isCertAuthority,
-        PublicKey signerPublicKey, PrivateKey signerPrivateKey) throws IOException,
-        CertIOException, OperatorCreationException, CertificateException,
-        NoSuchAlgorithmException {
-      Calendar startDate = DateTimeUtils.calendar();
-      Calendar endDate = DateTimeUtils.calendar();
-      endDate.add(Calendar.YEAR, 100);
-
-      BigInteger serialNumber = BigInteger.valueOf(startDate.getTimeInMillis());
-      X500Name issuer = new X500Name(
-          IETFUtils.rDNsFromString("cn=localhost", RFC4519Style.INSTANCE));
-      JcaX509v3CertificateBuilder certGen = new JcaX509v3CertificateBuilder(issuer,
-          serialNumber, startDate.getTime(), endDate.getTime(), issuer, kp.getPublic());
-      JcaX509ExtensionUtils extensionUtils = new JcaX509ExtensionUtils();
-      certGen.addExtension(Extension.subjectKeyIdentifier, false,
-          extensionUtils.createSubjectKeyIdentifier(kp.getPublic()));
-      certGen.addExtension(Extension.basicConstraints, false,
-          new BasicConstraints(isCertAuthority));
-      certGen.addExtension(Extension.authorityKeyIdentifier, false,
-          extensionUtils.createAuthorityKeyIdentifier(signerPublicKey));
-      if (isCertAuthority) {
-        certGen.addExtension(Extension.keyUsage, true, new KeyUsage(KeyUsage.keyCertSign));
-      }
-      X509CertificateHolder cert = certGen.build(
-          new JcaContentSignerBuilder(SIGNING_ALGORITHM).build(signerPrivateKey));
-      return new X509CertificateObject(cert.toASN1Structure());
-    }
-  }
-}
-
-// End SslDriverTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/server/src/test/java/org/apache/calcite/avatica/jdbc/JdbcMetaTest.java
----------------------------------------------------------------------
diff --git a/avatica/server/src/test/java/org/apache/calcite/avatica/jdbc/JdbcMetaTest.java b/avatica/server/src/test/java/org/apache/calcite/avatica/jdbc/JdbcMetaTest.java
deleted file mode 100644
index d84fd29..0000000
--- a/avatica/server/src/test/java/org/apache/calcite/avatica/jdbc/JdbcMetaTest.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.jdbc;
-
-import org.apache.calcite.avatica.AvaticaPreparedStatement;
-import org.apache.calcite.avatica.Meta.ConnectionHandle;
-import org.apache.calcite.avatica.Meta.Signature;
-import org.apache.calcite.avatica.Meta.StatementHandle;
-
-import com.google.common.cache.Cache;
-
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import java.sql.Connection;
-import java.sql.ParameterMetaData;
-import java.sql.PreparedStatement;
-import java.sql.ResultSetMetaData;
-import java.sql.SQLException;
-import java.util.UUID;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
-
-/**
- * Unit tests for {@link JdbcMeta}.
- */
-public class JdbcMetaTest {
-
-  @Test public void testExceptionPropagation() throws SQLException {
-    JdbcMeta meta = new JdbcMeta("url");
-    final Throwable e = new Exception();
-    final RuntimeException rte;
-    try {
-      meta.propagate(e);
-      fail("Expected an exception to be thrown");
-    } catch (RuntimeException caughtException) {
-      rte = caughtException;
-      assertThat(rte.getCause(), is(e));
-    }
-  }
-
-  @Test public void testPrepareSetsMaxRows() throws Exception {
-    final String id = UUID.randomUUID().toString();
-    final String sql = "SELECT * FROM FOO";
-    final int maxRows = 500;
-    final ConnectionHandle ch = new ConnectionHandle(id);
-    final AtomicInteger statementIdGenerator = new AtomicInteger(0);
-
-    JdbcMeta meta = Mockito.mock(JdbcMeta.class);
-    Connection connection = Mockito.mock(Connection.class);
-    PreparedStatement statement = Mockito.mock(PreparedStatement.class);
-    ResultSetMetaData resultSetMetaData = Mockito.mock(ResultSetMetaData.class);
-    ParameterMetaData parameterMetaData = Mockito.mock(ParameterMetaData.class);
-    @SuppressWarnings("unchecked")
-    Cache<Integer, StatementInfo> statementCache =
-        (Cache<Integer, StatementInfo>) Mockito.mock(Cache.class);
-
-    Mockito.when(meta.getStatementIdGenerator()).thenReturn(statementIdGenerator);
-    Mockito.when(meta.getStatementCache()).thenReturn(statementCache);
-    Mockito.when(meta.getConnection(id)).thenReturn(connection);
-    Mockito.when(connection.prepareStatement(sql)).thenReturn(statement);
-    Mockito.when(statement.isWrapperFor(AvaticaPreparedStatement.class)).thenReturn(false);
-    Mockito.when(statement.getMetaData()).thenReturn(resultSetMetaData);
-    Mockito.when(statement.getParameterMetaData()).thenReturn(parameterMetaData);
-    // Call the real methods
-    Mockito.doCallRealMethod().when(meta).setMaxRows(statement, maxRows);
-    Mockito.doCallRealMethod().when(meta).prepare(ch, sql, maxRows);
-
-    meta.prepare(ch, sql, maxRows);
-
-    Mockito.verify(statement).setMaxRows(maxRows);
-  }
-
-  @Test public void testPrepareAndExecuteSetsMaxRows() throws Exception {
-    final String id = UUID.randomUUID().toString();
-    final int statementId = 12345;
-    final String sql = "SELECT * FROM FOO";
-    final int maxRows = 500;
-
-    JdbcMeta meta = Mockito.mock(JdbcMeta.class);
-    PreparedStatement statement = Mockito.mock(PreparedStatement.class);
-    @SuppressWarnings("unchecked")
-    Cache<Integer, StatementInfo> statementCache =
-        (Cache<Integer, StatementInfo>) Mockito.mock(Cache.class);
-    Signature signature = Mockito.mock(Signature.class);
-
-    final StatementInfo statementInfo = new StatementInfo(statement);
-    final StatementHandle statementHandle = new StatementHandle(id, statementId, signature);
-
-    Mockito.when(meta.getStatementCache()).thenReturn(statementCache);
-    Mockito.when(statementCache.getIfPresent(statementId)).thenReturn(statementInfo);
-    Mockito.when(statement.getResultSet()).thenReturn(null);
-    // The real methods
-    Mockito.when(meta.prepareAndExecute(statementHandle, sql, maxRows, 50, null)).
-        thenCallRealMethod();
-    Mockito.doCallRealMethod().when(meta).setMaxRows(statement, maxRows);
-
-    // Call our method
-    meta.prepareAndExecute(statementHandle, sql, maxRows, 50, null);
-
-    // Verify we called setMaxRows with the right value
-    Mockito.verify(statement).setMaxRows(maxRows);
-  }
-}
-
-// End JdbcMetaTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/server/src/test/java/org/apache/calcite/avatica/jdbc/StatementInfoTest.java
----------------------------------------------------------------------
diff --git a/avatica/server/src/test/java/org/apache/calcite/avatica/jdbc/StatementInfoTest.java b/avatica/server/src/test/java/org/apache/calcite/avatica/jdbc/StatementInfoTest.java
deleted file mode 100644
index 2984692..0000000
--- a/avatica/server/src/test/java/org/apache/calcite/avatica/jdbc/StatementInfoTest.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.jdbc;
-
-import org.junit.Test;
-import org.mockito.InOrder;
-import org.mockito.Mockito;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
-
-import java.sql.ResultSet;
-import java.sql.SQLFeatureNotSupportedException;
-import java.sql.Statement;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-/**
- * Tests covering {@link StatementInfo}.
- */
-public class StatementInfoTest {
-
-  @Test
-  public void testLargeOffsets() throws Exception {
-    Statement stmt = Mockito.mock(Statement.class);
-    ResultSet results = Mockito.mock(ResultSet.class);
-
-    StatementInfo info = new StatementInfo(stmt);
-
-    Mockito.when(results.relative(Integer.MAX_VALUE)).thenReturn(true, true);
-    Mockito.when(results.relative(1)).thenReturn(true);
-
-    long offset = 1L + Integer.MAX_VALUE + Integer.MAX_VALUE;
-    assertTrue(info.advanceResultSetToOffset(results, offset));
-
-    InOrder inOrder = Mockito.inOrder(results);
-
-    inOrder.verify(results, Mockito.times(2)).relative(Integer.MAX_VALUE);
-    inOrder.verify(results).relative(1);
-
-    assertEquals(offset, info.getPosition());
-  }
-
-  @Test
-  public void testNextUpdatesPosition() throws Exception {
-    Statement stmt = Mockito.mock(Statement.class);
-    ResultSet results = Mockito.mock(ResultSet.class);
-
-    StatementInfo info = new StatementInfo(stmt);
-    info.setResultSet(results);
-
-    Mockito.when(results.next()).thenReturn(true, true, true, false);
-
-    for (int i = 0; i < 3; i++) {
-      assertTrue(i + "th call of next() should return true", info.next());
-      assertEquals(info.getPosition(), i + 1);
-    }
-
-    assertFalse("Expected last next() to return false", info.next());
-    assertEquals(info.getPosition(), 4L);
-  }
-
-  @Test(expected = IllegalArgumentException.class)
-  public void testNoMovement() throws Exception {
-    Statement stmt = Mockito.mock(Statement.class);
-    ResultSet results = Mockito.mock(ResultSet.class);
-
-    StatementInfo info = new StatementInfo(stmt);
-    info.setPosition(500);
-
-    info.advanceResultSetToOffset(results, 400);
-  }
-
-  @Test public void testResultSetGetter() throws Exception {
-    Statement stmt = Mockito.mock(Statement.class);
-    ResultSet results = Mockito.mock(ResultSet.class);
-
-    StatementInfo info = new StatementInfo(stmt);
-
-    assertFalse("ResultSet should not be initialized", info.isResultSetInitialized());
-    assertNull("ResultSet should be null", info.getResultSet());
-
-    info.setResultSet(results);
-
-    assertTrue("ResultSet should be initialized", info.isResultSetInitialized());
-    assertEquals(results, info.getResultSet());
-  }
-
-  @Test public void testCheckPositionAfterFailedRelative() throws Exception {
-    Statement stmt = Mockito.mock(Statement.class);
-    ResultSet results = Mockito.mock(ResultSet.class);
-    final long offset = 500;
-
-    StatementInfo info = new StatementInfo(stmt);
-    info.setResultSet(results);
-
-    // relative() doesn't work
-    Mockito.when(results.relative((int) offset)).thenThrow(new SQLFeatureNotSupportedException());
-    // Should fall back to next(), 500 calls to next, 1 false
-    Mockito.when(results.next()).then(new Answer<Boolean>() {
-      private long invocations = 0;
-
-      // Return true until 500, false after.
-      @Override public Boolean answer(InvocationOnMock invocation) throws Throwable {
-        invocations++;
-        if (invocations >= offset) {
-          return false;
-        }
-        return true;
-      }
-    });
-
-    info.advanceResultSetToOffset(results, offset);
-
-    // Verify correct position
-    assertEquals(offset, info.getPosition());
-    // Make sure that we actually advanced the result set
-    Mockito.verify(results, Mockito.times(500)).next();
-  }
-}
-
-// End StatementInfoTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/server/src/test/java/org/apache/calcite/avatica/remote/AlternatingRemoteMetaTest.java
----------------------------------------------------------------------
diff --git a/avatica/server/src/test/java/org/apache/calcite/avatica/remote/AlternatingRemoteMetaTest.java b/avatica/server/src/test/java/org/apache/calcite/avatica/remote/AlternatingRemoteMetaTest.java
deleted file mode 100644
index d0c10c6..0000000
--- a/avatica/server/src/test/java/org/apache/calcite/avatica/remote/AlternatingRemoteMetaTest.java
+++ /dev/null
@@ -1,398 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import org.apache.calcite.avatica.AvaticaConnection;
-import org.apache.calcite.avatica.AvaticaStatement;
-import org.apache.calcite.avatica.ConnectionConfig;
-import org.apache.calcite.avatica.ConnectionPropertiesImpl;
-import org.apache.calcite.avatica.ConnectionSpec;
-import org.apache.calcite.avatica.Meta;
-import org.apache.calcite.avatica.jdbc.JdbcMeta;
-import org.apache.calcite.avatica.server.AvaticaJsonHandler;
-import org.apache.calcite.avatica.server.HttpServer;
-import org.apache.calcite.avatica.server.Main;
-import org.apache.calcite.avatica.server.Main.HandlerFactory;
-
-import com.google.common.cache.Cache;
-
-import org.eclipse.jetty.server.handler.AbstractHandler;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-
-/**
- * Tests that verify that the Driver still functions when requests are randomly bounced between
- * more than one server.
- */
-public class AlternatingRemoteMetaTest {
-  private static final ConnectionSpec CONNECTION_SPEC = ConnectionSpec.HSQLDB;
-
-  private static String url;
-
-  static {
-    try {
-      // Force DriverManager initialization before we hit AlternatingDriver->Driver.<clinit>
-      // Otherwise Driver.<clinit> -> DriverManager.registerDriver -> scan service provider files
-      // causes a deadlock; see [CALCITE-1060]
-      DriverManager.getDrivers();
-      DriverManager.registerDriver(new AlternatingDriver());
-    } catch (SQLException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  // Keep a reference to the servers we start to clean them up after
-  private static final List<HttpServer> ACTIVE_SERVERS = new ArrayList<>();
-
-  /** Factory that provides a {@link JdbcMeta}. */
-  public static class FullyRemoteJdbcMetaFactory implements Meta.Factory {
-
-    private static JdbcMeta instance = null;
-
-    private static JdbcMeta getInstance() {
-      if (instance == null) {
-        try {
-          instance = new JdbcMeta(CONNECTION_SPEC.url, CONNECTION_SPEC.username,
-              CONNECTION_SPEC.password);
-        } catch (SQLException e) {
-          throw new RuntimeException(e);
-        }
-      }
-      return instance;
-    }
-
-    @Override public Meta create(List<String> args) {
-      return getInstance();
-    }
-  }
-
-  /**
-   * AvaticaHttpClient implementation that randomly chooses among the provided URLs.
-   */
-  public static class AlternatingAvaticaHttpClient implements AvaticaHttpClient {
-    private final List<AvaticaHttpClientImpl> clients;
-    private final Random r = new Random();
-
-    public AlternatingAvaticaHttpClient(List<URL> urls) {
-      //System.out.println("Constructing clients for " + urls);
-      clients = new ArrayList<>(urls.size());
-      for (URL url : urls) {
-        clients.add(new AvaticaHttpClientImpl(url));
-      }
-    }
-
-    public byte[] send(byte[] request) {
-      AvaticaHttpClientImpl client = clients.get(r.nextInt(clients.size()));
-      //System.out.println("URL: " + client.url);
-      return client.send(request);
-    }
-
-  }
-
-  /**
-   * Driver implementation {@link AlternatingAvaticaHttpClient}.
-   */
-  public static class AlternatingDriver extends Driver {
-
-    public static final String PREFIX = "jdbc:avatica:remote-alternating:";
-
-    @Override protected String getConnectStringPrefix() {
-      return PREFIX;
-    }
-
-    @Override public Meta createMeta(AvaticaConnection connection) {
-      final ConnectionConfig config = connection.config();
-      final Service service = new RemoteService(getHttpClient(connection, config));
-      connection.setService(service);
-      return new RemoteMeta(connection, service);
-    }
-
-    @Override AvaticaHttpClient getHttpClient(AvaticaConnection connection,
-        ConnectionConfig config) {
-      return new AlternatingAvaticaHttpClient(parseUrls(config.url()));
-    }
-
-    List<URL> parseUrls(String urlStr) {
-      final List<URL> urls = new ArrayList<>();
-      final char comma = ',';
-
-      int prevIndex = 0;
-      int index = urlStr.indexOf(comma);
-      if (-1 == index) {
-        try {
-          return Collections.singletonList(new URL(urlStr));
-        } catch (MalformedURLException e) {
-          throw new RuntimeException(e);
-        }
-      }
-
-      // String split w/o regex
-      while (-1 != index) {
-        try {
-          urls.add(new URL(urlStr.substring(prevIndex, index)));
-        } catch (MalformedURLException e) {
-          throw new RuntimeException(e);
-        }
-        prevIndex = index + 1;
-        index = urlStr.indexOf(comma, prevIndex);
-      }
-
-      // Get the last one
-      try {
-        urls.add(new URL(urlStr.substring(prevIndex)));
-      } catch (MalformedURLException e) {
-        throw new RuntimeException(e);
-      }
-
-      return urls;
-    }
-
-  }
-
-  @BeforeClass
-  public static void beforeClass() throws Exception {
-    final String[] mainArgs = new String[] { FullyRemoteJdbcMetaFactory.class.getName() };
-
-    // Bind to '0' to pluck an ephemeral port instead of expecting a certain one to be free
-
-    StringBuilder sb = new StringBuilder();
-    for (int i = 0; i < 2; i++) {
-      if (sb.length() > 0) {
-        sb.append(",");
-      }
-      HttpServer jsonServer = Main.start(mainArgs, 0, new HandlerFactory() {
-        @Override public AbstractHandler createHandler(Service service) {
-          return new AvaticaJsonHandler(service);
-        }
-      });
-      ACTIVE_SERVERS.add(jsonServer);
-      sb.append("http://localhost:").append(jsonServer.getPort());
-    }
-
-    url = AlternatingDriver.PREFIX + "url=" + sb.toString();
-  }
-
-  @AfterClass public static void afterClass() throws Exception {
-    for (HttpServer server : ACTIVE_SERVERS) {
-      if (server != null) {
-        server.stop();
-      }
-    }
-  }
-
-  private static Meta getMeta(AvaticaConnection conn) throws Exception {
-    Field f = AvaticaConnection.class.getDeclaredField("meta");
-    f.setAccessible(true);
-    return (Meta) f.get(conn);
-  }
-
-  private static Meta.ExecuteResult prepareAndExecuteInternal(AvaticaConnection conn,
-    final AvaticaStatement statement, String sql, int maxRowCount) throws Exception {
-    Method m =
-        AvaticaConnection.class.getDeclaredMethod("prepareAndExecuteInternal",
-            AvaticaStatement.class, String.class, long.class);
-    m.setAccessible(true);
-    return (Meta.ExecuteResult) m.invoke(conn, statement, sql, maxRowCount);
-  }
-
-  private static Connection getConnection(JdbcMeta m, String id) throws Exception {
-    Field f = JdbcMeta.class.getDeclaredField("connectionCache");
-    f.setAccessible(true);
-    //noinspection unchecked
-    Cache<String, Connection> connectionCache = (Cache<String, Connection>) f.get(m);
-    return connectionCache.getIfPresent(id);
-  }
-
-  @Test public void testRemoteExecuteMaxRowCount() throws Exception {
-    ConnectionSpec.getDatabaseLock().lock();
-    try (AvaticaConnection conn = (AvaticaConnection) DriverManager.getConnection(url)) {
-      final AvaticaStatement statement = conn.createStatement();
-      prepareAndExecuteInternal(conn, statement,
-        "select * from (values ('a', 1), ('b', 2))", 0);
-      ResultSet rs = statement.getResultSet();
-      int count = 0;
-      while (rs.next()) {
-        count++;
-      }
-      assertEquals("Check maxRowCount=0 and ResultSets is 0 row", count, 0);
-      assertEquals("Check result set meta is still there",
-        rs.getMetaData().getColumnCount(), 2);
-      rs.close();
-      statement.close();
-      conn.close();
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  /** Test case for
-   * <a href="https://issues.apache.org/jira/browse/CALCITE-780">[CALCITE-780]
-   * HTTP error 413 when sending a long string to the Avatica server</a>. */
-  @Test public void testRemoteExecuteVeryLargeQuery() throws Exception {
-    ConnectionSpec.getDatabaseLock().lock();
-    try {
-      // Before the bug was fixed, a value over 7998 caused an HTTP 413.
-      // 16K bytes, I guess.
-      checkLargeQuery(8);
-      checkLargeQuery(240);
-      checkLargeQuery(8000);
-      checkLargeQuery(240000);
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  private void checkLargeQuery(int n) throws Exception {
-    try (AvaticaConnection conn = (AvaticaConnection) DriverManager.getConnection(url)) {
-      final AvaticaStatement statement = conn.createStatement();
-      final String frenchDisko = "It said human existence is pointless\n"
-          + "As acts of rebellious solidarity\n"
-          + "Can bring sense in this world\n"
-          + "La resistance!\n";
-      final String sql = "select '"
-          + longString(frenchDisko, n)
-          + "' as s from (values 'x')";
-      prepareAndExecuteInternal(conn, statement, sql, -1);
-      ResultSet rs = statement.getResultSet();
-      int count = 0;
-      while (rs.next()) {
-        count++;
-      }
-      assertThat(count, is(1));
-      rs.close();
-      statement.close();
-      conn.close();
-    }
-  }
-
-  /** Creates a string of exactly {@code length} characters by concatenating
-   * {@code fragment}. */
-  private static String longString(String fragment, int length) {
-    assert fragment.length() > 0;
-    final StringBuilder buf = new StringBuilder();
-    while (buf.length() < length) {
-      buf.append(fragment);
-    }
-    buf.setLength(length);
-    return buf.toString();
-  }
-
-  @Test public void testRemoteConnectionProperties() throws Exception {
-    ConnectionSpec.getDatabaseLock().lock();
-    try (AvaticaConnection conn = (AvaticaConnection) DriverManager.getConnection(url)) {
-      String id = conn.id;
-      final Map<String, ConnectionPropertiesImpl> m = ((RemoteMeta) getMeta(conn)).propsMap;
-      assertFalse("remote connection map should start ignorant", m.containsKey(id));
-      // force creating a connection object on the remote side.
-      try (final Statement stmt = conn.createStatement()) {
-        assertTrue("creating a statement starts a local object.", m.containsKey(id));
-        assertTrue(stmt.execute("select count(1) from EMP"));
-      }
-      Connection remoteConn = getConnection(FullyRemoteJdbcMetaFactory.getInstance(), id);
-      final boolean defaultRO = remoteConn.isReadOnly();
-      final boolean defaultAutoCommit = remoteConn.getAutoCommit();
-      final String defaultCatalog = remoteConn.getCatalog();
-      final String defaultSchema = remoteConn.getSchema();
-      conn.setReadOnly(!defaultRO);
-      assertTrue("local changes dirty local state", m.get(id).isDirty());
-      assertEquals("remote connection has not been touched", defaultRO, remoteConn.isReadOnly());
-      conn.setAutoCommit(!defaultAutoCommit);
-      assertEquals("remote connection has not been touched",
-          defaultAutoCommit, remoteConn.getAutoCommit());
-
-      // further interaction with the connection will force a sync
-      try (final Statement stmt = conn.createStatement()) {
-        assertEquals(!defaultAutoCommit, remoteConn.getAutoCommit());
-        assertFalse("local values should be clean", m.get(id).isDirty());
-      }
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  @Test public void testQuery() throws Exception {
-    ConnectionSpec.getDatabaseLock().lock();
-    try (AvaticaConnection conn = (AvaticaConnection) DriverManager.getConnection(url);
-        Statement statement = conn.createStatement()) {
-      assertFalse(statement.execute("SET SCHEMA \"SCOTT\""));
-      assertFalse(
-          statement.execute(
-              "CREATE TABLE \"FOO\"(\"KEY\" INTEGER NOT NULL, \"VALUE\" VARCHAR(10))"));
-      assertFalse(statement.execute("SET TABLE \"FOO\" READONLY FALSE"));
-
-      final int numRecords = 1000;
-      for (int i = 0; i < numRecords; i++) {
-        assertFalse(statement.execute("INSERT INTO \"FOO\" VALUES(" + i + ", '" + i + "')"));
-      }
-
-      // Make sure all the records are there that we expect
-      ResultSet results = statement.executeQuery("SELECT count(KEY) FROM FOO");
-      assertTrue(results.next());
-      assertEquals(1000, results.getInt(1));
-      assertFalse(results.next());
-
-      results = statement.executeQuery("SELECT KEY, VALUE FROM FOO ORDER BY KEY ASC");
-      for (int i = 0; i < numRecords; i++) {
-        assertTrue(results.next());
-        assertEquals(i, results.getInt(1));
-        assertEquals(Integer.toString(i), results.getString(2));
-      }
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  @Test public void testSingleUrlParsing() throws Exception {
-    AlternatingDriver d = new AlternatingDriver();
-    List<URL> urls = d.parseUrls("http://localhost:1234");
-    assertEquals(Arrays.asList(new URL("http://localhost:1234")), urls);
-  }
-
-  @Test public void testMultipleUrlParsing() throws Exception {
-    AlternatingDriver d = new AlternatingDriver();
-    List<URL> urls = d.parseUrls("http://localhost:1234,http://localhost:2345,"
-        + "http://localhost:3456");
-    List<URL> expectedUrls = Arrays.asList(new URL("http://localhost:1234"),
-        new URL("http://localhost:2345"), new URL("http://localhost:3456"));
-    assertEquals(expectedUrls, urls);
-  }
-}
-
-// End AlternatingRemoteMetaTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/server/src/test/java/org/apache/calcite/avatica/remote/RemoteMetaTest.java
----------------------------------------------------------------------
diff --git a/avatica/server/src/test/java/org/apache/calcite/avatica/remote/RemoteMetaTest.java b/avatica/server/src/test/java/org/apache/calcite/avatica/remote/RemoteMetaTest.java
deleted file mode 100644
index ebd3c76..0000000
--- a/avatica/server/src/test/java/org/apache/calcite/avatica/remote/RemoteMetaTest.java
+++ /dev/null
@@ -1,774 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import org.apache.calcite.avatica.AvaticaConnection;
-import org.apache.calcite.avatica.AvaticaSpecificDatabaseMetaData;
-import org.apache.calcite.avatica.AvaticaSqlException;
-import org.apache.calcite.avatica.AvaticaStatement;
-import org.apache.calcite.avatica.AvaticaUtils;
-import org.apache.calcite.avatica.ConnectionPropertiesImpl;
-import org.apache.calcite.avatica.ConnectionSpec;
-import org.apache.calcite.avatica.Meta;
-import org.apache.calcite.avatica.Meta.DatabaseProperty;
-import org.apache.calcite.avatica.jdbc.JdbcMeta;
-import org.apache.calcite.avatica.remote.Service.ErrorResponse;
-import org.apache.calcite.avatica.remote.Service.Response;
-import org.apache.calcite.avatica.server.AvaticaJsonHandler;
-import org.apache.calcite.avatica.server.AvaticaProtobufHandler;
-import org.apache.calcite.avatica.server.HttpServer;
-import org.apache.calcite.avatica.server.Main;
-import org.apache.calcite.avatica.server.Main.HandlerFactory;
-import org.apache.calcite.avatica.util.ArrayImpl;
-import org.apache.calcite.avatica.util.FilteredConstants;
-
-import com.google.common.base.Throwables;
-import com.google.common.cache.Cache;
-
-import org.junit.AfterClass;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-
-import java.io.DataOutputStream;
-import java.io.InputStream;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.net.HttpURLConnection;
-import java.net.InetAddress;
-import java.net.URL;
-import java.nio.charset.StandardCharsets;
-import java.sql.Array;
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.DriverManager;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Random;
-import java.util.UUID;
-
-import static org.hamcrest.CoreMatchers.instanceOf;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.core.StringContains.containsString;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-/** Tests covering {@link RemoteMeta}. */
-@RunWith(Parameterized.class)
-public class RemoteMetaTest {
-  private static final Random RANDOM = new Random();
-  private static final ConnectionSpec CONNECTION_SPEC = ConnectionSpec.HSQLDB;
-
-  // Keep a reference to the servers we start to clean them up after
-  private static final List<HttpServer> ACTIVE_SERVERS = new ArrayList<>();
-
-  private final HttpServer server;
-  private final String url;
-  private final int port;
-  private final Driver.Serialization serialization;
-
-  @Parameters
-  public static List<Object[]> parameters() throws Exception {
-    List<Object[]> params = new ArrayList<>();
-
-    final String[] mainArgs = { FullyRemoteJdbcMetaFactory.class.getName() };
-
-    // Bind to '0' to pluck an ephemeral port instead of expecting a certain one to be free
-
-    final HttpServer jsonServer = Main.start(mainArgs, 0, new HandlerFactory() {
-      @Override public AvaticaJsonHandler createHandler(Service service) {
-        return new AvaticaJsonHandler(service);
-      }
-    });
-    params.add(new Object[] {jsonServer, Driver.Serialization.JSON});
-    ACTIVE_SERVERS.add(jsonServer);
-
-    final HttpServer protobufServer = Main.start(mainArgs, 0, new HandlerFactory() {
-      @Override public AvaticaProtobufHandler createHandler(Service service) {
-        return new AvaticaProtobufHandler(service);
-      }
-    });
-    params.add(new Object[] {protobufServer, Driver.Serialization.PROTOBUF});
-
-    ACTIVE_SERVERS.add(protobufServer);
-
-    return params;
-  }
-
-  public RemoteMetaTest(HttpServer server, Driver.Serialization serialization) {
-    this.server = server;
-    this.port = this.server.getPort();
-    this.serialization = serialization;
-    url = "jdbc:avatica:remote:url=http://localhost:" + port + ";serialization="
-        + serialization.name();
-  }
-
-  @AfterClass public static void afterClass() throws Exception {
-    for (HttpServer server : ACTIVE_SERVERS) {
-      if (server != null) {
-        server.stop();
-      }
-    }
-  }
-
-  private static Meta getMeta(AvaticaConnection conn) throws Exception {
-    Field f = AvaticaConnection.class.getDeclaredField("meta");
-    f.setAccessible(true);
-    return (Meta) f.get(conn);
-  }
-
-  private static Meta.ExecuteResult prepareAndExecuteInternal(AvaticaConnection conn,
-    final AvaticaStatement statement, String sql, int maxRowCount) throws Exception {
-    Method m =
-        AvaticaConnection.class.getDeclaredMethod("prepareAndExecuteInternal",
-            AvaticaStatement.class, String.class, long.class);
-    m.setAccessible(true);
-    return (Meta.ExecuteResult) m.invoke(conn, statement, sql, maxRowCount);
-  }
-
-  private static Connection getConnection(JdbcMeta m, String id) throws Exception {
-    Field f = JdbcMeta.class.getDeclaredField("connectionCache");
-    f.setAccessible(true);
-    //noinspection unchecked
-    Cache<String, Connection> connectionCache = (Cache<String, Connection>) f.get(m);
-    return connectionCache.getIfPresent(id);
-  }
-
-  @Test public void testRemoteExecuteMaxRowCount() throws Exception {
-    ConnectionSpec.getDatabaseLock().lock();
-    try (AvaticaConnection conn = (AvaticaConnection) DriverManager.getConnection(url)) {
-      final AvaticaStatement statement = conn.createStatement();
-      prepareAndExecuteInternal(conn, statement,
-        "select * from (values ('a', 1), ('b', 2))", 0);
-      ResultSet rs = statement.getResultSet();
-      int count = 0;
-      while (rs.next()) {
-        count++;
-      }
-      assertEquals("Check maxRowCount=0 and ResultSets is 0 row", count, 0);
-      assertEquals("Check result set meta is still there",
-        rs.getMetaData().getColumnCount(), 2);
-      rs.close();
-      statement.close();
-      conn.close();
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  /** Test case for
-   * <a href="https://issues.apache.org/jira/browse/CALCITE-1301">[CALCITE-1301]
-   * Add cancel flag to AvaticaStatement</a>. */
-  @Test public void testCancel() throws Exception {
-    ConnectionSpec.getDatabaseLock().lock();
-    try (AvaticaConnection conn = (AvaticaConnection) DriverManager.getConnection(url)) {
-      final AvaticaStatement statement = conn.createStatement();
-      final String sql = "select * from (values ('a', 1), ('b', 2))";
-      final ResultSet rs = statement.executeQuery(sql);
-      int count = 0;
-    loop:
-      for (;;) {
-        switch (count++) {
-        case 0:
-          assertThat(rs.next(), is(true));
-          break;
-        case 1:
-          rs.getStatement().cancel();
-          try {
-            boolean x = rs.next();
-            fail("expected exception, got " + x);
-          } catch (SQLException e) {
-            assertThat(e.getMessage(), is("Statement canceled"));
-          }
-          break loop;
-        default:
-          fail("count: " + count);
-        }
-      }
-      assertThat(count, is(2));
-      assertThat(statement.isClosed(), is(false));
-      rs.close();
-      assertThat(statement.isClosed(), is(false));
-      statement.close();
-      assertThat(statement.isClosed(), is(true));
-      statement.close();
-      assertThat(statement.isClosed(), is(true));
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  /** Test case for
-   * <a href="https://issues.apache.org/jira/browse/CALCITE-780">[CALCITE-780]
-   * HTTP error 413 when sending a long string to the Avatica server</a>. */
-  @Test public void testRemoteExecuteVeryLargeQuery() throws Exception {
-    ConnectionSpec.getDatabaseLock().lock();
-    try {
-      // Before the bug was fixed, a value over 7998 caused an HTTP 413.
-      // 16K bytes, I guess.
-      checkLargeQuery(8);
-      checkLargeQuery(240);
-      checkLargeQuery(8000);
-      checkLargeQuery(240000);
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  private void checkLargeQuery(int n) throws Exception {
-    try (AvaticaConnection conn = (AvaticaConnection) DriverManager.getConnection(url)) {
-      final AvaticaStatement statement = conn.createStatement();
-      final String frenchDisko = "It said human existence is pointless\n"
-          + "As acts of rebellious solidarity\n"
-          + "Can bring sense in this world\n"
-          + "La resistance!\n";
-      final String sql = "select '"
-          + longString(frenchDisko, n)
-          + "' as s from (values 'x')";
-      prepareAndExecuteInternal(conn, statement, sql, -1);
-      ResultSet rs = statement.getResultSet();
-      int count = 0;
-      while (rs.next()) {
-        count++;
-      }
-      assertThat(count, is(1));
-      rs.close();
-      statement.close();
-      conn.close();
-    }
-  }
-
-  /** Creates a string of exactly {@code length} characters by concatenating
-   * {@code fragment}. */
-  private static String longString(String fragment, int length) {
-    assert fragment.length() > 0;
-    final StringBuilder buf = new StringBuilder();
-    while (buf.length() < length) {
-      buf.append(fragment);
-    }
-    buf.setLength(length);
-    return buf.toString();
-  }
-
-  @Test public void testRemoteConnectionProperties() throws Exception {
-    ConnectionSpec.getDatabaseLock().lock();
-    try (AvaticaConnection conn = (AvaticaConnection) DriverManager.getConnection(url)) {
-      String id = conn.id;
-      final Map<String, ConnectionPropertiesImpl> m = ((RemoteMeta) getMeta(conn)).propsMap;
-      assertFalse("remote connection map should start ignorant", m.containsKey(id));
-      // force creating a connection object on the remote side.
-      try (final Statement stmt = conn.createStatement()) {
-        assertTrue("creating a statement starts a local object.", m.containsKey(id));
-        assertTrue(stmt.execute("select count(1) from EMP"));
-      }
-      Connection remoteConn = getConnection(FullyRemoteJdbcMetaFactory.getInstance(), id);
-      final boolean defaultRO = remoteConn.isReadOnly();
-      final boolean defaultAutoCommit = remoteConn.getAutoCommit();
-      final String defaultCatalog = remoteConn.getCatalog();
-      final String defaultSchema = remoteConn.getSchema();
-      conn.setReadOnly(!defaultRO);
-      assertTrue("local changes dirty local state", m.get(id).isDirty());
-      assertEquals("remote connection has not been touched", defaultRO, remoteConn.isReadOnly());
-      conn.setAutoCommit(!defaultAutoCommit);
-      assertEquals("remote connection has not been touched",
-          defaultAutoCommit, remoteConn.getAutoCommit());
-
-      // further interaction with the connection will force a sync
-      try (final Statement stmt = conn.createStatement()) {
-        assertEquals(!defaultAutoCommit, remoteConn.getAutoCommit());
-        assertFalse("local values should be clean", m.get(id).isDirty());
-      }
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  @Test public void testRemoteStatementInsert() throws Exception {
-    ConnectionSpec.getDatabaseLock().lock();
-    try {
-      final String t = AvaticaUtils.unique("TEST_TABLE2");
-      AvaticaConnection conn = (AvaticaConnection) DriverManager.getConnection(url);
-      Statement statement = conn.createStatement();
-      final String create =
-          String.format(Locale.ROOT, "create table if not exists %s ("
-              + "  id int not null, msg varchar(255) not null)", t);
-      int status = statement.executeUpdate(create);
-      assertEquals(status, 0);
-
-      statement = conn.createStatement();
-      final String update =
-          String.format(Locale.ROOT, "insert into %s values ('%d', '%s')",
-              t, RANDOM.nextInt(Integer.MAX_VALUE), UUID.randomUUID());
-      status = statement.executeUpdate(update);
-      assertEquals(status, 1);
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  @Test public void testBigints() throws Exception {
-    final String table = "TESTBIGINTS";
-    ConnectionSpec.getDatabaseLock().lock();
-    try (AvaticaConnection conn = (AvaticaConnection) DriverManager.getConnection(url);
-        Statement stmt = conn.createStatement()) {
-      assertFalse(stmt.execute("DROP TABLE IF EXISTS " + table));
-      assertFalse(stmt.execute("CREATE TABLE " + table + " (id BIGINT)"));
-      assertFalse(stmt.execute("INSERT INTO " + table + " values(10)"));
-      ResultSet results = conn.getMetaData().getColumns(null, null, table, null);
-      assertTrue(results.next());
-      assertEquals(table, results.getString(3));
-      // ordinal position
-      assertEquals(1L, results.getLong(17));
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  @Test public void testOpenConnectionWithProperties() throws Exception {
-    // This tests that username and password are used for creating a connection on the
-    // server. If this was not the case, it would succeed.
-    try {
-      DriverManager.getConnection(url, "john", "doe");
-      fail("expected exception");
-    } catch (RuntimeException e) {
-      assertEquals("Remote driver error: RuntimeException: "
-          + "java.sql.SQLInvalidAuthorizationSpecException: invalid authorization specification"
-          + " - not found: john"
-          + " -> SQLInvalidAuthorizationSpecException: invalid authorization specification - "
-          + "not found: john"
-          + " -> HsqlException: invalid authorization specification - not found: john",
-          e.getMessage());
-    }
-  }
-
-  @Test public void testRemoteConnectionsAreDifferent() throws SQLException {
-    ConnectionSpec.getDatabaseLock().lock();
-    try {
-      Connection conn1 = DriverManager.getConnection(url);
-      Statement stmt = conn1.createStatement();
-      stmt.execute("DECLARE LOCAL TEMPORARY TABLE"
-          + " buffer (id INTEGER PRIMARY KEY, textdata VARCHAR(100))");
-      stmt.execute("insert into buffer(id, textdata) values(1, 'abc')");
-      stmt.executeQuery("select * from buffer");
-
-      // The local temporary table is local to the connection above, and should
-      // not be visible on another connection
-      Connection conn2 = DriverManager.getConnection(url);
-      Statement stmt2 = conn2.createStatement();
-      try {
-        stmt2.executeQuery("select * from buffer");
-        fail("expected exception");
-      } catch (Exception e) {
-        assertEquals("Error -1 (00000) : Error while executing SQL \"select * from buffer\": "
-            + "Remote driver error: RuntimeException: java.sql.SQLSyntaxErrorException: "
-            + "user lacks privilege or object not found: BUFFER -> "
-            + "SQLSyntaxErrorException: user lacks privilege or object not found: BUFFER -> "
-            + "HsqlException: user lacks privilege or object not found: BUFFER",
-            e.getMessage());
-      }
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  @Ignore("[CALCITE-942] AvaticaConnection should fail-fast when closed.")
-  @Test public void testRemoteConnectionClosing() throws Exception {
-    AvaticaConnection conn = (AvaticaConnection) DriverManager.getConnection(url);
-    // Verify connection is usable
-    conn.createStatement();
-    conn.close();
-
-    // After closing the connection, it should not be usable anymore
-    try {
-      conn.createStatement();
-      fail("expected exception");
-    } catch (SQLException e) {
-      assertThat(e.getMessage(),
-          containsString("Connection is closed"));
-    }
-  }
-
-  @Test public void testExceptionPropagation() throws Exception {
-    final String sql = "SELECT * from EMP LIMIT FOOBARBAZ";
-    ConnectionSpec.getDatabaseLock().lock();
-    try (final AvaticaConnection conn = (AvaticaConnection) DriverManager.getConnection(url);
-        final Statement stmt = conn.createStatement()) {
-      try {
-        // invalid SQL
-        stmt.execute(sql);
-        fail("Expected an AvaticaSqlException");
-      } catch (AvaticaSqlException e) {
-        assertEquals(ErrorResponse.UNKNOWN_ERROR_CODE, e.getErrorCode());
-        assertEquals(ErrorResponse.UNKNOWN_SQL_STATE, e.getSQLState());
-        assertTrue("Message should contain original SQL, was '" + e.getMessage() + "'",
-            e.getMessage().contains(sql));
-        assertEquals(1, e.getStackTraces().size());
-        final String stacktrace = e.getStackTraces().get(0);
-        final String substring = "unexpected token: FOOBARBAZ";
-        assertTrue("Message should contain '" + substring + "', was '" + e.getMessage() + ",",
-            stacktrace.contains(substring));
-      }
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  @Test public void testRemoteColumnsMeta() throws Exception {
-    ConnectionSpec.getDatabaseLock().lock();
-    try {
-      // Verify all columns are retrieved, thus that frame-based fetching works correctly
-      // for columns
-      int rowCount = 0;
-      try (AvaticaConnection conn = (AvaticaConnection) DriverManager.getConnection(url)) {
-        ResultSet rs = conn.getMetaData().getColumns(null, null, null, null);
-        while (rs.next()) {
-          rowCount++;
-        }
-        rs.close();
-
-        // The implicitly created statement should have been closed
-        assertTrue(rs.getStatement().isClosed());
-      }
-      // default fetch size is 100, we are well beyond it
-      assertTrue(rowCount > 900);
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  @Test public void testArrays() throws SQLException {
-    ConnectionSpec.getDatabaseLock().lock();
-    try (AvaticaConnection conn = (AvaticaConnection) DriverManager.getConnection(url);
-         Statement stmt = conn.createStatement()) {
-      ResultSet resultSet =
-          stmt.executeQuery("select * from (values ('a', array['b', 'c']));");
-
-      assertTrue(resultSet.next());
-      assertEquals("a", resultSet.getString(1));
-      Array arr = resultSet.getArray(2);
-      assertTrue(arr instanceof ArrayImpl);
-      Object[] values = (Object[]) ((ArrayImpl) arr).getArray();
-      assertArrayEquals(new String[]{"b", "c"}, values);
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  @Test public void testBinaryAndStrings() throws Exception {
-    final String tableName = "testbinaryandstrs";
-    final byte[] data = "asdf".getBytes(StandardCharsets.UTF_8);
-    ConnectionSpec.getDatabaseLock().lock();
-    try (final Connection conn = DriverManager.getConnection(url);
-        final Statement stmt = conn.createStatement()) {
-      assertFalse(stmt.execute("DROP TABLE IF EXISTS " + tableName));
-      assertFalse(stmt.execute("CREATE TABLE " + tableName + "(id int, bin BINARY(4))"));
-      try (final PreparedStatement prepStmt = conn.prepareStatement(
-          "INSERT INTO " + tableName + " values(1, ?)")) {
-        prepStmt.setBytes(1, data);
-        assertFalse(prepStmt.execute());
-      }
-      try (ResultSet results = stmt.executeQuery("SELECT id, bin from " + tableName)) {
-        assertTrue(results.next());
-        assertEquals(1, results.getInt(1));
-        // byte comparison should work
-        assertArrayEquals("Bytes were " + Arrays.toString(results.getBytes(2)),
-            data, results.getBytes(2));
-        // as should string
-        assertEquals(new String(data, StandardCharsets.UTF_8), results.getString(2));
-        assertFalse(results.next());
-      }
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  @Test public void testLocalStackTraceHasServerStackTrace() {
-    ConnectionSpec.getDatabaseLock().lock();
-    try {
-      Statement statement = DriverManager.getConnection(url).createStatement();
-      statement.executeQuery("SELECT * FROM BOGUS_TABLE_DEF_DOESNT_EXIST");
-    } catch (SQLException e) {
-      // Verify that we got the expected exception
-      assertThat(e, instanceOf(AvaticaSqlException.class));
-
-      // Attempt to verify that we got a "server-side" class in the stack.
-      assertThat(Throwables.getStackTraceAsString(e),
-          containsString(JdbcMeta.class.getName()));
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  @Test public void testServerAddressInResponse() throws Exception {
-    ConnectionSpec.getDatabaseLock().lock();
-    try {
-      URL url = new URL("http://localhost:" + this.port);
-      AvaticaHttpClient httpClient = new AvaticaHttpClientImpl(url);
-      byte[] request;
-
-      Service.OpenConnectionRequest jsonReq = new Service.OpenConnectionRequest(
-          UUID.randomUUID().toString(), Collections.<String, String>emptyMap());
-      switch (this.serialization) {
-      case JSON:
-        request = JsonService.MAPPER.writeValueAsBytes(jsonReq);
-        break;
-      case PROTOBUF:
-        ProtobufTranslation pbTranslation = new ProtobufTranslationImpl();
-        request = pbTranslation.serializeRequest(jsonReq);
-        break;
-      default:
-        throw new IllegalStateException("Should not reach here");
-      }
-
-      byte[] response = httpClient.send(request);
-      Service.OpenConnectionResponse openCnxnResp;
-      switch (this.serialization) {
-      case JSON:
-        openCnxnResp = JsonService.MAPPER.readValue(response,
-            Service.OpenConnectionResponse.class);
-        break;
-      case PROTOBUF:
-        ProtobufTranslation pbTranslation = new ProtobufTranslationImpl();
-        Response genericResp = pbTranslation.parseResponse(response);
-        assertTrue("Expected an OpenConnnectionResponse, but got " + genericResp.getClass(),
-            genericResp instanceof Service.OpenConnectionResponse);
-        openCnxnResp = (Service.OpenConnectionResponse) genericResp;
-        break;
-      default:
-        throw new IllegalStateException("Should not reach here");
-      }
-
-      String hostname = InetAddress.getLocalHost().getHostName();
-
-      assertNotNull(openCnxnResp.rpcMetadata);
-      assertEquals(hostname + ":" + this.port, openCnxnResp.rpcMetadata.serverAddress);
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  @Test public void testCommitRollback() throws Exception {
-    final String productTable = "commitrollback_products";
-    final String salesTable = "commitrollback_sales";
-    ConnectionSpec.getDatabaseLock().lock();
-    try (final Connection conn = DriverManager.getConnection(url);
-        final Statement stmt = conn.createStatement()) {
-      assertFalse(stmt.execute("DROP TABLE IF EXISTS " + productTable));
-      assertFalse(
-          stmt.execute(
-              String.format(Locale.ROOT,
-                  "CREATE TABLE %s(id integer, stock integer)",
-                  productTable)));
-      assertFalse(stmt.execute("DROP TABLE IF EXISTS " + salesTable));
-      assertFalse(
-          stmt.execute(
-              String.format(Locale.ROOT,
-                  "CREATE TABLE %s(id integer, units_sold integer)",
-                  salesTable)));
-
-      final int productId = 1;
-      // No products and no sales
-      assertFalse(
-          stmt.execute(
-              String.format(Locale.ROOT, "INSERT INTO %s VALUES(%d, 0)",
-                  productTable, productId)));
-      assertFalse(
-          stmt.execute(
-              String.format(Locale.ROOT, "INSERT INTO %s VALUES(%d, 0)",
-                  salesTable, productId)));
-
-      conn.setAutoCommit(false);
-      PreparedStatement productStmt = conn.prepareStatement(
-          String.format(Locale.ROOT,
-              "UPDATE %s SET stock = stock + ? WHERE id = ?", productTable));
-      PreparedStatement salesStmt = conn.prepareStatement(
-          String.format(Locale.ROOT,
-              "UPDATE %s SET units_sold = units_sold + ? WHERE id = ?",
-              salesTable));
-
-      // No stock
-      assertEquals(0, getInventory(conn, productTable, productId));
-
-      // Set a stock of 10 for product 1
-      productStmt.setInt(1, 10);
-      productStmt.setInt(2, productId);
-      productStmt.executeUpdate();
-
-      conn.commit();
-      assertEquals(10, getInventory(conn, productTable, productId));
-
-      // Sold 5 items (5 in stock, 5 sold)
-      productStmt.setInt(1, -5);
-      productStmt.setInt(2, productId);
-      productStmt.executeUpdate();
-      salesStmt.setInt(1, 5);
-      salesStmt.setInt(2, productId);
-      salesStmt.executeUpdate();
-
-      conn.commit();
-      // We will definitely see the updated values
-      assertEquals(5, getInventory(conn, productTable, productId));
-      assertEquals(5, getSales(conn, salesTable, productId));
-
-      // Update some "bad" values
-      productStmt.setInt(1, -10);
-      productStmt.setInt(2, productId);
-      productStmt.executeUpdate();
-      salesStmt.setInt(1, 10);
-      salesStmt.setInt(2, productId);
-      salesStmt.executeUpdate();
-
-      // We just went negative, nonsense. Better rollback.
-      conn.rollback();
-
-      // Should still have 5 and 5
-      assertEquals(5, getInventory(conn, productTable, productId));
-      assertEquals(5, getSales(conn, salesTable, productId));
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  private int getInventory(Connection conn, String productTable, int productId) throws Exception {
-    try (Statement stmt = conn.createStatement()) {
-      ResultSet results = stmt.executeQuery(
-          String.format(Locale.ROOT, "SELECT stock FROM %s WHERE id = %d",
-              productTable, productId));
-      assertTrue(results.next());
-      return results.getInt(1);
-    }
-  }
-
-  private int getSales(Connection conn, String salesTable, int productId) throws Exception {
-    try (Statement stmt = conn.createStatement()) {
-      ResultSet results = stmt.executeQuery(
-          String.format(Locale.ROOT, "SELECT units_sold FROM %s WHERE id = %d",
-              salesTable, productId));
-      assertTrue(results.next());
-      return results.getInt(1);
-    }
-  }
-
-  @Test public void getAvaticaVersion() throws Exception {
-    ConnectionSpec.getDatabaseLock().lock();
-    try (final Connection conn = DriverManager.getConnection(url)) {
-      DatabaseMetaData metadata = conn.getMetaData();
-      assertTrue("DatabaseMetaData is not an instance of AvaticaDatabaseMetaData",
-          metadata instanceof AvaticaSpecificDatabaseMetaData);
-      AvaticaSpecificDatabaseMetaData avaticaMetadata = (AvaticaSpecificDatabaseMetaData) metadata;
-      // We should get the same version back from the server
-      assertEquals(FilteredConstants.VERSION, avaticaMetadata.getAvaticaServerVersion());
-
-      Properties avaticaProps = avaticaMetadata.unwrap(Properties.class);
-      assertNotNull(avaticaProps);
-      assertEquals(FilteredConstants.VERSION,
-          avaticaProps.get(DatabaseProperty.AVATICA_VERSION.name()));
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  @Test public void testMalformedRequest() throws Exception {
-    URL url = new URL("http://localhost:" + this.port);
-
-    HttpURLConnection conn = (HttpURLConnection) url.openConnection();
-    conn.setRequestMethod("POST");
-    conn.setDoInput(true);
-    conn.setDoOutput(true);
-
-    try (DataOutputStream wr = new DataOutputStream(conn.getOutputStream())) {
-      // Write some garbage data
-      wr.write(new byte[] {0, 1, 2, 3, 4, 5, 6, 7});
-      wr.flush();
-      wr.close();
-    }
-    final int responseCode = conn.getResponseCode();
-    assertEquals(500, responseCode);
-    final InputStream inputStream = conn.getErrorStream();
-    byte[] responseBytes = AvaticaUtils.readFullyToBytes(inputStream);
-    ErrorResponse response;
-    switch (this.serialization) {
-    case JSON:
-      response = JsonService.MAPPER.readValue(responseBytes, ErrorResponse.class);
-      assertTrue("Unexpected error message: " + response.errorMessage,
-          response.errorMessage.contains("Illegal character"));
-      break;
-    case PROTOBUF:
-      ProtobufTranslation pbTranslation = new ProtobufTranslationImpl();
-      Response genericResp = pbTranslation.parseResponse(responseBytes);
-      assertTrue("Response was not an ErrorResponse, but was " + genericResp.getClass(),
-          genericResp instanceof ErrorResponse);
-      response = (ErrorResponse) genericResp;
-      assertTrue("Unexpected error message: " + response.errorMessage,
-          response.errorMessage.contains("contained an invalid tag"));
-      break;
-    default:
-      fail("Unhandled serialization " + this.serialization);
-      throw new RuntimeException();
-    }
-  }
-
-  @Test public void testDriverProperties() throws Exception {
-    final Properties props = new Properties();
-    props.setProperty("foo", "bar");
-    final Properties originalProps = (Properties) props.clone();
-    try (final Connection conn = DriverManager.getConnection(url, props)) {
-      // The contents of the two properties objects should not have changed after connecting.
-      assertEquals(props, originalProps);
-    }
-  }
-
-  /** Factory that provides a {@link JdbcMeta}. */
-  public static class FullyRemoteJdbcMetaFactory implements Meta.Factory {
-
-    private static JdbcMeta instance = null;
-
-    private static JdbcMeta getInstance() {
-      if (instance == null) {
-        try {
-          instance = new JdbcMeta(CONNECTION_SPEC.url, CONNECTION_SPEC.username,
-              CONNECTION_SPEC.password);
-        } catch (SQLException e) {
-          throw new RuntimeException(e);
-        }
-      }
-      return instance;
-    }
-
-    @Override public Meta create(List<String> args) {
-      return getInstance();
-    }
-  }
-}
-
-// End RemoteMetaTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/server/src/test/java/org/apache/calcite/avatica/server/AbstractAvaticaHandlerTest.java
----------------------------------------------------------------------
diff --git a/avatica/server/src/test/java/org/apache/calcite/avatica/server/AbstractAvaticaHandlerTest.java b/avatica/server/src/test/java/org/apache/calcite/avatica/server/AbstractAvaticaHandlerTest.java
deleted file mode 100644
index 66eb361..0000000
--- a/avatica/server/src/test/java/org/apache/calcite/avatica/server/AbstractAvaticaHandlerTest.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.server;
-
-import org.apache.calcite.avatica.remote.AuthenticationType;
-
-import org.hamcrest.BaseMatcher;
-import org.hamcrest.Description;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.net.HttpURLConnection;
-import java.nio.charset.StandardCharsets;
-
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-import static org.mockito.hamcrest.MockitoHamcrest.argThat;
-
-/**
- * Test class for logic common to all {@link AvaticaHandler}'s.
- */
-public class AbstractAvaticaHandlerTest {
-
-  private AbstractAvaticaHandler handler;
-  private AvaticaServerConfiguration config;
-  private HttpServletRequest request;
-  private HttpServletResponse response;
-
-  @Before public void setup() throws Exception {
-    handler = mock(AbstractAvaticaHandler.class);
-    config = mock(AvaticaServerConfiguration.class);
-    request = mock(HttpServletRequest.class);
-    response = mock(HttpServletResponse.class);
-    when(handler.isUserPermitted(config, request, response)).thenCallRealMethod();
-  }
-
-  @Test public void disallowUnauthenticatedUsers() throws Exception {
-    ServletOutputStream os = mock(ServletOutputStream.class);
-
-    when(config.getAuthenticationType()).thenReturn(AuthenticationType.SPNEGO);
-    when(request.getRemoteUser()).thenReturn(null);
-    when(response.getOutputStream()).thenReturn(os);
-
-    assertFalse(handler.isUserPermitted(config, request, response));
-
-    verify(response).setStatus(HttpURLConnection.HTTP_UNAUTHORIZED);
-    // Make sure that the serialized ErrorMessage looks reasonable
-    verify(os).write(argThat(new BaseMatcher<byte[]>() {
-      @Override public void describeTo(Description description) {
-        String desc = "A serialized ErrorMessage which contains 'User is not authenticated'";
-        description.appendText(desc);
-      }
-
-      @Override public boolean matches(Object item) {
-        String msg = new String((byte[]) item, StandardCharsets.UTF_8);
-        return msg.contains("User is not authenticated");
-      }
-
-      @Override public void describeMismatch(Object item, Description mismatchDescription) {
-        mismatchDescription.appendText("The message should contain 'User is not authenticated'");
-      }
-    }));
-  }
-
-  @Test public void allowAuthenticatedUsers() throws Exception {
-    when(config.getAuthenticationType()).thenReturn(AuthenticationType.SPNEGO);
-    when(request.getRemoteUser()).thenReturn("user1");
-    assertTrue(handler.isUserPermitted(config, request, response));
-  }
-
-  @Test public void allowAllUsersWhenNoAuthenticationIsNeeded() throws Exception {
-    when(config.getAuthenticationType()).thenReturn(AuthenticationType.NONE);
-    when(request.getRemoteUser()).thenReturn(null);
-    assertTrue(handler.isUserPermitted(config, request, response));
-
-    when(request.getRemoteUser()).thenReturn("user1");
-    assertTrue(handler.isUserPermitted(config, request, response));
-  }
-}
-
-// End AbstractAvaticaHandlerTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/server/src/test/java/org/apache/calcite/avatica/server/BasicAuthHttpServerTest.java
----------------------------------------------------------------------
diff --git a/avatica/server/src/test/java/org/apache/calcite/avatica/server/BasicAuthHttpServerTest.java b/avatica/server/src/test/java/org/apache/calcite/avatica/server/BasicAuthHttpServerTest.java
deleted file mode 100644
index 6f5f872..0000000
--- a/avatica/server/src/test/java/org/apache/calcite/avatica/server/BasicAuthHttpServerTest.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.server;
-
-import org.apache.calcite.avatica.ConnectionSpec;
-import org.apache.calcite.avatica.jdbc.JdbcMeta;
-import org.apache.calcite.avatica.remote.Driver;
-import org.apache.calcite.avatica.remote.LocalService;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import java.util.Properties;
-
-import static org.hamcrest.core.StringContains.containsString;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
-
-/**
- * Test class for HTTP Basic authentication.
- */
-public class BasicAuthHttpServerTest extends HttpAuthBase {
-
-  private static final ConnectionSpec CONNECTION_SPEC = ConnectionSpec.HSQLDB;
-  private static HttpServer server;
-  private static String url;
-
-  @BeforeClass public static void startServer() throws Exception {
-    final String userPropertiesFile = BasicAuthHttpServerTest.class
-        .getResource("/auth-users.properties").getFile();
-    assertNotNull("Could not find properties file for basic auth users", userPropertiesFile);
-
-    // Create a LocalService around HSQLDB
-    final JdbcMeta jdbcMeta = new JdbcMeta(CONNECTION_SPEC.url,
-        CONNECTION_SPEC.username, CONNECTION_SPEC.password);
-    LocalService service = new LocalService(jdbcMeta);
-
-    server = new HttpServer.Builder()
-        .withBasicAuthentication(userPropertiesFile, new String[] { "users" })
-        .withHandler(service, Driver.Serialization.PROTOBUF)
-        .withPort(0)
-        .build();
-    server.start();
-
-    url = "jdbc:avatica:remote:url=http://localhost:" + server.getPort()
-        + ";authentication=BASIC;serialization=PROTOBUF";
-
-    // Create and grant permissions to our users
-    createHsqldbUsers();
-  }
-
-  @AfterClass public static void stopServer() throws Exception {
-    if (null != server) {
-      server.stop();
-    }
-  }
-
-  @Test public void testDisallowedAvaticaAllowedDbUser() throws Exception {
-    // Allowed by avatica and hsqldb
-    final Properties props = new Properties();
-    props.put("avatica_user", "USER2");
-    props.put("avatica_password", "foo");
-    props.put("user", "USER2");
-    props.put("password", "password2");
-
-    try {
-      readWriteData(url, "INVALID_AVATICA_USER_VALID_DB_USER", props);
-      fail("Expected an exception");
-    } catch (RuntimeException e) {
-      assertThat(e.getMessage(), containsString("HTTP/401"));
-    }
-  }
-
-  @Test public void testDisallowedAvaticaNoDbUser() throws Exception {
-    // Allowed by avatica and hsqldb
-    final Properties props = new Properties();
-    props.put("avatica_user", "USER2");
-    props.put("avatica_password", "password2");
-
-    readWriteData(url, "INVALID_AVATICA_USER_NO_DB_USER", props);
-  }
-
-  @Test public void testValidUser() throws Exception {
-    // Allowed by avatica and hsqldb
-    final Properties props = new Properties();
-    props.put("avatica_user", "USER2");
-    props.put("avatica_password", "password2");
-    props.put("user", "USER2");
-    props.put("password", "password2");
-
-    readWriteData(url, "VALID_USER", props);
-  }
-
-  @Test public void testInvalidUser() throws Exception {
-    // Denied by avatica
-    final Properties props = new Properties();
-    props.put("user", "foo");
-    props.put("password", "bar");
-
-    try {
-      readWriteData(url, "INVALID_USER", props);
-      fail("Expected an exception");
-    } catch (RuntimeException e) {
-      assertThat(e.getMessage(), containsString("HTTP/401"));
-    }
-  }
-
-  @Test public void testUserWithDisallowedRole() throws Exception {
-    // Disallowed by avatica
-    final Properties props = new Properties();
-    props.put("avatica_user", "USER4");
-    props.put("avatica_password", "password4");
-
-    try {
-      readWriteData(url, "DISALLOWED_AVATICA_USER", props);
-      fail("Expected an exception");
-    } catch (RuntimeException e) {
-      assertThat(e.getMessage(), containsString("HTTP/403"));
-    }
-  }
-
-  @Test public void testDisallowedDbUser() throws Exception {
-    // Disallowed by hsqldb, allowed by avatica
-    final Properties props = new Properties();
-    props.put("avatica_user", "USER1");
-    props.put("avatica_password", "password1");
-    props.put("user", "USER1");
-    props.put("password", "password1");
-
-    try {
-      readWriteData(url, "DISALLOWED_DB_USER", props);
-      fail("Expected an exception");
-    } catch (RuntimeException e) {
-      assertEquals("Remote driver error: RuntimeException: "
-          + "java.sql.SQLInvalidAuthorizationSpecException: invalid authorization specification"
-          + " - not found: USER1"
-          + " -> SQLInvalidAuthorizationSpecException: invalid authorization specification - "
-          + "not found: USER1"
-          + " -> HsqlException: invalid authorization specification - not found: USER1",
-          e.getMessage());
-    }
-  }
-}
-
-// End BasicAuthHttpServerTest.java


[49/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaDatabaseMetaData.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaDatabaseMetaData.java b/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaDatabaseMetaData.java
deleted file mode 100644
index 7182968..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaDatabaseMetaData.java
+++ /dev/null
@@ -1,1460 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import org.apache.calcite.avatica.AvaticaConnection.CallableWithoutException;
-import org.apache.calcite.avatica.Meta.DatabaseProperty;
-import org.apache.calcite.avatica.remote.MetaDataOperation;
-import org.apache.calcite.avatica.util.Casing;
-import org.apache.calcite.avatica.util.Quoting;
-
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.RowIdLifetime;
-import java.sql.SQLException;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Properties;
-
-import static org.apache.calcite.avatica.InternalProperty.CASE_SENSITIVE;
-import static org.apache.calcite.avatica.InternalProperty.NULL_SORTING;
-import static org.apache.calcite.avatica.InternalProperty.NullSorting;
-import static org.apache.calcite.avatica.InternalProperty.QUOTED_CASING;
-import static org.apache.calcite.avatica.InternalProperty.QUOTING;
-import static org.apache.calcite.avatica.InternalProperty.UNQUOTED_CASING;
-
-/**
- * Implementation of {@link java.sql.DatabaseMetaData}
- * for the Avatica engine.
- *
- * <p>This class has sub-classes which implement JDBC 3.0 and JDBC 4.0 APIs;
- * it is instantiated using {@link AvaticaFactory#newDatabaseMetaData}.</p>
- */
-public class AvaticaDatabaseMetaData implements AvaticaSpecificDatabaseMetaData {
-  private final AvaticaConnection connection;
-
-  protected  AvaticaDatabaseMetaData(AvaticaConnection connection) {
-    this.connection = connection;
-  }
-
-  // Helper methods
-
-  private NullSorting nullSorting() {
-    return NULL_SORTING.getEnum(getProperties(), NullSorting.class);
-  }
-
-  private Quoting quoting() {
-    return QUOTING.getEnum(getProperties(), Quoting.class);
-  }
-
-  private Casing unquotedCasing() {
-    return UNQUOTED_CASING.getEnum(getProperties(), Casing.class);
-  }
-
-  private Casing quotedCasing() {
-    return QUOTED_CASING.getEnum(getProperties(), Casing.class);
-  }
-
-  private boolean caseSensitive() {
-    return CASE_SENSITIVE.getBoolean(getProperties());
-  }
-
-  // JDBC methods
-
-  public boolean allProceduresAreCallable() throws SQLException {
-    return true;
-  }
-
-  public boolean allTablesAreSelectable() throws SQLException {
-    return true;
-  }
-
-  public String getURL() throws SQLException {
-    return connection.url;
-  }
-
-  public String getUserName() throws SQLException {
-    return connection.info.getProperty("user");
-  }
-
-  public boolean isReadOnly() throws SQLException {
-    return true;
-  }
-
-  public boolean nullsAreSortedHigh() throws SQLException {
-    return nullSorting() == NullSorting.HIGH;
-  }
-
-  public boolean nullsAreSortedLow() throws SQLException {
-    return nullSorting() == NullSorting.LOW;
-  }
-
-  public boolean nullsAreSortedAtStart() throws SQLException {
-    return nullSorting() == NullSorting.START;
-  }
-
-  public boolean nullsAreSortedAtEnd() throws SQLException {
-    return nullSorting() == NullSorting.END;
-  }
-
-  public String getDatabaseProductName() throws SQLException {
-    return connection.driver.version.productName;
-  }
-
-  public String getDatabaseProductVersion() throws SQLException {
-    return connection.driver.version.productVersion;
-  }
-
-  public String getDriverName() throws SQLException {
-    return connection.driver.version.name;
-  }
-
-  public String getDriverVersion() throws SQLException {
-    return connection.driver.version.versionString;
-  }
-
-  public int getDriverMajorVersion() {
-    return connection.driver.getMajorVersion();
-  }
-
-  public int getDriverMinorVersion() {
-    return connection.driver.getMinorVersion();
-  }
-
-  public boolean usesLocalFiles() throws SQLException {
-    return false;
-  }
-
-  public boolean usesLocalFilePerTable() throws SQLException {
-    return false;
-  }
-
-  public boolean storesMixedCaseIdentifiers() throws SQLException {
-    return !caseSensitive() && unquotedCasing() == Casing.UNCHANGED;
-  }
-
-  public boolean supportsMixedCaseIdentifiers() throws SQLException {
-    return caseSensitive() && unquotedCasing() == Casing.UNCHANGED;
-  }
-
-  public boolean storesUpperCaseIdentifiers() throws SQLException {
-    return unquotedCasing() == Casing.TO_UPPER;
-  }
-
-  public boolean storesLowerCaseIdentifiers() throws SQLException {
-    return unquotedCasing() == Casing.TO_LOWER;
-  }
-
-  public boolean storesMixedCaseQuotedIdentifiers() throws SQLException {
-    return !caseSensitive() && quotedCasing() == Casing.UNCHANGED;
-  }
-
-  public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException {
-    return caseSensitive() && quotedCasing() == Casing.UNCHANGED;
-  }
-
-  public boolean storesUpperCaseQuotedIdentifiers() throws SQLException {
-    return quotedCasing() == Casing.TO_UPPER;
-  }
-
-  public boolean storesLowerCaseQuotedIdentifiers() throws SQLException {
-    return quotedCasing() == Casing.TO_LOWER;
-  }
-
-  public String getIdentifierQuoteString() throws SQLException {
-    return quoting().string;
-  }
-
-  private Map<InternalProperty, Object> getProperties() {
-    return connection.properties;
-  }
-
-  public String getSQLKeywords() throws SQLException {
-    return connection.invokeWithRetries(
-        new CallableWithoutException<String>() {
-          public String call() {
-            return Meta.DatabaseProperty.GET_S_Q_L_KEYWORDS
-                .getProp(connection.meta, connection.handle, String.class);
-          }
-        });
-  }
-
-  public String getNumericFunctions() throws SQLException {
-    return connection.invokeWithRetries(
-        new CallableWithoutException<String>() {
-          public String call() {
-            return Meta.DatabaseProperty.GET_NUMERIC_FUNCTIONS
-                .getProp(connection.meta, connection.handle, String.class);
-          }
-        });
-  }
-
-  public String getStringFunctions() throws SQLException {
-    return connection.invokeWithRetries(
-        new CallableWithoutException<String>() {
-          public String call() {
-            return Meta.DatabaseProperty.GET_STRING_FUNCTIONS
-                .getProp(connection.meta, connection.handle, String.class);
-          }
-        });
-  }
-
-  public String getSystemFunctions() throws SQLException {
-    return connection.invokeWithRetries(
-        new CallableWithoutException<String>() {
-          public String call() {
-            return Meta.DatabaseProperty.GET_SYSTEM_FUNCTIONS
-                .getProp(connection.meta, connection.handle, String.class);
-          }
-        });
-  }
-
-  public String getTimeDateFunctions() throws SQLException {
-    return connection.invokeWithRetries(
-        new CallableWithoutException<String>() {
-          public String call() {
-            return Meta.DatabaseProperty.GET_TIME_DATE_FUNCTIONS
-                .getProp(connection.meta, connection.handle, String.class);
-          }
-        });
-  }
-
-  public String getSearchStringEscape() throws SQLException {
-    return "\\";
-  }
-
-  public String getExtraNameCharacters() throws SQLException {
-    return "";
-  }
-
-  public boolean supportsAlterTableWithAddColumn() throws SQLException {
-    return false;
-  }
-
-  public boolean supportsAlterTableWithDropColumn() throws SQLException {
-    return false;
-  }
-
-  public boolean supportsColumnAliasing() throws SQLException {
-    return true;
-  }
-
-  public boolean nullPlusNonNullIsNull() throws SQLException {
-    return true;
-  }
-
-  public boolean supportsConvert() throws SQLException {
-    return true;
-  }
-
-  public boolean supportsConvert(int fromType, int toType) throws SQLException {
-    return false; // TODO: more detail
-  }
-
-  public boolean supportsTableCorrelationNames() throws SQLException {
-    return true;
-  }
-
-  public boolean supportsDifferentTableCorrelationNames() throws SQLException {
-    return true;
-  }
-
-  public boolean supportsExpressionsInOrderBy() throws SQLException {
-    return true;
-  }
-
-  public boolean supportsOrderByUnrelated() throws SQLException {
-    return true;
-  }
-
-  public boolean supportsGroupBy() throws SQLException {
-    return true;
-  }
-
-  public boolean supportsGroupByUnrelated() throws SQLException {
-    return true;
-  }
-
-  public boolean supportsGroupByBeyondSelect() throws SQLException {
-    return true;
-  }
-
-  public boolean supportsLikeEscapeClause() throws SQLException {
-    return true;
-  }
-
-  public boolean supportsMultipleResultSets() throws SQLException {
-    return false;
-  }
-
-  public boolean supportsMultipleTransactions() throws SQLException {
-    return false;
-  }
-
-  public boolean supportsNonNullableColumns() throws SQLException {
-    return true;
-  }
-
-  public boolean supportsMinimumSQLGrammar() throws SQLException {
-    return true;
-  }
-
-  public boolean supportsCoreSQLGrammar() throws SQLException {
-    return true;
-  }
-
-  public boolean supportsExtendedSQLGrammar() throws SQLException {
-    return true;
-  }
-
-  public boolean supportsANSI92EntryLevelSQL() throws SQLException {
-    return true;
-  }
-
-  public boolean supportsANSI92IntermediateSQL() throws SQLException {
-    return true;
-  }
-
-  public boolean supportsANSI92FullSQL() throws SQLException {
-    return true;
-  }
-
-  public boolean supportsIntegrityEnhancementFacility() throws SQLException {
-    return false;
-  }
-
-  public boolean supportsOuterJoins() throws SQLException {
-    return true;
-  }
-
-  public boolean supportsFullOuterJoins() throws SQLException {
-    return true;
-  }
-
-  public boolean supportsLimitedOuterJoins() throws SQLException {
-    return true;
-  }
-
-  public String getSchemaTerm() throws SQLException {
-    return "schema";
-  }
-
-  public String getProcedureTerm() throws SQLException {
-    return "procedure";
-  }
-
-  public String getCatalogTerm() throws SQLException {
-    return "catalog";
-  }
-
-  public boolean isCatalogAtStart() throws SQLException {
-    return true;
-  }
-
-  public String getCatalogSeparator() throws SQLException {
-    return ".";
-  }
-
-  public boolean supportsSchemasInDataManipulation() throws SQLException {
-    return true;
-  }
-
-  public boolean supportsSchemasInProcedureCalls() throws SQLException {
-    return true;
-  }
-
-  public boolean supportsSchemasInTableDefinitions() throws SQLException {
-    return true;
-  }
-
-  public boolean supportsSchemasInIndexDefinitions() throws SQLException {
-    return true; // except that we don't support index definitions
-  }
-
-  public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException {
-    return true; // except that we don't support privilege definitions
-  }
-
-  public boolean supportsCatalogsInDataManipulation() throws SQLException {
-    return true;
-  }
-
-  public boolean supportsCatalogsInProcedureCalls() throws SQLException {
-    return true;
-  }
-
-  public boolean supportsCatalogsInTableDefinitions() throws SQLException {
-    return true;
-  }
-
-  public boolean supportsCatalogsInIndexDefinitions() throws SQLException {
-    return true; // except that we don't support index definitions
-  }
-
-  public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException {
-    return true; // except that we don't support privilege definitions
-  }
-
-  public boolean supportsPositionedDelete() throws SQLException {
-    return false;
-  }
-
-  public boolean supportsPositionedUpdate() throws SQLException {
-    return false;
-  }
-
-  public boolean supportsSelectForUpdate() throws SQLException {
-    return false;
-  }
-
-  public boolean supportsStoredProcedures() throws SQLException {
-    return false;
-  }
-
-  public boolean supportsSubqueriesInComparisons() throws SQLException {
-    return true;
-  }
-
-  public boolean supportsSubqueriesInExists() throws SQLException {
-    return true;
-  }
-
-  public boolean supportsSubqueriesInIns() throws SQLException {
-    return true;
-  }
-
-  public boolean supportsSubqueriesInQuantifieds() throws SQLException {
-    return false;
-  }
-
-  public boolean supportsCorrelatedSubqueries() throws SQLException {
-    return true;
-  }
-
-  public boolean supportsUnion() throws SQLException {
-    return true;
-  }
-
-  public boolean supportsUnionAll() throws SQLException {
-    return true;
-  }
-
-  public boolean supportsOpenCursorsAcrossCommit() throws SQLException {
-    return false;
-  }
-
-  public boolean supportsOpenCursorsAcrossRollback() throws SQLException {
-    return false;
-  }
-
-  public boolean supportsOpenStatementsAcrossCommit() throws SQLException {
-    return false;
-  }
-
-  public boolean supportsOpenStatementsAcrossRollback() throws SQLException {
-    return false;
-  }
-
-  public int getMaxBinaryLiteralLength() throws SQLException {
-    return 0;
-  }
-
-  public int getMaxCharLiteralLength() throws SQLException {
-    return 0;
-  }
-
-  public int getMaxColumnNameLength() throws SQLException {
-    return 0;
-  }
-
-  public int getMaxColumnsInGroupBy() throws SQLException {
-    return 0;
-  }
-
-  public int getMaxColumnsInIndex() throws SQLException {
-    return 0;
-  }
-
-  public int getMaxColumnsInOrderBy() throws SQLException {
-    return 0;
-  }
-
-  public int getMaxColumnsInSelect() throws SQLException {
-    return 0;
-  }
-
-  public int getMaxColumnsInTable() throws SQLException {
-    return 0;
-  }
-
-  public int getMaxConnections() throws SQLException {
-    return 0;
-  }
-
-  public int getMaxCursorNameLength() throws SQLException {
-    return 0;
-  }
-
-  public int getMaxIndexLength() throws SQLException {
-    return 0;
-  }
-
-  public int getMaxSchemaNameLength() throws SQLException {
-    return 0;
-  }
-
-  public int getMaxProcedureNameLength() throws SQLException {
-    return 0;
-  }
-
-  public int getMaxCatalogNameLength() throws SQLException {
-    return 0;
-  }
-
-  public int getMaxRowSize() throws SQLException {
-    return 0;
-  }
-
-  public boolean doesMaxRowSizeIncludeBlobs() throws SQLException {
-    return false;
-  }
-
-  public int getMaxStatementLength() throws SQLException {
-    return 0;
-  }
-
-  public int getMaxStatements() throws SQLException {
-    return 0;
-  }
-
-  public int getMaxTableNameLength() throws SQLException {
-    return 0;
-  }
-
-  public int getMaxTablesInSelect() throws SQLException {
-    return 0;
-  }
-
-  public int getMaxUserNameLength() throws SQLException {
-    return 0;
-  }
-
-  public int getDefaultTransactionIsolation() throws SQLException {
-    return connection.invokeWithRetries(
-        new CallableWithoutException<Integer>() {
-          public Integer call() {
-            return Meta.DatabaseProperty.GET_DEFAULT_TRANSACTION_ISOLATION
-                .getProp(connection.meta, connection.handle, Integer.class);
-          }
-        });
-  }
-
-  public boolean supportsTransactions() throws SQLException {
-    return false;
-  }
-
-  public boolean supportsTransactionIsolationLevel(int level)
-      throws SQLException {
-    return level == Connection.TRANSACTION_NONE;
-  }
-
-  public boolean supportsDataDefinitionAndDataManipulationTransactions()
-      throws SQLException {
-    return false;
-  }
-
-  public boolean supportsDataManipulationTransactionsOnly()
-      throws SQLException {
-    return true;
-  }
-
-  public boolean dataDefinitionCausesTransactionCommit() throws SQLException {
-    return true;
-  }
-
-  public boolean dataDefinitionIgnoredInTransactions() throws SQLException {
-    return false;
-  }
-
-  public ResultSet getProcedures(
-      final String catalog,
-      final String schemaPattern,
-      final String procedureNamePattern) throws SQLException {
-    try {
-      return connection.invokeWithRetries(
-          new CallableWithoutException<ResultSet>() {
-            public ResultSet call() {
-              try {
-                return connection.createResultSet(
-                    connection.meta.getProcedures(connection.handle, catalog, pat(schemaPattern),
-                        pat(procedureNamePattern)),
-                    new QueryState(MetaDataOperation.GET_PROCEDURES, catalog, schemaPattern,
-                        procedureNamePattern));
-              } catch (SQLException e) {
-                throw new RuntimeException(e);
-              }
-            }
-          });
-    } catch (RuntimeException e) {
-      Throwable cause = e.getCause();
-      if (cause instanceof SQLException) {
-        throw (SQLException) cause;
-      }
-      throw e;
-    }
-  }
-
-  public ResultSet getProcedureColumns(
-      final String catalog,
-      final String schemaPattern,
-      final String procedureNamePattern,
-      final String columnNamePattern) throws SQLException {
-    try {
-      return connection.invokeWithRetries(
-          new CallableWithoutException<ResultSet>() {
-            public ResultSet call() {
-              try {
-                return connection.createResultSet(
-                    connection.meta.getProcedureColumns(connection.handle, catalog,
-                        pat(schemaPattern), pat(procedureNamePattern), pat(columnNamePattern)),
-                    new QueryState(MetaDataOperation.GET_PROCEDURE_COLUMNS, catalog, schemaPattern,
-                        procedureNamePattern, columnNamePattern));
-              } catch (SQLException e) {
-                throw new RuntimeException(e);
-              }
-            }
-          });
-    } catch (RuntimeException e) {
-      Throwable cause = e.getCause();
-      if (cause instanceof SQLException) {
-        throw (SQLException) cause;
-      }
-      throw e;
-    }
-  }
-
-  public ResultSet getTables(
-      final String catalog,
-      final String schemaPattern,
-      final String tableNamePattern,
-      final String[] types) throws SQLException {
-    final List<String> typeList = types == null ? null : Arrays.asList(types);
-    try {
-      return connection.invokeWithRetries(
-          new CallableWithoutException<ResultSet>() {
-            public ResultSet call() {
-              try {
-                return connection.createResultSet(
-                    connection.meta.getTables(connection.handle, catalog, pat(schemaPattern),
-                        pat(tableNamePattern), typeList),
-                    new QueryState(MetaDataOperation.GET_TABLES, catalog, schemaPattern,
-                        tableNamePattern, types));
-              } catch (SQLException e) {
-                throw new RuntimeException(e);
-              }
-            }
-          });
-    } catch (RuntimeException e) {
-      Throwable cause = e.getCause();
-      if (cause instanceof SQLException) {
-        throw (SQLException) cause;
-      }
-      throw e;
-    }
-  }
-
-  private static Meta.Pat pat(String schemaPattern) {
-    return Meta.Pat.of(schemaPattern);
-  }
-
-  public ResultSet getSchemas(
-      final String catalog, final String schemaPattern) throws SQLException {
-    // TODO: add a 'catch ... throw new SQLException' logic to this and other
-    // getXxx methods. Right now any error will throw a RuntimeException
-    try {
-      return connection.invokeWithRetries(
-          new CallableWithoutException<ResultSet>() {
-            public ResultSet call() {
-              try {
-                return connection.createResultSet(
-                    connection.meta.getSchemas(connection.handle, catalog, pat(schemaPattern)),
-                    new QueryState(MetaDataOperation.GET_SCHEMAS_WITH_ARGS, catalog,
-                        schemaPattern));
-              } catch (SQLException e) {
-                throw new RuntimeException(e);
-              }
-            }
-          });
-    } catch (RuntimeException e) {
-      Throwable cause = e.getCause();
-      if (cause instanceof SQLException) {
-        throw (SQLException) cause;
-      }
-      throw e;
-    }
-  }
-
-  public ResultSet getSchemas() throws SQLException {
-    return getSchemas(null, null);
-  }
-
-  public ResultSet getCatalogs() throws SQLException {
-    try {
-      return connection.invokeWithRetries(
-          new CallableWithoutException<ResultSet>() {
-            public ResultSet call() {
-              try {
-                return connection.createResultSet(connection.meta.getCatalogs(connection.handle),
-                    new QueryState(MetaDataOperation.GET_CATALOGS));
-              } catch (SQLException e) {
-                throw new RuntimeException(e);
-              }
-            }
-          });
-    } catch (RuntimeException e) {
-      Throwable cause = e.getCause();
-      if (cause instanceof SQLException) {
-        throw (SQLException) cause;
-      }
-      throw e;
-    }
-  }
-
-  public ResultSet getTableTypes() throws SQLException {
-    try {
-      return connection.invokeWithRetries(
-          new CallableWithoutException<ResultSet>() {
-            public ResultSet call() {
-              try {
-                return connection.createResultSet(connection.meta.getTableTypes(connection.handle),
-                    new QueryState(MetaDataOperation.GET_TABLE_TYPES));
-              } catch (SQLException e) {
-                throw new RuntimeException(e);
-              }
-            }
-          });
-    } catch (RuntimeException e) {
-      Throwable cause = e.getCause();
-      if (cause instanceof SQLException) {
-        throw (SQLException) cause;
-      }
-      throw e;
-    }
-  }
-
-  public ResultSet getColumns(
-      final String catalog,
-      final String schemaPattern,
-      final String tableNamePattern,
-      final String columnNamePattern) throws SQLException {
-    try {
-      return connection.invokeWithRetries(
-          new CallableWithoutException<ResultSet>() {
-            public ResultSet call() {
-              try {
-                return connection.createResultSet(
-                    connection.meta.getColumns(connection.handle, catalog, pat(schemaPattern),
-                        pat(tableNamePattern), pat(columnNamePattern)),
-                    new QueryState(MetaDataOperation.GET_COLUMNS, catalog, schemaPattern,
-                        tableNamePattern, columnNamePattern));
-              } catch (SQLException e) {
-                throw new RuntimeException(e);
-              }
-            }
-          });
-    } catch (RuntimeException e) {
-      Throwable cause = e.getCause();
-      if (cause instanceof SQLException) {
-        throw (SQLException) cause;
-      }
-      throw e;
-    }
-  }
-
-  public ResultSet getColumnPrivileges(
-      final String catalog,
-      final String schema,
-      final String table,
-      final String columnNamePattern) throws SQLException {
-    try {
-      return connection.invokeWithRetries(
-          new CallableWithoutException<ResultSet>() {
-            public ResultSet call() {
-              try {
-                return connection.createResultSet(
-                    connection.meta.getColumnPrivileges(connection.handle, catalog, schema, table,
-                        pat(columnNamePattern)),
-                    new QueryState(MetaDataOperation.GET_COLUMN_PRIVILEGES, catalog, schema, table,
-                        columnNamePattern));
-              } catch (SQLException e) {
-                throw new RuntimeException(e);
-              }
-            }
-          });
-    } catch (RuntimeException e) {
-      Throwable cause = e.getCause();
-      if (cause instanceof SQLException) {
-        throw (SQLException) cause;
-      }
-      throw e;
-    }
-  }
-
-  public ResultSet getTablePrivileges(
-      final String catalog,
-      final String schemaPattern,
-      final String tableNamePattern) throws SQLException {
-    try {
-      return connection.invokeWithRetries(
-          new CallableWithoutException<ResultSet>() {
-            public ResultSet call() {
-              try {
-                return connection.createResultSet(
-                    connection.meta.getTablePrivileges(connection.handle, catalog,
-                        pat(schemaPattern), pat(tableNamePattern)),
-                    new QueryState(MetaDataOperation.GET_TABLE_PRIVILEGES, catalog, schemaPattern,
-                        tableNamePattern));
-              } catch (SQLException e) {
-                throw new RuntimeException(e);
-              }
-            }
-          });
-    } catch (RuntimeException e) {
-      Throwable cause = e.getCause();
-      if (cause instanceof SQLException) {
-        throw (SQLException) cause;
-      }
-      throw e;
-    }
-  }
-
-  public ResultSet getBestRowIdentifier(
-      final String catalog,
-      final String schema,
-      final String table,
-      final int scope,
-      final boolean nullable) throws SQLException {
-    try {
-      return connection.invokeWithRetries(
-          new CallableWithoutException<ResultSet>() {
-            public ResultSet call() {
-              try {
-                return connection.createResultSet(
-                    connection.meta.getBestRowIdentifier(connection.handle, catalog, schema, table,
-                        scope, nullable),
-                    new QueryState(MetaDataOperation.GET_BEST_ROW_IDENTIFIER, catalog, table, scope,
-                        nullable));
-              } catch (SQLException e) {
-                throw new RuntimeException(e);
-              }
-            }
-          });
-    } catch (RuntimeException e) {
-      Throwable cause = e.getCause();
-      if (cause instanceof SQLException) {
-        throw (SQLException) cause;
-      }
-      throw e;
-    }
-  }
-
-  public ResultSet getVersionColumns(
-      final String catalog, final String schema, final String table) throws SQLException {
-    try {
-      return connection.invokeWithRetries(
-          new CallableWithoutException<ResultSet>() {
-            public ResultSet call() {
-              try {
-                return connection.createResultSet(
-                    connection.meta.getVersionColumns(connection.handle, catalog, schema, table),
-                    new QueryState(MetaDataOperation.GET_VERSION_COLUMNS, catalog, schema, table));
-              } catch (SQLException e) {
-                throw new RuntimeException(e);
-              }
-            }
-          });
-    } catch (RuntimeException e) {
-      Throwable cause = e.getCause();
-      if (cause instanceof SQLException) {
-        throw (SQLException) cause;
-      }
-      throw e;
-    }
-  }
-
-  public ResultSet getPrimaryKeys(
-      final String catalog, final String schema, final String table) throws SQLException {
-    try {
-      return connection.invokeWithRetries(
-          new CallableWithoutException<ResultSet>() {
-            public ResultSet call() {
-              try {
-                return connection.createResultSet(
-                    connection.meta.getPrimaryKeys(connection.handle, catalog, schema, table),
-                    new QueryState(MetaDataOperation.GET_PRIMARY_KEYS, catalog, schema, table));
-              } catch (SQLException e) {
-                throw new RuntimeException(e);
-              }
-            }
-          });
-    } catch (RuntimeException e) {
-      Throwable cause = e.getCause();
-      if (cause instanceof SQLException) {
-        throw (SQLException) cause;
-      }
-      throw e;
-    }
-  }
-
-  public ResultSet getImportedKeys(
-      final String catalog, final String schema, final String table) throws SQLException {
-    try {
-      return connection.invokeWithRetries(
-          new CallableWithoutException<ResultSet>() {
-            public ResultSet call() {
-              try {
-                return connection.createResultSet(
-                    connection.meta.getImportedKeys(connection.handle, catalog, schema, table),
-                    new QueryState(MetaDataOperation.GET_IMPORTED_KEYS, catalog, schema, table));
-              } catch (SQLException e) {
-                throw new RuntimeException(e);
-              }
-            }
-          });
-    } catch (RuntimeException e) {
-      Throwable cause = e.getCause();
-      if (cause instanceof SQLException) {
-        throw (SQLException) cause;
-      }
-      throw e;
-    }
-  }
-
-  public ResultSet getExportedKeys(
-      final String catalog, final String schema, final String table) throws SQLException {
-    try {
-      return connection.invokeWithRetries(
-          new CallableWithoutException<ResultSet>() {
-            public ResultSet call() {
-              try {
-                return connection.createResultSet(
-                    connection.meta.getExportedKeys(connection.handle, catalog, schema, table),
-                    new QueryState(MetaDataOperation.GET_EXPORTED_KEYS, catalog, schema, table));
-              } catch (SQLException e) {
-                throw new RuntimeException(e);
-              }
-            }
-          });
-    } catch (RuntimeException e) {
-      Throwable cause = e.getCause();
-      if (cause instanceof SQLException) {
-        throw (SQLException) cause;
-      }
-      throw e;
-    }
-  }
-
-  public ResultSet getCrossReference(
-      final String parentCatalog,
-      final String parentSchema,
-      final String parentTable,
-      final String foreignCatalog,
-      final String foreignSchema,
-      final String foreignTable) throws SQLException {
-    try {
-      return connection.invokeWithRetries(
-          new CallableWithoutException<ResultSet>() {
-            public ResultSet call() {
-              try {
-                return connection.createResultSet(
-                    connection.meta.getCrossReference(connection.handle, parentCatalog,
-                        parentSchema, parentTable, foreignCatalog, foreignSchema, foreignTable),
-                    new QueryState(MetaDataOperation.GET_CROSS_REFERENCE, parentCatalog,
-                        parentSchema, parentTable, foreignCatalog, foreignSchema, foreignTable));
-              } catch (SQLException e) {
-                throw new RuntimeException(e);
-              }
-            }
-          });
-    } catch (RuntimeException e) {
-      Throwable cause = e.getCause();
-      if (cause instanceof SQLException) {
-        throw (SQLException) cause;
-      }
-      throw e;
-    }
-  }
-
-  public ResultSet getTypeInfo() throws SQLException {
-    try {
-      return connection.invokeWithRetries(
-          new CallableWithoutException<ResultSet>() {
-            public ResultSet call() {
-              try {
-                return connection.createResultSet(connection.meta.getTypeInfo(connection.handle),
-                    new QueryState(MetaDataOperation.GET_TYPE_INFO));
-              } catch (SQLException e) {
-                throw new RuntimeException(e);
-              }
-            }
-          });
-    } catch (RuntimeException e) {
-      Throwable cause = e.getCause();
-      if (cause instanceof SQLException) {
-        throw (SQLException) cause;
-      }
-      throw e;
-    }
-  }
-
-  public ResultSet getIndexInfo(
-      final String catalog,
-      final String schema,
-      final String table,
-      final boolean unique,
-      final boolean approximate) throws SQLException {
-    try {
-      return connection.invokeWithRetries(
-          new CallableWithoutException<ResultSet>() {
-            public ResultSet call() {
-              try {
-                return connection.createResultSet(
-                    connection.meta.getIndexInfo(connection.handle, catalog, schema, table, unique,
-                        approximate),
-                    new QueryState(MetaDataOperation.GET_INDEX_INFO, catalog, schema, table, unique,
-                        approximate));
-              } catch (SQLException e) {
-                throw new RuntimeException(e);
-              }
-            }
-          });
-    } catch (RuntimeException e) {
-      Throwable cause = e.getCause();
-      if (cause instanceof SQLException) {
-        throw (SQLException) cause;
-      }
-      throw e;
-    }
-  }
-
-  public boolean supportsResultSetType(int type) throws SQLException {
-    return type == ResultSet.TYPE_FORWARD_ONLY;
-  }
-
-  public boolean supportsResultSetConcurrency(
-      int type, int concurrency) throws SQLException {
-    return type == ResultSet.TYPE_FORWARD_ONLY
-        && concurrency == ResultSet.CONCUR_READ_ONLY;
-  }
-
-  public boolean ownUpdatesAreVisible(int type) throws SQLException {
-    throw connection.helper.todo();
-  }
-
-  public boolean ownDeletesAreVisible(int type) throws SQLException {
-    throw connection.helper.todo();
-  }
-
-  public boolean ownInsertsAreVisible(int type) throws SQLException {
-    throw connection.helper.todo();
-  }
-
-  public boolean othersUpdatesAreVisible(int type) throws SQLException {
-    throw connection.helper.todo();
-  }
-
-  public boolean othersDeletesAreVisible(int type) throws SQLException {
-    throw connection.helper.todo();
-  }
-
-  public boolean othersInsertsAreVisible(int type) throws SQLException {
-    throw connection.helper.todo();
-  }
-
-  public boolean updatesAreDetected(int type) throws SQLException {
-    throw connection.helper.todo();
-  }
-
-  public boolean deletesAreDetected(int type) throws SQLException {
-    throw connection.helper.todo();
-  }
-
-  public boolean insertsAreDetected(int type) throws SQLException {
-    throw connection.helper.todo();
-  }
-
-  public boolean supportsBatchUpdates() throws SQLException {
-    return true;
-  }
-
-  public ResultSet getUDTs(
-      final String catalog,
-      final String schemaPattern,
-      final String typeNamePattern,
-      final int[] types) throws SQLException {
-    try {
-      return connection.invokeWithRetries(
-          new CallableWithoutException<ResultSet>() {
-            public ResultSet call() {
-              try {
-                return connection.createResultSet(
-                    connection.meta.getUDTs(connection.handle, catalog, pat(schemaPattern),
-                        pat(typeNamePattern), types),
-                    new QueryState(MetaDataOperation.GET_UDTS, catalog, schemaPattern,
-                        typeNamePattern, types));
-              } catch (SQLException e) {
-                throw new RuntimeException(e);
-              }
-            }
-          });
-    } catch (RuntimeException e) {
-      Throwable cause = e.getCause();
-      if (cause instanceof SQLException) {
-        throw (SQLException) cause;
-      }
-      throw e;
-    }
-  }
-
-  public Connection getConnection() throws SQLException {
-    return connection;
-  }
-
-  public boolean supportsSavepoints() throws SQLException {
-    return false;
-  }
-
-  public boolean supportsNamedParameters() throws SQLException {
-    return false;
-  }
-
-  public boolean supportsMultipleOpenResults() throws SQLException {
-    return false;
-  }
-
-  public boolean supportsGetGeneratedKeys() throws SQLException {
-    return false;
-  }
-
-  public ResultSet getSuperTypes(
-      final String catalog,
-      final String schemaPattern,
-      final String typeNamePattern) throws SQLException {
-    try {
-      return connection.invokeWithRetries(
-          new CallableWithoutException<ResultSet>() {
-            public ResultSet call() {
-              try {
-                return connection.createResultSet(
-                    connection.meta.getSuperTypes(connection.handle, catalog, pat(schemaPattern),
-                        pat(typeNamePattern)),
-                    new QueryState(MetaDataOperation.GET_SUPER_TYPES, catalog, schemaPattern,
-                        typeNamePattern));
-              } catch (SQLException e) {
-                throw new RuntimeException(e);
-              }
-            }
-          });
-    } catch (RuntimeException e) {
-      Throwable cause = e.getCause();
-      if (cause instanceof SQLException) {
-        throw (SQLException) cause;
-      }
-      throw e;
-    }
-  }
-
-  public ResultSet getSuperTables(
-      final String catalog,
-      final String schemaPattern,
-      final String tableNamePattern) throws SQLException {
-    try {
-      return connection.invokeWithRetries(
-          new CallableWithoutException<ResultSet>() {
-            public ResultSet call() {
-              try {
-                return connection.createResultSet(
-                    connection.meta.getSuperTables(connection.handle, catalog, pat(schemaPattern),
-                        pat(tableNamePattern)),
-                    new QueryState(MetaDataOperation.GET_SUPER_TABLES, catalog, schemaPattern,
-                        tableNamePattern));
-              } catch (SQLException e) {
-                throw new RuntimeException(e);
-              }
-            }
-          });
-    } catch (RuntimeException e) {
-      Throwable cause = e.getCause();
-      if (cause instanceof SQLException) {
-        throw (SQLException) cause;
-      }
-      throw e;
-    }
-  }
-
-  public ResultSet getAttributes(
-      final String catalog,
-      final String schemaPattern,
-      final String typeNamePattern,
-      final String attributeNamePattern) throws SQLException {
-    try {
-      return connection.invokeWithRetries(
-          new CallableWithoutException<ResultSet>() {
-            public ResultSet call() {
-              try {
-                return connection.createResultSet(
-                    connection.meta.getAttributes(connection.handle, catalog, pat(schemaPattern),
-                        pat(typeNamePattern), pat(attributeNamePattern)),
-                    new QueryState(MetaDataOperation.GET_ATTRIBUTES, catalog, schemaPattern,
-                        typeNamePattern, attributeNamePattern));
-              } catch (SQLException e) {
-                throw new RuntimeException(e);
-              }
-            }
-          });
-    } catch (RuntimeException e) {
-      Throwable cause = e.getCause();
-      if (cause instanceof SQLException) {
-        throw (SQLException) cause;
-      }
-      throw e;
-    }
-  }
-
-  public boolean supportsResultSetHoldability(int holdability)
-      throws SQLException {
-    throw connection.helper.todo();
-  }
-
-  public int getResultSetHoldability() {
-    return ResultSet.HOLD_CURSORS_OVER_COMMIT;
-  }
-
-  public int getDatabaseMajorVersion() throws SQLException {
-    return connection.driver.version.databaseMajorVersion;
-  }
-
-  public int getDatabaseMinorVersion() throws SQLException {
-    return connection.driver.version.databaseMinorVersion;
-  }
-
-  public int getJDBCMajorVersion() throws SQLException {
-    return connection.factory.getJdbcMajorVersion();
-  }
-
-  public int getJDBCMinorVersion() throws SQLException {
-    return connection.factory.getJdbcMinorVersion();
-  }
-
-  public int getSQLStateType() throws SQLException {
-    return sqlStateSQL;
-  }
-
-  public boolean locatorsUpdateCopy() throws SQLException {
-    return true;
-  }
-
-  public boolean supportsStatementPooling() throws SQLException {
-    return false;
-  }
-
-  public RowIdLifetime getRowIdLifetime() throws SQLException {
-    return RowIdLifetime.ROWID_UNSUPPORTED;
-  }
-
-  public boolean supportsStoredFunctionsUsingCallSyntax()
-      throws SQLException {
-    return true;
-  }
-
-  public boolean autoCommitFailureClosesAllResultSets() throws SQLException {
-    return false;
-  }
-
-  public ResultSet getClientInfoProperties() throws SQLException {
-    try {
-      return connection.invokeWithRetries(
-          new CallableWithoutException<ResultSet>() {
-            public ResultSet call() {
-              try {
-                return connection.createResultSet(
-                    connection.meta.getClientInfoProperties(connection.handle),
-                    new QueryState(MetaDataOperation.GET_CLIENT_INFO_PROPERTIES));
-              } catch (SQLException e) {
-                throw new RuntimeException(e);
-              }
-            }
-          });
-    } catch (RuntimeException e) {
-      Throwable cause = e.getCause();
-      if (cause instanceof SQLException) {
-        throw (SQLException) cause;
-      }
-      throw e;
-    }
-  }
-
-  public ResultSet getFunctions(
-      final String catalog,
-      final String schemaPattern,
-      final String functionNamePattern) throws SQLException {
-    try {
-      return connection.invokeWithRetries(
-          new CallableWithoutException<ResultSet>() {
-            public ResultSet call() {
-              try {
-                return connection.createResultSet(
-                    connection.meta.getFunctions(connection.handle, catalog, pat(schemaPattern),
-                        pat(functionNamePattern)),
-                    new QueryState(MetaDataOperation.GET_FUNCTIONS, catalog, schemaPattern,
-                        functionNamePattern));
-              } catch (SQLException e) {
-                throw new RuntimeException(e);
-              }
-            }
-          });
-    } catch (RuntimeException e) {
-      Throwable cause = e.getCause();
-      if (cause instanceof SQLException) {
-        throw (SQLException) cause;
-      }
-      throw e;
-    }
-  }
-
-  public ResultSet getFunctionColumns(
-      final String catalog,
-      final String schemaPattern,
-      final String functionNamePattern,
-      final String columnNamePattern) throws SQLException {
-    try {
-      return connection.invokeWithRetries(
-          new CallableWithoutException<ResultSet>() {
-            public ResultSet call() {
-              try {
-                return connection.createResultSet(
-                    connection.meta.getFunctionColumns(connection.handle, catalog,
-                        pat(schemaPattern), pat(functionNamePattern), pat(columnNamePattern)),
-                    new QueryState(MetaDataOperation.GET_FUNCTION_COLUMNS, catalog,
-                        schemaPattern, functionNamePattern, columnNamePattern));
-              } catch (SQLException e) {
-                throw new RuntimeException(e);
-              }
-            }
-          });
-    } catch (RuntimeException e) {
-      Throwable cause = e.getCause();
-      if (cause instanceof SQLException) {
-        throw (SQLException) cause;
-      }
-      throw e;
-    }
-  }
-
-  public ResultSet getPseudoColumns(
-      final String catalog,
-      final String schemaPattern,
-      final String tableNamePattern,
-      final String columnNamePattern) throws SQLException {
-    try {
-      return connection.invokeWithRetries(
-          new CallableWithoutException<ResultSet>() {
-            public ResultSet call() {
-              try {
-                return connection.createResultSet(
-                    connection.meta.getPseudoColumns(connection.handle, catalog, pat(schemaPattern),
-                        pat(tableNamePattern), pat(columnNamePattern)),
-                    new QueryState(MetaDataOperation.GET_PSEUDO_COLUMNS, catalog, schemaPattern,
-                        tableNamePattern, columnNamePattern));
-              } catch (SQLException e) {
-                throw new RuntimeException(e);
-              }
-            }
-          });
-    } catch (RuntimeException e) {
-      Throwable cause = e.getCause();
-      if (cause instanceof SQLException) {
-        throw (SQLException) cause;
-      }
-      throw e;
-    }
-  }
-
-  public boolean generatedKeyAlwaysReturned() throws SQLException {
-    return false;
-  }
-
-  // implement Wrapper
-
-  @Override public <T> T unwrap(Class<T> iface) throws SQLException {
-    if (iface.isInstance(this)) {
-      return iface.cast(this);
-    }
-
-    if (Properties.class.equals(iface)) {
-      return iface.cast(getRemoteAvaticaProperties());
-    }
-
-    throw connection.helper.createException(
-        "does not implement '" + iface + "'");
-  }
-
-  @Override public boolean isWrapperFor(Class<?> iface) throws SQLException {
-    return iface.isInstance(this) || Properties.class.equals(iface);
-  }
-
-  // Not JDBC Methods
-
-  @Override public Properties getRemoteAvaticaProperties() {
-    Map<DatabaseProperty, Object> propertyMap = connection.invokeWithRetries(
-        new CallableWithoutException<Map<DatabaseProperty, Object>>() {
-          public Map<DatabaseProperty, Object> call() {
-            return connection.meta.getDatabaseProperties(connection.handle);
-          }
-        });
-
-    final Properties properties = new Properties();
-    for (Entry<DatabaseProperty, Object> entry: propertyMap.entrySet()) {
-      properties.setProperty(entry.getKey().name(), entry.getValue().toString());
-    }
-
-    return properties;
-  }
-
-  /**
-   * Fetches the Avatica version from the given server.
-   *
-   * @return The Avatica version string or null if the server did not provide the version.
-   */
-  @Override public String getAvaticaServerVersion() {
-    Map<DatabaseProperty, Object> properties = connection.invokeWithRetries(
-        new CallableWithoutException<Map<DatabaseProperty, Object>>() {
-          public Map<DatabaseProperty, Object> call() {
-            return connection.meta.getDatabaseProperties(connection.handle);
-          }
-        });
-    Object o = properties.get(DatabaseProperty.AVATICA_VERSION);
-    if (null == o) {
-      return null;
-    }
-    return (String) o;
-  }
-}
-
-// End AvaticaDatabaseMetaData.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaFactory.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaFactory.java b/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaFactory.java
deleted file mode 100644
index f6d955e..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaFactory.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import java.sql.ResultSetMetaData;
-import java.sql.SQLException;
-import java.util.Properties;
-import java.util.TimeZone;
-
-/**
- * Factory for JDBC objects.
- *
- * <p>There is an implementation for each supported JDBC version.</p>
- */
-public interface AvaticaFactory {
-  int getJdbcMajorVersion();
-
-  int getJdbcMinorVersion();
-
-  AvaticaConnection newConnection(
-      UnregisteredDriver driver,
-      AvaticaFactory factory,
-      String url,
-      Properties info) throws SQLException;
-
-  AvaticaStatement newStatement(AvaticaConnection connection,
-      /*@Nullable*/ Meta.StatementHandle h, int resultSetType,
-      int resultSetConcurrency, int resultSetHoldability) throws SQLException;
-
-  AvaticaPreparedStatement newPreparedStatement(AvaticaConnection connection,
-      /*@Nullable*/ Meta.StatementHandle h, Meta.Signature signature,
-      int resultSetType, int resultSetConcurrency, int resultSetHoldability)
-      throws SQLException;
-
-  /**
-   * Creates a result set. You will then need to call
-   * {@link AvaticaResultSet#execute()} on it.
-   *
-   * @param statement Statement
-   * @param state The state used to create this result set
-   * @param signature Prepared statement
-   * @param timeZone Time zone
-   * @param firstFrame Frame containing the first (or perhaps only) rows in the
-   *                   result, or null if an execute/fetch is required
-   * @return Result set
-   */
-  AvaticaResultSet newResultSet(AvaticaStatement statement, QueryState state,
-      Meta.Signature signature, TimeZone timeZone, Meta.Frame firstFrame)
-      throws SQLException;
-
-  /**
-   * Creates meta data for the database.
-   *
-   * @return Database meta data
-   */
-  AvaticaSpecificDatabaseMetaData newDatabaseMetaData(AvaticaConnection connection);
-
-  /**
-   * Creates meta data for a result set.
-   *
-   * @param statement Statement
-   * @param signature Prepared statement
-   * @return Result set meta data
-   */
-  ResultSetMetaData newResultSetMetaData(AvaticaStatement statement,
-      Meta.Signature signature) throws SQLException;
-}
-
-// End AvaticaFactory.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaJdbc41Factory.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaJdbc41Factory.java b/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaJdbc41Factory.java
deleted file mode 100644
index 2edf515..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaJdbc41Factory.java
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import java.io.InputStream;
-import java.io.Reader;
-import java.sql.NClob;
-import java.sql.ResultSetMetaData;
-import java.sql.RowId;
-import java.sql.SQLException;
-import java.sql.SQLXML;
-import java.util.Properties;
-import java.util.TimeZone;
-
-/**
- * Implementation of {@link AvaticaFactory} for JDBC 4.1 (corresponds to JDK
- * 1.7).
- */
-@SuppressWarnings("UnusedDeclaration")
-class AvaticaJdbc41Factory implements AvaticaFactory {
-  private final int major;
-  private final int minor;
-
-  /** Creates a JDBC factory. */
-  public AvaticaJdbc41Factory() {
-    this(4, 1);
-  }
-
-  /** Creates a JDBC factory with given major/minor version number. */
-  protected AvaticaJdbc41Factory(int major, int minor) {
-    this.major = major;
-    this.minor = minor;
-  }
-
-  public int getJdbcMajorVersion() {
-    return major;
-  }
-
-  public int getJdbcMinorVersion() {
-    return minor;
-  }
-
-  public AvaticaConnection newConnection(
-      UnregisteredDriver driver,
-      AvaticaFactory factory,
-      String url,
-      Properties info) {
-    return new AvaticaJdbc41Connection(driver, factory, url, info);
-  }
-
-  public AvaticaSpecificDatabaseMetaData newDatabaseMetaData(
-      AvaticaConnection connection) {
-    return new AvaticaJdbc41DatabaseMetaData(connection);
-  }
-
-  public AvaticaStatement newStatement(AvaticaConnection connection,
-      Meta.StatementHandle h, int resultSetType, int resultSetConcurrency,
-      int resultSetHoldability) {
-    return new AvaticaJdbc41Statement(connection, h, resultSetType,
-        resultSetConcurrency, resultSetHoldability);
-  }
-
-  public AvaticaPreparedStatement newPreparedStatement(
-      AvaticaConnection connection, Meta.StatementHandle h,
-      Meta.Signature signature, int resultSetType, int resultSetConcurrency,
-      int resultSetHoldability)
-      throws SQLException {
-    return new AvaticaJdbc41PreparedStatement(connection, h, signature,
-        resultSetType, resultSetConcurrency, resultSetHoldability);
-  }
-
-  public AvaticaResultSet newResultSet(AvaticaStatement statement,
-      QueryState state, Meta.Signature signature, TimeZone timeZone, Meta.Frame firstFrame) {
-    final ResultSetMetaData metaData =
-        newResultSetMetaData(statement, signature);
-    return new AvaticaResultSet(statement, state, signature, metaData, timeZone,
-        firstFrame);
-  }
-
-  public AvaticaResultSetMetaData newResultSetMetaData(
-      AvaticaStatement statement, Meta.Signature signature) {
-    return new AvaticaResultSetMetaData(statement, null, signature);
-  }
-
-  /** Implementation of Connection for JDBC 4.1. */
-  private static class AvaticaJdbc41Connection extends AvaticaConnection {
-    AvaticaJdbc41Connection(UnregisteredDriver driver,
-        AvaticaFactory factory,
-        String url,
-        Properties info) {
-      super(driver, factory, url, info);
-    }
-  }
-
-  /** Implementation of Statement for JDBC 4.1. */
-  private static class AvaticaJdbc41Statement extends AvaticaStatement {
-    public AvaticaJdbc41Statement(AvaticaConnection connection,
-        Meta.StatementHandle h, int resultSetType, int resultSetConcurrency,
-        int resultSetHoldability) {
-      super(connection, h, resultSetType, resultSetConcurrency,
-          resultSetHoldability);
-    }
-  }
-
-  /** Implementation of PreparedStatement for JDBC 4.1. */
-  private static class AvaticaJdbc41PreparedStatement
-      extends AvaticaPreparedStatement {
-    AvaticaJdbc41PreparedStatement(AvaticaConnection connection,
-        Meta.StatementHandle h, Meta.Signature signature, int resultSetType,
-        int resultSetConcurrency, int resultSetHoldability)
-        throws SQLException {
-      super(connection, h, signature, resultSetType, resultSetConcurrency,
-          resultSetHoldability);
-    }
-
-    public void setRowId(
-        int parameterIndex,
-        RowId x) throws SQLException {
-      getSite(parameterIndex).setRowId(x);
-    }
-
-    public void setNString(
-        int parameterIndex, String value) throws SQLException {
-      getSite(parameterIndex).setNString(value);
-    }
-
-    public void setNCharacterStream(
-        int parameterIndex,
-        Reader value,
-        long length) throws SQLException {
-      getSite(parameterIndex)
-          .setNCharacterStream(value, length);
-    }
-
-    public void setNClob(
-        int parameterIndex,
-        NClob value) throws SQLException {
-      getSite(parameterIndex).setNClob(value);
-    }
-
-    public void setClob(
-        int parameterIndex,
-        Reader reader,
-        long length) throws SQLException {
-      getSite(parameterIndex)
-          .setClob(reader, length);
-    }
-
-    public void setBlob(
-        int parameterIndex,
-        InputStream inputStream,
-        long length) throws SQLException {
-      getSite(parameterIndex)
-          .setBlob(inputStream, length);
-    }
-
-    public void setNClob(
-        int parameterIndex,
-        Reader reader,
-        long length) throws SQLException {
-      getSite(parameterIndex)
-          .setNClob(reader, length);
-    }
-
-    public void setSQLXML(
-        int parameterIndex, SQLXML xmlObject) throws SQLException {
-      getSite(parameterIndex).setSQLXML(xmlObject);
-    }
-
-    public void setAsciiStream(
-        int parameterIndex,
-        InputStream x,
-        long length) throws SQLException {
-      getSite(parameterIndex)
-          .setAsciiStream(x, length);
-    }
-
-    public void setBinaryStream(
-        int parameterIndex,
-        InputStream x,
-        long length) throws SQLException {
-      getSite(parameterIndex)
-          .setBinaryStream(x, length);
-    }
-
-    public void setCharacterStream(
-        int parameterIndex,
-        Reader reader,
-        long length) throws SQLException {
-      getSite(parameterIndex)
-          .setCharacterStream(reader, length);
-    }
-
-    public void setAsciiStream(
-        int parameterIndex, InputStream x) throws SQLException {
-      getSite(parameterIndex).setAsciiStream(x);
-    }
-
-    public void setBinaryStream(
-        int parameterIndex, InputStream x) throws SQLException {
-      getSite(parameterIndex).setBinaryStream(x);
-    }
-
-    public void setCharacterStream(
-        int parameterIndex, Reader reader) throws SQLException {
-      getSite(parameterIndex)
-          .setCharacterStream(reader);
-    }
-
-    public void setNCharacterStream(
-        int parameterIndex, Reader value) throws SQLException {
-      getSite(parameterIndex)
-          .setNCharacterStream(value);
-    }
-
-    public void setClob(
-        int parameterIndex,
-        Reader reader) throws SQLException {
-      getSite(parameterIndex).setClob(reader);
-    }
-
-    public void setBlob(
-        int parameterIndex, InputStream inputStream) throws SQLException {
-      getSite(parameterIndex).setBlob(inputStream);
-    }
-
-    public void setNClob(
-        int parameterIndex, Reader reader) throws SQLException {
-      getSite(parameterIndex).setNClob(reader);
-    }
-  }
-
-  /** Implementation of DatabaseMetaData for JDBC 4.1. */
-  private static class AvaticaJdbc41DatabaseMetaData
-      extends AvaticaDatabaseMetaData {
-    AvaticaJdbc41DatabaseMetaData(AvaticaConnection connection) {
-      super(connection);
-    }
-  }
-}
-
-// End AvaticaJdbc41Factory.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaParameter.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaParameter.java b/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaParameter.java
deleted file mode 100644
index 3c5a9ab..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaParameter.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import org.apache.calcite.avatica.proto.Common;
-
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-import java.util.Objects;
-
-/**
- * Metadata for a parameter.
- */
-public class AvaticaParameter {
-  public final boolean signed;
-  public final int precision;
-  public final int scale;
-  public final int parameterType;
-  public final String typeName;
-  public final String className;
-  public final String name;
-
-  @JsonCreator
-  public AvaticaParameter(
-      @JsonProperty("signed") boolean signed,
-      @JsonProperty("precision") int precision,
-      @JsonProperty("scale") int scale,
-      @JsonProperty("parameterType") int parameterType,
-      @JsonProperty("typeName") String typeName,
-      @JsonProperty("className") String className,
-      @JsonProperty("name") String name) {
-    this.signed = signed;
-    this.precision = precision;
-    this.scale = scale;
-    this.parameterType = parameterType;
-    this.typeName = typeName;
-    this.className = className;
-    this.name = name;
-  }
-
-  public Common.AvaticaParameter toProto() {
-    Common.AvaticaParameter.Builder builder = Common.AvaticaParameter.newBuilder();
-
-    builder.setSigned(signed);
-    builder.setPrecision(precision);
-    builder.setScale(scale);
-    builder.setParameterType(parameterType);
-    builder.setTypeName(typeName);
-    builder.setClassName(className);
-    builder.setName(name);
-
-    return builder.build();
-  }
-
-  public static AvaticaParameter fromProto(Common.AvaticaParameter proto) {
-    return new AvaticaParameter(proto.getSigned(), proto.getPrecision(),
-        proto.getScale(), proto.getParameterType(), proto.getTypeName(),
-        proto.getClassName(), proto.getName());
-  }
-
-  @Override public int hashCode() {
-    return Objects.hash(className, name, parameterType, precision, scale,
-        signed, typeName);
-  }
-
-  @Override public boolean equals(Object obj) {
-    if (obj == this) {
-      return true;
-    }
-    if (obj instanceof AvaticaParameter) {
-      AvaticaParameter other = (AvaticaParameter) obj;
-
-      if (null == className) {
-        if (null != other.className) {
-          return false;
-        }
-      } else if (!className.equals(other.className)) {
-        return false;
-      }
-
-      if (null == name) {
-        if (null != other.name) {
-          return false;
-        }
-      } else if (!name.equals(other.name)) {
-        return false;
-      }
-
-      if (parameterType != other.parameterType) {
-        return false;
-      }
-
-      if (precision != other.precision) {
-        return false;
-      }
-
-      if (scale != other.scale) {
-        return false;
-      }
-
-      if (signed != other.signed) {
-        return false;
-      }
-
-      if (null == typeName) {
-        if (null != other.typeName) {
-          return false;
-        }
-      } else if (!typeName.equals(other.typeName)) {
-        return false;
-      }
-
-      return true;
-    }
-
-    return false;
-  }
-}
-
-// End AvaticaParameter.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaPreparedStatement.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaPreparedStatement.java b/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaPreparedStatement.java
deleted file mode 100644
index e611c9a..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaPreparedStatement.java
+++ /dev/null
@@ -1,387 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import org.apache.calcite.avatica.Meta.Signature;
-import org.apache.calcite.avatica.remote.TypedValue;
-
-import java.io.InputStream;
-import java.io.Reader;
-import java.math.BigDecimal;
-import java.net.URL;
-import java.sql.Array;
-import java.sql.Blob;
-import java.sql.Clob;
-import java.sql.Date;
-import java.sql.ParameterMetaData;
-import java.sql.PreparedStatement;
-import java.sql.Ref;
-import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
-import java.sql.SQLException;
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.List;
-import java.util.Locale;
-
-/**
- * Implementation of {@link java.sql.PreparedStatement}
- * for the Avatica engine.
- *
- * <p>This class has sub-classes which implement JDBC 3.0 and JDBC 4.0 APIs;
- * it is instantiated using {@link AvaticaFactory#newPreparedStatement}.</p>
- */
-public abstract class AvaticaPreparedStatement
-    extends AvaticaStatement
-    implements PreparedStatement, ParameterMetaData {
-  private final ResultSetMetaData resultSetMetaData;
-  private Calendar calendar;
-  protected final TypedValue[] slots;
-  protected final List<List<TypedValue>> parameterValueBatch;
-
-  /**
-   * Creates an AvaticaPreparedStatement.
-   *
-   * @param connection Connection
-   * @param h Statement handle
-   * @param signature Result of preparing statement
-   * @param resultSetType Result set type
-   * @param resultSetConcurrency Result set concurrency
-   * @param resultSetHoldability Result set holdability
-   * @throws SQLException If fails due to underlying implementation reasons.
-   */
-  protected AvaticaPreparedStatement(AvaticaConnection connection,
-      Meta.StatementHandle h,
-      Meta.Signature signature,
-      int resultSetType,
-      int resultSetConcurrency,
-      int resultSetHoldability) throws SQLException {
-    super(connection, h, resultSetType, resultSetConcurrency,
-        resultSetHoldability, signature);
-    this.slots = new TypedValue[signature.parameters.size()];
-    this.resultSetMetaData =
-        connection.factory.newResultSetMetaData(this, signature);
-    this.parameterValueBatch = new ArrayList<>();
-  }
-
-  @Override protected List<TypedValue> getParameterValues() {
-    return Arrays.asList(slots);
-  }
-
-  /** Returns a copy of the current parameter values.
-   * @return A copied list of the parameter values
-   */
-  protected List<TypedValue> copyParameterValues() {
-    // For implementing batch update, we need to make a copy of slots, not just a thin reference
-    // to it as as list. Otherwise, subsequent setFoo(..) calls will alter the underlying array
-    // and modify our cached TypedValue list.
-    List<TypedValue> copy = new ArrayList<>(slots.length);
-    for (TypedValue value : slots) {
-      copy.add(value);
-    }
-    return copy;
-  }
-
-  /** Returns a calendar in the connection's time zone, creating one the first
-   * time this method is called.
-   *
-   * <p>Uses the calendar to offset date-time values when calling methods such
-   * as {@link #setDate(int, Date)}.
-   *
-   * <p>A note on thread-safety. This method does not strictly need to be
-   * {@code synchronized}, because JDBC does not promise thread safety if
-   * different threads are accessing the same statement, or even different
-   * objects within a particular connection.
-   *
-   * <p>The calendar returned is to be used only within this statement, and
-   * JDBC only allows access to a statement from within one thread, so
-   * therefore does not need to be synchronized when accessed.
-   */
-  protected synchronized Calendar getCalendar() {
-    if (calendar == null) {
-      calendar = Calendar.getInstance(connection.getTimeZone(), Locale.ROOT);
-    }
-    return calendar;
-  }
-
-  protected List<List<TypedValue>> getParameterValueBatch() {
-    return this.parameterValueBatch;
-  }
-
-  // implement PreparedStatement
-
-  public ResultSet executeQuery() throws SQLException {
-    this.updateCount = -1;
-    final Signature sig = getSignature();
-    return getConnection().executeQueryInternal(this, sig, null,
-        new QueryState(sig.sql), false);
-  }
-
-  public ParameterMetaData getParameterMetaData() throws SQLException {
-    return this;
-  }
-
-  public final int executeUpdate() throws SQLException {
-    return (int) executeLargeUpdate();
-  }
-
-  public long executeLargeUpdate() throws SQLException {
-    getConnection().executeQueryInternal(this, null, null,
-        new QueryState(getSignature().sql), true);
-    return updateCount;
-  }
-
-  public void setNull(int parameterIndex, int sqlType) throws SQLException {
-    getSite(parameterIndex).setNull(sqlType);
-  }
-
-  public void setBoolean(int parameterIndex, boolean x) throws SQLException {
-    getSite(parameterIndex).setBoolean(x);
-  }
-
-  public void setByte(int parameterIndex, byte x) throws SQLException {
-    getSite(parameterIndex).setByte(x);
-  }
-
-  public void setShort(int parameterIndex, short x) throws SQLException {
-    getSite(parameterIndex).setShort(x);
-  }
-
-  public void setInt(int parameterIndex, int x) throws SQLException {
-    getSite(parameterIndex).setInt(x);
-  }
-
-  public void setLong(int parameterIndex, long x) throws SQLException {
-    getSite(parameterIndex).setLong(x);
-  }
-
-  public void setFloat(int parameterIndex, float x) throws SQLException {
-    getSite(parameterIndex).setFloat(x);
-  }
-
-  public void setDouble(int parameterIndex, double x) throws SQLException {
-    getSite(parameterIndex).setDouble(x);
-  }
-
-  public void setBigDecimal(int parameterIndex, BigDecimal x)
-      throws SQLException {
-    getSite(parameterIndex).setBigDecimal(x);
-  }
-
-  public void setString(int parameterIndex, String x) throws SQLException {
-    getSite(parameterIndex).setString(x);
-  }
-
-  public void setBytes(int parameterIndex, byte[] x) throws SQLException {
-    getSite(parameterIndex).setBytes(x);
-  }
-
-  public void setAsciiStream(int parameterIndex, InputStream x, int length)
-      throws SQLException {
-    getSite(parameterIndex).setAsciiStream(x, length);
-  }
-
-  @SuppressWarnings("deprecation")
-  public void setUnicodeStream(int parameterIndex, InputStream x, int length)
-      throws SQLException {
-    getSite(parameterIndex).setUnicodeStream(x, length);
-  }
-
-  public void setBinaryStream(int parameterIndex, InputStream x, int length)
-      throws SQLException {
-    getSite(parameterIndex).setBinaryStream(x, length);
-  }
-
-  public void clearParameters() throws SQLException {
-    for (int i = 0; i < slots.length; i++) {
-      slots[i] = null;
-    }
-  }
-
-  public void setObject(int parameterIndex, Object x, int targetSqlType)
-      throws SQLException {
-    getSite(parameterIndex).setObject(x, targetSqlType);
-  }
-
-  public void setObject(int parameterIndex, Object x) throws SQLException {
-    getSite(parameterIndex).setObject(x);
-  }
-
-  public boolean execute() throws SQLException {
-    this.updateCount = -1;
-    // We don't know if this is actually an update or a query, so call it a query so we pass the
-    // Signature to the server.
-    getConnection().executeQueryInternal(this, getSignature(), null,
-        new QueryState(getSignature().sql), false);
-    // Result set is null for DML or DDL.
-    // Result set is closed if user cancelled the query.
-    return openResultSet != null && !openResultSet.isClosed();
-  }
-
-  public void addBatch() throws SQLException {
-    // Need to copy the parameterValues into a new list, not wrap the array in a list
-    // as getParameterValues does.
-    this.parameterValueBatch.add(copyParameterValues());
-  }
-
-  @Override public void clearBatch() {
-    this.parameterValueBatch.clear();
-  }
-
-  @Override public int[] executeBatch() throws SQLException {
-    return AvaticaUtils.toSaturatedInts(executeLargeBatch());
-  }
-
-  public long[] executeLargeBatch() throws SQLException {
-    // Overriding the implementation in AvaticaStatement.
-    try {
-      return getConnection().executeBatchUpdateInternal(this);
-    } finally {
-      // If we failed to send this batch, that's a problem for the user to handle, not us.
-      // Make sure we always clear the statements we collected to submit in one RPC.
-      this.parameterValueBatch.clear();
-    }
-  }
-
-  public void setCharacterStream(int parameterIndex, Reader reader, int length)
-      throws SQLException {
-    getSite(parameterIndex).setCharacterStream(reader, length);
-  }
-
-  public void setRef(int parameterIndex, Ref x) throws SQLException {
-    getSite(parameterIndex).setRef(x);
-  }
-
-  public void setBlob(int parameterIndex, Blob x) throws SQLException {
-    getSite(parameterIndex).setBlob(x);
-  }
-
-  public void setClob(int parameterIndex, Clob x) throws SQLException {
-    getSite(parameterIndex).setClob(x);
-  }
-
-  public void setArray(int parameterIndex, Array x) throws SQLException {
-    getSite(parameterIndex).setArray(x);
-  }
-
-  public ResultSetMetaData getMetaData() {
-    return resultSetMetaData;
-  }
-
-  public void setDate(int parameterIndex, Date x, Calendar calendar)
-      throws SQLException {
-    getSite(parameterIndex).setDate(x, calendar);
-  }
-
-  public void setDate(int parameterIndex, Date x) throws SQLException {
-    setDate(parameterIndex, x, getCalendar());
-  }
-
-  public void setTime(int parameterIndex, Time x, Calendar calendar)
-      throws SQLException {
-    getSite(parameterIndex).setTime(x, calendar);
-  }
-
-  public void setTime(int parameterIndex, Time x) throws SQLException {
-    setTime(parameterIndex, x, getCalendar());
-  }
-
-  public void setTimestamp(int parameterIndex, Timestamp x, Calendar calendar)
-      throws SQLException {
-    getSite(parameterIndex).setTimestamp(x, calendar);
-  }
-
-  public void setTimestamp(int parameterIndex, Timestamp x)
-      throws SQLException {
-    setTimestamp(parameterIndex, x, getCalendar());
-  }
-
-  public void setNull(int parameterIndex, int sqlType, String typeName)
-      throws SQLException {
-    getSite(parameterIndex).setNull(sqlType, typeName);
-  }
-
-  public void setURL(int parameterIndex, URL x) throws SQLException {
-    getSite(parameterIndex).setURL(x);
-  }
-
-  public void setObject(int parameterIndex, Object x, int targetSqlType,
-      int scaleOrLength) throws SQLException {
-    getSite(parameterIndex).setObject(x, targetSqlType, scaleOrLength);
-  }
-
-  // implement ParameterMetaData
-
-  protected AvaticaParameter getParameter(int param) throws SQLException {
-    try {
-      return getSignature().parameters.get(param - 1);
-    } catch (IndexOutOfBoundsException e) {
-      //noinspection ThrowableResultOfMethodCallIgnored
-      throw connection.helper.toSQLException(
-          connection.helper.createException(
-              "parameter ordinal " + param + " out of range"));
-    }
-  }
-
-  protected AvaticaSite getSite(int param) throws SQLException {
-    final AvaticaParameter parameter = getParameter(param);
-    return new AvaticaSite(parameter, getCalendar(), param - 1, slots);
-  }
-
-  public int getParameterCount() {
-    return getSignature().parameters.size();
-  }
-
-  public int isNullable(int param) throws SQLException {
-    return ParameterMetaData.parameterNullableUnknown;
-  }
-
-  public boolean isSigned(int index) throws SQLException {
-    return getParameter(index).signed;
-  }
-
-  public int getPrecision(int index) throws SQLException {
-    return getParameter(index).precision;
-  }
-
-  public int getScale(int index) throws SQLException {
-    return getParameter(index).scale;
-  }
-
-  public int getParameterType(int index) throws SQLException {
-    return getParameter(index).parameterType;
-  }
-
-  public String getParameterTypeName(int index) throws SQLException {
-    return getParameter(index).typeName;
-  }
-
-  public String getParameterClassName(int index) throws SQLException {
-    return getParameter(index).className;
-  }
-
-  public int getParameterMode(int param) throws SQLException {
-    //noinspection UnusedDeclaration
-    AvaticaParameter paramDef = getParameter(param); // forces param range check
-    return ParameterMetaData.parameterModeIn;
-  }
-}
-
-// End AvaticaPreparedStatement.java


[12/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/codegen/templates/Parser.jj
----------------------------------------------------------------------
diff --git a/core/src/main/codegen/templates/Parser.jj b/core/src/main/codegen/templates/Parser.jj
deleted file mode 100644
index c30794d..0000000
--- a/core/src/main/codegen/templates/Parser.jj
+++ /dev/null
@@ -1,6623 +0,0 @@
-/*
- * 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.
- */
-<@pp.dropOutputFile />
-
-<@pp.changeOutputFile name="javacc/Parser.jj" />
-
-options {
-    STATIC = false;
-    IGNORE_CASE = true;
-    UNICODE_INPUT = true;
-}
-
-
-PARSER_BEGIN(${parser.class})
-
-package ${parser.package};
-
-<#list parser.imports as importStr>
-import ${importStr};
-</#list>
-
-
-import org.apache.calcite.avatica.util.Casing;
-import org.apache.calcite.avatica.util.DateTimeUtils;
-import org.apache.calcite.avatica.util.TimeUnit;
-import org.apache.calcite.rel.type.RelDataType;
-import org.apache.calcite.runtime.CalciteContextException;
-import org.apache.calcite.sql.JoinConditionType;
-import org.apache.calcite.sql.JoinType;
-import org.apache.calcite.sql.SqlAlter;
-import org.apache.calcite.sql.SqlBinaryOperator;
-import org.apache.calcite.sql.SqlCall;
-import org.apache.calcite.sql.SqlCharStringLiteral;
-import org.apache.calcite.sql.SqlCollation;
-import org.apache.calcite.sql.SqlDataTypeSpec;
-import org.apache.calcite.sql.SqlDateLiteral;
-import org.apache.calcite.sql.SqlDelete;
-import org.apache.calcite.sql.SqlDescribeSchema;
-import org.apache.calcite.sql.SqlDescribeTable;
-import org.apache.calcite.sql.SqlDynamicParam;
-import org.apache.calcite.sql.SqlExplain;
-import org.apache.calcite.sql.SqlExplainFormat;
-import org.apache.calcite.sql.SqlExplainLevel;
-import org.apache.calcite.sql.SqlFunction;
-import org.apache.calcite.sql.SqlFunctionCategory;
-import org.apache.calcite.sql.SqlIdentifier;
-import org.apache.calcite.sql.SqlInsert;
-import org.apache.calcite.sql.SqlInsertKeyword;
-import org.apache.calcite.sql.SqlIntervalLiteral;
-import org.apache.calcite.sql.SqlIntervalQualifier;
-import org.apache.calcite.sql.SqlJdbcDataTypeName;
-import org.apache.calcite.sql.SqlJdbcFunctionCall;
-import org.apache.calcite.sql.SqlJoin;
-import org.apache.calcite.sql.SqlKind;
-import org.apache.calcite.sql.SqlLiteral;
-import org.apache.calcite.sql.SqlMatchRecognize;
-import org.apache.calcite.sql.SqlMerge;
-import org.apache.calcite.sql.SqlNode;
-import org.apache.calcite.sql.SqlNodeList;
-import org.apache.calcite.sql.SqlNumericLiteral;
-import org.apache.calcite.sql.SqlOperator;
-import org.apache.calcite.sql.SqlOrderBy;
-import org.apache.calcite.sql.SqlPostfixOperator;
-import org.apache.calcite.sql.SqlPrefixOperator;
-import org.apache.calcite.sql.SqlSampleSpec;
-import org.apache.calcite.sql.SqlSelect;
-import org.apache.calcite.sql.SqlSelectKeyword;
-import org.apache.calcite.sql.SqlSetOption;
-import org.apache.calcite.sql.SqlTimeLiteral;
-import org.apache.calcite.sql.SqlTimestampLiteral;
-import org.apache.calcite.sql.SqlUnnestOperator;
-import org.apache.calcite.sql.SqlUpdate;
-import org.apache.calcite.sql.SqlUtil;
-import org.apache.calcite.sql.SqlWindow;
-import org.apache.calcite.sql.SqlWith;
-import org.apache.calcite.sql.SqlWithItem;
-import org.apache.calcite.sql.fun.SqlCase;
-import org.apache.calcite.sql.fun.OracleSqlOperatorTable;
-import org.apache.calcite.sql.fun.SqlStdOperatorTable;
-import org.apache.calcite.sql.fun.SqlTrimFunction;
-import org.apache.calcite.sql.parser.SqlAbstractParserImpl;
-import org.apache.calcite.sql.parser.SqlParseException;
-import org.apache.calcite.sql.parser.SqlParser;
-import org.apache.calcite.sql.parser.SqlParserImplFactory;
-import org.apache.calcite.sql.parser.SqlParserPos;
-import org.apache.calcite.sql.parser.SqlParserUtil;
-import org.apache.calcite.sql.type.SqlTypeName;
-import org.apache.calcite.sql.validate.SqlConformance;
-import org.apache.calcite.util.Glossary;
-import org.apache.calcite.util.NlsString;
-import org.apache.calcite.util.Util;
-import org.apache.calcite.util.trace.CalciteTrace;
-
-import com.google.common.collect.Lists;
-
-import org.slf4j.Logger;
-
-import java.io.Reader;
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.List;
-import java.util.Locale;
-
-import static org.apache.calcite.util.Static.RESOURCE;
-
-/**
- * SQL parser, generated from Parser.jj by JavaCC.
- *
- * <p>The public wrapper for this parser is {@link SqlParser}.
- */
-public class ${parser.class} extends SqlAbstractParserImpl
-{
-    private static final Logger LOGGER = CalciteTrace.getParserTracer();
-
-    // Can't use quoted literal because of a bug in how JavaCC translates
-    // backslash-backslash.
-    private static final char BACKSLASH = 0x5c;
-    private static final char DOUBLE_QUOTE = 0x22;
-    private static final String DQ = DOUBLE_QUOTE + "";
-    private static final String DQDQ = DQ + DQ;
-
-    private static Metadata metadata;
-
-    private Casing unquotedCasing;
-    private Casing quotedCasing;
-    private int identifierMaxLength;
-    private SqlConformance conformance;
-
-    /**
-     * {@link SqlParserImplFactory} implementation for creating parser.
-     */
-    public static final SqlParserImplFactory FACTORY = new SqlParserImplFactory() {
-        public SqlAbstractParserImpl getParser(Reader stream) {
-            return new ${parser.class}(stream);
-        }
-    };
-
-    public SqlParseException normalizeException(Throwable ex)
-    {
-        try {
-            if (ex instanceof ParseException) {
-                ex = cleanupParseException((ParseException) ex);
-            }
-            return convertException(ex);
-        } catch (ParseException e) {
-            throw new AssertionError(e);
-        }
-    }
-
-    public Metadata getMetadata()
-    {
-        synchronized (${parser.class}.class) {
-            if (metadata == null) {
-                metadata = new MetadataImpl(
-                    new ${parser.class}(new java.io.StringReader("")));
-            }
-            return metadata;
-        }
-    }
-
-    public void setTabSize(int tabSize)
-    {
-        jj_input_stream.setTabSize(tabSize);
-    }
-
-    public void switchTo(String stateName)
-    {
-        int state = Arrays.asList(${parser.class}TokenManager.lexStateNames)
-            .indexOf(stateName);
-        token_source.SwitchTo(state);
-    }
-
-    public void setQuotedCasing(Casing quotedCasing)
-    {
-        this.quotedCasing = quotedCasing;
-    }
-
-    public void setUnquotedCasing(Casing unquotedCasing)
-    {
-        this.unquotedCasing = unquotedCasing;
-    }
-
-    public void setIdentifierMaxLength(int identifierMaxLength)
-    {
-        this.identifierMaxLength = identifierMaxLength;
-    }
-
-    public void setConformance(SqlConformance conformance)
-    {
-        this.conformance = conformance;
-    }
-
-    public SqlNode parseSqlExpressionEof() throws Exception
-    {
-        return SqlExpressionEof();
-    }
-
-    public SqlNode parseSqlStmtEof() throws Exception
-    {
-        return SqlStmtEof();
-    }
-
-    private SqlNode extend(SqlNode table, SqlNodeList extendList) {
-        return SqlStdOperatorTable.EXTEND.createCall(
-            table.getParserPosition().plus(extendList.getParserPosition()),
-            table, extendList);
-    }
-}
-
-PARSER_END(${parser.class})
-
-
-/***************************************
- * Utility Codes for Semantic Analysis *
- ***************************************/
-
-/* For Debug */
-JAVACODE
-void debug_message1() {
-    LOGGER.info("{} , {}", getToken(0).image, getToken(1).image);
-}
-
-JAVACODE String unquotedIdentifier() {
-    return SqlParserUtil.strip(getToken(0).image, null, null, null,
-        unquotedCasing);
-}
-
-String NonReservedKeyWord() :
-{
-    String kw;
-}
-{
-    kw = CommonNonReservedKeyWord()
-    {
-        return kw;
-    }
-}
-
-/**
- * Allows parser to be extended with new types of table references.  The
- * default implementation of this production is empty.
- */
-SqlNode ExtendedTableRef() :
-{
-}
-{
-    UnusedExtension()
-    {
-        return null;
-    }
-}
-
-/**
- * Allows an OVER clause following a table expression as an extension to
- * standard SQL syntax. The default implementation of this production is empty.
- */
-SqlNode TableOverOpt() :
-{
-}
-{
-    {
-        return null;
-    }
-}
-
-/*
- * Parses dialect-specific keywords immediately following the SELECT keyword.
- */
-void SqlSelectKeywords(List<SqlLiteral> keywords) :
-{}
-{
-    E()
-}
-
-/*
- * Parses dialect-specific keywords immediately following the INSERT keyword.
- */
-void SqlInsertKeywords(List<SqlLiteral> keywords) :
-{}
-{
-    E()
-}
-
-SqlNode ExtendedBuiltinFunctionCall() :
-{
-}
-{
-    UnusedExtension()
-    {
-        return null;
-    }
-}
-
-/*
-* Parse Floor/Ceil function parameters
-*/
-SqlNode FloorCeilOptions(SqlParserPos pos, boolean floorFlag) :
-{
-    SqlNode node;
-}
-{
-    node = StandardFloorCeilOptions(pos, floorFlag)
-    {
-        return node;
-    }
-}
-
-/*
-// This file contains the heart of a parser for SQL SELECT statements.
-// code can be shared between various parsers (for example, a DDL parser and a
-// DML parser) but is not a standalone JavaCC file. You need to prepend a
-// parser declaration (such as that in Parser.jj).
-*/
-
-/* Epsilon */
-JAVACODE
-void E() {}
-
-JAVACODE List startList(Object o)
-{
-    List list = new ArrayList();
-    list.add(o);
-    return list;
-}
-
-/*
- * NOTE jvs 6-Feb-2004: The straightforward way to implement the SQL grammar is
- * to keep query expressions (SELECT, UNION, etc) separate from row expressions
- * (+, LIKE, etc).  However, this is not possible with an LL(k) parser, because
- * both kinds of expressions allow parenthesization, so no fixed amount of left
- * context is ever good enough.  A sub-query can be a leaf in a row expression,
- * and can include operators like UNION, so it's not even possible to use a
- * syntactic lookahead rule like "look past an indefinite number of parentheses
- * until you see SELECT, VALUES, or TABLE" (since at that point we still
- * don't know whether we're parsing a sub-query like ((select ...) + x)
- * vs. (select ... union select ...).
- *
- * The somewhat messy solution is to unify the two kinds of expression,
- * and to enforce syntax rules using parameterized context.  This
- * is the purpose of the ExprContext parameter.  It is passed to
- * most expression productions, which check the expressions encountered
- * against the context for correctness.  When a query
- * element like SELECT is encountered, the production calls
- * checkQueryExpression, which will throw an exception if
- * a row expression was expected instead.  When a row expression like
- * IN is encountered, the production calls checkNonQueryExpression
- * instead.  It is very important to understand how this works
- * when modifying the grammar.
- *
- * The commingling of expressions results in some bogus ambiguities which are
- * resolved with LOOKAHEAD hints.  The worst example is comma.  SQL allows both
- * (WHERE x IN (1,2)) and (WHERE x IN (select ...)).  This means when we parse
- * the right-hand-side of an IN, we have to allow any kind of expression inside
- * the parentheses.  Now consider the expression "WHERE x IN(SELECT a FROM b
- * GROUP BY c,d)".  When the parser gets to "c,d" it doesn't know whether the
- * comma indicates the end of the GROUP BY or the end of one item in an IN
- * list.  Luckily, we know that select and comma-list are mutually exclusive
- * within IN, so we use maximal munch for the GROUP BY comma.  However, this
- * usage of hints could easily mask unintended ambiguities resulting from
- * future changes to the grammar, making it very brittle.
- */
-
-JAVACODE SqlParserPos getPos()
-{
-    return new SqlParserPos(
-        token.beginLine,
-        token.beginColumn,
-        token.endLine,
-        token.endColumn);
-}
-
-JAVACODE void checkQueryExpression(ExprContext exprContext)
-{
-    switch (exprContext) {
-    case ACCEPT_NON_QUERY:
-    case ACCEPT_SUB_QUERY:
-    case ACCEPT_CURSOR:
-        throw SqlUtil.newContextException(getPos(),
-            RESOURCE.illegalQueryExpression());
-    }
-}
-
-JAVACODE void checkNonQueryExpression(ExprContext exprContext)
-{
-    switch (exprContext) {
-    case ACCEPT_QUERY:
-        throw SqlUtil.newContextException(getPos(),
-            RESOURCE.illegalNonQueryExpression());
-    }
-}
-
-// The date/time parse utilities have to live here, instead of in the
-// SqlParserUtil class because ParseException is ambiguous, and
-// CommonParser has to live in multiple packages.
-
-JAVACODE SqlDateLiteral parseDateLiteral(String s, SqlParserPos pos) {
-    String dateStr = SqlParserUtil.parseString(s);
-    Calendar cal = DateTimeUtils.parseDateFormat(
-        dateStr, DateTimeUtils.DATE_FORMAT_STRING, DateTimeUtils.GMT_ZONE);
-    if (null == cal) {
-        throw SqlUtil.newContextException(pos,
-            RESOURCE.illegalLiteral("DATE", s,
-                RESOURCE.badFormat(DateTimeUtils.DATE_FORMAT_STRING).str()));
-    }
-    return SqlLiteral.createDate(cal, pos);
-}
-
-JAVACODE SqlTimeLiteral parseTimeLiteral(String s, SqlParserPos pos) {
-    String dateStr = SqlParserUtil.parseString(s);
-    DateTimeUtils.PrecisionTime pt =
-    DateTimeUtils.parsePrecisionDateTimeLiteral(
-        dateStr, DateTimeUtils.TIME_FORMAT_STRING, DateTimeUtils.GMT_ZONE);
-    if (null == pt) {
-        throw SqlUtil.newContextException(pos,
-            RESOURCE.illegalLiteral("TIME", s,
-                RESOURCE.badFormat(DateTimeUtils.TIME_FORMAT_STRING).str()));
-    }
-    return SqlLiteral.createTime(pt.getCalendar(), pt.getPrecision(), pos);
-}
-
-JAVACODE SqlTimestampLiteral parseTimestampLiteral(String s, SqlParserPos pos) {
-    String dateStr = SqlParserUtil.parseString(s);
-    DateTimeUtils.PrecisionTime pt =
-    DateTimeUtils.parsePrecisionDateTimeLiteral(
-        dateStr, DateTimeUtils.TIMESTAMP_FORMAT_STRING, DateTimeUtils.GMT_ZONE);
-    if (null == pt) {
-        throw SqlUtil.newContextException(pos,
-            RESOURCE.illegalLiteral("TIMESTAMP", s,
-                RESOURCE.badFormat(DateTimeUtils.TIMESTAMP_FORMAT_STRING).str()));
-    }
-    return SqlLiteral.createTimestamp(pt.getCalendar(), pt.getPrecision(), pos);
-}
-
-JAVACODE SqlIntervalLiteral parseIntervalLiteral(
-    SqlParserPos pos,
-    int sign,
-    String s,
-    SqlIntervalQualifier intervalQualifier) throws ParseException
-{
-    String intervalStr = SqlParserUtil.parseString(s);
-    if ("".equals(intervalStr)) {
-        throw new ParseException(
-            RESOURCE.illegalIntervalLiteral(s + " "
-                + intervalQualifier.toString(), pos.toString()).str());
-    }
-    return SqlLiteral.createInterval(sign, intervalStr, intervalQualifier, pos);
-}
-
-/**
- * Converts a ParseException (local to this particular instantiation
- * of the parser) into a SqlParseException (common to all parsers).
- */
-JAVACODE SqlParseException convertException(Throwable ex)
-{
-    if (ex instanceof SqlParseException) {
-        return (SqlParseException) ex;
-    }
-    SqlParserPos pos = null;
-    int[][] expectedTokenSequences = null;
-    String[] tokenImage = null;
-    if (ex instanceof ParseException) {
-        ParseException pex = (ParseException) ex;
-        expectedTokenSequences = pex.expectedTokenSequences;
-        tokenImage = pex.tokenImage;
-        if (pex.currentToken != null) {
-            final Token token = pex.currentToken.next;
-            pos = new SqlParserPos(
-                token.beginLine,
-                token.beginColumn,
-                token.endLine,
-                token.endColumn);
-        }
-    } else if (ex instanceof TokenMgrError) {
-        TokenMgrError tme = (TokenMgrError) ex;
-        expectedTokenSequences = null;
-        tokenImage = null;
-        // Example:
-        //    Lexical error at line 3, column 24.  Encountered "#" after "a".
-        final java.util.regex.Pattern pattern = java.util.regex.Pattern.compile(
-            "(?s)Lexical error at line ([0-9]+), column ([0-9]+).*");
-        java.util.regex.Matcher matcher = pattern.matcher(ex.getMessage());
-        if (matcher.matches()) {
-            int line = Integer.parseInt(matcher.group(1));
-            int column = Integer.parseInt(matcher.group(2));
-            pos = new SqlParserPos(line, column, line, column);
-        }
-    } else if (ex instanceof CalciteContextException) {
-        // CalciteContextException is the standard wrapper for exceptions
-        // produced by the validator, but in the parser, the standard is
-        // SqlParseException; so, strip it away. In case you were wondering,
-        // the CalciteContextException appears because the parser
-        // occasionally calls into validator-style code such as
-        // SqlSpecialOperator.reduceExpr.
-        CalciteContextException ece =
-            (CalciteContextException) ex;
-        pos = new SqlParserPos(
-            ece.getPosLine(),
-            ece.getPosColumn(),
-            ece.getEndPosLine(),
-            ece.getEndPosColumn());
-        ex = ece.getCause();
-    }
-
-    return new SqlParseException(
-        ex.getMessage(), pos, expectedTokenSequences, tokenImage, ex);
-}
-
-/**
- * Removes or transforms misleading information from a parse exception.
- *
- * @param e dirty excn
- *
- * @return clean excn
- */
-JAVACODE ParseException cleanupParseException(ParseException ex)
-{
-    if (ex.expectedTokenSequences == null) {
-        return ex;
-    }
-    int iIdentifier = java.util.Arrays.asList(ex.tokenImage).indexOf("<IDENTIFIER>");
-
-    // Find all sequences in the error which contain identifier. For
-    // example,
-    //       {<IDENTIFIER>}
-    //       {A}
-    //       {B, C}
-    //       {D, <IDENTIFIER>}
-    //       {D, A}
-    //       {D, B}
-    //
-    // would yield
-    //       {}
-    //       {D}
-    boolean id = false;
-    final List<int[]> prefixList = new ArrayList<int[]>();
-    for (int i = 0; i < ex.expectedTokenSequences.length; ++i) {
-        int[] seq = ex.expectedTokenSequences[i];
-        int j = seq.length - 1;
-        int i1 = seq[j];
-        if (i1 == iIdentifier) {
-            int[] prefix = new int[j];
-            System.arraycopy(seq, 0, prefix, 0, j);
-            prefixList.add(prefix);
-        }
-    }
-
-    if (prefixList.isEmpty()) {
-        return ex;
-    }
-
-    int[][] prefixes = (int[][])
-        prefixList.toArray(new int[prefixList.size()][]);
-
-    // Since <IDENTIFIER> was one of the possible productions,
-    // we know that the parser will also have included all
-    // of the non-reserved keywords (which are treated as
-    // identifiers in non-keyword contexts).  So, now we need
-    // to clean those out, since they're totally irrelevant.
-
-    final List<int[]> list = new ArrayList<int[]>();
-    Metadata metadata = getMetadata();
-    for (int i = 0; i < ex.expectedTokenSequences.length; ++i) {
-        int [] seq = ex.expectedTokenSequences[i];
-        String tokenImage = ex.tokenImage[seq[seq.length - 1]];
-        String token = SqlParserUtil.getTokenVal(tokenImage);
-        if (token == null  || !metadata.isNonReservedKeyword(token)) {
-            list.add(seq);
-            continue;
-        }
-        boolean match = matchesPrefix(seq, prefixes);
-        if (!match) {
-            list.add(seq);
-        }
-    }
-
-    ex.expectedTokenSequences =
-        (int [][]) list.toArray(new int [list.size()][]);
-    return ex;
-}
-
-JAVACODE boolean matchesPrefix(int[] seq, int[][] prefixes)
-{
-    nextPrefix:
-    for (int[] prefix : prefixes) {
-        if (seq.length == prefix.length + 1) {
-            for (int k = 0; k < prefix.length; k++) {
-                if (prefix[k] != seq[k]) {
-                    continue nextPrefix;
-                }
-            }
-            return true;
-        }
-    }
-    return false;
-}
-
-/*****************************************
- * Syntactical Descriptions              *
- *****************************************/
-
-/**
- * Parses either a row expression or a query expression with an optional
- * ORDER BY.
- *
- * <p>Postgres syntax for limit:
- *
- *    [ LIMIT { count | ALL } ]
- *    [ OFFSET start ]
- *
- * <p>SQL:2008 syntax for limit:
- *
- *    [ OFFSET start { ROW | ROWS } ]
- *    [ FETCH { FIRST | NEXT } [ count ] { ROW | ROWS } ONLY ]
- */
-SqlNode OrderedQueryOrExpr(ExprContext exprContext) :
-{
-    SqlNode e;
-    SqlNodeList orderBy = null;
-    SqlNode start = null;
-    SqlNode count = null;
-    SqlParserPos pos = null;
-}
-{
-    (
-        e = QueryOrExpr(exprContext)
-    )
-    [
-        // use the syntactic type of the expression we just parsed
-        // to decide whether ORDER BY makes sense
-        orderBy = OrderBy(e.isA(SqlKind.QUERY))
-    ]
-    [
-        // Postgres-style syntax. "LIMIT ... OFFSET ..."
-        <LIMIT> ( count = UnsignedNumericLiteral() | <ALL> )
-    ]
-    [
-        // ROW or ROWS is required in SQL:2008 but we make it optional
-        // because it is not present in Postgres-style syntax.
-        <OFFSET> start = UnsignedNumericLiteral() [ <ROW> | <ROWS> ]
-    ]
-    [
-        // SQL:2008-style syntax. "OFFSET ... FETCH ...".
-        // If you specify both LIMIT and FETCH, FETCH wins.
-        <FETCH> ( <FIRST> | <NEXT> ) count = UnsignedNumericLiteral() ( <ROW> | <ROWS> ) <ONLY>
-    ]
-    {
-        if (orderBy != null || start != null || count != null) {
-            pos = getPos();
-            if (orderBy == null) {
-                orderBy = SqlNodeList.EMPTY;
-            }
-            e = new SqlOrderBy(pos, e, orderBy, start, count);
-
-        }
-        return e;
-    }
-}
-
-/**
- * Parses a leaf in a query expression (SELECT, VALUES or TABLE).
- */
-SqlNode LeafQuery(ExprContext exprContext) :
-{
-    SqlNode e;
-}
-{
-    {
-        // ensure a query is legal in this context
-        checkQueryExpression(exprContext);
-    }
-    e = SqlSelect()
-    {
-        return e;
-    }
-    | e = TableConstructor()
-    {
-        return e;
-    }
-    | e = ExplicitTable(getPos())
-    {
-        return e;
-    }
-}
-
-/**
- * Parses a parenthesized query or single row expression.
- */
-SqlNode ParenthesizedExpression(ExprContext exprContext) :
-{
-    SqlNode e;
-}
-{
-    <LPAREN>
-    {
-        // we've now seen left paren, so queries inside should
-        // be allowed as sub-queries
-        switch (exprContext) {
-        case ACCEPT_SUB_QUERY:
-            exprContext = ExprContext.ACCEPT_NONCURSOR;
-            break;
-        case ACCEPT_CURSOR:
-            exprContext = ExprContext.ACCEPT_ALL;
-            break;
-        }
-    }
-    e = OrderedQueryOrExpr(exprContext)
-    <RPAREN>
-    {
-        return e;
-    }
-}
-
-/**
- * Parses a parenthesized query or comma-list of row expressions.
- *
- * <p>REVIEW jvs 8-Feb-2004: There's a small hole in this production.  It can be
- * used to construct something like
- *
- * <code>WHERE x IN (select count(*) from t where c=d,5)</code>,
- *
- * which should be illegal.  The above is interpreted as equivalent to
- *
- * <code>WHERE x IN ((select count(*) from t where c=d),5)</code>,
- *
- * which is a legal use of a sub-query.  The only way to fix the hole is to be
- * able to remember whether a subexpression was parenthesized or not, which
- * means preserving parentheses in the SqlNode tree.  This is probably
- * desirable anyway for use in purely syntactic parsing applications (e.g. SQL
- * pretty-printer).  However, if this is done, it's important to also make
- * isA() on the paren node call down to its operand so that we can
- * always correctly discriminate a query from a row expression.
- */
-SqlNodeList ParenthesizedQueryOrCommaList(
-    ExprContext exprContext) :
-{
-    SqlNode e;
-    List<SqlNode> list;
-    ExprContext firstExprContext = exprContext;
-    SqlParserPos pos;
-}
-{
-    <LPAREN>
-    {
-        // we've now seen left paren, so a query by itself should
-        // be interpreted as a sub-query
-        pos = getPos();
-        switch (exprContext) {
-        case ACCEPT_SUB_QUERY:
-            firstExprContext = ExprContext.ACCEPT_NONCURSOR;
-            break;
-        case ACCEPT_CURSOR:
-            firstExprContext = ExprContext.ACCEPT_ALL;
-            break;
-        }
-    }
-    e = OrderedQueryOrExpr(firstExprContext)
-    {
-        list = startList(e);
-    }
-    (
-        <COMMA>
-        {
-            // a comma-list can't appear where only a query is expected
-            checkNonQueryExpression(exprContext);
-        }
-        e = Expression(exprContext)
-        {
-            list.add(e);
-        }
-    ) *
-    <RPAREN>
-    {
-        return new SqlNodeList(list, pos.plus(getPos()));
-    }
-}
-
-/**
- * Parses function parameter lists including DISTINCT keyword recognition,
- * DEFAULT, and named argument assignment.
- */
-List FunctionParameterList(
-    ExprContext exprContext) :
-{
-    SqlNode e = null;
-    List list = new ArrayList();
-}
-{
-    <LPAREN>
-    [
-        <DISTINCT> {
-            e = SqlSelectKeyword.DISTINCT.symbol(getPos());
-        }
-    |
-        <ALL> {
-            e = SqlSelectKeyword.ALL.symbol(getPos());
-        }
-    ]
-    {
-        list.add(e);
-    }
-    Arg0(list, exprContext)
-    (
-        <COMMA> {
-            // a comma-list can't appear where only a query is expected
-            checkNonQueryExpression(exprContext);
-        }
-        Arg(list, exprContext)
-    )*
-    <RPAREN>
-    {
-        return list;
-    }
-}
-
-void Arg0(List list, ExprContext exprContext) :
-{
-    SqlIdentifier name = null;
-    SqlNode e = null;
-    final ExprContext firstExprContext;
-    {
-        // we've now seen left paren, so queries inside should
-        // be allowed as sub-queries
-        switch (exprContext) {
-        case ACCEPT_SUB_QUERY:
-            firstExprContext = ExprContext.ACCEPT_NONCURSOR;
-            break;
-        case ACCEPT_CURSOR:
-            firstExprContext = ExprContext.ACCEPT_ALL;
-            break;
-        default:
-            firstExprContext = exprContext;
-            break;
-        }
-    }
-}
-{
-    [
-        name = SimpleIdentifier() <NAMED_ARGUMENT_ASSIGNMENT>
-    ]
-    (
-        <DEFAULT_KW> {
-            e = SqlStdOperatorTable.DEFAULT.createCall(getPos());
-        }
-    |
-        e = OrderedQueryOrExpr(firstExprContext)
-    )
-    {
-        if (e != null) {
-            if (name != null) {
-                e = SqlStdOperatorTable.ARGUMENT_ASSIGNMENT.createCall(
-                    name.getParserPosition().plus(e.getParserPosition()),
-                    e, name);
-            }
-            list.add(e);
-        }
-    }
-}
-
-void Arg(List list, ExprContext exprContext) :
-{
-    SqlIdentifier name = null;
-    SqlNode e = null;
-}
-{
-    [
-        name = SimpleIdentifier() <NAMED_ARGUMENT_ASSIGNMENT>
-    ]
-    (
-        <DEFAULT_KW> {
-            e = SqlStdOperatorTable.DEFAULT.createCall(getPos());
-        }
-    |
-        e = Expression(exprContext)
-    )
-    {
-        if (e != null) {
-            if (name != null) {
-                e = SqlStdOperatorTable.ARGUMENT_ASSIGNMENT.createCall(
-                    name.getParserPosition().plus(e.getParserPosition()),
-                    e, name);
-            }
-            list.add(e);
-        }
-    }
-}
-
-/**
- * Parses a query (SELECT, UNION, INTERSECT, EXCEPT, VALUES, TABLE) followed by
- * the end-of-file symbol.
- */
-SqlNode SqlQueryEof() :
-{
-    SqlNode query;
-}
-{
-    query = OrderedQueryOrExpr(ExprContext.ACCEPT_QUERY)
-    <EOF>
-    { return query; }
-}
-
-/**
- * Parses an SQL statement.
- */
-SqlNode SqlStmt() :
-{
-    SqlNode stmt;
-}
-{
-    (
-        stmt = SqlSetOption(null, null)
-        |
-        stmt = SqlAlter()
-        |
-<#if parser.createStatementParserMethods?size != 0>
-        stmt = SqlCreate()
-        |
-</#if>
-        stmt = OrderedQueryOrExpr(ExprContext.ACCEPT_QUERY)
-        |
-        stmt = SqlExplain()
-        |
-        stmt = SqlDescribe()
-        |
-        stmt = SqlInsert()
-        |
-        stmt = SqlDelete()
-        |
-        stmt = SqlUpdate()
-        |
-        stmt = SqlMerge()
-        |
-        stmt = SqlProcedureCall()
-
-      <#-- Add methods to parse additional statements here -->
-      <#list parser.statementParserMethods as method>
-        |
-        stmt = ${method}
-      </#list>
-    )
-    {
-        return stmt;
-    }
-}
-
-/**
- * Parses an SQL statement followed by the end-of-file symbol.
- */
-SqlNode SqlStmtEof() :
-{
-    SqlNode stmt;
-}
-{
-    stmt = SqlStmt() <EOF>
-    {
-        return stmt;
-    }
-}
-
-<#-- Add implementations of additional parser statement calls here -->
-<#list parser.implementationFiles as file>
-    <#include "/@includes/"+file />
-</#list>
-
-/**
- * Parses a leaf SELECT expression without ORDER BY.
- */
-SqlSelect SqlSelect() :
-{
-    final List<SqlLiteral> keywords = Lists.newArrayList();
-    List<SqlNode> selectList;
-    final SqlNode fromClause;
-    final SqlNode where;
-    final SqlNodeList groupBy;
-    final SqlNode having;
-    final SqlNodeList windowDecls;
-    SqlParserPos pos;
-}
-{
-    <SELECT>
-    {
-        pos = getPos();
-    }
-    SqlSelectKeywords(keywords)
-    (
-        <STREAM> {
-            keywords.add(SqlSelectKeyword.STREAM.symbol(getPos()));
-        }
-    )?
-    (
-        <DISTINCT> {
-            keywords.add(SqlSelectKeyword.DISTINCT.symbol(getPos()));
-        }
-    |   <ALL> {
-            keywords.add(SqlSelectKeyword.ALL.symbol(getPos()));
-        }
-    )?
-    selectList = SelectList()
-    (
-        <FROM> fromClause = FromClause()
-        where = WhereOpt()
-        groupBy = GroupByOpt()
-        having = HavingOpt()
-        windowDecls = WindowOpt()
-    |
-        E() {
-            fromClause = null;
-            where = null;
-            groupBy = null;
-            having = null;
-            windowDecls = null;
-        }
-    )
-    {
-        final SqlNode selectItem = (SqlNode)selectList.get(0);
-        final SqlParserPos selectListPos = selectItem.getParserPosition();
-        return new SqlSelect(pos.plus(getPos()),
-            new SqlNodeList(keywords, pos),
-            new SqlNodeList(selectList, selectListPos.plusAll(selectList)),
-            fromClause, where, groupBy, having, windowDecls, null, null, null);
-    }
-}
-
-/*
- * Abstract production:
- *
- *    void SqlSelectKeywords(List keywords)
- *
- * Parses dialect-specific keywords immediately following the SELECT keyword.
- */
-
-/**
- * Parses an EXPLAIN PLAN statement.
- */
-SqlNode SqlExplain() :
-{
-    SqlNode stmt;
-    SqlExplainLevel detailLevel = SqlExplainLevel.EXPPLAN_ATTRIBUTES;
-    SqlExplain.Depth depth;
-    SqlParserPos pos;
-    final SqlExplainFormat format;
-}
-{
-    <EXPLAIN> <PLAN>
-    [ detailLevel = ExplainDetailLevel() ]
-    depth = ExplainDepth()
-    (
-        <AS> <XML> { format = SqlExplainFormat.XML; }
-    |
-        <AS> <JSON> { format = SqlExplainFormat.JSON; }
-    |
-        { format = SqlExplainFormat.TEXT; }
-    )
-    <FOR> stmt = SqlQueryOrDml() {
-        pos = getPos();
-        return new SqlExplain(pos,
-            stmt,
-            detailLevel.symbol(SqlParserPos.ZERO),
-            depth.symbol(SqlParserPos.ZERO),
-            format.symbol(SqlParserPos.ZERO),
-            nDynamicParams);
-    }
-}
-
-/** Parses a query (SELECT or VALUES)
- * or DML statement (INSERT, UPDATE, DELETE, MERGE). */
-SqlNode SqlQueryOrDml() :
-{
-    SqlNode stmt;
-}
-{
-    (
-        stmt = OrderedQueryOrExpr(ExprContext.ACCEPT_QUERY)
-    |
-        stmt = SqlInsert()
-    |
-        stmt = SqlDelete()
-    |
-        stmt = SqlUpdate()
-    |
-        stmt = SqlMerge()
-    ) { return stmt; }
-}
-
-/**
- * Parses WITH TYPE | WITH IMPLEMENTATION | WITHOUT IMPLEMENTATION modifier for
- * EXPLAIN PLAN.
- */
-SqlExplain.Depth ExplainDepth() :
-{
-}
-{
-    (
-        LOOKAHEAD(2)
-        <WITH> <TYPE>
-        {
-            return SqlExplain.Depth.TYPE;
-        }
-        |
-        <WITH> <IMPLEMENTATION>
-        {
-            return SqlExplain.Depth.PHYSICAL;
-        }
-        |
-        <WITHOUT> <IMPLEMENTATION>
-        {
-            return SqlExplain.Depth.LOGICAL;
-        }
-        |
-        {
-            return SqlExplain.Depth.PHYSICAL;
-        }
-
-    )
-}
-
-/**
- * Parses INCLUDING ALL ATTRIBUTES modifier for EXPLAIN PLAN.
- */
-SqlExplainLevel ExplainDetailLevel() :
-{
-    SqlExplainLevel level = SqlExplainLevel.EXPPLAN_ATTRIBUTES;
-}
-{
-    (
-        <EXCLUDING> <ATTRIBUTES>
-        {
-            level = SqlExplainLevel.NO_ATTRIBUTES;
-        }
-        |
-        <INCLUDING>
-        [ <ALL> { level = SqlExplainLevel.ALL_ATTRIBUTES; } ]
-        <ATTRIBUTES>
-        {
-        }
-    )
-    {
-        return level;
-    }
-}
-
-/**
- * Parses a DESCRIBE statement.
- */
-SqlNode SqlDescribe() :
-{
-   final SqlParserPos pos;
-   final SqlIdentifier table;
-   final SqlIdentifier column;
-   final SqlNode stmt;
-}
-{
-    <DESCRIBE> { pos = getPos(); }
-    (
-        (<DATABASE> | <CATALOG> | <SCHEMA>) {
-            // DESCRIBE DATABASE and DESCRIBE CATALOG currently do the same as
-            // DESCRIBE SCHEMA but should be different. See
-            //   [CALCITE-1221] Implement DESCRIBE DATABASE, CATALOG, STATEMENT
-            return new SqlDescribeSchema(pos, CompoundIdentifier());
-        }
-    |
-        // Use syntactic lookahead to determine whether a table name is coming.
-        // We do not allow SimpleIdentifier() because that includes <STATEMENT>.
-        LOOKAHEAD( <TABLE> | <IDENTIFIER> | <QUOTED_IDENTIFIER>
-           | <BACK_QUOTED_IDENTIFIER> | <BRACKET_QUOTED_IDENTIFIER> )
-        (<TABLE>)?
-        table = CompoundIdentifier()
-        (
-            column = SimpleIdentifier()
-        |
-            E() { column = null; }
-        ) {
-            return new SqlDescribeTable(pos, table, column);
-        }
-    |
-        (<STATEMENT>)?
-        stmt = SqlQueryOrDml() {
-            // DESCRIBE STATEMENT currently does the same as EXPLAIN. See
-            //   [CALCITE-1221] Implement DESCRIBE DATABASE, CATALOG, STATEMENT
-            final SqlExplainLevel detailLevel = SqlExplainLevel.EXPPLAN_ATTRIBUTES;
-            final SqlExplain.Depth depth = SqlExplain.Depth.PHYSICAL;
-            final SqlExplainFormat format = SqlExplainFormat.TEXT;
-            return new SqlExplain(pos,
-                stmt,
-                detailLevel.symbol(SqlParserPos.ZERO),
-                depth.symbol(SqlParserPos.ZERO),
-                format.symbol(SqlParserPos.ZERO),
-                nDynamicParams);
-        }
-    )
-}
-
-/**
- * Parses a CALL statement.
- */
-SqlNode SqlProcedureCall() :
-{
-    SqlParserPos callPos;
-    SqlNode routineCall;
-}
-{
-    <CALL>
-    {
-        callPos = getPos();
-    }
-    routineCall = NamedRoutineCall(
-        SqlFunctionCategory.USER_DEFINED_PROCEDURE,
-        ExprContext.ACCEPT_SUB_QUERY)
-    {
-        return SqlStdOperatorTable.PROCEDURE_CALL.createCall(
-            callPos, routineCall);
-    }
-}
-
-SqlNode NamedRoutineCall(
-    SqlFunctionCategory routineType,
-    ExprContext exprContext) :
-{
-    SqlIdentifier name;
-    final List<SqlNode> list = Lists.newArrayList();
-    final SqlParserPos pos;
-}
-{
-    name = CompoundIdentifier() {
-        pos = getPos();
-    }
-    <LPAREN>
-    [
-        Arg0(list, exprContext)
-        (
-            <COMMA> {
-                // a comma-list can't appear where only a query is expected
-                checkNonQueryExpression(exprContext);
-            }
-            Arg(list, exprContext)
-        )*
-    ]
-    <RPAREN>
-    {
-        SqlNode function = createCall(
-            name, pos.plus(getPos()), routineType, null, SqlParserUtil.toNodeArray(list));
-        return function;
-    }
-}
-
-/**
- * Parses an INSERT statement.
- */
-SqlNode SqlInsert() :
-{
-    final List<SqlLiteral> keywords = Lists.newArrayList();
-    SqlNode table;
-    SqlNodeList extendList = null;
-    SqlNode source;
-    SqlNodeList columnList = null;
-    SqlParserPos pos;
-}
-{
-    (
-        <INSERT>
-    |
-        <UPSERT> { keywords.add(SqlInsertKeyword.UPSERT.symbol(getPos())); }
-    )
-    SqlInsertKeywords(keywords)
-    <INTO> table = CompoundIdentifier()
-    [
-        LOOKAHEAD(3)
-        [ <EXTEND> ]
-        extendList = ExtendList() {
-            table = extend(table, extendList);
-        }
-    ]
-    {
-        pos = getPos();
-    }
-    [
-        LOOKAHEAD(2)
-        columnList = ParenthesizedCompoundIdentifierList()
-    ]
-    source = OrderedQueryOrExpr(ExprContext.ACCEPT_QUERY)
-    {
-        return new SqlInsert(pos, new SqlNodeList(keywords, pos), table, source,
-            columnList);
-    }
-}
-
-/*
- * Abstract production:
- *
- *    void SqlInsertKeywords(List keywords)
- *
- * Parses dialect-specific keywords immediately following the INSERT keyword.
- */
-
-/**
- * Parses a DELETE statement.
- */
-SqlNode SqlDelete() :
-{
-    SqlNode table;
-    SqlNodeList extendList = null;
-    SqlIdentifier alias = null;
-    SqlNode condition;
-    SqlParserPos pos;
-}
-{
-    <DELETE>
-    {
-        pos = getPos();
-    }
-    <FROM> table = CompoundIdentifier()
-    {
-
-    }
-    [
-        [ <EXTEND> ]
-        extendList = ExtendList() {
-            table = extend(table, extendList);
-        }
-    ]
-    [ [ <AS> ] alias = SimpleIdentifier() ]
-    condition = WhereOpt()
-    {
-        return new SqlDelete(pos, table, condition, null, alias);
-    }
-}
-
-/**
- * Parses an UPDATE statement.
- */
-SqlNode SqlUpdate() :
-{
-    SqlNode table;
-    SqlNodeList extendList = null;
-    SqlIdentifier alias = null;
-    SqlNode condition;
-    SqlNodeList sourceExpressionList;
-    SqlNodeList targetColumnList;
-    SqlIdentifier id;
-    SqlNode exp;
-    SqlParserPos pos;
-}
-{
-    <UPDATE> table = CompoundIdentifier()
-    {
-        pos = getPos();
-        targetColumnList = new SqlNodeList(pos);
-        sourceExpressionList = new SqlNodeList(pos);
-    }
-    [
-        [ <EXTEND> ]
-        extendList = ExtendList() {
-            table = extend(table, extendList);
-        }
-    ]
-    [ [ <AS> ] alias = SimpleIdentifier() ]
-    <SET> id = SimpleIdentifier()
-    {
-        targetColumnList.add(id);
-    }
-    <EQ> exp = Expression(ExprContext.ACCEPT_SUB_QUERY)
-    {
-        // TODO:  support DEFAULT also
-        sourceExpressionList.add(exp);
-    }
-    (
-        <COMMA>
-        id = SimpleIdentifier()
-        {
-            targetColumnList.add(id);
-        }
-        <EQ> exp = Expression(ExprContext.ACCEPT_SUB_QUERY)
-        {
-            sourceExpressionList.add(exp);
-        }
-    ) *
-    condition = WhereOpt()
-    {
-        return new SqlUpdate(pos, table, targetColumnList, sourceExpressionList,
-            condition, null, alias);
-    }
-}
-
-/**
- * Parses a MERGE statement.
- */
-SqlNode SqlMerge() :
-{
-    SqlNode table;
-    SqlNodeList extendList = null;
-    SqlIdentifier alias = null;
-    SqlNode sourceTableRef;
-    SqlNode condition;
-    SqlUpdate updateCall = null;
-    SqlInsert insertCall = null;
-    SqlParserPos mergePos;
-}
-{
-    <MERGE> <INTO> table = CompoundIdentifier()
-    {
-        mergePos = getPos();
-    }
-    [
-        [ <EXTEND> ]
-        extendList = ExtendList() {
-            table = extend(table, extendList);
-        }
-    ]
-    [ [ <AS> ] alias = SimpleIdentifier() ]
-
-    <USING> sourceTableRef = TableRef()
-
-    <ON> condition = Expression(ExprContext.ACCEPT_SUB_QUERY)
-
-    (
-    LOOKAHEAD(2)
-    updateCall = WhenMatchedClause(table, alias)
-    [ insertCall = WhenNotMatchedClause(table) ]
-    |
-    insertCall = WhenNotMatchedClause(table)
-    )
-    {
-        return new SqlMerge(mergePos, table, condition, sourceTableRef,
-            updateCall, insertCall, null, alias);
-    }
-}
-
-SqlUpdate WhenMatchedClause(SqlNode table, SqlIdentifier alias) :
-{
-    SqlIdentifier id;
-    SqlParserPos pos;
-    SqlNodeList updateColumnList;
-    SqlNode exp;
-    SqlNodeList updateExprList;
-}
-{
-    <WHEN> <MATCHED> <THEN>
-    <UPDATE> <SET> id = SimpleIdentifier()
-    {
-        pos = getPos();
-        updateColumnList = new SqlNodeList(pos);
-        updateExprList = new SqlNodeList(pos);
-        updateColumnList.add(id);
-    }
-    <EQ> exp = Expression(ExprContext.ACCEPT_SUB_QUERY)
-    {
-        updateExprList.add(exp);
-    }
-    (
-        <COMMA>
-        id = SimpleIdentifier()
-        {
-            updateColumnList.add(id);
-        }
-        <EQ> exp = Expression(ExprContext.ACCEPT_SUB_QUERY)
-        {
-            updateExprList.add(exp);
-        }
-    ) *
-    {
-        return new SqlUpdate(pos, table, updateColumnList, updateExprList, null,
-            null, alias);
-    }
-}
-
-SqlInsert WhenNotMatchedClause(SqlNode table) :
-{
-    SqlParserPos pos, insertPos;
-    List<SqlLiteral> keywords = Lists.newArrayList();
-    SqlNodeList insertColumnList = null;
-    SqlNode rowConstructor;
-    SqlNode insertValues;
-}
-{
-    <WHEN> <NOT> <MATCHED> <THEN>
-    <INSERT>
-    {
-        insertPos = getPos();
-    }
-    SqlInsertKeywords(keywords)
-    [
-        LOOKAHEAD(2)
-        insertColumnList = ParenthesizedSimpleIdentifierList()
-    ]
-    [ <LPAREN> ]
-    <VALUES> { pos = getPos(); }
-    rowConstructor = RowConstructor()
-    [ <RPAREN> ]
-    {
-        // TODO zfong 5/26/06: note that extra parentheses are accepted above
-        // around the VALUES clause as a hack for unparse, but this is
-        // actually invalid SQL; should fix unparse
-        insertValues = SqlStdOperatorTable.VALUES.createCall(
-            pos.plus(rowConstructor.getParserPosition()),
-            rowConstructor);
-        return new SqlInsert(insertPos, new SqlNodeList(keywords, insertPos),
-            table, insertValues, insertColumnList);
-    }
-}
-
-/**
- * Parses the select list of a SELECT statement.
- */
-List<SqlNode> SelectList() :
-{
-    List<SqlNode> list = new ArrayList<SqlNode>();
-    SqlNode item;
-}
-{
-    item = SelectItem() {list.add(item);}
-    ( <COMMA> item = SelectItem() {list.add(item);} ) *
-    {
-        return list;
-    }
-}
-
-/**
- * Parses one item in a select list.
- */
-SqlNode SelectItem() :
-{
-    SqlNode e;
-    SqlIdentifier id;
-    SqlParserPos pos;
-}
-{
-    e = SelectExpression()
-    [
-        [ <AS> ]
-        id = SimpleIdentifier()
-        {
-            pos = e.getParserPosition().plus(getPos());
-            e = SqlStdOperatorTable.AS.createCall(pos, e, id);
-        }
-    ]
-    {
-        return e;
-    }
-}
-
-/**
- * Parses one unaliased expression in a select list.
- */
-SqlNode SelectExpression() :
-{
-    SqlNode e;
-}
-{
-    <STAR>
-    {
-        return SqlIdentifier.star(getPos());
-    }
-    |
-    e = Expression(ExprContext.ACCEPT_SUB_QUERY)
-    {
-        return e;
-    }
-}
-
-SqlLiteral Natural() :
-{
-}
-{
-    (
-        <NATURAL> { return SqlLiteral.createBoolean(true, getPos()); }
-    |
-        { return SqlLiteral.createBoolean(false, getPos()); }
-    )
-}
-
-SqlLiteral JoinType() :
-{
-    JoinType joinType;
-}
-{
-    (
-        <JOIN> { joinType = JoinType.INNER; }
-    |
-        <INNER> <JOIN> { joinType = JoinType.INNER; }
-    |
-        <LEFT> [ <OUTER> ] <JOIN> { joinType = JoinType.LEFT; }
-    |
-        <RIGHT> [ <OUTER> ] <JOIN> { joinType = JoinType.RIGHT; }
-    |
-        <FULL> [ <OUTER> ] <JOIN> { joinType = JoinType.FULL; }
-    |
-        <CROSS> <JOIN> { joinType = JoinType.CROSS; }
-    )
-    {
-        return joinType.symbol(getPos());
-    }
-}
-
-/** Matches "LEFT JOIN t ON ...", "RIGHT JOIN t USING ...", "JOIN t". */
-SqlNode JoinTable(SqlNode e) :
-{
-    SqlNode e2, condition;
-    SqlLiteral natural, joinType;
-    SqlNodeList list;
-    SqlParserPos pos;
-}
-{
-    natural = Natural()
-    joinType = JoinType()
-    e2 = TableRef()
-    (
-        <ON> { pos = getPos(); }
-        condition = Expression(ExprContext.ACCEPT_SUB_QUERY) {
-            SqlParserPos onPos = pos.plus(getPos());
-            return new SqlJoin(joinType.getParserPosition(),
-                e,
-                natural,
-                joinType,
-                e2,
-                JoinConditionType.ON.symbol(onPos),
-                condition);
-        }
-    |
-        <USING> { pos = getPos(); }
-        list = ParenthesizedSimpleIdentifierList() {
-            SqlParserPos usingPos = pos.plus(getPos());
-            return new SqlJoin(joinType.getParserPosition(),
-                e,
-                natural,
-                joinType,
-                e2,
-                JoinConditionType.USING.symbol(usingPos),
-                new SqlNodeList(list.getList(), usingPos));
-        }
-    |
-        {
-            return new SqlJoin(joinType.getParserPosition(),
-                e,
-                natural,
-                joinType,
-                e2,
-                JoinConditionType.NONE.symbol(joinType.getParserPosition()),
-                null);
-        }
-    )
-}
-
-// TODO jvs 15-Nov-2003:  SQL standard allows parentheses in the FROM list for
-// building up non-linear join trees (e.g. OUTER JOIN two tables, and then INNER
-// JOIN the result).  Also note that aliases on parenthesized FROM expressions
-// "hide" all table names inside the parentheses (without aliases, they're
-// visible).
-//
-// We allow CROSS JOIN to have a join condition, even though that is not valid
-// SQL; the validator will catch it.
-/**
- * Parses the FROM clause for a SELECT.
- *
- * <p>FROM is mandatory in standard SQL, optional in dialects such as MySQL,
- * PostgreSQL. The parser allows SELECT without FROM, but the validator fails
- * if conformance is, say, STRICT_2003.
- */
-SqlNode FromClause() :
-{
-    SqlNode e, e2, condition;
-    SqlLiteral natural, joinType;
-    SqlNodeList list;
-    SqlParserPos pos;
-}
-{
-    e = TableRef()
-    (
-        // Decide whether to read a JOIN clause or a comma, or to quit having
-        // seen a single entry FROM clause like 'FROM emps'. See comments
-        // elsewhere regarding <COMMA> lookahead.
-        LOOKAHEAD(2)
-        natural = Natural()
-        joinType = JoinType()
-        e2 = TableRef()
-        (
-            <ON> { pos = getPos(); }
-            condition = Expression(ExprContext.ACCEPT_SUB_QUERY) {
-                SqlParserPos onPos = pos.plus(getPos());
-                e = new SqlJoin(joinType.getParserPosition(),
-                    e,
-                    natural,
-                    joinType,
-                    e2,
-                    JoinConditionType.ON.symbol(onPos),
-                    condition);
-            }
-            |
-            <USING> { pos = getPos(); }
-            list = ParenthesizedSimpleIdentifierList() {
-                SqlParserPos usingPos = pos.plus(getPos());
-                e = new SqlJoin(joinType.getParserPosition(),
-                    e,
-                    natural,
-                    joinType,
-                    e2,
-                    JoinConditionType.USING.symbol(usingPos),
-                    new SqlNodeList(list.getList(), usingPos));
-            }
-            |
-            {
-                e = new SqlJoin(joinType.getParserPosition(),
-                    e,
-                    natural,
-                    joinType,
-                    e2,
-                    JoinConditionType.NONE.symbol(joinType.getParserPosition()),
-                    null);
-            }
-        )
-        |
-        // NOTE jvs 6-Feb-2004:  See comments at top of file for why
-        // hint is necessary here.  I had to use this special semantic
-        // lookahead form to get JavaCC to shut up, which makes
-        // me even more uneasy.
-        //LOOKAHEAD({true})
-        <COMMA> { pos = getPos(); }
-        e2 = TableRef() {
-            e = new SqlJoin(pos,
-                e,
-                SqlLiteral.createBoolean(false, pos),
-                JoinType.COMMA.symbol(SqlParserPos.ZERO),
-                e2,
-                JoinConditionType.NONE.symbol(SqlParserPos.ZERO),
-                null);
-        }
-        |
-        <CROSS> { pos = getPos(); } <APPLY>
-        e2 = TableRef2(true) {
-            if (!this.conformance.isApplyAllowed()) {
-                throw new ParseException(RESOURCE.applyNotAllowed().str());
-            }
-            e = new SqlJoin(pos,
-                e,
-                SqlLiteral.createBoolean(false, pos),
-                JoinType.CROSS.symbol(SqlParserPos.ZERO),
-                e2,
-                JoinConditionType.NONE.symbol(SqlParserPos.ZERO),
-                null);
-        }
-        |
-        <OUTER> { pos = getPos(); } <APPLY>
-        e2 = TableRef2(true) {
-            if (!this.conformance.isApplyAllowed()) {
-                throw new ParseException(RESOURCE.applyNotAllowed().str());
-            }
-            e = new SqlJoin(pos,
-                e,
-                SqlLiteral.createBoolean(false, pos),
-                JoinType.LEFT.symbol(SqlParserPos.ZERO),
-                e2,
-                JoinConditionType.ON.symbol(SqlParserPos.ZERO),
-                SqlLiteral.createBoolean(true, pos));
-        }
-    ) *
-    {
-        return e;
-    }
-}
-
-// TODO jvs 15-Nov-2003: SQL standard allows column aliases on table
-// references, e.g. DEPTS AS D1(DEPTNO1,DNAME1); I guess this is syntactic
-// sugar to make it easier for query writers to conform to the column name
-// uniqueness rules without requiring them to write a nested SELECT, but it
-// seems pretty useless for non-trivial tables, since you have to supply names
-// for ALL columns at once.
-/**
- * Parses a table reference in a FROM clause, not lateral unless LATERAL
- * is explicitly specified.
- */
-SqlNode TableRef() :
-{
-    final SqlNode e;
-}
-{
-    e = TableRef2(false) { return e; }
-}
-
-/**
- * Parses a table reference in a FROM clause.
- */
-SqlNode TableRef2(boolean lateral) :
-{
-    SqlNode tableRef;
-    SqlNode over;
-    SqlNodeList extendList = null;
-    String alias;
-    SqlParserPos pos;
-    SqlNodeList args;
-    SqlNode sample;
-    boolean isBernoulli;
-    SqlNumericLiteral samplePercentage;
-    boolean isRepeatable = false;
-    int repeatableSeed = 0;
-    SqlNodeList columnAliasList = null;
-    SqlUnnestOperator unnestOp = SqlStdOperatorTable.UNNEST;
-}
-{
-    (
-        LOOKAHEAD(2)
-        tableRef = CompoundIdentifier()
-        [
-            [ <EXTEND> ]
-            extendList = ExtendList() {
-                tableRef = extend(tableRef, extendList);
-            }
-        ]
-        over = TableOverOpt()
-        {
-            if (over != null) {
-                pos = getPos();
-                tableRef = SqlStdOperatorTable.OVER.createCall(
-                    pos, tableRef, over);
-            }
-        }
-        [
-            over = MatchRecognizeOpt(tableRef)
-            {
-                if (over != null) {
-                    tableRef = over;
-                }
-            }
-        ]
-    |
-        [ <LATERAL> { lateral = true; } ]
-        tableRef = ParenthesizedExpression(ExprContext.ACCEPT_QUERY)
-        over = TableOverOpt()
-        {
-            if (over != null) {
-                pos = getPos();
-                tableRef = SqlStdOperatorTable.OVER.createCall(
-                    pos, tableRef, over);
-            }
-            if (lateral) {
-                tableRef = SqlStdOperatorTable.LATERAL.createCall(
-                    getPos(), tableRef);
-            }
-        }
-        (
-            [ over = MatchRecognizeOpt(tableRef) ]
-            {
-                if (over != null) {
-                    tableRef = over;
-                }
-            }
-        )
-    |
-        <UNNEST> { pos = getPos(); }
-        args = ParenthesizedQueryOrCommaList(ExprContext.ACCEPT_SUB_QUERY)
-        [
-            <WITH> <ORDINALITY> {
-                unnestOp = SqlStdOperatorTable.UNNEST_WITH_ORDINALITY;
-            }
-        ]
-        {
-            tableRef = unnestOp.createCall(pos.plus(getPos()), args.toArray());
-        }
-    |
-        [ <LATERAL> { lateral = true; } ]
-        <TABLE> { pos = getPos(); } <LPAREN>
-        tableRef = TableFunctionCall(pos)
-        <RPAREN>
-        {
-            if (lateral) {
-                tableRef = SqlStdOperatorTable.LATERAL.createCall(
-                    getPos(), tableRef);
-            }
-        }
-    |
-        tableRef = ExtendedTableRef()
-    )
-    [
-        [ <AS> ] alias = Identifier()
-        [ columnAliasList = ParenthesizedSimpleIdentifierList() ]
-        {
-            pos = getPos();
-            if (columnAliasList == null) {
-                tableRef = SqlStdOperatorTable.AS.createCall(
-                    pos, tableRef, new SqlIdentifier(alias, pos));
-            } else {
-                List<SqlNode> idList = new ArrayList<SqlNode>();
-                idList.add(tableRef);
-                idList.add(new SqlIdentifier(alias, pos));
-                idList.addAll(columnAliasList.getList());
-                tableRef = SqlStdOperatorTable.AS.createCall(pos, idList);
-            }
-        }
-    ]
-    [
-        <TABLESAMPLE> { pos = getPos(); }
-        (
-            <SUBSTITUTE> <LPAREN> sample = StringLiteral() <RPAREN>
-            {
-                String sampleName =
-                    ((NlsString) SqlLiteral.value(sample)).getValue();
-                SqlSampleSpec sampleSpec = SqlSampleSpec.createNamed(sampleName);
-                SqlLiteral sampleLiteral = SqlLiteral.createSample(sampleSpec, pos);
-                tableRef = SqlStdOperatorTable.TABLESAMPLE.createCall(
-                    pos.plus(getPos()), tableRef, sampleLiteral);
-             }
-        |
-            (
-                <BERNOULLI>
-                {
-                    isBernoulli = true;
-                }
-            |
-                <SYSTEM>
-                {
-                    isBernoulli = false;
-                }
-            )
-            <LPAREN> samplePercentage = UnsignedNumericLiteral() <RPAREN>
-            [
-                <REPEATABLE> <LPAREN> repeatableSeed = IntLiteral() <RPAREN>
-                {
-                    isRepeatable = true;
-                }
-            ]
-            {
-                final BigDecimal ONE_HUNDRED = BigDecimal.valueOf(100L);
-                BigDecimal rate = samplePercentage.bigDecimalValue();
-                if (rate.compareTo(BigDecimal.ZERO) < 0
-                    || rate.compareTo(ONE_HUNDRED) > 0)
-                {
-                    throw new ParseException(RESOURCE.invalidSampleSize().str());
-                }
-
-                // Treat TABLESAMPLE(0) and TABLESAMPLE(100) as no table
-                // sampling at all.  Not strictly correct: TABLESAMPLE(0)
-                // should produce no output, but it simplifies implementation
-                // to know that some amount of sampling will occur.
-                // In practice values less than ~1E-43% are treated as 0.0 and
-                // values greater than ~99.999997% are treated as 1.0
-                float fRate = rate.divide(ONE_HUNDRED).floatValue();
-                if (fRate > 0.0f && fRate < 1.0f) {
-                    SqlSampleSpec tableSampleSpec =
-                    isRepeatable
-                        ? SqlSampleSpec.createTableSample(
-                            isBernoulli, fRate, repeatableSeed)
-                        : SqlSampleSpec.createTableSample(isBernoulli, fRate);
-
-                    SqlLiteral tableSampleLiteral =
-                        SqlLiteral.createSample(tableSampleSpec, pos);
-                    tableRef = SqlStdOperatorTable.TABLESAMPLE.createCall(
-                        pos.plus(getPos()), tableRef, tableSampleLiteral);
-                }
-            }
-        )
-    ]
-    {
-        return tableRef;
-    }
-}
-
-SqlNodeList ExtendList() :
-{
-    SqlParserPos pos;
-    List<SqlNode> list = Lists.newArrayList();
-}
-{
-    <LPAREN> { pos = getPos(); }
-    ColumnType(list)
-    (
-        <COMMA> ColumnType(list)
-    )*
-    <RPAREN> {
-        return new SqlNodeList(list, pos.plus(getPos()));
-    }
-}
-
-void ColumnType(List<SqlNode> list) :
-{
-    SqlIdentifier name;
-    SqlDataTypeSpec type;
-    boolean nullable = true;
-}
-{
-    name = SimpleIdentifier()
-    type = DataType()
-    [
-        <NOT> <NULL> {
-            nullable = false;
-        }
-    ]
-    {
-        list.add(name);
-        list.add(type.withNullable(nullable));
-    }
-}
-
-SqlNode TableFunctionCall(SqlParserPos pos) :
-{
-    SqlNode call;
-    SqlFunctionCategory funcType = SqlFunctionCategory.USER_DEFINED_TABLE_FUNCTION;
-}
-{
-    [
-        <SPECIFIC>
-        {
-            funcType = SqlFunctionCategory.USER_DEFINED_TABLE_SPECIFIC_FUNCTION;
-        }
-    ]
-    {
-    }
-    call = NamedRoutineCall(funcType, ExprContext.ACCEPT_CURSOR)
-    {
-        return SqlStdOperatorTable.COLLECTION_TABLE.createCall(pos, call);
-    }
-}
-
-/**
- * Abstract production:
- *    SqlNode ExtendedTableRef()
- *
- * Allows parser to be extended with new types of table references.  The
- * default implementation of this production is empty.
- */
-
-/*
- * Abstract production:
- *
- *    SqlNode TableOverOpt()
- *
- * Allows an OVER clause following a table expression as an extension to
- * standard SQL syntax. The default implementation of this production is empty.
- */
-
-/**
- * Parses an explicit TABLE t reference.
- */
-SqlNode ExplicitTable(SqlParserPos pos) :
-{
-    SqlNode tableRef;
-}
-{
-    <TABLE> tableRef = CompoundIdentifier()
-    {
-        return SqlStdOperatorTable.EXPLICIT_TABLE.createCall(pos, tableRef);
-    }
-}
-
-/**
- * Parses a VALUES leaf query expression.
- */
-SqlNode TableConstructor() :
-{
-    SqlNodeList rowConstructorList;
-    SqlParserPos pos;
-}
-{
-    <VALUES>
-    {
-        pos = getPos();
-    }
-    rowConstructorList = RowConstructorList(pos)
-    {
-        return SqlStdOperatorTable.VALUES.createCall(
-            pos.plus(getPos()), rowConstructorList.toArray());
-    }
-}
-
-/**
- * Parses one or more rows in a VALUES expression.
- */
-SqlNodeList RowConstructorList(SqlParserPos pos) :
-{
-    List<SqlNode> list = new ArrayList<SqlNode>();
-    SqlNode rowConstructor;
-}
-{
-    rowConstructor = RowConstructor() { list.add(rowConstructor); }
-    (
-        LOOKAHEAD(2)
-        <COMMA> rowConstructor = RowConstructor() { list.add(rowConstructor); }
-    ) *
-    {
-        return new SqlNodeList(list, pos.plus(getPos()));
-    }
-}
-
-/**
- * Parses a row constructor in the context of a VALUES expression.
- */
-SqlNode RowConstructor() :
-{
-    SqlNodeList valueList;
-    SqlNode value;
-    SqlParserPos pos;
-}
-{
-    // hints are necessary here due to common LPAREN prefixes
-    (
-        // TODO jvs 8-Feb-2004: extra parentheses are accepted here as a hack
-        // for unparse, but this is actually invalid SQL; should
-        // fix unparse
-        LOOKAHEAD(3)
-        <LPAREN> { pos = getPos(); }
-        <ROW>
-        valueList = ParenthesizedQueryOrCommaList(ExprContext.ACCEPT_NONCURSOR)
-        <RPAREN> { pos = pos.plus(getPos()); }
-        |
-        LOOKAHEAD(3)
-        { pos = getPos(); }
-        [
-            <ROW>
-        ]
-        valueList = ParenthesizedQueryOrCommaList(ExprContext.ACCEPT_NONCURSOR)
-        { pos = pos.plus(getPos()); }
-        |
-        value = Expression(ExprContext.ACCEPT_NONCURSOR)
-        {
-            // NOTE: A bare value here is standard SQL syntax, believe it or
-            // not.  Taken together with multi-row table constructors, it leads
-            // to very easy mistakes if you forget the parentheses on a
-            // single-row constructor.  This is also the reason for the
-            // LOOKAHEAD in RowConstructorList().  It would be so much more
-            // reasonable to require parentheses.  Sigh.
-            pos = value.getParserPosition();
-            valueList = new SqlNodeList(Collections.singletonList(value), pos);
-        }
-    )
-    {
-        // REVIEW jvs 8-Feb-2004: Should we discriminate between scalar
-        // sub-queries inside of ROW and row sub-queries?  The standard does,
-        // but the distinction seems to be purely syntactic.
-        return SqlStdOperatorTable.ROW.createCall(pos, valueList.toArray());
-    }
-}
-
-/**
- * Parses the optional WHERE clause for SELECT, DELETE, and UPDATE.
- */
-SqlNode WhereOpt() :
-{
-    SqlNode condition;
-}
-{
-    <WHERE> condition = Expression(ExprContext.ACCEPT_SUB_QUERY)
-    {
-        return condition;
-    }
-    |
-    {
-        return null;
-    }
-}
-
-/**
- * Parses the optional GROUP BY clause for SELECT.
- */
-SqlNodeList GroupByOpt() :
-{
-    List<SqlNode> list = Lists.newArrayList();
-    SqlNode e;
-    SqlParserPos pos;
-}
-{
-    <GROUP> { pos = getPos(); }
-    <BY> list = GroupingElementList() {
-        return new SqlNodeList(list, pos.plusAll(list));
-    }
-|
-    {
-        return null;
-    }
-}
-
-List<SqlNode> GroupingElementList() :
-{
-    List<SqlNode> list = Lists.newArrayList();
-    SqlNode e;
-}
-{
-    e = GroupingElement() { list.add(e); }
-    (
-        <COMMA>
-        e = GroupingElement() { list.add(e); }
-    )*
-    { return list; }
-}
-
-SqlNode GroupingElement() :
-{
-    List<SqlNode> list;
-    SqlNodeList nlist;
-    SqlNode e;
-    SqlParserPos pos;
-}
-{
-    <GROUPING> { pos = getPos(); }
-    <SETS> <LPAREN> list = GroupingElementList() <RPAREN> {
-        return SqlStdOperatorTable.GROUPING_SETS.createCall(pos, list);
-    }
-|   <ROLLUP> { pos = getPos(); }
-    <LPAREN> nlist = ExpressionCommaList(pos, ExprContext.ACCEPT_SUB_QUERY)
-    <RPAREN> {
-        return SqlStdOperatorTable.ROLLUP.createCall(nlist);
-    }
-|   <CUBE> { pos = getPos(); }
-    <LPAREN> nlist = ExpressionCommaList(pos, ExprContext.ACCEPT_SUB_QUERY)
-    <RPAREN> {
-        return SqlStdOperatorTable.CUBE.createCall(nlist);
-    }
-|   LOOKAHEAD(3)
-    <LPAREN> <RPAREN> {
-        return new SqlNodeList(getPos());
-    }
-|   e = Expression(ExprContext.ACCEPT_SUB_QUERY) {
-        return e;
-    }
-}
-
-/**
- * Parses a list of expressions separated by commas.
- */
-SqlNodeList ExpressionCommaList(
-    SqlParserPos pos,
-    ExprContext exprContext) :
-{
-    List<SqlNode> list;
-    SqlNode e;
-}
-{
-    e = Expression(exprContext)
-    {
-        if (pos == null) {
-            pos = getPos();
-        }
-        pos = pos.plus(getPos());
-        list = startList(e);
-    }
-    (
-        // NOTE jvs 6-Feb-2004:  See comments at top of file for why
-        // hint is necessary here.
-        LOOKAHEAD(2)
-        <COMMA> e = Expression(ExprContext.ACCEPT_SUB_QUERY)
-        {
-            list.add(e);
-            pos = pos.plus(getPos());
-        }
-    ) *
-    {
-        return new SqlNodeList(list, pos);
-    }
-}
-
-/**
- * Parses the optional HAVING clause for SELECT.
- */
-SqlNode HavingOpt() :
-{
-    SqlNode e;
-}
-{
-    <HAVING> e = Expression(ExprContext.ACCEPT_SUB_QUERY)
-    {
-        return e;
-    }
-    |
-    {
-        return null;
-    }
-}
-
-/**
- * Parses the optional WINDOW clause for SELECT
- */
-SqlNodeList WindowOpt() :
-{
-    SqlIdentifier id;
-    SqlWindow e;
-    List<SqlNode> list;
-    SqlParserPos pos;
-}
-{
-    <WINDOW> id = SimpleIdentifier() <AS> e = WindowSpecification()
-    {
-        pos = getPos();
-        e.setDeclName(id);
-        list = startList(e);
-    }
-    (
-        // NOTE jhyde 22-Oct-2004:  See comments at top of file for why
-        // hint is necessary here.
-        LOOKAHEAD(2)
-        <COMMA> id = SimpleIdentifier() <AS> e = WindowSpecification()
-        {
-            e.setDeclName(id);
-            list.add(e);
-        }
-    ) *
-    {
-        return new SqlNodeList(list, pos);
-    }
-    |
-    {
-        return null;
-    }
-}
-
-/**
- * Parses a window specification.
- */
-SqlWindow WindowSpecification() :
-{
-    SqlIdentifier id;
-    List list;
-    SqlNodeList partitionList;
-    SqlNodeList orderList;
-    SqlLiteral isRows = SqlLiteral.createBoolean(false, SqlParserPos.ZERO);
-    SqlNode lowerBound = null, upperBound = null;
-    SqlParserPos startPos;
-    SqlParserPos endPos;
-    SqlParserPos pos;
-    SqlLiteral allowPartial = null;
-}
-{
-    <LPAREN> { startPos = pos = getPos(); }
-    (
-        id = SimpleIdentifier()
-        |
-        { id = null; }
-    )
-    (
-        <PARTITION>
-        { pos = getPos(); }
-        <BY>
-        partitionList = ExpressionCommaList(pos, ExprContext.ACCEPT_NON_QUERY)
-        |
-        { partitionList = SqlNodeList.EMPTY; }
-    )
-    (
-        orderList = OrderBy(true)
-        |
-        { orderList = SqlNodeList.EMPTY; }
-    )
-    [
-        (
-            <ROWS> { isRows = SqlLiteral.createBoolean(true, getPos()); }
-            |
-            <RANGE> { isRows = SqlLiteral.createBoolean(false, getPos()); }
-        )
-        (
-            <BETWEEN> lowerBound = WindowRange()
-            <AND> upperBound = WindowRange()
-            |
-            lowerBound = WindowRange()
-        )
-    ]
-    [
-        <ALLOW> { pos = getPos(); } <PARTIAL> {
-            allowPartial = SqlLiteral.createBoolean(true, pos.plus(getPos()));
-        }
-    |
-        <DISALLOW> { pos = getPos(); } <PARTIAL> {
-            allowPartial = SqlLiteral.createBoolean(false, pos.plus(getPos()));
-        }
-    ]
-    <RPAREN>
-    {
-        endPos = getPos();
-        return SqlWindow.create(
-            null, id, partitionList, orderList,
-            isRows, lowerBound, upperBound, allowPartial,
-            startPos.plus(endPos));
-    }
-}
-
-SqlNode WindowRange() :
-{
-    SqlNode e;
-    SqlParserPos pos = null;
-    SqlParserPos endPos;
-}
-{
-    <CURRENT> {pos = getPos();} <ROW>
-    {
-        endPos = getPos();
-        return SqlWindow.createCurrentRow(pos.plus(endPos));
-    }
-    |
-    <UNBOUNDED>
-        { pos = getPos();}
-    (
-        <PRECEDING>
-        {
-            endPos = getPos();
-            return SqlWindow.createUnboundedPreceding(pos.plus(endPos));
-        }
-        |
-        <FOLLOWING>
-        {
-            endPos = getPos();
-            return SqlWindow.createUnboundedFollowing(pos.plus(endPos));
-        }
-    )
-    |
-    e = Expression(ExprContext.ACCEPT_NON_QUERY)
-    (
-        <PRECEDING>
-        {
-            return SqlWindow.createPreceding(
-                e, getPos());
-        }
-        |
-        <FOLLOWING>
-        {
-            return SqlWindow.createFollowing(
-                e, getPos());
-        }
-    )
-}
-
-/**
- * Parses an ORDER BY clause.
- */
-SqlNodeList OrderBy(boolean accept) :
-{
-    List<SqlNode> list;
-    SqlNode e;
-    SqlParserPos pos;
-}
-{
-    <ORDER> {
-        pos = getPos();
-        if (!accept) {
-            // Someone told us ORDER BY wasn't allowed here.  So why
-            // did they bother calling us?  To get the correct
-            // parser position for error reporting.
-            throw SqlUtil.newContextException(pos, RESOURCE.illegalOrderBy());
-        }
-    }
-    <BY> e = OrderItem() {
-        list = startList(e);
-    }
-    (
-        // NOTE jvs 6-Feb-2004:  See comments at top of file for why
-        // hint is necessary here.
-        LOOKAHEAD(2) <COMMA> e = OrderItem() { list.add(e); }
-    ) *
-    {
-        return new SqlNodeList(list, pos.plusAll(list));
-    }
-}
-
-/**
- * Parses one list item in an ORDER BY clause.
- */
-SqlNode OrderItem() :
-{
-    SqlNode e;
-}
-{
-    e = Expression(ExprContext.ACCEPT_SUB_QUERY)
-    (
-        <ASC>
-    |   <DESC> {
-            e = SqlStdOperatorTable.DESC.createCall(getPos(), e);
-        }
-    )?
-    (
-        <NULLS> <FIRST> {
-            e = SqlStdOperatorTable.NULLS_FIRST.createCall(getPos(), e);
-        }
-    |
-        <NULLS> <LAST> {
-            e = SqlStdOperatorTable.NULLS_LAST.createCall(getPos(), e);
-        }
-    )?
-    {
-        return e;
-    }
-}
-
-/**
- * Parses a MATCH_RECOGNIZE clause following a table expression.
- */
-SqlMatchRecognize MatchRecognizeOpt(SqlNode tableRef) :
-{
-    final SqlParserPos startPos;
-    SqlParserPos pos;
-    SqlNode pattern;
-    SqlNodeList patternDefList;
-    SqlLiteral isStrictStarts = SqlLiteral.createBoolean(false, getPos());
-    SqlLiteral isStrictEnds = SqlLiteral.createBoolean(false, getPos());
-}
-{
-    <MATCH_RECOGNIZE> { startPos = getPos(); } <LPAREN>
-    <PATTERN>
-    <LPAREN>
-    (
-        <CARET> { isStrictStarts = SqlLiteral.createBoolean(true, getPos()); }
-    |
-        { isStrictStarts = SqlLiteral.createBoolean(false, getPos()); }
-    )
-    pattern = PatternExpression()
-    (
-        <DOLLAR> { isStrictEnds = SqlLiteral.createBoolean(true, getPos()); }
-    |
-        { isStrictEnds = SqlLiteral.createBoolean(false, getPos()); }
-    )
-    <RPAREN>
-    <DEFINE> { pos = getPos(); }
-    patternDefList = PatternDefinitionCommaList(pos)
-    <RPAREN> {
-        return new SqlMatchRecognize(startPos.plus(getPos()), tableRef,
-            pattern, isStrictStarts, isStrictEnds, patternDefList);
-    }
-}
-
-SqlNode PatternExpression() :
-{
-    SqlNode left;
-    SqlNode right;
-}
-{
-    left = PatternTerm()
-    (
-        <VERTICAL_BAR>
-        right = PatternTerm() {
-            left = SqlStdOperatorTable.PATTERN_ALTER.createCall(
-                left.getParserPosition().plus(getPos()), left, right);
-        }
-    )*
-    {
-        return left;
-    }
-}
-
-SqlNode PatternTerm() :
-{
-    SqlNode left;
-    SqlNode right;
-}
-{
-    left = PatternFactor()
-    (
-        right = PatternFactor() {
-            left = SqlStdOperatorTable.PATTERN_CONCAT.createCall(
-                left.getParserPosition().plus(getPos()), left, right);
-        }
-    )*
-    {
-        return left;
-    }
-}
-
-SqlNode PatternFactor() :
-{
-    SqlNode e;
-    SqlNode extra;
-    SqlLiteral startNum = null;
-    SqlLiteral endNum = null;
-    SqlLiteral reluctant = SqlLiteral.createBoolean(false, SqlParserPos.ZERO);
-}
-{
-    e = PatternPrimary()
-    [
-        (
-            <STAR> {
-                startNum = SqlLiteral.createExactNumeric("0", SqlParserPos.ZERO);
-                endNum = SqlLiteral.createExactNumeric("-1", SqlParserPos.ZERO);
-            }
-        |
-            <PLUS> {
-                startNum = SqlLiteral.createExactNumeric("1", SqlParserPos.ZERO);
-                endNum = SqlLiteral.createExactNumeric("-1", SqlParserPos.ZERO);
-            }
-        |
-            <HOOK> {
-                startNum = SqlLiteral.createExactNumeric("0", SqlParserPos.ZERO);
-                endNum = SqlLiteral.createExactNumeric("1", SqlParserPos.ZERO);
-            }
-        |
-            <LBRACE>
-            (
-                startNum = UnsignedNumericLiteral() { endNum = startNum; }
-                [
-                    <COMMA> {
-                        endNum = SqlLiteral.createExactNumeric("-1", SqlParserPos.ZERO);
-                    }
-                    [
-                        endNum = UnsignedNumericLiteral()
-                    ]
-                ]
-                <RBRACE>
-            |
-                {
-                    startNum = SqlLiteral.createExactNumeric("-1", SqlParserPos.ZERO);
-                }
-                <COMMA>
-                endNum = UnsignedNumericLiteral()
-                <RBRACE>
-            |
-                <MINUS> extra = PatternExpression() <MINUS> <RBRACE> {
-                    extra = SqlStdOperatorTable.PATTERN_EXCLUDE.createCall(
-                        extra.getParserPosition().plus(getPos()), extra);
-                    e = SqlStdOperatorTable.PATTERN_CONCAT.createCall(
-                        e.getParserPosition().plus(getPos()), e, extra);
-                    return e;
-                }
-            )
-        )
-        [
-            <HOOK>
-            {
-                if (startNum.intValue(true) != endNum.intValue(true)) {
-                    reluctant = SqlLiteral.createBoolean(true, SqlParserPos.ZERO);
-                }
-            }
-        ]
-    ]
-    {
-        if (startNum == null) {
-            return e;
-        } else {
-            return SqlStdOperatorTable.PATTERN_QUANTIFIER.createCall(
-                e.getParserPosition().plus(getPos()),
-                e, startNum, endNum, reluctant);
-        }
-    }
-}
-
-SqlNode PatternPrimary() :
-{
-    SqlParserPos pos;
-    SqlNode e;
-    List<SqlNode> eList;
-}
-{
-    (
-        e = SimpleIdentifier()
-    |
-        <LPAREN> e = PatternExpression() <RPAREN>
-    |
-        <LBRACE> { pos = getPos(); }
-        <MINUS> e = PatternExpression()
-        <MINUS> <RBRACE> {
-            e = SqlStdOperatorTable.PATTERN_EXCLUDE.createCall(
-                pos.plus(getPos()), e);
-        }
-    |
-        (
-            <PERMUTE> { pos = getPos(); }
-            <LPAREN>
-            e = PatternExpression() {
-                eList = new ArrayList<SqlNode>();
-                eList.add(e);
-            }
-            (
-                <COMMA>
-                e = PatternExpression()
-                {
-                    eList.add(e);
-                }
-            )*
-            <RPAREN> {
-                e = SqlStdOperatorTable.PATTERN_PERMUTE.createCall(
-                    pos.plus(getPos()), eList);
-            }
-        )
-    )
-    {
-        return e;
-    }
-}
-
-SqlNodeList PatternDefinitionCommaList(SqlParserPos pos) :
-{
-    SqlNode e;
-    final List<SqlNode> eList = new ArrayList<SqlNode>();
-}
-{
-    e = PatternDefinition() {
-        if (pos == null) {
-            pos = e.getParserPosition();
-        }
-        eList.add(e);
-    }
-    (
-        <COMMA>
-        e = PatternDefinition() {
-            eList.add(e);
-        }
-    )*
-    {
-        return new SqlNodeList(eList, pos.plus(getPos()));
-    }
-}
-
-SqlNode PatternDefinition() :
-{
-    SqlNode var;
-    SqlNode e;
-}
-{
-    var = SimpleIdentifier()
-    <AS>
-    e = Expression(ExprContext.ACCEPT_SUB_QUERY) {
-        return SqlStdOperatorTable.AS.createCall(
-            var.getParserPosition().plus(getPos()), e, var);
-    }
-}
-
-// ----------------------------------------------------------------------------
-// Expressions
-
-/**
- * Parses a SQL expression (such as might occur in a WHERE clause) followed by
- * the end-of-file symbol.
- */
-SqlNode SqlExpressionEof() :
-{
-    SqlNode e;
-}
-{
-    e = Expression(ExprContext.ACCEPT_SUB_QUERY) (<EOF>)
-    {
-        return e;
-    }
-}
-
-/**
- * Parses either a row expression or a query expression without ORDER BY.
- */
-SqlNode QueryOrExpr(ExprContext exprContext) :
-{
-    SqlNodeList withList = null;
-    SqlNode e;
-    SqlOperator op;
-    SqlParserPos pos;
-    SqlParserPos withPos;
-    List<Object> list;
-}
-{
-    [
-        withList = WithList()
-    ]
-    (
-        e = LeafQueryOrExpr(exprContext)
-    )
-    {
-        list = startList(e);
-    }
-    (
-        {
-            if (!e.isA(SqlKind.QUERY)) {
-                // whoops, expression we just parsed wasn't a query,
-                // but we're about to see something like UNION, so
-                // force an exception retroactively
-                checkNonQueryExpression(ExprContext.ACCEPT_QUERY);
-            }
-        }
-        op = BinaryQueryOperator()
-        {
-            // ensure a query is legal in this context
-            pos = getPos();
-            checkQueryExpression(exprContext);
-
-        }
-        e = LeafQueryOrExpr(ExprContext.ACCEPT_QUERY)
-        {
-            list.add(new SqlParserUtil.ToTreeListItem(op, pos));
-            list.add(e);
-        }
-    ) *
-    {
-        e = SqlParserUtil.toTree(list);
-        if (withList != null) {
-            e = new SqlWith(withList.getParserPosition(), withList, e);
-        }
-        return e;
-    }
-}
-
-SqlNodeList WithList() :
-{
-    SqlWithItem withItem;
-    SqlParserPos pos;
-    SqlNodeList list;
-}
-{
-    <WITH> { list = new SqlNodeList(getPos()); }
-    withItem = WithItem() {list.add(withItem);}
-    (
-        <COMMA> withItem = WithItem() {list.add(withItem);}
-    )*
-    { return list; }
-}
-
-SqlWithItem WithItem() :
-{
-    SqlIdentifier id;
-    SqlNodeList columnList = null;
-    SqlNode definition;
-}
-{
-    id = SimpleIdentifier()
-    [
-        LOOKAHEAD(2)
-        columnList = ParenthesizedSimpleIdentifierList()
-    ]
-    <AS>
-    definition = ParenthesizedExpression(ExprContext.ACCEPT_QUERY)
-    {
-        return new SqlWithItem(id.getParserPosition(), id, columnList,
-            definition);
-    }
-}
-
-/**
- * Parses either a row expression, a leaf query expression, or
- * a parenthesized expression of any kind.
- */
-SqlNode LeafQueryOrExpr(ExprContext exprContext) :
-{
-    SqlNode e;
-}
-{
-    e = Expression(exprContext)
-    {
-        return e;
-    }
-    | e = LeafQuery(exprContext)
-    {
-        return e;
-    }
-}
-
-/**
- * Parses a row expression or a parenthesized expression of any kind.
- */
-SqlNode Expression(ExprContext exprContext) :
-{
-    List<Object> list;
-    SqlNode e;
-}
-{
-    list = Expression2(exprContext)
-    {
-        e = SqlParserUtil.toTree(list);
-        return e;
-    }
-}
-
-// TODO jvs 15-Nov-2003:  ANY/ALL
-
-void Expression2b(ExprContext exprContext, List<Object> list) :
-{
-    SqlNode e;
-    SqlOperator op;
-}
-{
-    (
-        op = PrefixRowOperator() {
-            checkNonQueryExpression(exprContext);
-            list.add(new SqlParserUtil.ToTreeListItem(op, getPos()));
-        }
-    )*
-    e = Expression3(exprContext) {
-        list.add(e);
-    }
-}
-
-/**
- * Parses a binary row expression, or a parenthesized expression of any
- * kind.
- *
- * <p>The result is as a flat list of operators and operands. The top-level
- * call to get an expression should call {@link #Expression}, but lower-level
- * calls should call this, to give the parser the opportunity to associate
- * operator calls.
- *
- * <p>For example 'a = b like c = d' should come out '((a = b) like c) = d'
- * because LIKE and '=' have the same precedence, but tends to come out as '(a
- * = b) like (c = d)' because (a = b) and (c = d) are parsed as separate
- * expressions.
- */
-List<Object> Expression2(ExprContext exprContext) :
-{
-    final List<Object> list = new ArrayList();
-    List<Object> list2;
-    SqlNodeList nodeList;
-    SqlNode e;
-    SqlOperator op;
-    SqlParserPos pos = getPos();
-}
-{
-    Expression2b(exprContext, list)
-    (
-        (
-            LOOKAHEAD(2)
-            (
-                // Special case for "IN", because RHS of "IN" is the only place
-                // that an expression-list is allowed ("exp IN (exp1, exp2)").
-                LOOKAHEAD(2)
-                {
-                    checkNonQueryExpression(exprContext);
-                }
-                (
-                    <NOT> <IN>
-                    {
-                        op = SqlStdOperatorTable.NOT_IN;
-                        pos = getPos();
-                    }
-                |
-                    <IN>
-                    {
-                        op = SqlStdOperatorTable.IN;
-                        pos = getPos();
-                    }
-                )
-                nodeList = ParenthesizedQueryOrCommaList(ExprContext.ACCEPT_NONCURSOR)
-                {
-                    list.add(new SqlParserUtil.ToTreeListItem(op, pos));
-                    pos = pos.plus(getPos());
-                    // special case for stuff like IN (s1 UNION s2)
-                    if (nodeList.size() == 1) {
-                        SqlNode item = nodeList.get(0);
-                        if (item.isA(SqlKind.QUERY)) {
-                            list.add(item);
-                        } else {
-                            list.add(nodeList);
-                        }
-                    } else {
-                        list.add(nodeList);
-                    }
-                }
-            |
-                LOOKAHEAD(2)
-                {
-                    checkNonQueryExpression(exprContext);
-                }
-                (
-                    <NOT> <BETWEEN>
-                    {
-                        op = SqlStdOperatorTable.NOT_BETWEEN;
-                        pos = getPos();
-                    }
-                    [
-                        <SYMMETRIC> { op = SqlStdOperatorTable.SYMMETRIC_NOT_BETWEEN; }
-                    |
-                        <ASYMMETRIC>
-                    ]
-                |
-                    <BETWEEN>
-                    {
-                        op = SqlStdOperatorTable.BETWEEN;
-                        pos = getPos();
-                    }
-                    [
-                        <SYMMETRIC> { op = SqlStdOperatorTable.SYMMETRIC_BETWEEN; }
-                    |
-                        <ASYMMETRIC>
-                    ]
-                )
-                e = Expression3(ExprContext.ACCEPT_SUB_QUERY)
-                {
-                    list.add(new SqlParserUtil.ToTreeListItem(op, pos));
-                    list.add(e);
-                }
-            |
-                {
-                    checkNonQueryExpression(exprContext);
-                    pos = getPos();
-                }
-                (
-                    <NOT>
-                    (
-                        <LIKE> { op = SqlStdOperatorTable.NOT_LIKE; }
-                    |
-                        <SIMILAR> <TO> { op = SqlStdOperatorTable.NOT_SIMILAR_TO; }
-                    )
-                |
-                    <LIKE> { op = SqlStdOperatorTable.LIKE; }
-                |
-                    <SIMILAR> <TO> { op = SqlStdOperatorTable.SIMILAR_TO; }
-                )
-                list2 = Expression2(ExprContext.ACCEPT_SUB_QUERY)
-                {
-                    list.add(new SqlParserUtil.ToTreeListItem(op, pos));
-                    list.addAll(list2);
-                }
-                [
-                    LOOKAHEAD(2)
-                    <ESCAPE> e = Expression3(ExprContext.ACCEPT_SUB_QUERY)
-                    {
-                        pos = getPos();
-                        list.add(
-                            new SqlParserUtil.ToTreeListItem(
-                                SqlStdOperatorTable.ESCAPE, pos));
-                        list.add(e);
-                    }
-                ]
-            |
-                LOOKAHEAD(3) op = BinaryRowOperator()
-                {
-                    checkNonQueryExpression(exprContext);
-                    list.add(new SqlParserUtil.ToTreeListItem(op, getPos()));
-                }
-                Expression2b(ExprContext.ACCEPT_SUB_QUERY, list)
-            |
-                <LBRACKET>
-                e = Expression(ExprContext.ACCEPT_SUB_QUERY)
-                <RBRACKET>
-                {
-                    list.add(
-                        new SqlParserUtil.ToTreeListItem(
-                            SqlStdOperatorTable.ITEM, getPos()));
-                    list.add(e);
-                }
-            |
-                {
-                    checkNonQueryExpression(exprContext);
-                }
-                op = PostfixRowOperator()
-                {
-                    list.add(new SqlParserUtil.ToTreeListItem(op, getPos()));
-                }
-            )
-        ) +
-        {
-            return list;
-        }
-        |
-        {
-            return list;
-        }
-    )
-}
-
-/**
- * Parses a unary row expression, or a parenthesized expression of any
- * kind.
- */
-SqlNode Expression3(ExprContext exprContext) :
-{
-    SqlNode e;
-    SqlNodeList list;
-    SqlNodeList list1;
-    SqlNodeList list2;
-    SqlPrefixOperator op;
-    boolean rowSeen = false;
-    SqlParserPos pos;
-    SqlParserPos prefixRowOpPos;
-}
-{
-    LOOKAHEAD(2)
-    e = AtomicRowExpression()
-    {
-        checkNonQueryExpression(exprContext);
-        return e;
-    }
-    |
-    e = CursorExpression(exprContext) { return e; }
-    |
-    LOOKAHEAD(3)
-    <ROW> list = ParenthesizedSimpleIdentifierList()
-    {
-        pos = getPos();
-        if (exprContext != ExprContext.ACCEPT_ALL
-            && exprContext != ExprContext.ACCEPT_CURSOR)
-        {
-            throw SqlUtil.newContextException(pos,
-                RESOURCE.illegalRowExpression());
-        }
-        return SqlStdOperatorTable.ROW.createCall(list);
-    }
-    |
-    {
-        pos = getPos();
-    }
-    [
-        <ROW>
-        {
-            pos = getPos(); rowSeen = true;
-        }
-    ]
-    list1 = ParenthesizedQueryOrCommaList(exprContext) {
-        if (rowSeen) {
-            // interpret as row constructor
-            return SqlStdOperatorTable.ROW.createCall(pos, list1.toArray());
-
-        }
-    }
-    [
-        (
-            <OVERLAPS>
-            list2 = ParenthesizedQueryOrCommaList(exprContext)
-            {
-                if (list1.size() != 2 || list2.size() != 2) {
-                    throw SqlUtil.newContextException(
-                        list1.getParserPosition().plus(
-                            list2.getParserPosition()),
-                        RESOURCE.illegalOverlaps());
-                }
-                for (SqlNode node : list2) {
-                    list1.add(node);
-                }
-                return SqlStdOperatorTable.OVERLAPS.createCall(
-                    list1.getParserPosition().plus(list2.getParserPosition()),
-                    list1.toArray());
-            }
-        )
-        |
-        (
-            e = IntervalQualifier()
-            {
-                if ((list1.size() == 1)
-                    && list1.get(0) instanceof SqlCall)
-                {
-                    final SqlCall call = (SqlCall) list1.get(0);
-                    if (call.getKind() == SqlKind.MINUS
-                            && call.operandCount() == 2) {
-                        List<SqlNode> list3 = startList(call.operand(0));
-                        list3.add(call.operand(1));
-                        list3.add(e);
-                        return SqlStdOperatorTable.MINUS_DATE.createCall(
-                            list1.getParserPosition().plus(getPos()),
-                            SqlParserUtil.toNodeArray(list3));
-                     }
-                }
-                throw SqlUtil.newContextException(
-                    list1.getParserPosition().plus(getPos()),
-                    RESOURCE.illegalMinusDate());
-            }
-        )
-    ]
-    {
-        if (list1.size() == 1) {
-            // interpret as single value or query
-            return list1.get(0);
-        } else {
-            // interpret as row constructor
-            return SqlStdOperatorTable.ROW.createCall(pos, list1.toArray());
-        }
-    }
-}
-
-/**
- * Parses a COLLATE clause
- */
-SqlCollation CollateClause() :
-{
-}
-{
-    <COLLATE> <COLLATION_ID>
-    {
-        return new SqlCollation(
-            getToken(0).image, SqlCollation.Coercibility.EXPLICIT);
-    }
-}
-
-/**
- * Parses an atomic row expression.
- */
-SqlNode AtomicRowExpression() :
-{
-    SqlNode e;
-    SqlParserPos pos;
-}
-{
-    LOOKAHEAD(1)
-    e = Literal() { return e; }
-    |
-    e = DynamicParam() { return e; }
-    |
-    e = BuiltinFunctionCall() { return e; }
-    |
-    e = JdbcFunctionCall() { return e; }
-    |
-    e = MultisetConstructor() { return e; }
-    |
-    e = ArrayConstructor() { return e; }
-    |
-    e = MapConstructor() { return e; }
-    |
-    // NOTE jvs 18-Jan-2005:  use syntactic lookahead to discriminate
-    // compound identifiers from function calls in which the function
-    // name is a compound identifier
-    LOOKAHEAD( [<SPECIFIC>] FunctionName() <LPAREN>)
-    e = NamedFunctionCall() { return e; }
-    |
-    e = ContextVariable() { return e; }
-    |
-    e = CompoundIdentifier() { return e; }
-    |
-    e = NewSpecification(

<TRUNCATED>

[16/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/site/fonts/fontawesome-webfont.woff
----------------------------------------------------------------------
diff --git a/avatica/site/fonts/fontawesome-webfont.woff b/avatica/site/fonts/fontawesome-webfont.woff
deleted file mode 100755
index 628b6a5..0000000
Binary files a/avatica/site/fonts/fontawesome-webfont.woff and /dev/null differ

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/site/img/feather.png
----------------------------------------------------------------------
diff --git a/avatica/site/img/feather.png b/avatica/site/img/feather.png
deleted file mode 100644
index a2da98a..0000000
Binary files a/avatica/site/img/feather.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/site/img/logo.png
----------------------------------------------------------------------
diff --git a/avatica/site/img/logo.png b/avatica/site/img/logo.png
deleted file mode 100644
index 22b983e..0000000
Binary files a/avatica/site/img/logo.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/site/index.html
----------------------------------------------------------------------
diff --git a/avatica/site/index.html b/avatica/site/index.html
deleted file mode 100644
index d347e33..0000000
--- a/avatica/site/index.html
+++ /dev/null
@@ -1,66 +0,0 @@
----
-layout: default
-title: Apache Calcite &bull; Dynamic data management framework
-overview: true
----
-{% comment %}
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements.  See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License.  You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-{% endcomment %}
-
-<section class="intro">
-  <div class="grid">
-    <div class="unit whole center-on-mobiles">
-      <p class="first">Avatica is a framework for building database drivers.</p>
-    </div>
-  </div>
-</section>
-<section class="features">
-  <div class="grid">
-    <div class="unit whole center-on-mobiles">
-      <p>Avatica is defined by a wire API between a client and a server. The Avatica server is
-      an HTTP server, the Avatica client is a JDBC driver, and the wire API is defined by
-      JSON or Protobuf Buffers. The flexibility of the wire API and HTTP transport allows
-      other Avatica clients to be built in any language, implementing any client specification.</p>
-      <p>Avatica is a sub-project of the <a href="{{ site.baseurl }}/..">Apache Calcite project</a>.
-      Please refer to Calcite for information about the project as a whole.</p>
-    </div>
-  </div>
-</section>
-<section class="resources">
-  <div class="grid">
-    <div class="unit one-third">
-      <summary>
-        <h3>Resources</h3>
-        <ul>
-          <li><a href="{{ site.baseurl }}/downloads">Downloads</a></li>
-          <li><a href="{{ site.baseurl }}/docs/history.html">History</a></li>
-          <li><a href="http://www.apache.org/security">Security</a></li>
-        </ul>
-      </summary>
-    </div>
-    <div class="unit one-third">
-      <summary>
-        <h3>Apache</h3>
-        <ul>
-          <li><a href="http://www.apache.org/licenses">License</a></li>
-          <li><a href="http://www.apache.org/foundation/sponsorship.html">Donate</a></li>
-          <li><a href="http://www.apache.org/foundation/thanks.html">Thanks</a></li>
-          <li><a href="http://www.apache.org">Website</a></li>
-        </ul>
-      </summary>
-    </div>
-  </div>
-</section>

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/site/js/html5shiv.min.js
----------------------------------------------------------------------
diff --git a/avatica/site/js/html5shiv.min.js b/avatica/site/js/html5shiv.min.js
deleted file mode 100644
index d4c731a..0000000
--- a/avatica/site/js/html5shiv.min.js
+++ /dev/null
@@ -1,4 +0,0 @@
-/**
-* @preserve HTML5 Shiv 3.7.2 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
-*/
-!function(a,b){function c(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function d(){var a=t.elements;return"string"==typeof a?a.split(" "):a}function e(a,b){var c=t.elements;"string"!=typeof c&&(c=c.join(" ")),"string"!=typeof a&&(a=a.join(" ")),t.elements=c+" "+a,j(b)}function f(a){var b=s[a[q]];return b||(b={},r++,a[q]=r,s[r]=b),b}function g(a,c,d){if(c||(c=b),l)return c.createElement(a);d||(d=f(c));var e;return e=d.cache[a]?d.cache[a].cloneNode():p.test(a)?(d.cache[a]=d.createElem(a)).cloneNode():d.createElem(a),!e.canHaveChildren||o.test(a)||e.tagUrn?e:d.frag.appendChild(e)}function h(a,c){if(a||(a=b),l)return a.createDocumentFragment();c=c||f(a);for(var e=c.frag.cloneNode(),g=0,h=d(),i=h.length;i>g;g++)e.createElement(h[g]);return e}function i(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag
 ()),a.createElement=function(c){return t.shivMethods?g(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+d().join().replace(/[\w\-:]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(t,b.frag)}function j(a){a||(a=b);var d=f(a);return!t.shivCSS||k||d.hasCSS||(d.hasCSS=!!c(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),l||i(a,d),a}var k,l,m="3.7.2",n=a.html5||{},o=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,p=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,q="_html5shiv",r=0,s={};!function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",k="hidden"in a,l=1==a.childNodes.length||function(){b.createElement("a");var a=b.createDocumentFragment();return"undefined"
 ==typeof a.cloneNode||"undefined"==typeof a.createDocumentFragment||"undefined"==typeof a.createElement}()}catch(c){k=!0,l=!0}}();var t={elements:n.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video",version:m,shivCSS:n.shivCSS!==!1,supportsUnknownElements:l,shivMethods:n.shivMethods!==!1,type:"default",shivDocument:j,createElement:g,createDocumentFragment:h,addElements:e};a.html5=t,j(b)}(this,document);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/site/js/respond.min.js
----------------------------------------------------------------------
diff --git a/avatica/site/js/respond.min.js b/avatica/site/js/respond.min.js
deleted file mode 100644
index 80a7b69..0000000
--- a/avatica/site/js/respond.min.js
+++ /dev/null
@@ -1,5 +0,0 @@
-/*! Respond.js v1.4.2: min/max-width media query polyfill * Copyright 2013 Scott Jehl
- * Licensed under https://github.com/scottjehl/Respond/blob/master/LICENSE-MIT
- *  */
-
-!function(a){"use strict";a.matchMedia=a.matchMedia||function(a){var b,c=a.documentElement,d=c.firstElementChild||c.firstChild,e=a.createElement("body"),f=a.createElement("div");return f.id="mq-test-1",f.style.cssText="position:absolute;top:-100em",e.style.background="none",e.appendChild(f),function(a){return f.innerHTML='&shy;<style media="'+a+'"> #mq-test-1 { width: 42px; }</style>',c.insertBefore(e,d),b=42===f.offsetWidth,c.removeChild(e),{matches:b,media:a}}}(a.document)}(this),function(a){"use strict";function b(){u(!0)}var c={};a.respond=c,c.update=function(){};var d=[],e=function(){var b=!1;try{b=new a.XMLHttpRequest}catch(c){b=new a.ActiveXObject("Microsoft.XMLHTTP")}return function(){return b}}(),f=function(a,b){var c=e();c&&(c.open("GET",a,!0),c.onreadystatechange=function(){4!==c.readyState||200!==c.status&&304!==c.status||b(c.responseText)},4!==c.readyState&&c.send(null))};if(c.ajax=f,c.queue=d,c.regex={media:/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,keyframes:/@(?:\-(?:
 o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,urls:/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,findStyles:/@media *([^\{]+)\{([\S\s]+?)$/,only:/(only\s+)?([a-zA-Z]+)\s?/,minw:/\([\s]*min\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/,maxw:/\([\s]*max\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/},c.mediaQueriesSupported=a.matchMedia&&null!==a.matchMedia("only all")&&a.matchMedia("only all").matches,!c.mediaQueriesSupported){var g,h,i,j=a.document,k=j.documentElement,l=[],m=[],n=[],o={},p=30,q=j.getElementsByTagName("head")[0]||k,r=j.getElementsByTagName("base")[0],s=q.getElementsByTagName("link"),t=function(){var a,b=j.createElement("div"),c=j.body,d=k.style.fontSize,e=c&&c.style.fontSize,f=!1;return b.style.cssText="position:absolute;font-size:1em;width:1em",c||(c=f=j.createElement("body"),c.style.background="none"),k.style.fontSize="100%",c.style.fontSize="100%",c.appendChild(b),f&&k.insertBefore(c,k.firstChild),a=b.offsetWidth,f?k.removeChild(c):c.removeC
 hild(b),k.style.fontSize=d,e&&(c.style.fontSize=e),a=i=parseFloat(a)},u=function(b){var c="clientWidth",d=k[c],e="CSS1Compat"===j.compatMode&&d||j.body[c]||d,f={},o=s[s.length-1],r=(new Date).getTime();if(b&&g&&p>r-g)return a.clearTimeout(h),h=a.setTimeout(u,p),void 0;g=r;for(var v in l)if(l.hasOwnProperty(v)){var w=l[v],x=w.minw,y=w.maxw,z=null===x,A=null===y,B="em";x&&(x=parseFloat(x)*(x.indexOf(B)>-1?i||t():1)),y&&(y=parseFloat(y)*(y.indexOf(B)>-1?i||t():1)),w.hasquery&&(z&&A||!(z||e>=x)||!(A||y>=e))||(f[w.media]||(f[w.media]=[]),f[w.media].push(m[w.rules]))}for(var C in n)n.hasOwnProperty(C)&&n[C]&&n[C].parentNode===q&&q.removeChild(n[C]);n.length=0;for(var D in f)if(f.hasOwnProperty(D)){var E=j.createElement("style"),F=f[D].join("\n");E.type="text/css",E.media=D,q.insertBefore(E,o.nextSibling),E.styleSheet?E.styleSheet.cssText=F:E.appendChild(j.createTextNode(F)),n.push(E)}},v=function(a,b,d){var e=a.replace(c.regex.keyframes,"").match(c.regex.media),f=e&&e.length||0;b=b.substr
 ing(0,b.lastIndexOf("/"));var g=function(a){return a.replace(c.regex.urls,"$1"+b+"$2$3")},h=!f&&d;b.length&&(b+="/"),h&&(f=1);for(var i=0;f>i;i++){var j,k,n,o;h?(j=d,m.push(g(a))):(j=e[i].match(c.regex.findStyles)&&RegExp.$1,m.push(RegExp.$2&&g(RegExp.$2))),n=j.split(","),o=n.length;for(var p=0;o>p;p++)k=n[p],l.push({media:k.split("(")[0].match(c.regex.only)&&RegExp.$2||"all",rules:m.length-1,hasquery:k.indexOf("(")>-1,minw:k.match(c.regex.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:k.match(c.regex.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}u()},w=function(){if(d.length){var b=d.shift();f(b.href,function(c){v(c,b.href,b.media),o[b.href]=!0,a.setTimeout(function(){w()},0)})}},x=function(){for(var b=0;b<s.length;b++){var c=s[b],e=c.href,f=c.media,g=c.rel&&"stylesheet"===c.rel.toLowerCase();e&&g&&!o[e]&&(c.styleSheet&&c.styleSheet.rawCssText?(v(c.styleSheet.rawCssText,e,f),o[e]=!0):(!/^([a-zA-Z:]*\/\/)/.test(e)&&!r||e.replace(RegExp.$1,"").split("/")[0]===a.location.host)&&("
 //"===e.substring(0,2)&&(e=a.location.protocol+e),d.push({href:e,media:f})))}w()};x(),c.update=x,c.getEmValue=t,a.addEventListener?a.addEventListener("resize",b,!1):a.attachEvent&&a.attachEvent("onresize",b)}}(this);
\ No newline at end of file

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

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

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/src/main/config/assemblies/source-assembly.xml
----------------------------------------------------------------------
diff --git a/avatica/src/main/config/assemblies/source-assembly.xml b/avatica/src/main/config/assemblies/source-assembly.xml
deleted file mode 100644
index 2b1f930..0000000
--- a/avatica/src/main/config/assemblies/source-assembly.xml
+++ /dev/null
@@ -1,103 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!--
-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.
--->
-<assembly>
-  <id>source-release</id>
-  <formats>
-    <format>zip</format>
-    <format>tar.gz</format>
-  </formats>
-  <fileSets>
-    <!-- main project directory structure -->
-    <fileSet>
-      <directory>.</directory>
-      <outputDirectory>/</outputDirectory>
-      <useDefaultExcludes>true</useDefaultExcludes>
-      <excludes>
-        <!-- build output -->
-        <exclude>%regex[(?!((?!${project.build.directory}/)[^/]+/)*src/).*${project.build.directory}.*]
-        </exclude>
-
-        <!-- NOTE: Most of the following excludes should not be required
-          if the standard release process is followed. This is because the release
-          plugin checks out project sources into a location like target/checkout, then
-          runs the build from there. The result is a source-release archive that comes
-          from a pretty clean directory structure. HOWEVER, if the release plugin is
-          configured to run extra goals or generate a project website, it's definitely
-          possible that some of these files will be present. So, it's safer to exclude
-          them. -->
-
-        <!-- IDEs -->
-        <exclude>%regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?maven-eclipse\.xml]
-        </exclude>
-        <exclude>%regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?\.project]
-        </exclude>
-        <exclude>%regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?\.classpath]
-        </exclude>
-        <exclude>%regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?[^/]*\.iws]
-        </exclude>
-        <exclude>%regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?\.idea(/.*)?]
-        </exclude>
-        <exclude>%regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?out(/.*)?]
-        </exclude>
-        <exclude>%regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?[^/]*\.ipr]
-        </exclude>
-        <exclude>%regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?[^/]*\.iml]
-        </exclude>
-        <exclude>%regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?\.settings(/.*)?]
-        </exclude>
-        <exclude>%regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?\.externalToolBuilders(/.*)?]
-        </exclude>
-        <exclude>%regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?\.deployables(/.*)?]
-        </exclude>
-        <exclude>%regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?\.wtpmodules(/.*)?]
-        </exclude>
-
-
-        <!-- scm -->
-        <exclude>%regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?\.gitignore(/.*)?]
-        </exclude>
-
-        <exclude>**/.buildpath</exclude>
-        <exclude>**/sandbox/**</exclude>
-
-        <!-- misc -->
-        <exclude>%regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?cobertura\.ser]
-        </exclude>
-
-        <!-- release-plugin temp files -->
-        <exclude>%regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?pom\.xml\.releaseBackup]
-        </exclude>
-        <exclude>%regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?release\.properties]
-        </exclude>
-      </excludes>
-    </fileSet>
-    <!-- LICENSE, NOTICE, DEPENDENCIES, git.properties, etc. calculated at build time -->
-    <fileSet>
-      <directory>${project.build.directory}/maven-shared-archive-resources/META-INF
-      </directory>
-      <outputDirectory>/</outputDirectory>
-    </fileSet>
-    <fileSet>
-      <directory>${project.build.directory}</directory>
-      <includes>
-        <include>git.properties</include>
-      </includes>
-      <outputDirectory>/</outputDirectory>
-    </fileSet>
-  </fileSets>
-</assembly>

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/src/main/config/checkstyle/checker.xml
----------------------------------------------------------------------
diff --git a/avatica/src/main/config/checkstyle/checker.xml b/avatica/src/main/config/checkstyle/checker.xml
deleted file mode 100644
index 167511b..0000000
--- a/avatica/src/main/config/checkstyle/checker.xml
+++ /dev/null
@@ -1,279 +0,0 @@
-<?xml version="1.0"?>
-<!--
-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.
--->
-
-<!--
-  This version of checkstyle is based on the Apache Giraph checkstyle
-  configuration, which in turn is based on Hadoop and common-math
-  configurations.
-
-  The documentation for checkstyle is available at
-
-  http://checkstyle.sourceforge.net
--->
-
-<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.1//EN" "http://www.puppycrawl.com/dtds/configuration_1_1.dtd">
-
-<!-- Calcite customization of default Checkstyle behavior -->
-<module name="Checker">
-  <property name="localeLanguage" value="en"/>
-
-  <!-- Checks for headers -->
-  <!-- See http://checkstyle.sf.net/config_header.html -->
-    <!-- Verify that EVERY source file has the appropriate license -->
-  <module name="Header">
-    <property name="headerFile" value="${checkstyle.header.file}"/>
-  </module>
-
-  <!-- Checks for Javadoc comments (checker).           -->
-  <!-- See http://checkstyle.sf.net/config_javadoc.html -->
-    <!-- Require package javadoc -->
-  <module name="JavadocPackage"/>
-
-  <!-- Miscellaneous other checks (checker).         -->
-  <!-- See http://checkstyle.sf.net/config_misc.html -->
-    <!-- Require files to end with newline characters -->
-  <module name="NewlineAtEndOfFile">
-    <property name="lineSeparator" value="lf"/>
-  </module>
-
-  <!-- Checks for whitespace (tree walker)                 -->
-  <!-- See http://checkstyle.sf.net/config_whitespace.html -->
-    <!-- No tabs allowed! -->
-  <module name="FileTabCharacter"/>
-
-  <module name="TreeWalker">
-    <property name="cacheFile" value="target/checkstyle-cachefile"/>
-
-    <!-- Checks for blocks. You know, those {}'s         -->
-    <!-- See http://checkstyle.sf.net/config_blocks.html -->
-      <!-- No empty blocks (i.e. catch); must contain at least a comment -->
-    <module name="EmptyBlock">
-      <property name="option" value="text"/>
-    </module>
-    <module name="AvoidNestedBlocks">
-        <property name="allowInSwitchCase" value="true"/>
-    </module>
-    <module name="LeftCurly"/>
-      <!-- No if/else/do/for/while without braces -->
-    <module name="NeedBraces"/>
-    <module name="RightCurly"/>
-
-    <!-- Checks for class design                         -->
-    <!-- See http://checkstyle.sf.net/config_design.html -->
-      <!-- Utility class should not be instantiated, they must have a
-           private constructor -->
-    <module name="HideUtilityClassConstructor"/>
-
-    <!-- Checks for common coding problems               -->
-    <!-- See http://checkstyle.sf.net/config_coding.html -->
-    <module name="EmptyStatement"/>
-      <!-- Require hash code override when equals is -->
-    <module name="EqualsHashCode"/>
-      <!-- Disallow unnecessary instantiation of Boolean, String -->
-    <module name="IllegalInstantiation">
-      <property name="classes" value="java.lang.Boolean, java.lang.String"/>
-    </module>
-      <!-- Switch statements should be complete and with independent cases -->
-    <module name="FallThrough"/>
-    <module name="SimplifyBooleanExpression"/>
-    <module name="SimplifyBooleanReturn"/>
-      <!-- Only one statement per line allowed -->
-    <module name="OneStatementPerLine"/>
-      <!-- Don't add up parentheses when they are not required -->
-    <module name="UnnecessaryParentheses" />
-      <!-- Don't use = or != for string comparisons -->
-    <module name="StringLiteralEquality" />
-      <!-- Don't declare multiple variables in the same statement -->
-    <module name="MultipleVariableDeclarations" />
-      <!-- String literals more than one character long should not be
-           repeated several times -->
-      <!-- the "unchecked" string is also accepted to allow
-           @SuppressWarnings("unchecked") -->
-      <!-- Disabling for now until we have a better ignoreStringsRegexp -->
-      <!--
-    <module name="MultipleStringLiterals" >
-      <property name="ignoreStringsRegexp" value='^(("")|(".")|("unchecked"))$'/>
-    </module>
-      -->
-
-    <!-- Checks for imports                              -->
-    <!-- See http://checkstyle.sf.net/config_import.html -->
-    <module name="RedundantImport"/>
-      <!-- Import should be explicit, and only from pure java packages.
-           But we allow imports that are only used in javadoc. -->
-    <module name="UnusedImports">
-      <property name="processJavadoc" value="true"/>
-    </module>
-    <module name="IllegalImport" />
-    <module name="AvoidStarImport" />
-    <module name="ImportOrder">
-      <property name="groups" value="org.apache.calcite,org.apache,au.com.,com.,io.,mondrian.,net.,org.,scala.,/^javax?\./"/>
-      <property name="ordered" value="true"/>
-      <property name="separated" value="true"/>
-      <property name="option" value="bottom"/>
-    </module>
-
-    <!-- Checks for Javadoc comments (tree walker).       -->
-    <!-- See http://checkstyle.sf.net/config_javadoc.html -->
-      <!-- Javadoc must be formatted correctly -->
-    <module name="JavadocStyle">
-      <property name="checkFirstSentence" value="false"/>
-    </module>
-      <!-- Must have class / interface header comments -->
-    <module name="JavadocType"/>
-
-    <!-- Miscellaneous other checks (tree walker).     -->
-    <!-- See http://checkstyle.sf.net/config_misc.html -->
-      <!-- Java style arrays -->
-    <module name="ArrayTypeStyle"/>
-      <!-- Indentation -->
-    <module name="Indentation">
-      <property name="caseIndent" value="0"/>
-      <property name="basicOffset" value="2"/>
-      <property name="braceAdjustment" value="0"/>
-    </module>
-      <!-- Turn this on to see what needs to be done
-    <module name="TodoComment"/>
-       -->
-    <module name="UpperEll"/>
-
-    <module name="OperatorWrap"/>
-
-    <!-- Modifier Checks                                    -->
-    <!-- See http://checkstyle.sf.net/config_modifiers.html -->
-      <!-- Use a consistent way to put modifiers -->
-    <module name="ModifierOrder"/>
-    <module name="RedundantModifier"/>
-
-    <!-- Checks for Naming Conventions.                  -->
-    <!-- See http://checkstyle.sf.net/config_naming.html -->
-      <!-- Constant names should obey the traditional all uppercase
-           naming convention -->
-    <module name="ConstantName"/>
-    <module name="LocalFinalVariableName">
-      <!-- Allow '_' except first. -->
-      <property name="format" value="^[a-z][a-zA-Z0-9_]*$"/>
-    </module>
-    <module name="LocalVariableName">
-      <!-- Allow '_' except first. -->
-      <property name="format" value="^[a-z][a-zA-Z0-9_]*$"/>
-    </module>
-    <module name="MemberName"/>
-    <module name="MethodName">
-      <!-- Allow trailing '_', signifying private methods.
-           Also allow '_' prefix, indicating disabled method or junit test. -->
-      <property name="format" value="^_?[a-z][a-zA-Z0-9]*_?$"/>
-    </module>
-    <module name="PackageName"/>
-    <module name="ParameterName">
-      <!-- Allow trailing '_'. -->
-      <property name="format" value="^[a-z][a-zA-Z0-9]*_?$"/>
-    </module>
-    <module name="StaticVariableName"/>
-    <module name="TypeName"/>
-
-    <!-- Checks for regexp expressions.                  -->
-    <!-- See http://checkstyle.sf.net/config_regexp.html -->
-
-    <!-- No trailing whitespace -->
-    <module name="Regexp">
-      <property name="format" value="[ \t]+$"/>
-      <property name="illegalPattern" value="true"/>
-      <property name="message" value="Trailing whitespace"/>
-    </module>
-
-    <!-- Authors should be in pom.xml file -->
-    <module name="Regexp">
-      <property name="format" value="@author"/>
-      <property name="illegalPattern" value="true"/>
-      <property name="message" value="developers names should be in pom file"/>
-    </module>
-
-    <!-- No multi-line C-style comments except at start of line. -->
-    <module name="Regexp">
-      <property name="format" value="^ +/\*[^*][^/]$"/>
-      <property name="illegalPattern" value="true"/>
-      <property name="message" value="C-style comment"/>
-    </module>
-
-    <module name="Regexp">
-      <property name="format" value="^ +/\*$"/>
-      <property name="illegalPattern" value="true"/>
-      <property name="message" value="C-style comment"/>
-    </module>
-
-    <!-- Checks for Size Violations.                    -->
-    <!-- See http://checkstyle.sf.net/config_sizes.html -->
-    <!-- Lines cannot exceed 80 chars, except if they are hyperlinks
-         or strings (possibly preceded by '+' and followed by say '),'. -->
-    <module name="LineLength">
-      <property name="max" value="100"/>
-      <property name="ignorePattern" value="^import|@see|@link|@BaseMessage|href|^[ +]*&quot;.*&quot;[);,]*$"/>
-    </module>
-      <!-- Over time, we will revise this down -->
-    <module name="MethodLength">
-      <property name="max" value="390"/>
-    </module>
-
-    <!-- Checks for whitespace (tree walker)                 -->
-    <!-- See http://checkstyle.sf.net/config_whitespace.html -->
-    <module name="EmptyForIteratorPad"/>
-      <!-- Spacing around methods -->
-    <module name="MethodParamPad">
-      <property name="option" value="nospace"/>
-      <property name="allowLineBreaks" value="true"/>
-     </module>
-      <!-- No whitespace before a token -->
-    <module name="NoWhitespaceBefore"/>
-      <!-- Whitespace after tokens is required -->
-    <module name="WhitespaceAfter"/>
-      <!-- Whitespace around tokens is required -->
-    <module name="WhitespaceAround">
-        <property name="allowEmptyConstructors" value="true"/>
-        <property name="allowEmptyMethods" value="true"/>
-    </module>
-    <module name="ParenPad"/>
-    <module name="TypecastParenPad"/>
-      <!-- No extra whitespace around types -->
-    <module name="GenericWhitespace"/>
-
-    <!-- Required for SuppressionCommentFilter below -->
-    <module name="FileContentsHolder"/>
-  </module>
-
-  <!-- Setup special comments to suppress specific checks from source files -->
-  <module name="SuppressionCommentFilter">
-    <property name="offCommentFormat" value="CHECKSTYLE\: stop ([\w\|]+)"/>
-    <property name="onCommentFormat"  value="CHECKSTYLE\: resume ([\w\|]+)"/>
-    <property name="checkFormat"      value="$1"/>
-  </module>
-
-  <!-- Turn off all checks between OFF and ON -->
-  <module name="SuppressionCommentFilter">
-    <property name="offCommentFormat" value="CHECKSTYLE\: OFF"/>
-    <property name="onCommentFormat"  value="CHECKSTYLE\: ON"/>
-  </module>
-
-  <!-- Turn off checks for the next N lines. -->
-  <module name="SuppressWithNearbyCommentFilter">
-    <property name="commentFormat" value="CHECKSTYLE: +IGNORE (\d+)"/>
-    <property name="influenceFormat" value="$1"/>
-  </module>
-
-  <module name="net.hydromatic.toolbox.checkstyle.HydromaticFileSetCheck"/>
-</module>

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/src/main/config/checkstyle/header.txt
----------------------------------------------------------------------
diff --git a/avatica/src/main/config/checkstyle/header.txt b/avatica/src/main/config/checkstyle/header.txt
deleted file mode 100644
index 2a42971..0000000
--- a/avatica/src/main/config/checkstyle/header.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * 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.
- */

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/src/main/config/checkstyle/suppressions.xml
----------------------------------------------------------------------
diff --git a/avatica/src/main/config/checkstyle/suppressions.xml b/avatica/src/main/config/checkstyle/suppressions.xml
deleted file mode 100644
index 9c31837..0000000
--- a/avatica/src/main/config/checkstyle/suppressions.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE suppressions PUBLIC
-        "-//Puppy Crawl//DTD Suppressions 1.1//EN"
-        "http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
-<!--
-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.
--->
-<suppressions>
-  <!-- Suppress checks on generated files. -->
-  <suppress checks="Header" files="CalciteResource.properties"/>
-  <suppress checks=".*" files="org-apache-calcite-jdbc.properties"/>
-  <suppress checks=".*" files="Foo.java"/>
-  <suppress checks=".*" files=".*[/\\]target[/\\]maven-archiver[/\\]pom.properties"/>
-  <suppress checks=".*" files="git.properties"/>
-  <suppress checks=".*" files="trace.properties"/>
-  <suppress checks=".*" files="release.properties"/>
-  <suppress checks=".*" files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]apache[/\\]calcite[/\\]avatica[/\\]proto"/>
-  <suppress checks=".*" files="log4j.properties"/>
-  <suppress checks=".*" files="auth-users.properties"/>
-
-  <!-- This file triggers https://github.com/checkstyle/checkstyle/issues/92,
-       through no fault of its own. -->
-  <suppress checks=".*" files="SqlSimpleParser.java"/>
-
-  <!-- Don't complain about field names such as cust_id -->
-  <suppress checks=".*Name" files="JdbcExample.java"/>
-
-  <!-- Suppress JavadocPackage in the test packages -->
-  <suppress checks="JavadocPackage" files="src[/\\]test[/\\]java[/\\]"/>
-
-  <!-- And likewise in ubenchmark -->
-  <suppress checks="JavadocPackage" files="StatementTest.java"/>
-
-  <!-- Method names in Resource can have underscores -->
-  <suppress checks="MethodName" files="CalciteResource.java"/>
-</suppressions>

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/src/main/config/forbidden-apis/signatures.txt
----------------------------------------------------------------------
diff --git a/avatica/src/main/config/forbidden-apis/signatures.txt b/avatica/src/main/config/forbidden-apis/signatures.txt
deleted file mode 100644
index 588837d..0000000
--- a/avatica/src/main/config/forbidden-apis/signatures.txt
+++ /dev/null
@@ -1,39 +0,0 @@
-# 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.
-#
-# Signatures of APIs to avoid.
-# Cribbed from Elasticsearch
-
-java.lang.Character#codePointBefore(char[],int) @ Implicit start offset is error-prone when the char[] is a buffer and the first chars are random chars
-java.lang.Character#codePointAt(char[],int) @ Implicit end offset is error-prone when the char[] is a buffer and the last chars are random chars
-
-@defaultMessage Only use wait / notify when really needed try to use concurrency primitives, latches or callbacks instead.
-java.lang.Object#wait()
-java.lang.Object#wait(long)
-java.lang.Object#wait(long,int)
-java.lang.Object#notify()
-java.lang.Object#notifyAll()
-
-@defaultMessage Please do not try to stop the world
-java.lang.System#gc()
-
-@defaultMessage Please do not try to kill the world
-java.lang.System#exit(int)
-java.lang.Runtime#exit(int)
-
-@defaultMessage Don't interrupt threads; use FutureUtils#cancel(Future<T>) instead
-java.util.concurrent.Future#cancel(boolean)
-
-# End signatures.txt

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/standalone-server/.gitignore
----------------------------------------------------------------------
diff --git a/avatica/standalone-server/.gitignore b/avatica/standalone-server/.gitignore
deleted file mode 100644
index b83d222..0000000
--- a/avatica/standalone-server/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/target/

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/standalone-server/pom.xml
----------------------------------------------------------------------
diff --git a/avatica/standalone-server/pom.xml b/avatica/standalone-server/pom.xml
deleted file mode 100644
index 88bfd3b..0000000
--- a/avatica/standalone-server/pom.xml
+++ /dev/null
@@ -1,217 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <parent>
-    <groupId>org.apache.calcite.avatica</groupId>
-    <artifactId>avatica-parent</artifactId>
-    <version>1.10.0-SNAPSHOT</version>
-  </parent>
-  <artifactId>avatica-standalone-server</artifactId>
-  <name>Avatica Standalone Server</name>
-  <description>A Stadnalone Avatica Server Implementation</description>
-
-  <properties>
-    <top.dir>${project.basedir}/..</top.dir>
-    <shaded.pkg>org.apache.calcite.avatica.standalone.shaded</shaded.pkg>
-  </properties>
-
-  <dependencies>
-    <!-- Sorted by groupId, artifactId; calcite dependencies first. Put versions
-         in dependencyManagement in the root POM, not here. -->
-    <dependency>
-      <groupId>org.apache.calcite.avatica</groupId>
-      <artifactId>avatica-core</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.calcite.avatica</groupId>
-      <artifactId>avatica-server</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>com.beust</groupId>
-      <artifactId>jcommander</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-api</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-log4j12</artifactId>
-    </dependency>
-  </dependencies>
-
-  <build>
-    <pluginManagement>
-      <plugins>
-        <plugin>
-          <groupId>org.eclipse.m2e</groupId>
-          <artifactId>lifecycle-mapping</artifactId>
-          <version>1.0.0</version>
-          <configuration>
-            <lifecycleMappingMetadata>
-              <pluginExecutions>
-                <pluginExecution>
-                  <pluginExecutionFilter>
-                    <groupId>org.apache.maven.plugins</groupId>
-                    <artifactId>maven-checkstyle-plugin</artifactId>
-                    <versionRange>[2.12.1,)</versionRange>
-                    <goals>
-                      <goal>check</goal>
-                    </goals>
-                  </pluginExecutionFilter>
-                  <action>
-                    <ignore />
-                  </action>
-                </pluginExecution>
-              </pluginExecutions>
-            </lifecycleMappingMetadata>
-          </configuration>
-        </plugin>
-      </plugins>
-    </pluginManagement>
-    <plugins>
-      <!-- Parent module has the same plugin and does the work of
-           generating -sources.jar for each project. But without the
-           plugin declared here, IDEs don't know the sources are
-           available. -->
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-source-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>attach-sources</id>
-            <phase>verify</phase>
-            <goals>
-              <goal>jar-no-fork</goal>
-              <goal>test-jar-no-fork</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <artifactId>maven-dependency-plugin</artifactId>
-        <version>${maven-dependency-plugin.version}</version>
-        <executions>
-          <execution>
-            <id>analyze</id>
-            <goals>
-              <goal>analyze-only</goal>
-            </goals>
-            <configuration>
-              <failOnWarning>true</failOnWarning>
-              <!-- ignore "unused but declared" warnings -->
-              <ignoredUnusedDeclaredDependencies>
-                <ignoredUnusedDeclaredDependency>org.slf4j:slf4j-log4j12</ignoredUnusedDeclaredDependency>
-                <ignoredUnusedDeclaredDependency>org.slf4j:slf4j-api</ignoredUnusedDeclaredDependency>
-              </ignoredUnusedDeclaredDependencies>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <!-- Create a standalone JAR capable of running the server -->
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-              <createDependencyReducedPom>false</createDependencyReducedPom>
-              <relocations>
-                <relocation>
-                  <pattern>com.beust</pattern>
-                  <shadedPattern>${shaded.pkg}.com.beust</shadedPattern>
-                </relocation>
-                <relocation>
-                  <pattern>com.fasterxml</pattern>
-                  <shadedPattern>${shaded.pkg}.com.fasterxml</shadedPattern>
-                </relocation>
-                <relocation>
-                  <pattern>com.google.common</pattern>
-                  <shadedPattern>${shaded.pkg}.com.google.common</shadedPattern>
-                </relocation>
-                <relocation>
-                  <pattern>com.google.protobuf</pattern>
-                  <shadedPattern>${shaded.pkg}.com.google.protobuf</shadedPattern>
-                </relocation>
-                <relocation>
-                  <pattern>javax.servlet</pattern>
-                  <shadedPattern>${shaded.pkg}.javax.servlet</shadedPattern>
-                </relocation>
-                <relocation>
-                  <pattern>org.apache.log4j</pattern>
-                  <shadedPattern>${shaded.pkg}.org.apache.log4j</shadedPattern>
-                </relocation>
-                <relocation>
-                  <pattern>org.eclipse.jetty</pattern>
-                  <shadedPattern>${shaded.pkg}.org.eclipse.jetty</shadedPattern>
-                </relocation>
-                <relocation>
-                  <pattern>org.slf4j</pattern>
-                  <shadedPattern>${shaded.pkg}.org.slf4j</shadedPattern>
-                </relocation>
-                <relocation>
-                  <pattern>org.apache.http</pattern>
-                  <shadedPattern>${shaded.pkg}.org.apache.http</shadedPattern>
-                </relocation>
-                <relocation>
-                  <pattern>org.apache.commons</pattern>
-                  <shadedPattern>${shaded.pkg}.org.apache.commons</shadedPattern>
-                </relocation>
-              </relocations>
-              <shadedArtifactAttached>true</shadedArtifactAttached>
-              <transformers>
-                <transformer implementation="org.apache.maven.plugins.shade.resource.ApacheNoticeResourceTransformer">
-                  <addHeader>false</addHeader>
-                </transformer>
-                <transformer implementation="org.apache.maven.plugins.shade.resource.DontIncludeResourceTransformer">
-                  <resources>
-                    <resource>LICENSE.txt</resource>
-                    <!-- Prevent the default LICENSE from conflicting with our custom LICENSE -->
-                    <resource>LICENSE</resource>
-                  </resources>
-                </transformer>
-                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
-                  <mainClass>org.apache.calcite.avatica.server.StandaloneServer</mainClass>
-                </transformer>
-                <!-- Use a custom LICENSE file -->
-                <transformer implementation="org.apache.maven.plugins.shade.resource.IncludeResourceTransformer">
-                  <resource>META-INF/LICENSE</resource>
-                  <file>src/main/shaded-resources/LICENSE</file>
-                </transformer>
-              </transformers>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.rat</groupId>
-        <artifactId>apache-rat-plugin</artifactId>
-        <configuration>
-          <excludes>
-            <exclude>src/main/resources/META-INF/services/java.sql.Driver</exclude>
-          </excludes>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-</project>

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/standalone-server/src/main/java/org/apache/calcite/avatica/standalone/StandaloneServer.java
----------------------------------------------------------------------
diff --git a/avatica/standalone-server/src/main/java/org/apache/calcite/avatica/standalone/StandaloneServer.java b/avatica/standalone-server/src/main/java/org/apache/calcite/avatica/standalone/StandaloneServer.java
deleted file mode 100644
index f658f5e..0000000
--- a/avatica/standalone-server/src/main/java/org/apache/calcite/avatica/standalone/StandaloneServer.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.standalone;
-
-import org.apache.calcite.avatica.jdbc.JdbcMeta;
-import org.apache.calcite.avatica.remote.Driver.Serialization;
-import org.apache.calcite.avatica.remote.LocalService;
-import org.apache.calcite.avatica.server.HttpServer;
-import org.apache.calcite.avatica.util.Unsafe;
-
-import com.beust.jcommander.IStringConverter;
-import com.beust.jcommander.JCommander;
-import com.beust.jcommander.Parameter;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Locale;
-
-/**
- * An Avatica server for arbitrary JDBC drivers.
- */
-public class StandaloneServer {
-  private static final Logger LOG = LoggerFactory.getLogger(StandaloneServer.class);
-
-  @Parameter(names = { "-u", "--url" }, required = true,
-      description = "JDBC driver url for the server")
-  private String url;
-
-  @Parameter(names = { "-p", "--port" }, required = false,
-      description = "Port the server should bind")
-  private int port = 0;
-
-  @Parameter(names = { "-s", "--serialization" }, required = false,
-      description = "Serialization method to use", converter = SerializationConverter.class)
-  private Serialization serialization = Serialization.PROTOBUF;
-
-  private HttpServer server;
-
-  public void start() {
-    if (null != server) {
-      LOG.error("The server was already started");
-      Unsafe.systemExit(ExitCodes.ALREADY_STARTED.ordinal());
-      return;
-    }
-
-    try {
-      JdbcMeta meta = new JdbcMeta(url);
-      LocalService service = new LocalService(meta);
-
-      // Construct the server
-      this.server = new HttpServer.Builder()
-          .withHandler(service, serialization)
-          .withPort(port)
-          .build();
-
-      // Then start it
-      server.start();
-
-      LOG.info("Started Avatica server on port {} with serialization {}", server.getPort(),
-          serialization);
-    } catch (Exception e) {
-      LOG.error("Failed to start Avatica server", e);
-      Unsafe.systemExit(ExitCodes.START_FAILED.ordinal());
-    }
-  }
-
-  public void stop() {
-    if (null != server) {
-      server.stop();
-      server = null;
-    }
-  }
-
-  public void join() throws InterruptedException {
-    server.join();
-  }
-
-  public static void main(String[] args) {
-    final StandaloneServer server = new StandaloneServer();
-    new JCommander(server, args);
-
-    server.start();
-
-    // Try to clean up when the server is stopped.
-    Runtime.getRuntime().addShutdownHook(
-        new Thread(new Runnable() {
-          @Override public void run() {
-            LOG.info("Stopping server");
-            server.stop();
-            LOG.info("Server stopped");
-          }
-        }));
-
-    try {
-      server.join();
-    } catch (InterruptedException e) {
-      // Reset interruption
-      Thread.currentThread().interrupt();
-      // And exit now.
-      return;
-    }
-  }
-
-  /**
-   * Converter from String to Serialization. Must be public for JCommander.
-   */
-  public static class SerializationConverter implements IStringConverter<Serialization> {
-    @Override public Serialization convert(String value) {
-      return Serialization.valueOf(value.toUpperCase(Locale.ROOT));
-    }
-  }
-
-  /**
-   * Codes for exit conditions
-   */
-  private enum ExitCodes {
-    NORMAL,
-    ALREADY_STARTED, // 1
-    START_FAILED;    // 2
-  }
-}
-
-// End StandaloneServer.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/standalone-server/src/main/java/org/apache/calcite/avatica/standalone/package-info.java
----------------------------------------------------------------------
diff --git a/avatica/standalone-server/src/main/java/org/apache/calcite/avatica/standalone/package-info.java b/avatica/standalone-server/src/main/java/org/apache/calcite/avatica/standalone/package-info.java
deleted file mode 100644
index 1adb260..0000000
--- a/avatica/standalone-server/src/main/java/org/apache/calcite/avatica/standalone/package-info.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * Avatica Server without any authentication for any JDBC driver.
- */
-@PackageMarker
-package org.apache.calcite.avatica.standalone;
-
-import org.apache.calcite.avatica.util.PackageMarker;
-
-// End package-info.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/standalone-server/src/main/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/avatica/standalone-server/src/main/resources/log4j.properties b/avatica/standalone-server/src/main/resources/log4j.properties
deleted file mode 100644
index 3a661ab..0000000
--- a/avatica/standalone-server/src/main/resources/log4j.properties
+++ /dev/null
@@ -1,24 +0,0 @@
-# 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.
-
-# Root logger is configured at INFO and is sent to A1
-log4j.rootLogger=INFO, A1
-
-# A1 goes to the console
-log4j.appender.A1=org.apache.calcite.avatica.standalone.shaded.org.apache.log4j.ConsoleAppender
-
-# Set the pattern for each log message
-log4j.appender.A1.layout=org.apache.calcite.avatica.standalone.shaded.org.apache.log4j.PatternLayout
-log4j.appender.A1.layout.ConversionPattern=%d{ISO8601} [%t] %-5p %c{2} - %m%n

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

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/tck/.gitignore
----------------------------------------------------------------------
diff --git a/avatica/tck/.gitignore b/avatica/tck/.gitignore
deleted file mode 100644
index b83d222..0000000
--- a/avatica/tck/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/target/

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/tck/README.md
----------------------------------------------------------------------
diff --git a/avatica/tck/README.md b/avatica/tck/README.md
deleted file mode 100644
index d8025ef..0000000
--- a/avatica/tck/README.md
+++ /dev/null
@@ -1,80 +0,0 @@
-<!--
-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.
--->
-
-# Apache Calcite Avatica Technology Compatibility Kit (TCK)
-
-The Avatica TCK is a framework to test the compatibilty between
-various versions of Avatica clients and servers.
-
-The TCK is configured by a YAML file which specifies a TCK framework
-jar and a list of Avatica client and server versions. Each version
-must specify the path to a client jar, the URL of the server for
-that version, and a template for the JDBC url.
-
-An example YAML configuration file is provided ([example_config.yml][example-config-yml])
-which can be used as a starting point for users to fill out. Most elements are
-straightforward to understand; however, it does require that you provide a URL
-to a running Avatica server for each version to be tested.
-
-## Running a standalone Avatica server
-
-To make it easy to run a standalone Avatica server, an instance of the Avatica
-server running against an in-memory SQL database (HSQLDB) is provided starting
-in version 1.8.0. The `avatica-hsqldb-server-1.8.0-SNAPSHOT-shaded.jar` artifact
-can be used to start an Avatica server on a random port (printed to the console).
-
-  `java -jar avatica-hsqldb-server-1.8.0-SNAPSHOT-shaded.jar`
-
-For convenience in testing against earlier versions of Avatica, the following
-repository can be used to simplify building the same instance of a standalone
-HSQLDB-backed Avatica server https://github.com/joshelser/legacy-avatica-hsqldb-server
-
-Follow the instructions in the [README][legacy-readme] to build a standalone jar
-against a specific version of Calcite/Avatica which can be used as specified above.
-
-## Running the TCK
-
-A ruby script, [test_runner.rb][test-runner-script] is provided which consumes the modified YAML configuration
-file. This script will first run each provided version against itself as a sanity
-check for the tests itself (as the scope of what is implemented in Avatica does
-change over time), and then enumerate all possible combinations of client and server
-version.
-
-  `./test_runner.rb my_tck_config.yml`
-
-For example, if versions 1.6.0, 1.7.1 and 1.8.0-SNAPSHOT are defined in the YAML configuration
-file, the following identity tests will be run from client to server:
-
-* 1.6.0 to 1.6.0
-* 1.7.1 to 1.7.1
-* 1.8.0-SNAPSHOT to 1.8.0-SNAPSHOT
-
-while the following tests will be run for cross-version compatibility:
-
-* 1.6.0 to 1.7.1
-* 1.6.0 to 1.8.0-SNAPSHOT
-* 1.7.1 to 1.6.0
-* 1.7.1 to 1.8.0-SNAPSHOT
-* 1.8.0-SNAPSHOT to 1.6.0
-* 1.8.0-SNAPSHOT to 1.7.1
-
-Any errors encountered will be printed to the terminal. The final output of the script
-will be a summary of both the identity tests and the cross-version tests for easy consumption.
-
-[example-config-yml]: https://github.com/apache/calcite/tree/master/avatica/tck/src/main/resources/example_config.yml
-[legacy-readme]: https://github.com/joshelser/legacy-avatica-hsqldb-server/blob/master/README.md
-[test-runner-script]: https://github.com/apache/calcite/tree/master/avatica/tck/src/main/ruby/test_runner.rb

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/tck/pom.xml
----------------------------------------------------------------------
diff --git a/avatica/tck/pom.xml b/avatica/tck/pom.xml
deleted file mode 100644
index a863a6d..0000000
--- a/avatica/tck/pom.xml
+++ /dev/null
@@ -1,224 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <parent>
-    <groupId>org.apache.calcite.avatica</groupId>
-    <artifactId>avatica-parent</artifactId>
-    <version>1.10.0-SNAPSHOT</version>
-  </parent>
-
-  <artifactId>avatica-tck</artifactId>
-  <packaging>jar</packaging>
-  <name>Apache Calcite Avatica Compatibility Kit</name>
-  <description>Library for testing compatibility of Avatica across versions.</description>
-
-  <properties>
-    <top.dir>${project.basedir}/..</top.dir>
-  </properties>
-
-  <dependencies>
-    <!-- Sorted by groupId, artifactId; calcite dependencies first. Put versions
-         in dependencyManagement in the root POM, not here. -->
-    <dependency>
-      <groupId>com.beust</groupId>
-      <artifactId>jcommander</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>com.google.guava</groupId>
-      <artifactId>guava</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.hamcrest</groupId>
-      <artifactId>hamcrest-core</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.hsqldb</groupId>
-      <artifactId>hsqldb</artifactId>
-    </dependency>
-    <!-- As long as we want to run compatibility checks again 1.6.0, we have to include these because
-         they weren't yet provided by the avatica client jar -->
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-api</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-log4j12</artifactId>
-    </dependency>
-  </dependencies>
-
-  <build>
-    <pluginManagement>
-      <plugins>
-        <plugin>
-          <groupId>org.eclipse.m2e</groupId>
-          <artifactId>lifecycle-mapping</artifactId>
-          <version>1.0.0</version>
-          <configuration>
-            <lifecycleMappingMetadata>
-              <pluginExecutions>
-                <pluginExecution>
-                  <pluginExecutionFilter>
-                    <groupId>org.apache.maven.plugins</groupId>
-                    <artifactId>maven-checkstyle-plugin</artifactId>
-                    <versionRange>[2.12.1,)</versionRange>
-                    <goals>
-                      <goal>check</goal>
-                    </goals>
-                  </pluginExecutionFilter>
-                  <action>
-                    <ignore />
-                  </action>
-                </pluginExecution>
-              </pluginExecutions>
-            </lifecycleMappingMetadata>
-          </configuration>
-        </plugin>
-      </plugins>
-    </pluginManagement>
-    <plugins>
-      <!-- Parent module has the same plugin and does the work of
-           generating -sources.jar for each project. But without the
-           plugin declared here, IDEs don't know the sources are
-           available. -->
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-source-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>attach-sources</id>
-            <phase>verify</phase>
-            <goals>
-              <goal>jar-no-fork</goal>
-              <goal>test-jar-no-fork</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <!-- Create a standalone JAR capable of running the server -->
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-              <artifactSet>
-                <excludes>
-                  <exclude>com.google.protobuf:protobuf-java</exclude>
-                  <exclude>org.apache.httpcomponents:*</exclude>
-                  <exclude>commons-codec:commons-codec</exclude>
-                </excludes>
-                </artifactSet>
-              <createDependencyReducedPom>false</createDependencyReducedPom>
-              <relocations>
-                <relocation>
-                  <pattern>com.beust</pattern>
-                  <shadedPattern>org.apache.calcite.avatica.tck.shaded.com.beust</shadedPattern>
-                </relocation>
-                <relocation>
-                  <pattern>com.fasterxml</pattern>
-                  <shadedPattern>org.apache.calcite.avatica.tck.shaded.com.fasterxml</shadedPattern>
-                </relocation>
-                <relocation>
-                  <pattern>com.google.common</pattern>
-                  <shadedPattern>org.apache.calcite.avatica.tck.shaded.com.google.common</shadedPattern>
-                </relocation>
-                <relocation>
-                  <pattern>javax.servlet</pattern>
-                  <shadedPattern>org.apache.calcite.avatica.tck.shaded.javax.servlet</shadedPattern>
-                </relocation>
-                <relocation>
-                  <pattern>junit</pattern>
-                  <shadedPattern>org.apache.calcite.avatica.tck.shaded.junit</shadedPattern>
-                </relocation>
-                <relocation>
-                  <pattern>net.hydromatic</pattern>
-                  <shadedPattern>org.apache.calcite.avatica.tck.shaded.net.hydromatic</shadedPattern>
-                </relocation>
-                <!-- We bundle a log4j.properties file which will be looking in this relocated location -->
-                <relocation>
-                  <pattern>org.apache.log4j</pattern>
-                  <shadedPattern>org.apache.calcite.avatica.tck.shaded.org.apache.log4j</shadedPattern>
-                </relocation>
-                <relocation>
-                  <pattern>org.eclipse.jetty</pattern>
-                  <shadedPattern>org.apache.calcite.avatica.tck.shaded.org.eclipse.jetty</shadedPattern>
-                </relocation>
-                <relocation>
-                  <pattern>org.hamcrest</pattern>
-                  <shadedPattern>org.apache.calcite.avatica.tck.shaded.org.hamcrest</shadedPattern>
-                </relocation>
-                <relocation>
-                  <pattern>org.hsqldb</pattern>
-                  <shadedPattern>org.apache.calcite.avatica.tck.shaded.org.hsqldb</shadedPattern>
-                </relocation>
-                <relocation>
-                  <pattern>org.junit</pattern>
-                  <shadedPattern>org.apache.calcite.avatica.tck.shaded.org.junit</shadedPattern>
-                </relocation>
-                <!-- Intentionally not shading slf4j as it would break -->
-              </relocations>
-              <shadedArtifactAttached>true</shadedArtifactAttached>
-              <transformers>
-                <transformer implementation="org.apache.maven.plugins.shade.resource.ApacheNoticeResourceTransformer">
-                    <addHeader>false</addHeader>
-                </transformer>
-                <transformer implementation="org.apache.maven.plugins.shade.resource.DontIncludeResourceTransformer">
-                  <resources>
-                    <resource>LICENSE.txt</resource>
-                  </resources>
-                </transformer>
-              </transformers>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <artifactId>maven-dependency-plugin</artifactId>
-        <version>${maven-dependency-plugin.version}</version>
-        <executions>
-          <execution>
-            <id>analyze</id>
-            <goals>
-              <goal>analyze-only</goal>
-            </goals>
-            <configuration>
-              <failOnWarning>true</failOnWarning>
-              <!-- ignore "unused but declared" warnings -->
-              <ignoredUnusedDeclaredDependencies>
-                <ignoredUnusedDeclaredDependency>org.hamcrest:hamcrest-core</ignoredUnusedDeclaredDependency>
-                <ignoredUnusedDeclaredDependency>org.hsqldb:hsqldb</ignoredUnusedDeclaredDependency>
-                <ignoredUnusedDeclaredDependency>org.slf4j:slf4j-log4j12</ignoredUnusedDeclaredDependency>
-                <ignoredUnusedDeclaredDependency>org.slf4j:slf4j-api</ignoredUnusedDeclaredDependency>
-              </ignoredUnusedDeclaredDependencies>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-</project>

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/tck/src/main/java/org/apache/calcite/avatica/tck/PackageMarker.java
----------------------------------------------------------------------
diff --git a/avatica/tck/src/main/java/org/apache/calcite/avatica/tck/PackageMarker.java b/avatica/tck/src/main/java/org/apache/calcite/avatica/tck/PackageMarker.java
deleted file mode 100644
index cb64e93..0000000
--- a/avatica/tck/src/main/java/org/apache/calcite/avatica/tck/PackageMarker.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.tck;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * This is a dummy annotation that forces javac to produce output for
- * otherwise empty package-info.java.
- *
- * <p>The result is maven-compiler-plugin can properly identify the scope of
- * changed files
- *
- * <p>See more details in
- * <a href="https://jira.codehaus.org/browse/MCOMPILER-205">
- *   maven-compiler-plugin: incremental compilation broken</a>
- */
-@Retention(RetentionPolicy.SOURCE)
-public @interface PackageMarker {
-}
-
-// End PackageMarker.java


[08/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableRules.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableRules.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableRules.java
deleted file mode 100644
index 29ee347..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableRules.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.plan.RelOptRule;
-import org.apache.calcite.util.trace.CalciteTrace;
-
-import org.slf4j.Logger;
-
-/**
- * Rules and relational operators for the
- * {@link EnumerableConvention enumerable calling convention}.
- */
-public class EnumerableRules {
-  protected static final Logger LOGGER = CalciteTrace.getPlannerTracer();
-
-  public static final boolean BRIDGE_METHODS = true;
-
-  public static final RelOptRule ENUMERABLE_JOIN_RULE =
-      new EnumerableJoinRule();
-
-  public static final RelOptRule ENUMERABLE_MERGE_JOIN_RULE =
-      new EnumerableMergeJoinRule();
-
-  public static final RelOptRule ENUMERABLE_SEMI_JOIN_RULE =
-      new EnumerableSemiJoinRule();
-
-  public static final RelOptRule ENUMERABLE_CORRELATE_RULE =
-      new EnumerableCorrelateRule();
-
-  private EnumerableRules() {
-  }
-
-  public static final EnumerableProjectRule ENUMERABLE_PROJECT_RULE =
-      new EnumerableProjectRule();
-
-  public static final EnumerableFilterRule ENUMERABLE_FILTER_RULE =
-      new EnumerableFilterRule();
-
-  public static final EnumerableCalcRule ENUMERABLE_CALC_RULE =
-      new EnumerableCalcRule();
-
-  public static final EnumerableAggregateRule ENUMERABLE_AGGREGATE_RULE =
-      new EnumerableAggregateRule();
-
-  public static final EnumerableSortRule ENUMERABLE_SORT_RULE =
-      new EnumerableSortRule();
-
-  public static final EnumerableLimitRule ENUMERABLE_LIMIT_RULE =
-      new EnumerableLimitRule();
-
-  public static final EnumerableUnionRule ENUMERABLE_UNION_RULE =
-      new EnumerableUnionRule();
-
-  public static final EnumerableIntersectRule ENUMERABLE_INTERSECT_RULE =
-      new EnumerableIntersectRule();
-
-  public static final EnumerableMinusRule ENUMERABLE_MINUS_RULE =
-      new EnumerableMinusRule();
-
-  public static final EnumerableTableModifyRule
-  ENUMERABLE_TABLE_MODIFICATION_RULE = new EnumerableTableModifyRule();
-
-  public static final EnumerableValuesRule ENUMERABLE_VALUES_RULE =
-      new EnumerableValuesRule();
-
-  public static final EnumerableWindowRule ENUMERABLE_WINDOW_RULE =
-      new EnumerableWindowRule();
-
-  public static final EnumerableCollectRule ENUMERABLE_COLLECT_RULE =
-      new EnumerableCollectRule();
-
-  public static final EnumerableUncollectRule ENUMERABLE_UNCOLLECT_RULE =
-      new EnumerableUncollectRule();
-
-  public static final EnumerableFilterToCalcRule
-  ENUMERABLE_FILTER_TO_CALC_RULE = new EnumerableFilterToCalcRule();
-
-  public static final EnumerableProjectToCalcRule
-  ENUMERABLE_PROJECT_TO_CALC_RULE = new EnumerableProjectToCalcRule();
-
-  public static final EnumerableTableScanRule ENUMERABLE_TABLE_SCAN_RULE =
-      new EnumerableTableScanRule();
-
-  public static final EnumerableTableFunctionScanRule
-  ENUMERABLE_TABLE_FUNCTION_SCAN_RULE = new EnumerableTableFunctionScanRule();
-}
-
-// End EnumerableRules.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableSemiJoin.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableSemiJoin.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableSemiJoin.java
deleted file mode 100644
index 0162c51..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableSemiJoin.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.linq4j.tree.BlockBuilder;
-import org.apache.calcite.linq4j.tree.Expression;
-import org.apache.calcite.linq4j.tree.Expressions;
-import org.apache.calcite.plan.RelOptCluster;
-import org.apache.calcite.plan.RelOptCost;
-import org.apache.calcite.plan.RelOptPlanner;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.InvalidRelException;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.core.JoinInfo;
-import org.apache.calcite.rel.core.JoinRelType;
-import org.apache.calcite.rel.core.SemiJoin;
-import org.apache.calcite.rel.metadata.RelMetadataQuery;
-import org.apache.calcite.rex.RexNode;
-import org.apache.calcite.util.BuiltInMethod;
-import org.apache.calcite.util.ImmutableIntList;
-import org.apache.calcite.util.Util;
-
-/** Implementation of {@link org.apache.calcite.rel.core.SemiJoin} in
- * {@link org.apache.calcite.adapter.enumerable.EnumerableConvention enumerable calling convention}. */
-public class EnumerableSemiJoin extends SemiJoin implements EnumerableRel {
-  /** Creates an EnumerableSemiJoin.
-   *
-   * <p>Use {@link #create} unless you know what you're doing. */
-  EnumerableSemiJoin(
-      RelOptCluster cluster,
-      RelTraitSet traits,
-      RelNode left,
-      RelNode right,
-      RexNode condition,
-      ImmutableIntList leftKeys,
-      ImmutableIntList rightKeys)
-      throws InvalidRelException {
-    super(cluster, traits, left, right, condition, leftKeys, rightKeys);
-  }
-
-  /** Creates an EnumerableSemiJoin. */
-  public static EnumerableSemiJoin create(RelNode left, RelNode right, RexNode condition,
-      ImmutableIntList leftKeys, ImmutableIntList rightKeys) {
-    final RelOptCluster cluster = left.getCluster();
-    try {
-      return new EnumerableSemiJoin(cluster,
-          cluster.traitSetOf(EnumerableConvention.INSTANCE), left,
-          right, condition, leftKeys, rightKeys);
-    } catch (InvalidRelException e) {
-      // Semantic error not possible. Must be a bug. Convert to
-      // internal error.
-      throw new AssertionError(e);
-    }
-  }
-
-  @Override public SemiJoin copy(RelTraitSet traitSet, RexNode condition,
-      RelNode left, RelNode right, JoinRelType joinType,
-      boolean semiJoinDone) {
-    assert joinType == JoinRelType.INNER;
-    final JoinInfo joinInfo = JoinInfo.of(left, right, condition);
-    assert joinInfo.isEqui();
-    try {
-      return new EnumerableSemiJoin(getCluster(), traitSet, left, right,
-          condition, joinInfo.leftKeys, joinInfo.rightKeys);
-    } catch (InvalidRelException e) {
-      // Semantic error not possible. Must be a bug. Convert to
-      // internal error.
-      throw new AssertionError(e);
-    }
-  }
-
-  @Override public RelOptCost computeSelfCost(RelOptPlanner planner,
-      RelMetadataQuery mq) {
-    double rowCount = mq.getRowCount(this);
-
-    // Right-hand input is the "build", and hopefully small, input.
-    final double rightRowCount = right.estimateRowCount(mq);
-    final double leftRowCount = left.estimateRowCount(mq);
-    if (Double.isInfinite(leftRowCount)) {
-      rowCount = leftRowCount;
-    } else {
-      rowCount += Util.nLogN(leftRowCount);
-    }
-    if (Double.isInfinite(rightRowCount)) {
-      rowCount = rightRowCount;
-    } else {
-      rowCount += rightRowCount;
-    }
-    return planner.getCostFactory().makeCost(rowCount, 0, 0).multiplyBy(.01d);
-  }
-
-  public Result implement(EnumerableRelImplementor implementor, Prefer pref) {
-    BlockBuilder builder = new BlockBuilder();
-    final Result leftResult =
-        implementor.visitChild(this, 0, (EnumerableRel) left, pref);
-    Expression leftExpression =
-        builder.append(
-            "left", leftResult.block);
-    final Result rightResult =
-        implementor.visitChild(this, 1, (EnumerableRel) right, pref);
-    Expression rightExpression =
-        builder.append(
-            "right", rightResult.block);
-    final PhysType physType = leftResult.physType;
-    return implementor.result(
-        physType,
-        builder.append(
-            Expressions.call(
-                BuiltInMethod.SEMI_JOIN.method,
-                Expressions.list(
-                    leftExpression,
-                    rightExpression,
-                    leftResult.physType.generateAccessor(leftKeys),
-                    rightResult.physType.generateAccessor(rightKeys))))
-            .toBlock());
-  }
-}
-
-// End EnumerableSemiJoin.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableSemiJoinRule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableSemiJoinRule.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableSemiJoinRule.java
deleted file mode 100644
index 96f4be7..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableSemiJoinRule.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.plan.Convention;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.convert.ConverterRule;
-import org.apache.calcite.rel.core.SemiJoin;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/** Planner rule that converts a
- * {@link org.apache.calcite.rel.core.SemiJoin} relational expression
- * {@link org.apache.calcite.adapter.enumerable.EnumerableConvention enumerable calling convention}. */
-class EnumerableSemiJoinRule extends ConverterRule {
-  EnumerableSemiJoinRule() {
-    super(SemiJoin.class, Convention.NONE, EnumerableConvention.INSTANCE,
-        "EnumerableSemiJoinRule");
-  }
-
-  @Override public RelNode convert(RelNode rel) {
-    final SemiJoin semiJoin = (SemiJoin) rel;
-    final List<RelNode> newInputs = new ArrayList<>();
-    for (RelNode input : semiJoin.getInputs()) {
-      if (!(input.getConvention() instanceof EnumerableConvention)) {
-        input =
-            convert(input,
-                input.getTraitSet().replace(EnumerableConvention.INSTANCE));
-      }
-      newInputs.add(input);
-    }
-    return EnumerableSemiJoin.create(newInputs.get(0), newInputs.get(1),
-        semiJoin.getCondition(), semiJoin.leftKeys, semiJoin.rightKeys);
-  }
-}
-
-// End EnumerableSemiJoinRule.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableSort.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableSort.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableSort.java
deleted file mode 100644
index 8046d64..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableSort.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.linq4j.tree.BlockBuilder;
-import org.apache.calcite.linq4j.tree.Expression;
-import org.apache.calcite.linq4j.tree.Expressions;
-import org.apache.calcite.plan.RelOptCluster;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.RelCollation;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.core.Sort;
-import org.apache.calcite.rex.RexNode;
-import org.apache.calcite.util.BuiltInMethod;
-import org.apache.calcite.util.Pair;
-
-/** Implementation of {@link org.apache.calcite.rel.core.Sort} in
- * {@link org.apache.calcite.adapter.enumerable.EnumerableConvention enumerable calling convention}. */
-public class EnumerableSort extends Sort implements EnumerableRel {
-  /**
-   * Creates an EnumerableSort.
-   *
-   * <p>Use {@link #create} unless you know what you're doing.
-   */
-  public EnumerableSort(RelOptCluster cluster, RelTraitSet traitSet,
-      RelNode input, RelCollation collation, RexNode offset, RexNode fetch) {
-    super(cluster, traitSet, input, collation, offset, fetch);
-    assert getConvention() instanceof EnumerableConvention;
-    assert getConvention() == input.getConvention();
-  }
-
-  /** Creates an EnumerableSort. */
-  public static EnumerableSort create(RelNode child, RelCollation collation,
-      RexNode offset, RexNode fetch) {
-    final RelOptCluster cluster = child.getCluster();
-    final RelTraitSet traitSet =
-        cluster.traitSetOf(EnumerableConvention.INSTANCE)
-            .replace(collation);
-    return new EnumerableSort(cluster, traitSet, child, collation, offset,
-        fetch);
-  }
-
-  @Override public EnumerableSort copy(
-      RelTraitSet traitSet,
-      RelNode newInput,
-      RelCollation newCollation,
-      RexNode offset,
-      RexNode fetch) {
-    return new EnumerableSort(getCluster(), traitSet, newInput, newCollation,
-        offset, fetch);
-  }
-
-  public Result implement(EnumerableRelImplementor implementor, Prefer pref) {
-    final BlockBuilder builder = new BlockBuilder();
-    final EnumerableRel child = (EnumerableRel) getInput();
-    final Result result = implementor.visitChild(this, 0, child, pref);
-    final PhysType physType =
-        PhysTypeImpl.of(
-            implementor.getTypeFactory(),
-            getRowType(),
-            result.format);
-    Expression childExp =
-        builder.append("child", result.block);
-
-    PhysType inputPhysType = result.physType;
-    final Pair<Expression, Expression> pair =
-        inputPhysType.generateCollationKey(
-            collation.getFieldCollations());
-
-    builder.add(
-        Expressions.return_(null,
-            Expressions.call(childExp,
-                BuiltInMethod.ORDER_BY.method,
-                Expressions.list(
-                    builder.append("keySelector", pair.left))
-                    .appendIfNotNull(
-                        builder.appendIfNotNull("comparator", pair.right)))));
-    return implementor.result(physType, builder.toBlock());
-  }
-}
-
-// End EnumerableSort.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableSortRule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableSortRule.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableSortRule.java
deleted file mode 100644
index eb3d737..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableSortRule.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.plan.Convention;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.convert.ConverterRule;
-import org.apache.calcite.rel.core.Sort;
-
-/**
- * Rule to convert an {@link org.apache.calcite.rel.core.Sort} to an
- * {@link EnumerableSort}.
- */
-class EnumerableSortRule extends ConverterRule {
-  EnumerableSortRule() {
-    super(Sort.class, Convention.NONE, EnumerableConvention.INSTANCE,
-        "EnumerableSortRule");
-  }
-
-  public RelNode convert(RelNode rel) {
-    final Sort sort = (Sort) rel;
-    if (sort.offset != null || sort.fetch != null) {
-      return null;
-    }
-    final RelNode input = sort.getInput();
-    return EnumerableSort.create(
-        convert(
-            input,
-            input.getTraitSet().replace(EnumerableConvention.INSTANCE)),
-        sort.getCollation(),
-        null,
-        null);
-  }
-}
-
-// End EnumerableSortRule.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableTableFunctionScan.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableTableFunctionScan.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableTableFunctionScan.java
deleted file mode 100644
index 90892fa..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableTableFunctionScan.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.adapter.java.JavaTypeFactory;
-import org.apache.calcite.linq4j.tree.BlockBuilder;
-import org.apache.calcite.linq4j.tree.Expression;
-import org.apache.calcite.linq4j.tree.Expressions;
-import org.apache.calcite.plan.RelOptCluster;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.core.TableFunctionScan;
-import org.apache.calcite.rel.metadata.RelColumnMapping;
-import org.apache.calcite.rel.type.RelDataType;
-import org.apache.calcite.rex.RexCall;
-import org.apache.calcite.rex.RexNode;
-import org.apache.calcite.schema.QueryableTable;
-import org.apache.calcite.schema.impl.TableFunctionImpl;
-import org.apache.calcite.sql.validate.SqlUserDefinedTableFunction;
-import org.apache.calcite.util.BuiltInMethod;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Type;
-import java.util.List;
-import java.util.Set;
-
-/** Implementation of {@link org.apache.calcite.rel.core.TableFunctionScan} in
- * {@link org.apache.calcite.adapter.enumerable.EnumerableConvention enumerable calling convention}. */
-public class EnumerableTableFunctionScan extends TableFunctionScan
-    implements EnumerableRel {
-
-  public EnumerableTableFunctionScan(RelOptCluster cluster,
-      RelTraitSet traits, List<RelNode> inputs, Type elementType,
-      RelDataType rowType, RexNode call,
-      Set<RelColumnMapping> columnMappings) {
-    super(cluster, traits, inputs, call, elementType, rowType,
-      columnMappings);
-  }
-
-  @Override public EnumerableTableFunctionScan copy(
-      RelTraitSet traitSet,
-      List<RelNode> inputs,
-      RexNode rexCall,
-      Type elementType,
-      RelDataType rowType,
-      Set<RelColumnMapping> columnMappings) {
-    return new EnumerableTableFunctionScan(getCluster(), traitSet, inputs,
-        elementType, rowType, rexCall, columnMappings);
-  }
-
-  public Result implement(EnumerableRelImplementor implementor, Prefer pref) {
-    BlockBuilder bb = new BlockBuilder();
-     // Non-array user-specified types are not supported yet
-    final JavaRowFormat format;
-    boolean array = false;
-    if (getElementType() == null) {
-      format = JavaRowFormat.ARRAY;
-    } else if (rowType.getFieldCount() == 1 && isQueryable()) {
-      format = JavaRowFormat.SCALAR;
-    } else if (getElementType() instanceof Class
-        && Object[].class.isAssignableFrom((Class) getElementType())) {
-      array = true;
-      format = JavaRowFormat.ARRAY;
-    } else {
-      format = JavaRowFormat.CUSTOM;
-    }
-    final PhysType physType =
-        PhysTypeImpl.of(implementor.getTypeFactory(), getRowType(), format,
-            false);
-    RexToLixTranslator t = RexToLixTranslator.forAggregation(
-        (JavaTypeFactory) getCluster().getTypeFactory(), bb, null);
-    t = t.setCorrelates(implementor.allCorrelateVariables);
-    Expression translated = t.translate(getCall());
-    if (array && rowType.getFieldCount() == 1) {
-      translated =
-          Expressions.call(null, BuiltInMethod.SLICE0.method, translated);
-    }
-    bb.add(Expressions.return_(null, translated));
-    return implementor.result(physType, bb.toBlock());
-  }
-
-  private boolean isQueryable() {
-    if (!(getCall() instanceof RexCall)) {
-      return false;
-    }
-    final RexCall call = (RexCall) getCall();
-    if (!(call.getOperator() instanceof SqlUserDefinedTableFunction)) {
-      return false;
-    }
-    final SqlUserDefinedTableFunction udtf =
-        (SqlUserDefinedTableFunction) call.getOperator();
-    if (!(udtf.getFunction() instanceof TableFunctionImpl)) {
-      return false;
-    }
-    final TableFunctionImpl tableFunction =
-        (TableFunctionImpl) udtf.getFunction();
-    final Method method = tableFunction.method;
-    return QueryableTable.class.isAssignableFrom(method.getReturnType());
-  }
-}
-
-// End EnumerableTableFunctionScan.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableTableFunctionScanRule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableTableFunctionScanRule.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableTableFunctionScanRule.java
deleted file mode 100644
index 5d06c18..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableTableFunctionScanRule.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.plan.Convention;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.convert.ConverterRule;
-import org.apache.calcite.rel.logical.LogicalTableFunctionScan;
-
-/** Planner rule that converts a
- * {@link org.apache.calcite.rel.logical.LogicalTableFunctionScan}
- * relational expression
- * {@link org.apache.calcite.adapter.enumerable.EnumerableConvention enumerable calling convention}. */
-public class EnumerableTableFunctionScanRule extends ConverterRule {
-  public EnumerableTableFunctionScanRule() {
-    super(LogicalTableFunctionScan.class, Convention.NONE,
-        EnumerableConvention.INSTANCE, "EnumerableTableFunctionScanRule");
-  }
-
-  @Override public RelNode convert(RelNode rel) {
-    final RelTraitSet traitSet =
-        rel.getTraitSet().replace(EnumerableConvention.INSTANCE);
-    LogicalTableFunctionScan tbl = (LogicalTableFunctionScan) rel;
-    return new EnumerableTableFunctionScan(rel.getCluster(), traitSet,
-        tbl.getInputs(), tbl.getElementType(), tbl.getRowType(),
-        tbl.getCall(), tbl.getColumnMappings());
-  }
-}
-
-// End EnumerableTableFunctionScanRule.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableTableModify.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableTableModify.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableTableModify.java
deleted file mode 100644
index 14ac0de..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableTableModify.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.adapter.java.JavaTypeFactory;
-import org.apache.calcite.linq4j.tree.BlockBuilder;
-import org.apache.calcite.linq4j.tree.Expression;
-import org.apache.calcite.linq4j.tree.Expressions;
-import org.apache.calcite.linq4j.tree.ParameterExpression;
-import org.apache.calcite.linq4j.tree.Types;
-import org.apache.calcite.plan.RelOptCluster;
-import org.apache.calcite.plan.RelOptTable;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.prepare.Prepare;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.core.TableModify;
-import org.apache.calcite.rex.RexNode;
-import org.apache.calcite.schema.ModifiableTable;
-import org.apache.calcite.util.BuiltInMethod;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-/** Implementation of {@link org.apache.calcite.rel.core.TableModify} in
- * {@link org.apache.calcite.adapter.enumerable.EnumerableConvention enumerable calling convention}. */
-public class EnumerableTableModify extends TableModify
-    implements EnumerableRel {
-  public EnumerableTableModify(RelOptCluster cluster, RelTraitSet traits,
-      RelOptTable table, Prepare.CatalogReader catalogReader, RelNode child,
-      Operation operation, List<String> updateColumnList,
-      List<RexNode> sourceExpressionList, boolean flattened) {
-    super(cluster, traits, table, catalogReader, child, operation,
-        updateColumnList, sourceExpressionList, flattened);
-    assert child.getConvention() instanceof EnumerableConvention;
-    assert getConvention() instanceof EnumerableConvention;
-    final ModifiableTable modifiableTable =
-        table.unwrap(ModifiableTable.class);
-    if (modifiableTable == null) {
-      throw new AssertionError(); // TODO: user error in validator
-    }
-  }
-
-  @Override public RelNode copy(RelTraitSet traitSet, List<RelNode> inputs) {
-    return new EnumerableTableModify(
-        getCluster(),
-        traitSet,
-        getTable(),
-        getCatalogReader(),
-        sole(inputs),
-        getOperation(),
-        getUpdateColumnList(),
-        getSourceExpressionList(),
-        isFlattened());
-  }
-
-  public Result implement(EnumerableRelImplementor implementor, Prefer pref) {
-    final BlockBuilder builder = new BlockBuilder();
-    final Result result = implementor.visitChild(
-        this, 0, (EnumerableRel) getInput(), pref);
-    Expression childExp =
-        builder.append(
-            "child", result.block);
-    final ParameterExpression collectionParameter =
-        Expressions.parameter(Collection.class,
-            builder.newName("collection"));
-    final Expression expression = table.getExpression(ModifiableTable.class);
-    assert expression != null; // TODO: user error in validator
-    assert ModifiableTable.class.isAssignableFrom(
-        Types.toClass(expression.getType())) : expression.getType();
-    builder.add(
-        Expressions.declare(
-            Modifier.FINAL,
-            collectionParameter,
-            Expressions.call(
-                expression,
-                BuiltInMethod.MODIFIABLE_TABLE_GET_MODIFIABLE_COLLECTION
-                    .method)));
-    final Expression countParameter =
-        builder.append(
-            "count",
-            Expressions.call(collectionParameter, "size"),
-            false);
-    Expression convertedChildExp;
-    if (!getInput().getRowType().equals(getRowType())) {
-      final JavaTypeFactory typeFactory =
-          (JavaTypeFactory) getCluster().getTypeFactory();
-      final JavaRowFormat format = EnumerableTableScan.deduceFormat(table);
-      PhysType physType =
-          PhysTypeImpl.of(typeFactory, table.getRowType(), format);
-      List<Expression> expressionList = new ArrayList<Expression>();
-      final PhysType childPhysType = result.physType;
-      final ParameterExpression o_ =
-          Expressions.parameter(childPhysType.getJavaRowType(), "o");
-      final int fieldCount =
-          childPhysType.getRowType().getFieldCount();
-      for (int i = 0; i < fieldCount; i++) {
-        expressionList.add(
-            childPhysType.fieldReference(o_, i, physType.getJavaFieldType(i)));
-      }
-      convertedChildExp =
-          builder.append(
-              "convertedChild",
-              Expressions.call(
-                  childExp,
-                  BuiltInMethod.SELECT.method,
-                  Expressions.lambda(
-                      physType.record(expressionList), o_)));
-    } else {
-      convertedChildExp = childExp;
-    }
-    final Method method;
-    switch (getOperation()) {
-    case INSERT:
-      method = BuiltInMethod.INTO.method;
-      break;
-    case DELETE:
-      method = BuiltInMethod.REMOVE_ALL.method;
-      break;
-    default:
-      throw new AssertionError(getOperation());
-    }
-    builder.add(
-        Expressions.statement(
-            Expressions.call(
-                convertedChildExp, method, collectionParameter)));
-    final Expression updatedCountParameter =
-        builder.append(
-            "updatedCount",
-            Expressions.call(collectionParameter, "size"),
-            false);
-    builder.add(
-        Expressions.return_(
-            null,
-            Expressions.call(
-                BuiltInMethod.SINGLETON_ENUMERABLE.method,
-                Expressions.convert_(
-                    Expressions.condition(
-                        Expressions.greaterThanOrEqual(
-                            updatedCountParameter, countParameter),
-                        Expressions.subtract(
-                            updatedCountParameter, countParameter),
-                        Expressions.subtract(
-                            countParameter, updatedCountParameter)),
-                    long.class))));
-    final PhysType physType =
-        PhysTypeImpl.of(
-            implementor.getTypeFactory(),
-            getRowType(),
-            pref == Prefer.ARRAY
-                ? JavaRowFormat.ARRAY : JavaRowFormat.SCALAR);
-    return implementor.result(physType, builder.toBlock());
-  }
-
-}
-
-// End EnumerableTableModify.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableTableModifyRule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableTableModifyRule.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableTableModifyRule.java
deleted file mode 100644
index 321115f..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableTableModifyRule.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.plan.Convention;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.convert.ConverterRule;
-import org.apache.calcite.rel.logical.LogicalTableModify;
-import org.apache.calcite.schema.ModifiableTable;
-
-/** Planner rule that converts a
- * {@link org.apache.calcite.rel.logical.LogicalTableModify}
- * relational expression
- * {@link org.apache.calcite.adapter.enumerable.EnumerableConvention enumerable calling convention}. */
-public class EnumerableTableModifyRule extends ConverterRule {
-  EnumerableTableModifyRule() {
-    super(LogicalTableModify.class, Convention.NONE,
-        EnumerableConvention.INSTANCE, "EnumerableTableModificationRule");
-  }
-
-  @Override public RelNode convert(RelNode rel) {
-    final LogicalTableModify modify =
-        (LogicalTableModify) rel;
-    final ModifiableTable modifiableTable =
-        modify.getTable().unwrap(ModifiableTable.class);
-    if (modifiableTable == null) {
-      return null;
-    }
-    final RelTraitSet traitSet =
-        modify.getTraitSet().replace(EnumerableConvention.INSTANCE);
-    return new EnumerableTableModify(
-        modify.getCluster(), traitSet,
-        modify.getTable(),
-        modify.getCatalogReader(),
-        convert(modify.getInput(), traitSet),
-        modify.getOperation(),
-        modify.getUpdateColumnList(),
-        modify.getSourceExpressionList(),
-        modify.isFlattened());
-  }
-}
-
-// End EnumerableTableModifyRule.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableTableScan.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableTableScan.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableTableScan.java
deleted file mode 100644
index 3b4d8a1..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableTableScan.java
+++ /dev/null
@@ -1,271 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.adapter.java.JavaTypeFactory;
-import org.apache.calcite.interpreter.Row;
-import org.apache.calcite.linq4j.Enumerable;
-import org.apache.calcite.linq4j.Queryable;
-import org.apache.calcite.linq4j.function.Function1;
-import org.apache.calcite.linq4j.tree.Blocks;
-import org.apache.calcite.linq4j.tree.Expression;
-import org.apache.calcite.linq4j.tree.Expressions;
-import org.apache.calcite.linq4j.tree.MethodCallExpression;
-import org.apache.calcite.linq4j.tree.ParameterExpression;
-import org.apache.calcite.linq4j.tree.Primitive;
-import org.apache.calcite.linq4j.tree.Types;
-import org.apache.calcite.plan.RelOptCluster;
-import org.apache.calcite.plan.RelOptTable;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.RelCollation;
-import org.apache.calcite.rel.RelCollationTraitDef;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.core.TableScan;
-import org.apache.calcite.rel.type.RelDataType;
-import org.apache.calcite.rel.type.RelDataTypeField;
-import org.apache.calcite.schema.FilterableTable;
-import org.apache.calcite.schema.ProjectableFilterableTable;
-import org.apache.calcite.schema.QueryableTable;
-import org.apache.calcite.schema.ScannableTable;
-import org.apache.calcite.schema.StreamableTable;
-import org.apache.calcite.schema.Table;
-import org.apache.calcite.util.BuiltInMethod;
-
-import com.google.common.base.Supplier;
-import com.google.common.collect.ImmutableList;
-
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.List;
-
-/** Implementation of {@link org.apache.calcite.rel.core.TableScan} in
- * {@link org.apache.calcite.adapter.enumerable.EnumerableConvention enumerable calling convention}. */
-public class EnumerableTableScan
-    extends TableScan
-    implements EnumerableRel {
-  private final Class elementType;
-
-  /** Creates an EnumerableTableScan.
-   *
-   * <p>Use {@link #create} unless you know what you are doing. */
-  public EnumerableTableScan(RelOptCluster cluster, RelTraitSet traitSet,
-      RelOptTable table, Class elementType) {
-    super(cluster, traitSet, table);
-    assert getConvention() instanceof EnumerableConvention;
-    this.elementType = elementType;
-  }
-
-  /** Creates an EnumerableTableScan. */
-  public static EnumerableTableScan create(RelOptCluster cluster,
-      RelOptTable relOptTable) {
-    final Table table = relOptTable.unwrap(Table.class);
-    Class elementType = EnumerableTableScan.deduceElementType(table);
-    final RelTraitSet traitSet =
-        cluster.traitSetOf(EnumerableConvention.INSTANCE)
-            .replaceIfs(RelCollationTraitDef.INSTANCE,
-                new Supplier<List<RelCollation>>() {
-                  public List<RelCollation> get() {
-                    if (table != null) {
-                      return table.getStatistic().getCollations();
-                    }
-                    return ImmutableList.of();
-                  }
-                });
-    return new EnumerableTableScan(cluster, traitSet, relOptTable, elementType);
-  }
-
-  @Override public boolean equals(Object obj) {
-    return obj == this
-        || obj instanceof EnumerableTableScan
-        && table.equals(((EnumerableTableScan) obj).table);
-  }
-
-  @Override public int hashCode() {
-    return table.hashCode();
-  }
-
-  /** Returns whether EnumerableTableScan can generate code to handle a
-   * particular variant of the Table SPI. */
-  public static boolean canHandle(Table table) {
-    // FilterableTable and ProjectableFilterableTable cannot be handled in
-    // enumerable convention because they might reject filters and those filters
-    // would need to be handled dynamically.
-    return table instanceof QueryableTable
-        || table instanceof ScannableTable;
-  }
-
-  public static Class deduceElementType(Table table) {
-    if (table instanceof QueryableTable) {
-      final QueryableTable queryableTable = (QueryableTable) table;
-      final Type type = queryableTable.getElementType();
-      if (type instanceof Class) {
-        return (Class) type;
-      } else {
-        return Object[].class;
-      }
-    } else if (table instanceof ScannableTable
-        || table instanceof FilterableTable
-        || table instanceof ProjectableFilterableTable
-        || table instanceof StreamableTable) {
-      return Object[].class;
-    } else {
-      return Object.class;
-    }
-  }
-
-  public static JavaRowFormat deduceFormat(RelOptTable table) {
-    final Class elementType = deduceElementType(table.unwrap(Table.class));
-    return elementType == Object[].class
-        ? JavaRowFormat.ARRAY
-        : JavaRowFormat.CUSTOM;
-  }
-
-  private Expression getExpression(PhysType physType) {
-    final Expression expression = table.getExpression(Queryable.class);
-    final Expression expression2 = toEnumerable(expression);
-    assert Types.isAssignableFrom(Enumerable.class, expression2.getType());
-    return toRows(physType, expression2);
-  }
-
-  private Expression toEnumerable(Expression expression) {
-    final Type type = expression.getType();
-    if (Types.isArray(type)) {
-      if (Types.toClass(type).getComponentType().isPrimitive()) {
-        expression =
-            Expressions.call(BuiltInMethod.AS_LIST.method, expression);
-      }
-      return Expressions.call(BuiltInMethod.AS_ENUMERABLE.method, expression);
-    } else if (Types.isAssignableFrom(Iterable.class, type)
-        && !Types.isAssignableFrom(Enumerable.class, type)) {
-      return Expressions.call(BuiltInMethod.AS_ENUMERABLE2.method,
-          expression);
-    } else if (Types.isAssignableFrom(Queryable.class, type)) {
-      // Queryable extends Enumerable, but it's too "clever", so we call
-      // Queryable.asEnumerable so that operations such as take(int) will be
-      // evaluated directly.
-      return Expressions.call(expression,
-          BuiltInMethod.QUERYABLE_AS_ENUMERABLE.method);
-    }
-    return expression;
-  }
-
-  private Expression toRows(PhysType physType, Expression expression) {
-    if (physType.getFormat() == JavaRowFormat.SCALAR
-        && Object[].class.isAssignableFrom(elementType)
-        && getRowType().getFieldCount() == 1
-        && (table.unwrap(ScannableTable.class) != null
-            || table.unwrap(FilterableTable.class) != null
-            || table.unwrap(ProjectableFilterableTable.class) != null)) {
-      return Expressions.call(BuiltInMethod.SLICE0.method, expression);
-    }
-    JavaRowFormat oldFormat = format();
-    if (physType.getFormat() == oldFormat && !hasCollectionField(rowType)) {
-      return expression;
-    }
-    final ParameterExpression row_ =
-        Expressions.parameter(elementType, "row");
-    final int fieldCount = table.getRowType().getFieldCount();
-    List<Expression> expressionList = new ArrayList<>(fieldCount);
-    for (int i = 0; i < fieldCount; i++) {
-      expressionList.add(fieldExpression(row_, i, physType, oldFormat));
-    }
-    return Expressions.call(expression,
-        BuiltInMethod.SELECT.method,
-        Expressions.lambda(Function1.class, physType.record(expressionList),
-            row_));
-  }
-
-  private Expression fieldExpression(ParameterExpression row_, int i,
-      PhysType physType, JavaRowFormat format) {
-    final Expression e =
-        format.field(row_, i, null, physType.getJavaFieldType(i));
-    final RelDataType relFieldType =
-        physType.getRowType().getFieldList().get(i).getType();
-    switch (relFieldType.getSqlTypeName()) {
-    case ARRAY:
-    case MULTISET:
-      // We can't represent a multiset or array as a List<Employee>, because
-      // the consumer does not know the element type.
-      // The standard element type is List.
-      // We need to convert to a List<List>.
-      final JavaTypeFactory typeFactory =
-          (JavaTypeFactory) getCluster().getTypeFactory();
-      final PhysType elementPhysType = PhysTypeImpl.of(
-          typeFactory, relFieldType.getComponentType(), JavaRowFormat.CUSTOM);
-      final MethodCallExpression e2 =
-          Expressions.call(BuiltInMethod.AS_ENUMERABLE2.method, e);
-      final RelDataType dummyType = this.rowType;
-      final Expression e3 =
-          elementPhysType.convertTo(e2,
-              PhysTypeImpl.of(typeFactory, dummyType, JavaRowFormat.LIST));
-      return Expressions.call(e3, BuiltInMethod.ENUMERABLE_TO_LIST.method);
-    default:
-      return e;
-    }
-  }
-
-  private JavaRowFormat format() {
-    int fieldCount = getRowType().getFieldCount();
-    if (fieldCount == 0) {
-      return JavaRowFormat.LIST;
-    }
-    if (Object[].class.isAssignableFrom(elementType)) {
-      return fieldCount == 1 ? JavaRowFormat.SCALAR : JavaRowFormat.ARRAY;
-    }
-    if (Row.class.isAssignableFrom(elementType)) {
-      return JavaRowFormat.ROW;
-    }
-    if (fieldCount == 1 && (Object.class == elementType
-          || Primitive.is(elementType)
-          || Number.class.isAssignableFrom(elementType))) {
-      return JavaRowFormat.SCALAR;
-    }
-    return JavaRowFormat.CUSTOM;
-  }
-
-  private boolean hasCollectionField(RelDataType rowType) {
-    for (RelDataTypeField field : rowType.getFieldList()) {
-      switch (field.getType().getSqlTypeName()) {
-      case ARRAY:
-      case MULTISET:
-        return true;
-      }
-    }
-    return false;
-  }
-
-  @Override public RelNode copy(RelTraitSet traitSet, List<RelNode> inputs) {
-    return new EnumerableTableScan(getCluster(), traitSet, table, elementType);
-  }
-
-  public Result implement(EnumerableRelImplementor implementor, Prefer pref) {
-    // Note that representation is ARRAY. This assumes that the table
-    // returns a Object[] for each record. Actually a Table<T> can
-    // return any type T. And, if it is a JdbcTable, we'd like to be
-    // able to generate alternate accessors that return e.g. synthetic
-    // records {T0 f0; T1 f1; ...} and don't box every primitive value.
-    final PhysType physType =
-        PhysTypeImpl.of(
-            implementor.getTypeFactory(),
-            getRowType(),
-            format());
-    final Expression expression = getExpression(physType);
-    return implementor.result(physType, Blocks.toBlock(expression));
-  }
-}
-
-// End EnumerableTableScan.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableTableScanRule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableTableScanRule.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableTableScanRule.java
deleted file mode 100644
index 416c01a..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableTableScanRule.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.linq4j.tree.Expression;
-import org.apache.calcite.plan.Convention;
-import org.apache.calcite.plan.RelOptTable;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.convert.ConverterRule;
-import org.apache.calcite.rel.logical.LogicalTableScan;
-import org.apache.calcite.schema.Table;
-
-/** Planner rule that converts a
- * {@link org.apache.calcite.rel.logical.LogicalTableFunctionScan}
- * relational expression
- * {@link EnumerableConvention enumerable calling convention}. */
-public class EnumerableTableScanRule extends ConverterRule {
-  public EnumerableTableScanRule() {
-    super(LogicalTableScan.class, Convention.NONE,
-        EnumerableConvention.INSTANCE, "EnumerableTableScanRule");
-  }
-
-  @Override public RelNode convert(RelNode rel) {
-    LogicalTableScan scan = (LogicalTableScan) rel;
-    final RelOptTable relOptTable = scan.getTable();
-    final Table table = relOptTable.unwrap(Table.class);
-    if (!EnumerableTableScan.canHandle(table)) {
-      return null;
-    }
-    final Expression expression = relOptTable.getExpression(Object.class);
-    if (expression == null) {
-      return null;
-    }
-    return EnumerableTableScan.create(scan.getCluster(), relOptTable);
-  }
-}
-
-// End EnumerableTableScanRule.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableThetaJoin.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableThetaJoin.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableThetaJoin.java
deleted file mode 100644
index dc400ad..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableThetaJoin.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.linq4j.function.Predicate2;
-import org.apache.calcite.linq4j.tree.BlockBuilder;
-import org.apache.calcite.linq4j.tree.Expression;
-import org.apache.calcite.linq4j.tree.Expressions;
-import org.apache.calcite.linq4j.tree.ParameterExpression;
-import org.apache.calcite.plan.RelOptCluster;
-import org.apache.calcite.plan.RelOptCost;
-import org.apache.calcite.plan.RelOptPlanner;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.InvalidRelException;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.core.CorrelationId;
-import org.apache.calcite.rel.core.Join;
-import org.apache.calcite.rel.core.JoinRelType;
-import org.apache.calcite.rel.metadata.RelMetadataQuery;
-import org.apache.calcite.rex.RexNode;
-import org.apache.calcite.rex.RexProgramBuilder;
-import org.apache.calcite.util.BuiltInMethod;
-import org.apache.calcite.util.Pair;
-
-import com.google.common.collect.ImmutableList;
-
-import java.util.Set;
-
-/** Implementation of {@link org.apache.calcite.rel.core.Join} in
- * {@link org.apache.calcite.adapter.enumerable.EnumerableConvention enumerable calling convention}
- * that allows conditions that are not just {@code =} (equals). */
-public class EnumerableThetaJoin extends Join implements EnumerableRel {
-  /** Creates an EnumerableThetaJoin. */
-  protected EnumerableThetaJoin(RelOptCluster cluster, RelTraitSet traits,
-      RelNode left, RelNode right, RexNode condition,
-      Set<CorrelationId> variablesSet, JoinRelType joinType)
-      throws InvalidRelException {
-    super(cluster, traits, left, right, condition, variablesSet, joinType);
-  }
-
-  @Deprecated // to be removed before 2.0
-  protected EnumerableThetaJoin(RelOptCluster cluster, RelTraitSet traits,
-      RelNode left, RelNode right, RexNode condition, JoinRelType joinType,
-      Set<String> variablesStopped) throws InvalidRelException {
-    this(cluster, traits, left, right, condition,
-        CorrelationId.setOf(variablesStopped), joinType);
-  }
-
-  @Override public EnumerableThetaJoin copy(RelTraitSet traitSet,
-      RexNode condition, RelNode left, RelNode right, JoinRelType joinType,
-      boolean semiJoinDone) {
-    try {
-      return new EnumerableThetaJoin(getCluster(), traitSet, left, right,
-          condition, variablesSet, joinType);
-    } catch (InvalidRelException e) {
-      // Semantic error not possible. Must be a bug. Convert to
-      // internal error.
-      throw new AssertionError(e);
-    }
-  }
-
-  @Override public RelOptCost computeSelfCost(RelOptPlanner planner,
-      RelMetadataQuery mq) {
-    double rowCount = mq.getRowCount(this);
-
-    // Joins can be flipped, and for many algorithms, both versions are viable
-    // and have the same cost. To make the results stable between versions of
-    // the planner, make one of the versions slightly more expensive.
-    switch (joinType) {
-    case RIGHT:
-      rowCount = addEpsilon(rowCount);
-      break;
-    default:
-      if (left.getId() > right.getId()) {
-        rowCount = addEpsilon(rowCount);
-      }
-    }
-
-    final double rightRowCount = right.estimateRowCount(mq);
-    final double leftRowCount = left.estimateRowCount(mq);
-    if (Double.isInfinite(leftRowCount)) {
-      rowCount = leftRowCount;
-    }
-    if (Double.isInfinite(rightRowCount)) {
-      rowCount = rightRowCount;
-    }
-    return planner.getCostFactory().makeCost(rowCount, 0, 0);
-  }
-
-  private double addEpsilon(double d) {
-    assert d >= 0d;
-    final double d0 = d;
-    if (d < 10) {
-      // For small d, adding 1 would change the value significantly.
-      d *= 1.001d;
-      if (d != d0) {
-        return d;
-      }
-    }
-    // For medium d, add 1. Keeps integral values integral.
-    ++d;
-    if (d != d0) {
-      return d;
-    }
-    // For large d, adding 1 might not change the value. Add .1%.
-    // If d is NaN, this still will probably not change the value. That's OK.
-    d *= 1.001d;
-    return d;
-  }
-
-  public Result implement(EnumerableRelImplementor implementor, Prefer pref) {
-    final BlockBuilder builder = new BlockBuilder();
-    final Result leftResult =
-        implementor.visitChild(this, 0, (EnumerableRel) left, pref);
-    Expression leftExpression =
-        builder.append("left", leftResult.block);
-    final Result rightResult =
-        implementor.visitChild(this, 1, (EnumerableRel) right, pref);
-    Expression rightExpression =
-        builder.append("right", rightResult.block);
-    final PhysType physType =
-        PhysTypeImpl.of(implementor.getTypeFactory(),
-            getRowType(),
-            pref.preferArray());
-    final BlockBuilder builder2 = new BlockBuilder();
-    return implementor.result(
-        physType,
-        builder.append(
-            Expressions.call(BuiltInMethod.THETA_JOIN.method,
-                leftExpression,
-                rightExpression,
-                predicate(implementor,
-                    builder2,
-                    leftResult.physType,
-                    rightResult.physType,
-                    condition),
-                EnumUtils.joinSelector(joinType,
-                    physType,
-                    ImmutableList.of(leftResult.physType,
-                        rightResult.physType)),
-                Expressions.constant(joinType.generatesNullsOnLeft()),
-                Expressions.constant(joinType.generatesNullsOnRight())))
-            .toBlock());
-  }
-
-  Expression predicate(EnumerableRelImplementor implementor,
-      BlockBuilder builder, PhysType leftPhysType, PhysType rightPhysType,
-      RexNode condition) {
-    final ParameterExpression left_ =
-        Expressions.parameter(leftPhysType.getJavaRowType(), "left");
-    final ParameterExpression right_ =
-        Expressions.parameter(rightPhysType.getJavaRowType(), "right");
-    final RexProgramBuilder program =
-        new RexProgramBuilder(
-            implementor.getTypeFactory().builder()
-                .addAll(left.getRowType().getFieldList())
-                .addAll(right.getRowType().getFieldList())
-                .build(),
-            getCluster().getRexBuilder());
-    program.addCondition(condition);
-    builder.add(
-        Expressions.return_(null,
-            RexToLixTranslator.translateCondition(program.getProgram(),
-                implementor.getTypeFactory(),
-                builder,
-                new RexToLixTranslator.InputGetterImpl(
-                    ImmutableList.of(Pair.of((Expression) left_, leftPhysType),
-                        Pair.of((Expression) right_, rightPhysType))),
-                implementor.allCorrelateVariables)));
-    return Expressions.lambda(Predicate2.class, builder.toBlock(), left_,
-        right_);
-  }
-}
-
-// End EnumerableThetaJoin.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableUncollect.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableUncollect.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableUncollect.java
deleted file mode 100644
index 9818622..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableUncollect.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.linq4j.tree.BlockBuilder;
-import org.apache.calcite.linq4j.tree.Expression;
-import org.apache.calcite.linq4j.tree.Expressions;
-import org.apache.calcite.plan.RelOptCluster;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.core.Uncollect;
-import org.apache.calcite.rel.type.RelDataType;
-import org.apache.calcite.rel.type.RelDataTypeField;
-import org.apache.calcite.runtime.SqlFunctions.FlatProductInputType;
-import org.apache.calcite.sql.type.MapSqlType;
-import org.apache.calcite.util.BuiltInMethod;
-
-import com.google.common.primitives.Ints;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/** Implementation of {@link org.apache.calcite.rel.core.Uncollect} in
- * {@link org.apache.calcite.adapter.enumerable.EnumerableConvention enumerable calling convention}. */
-public class EnumerableUncollect extends Uncollect implements EnumerableRel {
-  @Deprecated // to be removed before 2.0
-  public EnumerableUncollect(RelOptCluster cluster, RelTraitSet traitSet,
-      RelNode child) {
-    this(cluster, traitSet, child, false);
-  }
-
-  /** Creates an EnumerableUncollect.
-   *
-   * <p>Use {@link #create} unless you know what you're doing. */
-  public EnumerableUncollect(RelOptCluster cluster, RelTraitSet traitSet,
-      RelNode child, boolean withOrdinality) {
-    super(cluster, traitSet, child, withOrdinality);
-    assert getConvention() instanceof EnumerableConvention;
-    assert getConvention() == child.getConvention();
-  }
-
-  /**
-   * Creates an EnumerableUncollect.
-   *
-   * <p>Each field of the input relational expression must be an array or
-   * multiset.
-   *
-   * @param traitSet Trait set
-   * @param input    Input relational expression
-   * @param withOrdinality Whether output should contain an ORDINALITY column
-   */
-  public static EnumerableUncollect create(RelTraitSet traitSet, RelNode input,
-      boolean withOrdinality) {
-    final RelOptCluster cluster = input.getCluster();
-    return new EnumerableUncollect(cluster, traitSet, input, withOrdinality);
-  }
-
-  @Override public EnumerableUncollect copy(RelTraitSet traitSet,
-      RelNode newInput) {
-    return new EnumerableUncollect(getCluster(), traitSet, newInput,
-        withOrdinality);
-  }
-
-  public Result implement(EnumerableRelImplementor implementor, Prefer pref) {
-    final BlockBuilder builder = new BlockBuilder();
-    final EnumerableRel child = (EnumerableRel) getInput();
-    final Result result = implementor.visitChild(this, 0, child, pref);
-    final PhysType physType =
-        PhysTypeImpl.of(
-            implementor.getTypeFactory(),
-            getRowType(),
-            JavaRowFormat.LIST);
-
-    // final Enumerable<List<Employee>> child = <<child adapter>>;
-    // return child.selectMany(FLAT_PRODUCT);
-    final Expression child_ =
-        builder.append(
-            "child", result.block);
-
-    final List<Integer> fieldCounts = new ArrayList<>();
-    final List<FlatProductInputType> inputTypes = new ArrayList<>();
-
-    for (RelDataTypeField field : child.getRowType().getFieldList()) {
-      final RelDataType type = field.getType();
-      if (type instanceof MapSqlType) {
-        fieldCounts.add(2);
-        inputTypes.add(FlatProductInputType.MAP);
-      } else {
-        final RelDataType elementType = type.getComponentType();
-        if (elementType.isStruct()) {
-          fieldCounts.add(elementType.getFieldCount());
-          inputTypes.add(FlatProductInputType.LIST);
-        } else {
-          fieldCounts.add(-1);
-          inputTypes.add(FlatProductInputType.SCALAR);
-        }
-      }
-    }
-
-    final Expression lambda =
-        Expressions.call(BuiltInMethod.FLAT_PRODUCT.method,
-            Expressions.constant(Ints.toArray(fieldCounts)),
-            Expressions.constant(withOrdinality),
-            Expressions.constant(
-                inputTypes.toArray(new FlatProductInputType[inputTypes.size()])));
-    builder.add(
-        Expressions.return_(null,
-            Expressions.call(child_,
-                BuiltInMethod.SELECT_MANY.method,
-                lambda)));
-    return implementor.result(physType, builder.toBlock());
-  }
-
-}
-
-// End EnumerableUncollect.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableUncollectRule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableUncollectRule.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableUncollectRule.java
deleted file mode 100644
index 2687b1e..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableUncollectRule.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.plan.Convention;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.convert.ConverterRule;
-import org.apache.calcite.rel.core.Uncollect;
-
-/**
- * Rule to convert an {@link org.apache.calcite.rel.core.Uncollect} to an
- * {@link EnumerableUncollect}.
- */
-class EnumerableUncollectRule extends ConverterRule {
-  EnumerableUncollectRule() {
-    super(Uncollect.class, Convention.NONE, EnumerableConvention.INSTANCE,
-        "EnumerableUncollectRule");
-  }
-
-  public RelNode convert(RelNode rel) {
-    final Uncollect uncollect = (Uncollect) rel;
-    final RelTraitSet traitSet =
-        uncollect.getTraitSet().replace(EnumerableConvention.INSTANCE);
-    final RelNode input = uncollect.getInput();
-    final RelNode newInput = convert(input,
-        input.getTraitSet().replace(EnumerableConvention.INSTANCE));
-    return EnumerableUncollect.create(traitSet, newInput,
-        uncollect.withOrdinality);
-  }
-}
-
-// End EnumerableUncollectRule.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableUnion.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableUnion.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableUnion.java
deleted file mode 100644
index 2df6550..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableUnion.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.linq4j.Ord;
-import org.apache.calcite.linq4j.tree.BlockBuilder;
-import org.apache.calcite.linq4j.tree.Expression;
-import org.apache.calcite.linq4j.tree.Expressions;
-import org.apache.calcite.plan.RelOptCluster;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.core.Union;
-import org.apache.calcite.util.BuiltInMethod;
-
-import java.util.List;
-
-/** Implementation of {@link org.apache.calcite.rel.core.Union} in
- * {@link org.apache.calcite.adapter.enumerable.EnumerableConvention enumerable calling convention}. */
-public class EnumerableUnion extends Union implements EnumerableRel {
-  public EnumerableUnion(RelOptCluster cluster, RelTraitSet traitSet,
-      List<RelNode> inputs, boolean all) {
-    super(cluster, traitSet, inputs, all);
-  }
-
-  public EnumerableUnion copy(RelTraitSet traitSet, List<RelNode> inputs,
-      boolean all) {
-    return new EnumerableUnion(getCluster(), traitSet, inputs, all);
-  }
-
-  public Result implement(EnumerableRelImplementor implementor, Prefer pref) {
-    final BlockBuilder builder = new BlockBuilder();
-    Expression unionExp = null;
-    for (Ord<RelNode> ord : Ord.zip(inputs)) {
-      EnumerableRel input = (EnumerableRel) ord.e;
-      final Result result = implementor.visitChild(this, ord.i, input, pref);
-      Expression childExp =
-          builder.append(
-              "child" + ord.i,
-              result.block);
-
-      if (unionExp == null) {
-        unionExp = childExp;
-      } else {
-        unionExp = all
-            ? Expressions.call(unionExp, BuiltInMethod.CONCAT.method, childExp)
-            : Expressions.call(unionExp,
-                BuiltInMethod.UNION.method,
-                Expressions.list(childExp)
-                    .appendIfNotNull(result.physType.comparer()));
-      }
-
-      // Once the first input has chosen its format, ask for the same for
-      // other inputs.
-      pref = pref.of(result.format);
-    }
-
-    builder.add(unionExp);
-    final PhysType physType =
-        PhysTypeImpl.of(
-            implementor.getTypeFactory(),
-            getRowType(),
-            pref.prefer(JavaRowFormat.CUSTOM));
-    return implementor.result(physType, builder.toBlock());
-  }
-}
-
-// End EnumerableUnion.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableUnionRule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableUnionRule.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableUnionRule.java
deleted file mode 100644
index 42a97f1..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableUnionRule.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.plan.Convention;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.convert.ConverterRule;
-import org.apache.calcite.rel.logical.LogicalUnion;
-
-/**
- * Rule to convert an {@link org.apache.calcite.rel.logical.LogicalUnion} to an
- * {@link EnumerableUnion}.
- */
-class EnumerableUnionRule extends ConverterRule {
-  EnumerableUnionRule() {
-    super(LogicalUnion.class, Convention.NONE, EnumerableConvention.INSTANCE,
-        "EnumerableUnionRule");
-  }
-
-  public RelNode convert(RelNode rel) {
-    final LogicalUnion union = (LogicalUnion) rel;
-    final EnumerableConvention out = EnumerableConvention.INSTANCE;
-    final RelTraitSet traitSet = union.getTraitSet().replace(out);
-    return new EnumerableUnion(rel.getCluster(), traitSet,
-        convertList(union.getInputs(), out), union.all);
-  }
-}
-
-// End EnumerableUnionRule.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableValues.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableValues.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableValues.java
deleted file mode 100644
index 6023c02..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableValues.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.adapter.java.JavaTypeFactory;
-import org.apache.calcite.linq4j.tree.BlockBuilder;
-import org.apache.calcite.linq4j.tree.Expression;
-import org.apache.calcite.linq4j.tree.Expressions;
-import org.apache.calcite.linq4j.tree.Primitive;
-import org.apache.calcite.plan.RelOptCluster;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.RelCollation;
-import org.apache.calcite.rel.RelCollationTraitDef;
-import org.apache.calcite.rel.RelDistribution;
-import org.apache.calcite.rel.RelDistributionTraitDef;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.core.Values;
-import org.apache.calcite.rel.metadata.RelMdCollation;
-import org.apache.calcite.rel.metadata.RelMdDistribution;
-import org.apache.calcite.rel.metadata.RelMetadataQuery;
-import org.apache.calcite.rel.type.RelDataType;
-import org.apache.calcite.rel.type.RelDataTypeField;
-import org.apache.calcite.rex.RexLiteral;
-import org.apache.calcite.util.BuiltInMethod;
-import org.apache.calcite.util.Pair;
-
-import com.google.common.base.Supplier;
-import com.google.common.collect.ImmutableList;
-
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.List;
-
-/** Implementation of {@link org.apache.calcite.rel.core.Values} in
- * {@link org.apache.calcite.adapter.enumerable.EnumerableConvention enumerable calling convention}. */
-public class EnumerableValues extends Values implements EnumerableRel {
-  /** Creates an EnumerableValues. */
-  private EnumerableValues(RelOptCluster cluster, RelDataType rowType,
-      ImmutableList<ImmutableList<RexLiteral>> tuples, RelTraitSet traitSet) {
-    super(cluster, rowType, tuples, traitSet);
-  }
-
-  /** Creates an EnumerableValues. */
-  public static EnumerableValues create(RelOptCluster cluster,
-      final RelDataType rowType,
-      final ImmutableList<ImmutableList<RexLiteral>> tuples) {
-    final RelMetadataQuery mq = RelMetadataQuery.instance();
-    final RelTraitSet traitSet =
-        cluster.traitSetOf(EnumerableConvention.INSTANCE)
-            .replaceIfs(RelCollationTraitDef.INSTANCE,
-                new Supplier<List<RelCollation>>() {
-                  public List<RelCollation> get() {
-                    return RelMdCollation.values(mq, rowType, tuples);
-                  }
-                })
-            .replaceIf(RelDistributionTraitDef.INSTANCE,
-                new Supplier<RelDistribution>() {
-                  public RelDistribution get() {
-                    return RelMdDistribution.values(rowType, tuples);
-                  }
-                });
-    return new EnumerableValues(cluster, rowType, tuples, traitSet);
-  }
-
-  @Override public RelNode copy(RelTraitSet traitSet, List<RelNode> inputs) {
-    assert inputs.isEmpty();
-    return create(getCluster(), rowType, tuples);
-  }
-
-  public Result implement(EnumerableRelImplementor implementor, Prefer pref) {
-/*
-          return Linq4j.asEnumerable(
-              new Object[][] {
-                  new Object[] {1, 2},
-                  new Object[] {3, 4}
-              });
-*/
-    final JavaTypeFactory typeFactory =
-        (JavaTypeFactory) getCluster().getTypeFactory();
-    final BlockBuilder builder = new BlockBuilder();
-    final PhysType physType =
-        PhysTypeImpl.of(
-            implementor.getTypeFactory(),
-            getRowType(),
-            pref.preferCustom());
-    final Type rowClass = physType.getJavaRowType();
-
-    final List<Expression> expressions = new ArrayList<Expression>();
-    final List<RelDataTypeField> fields = rowType.getFieldList();
-    for (List<RexLiteral> tuple : tuples) {
-      final List<Expression> literals = new ArrayList<Expression>();
-      for (Pair<RelDataTypeField, RexLiteral> pair
-          : Pair.zip(fields, tuple)) {
-        literals.add(
-            RexToLixTranslator.translateLiteral(
-                pair.right,
-                pair.left.getType(),
-                typeFactory,
-                RexImpTable.NullAs.NULL));
-      }
-      expressions.add(physType.record(literals));
-    }
-    builder.add(
-        Expressions.return_(
-            null,
-            Expressions.call(
-                BuiltInMethod.AS_ENUMERABLE.method,
-                Expressions.newArrayInit(
-                    Primitive.box(rowClass), expressions))));
-    return implementor.result(physType, builder.toBlock());
-  }
-}
-
-// End EnumerableValues.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableValuesRule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableValuesRule.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableValuesRule.java
deleted file mode 100644
index 6e14bcc..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableValuesRule.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.plan.Convention;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.convert.ConverterRule;
-import org.apache.calcite.rel.logical.LogicalValues;
-
-/** Planner rule that converts a
- * {@link org.apache.calcite.rel.logical.LogicalValues}
- * relational expression
- * {@link org.apache.calcite.adapter.enumerable.EnumerableConvention enumerable calling convention}. */
-public class EnumerableValuesRule extends ConverterRule {
-  EnumerableValuesRule() {
-    super(LogicalValues.class, Convention.NONE, EnumerableConvention.INSTANCE,
-        "EnumerableValuesRule");
-  }
-
-  @Override public RelNode convert(RelNode rel) {
-    LogicalValues values = (LogicalValues) rel;
-    return EnumerableValues.create(values.getCluster(), values.getRowType(),
-        values.getTuples());
-  }
-}
-
-// End EnumerableValuesRule.java


[38/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/remote/KerberosConnection.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/KerberosConnection.java b/avatica/core/src/main/java/org/apache/calcite/avatica/remote/KerberosConnection.java
deleted file mode 100644
index da701dc..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/KerberosConnection.java
+++ /dev/null
@@ -1,400 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.lang.Thread.UncaughtExceptionHandler;
-import java.security.Principal;
-import java.util.AbstractMap;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map.Entry;
-import java.util.Objects;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import javax.security.auth.Subject;
-import javax.security.auth.kerberos.KerberosPrincipal;
-import javax.security.auth.kerberos.KerberosTicket;
-import javax.security.auth.login.AppConfigurationEntry;
-import javax.security.auth.login.Configuration;
-import javax.security.auth.login.LoginContext;
-import javax.security.auth.login.LoginException;
-
-/**
- * A utility to perform Kerberos logins and renewals.
- */
-public class KerberosConnection {
-  private static final Logger LOG = LoggerFactory.getLogger(KerberosConnection.class);
-
-  private static final String IBM_KRB5_LOGIN_MODULE =
-      "com.ibm.security.auth.module.Krb5LoginModule";
-  private static final String SUN_KRB5_LOGIN_MODULE =
-      "com.sun.security.auth.module.Krb5LoginModule";
-  private static final String JAAS_CONF_NAME = "AvaticaKeytabConf";
-  private static final String RENEWAL_THREAD_NAME = "Avatica Kerberos Renewal Thread";
-
-  /** The percentage of the Kerberos ticket's lifetime which we should start trying to renew it */
-  public static final float PERCENT_OF_LIFETIME_TO_RENEW = 0.80f;
-  /** How long should we sleep between checks to renew the Kerberos ticket */
-  public static final long RENEWAL_PERIOD = 30L;
-
-  private final String principal;
-  private final Configuration jaasConf;
-  private Subject subject;
-  private RenewalTask renewalTask;
-  private Thread renewalThread;
-
-  /**
-   * Constructs an instance.
-   *
-   * @param principal The Kerberos principal
-   * @param keytab The keytab containing keys for the Kerberos principal
-   */
-  public KerberosConnection(String principal, File keytab) {
-    this.principal = Objects.requireNonNull(principal);
-    this.jaasConf = new KeytabJaasConf(principal, Objects.requireNonNull(keytab));
-  }
-
-  public synchronized Subject getSubject() {
-    return this.subject;
-  }
-
-  /**
-   * Perform a Kerberos login and launch a daemon thread to periodically perfrom renewals of that
-   * Kerberos login. Exceptions are intentionally caught and rethrown as unchecked exceptions as
-   * there is nothing Avatica itself can do if the Kerberos login fails.
-   *
-   * @throws RuntimeException If the Kerberos login fails
-   */
-  public synchronized void login() {
-    final Entry<LoginContext, Subject> securityMaterial = performKerberosLogin();
-    subject = securityMaterial.getValue();
-    // Launch a thread to periodically perform renewals
-    final Entry<RenewalTask, Thread> renewalMaterial = createRenewalThread(
-        securityMaterial.getKey(), subject, KerberosConnection.RENEWAL_PERIOD);
-    renewalTask = renewalMaterial.getKey();
-    renewalThread = renewalMaterial.getValue();
-    renewalThread.start();
-  }
-
-  /**
-   * Performs a Kerberos login given the {@code principal} and {@code keytab}.
-   *
-   * @return The {@code Subject} and {@code LoginContext} from the successful login.
-   * @throws RuntimeException if the login failed
-   */
-  Entry<LoginContext, Subject> performKerberosLogin() {
-    // Loosely based on Apache Kerby's JaasKrbUtil class
-    // Synchronized by the caller
-
-    // Create a KerberosPrincipal given the principal.
-    final Set<Principal> principals = new HashSet<Principal>();
-    principals.add(new KerberosPrincipal(principal));
-
-    final Subject subject = new Subject(false, principals, new HashSet<Object>(),
-        new HashSet<Object>());
-
-    try {
-      return login(null, jaasConf, subject);
-    } catch (Exception e) {
-      throw new RuntimeException("Failed to perform Kerberos login");
-    }
-  }
-
-  /**
-   * Performs a kerberos login, possibly logging out first.
-   *
-   * @param prevContext The LoginContext from the previous login, or null
-   * @param conf JAAS Configuration object
-   * @param subject The JAAS Subject
-   * @return The context and subject from the login
-   * @throws LoginException If the login failed.
-   */
-  Entry<LoginContext, Subject> login(LoginContext prevContext, Configuration conf,
-      Subject subject) throws LoginException {
-    // Is synchronized by the caller
-
-    // If a context was provided, perform a logout first
-    if (null != prevContext) {
-      prevContext.logout();
-    }
-
-    // Create a LoginContext given the Configuration and Subject
-    LoginContext loginContext = createLoginContext(conf);
-    // Invoke the login
-    loginContext.login();
-    // Get the Subject from the context and verify it's non-null (null would imply failure)
-    Subject loggedInSubject = loginContext.getSubject();
-    if (null == loggedInSubject) {
-      throw new RuntimeException("Failed to perform Kerberos login");
-    }
-
-    // Send it back to the caller to use with launchRenewalThread
-    return new AbstractMap.SimpleEntry<>(loginContext, loggedInSubject);
-  }
-
-  // Enables mocking for unit tests
-  LoginContext createLoginContext(Configuration conf) throws LoginException {
-    return new LoginContext(JAAS_CONF_NAME, subject, null, conf);
-  }
-
-  /**
-   * Launches a thread to periodically check the current ticket's lifetime and perform a relogin
-   * as necessary.
-   *
-   * @param originalContext The original login's context.
-   * @param originalSubject The original login's subject.
-   * @param renewalPeriod The amount of time to sleep inbetween checks to renew
-   */
-  Entry<RenewalTask, Thread> createRenewalThread(LoginContext originalContext,
-      Subject originalSubject, long renewalPeriod) {
-    RenewalTask task = new RenewalTask(this, originalContext, originalSubject, jaasConf,
-        renewalPeriod);
-    Thread t = new Thread(task);
-
-    // Don't prevent the JVM from existing
-    t.setDaemon(true);
-    // Log an error message if this thread somehow dies
-    t.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
-      @Override public void uncaughtException(Thread t, Throwable e) {
-        LOG.error("Uncaught exception from Kerberos credential renewal thread", e);
-      }
-    });
-    t.setName(RENEWAL_THREAD_NAME);
-
-    return new AbstractMap.SimpleEntry<>(task, t);
-  }
-
-  /**
-   * Stops the Kerberos renewal thread if it is still running. If the thread was already started
-   * or never started, this method does nothing.
-   */
-  public void stopRenewalThread() {
-    if (null != renewalTask && null != renewalThread) {
-      LOG.debug("Informing RenewalTask to gracefully stop and interrupting the renewal thread.");
-      renewalTask.asyncStop();
-
-      long now = System.currentTimeMillis();
-      long until = now + 5000;
-      while (now < until) {
-        if (renewalThread.isAlive()) {
-          try {
-            Thread.sleep(500);
-          } catch (InterruptedException e) {
-            Thread.currentThread().interrupt();
-            return;
-          }
-
-          now = System.currentTimeMillis();
-        } else {
-          break;
-        }
-      }
-
-      if (renewalThread.isAlive()) {
-        LOG.warn("Renewal thread failed to gracefully stop, interrupting it");
-        renewalThread.interrupt();
-        try {
-          renewalThread.join(5000);
-        } catch (InterruptedException e) {
-          Thread.currentThread().interrupt();
-        }
-      }
-
-      // What more could we do?
-      if (renewalThread.isAlive()) {
-        LOG.warn("Renewal thread failed to gracefully and ungracefully stop, proceeding.");
-      }
-
-      renewalTask = null;
-      renewalThread = null;
-    } else {
-      LOG.warn("Renewal thread was never started or already stopped.");
-    }
-  }
-
-  /**
-   * Runnable for performing Kerberos renewals.
-   */
-  static class RenewalTask implements Runnable {
-    private static final Logger RENEWAL_LOG = LoggerFactory.getLogger(RenewalTask.class);
-    // Mutable variables -- change as re-login occurs
-    private LoginContext context;
-    private Subject subject;
-    private final KerberosConnection utilInstance;
-    private final Configuration conf;
-    private final long renewalPeriod;
-    private final AtomicBoolean keepRunning = new AtomicBoolean(true);
-
-    public RenewalTask(KerberosConnection utilInstance, LoginContext context, Subject subject,
-        Configuration conf, long renewalPeriod) {
-      this.utilInstance = Objects.requireNonNull(utilInstance);
-      this.context = Objects.requireNonNull(context);
-      this.subject = Objects.requireNonNull(subject);
-      this.conf = Objects.requireNonNull(conf);
-      this.renewalPeriod = renewalPeriod;
-    }
-
-    @Override public void run() {
-      while (keepRunning.get() && !Thread.currentThread().isInterrupted()) {
-        RENEWAL_LOG.debug("Checking if Kerberos ticket should be renewed");
-        // The current time
-        final long now = System.currentTimeMillis();
-
-        // Find the TGT in the Subject for the principal we were given.
-        Set<KerberosTicket> tickets = subject.getPrivateCredentials(KerberosTicket.class);
-        KerberosTicket activeTicket = null;
-        for (KerberosTicket ticket : tickets) {
-          if (isTGSPrincipal(ticket.getServer())) {
-            activeTicket = ticket;
-            break;
-          }
-        }
-
-        // If we have no active ticket, immediately renew and check again to make sure we have
-        // a valid ticket now.
-        if (null == activeTicket) {
-          RENEWAL_LOG.debug("There is no active Kerberos ticket, renewing now");
-          renew();
-          continue;
-        }
-
-        // Only renew when we hit a certain threshold of the current ticket's lifetime.
-        // We want to limit the number of renewals we have to invoke.
-        if (shouldRenew(activeTicket.getStartTime().getTime(),
-            activeTicket.getEndTime().getTime(), now)) {
-          RENEWAL_LOG.debug("The current ticket should be renewed now");
-          renew();
-        }
-
-        // Sleep until we check again
-        waitForNextCheck(renewalPeriod);
-      }
-    }
-
-    /**
-     * Computes whether or not the ticket should be renewed based on the lifetime of the ticket
-     * and the current time.
-     *
-     * @param start The start time of the ticket's validity in millis
-     * @param end The end time of the ticket's validity in millis
-     * @param now Milliseconds since the epoch
-     * @return True if renewal should occur, false otherwise
-     */
-    boolean shouldRenew(final long start, final long end, long now) {
-      final long lifetime = end - start;
-      final long renewAfter = start + (long) (lifetime * PERCENT_OF_LIFETIME_TO_RENEW);
-      return now >= renewAfter;
-    }
-
-    /**
-     * Logout and log back in with the Kerberos identity.
-     */
-    void renew() {
-      try {
-        // Lock on the instance of KerberosUtil
-        synchronized (utilInstance) {
-          Entry<LoginContext, Subject> pair = utilInstance.login(context, conf, subject);
-          context = pair.getKey();
-          subject = pair.getValue();
-        }
-      } catch (Exception e) {
-        throw new RuntimeException("Failed to perform kerberos login");
-      }
-    }
-
-    /**
-     * Wait the given amount of time.
-     *
-     * @param renewalPeriod The number of milliseconds to wait
-     */
-    void waitForNextCheck(long renewalPeriod) {
-      try {
-        Thread.sleep(renewalPeriod);
-      } catch (InterruptedException e) {
-        Thread.currentThread().interrupt();
-        return;
-      }
-    }
-
-    void asyncStop() {
-      keepRunning.set(false);
-    }
-  }
-
-  /**
-   * Computes if the given {@code principal} is the ticket-granting system's principal ("krbtgt").
-   *
-   * @param principal A {@link KerberosPrincipal}.
-   * @return True if {@code principal} is the TGS principal, false otherwise.
-   */
-  static boolean isTGSPrincipal(KerberosPrincipal principal) {
-    if (principal == null) {
-      return false;
-    }
-
-    if (principal.getName().equals("krbtgt/" + principal.getRealm() + "@" + principal.getRealm())) {
-      return true;
-    }
-
-    return false;
-  }
-
-  /**
-   * Javax Configuration for performing a keytab-based Kerberos login.
-   */
-  static class KeytabJaasConf extends Configuration {
-    private String principal;
-    private File keytabFile;
-
-    KeytabJaasConf(String principal, File keytab) {
-      this.principal = principal;
-      this.keytabFile = keytab;
-    }
-
-    @Override public AppConfigurationEntry[] getAppConfigurationEntry(String name) {
-      HashMap<String, String> options = new HashMap<String, String>();
-      options.put("keyTab", keytabFile.getAbsolutePath());
-      options.put("principal", principal);
-      options.put("useKeyTab", "true");
-      options.put("storeKey", "true");
-      options.put("doNotPrompt", "true");
-      options.put("renewTGT", "false");
-      options.put("refreshKrb5Config", "true");
-      options.put("isInitiator", "true");
-
-      return new AppConfigurationEntry[] {new AppConfigurationEntry(getKrb5LoginModuleName(),
-          AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, options)};
-    }
-  }
-
-  /**
-   * Returns the KRB5 LoginModule implementation. This is JVM-vendor dependent.
-   *
-   * @return The class name of the KRB5 LoginModule
-   */
-  static String getKrb5LoginModuleName() {
-    return System.getProperty("java.vendor").contains("IBM") ? IBM_KRB5_LOGIN_MODULE
-        : SUN_KRB5_LOGIN_MODULE;
-  }
-}
-
-// End KerberosConnection.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/remote/LocalJsonService.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/LocalJsonService.java b/avatica/core/src/main/java/org/apache/calcite/avatica/remote/LocalJsonService.java
deleted file mode 100644
index 0af6300..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/LocalJsonService.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import java.io.IOException;
-import java.io.StringWriter;
-
-/**
- * Implementation of {@link org.apache.calcite.avatica.remote.Service}
- * that goes to an in-process instance of {@code Service}.
- */
-public class LocalJsonService extends JsonService {
-  private final Service service;
-
-  public LocalJsonService(Service service) {
-    this.service = service;
-  }
-
-  @Override public String apply(String request) {
-    try {
-      Request request2 = MAPPER.readValue(request, Request.class);
-      Response response2 = request2.accept(service);
-      final StringWriter w = new StringWriter();
-      MAPPER.writeValue(w, response2);
-      return w.toString();
-    } catch (IOException e) {
-      throw handle(e);
-    }
-  }
-}
-
-// End LocalJsonService.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/remote/LocalProtobufService.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/LocalProtobufService.java b/avatica/core/src/main/java/org/apache/calcite/avatica/remote/LocalProtobufService.java
deleted file mode 100644
index 76e2392..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/LocalProtobufService.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import java.io.IOException;
-
-/**
- * A Service implementation that performs protocol buffer serialization on request and responses
- * on either side of computing a response from a request to mimic some transport to a server which
- * would normally perform such computation.
- */
-public class LocalProtobufService extends ProtobufService {
-  private final Service service;
-  private final ProtobufTranslation translation;
-
-  public LocalProtobufService(Service service, ProtobufTranslation translation) {
-    this.service = service;
-    this.translation = translation;
-  }
-
-  @Override public Response _apply(Request request) {
-    try {
-      // Serialize the request to "send to the server"
-      byte[] serializedRequest = translation.serializeRequest(request);
-
-      // *some transport would normally happen here*
-
-      // Fake deserializing that request somewhere else
-      Request request2 = translation.parseRequest(serializedRequest);
-
-      // Serialize the response from the service to "send to the client"
-      byte[] serializedResponse = translation.serializeResponse(request2.accept(service));
-
-      // *some transport would normally happen here*
-
-      // Deserialize the response on "the client"
-      return translation.parseResponse(serializedResponse);
-    } catch (IOException e) {
-      throw new RuntimeException(e);
-    }
-  }
-}
-
-// End LocalProtobufService.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/remote/LocalService.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/LocalService.java b/avatica/core/src/main/java/org/apache/calcite/avatica/remote/LocalService.java
deleted file mode 100644
index 929830b..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/LocalService.java
+++ /dev/null
@@ -1,376 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import org.apache.calcite.avatica.AvaticaUtils;
-import org.apache.calcite.avatica.Meta;
-import org.apache.calcite.avatica.Meta.ExecuteBatchResult;
-import org.apache.calcite.avatica.MissingResultsException;
-import org.apache.calcite.avatica.NoSuchStatementException;
-import org.apache.calcite.avatica.metrics.MetricsSystem;
-import org.apache.calcite.avatica.metrics.Timer;
-import org.apache.calcite.avatica.metrics.Timer.Context;
-import org.apache.calcite.avatica.metrics.noop.NoopMetricsSystem;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-
-import static org.apache.calcite.avatica.remote.MetricsHelper.concat;
-
-/**
- * Implementation of {@link Service} that talks to a local {@link Meta}.
- */
-public class LocalService implements Service {
-  final Meta meta;
-  final MetricsSystem metrics;
-
-  private final Timer executeTimer;
-  private final Timer commitTimer;
-  private final Timer prepareTimer;
-  private final Timer prepareAndExecuteTimer;
-  private final Timer connectionSyncTimer;
-
-  private RpcMetadataResponse serverLevelRpcMetadata;
-
-  public LocalService(Meta meta) {
-    this(meta, NoopMetricsSystem.getInstance());
-  }
-
-  public LocalService(Meta meta, MetricsSystem metrics) {
-    this.meta = meta;
-    this.metrics = Objects.requireNonNull(metrics);
-
-    this.executeTimer = this.metrics.getTimer(name("Execute"));
-    this.commitTimer = this.metrics.getTimer(name("Commit"));
-    this.prepareTimer = this.metrics.getTimer(name("Prepare"));
-    this.prepareAndExecuteTimer = this.metrics.getTimer(name("PrepareAndExecute"));
-    this.connectionSyncTimer = this.metrics.getTimer(name("ConnectionSync"));
-  }
-
-  private static String name(String timer) {
-    return concat(LocalService.class, timer);
-  }
-
-  @Override public void setRpcMetadata(RpcMetadataResponse serverLevelRpcMetadata) {
-    this.serverLevelRpcMetadata = Objects.requireNonNull(serverLevelRpcMetadata);
-  }
-
-  private static <E> List<E> list(Iterable<E> iterable) {
-    if (iterable instanceof List) {
-      return (List<E>) iterable;
-    }
-    final List<E> rowList = new ArrayList<>();
-    for (E row : iterable) {
-      rowList.add(row);
-    }
-    return rowList;
-  }
-
-  /** Converts a result set (not serializable) into a serializable response. */
-  public ResultSetResponse toResponse(Meta.MetaResultSet resultSet) {
-    if (resultSet.updateCount != -1) {
-      return new ResultSetResponse(resultSet.connectionId,
-          resultSet.statementId, resultSet.ownStatement, null, null,
-          resultSet.updateCount, serverLevelRpcMetadata);
-    }
-
-    Meta.Signature signature = resultSet.signature;
-    Meta.CursorFactory cursorFactory = resultSet.signature.cursorFactory;
-    Meta.Frame frame = null;
-    int updateCount = -1;
-    final List<Object> list;
-
-    if (resultSet.firstFrame != null) {
-      list = list(resultSet.firstFrame.rows);
-      switch (cursorFactory.style) {
-      case ARRAY:
-        cursorFactory = Meta.CursorFactory.LIST;
-        break;
-      case MAP:
-      case LIST:
-        break;
-      case RECORD:
-        cursorFactory = Meta.CursorFactory.LIST;
-        break;
-      default:
-        cursorFactory = Meta.CursorFactory.map(cursorFactory.fieldNames);
-      }
-
-      final boolean done = resultSet.firstFrame.done;
-
-      frame = new Meta.Frame(0, done, list);
-      updateCount = -1;
-
-      if (signature.statementType != null) {
-        if (signature.statementType.canUpdate()) {
-          frame = null;
-          updateCount = ((Number) ((List) list.get(0)).get(0)).intValue();
-        }
-      }
-    } else {
-      cursorFactory = Meta.CursorFactory.LIST;
-    }
-
-    if (cursorFactory != resultSet.signature.cursorFactory) {
-      signature = signature.setCursorFactory(cursorFactory);
-    }
-
-    return new ResultSetResponse(resultSet.connectionId, resultSet.statementId,
-        resultSet.ownStatement, signature, frame, updateCount, serverLevelRpcMetadata);
-  }
-
-  public ResultSetResponse apply(CatalogsRequest request) {
-    final Meta.ConnectionHandle ch =
-        new Meta.ConnectionHandle(request.connectionId);
-    final Meta.MetaResultSet resultSet = meta.getCatalogs(ch);
-    return toResponse(resultSet);
-  }
-
-  public ResultSetResponse apply(SchemasRequest request) {
-    final Meta.ConnectionHandle ch =
-        new Meta.ConnectionHandle(request.connectionId);
-    final Meta.MetaResultSet resultSet =
-        meta.getSchemas(ch, request.catalog, Meta.Pat.of(request.schemaPattern));
-    return toResponse(resultSet);
-  }
-
-  public ResultSetResponse apply(TablesRequest request) {
-    final Meta.ConnectionHandle ch =
-        new Meta.ConnectionHandle(request.connectionId);
-    final Meta.MetaResultSet resultSet =
-        meta.getTables(ch,
-            request.catalog,
-            Meta.Pat.of(request.schemaPattern),
-            Meta.Pat.of(request.tableNamePattern),
-            request.typeList);
-    return toResponse(resultSet);
-  }
-
-  public ResultSetResponse apply(TableTypesRequest request) {
-    final Meta.ConnectionHandle ch =
-        new Meta.ConnectionHandle(request.connectionId);
-    final Meta.MetaResultSet resultSet = meta.getTableTypes(ch);
-    return toResponse(resultSet);
-  }
-
-  public ResultSetResponse apply(TypeInfoRequest request) {
-    final Meta.ConnectionHandle ch =
-        new Meta.ConnectionHandle(request.connectionId);
-    final Meta.MetaResultSet resultSet = meta.getTypeInfo(ch);
-    return toResponse(resultSet);
-  }
-
-  public ResultSetResponse apply(ColumnsRequest request) {
-    final Meta.ConnectionHandle ch =
-        new Meta.ConnectionHandle(request.connectionId);
-    final Meta.MetaResultSet resultSet =
-        meta.getColumns(ch,
-            request.catalog,
-            Meta.Pat.of(request.schemaPattern),
-            Meta.Pat.of(request.tableNamePattern),
-            Meta.Pat.of(request.columnNamePattern));
-    return toResponse(resultSet);
-  }
-
-  public PrepareResponse apply(PrepareRequest request) {
-    try (final Context ignore = prepareTimer.start()) {
-      final Meta.ConnectionHandle ch =
-          new Meta.ConnectionHandle(request.connectionId);
-      final Meta.StatementHandle h =
-          meta.prepare(ch, request.sql, request.maxRowCount);
-      return new PrepareResponse(h, serverLevelRpcMetadata);
-    }
-  }
-
-  public ExecuteResponse apply(PrepareAndExecuteRequest request) {
-    try (final Context ignore = prepareAndExecuteTimer.start()) {
-      final Meta.StatementHandle sh =
-          new Meta.StatementHandle(request.connectionId, request.statementId, null);
-      try {
-        final Meta.ExecuteResult executeResult =
-            meta.prepareAndExecute(sh, request.sql, request.maxRowCount,
-                request.maxRowsInFirstFrame, new Meta.PrepareCallback() {
-                  @Override public Object getMonitor() {
-                    return LocalService.class;
-                  }
-
-                  @Override public void clear() {
-                  }
-
-                  @Override public void assign(Meta.Signature signature,
-                      Meta.Frame firstFrame, long updateCount) {
-                  }
-
-                  @Override public void execute() {
-                  }
-                });
-        final List<ResultSetResponse> results = new ArrayList<>();
-        for (Meta.MetaResultSet metaResultSet : executeResult.resultSets) {
-          results.add(toResponse(metaResultSet));
-        }
-        return new ExecuteResponse(results, false, serverLevelRpcMetadata);
-      } catch (NoSuchStatementException e) {
-        // The Statement doesn't exist anymore, bubble up this information
-        return new ExecuteResponse(null, true, serverLevelRpcMetadata);
-      }
-    }
-  }
-
-  public FetchResponse apply(FetchRequest request) {
-    final Meta.StatementHandle h = new Meta.StatementHandle(
-        request.connectionId, request.statementId, null);
-    try {
-      final Meta.Frame frame =
-          meta.fetch(h,
-              request.offset,
-              request.fetchMaxRowCount);
-      return new FetchResponse(frame, false, false, serverLevelRpcMetadata);
-    } catch (NullPointerException | NoSuchStatementException e) {
-      // The Statement doesn't exist anymore, bubble up this information
-      return new FetchResponse(null, true, true, serverLevelRpcMetadata);
-    } catch (MissingResultsException e) {
-      return new FetchResponse(null, false, true, serverLevelRpcMetadata);
-    }
-  }
-
-  public ExecuteResponse apply(ExecuteRequest request) {
-    try (final Context ignore = executeTimer.start()) {
-      try {
-        final Meta.ExecuteResult executeResult = meta.execute(request.statementHandle,
-            request.parameterValues, AvaticaUtils.toSaturatedInt(request.maxRowCount));
-
-        final List<ResultSetResponse> results = new ArrayList<>(executeResult.resultSets.size());
-        for (Meta.MetaResultSet metaResultSet : executeResult.resultSets) {
-          results.add(toResponse(metaResultSet));
-        }
-        return new ExecuteResponse(results, false, serverLevelRpcMetadata);
-      } catch (NoSuchStatementException e) {
-        return new ExecuteResponse(null, true, serverLevelRpcMetadata);
-      }
-    }
-  }
-
-  public CreateStatementResponse apply(CreateStatementRequest request) {
-    final Meta.ConnectionHandle ch =
-        new Meta.ConnectionHandle(request.connectionId);
-    final Meta.StatementHandle h = meta.createStatement(ch);
-    return new CreateStatementResponse(h.connectionId, h.id, serverLevelRpcMetadata);
-  }
-
-  public CloseStatementResponse apply(CloseStatementRequest request) {
-    final Meta.StatementHandle h = new Meta.StatementHandle(
-        request.connectionId, request.statementId, null);
-    meta.closeStatement(h);
-    return new CloseStatementResponse(serverLevelRpcMetadata);
-  }
-
-  public OpenConnectionResponse apply(OpenConnectionRequest request) {
-    final Meta.ConnectionHandle ch =
-        new Meta.ConnectionHandle(request.connectionId);
-    meta.openConnection(ch, request.info);
-    return new OpenConnectionResponse(serverLevelRpcMetadata);
-  }
-
-  public CloseConnectionResponse apply(CloseConnectionRequest request) {
-    final Meta.ConnectionHandle ch =
-        new Meta.ConnectionHandle(request.connectionId);
-    meta.closeConnection(ch);
-    return new CloseConnectionResponse(serverLevelRpcMetadata);
-  }
-
-  public ConnectionSyncResponse apply(ConnectionSyncRequest request) {
-    try (final Context ignore = connectionSyncTimer.start()) {
-      final Meta.ConnectionHandle ch =
-          new Meta.ConnectionHandle(request.connectionId);
-      final Meta.ConnectionProperties connProps =
-          meta.connectionSync(ch, request.connProps);
-      return new ConnectionSyncResponse(connProps, serverLevelRpcMetadata);
-    }
-  }
-
-  public DatabasePropertyResponse apply(DatabasePropertyRequest request) {
-    final Meta.ConnectionHandle ch =
-        new Meta.ConnectionHandle(request.connectionId);
-    return new DatabasePropertyResponse(meta.getDatabaseProperties(ch), serverLevelRpcMetadata);
-  }
-
-  public SyncResultsResponse apply(SyncResultsRequest request) {
-    final Meta.StatementHandle h = new Meta.StatementHandle(
-        request.connectionId, request.statementId, null);
-    SyncResultsResponse response;
-    try {
-      // Set success on the cached statement
-      response = new SyncResultsResponse(meta.syncResults(h, request.state, request.offset), false,
-          serverLevelRpcMetadata);
-    } catch (NoSuchStatementException e) {
-      // Tried to sync results on a statement which wasn't cached
-      response = new SyncResultsResponse(false, true, serverLevelRpcMetadata);
-    }
-
-    return response;
-  }
-
-  public CommitResponse apply(CommitRequest request) {
-    try (final Context ignore = commitTimer.start()) {
-      meta.commit(new Meta.ConnectionHandle(request.connectionId));
-
-      // If commit() errors, let the ErrorResponse be sent back via an uncaught Exception.
-      return new CommitResponse();
-    }
-  }
-
-  public RollbackResponse apply(RollbackRequest request) {
-    meta.rollback(new Meta.ConnectionHandle(request.connectionId));
-
-    // If rollback() errors, let the ErrorResponse be sent back via an uncaught Exception.
-    return new RollbackResponse();
-  }
-
-  public ExecuteBatchResponse apply(PrepareAndExecuteBatchRequest request) {
-    final Meta.StatementHandle h = new Meta.StatementHandle(request.connectionId,
-        request.statementId, null);
-    try {
-      ExecuteBatchResult result = meta.prepareAndExecuteBatch(h, request.sqlCommands);
-      return new ExecuteBatchResponse(request.connectionId, request.statementId,
-          result.updateCounts, false, serverLevelRpcMetadata);
-    } catch (NoSuchStatementException e) {
-      return new ExecuteBatchResponse(request.connectionId, request.statementId, null, true,
-          serverLevelRpcMetadata);
-    }
-  }
-
-  public ExecuteBatchResponse apply(ExecuteBatchRequest request) {
-    final Meta.StatementHandle h = new Meta.StatementHandle(request.connectionId,
-        request.statementId, null);
-    try {
-      ExecuteBatchResult result;
-      if (request.hasProtoUpdateBatches() && meta instanceof ProtobufMeta) {
-        result = ((ProtobufMeta) meta).executeBatchProtobuf(h, request.getProtoUpdateBatches());
-      } else {
-        result = meta.executeBatch(h, request.parameterValues);
-      }
-      return new ExecuteBatchResponse(request.connectionId, request.statementId,
-          result.updateCounts, false, serverLevelRpcMetadata);
-    } catch (NoSuchStatementException e) {
-      return new ExecuteBatchResponse(request.connectionId, request.statementId, null, true,
-          serverLevelRpcMetadata);
-    }
-  }
-}
-
-// End LocalService.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/remote/MetaDataOperation.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/MetaDataOperation.java b/avatica/core/src/main/java/org/apache/calcite/avatica/remote/MetaDataOperation.java
deleted file mode 100644
index 12a5b59..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/MetaDataOperation.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import org.apache.calcite.avatica.proto.Common;
-
-import java.sql.DatabaseMetaData;
-import java.sql.ResultSet;
-
-/**
- * Identifies an operation from {@link DatabaseMetaData} which returns a {@link ResultSet}. This
- * enum is used to allow clients to request the server to re-instantiate a {@link ResultSet} for
- * these operations which do not have a SQL string associated with them as a normal query does.
- */
-public enum MetaDataOperation {
-  GET_ATTRIBUTES,
-  GET_BEST_ROW_IDENTIFIER,
-  GET_CATALOGS,
-  GET_CLIENT_INFO_PROPERTIES,
-  GET_COLUMN_PRIVILEGES,
-  GET_COLUMNS,
-  GET_CROSS_REFERENCE,
-  GET_EXPORTED_KEYS,
-  GET_FUNCTION_COLUMNS,
-  GET_FUNCTIONS,
-  GET_IMPORTED_KEYS,
-  GET_INDEX_INFO,
-  GET_PRIMARY_KEYS,
-  GET_PROCEDURE_COLUMNS,
-  GET_PROCEDURES,
-  GET_PSEUDO_COLUMNS,
-  GET_SCHEMAS,
-  GET_SCHEMAS_WITH_ARGS,
-  GET_SUPER_TABLES,
-  GET_SUPER_TYPES,
-  GET_TABLE_PRIVILEGES,
-  GET_TABLES,
-  GET_TABLE_TYPES,
-  GET_TYPE_INFO,
-  GET_UDTS,
-  GET_VERSION_COLUMNS;
-
-  public Common.MetaDataOperation toProto() {
-    switch (this) {
-    case GET_ATTRIBUTES:
-      return Common.MetaDataOperation.GET_ATTRIBUTES;
-    case GET_BEST_ROW_IDENTIFIER:
-      return Common.MetaDataOperation.GET_BEST_ROW_IDENTIFIER;
-    case GET_CATALOGS:
-      return Common.MetaDataOperation.GET_CATALOGS;
-    case GET_CLIENT_INFO_PROPERTIES:
-      return Common.MetaDataOperation.GET_CLIENT_INFO_PROPERTIES;
-    case GET_COLUMNS:
-      return Common.MetaDataOperation.GET_COLUMNS;
-    case GET_COLUMN_PRIVILEGES:
-      return Common.MetaDataOperation.GET_COLUMN_PRIVILEGES;
-    case GET_CROSS_REFERENCE:
-      return Common.MetaDataOperation.GET_CROSS_REFERENCE;
-    case GET_EXPORTED_KEYS:
-      return Common.MetaDataOperation.GET_EXPORTED_KEYS;
-    case GET_FUNCTIONS:
-      return Common.MetaDataOperation.GET_FUNCTIONS;
-    case GET_FUNCTION_COLUMNS:
-      return Common.MetaDataOperation.GET_FUNCTION_COLUMNS;
-    case GET_IMPORTED_KEYS:
-      return Common.MetaDataOperation.GET_IMPORTED_KEYS;
-    case GET_INDEX_INFO:
-      return Common.MetaDataOperation.GET_INDEX_INFO;
-    case GET_PRIMARY_KEYS:
-      return Common.MetaDataOperation.GET_PRIMARY_KEYS;
-    case GET_PROCEDURES:
-      return Common.MetaDataOperation.GET_PROCEDURES;
-    case GET_PROCEDURE_COLUMNS:
-      return Common.MetaDataOperation.GET_PROCEDURE_COLUMNS;
-    case GET_PSEUDO_COLUMNS:
-      return Common.MetaDataOperation.GET_PSEUDO_COLUMNS;
-    case GET_SCHEMAS:
-      return Common.MetaDataOperation.GET_SCHEMAS;
-    case GET_SCHEMAS_WITH_ARGS:
-      return Common.MetaDataOperation.GET_SCHEMAS_WITH_ARGS;
-    case GET_SUPER_TABLES:
-      return Common.MetaDataOperation.GET_SUPER_TABLES;
-    case GET_SUPER_TYPES:
-      return Common.MetaDataOperation.GET_SUPER_TYPES;
-    case GET_TABLES:
-      return Common.MetaDataOperation.GET_TABLES;
-    case GET_TABLE_PRIVILEGES:
-      return Common.MetaDataOperation.GET_TABLE_PRIVILEGES;
-    case GET_TABLE_TYPES:
-      return Common.MetaDataOperation.GET_TABLE_TYPES;
-    case GET_TYPE_INFO:
-      return Common.MetaDataOperation.GET_TYPE_INFO;
-    case GET_UDTS:
-      return Common.MetaDataOperation.GET_UDTS;
-    case GET_VERSION_COLUMNS:
-      return Common.MetaDataOperation.GET_VERSION_COLUMNS;
-    default:
-      throw new RuntimeException("Unknown type: " + this);
-    }
-  }
-
-  public static MetaDataOperation fromProto(Common.MetaDataOperation protoOp) {
-    // Null is acceptable
-    if (null == protoOp) {
-      return null;
-    }
-
-    switch (protoOp) {
-    case GET_ATTRIBUTES:
-      return MetaDataOperation.GET_ATTRIBUTES;
-    case GET_BEST_ROW_IDENTIFIER:
-      return MetaDataOperation.GET_BEST_ROW_IDENTIFIER;
-    case GET_CATALOGS:
-      return MetaDataOperation.GET_CATALOGS;
-    case GET_CLIENT_INFO_PROPERTIES:
-      return MetaDataOperation.GET_CLIENT_INFO_PROPERTIES;
-    case GET_COLUMNS:
-      return MetaDataOperation.GET_COLUMNS;
-    case GET_COLUMN_PRIVILEGES:
-      return MetaDataOperation.GET_COLUMN_PRIVILEGES;
-    case GET_CROSS_REFERENCE:
-      return MetaDataOperation.GET_CROSS_REFERENCE;
-    case GET_EXPORTED_KEYS:
-      return MetaDataOperation.GET_EXPORTED_KEYS;
-    case GET_FUNCTIONS:
-      return MetaDataOperation.GET_FUNCTIONS;
-    case GET_FUNCTION_COLUMNS:
-      return MetaDataOperation.GET_FUNCTION_COLUMNS;
-    case GET_IMPORTED_KEYS:
-      return MetaDataOperation.GET_IMPORTED_KEYS;
-    case GET_INDEX_INFO:
-      return MetaDataOperation.GET_INDEX_INFO;
-    case GET_PRIMARY_KEYS:
-      return MetaDataOperation.GET_PRIMARY_KEYS;
-    case GET_PROCEDURES:
-      return MetaDataOperation.GET_PROCEDURES;
-    case GET_PROCEDURE_COLUMNS:
-      return MetaDataOperation.GET_PROCEDURE_COLUMNS;
-    case GET_PSEUDO_COLUMNS:
-      return MetaDataOperation.GET_PSEUDO_COLUMNS;
-    case GET_SCHEMAS:
-      return MetaDataOperation.GET_SCHEMAS;
-    case GET_SCHEMAS_WITH_ARGS:
-      return MetaDataOperation.GET_SCHEMAS_WITH_ARGS;
-    case GET_SUPER_TABLES:
-      return MetaDataOperation.GET_SUPER_TABLES;
-    case GET_SUPER_TYPES:
-      return MetaDataOperation.GET_SUPER_TYPES;
-    case GET_TABLES:
-      return MetaDataOperation.GET_TABLES;
-    case GET_TABLE_PRIVILEGES:
-      return MetaDataOperation.GET_TABLE_PRIVILEGES;
-    case GET_TABLE_TYPES:
-      return MetaDataOperation.GET_TABLE_TYPES;
-    case GET_TYPE_INFO:
-      return MetaDataOperation.GET_TYPE_INFO;
-    case GET_UDTS:
-      return MetaDataOperation.GET_UDTS;
-    case GET_VERSION_COLUMNS:
-      return MetaDataOperation.GET_VERSION_COLUMNS;
-    default:
-      throw new RuntimeException("Unknown type: " + protoOp);
-    }
-  }
-}
-
-// End MetaDataOperation.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/remote/MetricsHelper.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/MetricsHelper.java b/avatica/core/src/main/java/org/apache/calcite/avatica/remote/MetricsHelper.java
deleted file mode 100644
index 2561b29..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/MetricsHelper.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-/**
- * A utility class to encapsulate common logic in use of metrics implementation.
- */
-public class MetricsHelper {
-
-  private static final String PERIOD = ".";
-
-  private MetricsHelper() {}
-
-  public static String concat(Class<?> clz, String name) {
-    StringBuilder sb = new StringBuilder();
-    sb.append(clz.getName());
-    return sb.append(PERIOD).append(name).toString();
-  }
-
-}
-
-// End MetricsHelper.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/remote/MockJsonService.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/MockJsonService.java b/avatica/core/src/main/java/org/apache/calcite/avatica/remote/MockJsonService.java
deleted file mode 100644
index 11a6104..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/MockJsonService.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import org.apache.calcite.avatica.AvaticaConnection;
-
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Mock implementation of {@link Service}
- * that encodes its requests and responses as JSON
- * and looks up responses from a pre-defined map.
- */
-public class MockJsonService extends JsonService {
-  private final Map<String, String> map;
-
-  public MockJsonService(Map<String, String> map) {
-    this.map = map;
-  }
-
-  @Override public String apply(String request) {
-    String response = map.get(request);
-    if (response == null) {
-      throw new RuntimeException("No response for " + request);
-    }
-    return response;
-  }
-
-  /** Factory that creates a {@code MockJsonService}. */
-  public static class Factory implements Service.Factory {
-    public Service create(AvaticaConnection connection) {
-      final String connectionId = connection.id;
-      final Map<String, String> map1 = new HashMap<>();
-      try {
-        map1.put(
-            "{\"request\":\"openConnection\",\"connectionId\":\"" + connectionId + "\",\"info\":{}}",
-            "{\"response\":\"openConnection\"}");
-        map1.put(
-            "{\"request\":\"closeConnection\",\"connectionId\":\"" + connectionId + "\"}",
-            "{\"response\":\"closeConnection\"}");
-        map1.put(
-            "{\"request\":\"getSchemas\",\"catalog\":null,\"schemaPattern\":{\"s\":null}}",
-            "{\"response\":\"resultSet\", updateCount: -1, firstFrame: {offset: 0, done: true, rows: []}}");
-        map1.put(
-            JsonService.encode(new SchemasRequest(connectionId, null, null)),
-            "{\"response\":\"resultSet\", updateCount: -1, firstFrame: {offset: 0, done: true, rows: []}}");
-        map1.put(
-            JsonService.encode(
-                new TablesRequest(connectionId, null, null, null, Arrays.<String>asList())),
-            "{\"response\":\"resultSet\", updateCount: -1, firstFrame: {offset: 0, done: true, rows: []}}");
-        map1.put(
-            "{\"request\":\"createStatement\",\"connectionId\":\"" + connectionId + "\"}",
-            "{\"response\":\"createStatement\",\"id\":0}");
-        map1.put(
-            "{\"request\":\"prepareAndExecute\",\"statementId\":0,"
-                + "\"sql\":\"select * from (\\n  values (1, 'a'), (null, 'b'), (3, 'c')) as t (c1, c2)\",\"maxRowCount\":-1}",
-            "{\"response\":\"resultSet\", updateCount: -1, \"signature\": {\n"
-                + " \"columns\": [\n"
-                + "   {\"columnName\": \"C1\", \"type\": {type: \"scalar\", id: 4, rep: \"INTEGER\"}},\n"
-                + "   {\"columnName\": \"C2\", \"type\": {type: \"scalar\", id: 12, rep: \"STRING\"}}\n"
-                + " ], \"cursorFactory\": {\"style\": \"ARRAY\"}\n"
-                + "}, \"rows\": [[1, \"a\"], [null, \"b\"], [3, \"c\"]]}");
-        map1.put(
-            "{\"request\":\"prepare\",\"statementId\":0,"
-                + "\"sql\":\"select * from (\\n  values (1, 'a'), (null, 'b'), (3, 'c')) as t (c1, c2)\",\"maxRowCount\":-1}",
-            "{\"response\":\"prepare\",\"signature\": {\n"
-                + " \"columns\": [\n"
-                + "   {\"columnName\": \"C1\", \"type\": {type: \"scalar\", id: 4, rep: \"INTEGER\"}},\n"
-                + "   {\"columnName\": \"C2\", \"type\": {type: \"scalar\", id: 12, rep: \"STRING\"}}\n"
-                + " ],\n"
-                + " \"parameters\": [],\n"
-                + " \"cursorFactory\": {\"style\": \"ARRAY\"}\n"
-                + "}}");
-        map1.put(
-            "{\"request\":\"getColumns\",\"connectionId\":\"" + connectionId + "\",\"catalog\":null,\"schemaPattern\":null,"
-                + "\"tableNamePattern\":\"my_table\",\"columnNamePattern\":null}",
-            "{\"response\":\"resultSet\",\"connectionId\":\"00000000-0000-0000-0000-000000000000\",\"statementId\":-1,\"ownStatement\":true,"
-                + "\"signature\":{\"columns\":["
-                  + "{\"ordinal\":0,\"autoIncrement\":false,\"caseSensitive\":false,\"searchable\":true,\"currency\":false,\"nullable\":1,\"signed\":false,"
-                    + "\"displaySize\":40,\"label\":\"TABLE_NAME\",\"columnName\":\"TABLE_NAME\",\"schemaName\":\"\",\"precision\":0,\"scale\":0,\"tableName\":\"SYSTEM.TABLE\","
-                    + "\"catalogName\":\"\",\"type\":{\"type\":\"scalar\",\"id\":12,\"name\":\"VARCHAR\",\"rep\":\"STRING\"},\"readOnly\":true,\"writable\":false,"
-                    + "\"definitelyWritable\":false,\"columnClassName\":\"java.lang.String\"},"
-                  + "{\"ordinal\":1,\"autoIncrement\":false,\"caseSensitive\":false,\"searchable\":true,\"currency\":false,\"nullable\":1,\"signed\":true,"
-                    + "\"displaySize\":40,\"label\":\"ORDINAL_POSITION\",\"columnName\":\"ORDINAL_POSITION\",\"schemaName\":\"\",\"precision\":0,\"scale\":0,"
-                    + "\"tableName\":\"SYSTEM.TABLE\",\"catalogName\":\"\",\"type\":{\"type\":\"scalar\",\"id\":-5,\"name\":\"BIGINT\",\"rep\":\"PRIMITIVE_LONG\"},"
-                    + "\"readOnly\":true,\"writable\":false,\"definitelyWritable\":false,\"columnClassName\":\"java.lang.Long\"}"
-                + "],\"sql\":null,"
-                + "\"parameters\":[],"
-                + "\"cursorFactory\":{\"style\":\"LIST\",\"clazz\":null,\"fieldNames\":null},\"statementType\":null},"
-                + "\"firstFrame\":{\"offset\":0,\"done\":true,"
-                + "\"rows\":[[\"my_table\",10]]"
-                + "},\"updateCount\":-1}");
-      } catch (IOException e) {
-        throw new RuntimeException(e);
-      }
-      return new MockJsonService(map1);
-    }
-  }
-}
-
-// End MockJsonService.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/remote/MockProtobufService.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/MockProtobufService.java b/avatica/core/src/main/java/org/apache/calcite/avatica/remote/MockProtobufService.java
deleted file mode 100644
index a2cdd67..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/MockProtobufService.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import org.apache.calcite.avatica.AvaticaConnection;
-import org.apache.calcite.avatica.AvaticaParameter;
-import org.apache.calcite.avatica.ColumnMetaData;
-import org.apache.calcite.avatica.Meta;
-import org.apache.calcite.avatica.MetaImpl;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * A mock implementation of ProtobufService for testing.
- *
- * <p>It performs no serialization of requests and responses.
- */
-public class MockProtobufService extends ProtobufService {
-
-  private final String connectionId;
-  private final Map<Request, Response> mapping;
-
-  public MockProtobufService(String connectionId) {
-    this.connectionId = connectionId;
-    this.mapping = createMapping();
-  }
-
-  private Map<Request, Response> createMapping() {
-    HashMap<Request, Response> mappings = new HashMap<>();
-
-    // Add in mappings
-
-    mappings.put(
-        new OpenConnectionRequest(connectionId, new HashMap<String, String>()),
-        new OpenConnectionResponse());
-
-    // Get the schema, no.. schema..?
-    mappings.put(
-        new SchemasRequest(connectionId, null, null),
-        // ownStatement=false just to avoid the extra close statement call.
-        new ResultSetResponse(null, 1, false, null, Meta.Frame.EMPTY, -1, null));
-
-    // Get the tables, no tables exist
-    mappings.put(new TablesRequest(connectionId, null, null, null, Collections.<String>emptyList()),
-        // ownStatement=false just to avoid the extra close statement call.
-        new ResultSetResponse(null, 150, false, null, Meta.Frame.EMPTY, -1, null));
-
-    // Create a statement, get back an id
-    mappings.put(new CreateStatementRequest("0"), new CreateStatementResponse("0", 1, null));
-
-    // Prepare and execute a query. Values and schema are returned
-    mappings.put(
-        new PrepareAndExecuteRequest(connectionId, 1,
-            "select * from (\\n values (1, 'a'), (null, 'b'), (3, 'c')) as t (c1, c2)", -1),
-        new ResultSetResponse("0", 1, true,
-            Meta.Signature.create(
-                Arrays.<ColumnMetaData>asList(
-                    MetaImpl.columnMetaData("C1", 0, Integer.class, true),
-                    MetaImpl.columnMetaData("C2", 1, String.class, true)),
-                null, null, Meta.CursorFactory.ARRAY, Meta.StatementType.SELECT),
-            Meta.Frame.create(0, true,
-                Arrays.<Object>asList(new Object[] {1, "a"},
-                    new Object[] {null, "b"}, new Object[] {3, "c"})), -1, null));
-
-    // Prepare a query. Schema for results are returned, but no values
-    mappings.put(
-        new PrepareRequest(connectionId,
-            "select * from (\\n values(1, 'a'), (null, 'b'), (3, 'c')), as t (c1, c2)", -1),
-        new ResultSetResponse("0", 1, true,
-            Meta.Signature.create(
-                Arrays.<ColumnMetaData>asList(
-                    MetaImpl.columnMetaData("C1", 0, Integer.class, true),
-                    MetaImpl.columnMetaData("C2", 1, String.class, true)),
-                null, Collections.<AvaticaParameter>emptyList(),
-                Meta.CursorFactory.ARRAY, Meta.StatementType.SELECT),
-            null, -1, null));
-
-    mappings.put(
-        new ColumnsRequest(connectionId, null, null, "my_table", null),
-        new ResultSetResponse("00000000-0000-0000-0000-000000000000", -1, true,
-            Meta.Signature.create(
-                Arrays.<ColumnMetaData>asList(
-                    MetaImpl.columnMetaData("TABLE_NAME", 0, String.class, true),
-                    MetaImpl.columnMetaData("ORDINAL_POSITION", 1, Long.class, true)), null,
-                Collections.<AvaticaParameter>emptyList(), Meta.CursorFactory.ARRAY, null),
-            Meta.Frame.create(0, true,
-                Arrays.<Object>asList(new Object[] {new Object[]{"my_table", 10}})), -1, null));
-
-    return Collections.unmodifiableMap(mappings);
-  }
-
-  @Override public Response _apply(Request request) {
-    if (request instanceof CloseConnectionRequest) {
-      return new CloseConnectionResponse();
-    }
-
-    return dispatch(request);
-  }
-
-  /**
-   * Fetches the static response for the given request.
-   *
-   * @param request the client's request
-   * @return the appropriate response
-   * @throws RuntimeException if no mapping is found for the request
-   */
-  private Response dispatch(Request request) {
-    Response response = mapping.get(request);
-
-    if (null == response) {
-      throw new RuntimeException("Had no response mapping for " + request);
-    }
-
-    return response;
-  }
-
-  /**
-   * A factory that instantiates the mock protobuf service.
-   */
-  public static class MockProtobufServiceFactory implements Service.Factory {
-    @Override public Service create(AvaticaConnection connection) {
-      return new MockProtobufService(connection.id);
-    }
-  }
-}
-
-// End MockProtobufService.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/remote/ProtobufHandler.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/ProtobufHandler.java b/avatica/core/src/main/java/org/apache/calcite/avatica/remote/ProtobufHandler.java
deleted file mode 100644
index 89e380e..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/ProtobufHandler.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import org.apache.calcite.avatica.metrics.MetricsSystem;
-import org.apache.calcite.avatica.metrics.Timer;
-import org.apache.calcite.avatica.metrics.Timer.Context;
-import org.apache.calcite.avatica.remote.Service.Response;
-
-import java.io.IOException;
-
-/**
- * Dispatches serialized protocol buffer messages to the provided {@link Service}
- * by converting them to the POJO Request. Returns back the serialized protocol
- * buffer response.
- */
-public class ProtobufHandler extends AbstractHandler<byte[]> {
-
-  private final ProtobufTranslation translation;
-  private final MetricsSystem metrics;
-  private final Timer serializationTimer;
-
-  public ProtobufHandler(Service service, ProtobufTranslation translation, MetricsSystem metrics) {
-    super(service);
-    this.translation = translation;
-    this.metrics = metrics;
-    this.serializationTimer = this.metrics.getTimer(
-        MetricsHelper.concat(ProtobufHandler.class, HANDLER_SERIALIZATION_METRICS_NAME));
-  }
-
-  @Override public HandlerResponse<byte[]> apply(byte[] requestBytes) {
-    return super.apply(requestBytes);
-  }
-
-  @Override Service.Request decode(byte[] serializedRequest) throws IOException {
-    try (final Context ctx = serializationTimer.start()) {
-      return translation.parseRequest(serializedRequest);
-    }
-  }
-
-  @Override byte[] encode(Response response) throws IOException {
-    try (final Context ctx = serializationTimer.start()) {
-      return translation.serializeResponse(response);
-    }
-  }
-}
-
-// End ProtobufHandler.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/remote/ProtobufMeta.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/ProtobufMeta.java b/avatica/core/src/main/java/org/apache/calcite/avatica/remote/ProtobufMeta.java
deleted file mode 100644
index 375ae80..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/ProtobufMeta.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import org.apache.calcite.avatica.Meta;
-import org.apache.calcite.avatica.NoSuchStatementException;
-import org.apache.calcite.avatica.proto.Requests;
-
-import java.util.List;
-
-/**
- * An extension of {@link Meta} which allows for native processing of calls with the Protobuf
- * API objects instead of the POJOS (to avoid object translation). In the write-path, performing
- * this conversion tends to represent a signficant portion of execution time. The introduction
- * of this interface is to serve the purose of gradual migration to Meta implementations that
- * can naturally function over Protobuf objects instead of the POJOs.
- */
-public interface ProtobufMeta extends Meta {
-
-  /**
-   * Executes a batch of commands on a prepared statement.
-   *
-   * @param h Statement handle
-   * @param parameterValues A collection of list of typed values, one list per batch
-   * @return An array of update counts containing one element for each command in the batch.
-   */
-  ExecuteBatchResult executeBatchProtobuf(StatementHandle h, List<Requests.UpdateBatch>
-      parameterValues) throws NoSuchStatementException;
-}
-
-// End ProtobufMeta.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/remote/ProtobufService.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/ProtobufService.java b/avatica/core/src/main/java/org/apache/calcite/avatica/remote/ProtobufService.java
deleted file mode 100644
index d694440..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/ProtobufService.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import com.google.protobuf.Message;
-
-/**
- * Service implementation that encodes requests and responses as protocol buffers.
- */
-public abstract class ProtobufService extends AbstractService {
-
-  /**
-   * Derived class should implement this method to transport requests and
-   * responses to and from the peer service.
-   */
-  public abstract Response _apply(Request request);
-
-  @Override SerializationType getSerializationType() {
-    return SerializationType.PROTOBUF;
-  }
-
-  @Override public ResultSetResponse apply(CatalogsRequest request) {
-    return finagle((ResultSetResponse) _apply(request));
-  }
-
-  @Override public ResultSetResponse apply(SchemasRequest request) {
-    return finagle((ResultSetResponse) _apply(request));
-  }
-
-  @Override public ResultSetResponse apply(TablesRequest request) {
-    return finagle((ResultSetResponse) _apply(request));
-  }
-
-  @Override public ResultSetResponse apply(TableTypesRequest request) {
-    return finagle((ResultSetResponse) _apply(request));
-  }
-
-  @Override public ResultSetResponse apply(TypeInfoRequest request) {
-    return finagle((ResultSetResponse) _apply(request));
-  }
-
-  @Override public ResultSetResponse apply(ColumnsRequest request) {
-    return finagle((ResultSetResponse) _apply(request));
-  }
-
-  @Override public PrepareResponse apply(PrepareRequest request) {
-    return finagle((PrepareResponse) _apply(request));
-  }
-
-  @Override public ExecuteResponse apply(PrepareAndExecuteRequest request) {
-    return finagle((ExecuteResponse) _apply(request));
-  }
-
-  @Override public FetchResponse apply(FetchRequest request) {
-    return (FetchResponse) _apply(request);
-  }
-
-  @Override public CreateStatementResponse apply(CreateStatementRequest request) {
-    return (CreateStatementResponse) _apply(request);
-  }
-
-  @Override public CloseStatementResponse apply(CloseStatementRequest request) {
-    return (CloseStatementResponse) _apply(request);
-  }
-
-  @Override public OpenConnectionResponse apply(OpenConnectionRequest request) {
-    return (OpenConnectionResponse) _apply(request);
-  }
-
-  @Override public CloseConnectionResponse apply(CloseConnectionRequest request) {
-    return (CloseConnectionResponse) _apply(request);
-  }
-
-  @Override public ConnectionSyncResponse apply(ConnectionSyncRequest request) {
-    return (ConnectionSyncResponse) _apply(request);
-  }
-
-  @Override public DatabasePropertyResponse apply(DatabasePropertyRequest request) {
-    return (DatabasePropertyResponse) _apply(request);
-  }
-
-  @Override public ExecuteResponse apply(ExecuteRequest request) {
-    return finagle((ExecuteResponse) _apply(request));
-  }
-
-  @Override public SyncResultsResponse apply(SyncResultsRequest request) {
-    return (SyncResultsResponse) _apply(request);
-  }
-
-  @Override public CommitResponse apply(CommitRequest request) {
-    return (CommitResponse) _apply(request);
-  }
-
-  @Override public RollbackResponse apply(RollbackRequest request) {
-    return (RollbackResponse) _apply(request);
-  }
-
-  @Override public ExecuteBatchResponse apply(PrepareAndExecuteBatchRequest request) {
-    return (ExecuteBatchResponse) _apply(request);
-  }
-
-  @Override public ExecuteBatchResponse apply(ExecuteBatchRequest request) {
-    return (ExecuteBatchResponse) _apply(request);
-  }
-
-  /**
-   * Checks if the provided {@link Message} is an instance of the Class given by
-   * <code>expectedType</code>. Throws an IllegalArgumentException if the message is not of the
-   * expected type, otherwise, it returns the message cast as the expected type.
-   *
-   * @param msg A Protocol Buffer message.
-   * @param expectedType The expected type of the Protocol Buffer message.
-   * @return The msg cast to the concrete Message type.
-   * @throws IllegalArgumentException If the type of the message is not the expectedType.
-   */
-  public static <T extends Message> T castProtobufMessage(Message msg, Class<T> expectedType) {
-    if (!expectedType.isInstance(msg)) {
-      throw new IllegalArgumentException("Expected instance of " + expectedType.getName()
-          + ", but got " + msg.getClass().getName());
-    }
-
-    return expectedType.cast(msg);
-  }
-}
-
-// End ProtobufService.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/remote/ProtobufTranslation.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/ProtobufTranslation.java b/avatica/core/src/main/java/org/apache/calcite/avatica/remote/ProtobufTranslation.java
deleted file mode 100644
index 7142d59..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/ProtobufTranslation.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import org.apache.calcite.avatica.remote.Service.Request;
-import org.apache.calcite.avatica.remote.Service.Response;
-
-import java.io.IOException;
-
-/**
- * Generic interface to support parsing of serialized protocol buffers between client and server.
- */
-public interface ProtobufTranslation {
-
-  /**
-   * Serializes a {@link Response} as a protocol buffer.
-   *
-   * @param response The response to serialize
-   * @throws IOException If there are errors during serialization
-   */
-  byte[] serializeResponse(Response response) throws IOException;
-
-  /**
-   * Serializes a {@link Request} as a protocol buffer.
-   *
-   * @param request The request to serialize
-   * @throws IOException If there are errors during serialization
-   */
-  byte[] serializeRequest(Request request) throws IOException;
-
-  /**
-   * Parses a serialized protocol buffer request into a {@link Request}.
-   *
-   * @param bytes Serialized protocol buffer request from client
-   * @return A Request object for the given bytes
-   * @throws IOException If the protocol buffer cannot be deserialized
-   */
-  Request parseRequest(byte[] bytes) throws IOException;
-
-  /**
-   * Parses a serialized protocol buffer response into a {@link Response}.
-   *
-   * @param bytes Serialized protocol buffer request from server
-   * @return The Response object for the given bytes
-   * @throws IOException If the protocol buffer cannot be deserialized
-   */
-  Response parseResponse(byte[] bytes) throws IOException;
-}
-
-// End ProtobufTranslation.java


[14/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraProject.java
----------------------------------------------------------------------
diff --git a/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraProject.java b/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraProject.java
deleted file mode 100644
index 5e55e46..0000000
--- a/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraProject.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.cassandra;
-
-import org.apache.calcite.adapter.java.JavaTypeFactory;
-import org.apache.calcite.plan.RelOptCluster;
-import org.apache.calcite.plan.RelOptCost;
-import org.apache.calcite.plan.RelOptPlanner;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.core.Project;
-import org.apache.calcite.rel.metadata.RelMetadataQuery;
-import org.apache.calcite.rel.type.RelDataType;
-import org.apache.calcite.rex.RexNode;
-import org.apache.calcite.util.Pair;
-
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Implementation of {@link org.apache.calcite.rel.core.Project}
- * relational expression in Cassandra.
- */
-public class CassandraProject extends Project implements CassandraRel {
-  public CassandraProject(RelOptCluster cluster, RelTraitSet traitSet,
-      RelNode input, List<? extends RexNode> projects, RelDataType rowType) {
-    super(cluster, traitSet, input, projects, rowType);
-    assert getConvention() == CassandraRel.CONVENTION;
-    assert getConvention() == input.getConvention();
-  }
-
-  @Override public Project copy(RelTraitSet traitSet, RelNode input,
-      List<RexNode> projects, RelDataType rowType) {
-    return new CassandraProject(getCluster(), traitSet, input, projects,
-        rowType);
-  }
-
-  @Override public RelOptCost computeSelfCost(RelOptPlanner planner,
-      RelMetadataQuery mq) {
-    return super.computeSelfCost(planner, mq).multiplyBy(0.1);
-  }
-
-  public void implement(Implementor implementor) {
-    implementor.visitChild(0, getInput());
-    final CassandraRules.RexToCassandraTranslator translator =
-        new CassandraRules.RexToCassandraTranslator(
-            (JavaTypeFactory) getCluster().getTypeFactory(),
-            CassandraRules.cassandraFieldNames(getInput().getRowType()));
-    final Map<String, String> fields = new LinkedHashMap<String, String>();
-    for (Pair<RexNode, String> pair : getNamedProjects()) {
-      final String name = pair.right;
-      final String originalName = pair.left.accept(translator);
-      fields.put(originalName, name);
-    }
-    implementor.add(fields, null);
-  }
-}
-
-// End CassandraProject.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraRel.java
----------------------------------------------------------------------
diff --git a/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraRel.java b/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraRel.java
deleted file mode 100644
index b74919d..0000000
--- a/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraRel.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.cassandra;
-
-import org.apache.calcite.plan.Convention;
-import org.apache.calcite.plan.RelOptTable;
-import org.apache.calcite.rel.RelNode;
-
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Relational expression that uses Cassandra calling convention.
- */
-public interface CassandraRel extends RelNode {
-  void implement(Implementor implementor);
-
-  /** Calling convention for relational operations that occur in Cassandra. */
-  Convention CONVENTION = new Convention.Impl("CASSANDRA", CassandraRel.class);
-
-  /** Callback for the implementation process that converts a tree of
-   * {@link CassandraRel} nodes into a CQL query. */
-  class Implementor {
-    final Map<String, String> selectFields = new LinkedHashMap<String, String>();
-    final List<String> whereClause = new ArrayList<String>();
-    int offset = 0;
-    int fetch = -1;
-    final List<String> order = new ArrayList<String>();
-
-    RelOptTable table;
-    CassandraTable cassandraTable;
-
-    /** Adds newly projected fields and restricted predicates.
-     *
-     * @param fields New fields to be projected from a query
-     * @param predicates New predicates to be applied to the query
-     */
-    public void add(Map<String, String> fields, List<String> predicates) {
-      if (fields != null) {
-        selectFields.putAll(fields);
-      }
-      if (predicates != null) {
-        whereClause.addAll(predicates);
-      }
-    }
-
-    public void addOrder(List<String> newOrder) {
-      order.addAll(newOrder);
-    }
-
-    public void visitChild(int ordinal, RelNode input) {
-      assert ordinal == 0;
-      ((CassandraRel) input).implement(this);
-    }
-  }
-}
-
-// End CassandraRel.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraRules.java
----------------------------------------------------------------------
diff --git a/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraRules.java b/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraRules.java
deleted file mode 100644
index 3a9e9e9..0000000
--- a/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraRules.java
+++ /dev/null
@@ -1,411 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.cassandra;
-
-import org.apache.calcite.adapter.enumerable.EnumerableLimit;
-import org.apache.calcite.adapter.java.JavaTypeFactory;
-import org.apache.calcite.plan.Convention;
-import org.apache.calcite.plan.RelOptRule;
-import org.apache.calcite.plan.RelOptRuleCall;
-import org.apache.calcite.plan.RelOptRuleOperand;
-import org.apache.calcite.plan.RelOptUtil;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.RelCollation;
-import org.apache.calcite.rel.RelCollations;
-import org.apache.calcite.rel.RelFieldCollation;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.convert.ConverterRule;
-import org.apache.calcite.rel.core.Sort;
-import org.apache.calcite.rel.logical.LogicalFilter;
-import org.apache.calcite.rel.logical.LogicalProject;
-import org.apache.calcite.rel.type.RelDataType;
-import org.apache.calcite.rex.RexCall;
-import org.apache.calcite.rex.RexInputRef;
-import org.apache.calcite.rex.RexNode;
-import org.apache.calcite.rex.RexVisitorImpl;
-import org.apache.calcite.runtime.PredicateImpl;
-import org.apache.calcite.sql.SqlKind;
-import org.apache.calcite.sql.validate.SqlValidatorUtil;
-import org.apache.calcite.util.Pair;
-
-import com.google.common.base.Predicate;
-import com.google.common.base.Predicates;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-/**
- * Rules and relational operators for
- * {@link CassandraRel#CONVENTION}
- * calling convention.
- */
-public class CassandraRules {
-  private CassandraRules() {}
-
-  public static final RelOptRule[] RULES = {
-    CassandraFilterRule.INSTANCE,
-    CassandraProjectRule.INSTANCE,
-    CassandraSortRule.INSTANCE,
-    CassandraLimitRule.INSTANCE
-  };
-
-  static List<String> cassandraFieldNames(final RelDataType rowType) {
-    return SqlValidatorUtil.uniquify(rowType.getFieldNames(),
-        SqlValidatorUtil.EXPR_SUGGESTER, true);
-  }
-
-  /** Translator from {@link RexNode} to strings in Cassandra's expression
-   * language. */
-  static class RexToCassandraTranslator extends RexVisitorImpl<String> {
-    private final JavaTypeFactory typeFactory;
-    private final List<String> inFields;
-
-    protected RexToCassandraTranslator(JavaTypeFactory typeFactory,
-        List<String> inFields) {
-      super(true);
-      this.typeFactory = typeFactory;
-      this.inFields = inFields;
-    }
-
-    @Override public String visitInputRef(RexInputRef inputRef) {
-      return inFields.get(inputRef.getIndex());
-    }
-  }
-
-  /** Base class for planner rules that convert a relational expression to
-   * Cassandra calling convention. */
-  abstract static class CassandraConverterRule extends ConverterRule {
-    protected final Convention out;
-
-    public CassandraConverterRule(
-        Class<? extends RelNode> clazz,
-        String description) {
-      this(clazz, Predicates.<RelNode>alwaysTrue(), description);
-    }
-
-    public <R extends RelNode> CassandraConverterRule(
-        Class<R> clazz,
-        Predicate<? super R> predicate,
-        String description) {
-      super(clazz, predicate, Convention.NONE, CassandraRel.CONVENTION, description);
-      this.out = CassandraRel.CONVENTION;
-    }
-  }
-
-  /**
-   * Rule to convert a {@link org.apache.calcite.rel.logical.LogicalFilter} to a
-   * {@link CassandraFilter}.
-   */
-  private static class CassandraFilterRule extends RelOptRule {
-    private static final Predicate<LogicalFilter> PREDICATE =
-        new PredicateImpl<LogicalFilter>() {
-          public boolean test(LogicalFilter input) {
-            // TODO: Check for an equality predicate on the partition key
-            // Right now this just checks if we have a single top-level AND
-            return RelOptUtil.disjunctions(input.getCondition()).size() == 1;
-          }
-        };
-
-    private static final CassandraFilterRule INSTANCE = new CassandraFilterRule();
-
-    private CassandraFilterRule() {
-      super(operand(LogicalFilter.class, operand(CassandraTableScan.class, none())),
-          "CassandraFilterRule");
-    }
-
-    @Override public boolean matches(RelOptRuleCall call) {
-      // Get the condition from the filter operation
-      LogicalFilter filter = call.rel(0);
-      RexNode condition = filter.getCondition();
-
-      // Get field names from the scan operation
-      CassandraTableScan scan = call.rel(1);
-      Pair<List<String>, List<String>> keyFields = scan.cassandraTable.getKeyFields();
-      Set<String> partitionKeys = new HashSet<String>(keyFields.left);
-      List<String> fieldNames = CassandraRules.cassandraFieldNames(filter.getInput().getRowType());
-
-      List<RexNode> disjunctions = RelOptUtil.disjunctions(condition);
-      if (disjunctions.size() != 1) {
-        return false;
-      } else {
-        // Check that all conjunctions are primary key equalities
-        condition = disjunctions.get(0);
-        for (RexNode predicate : RelOptUtil.conjunctions(condition)) {
-          if (!isEqualityOnKey(predicate, fieldNames, partitionKeys, keyFields.right)) {
-            return false;
-          }
-        }
-      }
-
-      // Either all of the partition keys must be specified or none
-      return partitionKeys.size() == keyFields.left.size() || partitionKeys.size() == 0;
-    }
-
-    /** Check if the node is a supported predicate (primary key equality).
-     *
-     * @param node Condition node to check
-     * @param fieldNames Names of all columns in the table
-     * @param partitionKeys Names of primary key columns
-     * @param clusteringKeys Names of primary key columns
-     * @return True if the node represents an equality predicate on a primary key
-     */
-    private boolean isEqualityOnKey(RexNode node, List<String> fieldNames,
-        Set<String> partitionKeys, List<String> clusteringKeys) {
-      if (node.getKind() != SqlKind.EQUALS) {
-        return false;
-      }
-
-      RexCall call = (RexCall) node;
-      final RexNode left = call.operands.get(0);
-      final RexNode right = call.operands.get(1);
-      String key = compareFieldWithLiteral(left, right, fieldNames);
-      if (key == null) {
-        key = compareFieldWithLiteral(right, left, fieldNames);
-      }
-      if (key != null) {
-        return partitionKeys.remove(key) || clusteringKeys.contains(key);
-      } else {
-        return false;
-      }
-    }
-
-    /** Check if an equality operation is comparing a primary key column with a literal.
-     *
-     * @param left Left operand of the equality
-     * @param right Right operand of the equality
-     * @param fieldNames Names of all columns in the table
-     * @return The field being compared or null if there is no key equality
-     */
-    private String compareFieldWithLiteral(RexNode left, RexNode right, List<String> fieldNames) {
-      // FIXME Ignore casts for new and assume they aren't really necessary
-      if (left.isA(SqlKind.CAST)) {
-        left = ((RexCall) left).getOperands().get(0);
-      }
-
-      if (left.isA(SqlKind.INPUT_REF) && right.isA(SqlKind.LITERAL)) {
-        final RexInputRef left1 = (RexInputRef) left;
-        String name = fieldNames.get(left1.getIndex());
-        return name;
-      } else {
-        return null;
-      }
-    }
-
-    /** @see org.apache.calcite.rel.convert.ConverterRule */
-    public void onMatch(RelOptRuleCall call) {
-      LogicalFilter filter = call.rel(0);
-      CassandraTableScan scan = call.rel(1);
-      if (filter.getTraitSet().contains(Convention.NONE)) {
-        final RelNode converted = convert(filter, scan);
-        if (converted != null) {
-          call.transformTo(converted);
-        }
-      }
-    }
-
-    public RelNode convert(LogicalFilter filter, CassandraTableScan scan) {
-      final RelTraitSet traitSet = filter.getTraitSet().replace(CassandraRel.CONVENTION);
-      final Pair<List<String>, List<String>> keyFields = scan.cassandraTable.getKeyFields();
-      return new CassandraFilter(
-          filter.getCluster(),
-          traitSet,
-          convert(filter.getInput(), CassandraRel.CONVENTION),
-          filter.getCondition(),
-          keyFields.left,
-          keyFields.right,
-          scan.cassandraTable.getClusteringOrder());
-    }
-  }
-
-  /**
-   * Rule to convert a {@link org.apache.calcite.rel.logical.LogicalProject}
-   * to a {@link CassandraProject}.
-   */
-  private static class CassandraProjectRule extends CassandraConverterRule {
-    private static final CassandraProjectRule INSTANCE = new CassandraProjectRule();
-
-    private CassandraProjectRule() {
-      super(LogicalProject.class, "CassandraProjectRule");
-    }
-
-    @Override public boolean matches(RelOptRuleCall call) {
-      LogicalProject project = call.rel(0);
-      for (RexNode e : project.getProjects()) {
-        if (!(e instanceof RexInputRef)) {
-          return false;
-        }
-      }
-
-      return true;
-    }
-
-    public RelNode convert(RelNode rel) {
-      final LogicalProject project = (LogicalProject) rel;
-      final RelTraitSet traitSet = project.getTraitSet().replace(out);
-      return new CassandraProject(project.getCluster(), traitSet,
-          convert(project.getInput(), out), project.getProjects(),
-          project.getRowType());
-    }
-  }
-
-  /**
-   * Rule to convert a {@link org.apache.calcite.rel.core.Sort} to a
-   * {@link CassandraSort}.
-   */
-  private static class CassandraSortRule extends RelOptRule {
-    private static final Predicate<Sort> SORT_PREDICATE =
-        new PredicateImpl<Sort>() {
-          public boolean test(Sort input) {
-            // Limits are handled by CassandraLimit
-            return input.offset == null && input.fetch == null;
-          }
-        };
-    private static final Predicate<CassandraFilter> FILTER_PREDICATE =
-        new PredicateImpl<CassandraFilter>() {
-          public boolean test(CassandraFilter input) {
-            // We can only use implicit sorting within a single partition
-            return input.isSinglePartition();
-          }
-        };
-    private static final RelOptRuleOperand CASSANDRA_OP =
-        operand(CassandraToEnumerableConverter.class,
-        operand(CassandraFilter.class, null, FILTER_PREDICATE, any()));
-
-    private static final CassandraSortRule INSTANCE = new CassandraSortRule();
-
-    private CassandraSortRule() {
-      super(operand(Sort.class, null, SORT_PREDICATE, CASSANDRA_OP), "CassandraSortRule");
-    }
-
-    public RelNode convert(Sort sort, CassandraFilter filter) {
-      final RelTraitSet traitSet =
-          sort.getTraitSet().replace(CassandraRel.CONVENTION)
-              .replace(sort.getCollation());
-      return new CassandraSort(sort.getCluster(), traitSet,
-          convert(sort.getInput(), traitSet.replace(RelCollations.EMPTY)),
-          sort.getCollation());
-    }
-
-    public boolean matches(RelOptRuleCall call) {
-      final Sort sort = call.rel(0);
-      final CassandraFilter filter = call.rel(2);
-      return collationsCompatible(sort.getCollation(), filter.getImplicitCollation());
-    }
-
-    /** Check if it is possible to exploit native CQL sorting for a given collation.
-     *
-     * @return True if it is possible to achieve this sort in Cassandra
-     */
-    private boolean collationsCompatible(RelCollation sortCollation,
-        RelCollation implicitCollation) {
-      List<RelFieldCollation> sortFieldCollations = sortCollation.getFieldCollations();
-      List<RelFieldCollation> implicitFieldCollations = implicitCollation.getFieldCollations();
-
-      if (sortFieldCollations.size() > implicitFieldCollations.size()) {
-        return false;
-      }
-      if (sortFieldCollations.size() == 0) {
-        return true;
-      }
-
-      // Check if we need to reverse the order of the implicit collation
-      boolean reversed = reverseDirection(sortFieldCollations.get(0).getDirection())
-          == implicitFieldCollations.get(0).getDirection();
-
-      for (int i = 0; i < sortFieldCollations.size(); i++) {
-        RelFieldCollation sorted = sortFieldCollations.get(i);
-        RelFieldCollation implied = implicitFieldCollations.get(i);
-
-        // Check that the fields being sorted match
-        if (sorted.getFieldIndex() != implied.getFieldIndex()) {
-          return false;
-        }
-
-        // Either all fields must be sorted in the same direction
-        // or the opposite direction based on whether we decided
-        // if the sort direction should be reversed above
-        RelFieldCollation.Direction sortDirection = sorted.getDirection();
-        RelFieldCollation.Direction implicitDirection = implied.getDirection();
-        if ((!reversed && sortDirection != implicitDirection)
-            || (reversed && reverseDirection(sortDirection) != implicitDirection)) {
-          return false;
-        }
-      }
-
-      return true;
-    }
-
-    /** Find the reverse of a given collation direction.
-     *
-     * @return Reverse of the input direction
-     */
-    private RelFieldCollation.Direction reverseDirection(RelFieldCollation.Direction direction) {
-      switch(direction) {
-      case ASCENDING:
-      case STRICTLY_ASCENDING:
-        return RelFieldCollation.Direction.DESCENDING;
-      case DESCENDING:
-      case STRICTLY_DESCENDING:
-        return RelFieldCollation.Direction.ASCENDING;
-      default:
-        return null;
-      }
-    }
-
-    /** @see org.apache.calcite.rel.convert.ConverterRule */
-    public void onMatch(RelOptRuleCall call) {
-      final Sort sort = call.rel(0);
-      CassandraFilter filter = call.rel(2);
-      final RelNode converted = convert(sort, filter);
-      if (converted != null) {
-        call.transformTo(converted);
-      }
-    }
-  }
-
-  /**
-   * Rule to convert a {@link org.apache.calcite.adapter.enumerable.EnumerableLimit} to a
-   * {@link CassandraLimit}.
-   */
-  private static class CassandraLimitRule extends RelOptRule {
-    private static final CassandraLimitRule INSTANCE = new CassandraLimitRule();
-
-    private CassandraLimitRule() {
-      super(operand(EnumerableLimit.class, operand(CassandraToEnumerableConverter.class, any())),
-        "CassandraLimitRule");
-    }
-
-    public RelNode convert(EnumerableLimit limit) {
-      final RelTraitSet traitSet =
-          limit.getTraitSet().replace(CassandraRel.CONVENTION);
-      return new CassandraLimit(limit.getCluster(), traitSet,
-        convert(limit.getInput(), CassandraRel.CONVENTION), limit.offset, limit.fetch);
-    }
-
-    /** @see org.apache.calcite.rel.convert.ConverterRule */
-    public void onMatch(RelOptRuleCall call) {
-      final EnumerableLimit limit = call.rel(0);
-      final RelNode converted = convert(limit);
-      if (converted != null) {
-        call.transformTo(converted);
-      }
-    }
-  }
-}
-
-// End CassandraRules.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraSchema.java
----------------------------------------------------------------------
diff --git a/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraSchema.java b/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraSchema.java
deleted file mode 100644
index 21f37be..0000000
--- a/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraSchema.java
+++ /dev/null
@@ -1,305 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.cassandra;
-
-import org.apache.calcite.avatica.util.Casing;
-import org.apache.calcite.jdbc.CalciteSchema;
-import org.apache.calcite.rel.RelFieldCollation;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.type.RelDataTypeFactory;
-import org.apache.calcite.rel.type.RelDataTypeImpl;
-import org.apache.calcite.rel.type.RelDataTypeSystem;
-import org.apache.calcite.rel.type.RelProtoDataType;
-import org.apache.calcite.runtime.Hook;
-import org.apache.calcite.schema.SchemaPlus;
-import org.apache.calcite.schema.Table;
-import org.apache.calcite.schema.impl.AbstractSchema;
-import org.apache.calcite.schema.impl.MaterializedViewTable;
-import org.apache.calcite.sql.SqlDialect;
-import org.apache.calcite.sql.SqlSelect;
-import org.apache.calcite.sql.SqlWriter;
-import org.apache.calcite.sql.parser.SqlParseException;
-import org.apache.calcite.sql.parser.SqlParser;
-import org.apache.calcite.sql.pretty.SqlPrettyWriter;
-import org.apache.calcite.sql.type.SqlTypeFactoryImpl;
-import org.apache.calcite.sql.type.SqlTypeName;
-import org.apache.calcite.util.Pair;
-import org.apache.calcite.util.Util;
-import org.apache.calcite.util.trace.CalciteTrace;
-
-import com.datastax.driver.core.AbstractTableMetadata;
-import com.datastax.driver.core.Cluster;
-import com.datastax.driver.core.ClusteringOrder;
-import com.datastax.driver.core.ColumnMetadata;
-import com.datastax.driver.core.DataType;
-import com.datastax.driver.core.KeyspaceMetadata;
-import com.datastax.driver.core.MaterializedViewMetadata;
-import com.datastax.driver.core.Session;
-import com.datastax.driver.core.TableMetadata;
-import com.google.common.base.Function;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-
-import org.slf4j.Logger;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Schema mapped onto a Cassandra column family
- */
-public class CassandraSchema extends AbstractSchema {
-  final Session session;
-  final String keyspace;
-  private final SchemaPlus parentSchema;
-  final String name;
-  final Hook.Closeable hook;
-
-  protected static final Logger LOGGER = CalciteTrace.getPlannerTracer();
-
-  /**
-   * Creates a Cassandra schema.
-   *
-   * @param host Cassandra host, e.g. "localhost"
-   * @param keyspace Cassandra keyspace name, e.g. "twissandra"
-   */
-  public CassandraSchema(String host, String keyspace, SchemaPlus parentSchema, String name) {
-    this(host, keyspace, null, null, parentSchema, name);
-  }
-
-  /**
-   * Creates a Cassandra schema.
-   *
-   * @param host Cassandra host, e.g. "localhost"
-   * @param keyspace Cassandra keyspace name, e.g. "twissandra"
-   * @param username Cassandra username
-   * @param password Cassandra password
-   */
-  public CassandraSchema(String host, String keyspace, String username, String password,
-        SchemaPlus parentSchema, String name) {
-    super();
-
-    this.keyspace = keyspace;
-    try {
-      Cluster cluster;
-      if (username != null && password != null) {
-        cluster = Cluster.builder().addContactPoint(host)
-            .withCredentials(username, password).build();
-      } else {
-        cluster = Cluster.builder().addContactPoint(host).build();
-      }
-
-      this.session = cluster.connect(keyspace);
-    } catch (Exception e) {
-      throw new RuntimeException(e);
-    }
-    this.parentSchema = parentSchema;
-    this.name = name;
-
-    this.hook = Hook.TRIMMED.add(new Function<RelNode, Void>() {
-      public Void apply(RelNode node) {
-        CassandraSchema.this.addMaterializedViews();
-        return null;
-      }
-    });
-  }
-
-  RelProtoDataType getRelDataType(String columnFamily, boolean view) {
-    List<ColumnMetadata> columns;
-    if (view) {
-      columns = getKeyspace().getMaterializedView(columnFamily).getColumns();
-    } else {
-      columns = getKeyspace().getTable(columnFamily).getColumns();
-    }
-
-    // Temporary type factory, just for the duration of this method. Allowable
-    // because we're creating a proto-type, not a type; before being used, the
-    // proto-type will be copied into a real type factory.
-    final RelDataTypeFactory typeFactory =
-        new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT);
-    final RelDataTypeFactory.FieldInfoBuilder fieldInfo = typeFactory.builder();
-    for (ColumnMetadata column : columns) {
-      final String columnName = column.getName();
-      final DataType type = column.getType();
-
-      // TODO: This mapping of types can be done much better
-      SqlTypeName typeName = SqlTypeName.ANY;
-      if (type == DataType.uuid() || type == DataType.timeuuid()) {
-        // We currently rely on this in CassandraFilter to detect UUID columns.
-        // That is, these fixed length literals should be unquoted in CQL.
-        typeName = SqlTypeName.CHAR;
-      } else if (type == DataType.ascii() || type == DataType.text()
-            || type == DataType.varchar()) {
-        typeName = SqlTypeName.VARCHAR;
-      } else if (type == DataType.cint() || type == DataType.varint()) {
-        typeName = SqlTypeName.INTEGER;
-      } else if (type == DataType.bigint()) {
-        typeName = SqlTypeName.BIGINT;
-      } else if (type == DataType.cdouble() || type == DataType.cfloat()
-          || type == DataType.decimal()) {
-        typeName = SqlTypeName.DOUBLE;
-      }
-
-      fieldInfo.add(columnName, typeFactory.createSqlType(typeName)).nullable(true);
-    }
-
-    return RelDataTypeImpl.proto(fieldInfo.build());
-  }
-
-  /**
-   * Get all primary key columns from the underlying CQL table
-   *
-   * @return A list of field names that are part of the partition and clustering keys
-   */
-  Pair<List<String>, List<String>> getKeyFields(String columnFamily, boolean view) {
-    AbstractTableMetadata table;
-    if (view) {
-      table = getKeyspace().getMaterializedView(columnFamily);
-    } else {
-      table = getKeyspace().getTable(columnFamily);
-    }
-
-    List<ColumnMetadata> partitionKey = table.getPartitionKey();
-    List<String> pKeyFields = new ArrayList<String>();
-    for (ColumnMetadata column : partitionKey) {
-      pKeyFields.add(column.getName());
-    }
-
-    List<ColumnMetadata> clusteringKey = table.getClusteringColumns();
-    List<String> cKeyFields = new ArrayList<String>();
-    for (ColumnMetadata column : clusteringKey) {
-      cKeyFields.add(column.getName());
-    }
-
-    return Pair.of((List<String>) ImmutableList.copyOf(pKeyFields),
-        (List<String>) ImmutableList.copyOf(cKeyFields));
-  }
-
-  /** Get the collation of all clustering key columns.
-   *
-   * @return A RelCollations representing the collation of all clustering keys
-   */
-  public List<RelFieldCollation> getClusteringOrder(String columnFamily, boolean view) {
-    AbstractTableMetadata table;
-    if (view) {
-      table = getKeyspace().getMaterializedView(columnFamily);
-    } else {
-      table = getKeyspace().getTable(columnFamily);
-    }
-
-    List<ClusteringOrder> clusteringOrder = table.getClusteringOrder();
-    List<RelFieldCollation> keyCollations = new ArrayList<RelFieldCollation>();
-
-    int i = 0;
-    for (ClusteringOrder order : clusteringOrder) {
-      RelFieldCollation.Direction direction;
-      switch(order) {
-      case DESC:
-        direction = RelFieldCollation.Direction.DESCENDING;
-        break;
-      case ASC:
-      default:
-        direction = RelFieldCollation.Direction.ASCENDING;
-        break;
-      }
-      keyCollations.add(new RelFieldCollation(i, direction));
-      i++;
-    }
-
-    return keyCollations;
-  }
-
-  /** Add all materialized views defined in the schema to this column family
-   */
-  private void addMaterializedViews() {
-    // Close the hook use to get us here
-    hook.close();
-
-    for (MaterializedViewMetadata view : getKeyspace().getMaterializedViews()) {
-      String tableName = view.getBaseTable().getName();
-      StringBuilder queryBuilder = new StringBuilder("SELECT ");
-
-      // Add all the selected columns to the query
-      List<String> columnNames = new ArrayList<String>();
-      for (ColumnMetadata column : view.getColumns()) {
-        columnNames.add("\"" + column.getName() + "\"");
-      }
-      queryBuilder.append(Util.toString(columnNames, "", ", ", ""));
-
-      queryBuilder.append(" FROM \"" + tableName + "\"");
-
-      // Get the where clause from the system schema
-      String whereQuery = "SELECT where_clause from system_schema.views "
-          + "WHERE keyspace_name='" + keyspace + "' AND view_name='" + view.getName() + "'";
-      queryBuilder.append(" WHERE " + session.execute(whereQuery).one().getString(0));
-
-      // Parse and unparse the view query to get properly quoted field names
-      String query = queryBuilder.toString();
-      SqlParser.ConfigBuilder configBuilder = SqlParser.configBuilder();
-      configBuilder.setUnquotedCasing(Casing.UNCHANGED);
-
-      SqlSelect parsedQuery;
-      try {
-        parsedQuery = (SqlSelect) SqlParser.create(query, configBuilder.build()).parseQuery();
-      } catch (SqlParseException e) {
-        LOGGER.warn("Could not parse query {} for CQL view {}.{}",
-            query, keyspace, view.getName());
-        continue;
-      }
-
-      StringWriter stringWriter = new StringWriter(query.length());
-      PrintWriter printWriter = new PrintWriter(stringWriter);
-      SqlWriter writer = new SqlPrettyWriter(SqlDialect.CALCITE, true, printWriter);
-      parsedQuery.unparse(writer, 0, 0);
-      query = stringWriter.toString();
-
-      // Add the view for this query
-      String viewName = "$" + getTableNames().size();
-      SchemaPlus schema = parentSchema.getSubSchema(name);
-      CalciteSchema calciteSchema = CalciteSchema.from(schema);
-
-      List<String> viewPath = calciteSchema.path(viewName);
-
-      schema.add(viewName,
-            MaterializedViewTable.create(calciteSchema, query,
-            null, viewPath, view.getName(), true));
-    }
-  }
-
-  @Override protected Map<String, Table> getTableMap() {
-    final ImmutableMap.Builder<String, Table> builder = ImmutableMap.builder();
-    for (TableMetadata table : getKeyspace().getTables()) {
-      String tableName = table.getName();
-      builder.put(tableName, new CassandraTable(this, tableName));
-
-      for (MaterializedViewMetadata view : table.getViews()) {
-        String viewName = view.getName();
-        builder.put(viewName, new CassandraTable(this, viewName, true));
-      }
-    }
-    return builder.build();
-  }
-
-  private KeyspaceMetadata getKeyspace() {
-    return session.getCluster().getMetadata().getKeyspace(keyspace);
-  }
-}
-
-// End CassandraSchema.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraSchemaFactory.java
----------------------------------------------------------------------
diff --git a/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraSchemaFactory.java b/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraSchemaFactory.java
deleted file mode 100644
index 136b81b..0000000
--- a/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraSchemaFactory.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.cassandra;
-
-import org.apache.calcite.schema.Schema;
-import org.apache.calcite.schema.SchemaFactory;
-import org.apache.calcite.schema.SchemaPlus;
-
-import java.util.Map;
-
-/**
- * Factory that creates a {@link CassandraSchema}
- */
-@SuppressWarnings("UnusedDeclaration")
-public class CassandraSchemaFactory implements SchemaFactory {
-  public CassandraSchemaFactory() {
-  }
-
-  public Schema create(SchemaPlus parentSchema, String name,
-      Map<String, Object> operand) {
-    Map map = (Map) operand;
-    String host = (String) map.get("host");
-    String keyspace = (String) map.get("keyspace");
-    String username = (String) map.get("username");
-    String password = (String) map.get("password");
-    return new CassandraSchema(host, keyspace, username, password, parentSchema, name);
-  }
-}
-
-// End CassandraSchemaFactory.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraSort.java
----------------------------------------------------------------------
diff --git a/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraSort.java b/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraSort.java
deleted file mode 100644
index 8487815..0000000
--- a/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraSort.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.cassandra;
-
-import org.apache.calcite.plan.RelOptCluster;
-import org.apache.calcite.plan.RelOptCost;
-import org.apache.calcite.plan.RelOptPlanner;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.RelCollation;
-import org.apache.calcite.rel.RelFieldCollation;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.core.Sort;
-import org.apache.calcite.rel.metadata.RelMetadataQuery;
-import org.apache.calcite.rel.type.RelDataTypeField;
-import org.apache.calcite.rex.RexNode;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Implementation of {@link org.apache.calcite.rel.core.Sort}
- * relational expression in Cassandra.
- */
-public class CassandraSort extends Sort implements CassandraRel {
-  public CassandraSort(RelOptCluster cluster, RelTraitSet traitSet,
-      RelNode child, RelCollation collation) {
-    super(cluster, traitSet, child, collation, null, null);
-
-    assert getConvention() == CassandraRel.CONVENTION;
-    assert getConvention() == child.getConvention();
-  }
-
-  @Override public RelOptCost computeSelfCost(RelOptPlanner planner,
-      RelMetadataQuery mq) {
-    RelOptCost cost = super.computeSelfCost(planner, mq);
-    if (!collation.getFieldCollations().isEmpty()) {
-      return cost.multiplyBy(0.05);
-    } else {
-      return cost;
-    }
-  }
-
-  @Override public Sort copy(RelTraitSet traitSet, RelNode input,
-      RelCollation newCollation, RexNode offset, RexNode fetch) {
-    return new CassandraSort(getCluster(), traitSet, input, collation);
-  }
-
-  public void implement(Implementor implementor) {
-    implementor.visitChild(0, getInput());
-
-    List<RelFieldCollation> sortCollations = collation.getFieldCollations();
-    List<String> fieldOrder = new ArrayList<String>();
-    if (!sortCollations.isEmpty()) {
-      // Construct a series of order clauses from the desired collation
-      final List<RelDataTypeField> fields = getRowType().getFieldList();
-      for (RelFieldCollation fieldCollation : sortCollations) {
-        final String name =
-            fields.get(fieldCollation.getFieldIndex()).getName();
-        String direction = "ASC";
-        if (fieldCollation.getDirection().equals(RelFieldCollation.Direction.DESCENDING)) {
-          direction = "DESC";
-        }
-        fieldOrder.add(name + " " + direction);
-      }
-
-      implementor.addOrder(fieldOrder);
-    }
-  }
-}
-
-// End CassandraSort.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraTable.java
----------------------------------------------------------------------
diff --git a/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraTable.java b/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraTable.java
deleted file mode 100644
index ec2a636..0000000
--- a/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraTable.java
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.cassandra;
-
-import org.apache.calcite.adapter.java.AbstractQueryableTable;
-import org.apache.calcite.linq4j.AbstractEnumerable;
-import org.apache.calcite.linq4j.Enumerable;
-import org.apache.calcite.linq4j.Enumerator;
-import org.apache.calcite.linq4j.QueryProvider;
-import org.apache.calcite.linq4j.Queryable;
-import org.apache.calcite.linq4j.function.Function1;
-import org.apache.calcite.plan.RelOptCluster;
-import org.apache.calcite.plan.RelOptTable;
-import org.apache.calcite.rel.RelFieldCollation;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.type.RelDataType;
-import org.apache.calcite.rel.type.RelDataTypeFactory;
-import org.apache.calcite.rel.type.RelDataTypeImpl;
-import org.apache.calcite.rel.type.RelDataTypeSystem;
-import org.apache.calcite.rel.type.RelProtoDataType;
-import org.apache.calcite.schema.SchemaPlus;
-import org.apache.calcite.schema.TranslatableTable;
-import org.apache.calcite.schema.impl.AbstractTableQueryable;
-import org.apache.calcite.sql.type.SqlTypeFactoryImpl;
-import org.apache.calcite.sql.type.SqlTypeName;
-import org.apache.calcite.util.Pair;
-import org.apache.calcite.util.Util;
-
-import com.datastax.driver.core.ResultSet;
-import com.datastax.driver.core.Session;
-
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Table based on a Cassandra column family
- */
-public class CassandraTable extends AbstractQueryableTable
-    implements TranslatableTable {
-  RelProtoDataType protoRowType;
-  Pair<List<String>, List<String>> keyFields;
-  List<RelFieldCollation> clusteringOrder;
-  private final CassandraSchema schema;
-  private final String columnFamily;
-  private final boolean view;
-
-  public CassandraTable(CassandraSchema schema, String columnFamily, boolean view) {
-    super(Object[].class);
-    this.schema = schema;
-    this.columnFamily = columnFamily;
-    this.view = view;
-  }
-
-  public CassandraTable(CassandraSchema schema, String columnFamily) {
-    this(schema, columnFamily, false);
-  }
-
-  public String toString() {
-    return "CassandraTable {" + columnFamily + "}";
-  }
-
-  public RelDataType getRowType(RelDataTypeFactory typeFactory) {
-    if (protoRowType == null) {
-      protoRowType = schema.getRelDataType(columnFamily, view);
-    }
-    return protoRowType.apply(typeFactory);
-  }
-
-  public Pair<List<String>, List<String>> getKeyFields() {
-    if (keyFields == null) {
-      keyFields = schema.getKeyFields(columnFamily, view);
-    }
-    return keyFields;
-  }
-
-  public List<RelFieldCollation> getClusteringOrder() {
-    if (clusteringOrder == null) {
-      clusteringOrder = schema.getClusteringOrder(columnFamily, view);
-    }
-    return clusteringOrder;
-  }
-
-  public Enumerable<Object> query(final Session session) {
-    return query(session, Collections.<Map.Entry<String, Class>>emptyList(),
-        Collections.<Map.Entry<String, String>>emptyList(),
-        Collections.<String>emptyList(), Collections.<String>emptyList(), 0, -1);
-  }
-
-  /** Executes a CQL query on the underlying table.
-   *
-   * @param session Cassandra session
-   * @param fields List of fields to project
-   * @param predicates A list of predicates which should be used in the query
-   * @return Enumerator of results
-   */
-  public Enumerable<Object> query(final Session session, List<Map.Entry<String, Class>> fields,
-        final List<Map.Entry<String, String>> selectFields, List<String> predicates,
-        List<String> order, final Integer offset, final Integer fetch) {
-    // Build the type of the resulting row based on the provided fields
-    final RelDataTypeFactory typeFactory =
-        new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT);
-    final RelDataTypeFactory.FieldInfoBuilder fieldInfo = typeFactory.builder();
-    final RelDataType rowType = protoRowType.apply(typeFactory);
-
-    Function1<String, Void> addField = new Function1<String, Void>() {
-      public Void apply(String fieldName) {
-        SqlTypeName typeName = rowType.getField(fieldName, true, false).getType().getSqlTypeName();
-        fieldInfo.add(fieldName, typeFactory.createSqlType(typeName)).nullable(true);
-        return null;
-      }
-    };
-
-    if (selectFields.isEmpty()) {
-      for (Map.Entry<String, Class> field : fields) {
-        addField.apply(field.getKey());
-      }
-    } else {
-      for (Map.Entry<String, String> field : selectFields) {
-        addField.apply(field.getKey());
-      }
-    }
-
-    final RelProtoDataType resultRowType = RelDataTypeImpl.proto(fieldInfo.build());
-
-    // Construct the list of fields to project
-    final String selectString;
-    if (selectFields.isEmpty()) {
-      selectString = "*";
-    } else {
-      selectString = Util.toString(new Iterable<String>() {
-        public Iterator<String> iterator() {
-          final Iterator<Map.Entry<String, String>> selectIterator =
-              selectFields.iterator();
-
-          return new Iterator<String>() {
-            @Override public boolean hasNext() {
-              return selectIterator.hasNext();
-            }
-
-            @Override public String next() {
-              Map.Entry<String, String> entry = selectIterator.next();
-              return entry.getKey() + " AS " + entry.getValue();
-            }
-
-            @Override public void remove() {
-              throw new UnsupportedOperationException();
-            }
-          };
-        }
-      }, "", ", ", "");
-    }
-
-    // Combine all predicates conjunctively
-    String whereClause = "";
-    if (!predicates.isEmpty()) {
-      whereClause = " WHERE ";
-      whereClause += Util.toString(predicates, "", " AND ", "");
-    }
-
-    // Build and issue the query and return an Enumerator over the results
-    StringBuilder queryBuilder = new StringBuilder("SELECT ");
-    queryBuilder.append(selectString);
-    queryBuilder.append(" FROM \"" + columnFamily + "\"");
-    queryBuilder.append(whereClause);
-    if (!order.isEmpty()) {
-      queryBuilder.append(Util.toString(order, " ORDER BY ", ", ", ""));
-    }
-
-    int limit = offset;
-    if (fetch >= 0) { limit += fetch; }
-    if (limit > 0) {
-      queryBuilder.append(" LIMIT " + limit);
-    }
-    queryBuilder.append(" ALLOW FILTERING");
-    final String query = queryBuilder.toString();
-
-    return new AbstractEnumerable<Object>() {
-      public Enumerator<Object> enumerator() {
-        final ResultSet results = session.execute(query);
-        // Skip results until we get to the right offset
-        int skip = 0;
-        Enumerator<Object> enumerator = new CassandraEnumerator(results, resultRowType);
-        while (skip < offset && enumerator.moveNext()) { skip++; }
-
-        return enumerator;
-      }
-    };
-  }
-
-  public <T> Queryable<T> asQueryable(QueryProvider queryProvider,
-      SchemaPlus schema, String tableName) {
-    return new CassandraQueryable<>(queryProvider, schema, this, tableName);
-  }
-
-  public RelNode toRel(
-      RelOptTable.ToRelContext context,
-      RelOptTable relOptTable) {
-    final RelOptCluster cluster = context.getCluster();
-    return new CassandraTableScan(cluster, cluster.traitSetOf(CassandraRel.CONVENTION),
-        relOptTable, this, null);
-  }
-
-  /** Implementation of {@link org.apache.calcite.linq4j.Queryable} based on
-   * a {@link org.apache.calcite.adapter.cassandra.CassandraTable}. */
-  public static class CassandraQueryable<T> extends AbstractTableQueryable<T> {
-    public CassandraQueryable(QueryProvider queryProvider, SchemaPlus schema,
-        CassandraTable table, String tableName) {
-      super(queryProvider, schema, table, tableName);
-    }
-
-    public Enumerator<T> enumerator() {
-      //noinspection unchecked
-      final Enumerable<T> enumerable =
-          (Enumerable<T>) getTable().query(getSession());
-      return enumerable.enumerator();
-    }
-
-    private CassandraTable getTable() {
-      return (CassandraTable) table;
-    }
-
-    private Session getSession() {
-      return schema.unwrap(CassandraSchema.class).session;
-    }
-
-    /** Called via code-generation.
-     *
-     * @see org.apache.calcite.adapter.cassandra.CassandraMethod#CASSANDRA_QUERYABLE_QUERY
-     */
-    @SuppressWarnings("UnusedDeclaration")
-    public Enumerable<Object> query(List<Map.Entry<String, Class>> fields,
-        List<Map.Entry<String, String>> selectFields, List<String> predicates,
-        List<String> order, Integer offset, Integer fetch) {
-      return getTable().query(getSession(), fields, selectFields, predicates,
-          order, offset, fetch);
-    }
-  }
-}
-
-// End CassandraTable.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraTableScan.java
----------------------------------------------------------------------
diff --git a/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraTableScan.java b/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraTableScan.java
deleted file mode 100644
index 3197d93..0000000
--- a/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraTableScan.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.cassandra;
-
-import org.apache.calcite.plan.RelOptCluster;
-import org.apache.calcite.plan.RelOptPlanner;
-import org.apache.calcite.plan.RelOptRule;
-import org.apache.calcite.plan.RelOptTable;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.core.TableScan;
-import org.apache.calcite.rel.type.RelDataType;
-
-import java.util.List;
-
-/**
- * Relational expression representing a scan of a Cassandra collection.
- */
-public class CassandraTableScan extends TableScan implements CassandraRel {
-  final CassandraTable cassandraTable;
-  final RelDataType projectRowType;
-
-  /**
-   * Creates a CassandraTableScan.
-   *
-   * @param cluster        Cluster
-   * @param traitSet       Traits
-   * @param table          Table
-   * @param cassandraTable Cassandra table
-   * @param projectRowType Fields and types to project; null to project raw row
-   */
-  protected CassandraTableScan(RelOptCluster cluster, RelTraitSet traitSet,
-      RelOptTable table, CassandraTable cassandraTable, RelDataType projectRowType) {
-    super(cluster, traitSet, table);
-    this.cassandraTable = cassandraTable;
-    this.projectRowType = projectRowType;
-
-    assert cassandraTable != null;
-    assert getConvention() == CassandraRel.CONVENTION;
-  }
-
-  @Override public RelNode copy(RelTraitSet traitSet, List<RelNode> inputs) {
-    assert inputs.isEmpty();
-    return this;
-  }
-
-  @Override public RelDataType deriveRowType() {
-    return projectRowType != null ? projectRowType : super.deriveRowType();
-  }
-
-  @Override public void register(RelOptPlanner planner) {
-    planner.addRule(CassandraToEnumerableConverterRule.INSTANCE);
-    for (RelOptRule rule : CassandraRules.RULES) {
-      planner.addRule(rule);
-    }
-  }
-
-  public void implement(Implementor implementor) {
-    implementor.cassandraTable = cassandraTable;
-    implementor.table = table;
-  }
-}
-
-// End CassandraTableScan.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraToEnumerableConverter.java
----------------------------------------------------------------------
diff --git a/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraToEnumerableConverter.java b/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraToEnumerableConverter.java
deleted file mode 100644
index 66db1ff..0000000
--- a/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraToEnumerableConverter.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.cassandra;
-
-import org.apache.calcite.adapter.enumerable.EnumerableRel;
-import org.apache.calcite.adapter.enumerable.EnumerableRelImplementor;
-import org.apache.calcite.adapter.enumerable.JavaRowFormat;
-import org.apache.calcite.adapter.enumerable.PhysType;
-import org.apache.calcite.adapter.enumerable.PhysTypeImpl;
-import org.apache.calcite.linq4j.tree.BlockBuilder;
-import org.apache.calcite.linq4j.tree.Expression;
-import org.apache.calcite.linq4j.tree.Expressions;
-import org.apache.calcite.linq4j.tree.MethodCallExpression;
-import org.apache.calcite.plan.ConventionTraitDef;
-import org.apache.calcite.plan.RelOptCluster;
-import org.apache.calcite.plan.RelOptCost;
-import org.apache.calcite.plan.RelOptPlanner;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.prepare.CalcitePrepareImpl;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.convert.ConverterImpl;
-import org.apache.calcite.rel.metadata.RelMetadataQuery;
-import org.apache.calcite.rel.type.RelDataType;
-import org.apache.calcite.runtime.Hook;
-import org.apache.calcite.util.BuiltInMethod;
-import org.apache.calcite.util.Pair;
-
-import com.google.common.base.Function;
-import com.google.common.collect.Lists;
-
-import java.util.AbstractList;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Relational expression representing a scan of a table in a Cassandra data source.
- */
-public class CassandraToEnumerableConverter
-  extends ConverterImpl
-  implements EnumerableRel {
-  protected CassandraToEnumerableConverter(
-      RelOptCluster cluster,
-      RelTraitSet traits,
-      RelNode input) {
-    super(cluster, ConventionTraitDef.INSTANCE, traits, input);
-  }
-
-  @Override public RelNode copy(RelTraitSet traitSet, List<RelNode> inputs) {
-    return new CassandraToEnumerableConverter(
-        getCluster(), traitSet, sole(inputs));
-  }
-
-  @Override public RelOptCost computeSelfCost(RelOptPlanner planner,
-      RelMetadataQuery mq) {
-    return super.computeSelfCost(planner, mq).multiplyBy(.1);
-  }
-
-  public Result implement(EnumerableRelImplementor implementor, Prefer pref) {
-    // Generates a call to "query" with the appropriate fields and predicates
-    final BlockBuilder list = new BlockBuilder();
-    final CassandraRel.Implementor cassandraImplementor = new CassandraRel.Implementor();
-    cassandraImplementor.visitChild(0, getInput());
-    final RelDataType rowType = getRowType();
-    final PhysType physType =
-        PhysTypeImpl.of(
-                implementor.getTypeFactory(), rowType,
-                pref.prefer(JavaRowFormat.ARRAY));
-    final Expression fields =
-        list.append("fields",
-            constantArrayList(
-                Pair.zip(CassandraRules.cassandraFieldNames(rowType),
-                    new AbstractList<Class>() {
-                      @Override public Class get(int index) {
-                        return physType.fieldClass(index);
-                      }
-
-                      @Override public int size() {
-                        return rowType.getFieldCount();
-                      }
-                    }),
-                Pair.class));
-    List<Map.Entry<String, String>> selectList = new ArrayList<Map.Entry<String, String>>();
-    for (Map.Entry<String, String> entry
-            : Pair.zip(cassandraImplementor.selectFields.keySet(),
-                cassandraImplementor.selectFields.values())) {
-      selectList.add(entry);
-    }
-    final Expression selectFields =
-        list.append("selectFields", constantArrayList(selectList, Pair.class));
-    final Expression table =
-        list.append("table",
-            cassandraImplementor.table.getExpression(
-                CassandraTable.CassandraQueryable.class));
-    final Expression predicates =
-        list.append("predicates",
-            constantArrayList(cassandraImplementor.whereClause, String.class));
-    final Expression order =
-        list.append("order",
-            constantArrayList(cassandraImplementor.order, String.class));
-    final Expression offset =
-        list.append("offset",
-            Expressions.constant(cassandraImplementor.offset));
-    final Expression fetch =
-        list.append("fetch",
-            Expressions.constant(cassandraImplementor.fetch));
-    Expression enumerable =
-        list.append("enumerable",
-            Expressions.call(table,
-                CassandraMethod.CASSANDRA_QUERYABLE_QUERY.method, fields,
-                selectFields, predicates, order, offset, fetch));
-    if (CalcitePrepareImpl.DEBUG) {
-      System.out.println("Cassandra: " + predicates);
-    }
-    Hook.QUERY_PLAN.run(predicates);
-    list.add(
-        Expressions.return_(null, enumerable));
-    return implementor.result(physType, list.toBlock());
-  }
-
-  /** E.g. {@code constantArrayList("x", "y")} returns
-   * "Arrays.asList('x', 'y')". */
-  private static <T> MethodCallExpression constantArrayList(List<T> values,
-      Class clazz) {
-    return Expressions.call(
-        BuiltInMethod.ARRAYS_AS_LIST.method,
-        Expressions.newArrayInit(clazz, constantList(values)));
-  }
-
-  /** E.g. {@code constantList("x", "y")} returns
-   * {@code {ConstantExpression("x"), ConstantExpression("y")}}. */
-  private static <T> List<Expression> constantList(List<T> values) {
-    return Lists.transform(values,
-        new Function<T, Expression>() {
-          public Expression apply(T a0) {
-            return Expressions.constant(a0);
-          }
-        });
-  }
-}
-
-// End CassandraToEnumerableConverter.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraToEnumerableConverterRule.java
----------------------------------------------------------------------
diff --git a/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraToEnumerableConverterRule.java b/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraToEnumerableConverterRule.java
deleted file mode 100644
index 2ded8c8..0000000
--- a/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraToEnumerableConverterRule.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.cassandra;
-
-import org.apache.calcite.adapter.enumerable.EnumerableConvention;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.convert.ConverterRule;
-
-/**
- * Rule to convert a relational expression from
- * {@link CassandraRel#CONVENTION} to {@link EnumerableConvention}.
- */
-public class CassandraToEnumerableConverterRule extends ConverterRule {
-  public static final ConverterRule INSTANCE =
-    new CassandraToEnumerableConverterRule();
-
-  private CassandraToEnumerableConverterRule() {
-    super(RelNode.class, CassandraRel.CONVENTION, EnumerableConvention.INSTANCE,
-        "CassandraToEnumerableConverterRule");
-  }
-
-  @Override public RelNode convert(RelNode rel) {
-    RelTraitSet newTraitSet = rel.getTraitSet().replace(getOutConvention());
-    return new CassandraToEnumerableConverter(rel.getCluster(), newTraitSet, rel);
-  }
-}
-
-// End CassandraToEnumerableConverterRule.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/package-info.java
----------------------------------------------------------------------
diff --git a/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/package-info.java b/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/package-info.java
deleted file mode 100644
index c4be45a..0000000
--- a/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/package-info.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * Cassandra query provider.
- *
- * <p>There is one table for each Cassandra column family.</p>
- */
-@PackageMarker
-package org.apache.calcite.adapter.cassandra;
-
-import org.apache.calcite.avatica.util.PackageMarker;
-
-// End package-info.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/cassandra/src/test/java/org/apache/calcite/test/CassandraAdapterIT.java
----------------------------------------------------------------------
diff --git a/cassandra/src/test/java/org/apache/calcite/test/CassandraAdapterIT.java b/cassandra/src/test/java/org/apache/calcite/test/CassandraAdapterIT.java
deleted file mode 100644
index bca9233..0000000
--- a/cassandra/src/test/java/org/apache/calcite/test/CassandraAdapterIT.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.test;
-
-import org.apache.calcite.util.Util;
-
-import com.google.common.collect.ImmutableMap;
-
-import org.junit.Test;
-
-/**
- * Tests for the {@code org.apache.calcite.adapter.cassandra} package.
- *
- * <p>Before calling this test, you need to populate Cassandra, as follows:
- *
- * <blockquote><code>
- * git clone https://github.com/vlsi/calcite-test-dataset<br>
- * cd calcite-test-dataset<br>
- * mvn install
- * </code></blockquote>
- *
- * <p>This will create a virtual machine with Cassandra and the "twissandra"
- * test data set.
- */
-public class CassandraAdapterIT {
-  /** Connection factory based on the "mongo-zips" model. */
-  public static final ImmutableMap<String, String> TWISSANDRA =
-      ImmutableMap.of("model",
-          CassandraAdapterIT.class.getResource("/model.json")
-              .getPath());
-
-  /** Whether to run Cassandra tests. Enabled by default, however test is only
-   * included if "it" profile is activated ({@code -Pit}). To disable,
-   * specify {@code -Dcalcite.test.cassandra=false} on the Java command line. */
-  public static final boolean ENABLED =
-     Util.getBooleanProperty("calcite.test.cassandra", true);
-
-  /** Whether to run this test. */
-  protected boolean enabled() {
-    return ENABLED;
-  }
-
-  @Test public void testSelect() {
-    CalciteAssert.that()
-        .enable(enabled())
-        .with(TWISSANDRA)
-        .query("select * from \"users\"")
-        .returnsCount(10);
-  }
-
-  @Test public void testFilter() {
-    CalciteAssert.that()
-        .enable(enabled())
-        .with(TWISSANDRA)
-        .query("select * from \"userline\" where \"username\"='!PUBLIC!'")
-        .limit(1)
-        .returns("username=!PUBLIC!; time=e8754000-80b8-1fe9-8e73-e3698c967ddd; "
-            + "tweet_id=f3c329de-d05b-11e5-b58b-90e2ba530b12\n")
-        .explainContains("PLAN=CassandraToEnumerableConverter\n"
-           + "  CassandraFilter(condition=[=($0, '!PUBLIC!')])\n"
-           + "    CassandraTableScan(table=[[twissandra, userline]]");
-  }
-
-  @Test public void testFilterUUID() {
-    CalciteAssert.that()
-        .enable(enabled())
-        .with(TWISSANDRA)
-        .query("select * from \"tweets\" where \"tweet_id\"='f3cd759c-d05b-11e5-b58b-90e2ba530b12'")
-        .limit(1)
-        .returns("tweet_id=f3cd759c-d05b-11e5-b58b-90e2ba530b12; "
-            + "body=Lacus augue pede posuere.; username=JmuhsAaMdw\n")
-        .explainContains("PLAN=CassandraToEnumerableConverter\n"
-           + "  CassandraFilter(condition=[=(CAST($0):CHAR(36) CHARACTER SET \"ISO-8859-1\" COLLATE \"ISO-8859-1$en_US$primary\", 'f3cd759c-d05b-11e5-b58b-90e2ba530b12')])\n"
-           + "    CassandraTableScan(table=[[twissandra, tweets]]");
-  }
-
-  @Test public void testSort() {
-    CalciteAssert.that()
-        .enable(enabled())
-        .with(TWISSANDRA)
-        .query("select * from \"userline\" where \"username\" = '!PUBLIC!' order by \"time\" desc")
-        .returnsCount(146)
-        .explainContains("PLAN=CassandraToEnumerableConverter\n"
-            + "  CassandraSort(sort0=[$1], dir0=[DESC])\n"
-            + "    CassandraFilter(condition=[=($0, '!PUBLIC!')])\n");
-  }
-
-  @Test public void testProject() {
-    CalciteAssert.that()
-        .enable(enabled())
-        .with(TWISSANDRA)
-        .query("select \"tweet_id\" from \"userline\" where \"username\" = '!PUBLIC!' limit 2")
-        .returns("tweet_id=f3c329de-d05b-11e5-b58b-90e2ba530b12\n"
-               + "tweet_id=f3dbb03a-d05b-11e5-b58b-90e2ba530b12\n")
-        .explainContains("PLAN=CassandraToEnumerableConverter\n"
-                + "  CassandraLimit(fetch=[2])\n"
-                + "    CassandraProject(tweet_id=[$2])\n"
-                + "      CassandraFilter(condition=[=($0, '!PUBLIC!')])\n");
-  }
-
-  @Test public void testProjectAlias() {
-    CalciteAssert.that()
-        .enable(enabled())
-        .with(TWISSANDRA)
-        .query("select \"tweet_id\" as \"foo\" from \"userline\" "
-                + "where \"username\" = '!PUBLIC!' limit 1")
-        .returns("foo=f3c329de-d05b-11e5-b58b-90e2ba530b12\n");
-  }
-
-  @Test public void testProjectConstant() {
-    CalciteAssert.that()
-        .enable(enabled())
-        .with(TWISSANDRA)
-        .query("select 'foo' as \"bar\" from \"userline\" limit 1")
-        .returns("bar=foo\n");
-  }
-
-  @Test public void testLimit() {
-    CalciteAssert.that()
-        .enable(enabled())
-        .with(TWISSANDRA)
-        .query("select \"tweet_id\" from \"userline\" where \"username\" = '!PUBLIC!' limit 8")
-        .explainContains("CassandraLimit(fetch=[8])\n");
-  }
-
-  @Test public void testSortLimit() {
-    CalciteAssert.that()
-        .enable(enabled())
-        .with(TWISSANDRA)
-        .query("select * from \"userline\" where \"username\"='!PUBLIC!' "
-             + "order by \"time\" desc limit 10")
-        .explainContains("  CassandraLimit(fetch=[10])\n"
-                       + "    CassandraSort(sort0=[$1], dir0=[DESC])");
-  }
-
-  @Test public void testSortOffset() {
-    CalciteAssert.that()
-        .enable(enabled())
-        .with(TWISSANDRA)
-        .query("select \"tweet_id\" from \"userline\" where "
-             + "\"username\"='!PUBLIC!' limit 2 offset 1")
-        .explainContains("CassandraLimit(offset=[1], fetch=[2])")
-        .returns("tweet_id=f3dbb03a-d05b-11e5-b58b-90e2ba530b12\n"
-               + "tweet_id=f3e4182e-d05b-11e5-b58b-90e2ba530b12\n");
-  }
-
-  @Test public void testMaterializedView() {
-    CalciteAssert.that()
-        .enable(enabled())
-        .with(TWISSANDRA)
-        .query("select \"tweet_id\" from \"tweets\" where \"username\"='JmuhsAaMdw'")
-        .enableMaterializations(true)
-        .explainContains("CassandraTableScan(table=[[twissandra, tweets_by_user]])");
-  }
-}
-
-// End CassandraAdapterIT.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/cassandra/src/test/resources/model.json
----------------------------------------------------------------------
diff --git a/cassandra/src/test/resources/model.json b/cassandra/src/test/resources/model.json
deleted file mode 100644
index 5713d11..0000000
--- a/cassandra/src/test/resources/model.json
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.
- */
-{
-  "version": "1.0",
-  "defaultSchema": "twissandra",
-  "schemas": [
-    {
-      "name": "twissandra",
-      "type": "custom",
-      "factory": "org.apache.calcite.adapter.cassandra.CassandraSchemaFactory",
-      "operand": {
-        "host": "localhost",
-        "keyspace": "twissandra"
-      }
-    }
-  ]
-}


[20/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/site/_docs/custom_client_artifacts.md
----------------------------------------------------------------------
diff --git a/avatica/site/_docs/custom_client_artifacts.md b/avatica/site/_docs/custom_client_artifacts.md
deleted file mode 100644
index f128a4f..0000000
--- a/avatica/site/_docs/custom_client_artifacts.md
+++ /dev/null
@@ -1,133 +0,0 @@
----
-layout: docs
-title: Custom Client Artifacts
-permalink: /docs/custom_client_artifacts.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 %}
--->
-
-As of Apache Calcite Avatica 1.9.0, there are two artifacts (jars) provided that enable client-access
-to an Avatica server over JDBC.
-
-{% highlight xml %}
-<dependencies>
-  <!-- Shaded artifact -->
-  <dependency>
-    <groupId>org.apache.calcite.avatica</groupId>
-    <artifactId>avatica</artifactId>
-  </dependency>
-  <!-- Non-shaded artifact -->
-  <dependency>
-    <groupId>org.apache.calcite.avatica</groupId>
-    <artifactId>avatica-core</artifactId>
-  </dependency>
-</dependencies>
-{% endhighlight %}
-
-In keeping with the convention of previous releases, `org.apache.calcite.avatica:avatica` is a JAR
-which contains all of the necessary dependencies of the Avatica client code base. Those classes which
-can be safely relocated are done so to reduce the potential for classpath issues.
-
-Avatica 1.9.0 will introduce a new artifact `org.apache.calcite.avatica:avatica-core` which is only
-the Avatica client classes without any bundled dependencies. This artifact enables users to build a
-classpath with different versions of JARs than what Avatica presently depends upon. This is a "your-mileage-may-vary"
-or "void-your-warranty" type of decision (as you are using Avatica with dependecies which we have not tested);
-however, some downstream projects do provide reasonable assurances of compatibilities across releases.
-
-## Building your own Avatica client artifact
-
-In some cases, it may be beneficial to provide specific versions of Avatica dependencies. Here is
-a brief `pom.xml` which outlines how this can be done.
-
-{% highlight xml %}
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>myorg.custom.client</groupId>
-  <artifactId>my-special-app-client</artifactId>
-  <packaging>jar</packaging>
-  <name>Special Application Client Artifact</name>
-  <description>A custom artifact which uses Apache Calcite Avatica for my Org's Special Application</description>
-
-  <properties>
-    <myorg.prefix>myorg.custom.client</myorg.prefix>
-  </properties>
-
-  <dependencies>
-    <dependency>
-      <groupId>org.apache.calcite.avatica</groupId>
-      <artifactId>avatica-core</artifactId>
-      <version>1.9.0</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.httpcomponents</groupId>
-      <artifactId>httpclient</artifactId>
-      <!-- Override the version from avatica-core (4.5.2) to address a hypothetical bug in httpclient -->
-      <version>4.5.3</version>
-    </dependency>
-    <!-- Include Guava for the "Special Application" -->
-    <dependency>
-      <groupId>com.google.guava</groupId>
-      <artifactId>guava</artifactId>
-      <version>17.0</version>
-    </dependency>
-  </dependencies>
-
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-              <!-- Relocate Jackson, Protobuf, Apache Commons HttpClient and HttpComponents, but not Guava.
-                   The hypothetical "Special App" would be expecting Guava in the standard location -->
-              <relocations>
-                <relocation>
-                  <pattern>com.fasterxml.jackson</pattern>
-                  <shadedPattern>${myorg.prefix}.com.fasterxml.jackson</shadedPattern>
-                </relocation>
-                <relocation>
-                  <pattern>com.google.protobuf</pattern>
-                  <shadedPattern>${myorg.prefix}.com.google.protobuf</shadedPattern>
-                </relocation>
-                <relocation>
-                  <pattern>org.apache.http</pattern>
-                  <shadedPattern>${myorg.prefix}.org.apache.http</shadedPattern>
-                </relocation>
-                <relocation>
-                  <pattern>org.apache.commons</pattern>
-                  <shadedPattern>${myorg.prefix}.org.apache.commons</shadedPattern>
-                </relocation>
-              </relocations>
-              <createDependencyReducedPom>false</createDependencyReducedPom>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-</project>
-{% endhighlight %}

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/site/_docs/history.md
----------------------------------------------------------------------
diff --git a/avatica/site/_docs/history.md b/avatica/site/_docs/history.md
deleted file mode 100644
index 6e5184f..0000000
--- a/avatica/site/_docs/history.md
+++ /dev/null
@@ -1,314 +0,0 @@
----
-layout: docs
-title: History
-permalink: "/docs/history.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 %}
--->
-
-For a full list of releases, see
-<a href="https://github.com/apache/calcite/releases">github</a>.
-Downloads are available on the
-[downloads page]({{ site.baseurl }}/downloads/).
-
-## <a href="https://github.com/apache/calcite/releases/tag/calcite-avatica-1.9.0">1.9.0</a> / 2016-11-01
-{: #v1-9-0}
-
-Apache Calcite Avatica 1.9.0 includes various improvements to make it
-more robust and secure, while maintaining API and protocol
-compatibility with previous versions. We now include non-shaded and
-shaded artifacts, to make it easier to embed Avatica in your
-application. There is improved support for the JDBC API, including
-better type conversions and support for canceling statements. The
-transport is upgraded to use protobuf-3.1.0 (previously 3.0 beta).
-
-Compatibility: This release is tested
-on Linux, macOS, Microsoft Windows;
-using Oracle JDK 1.7, 1.8;
-Guava versions 14.0 to 19.0;
-other software versions as specified in `pom.xml`.
-
-Features and bug fixes
-
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1471">CALCITE-1471</a>]
-  `HttpServerSpnegoWithJaasTest.testAuthenticatedClientsAllowed` fails on Windows
-  (Aaron Mihalik)
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1464">CALCITE-1464</a>]
-  Upgrade Jetty version to 9.2.19v20160908
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1463">CALCITE-1463</a>]
-  In `standalone-server` jar, relocate dependencies rather than excluding them
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1355">CALCITE-1355</a>]
-  Upgrade to protobuf-java 3.1.0
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1462">CALCITE-1462</a>]
-  Remove Avatica pom cruft
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1458">CALCITE-1458</a>]
-  Add column values to the deprecated protobuf attribute
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1433">CALCITE-1433</a>]
-  Add missing dependencies to `avatica-server`
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1433">CALCITE-1433</a>]
-  Fix missing avatica `test-jar` dependency
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1423">CALCITE-1423</a>]
-  Add method `ByteString.indexOf(ByteString, int)`
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1408">CALCITE-1408</a>]
-  `ResultSet.getXxx` methods should throw `SQLDataException` if cannot convert to
-  the requested type (Laurent Goujon)
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1410">CALCITE-1410</a>]
-  Fix JDBC metadata classes (Laurent Goujon)
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1224">CALCITE-1224</a>]
-  Publish non-shaded and shaded versions of Avatica client artifacts
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1407">CALCITE-1407</a>]
-  `MetaImpl.fieldMetaData` wrongly uses 1-based column ordinals
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1361">CALCITE-1361</a>]
-  Remove entry from `AvaticaConnection.flagMap` when session closed
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1399">CALCITE-1399</a>]
-  Make the jcommander `SerializationConverter` public
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1394">CALCITE-1394</a>]
-  Javadoc warnings due to `CoreMatchers.containsString` and `mockito-all`
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1390">CALCITE-1390</a>]
-  Avatica JDBC driver wrongly modifies `Properties` object
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1371">CALCITE-1371</a>]
-  `PreparedStatement` does not process Date type correctly (Billy (Yiming) Liu)
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1301">CALCITE-1301</a>]
-  Add `cancel` flag to `AvaticaStatement`
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1315">CALCITE-1315</a>]
-  Retry the request on `NoHttpResponseException`
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1300">CALCITE-1300</a>]
-  Retry on HTTP-503 in hc-based `AvaticaHttpClient`
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1263">CALCITE-1263</a>]
-  Case-insensitive match and null default value for `enum` properties
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1282">CALCITE-1282</a>]
-  Adds an API method to set extra allowed Kerberos realms
-
-Tests
-
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1226">CALCITE-1226</a>]
-  Disable `AvaticaSpnegoTest` due to intermittent failures
-
-Web site and documentation
-
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1369">CALCITE-1369</a>]
-  Add list of Avatica clients to the web site
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1229">CALCITE-1229</a>]
-  Restore API and Test API links to site
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1287">CALCITE-1287</a>]
-  TCK test for binary columns
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1285">CALCITE-1285</a>]
-  Fix client URL template in example config file
-
-## <a href="https://github.com/apache/calcite/releases/tag/calcite-avatica-1.8.0">1.8.0</a> / 2016-06-04
-{: #v1-8-0}
-
-Apache Calcite Avatica 1.8.0 continues the focus on compatibility with previous
-versions while also adding support for authentication between Avatica client and server.
-Performance, notably on the write-path, is also major area of improvement
-in this release, increasing as much as two to three times over previous versions
-with the addition of new API support. The documentation for both users and developers
-continues to receive improvements.
-
-A number of protocol issues are resolved relating to the proper serialization of
-decimals, the wire-API semantics of signed integers that were marked as unsigned
-integers, and the unintentional Base64-encoding of binary data using the Protocol
-Buffers serialization in Avatica. These issues were fixed in such a way to be
-backwards compatible, but older clients/servers may still compute incorrect data.
-
-Users of Avatica 1.7.x should not notice any issues in upgrading existing applications
-and are encouraged to upgrade as soon as possible.
-
-Features and bug fixes
-
-* [<a href='https://issues.apache.org/jira/browse/CALCITE-1159'>CALCITE-1159</a>]
-  Support Kerberos-authenticated clients using SPNEGO
-* [<a href='https://issues.apache.org/jira/browse/CALCITE-1173'>CALCITE-1173</a>]
-  Basic and Digest authentication
-* [<a href='https://issues.apache.org/jira/browse/CALCITE-1249'>CALCITE-1249</a>]
-  L&N incorrect for source and non-shaded jars for avatica-standalone-server module
-* [<a href='https://issues.apache.org/jira/browse/CALCITE-1103'>CALCITE-1103</a>]
-  Decimal data serialized as Double in Protocol Buffer API
-* [<a href='https://issues.apache.org/jira/browse/CALCITE-1205'>CALCITE-1205</a>]
-  Inconsistency in protobuf TypedValue field names
-* [<a href='https://issues.apache.org/jira/browse/CALCITE-1207'>CALCITE-1207</a>]
-  Allow numeric connection properties, and K, M, G suffixes
-* [<a href='https://issues.apache.org/jira/browse/CALCITE-1209'>CALCITE-1209</a>]
-  Byte strings not being correctly decoded when sent to avatica using protocol buffers
-* [<a href='https://issues.apache.org/jira/browse/CALCITE-1213'>CALCITE-1213</a>]
-  Changing AvaticaDatabaseMetaData from class to interface breaks compatibility
-* [<a href='https://issues.apache.org/jira/browse/CALCITE-1218'>CALCITE-1218</a>]
-  Mishandling of uncaught exceptions results in no ErrorResponse sent to client
-* [<a href='https://issues.apache.org/jira/browse/CALCITE-1230'>CALCITE-1230</a>]
-  Add SQLSTATE reference data as enum SqlState
-* [<a href='https://issues.apache.org/jira/browse/CALCITE-1243'>CALCITE-1243</a>]
-  max_row_count in protobuf Requests should be signed int
-* [<a href='https://issues.apache.org/jira/browse/CALCITE-1247'>CALCITE-1247</a>]
-  JdbcMeta#prepare doesn't set maxRowCount on the Statement
-* [<a href='https://issues.apache.org/jira/browse/CALCITE-1254'>CALCITE-1254</a>]
-  Support PreparedStatement.executeLargeBatch
-* [<a href='https://issues.apache.org/jira/browse/CALCITE-643'>CALCITE-643</a>]
-  User authentication for avatica clients
-* [<a href='https://issues.apache.org/jira/browse/CALCITE-1128'>CALCITE-1128</a>]
-  Support addBatch()/executeBatch() in remote driver
-* [<a href='https://issues.apache.org/jira/browse/CALCITE-1179'>CALCITE-1179</a>]
-  Extend list of time units and time unit ranges
-* [<a href='https://issues.apache.org/jira/browse/CALCITE-1180'>CALCITE-1180</a>]
-  Support clearBatch() in remote driver
-* [<a href='https://issues.apache.org/jira/browse/CALCITE-1185'>CALCITE-1185</a>]
-  Send back ErrorResponse on failure to parse requests
-* [<a href='https://issues.apache.org/jira/browse/CALCITE-1192'>CALCITE-1192</a>]
-  Document protobuf and json REP types with examples
-* [<a href='https://issues.apache.org/jira/browse/CALCITE-1214'>CALCITE-1214</a>]
-  Support url-based kerberos login
-* [<a href='https://issues.apache.org/jira/browse/CALCITE-1236'>CALCITE-1236</a>]
-  Log exceptions sent back to client in server log
-* [<a href='https://issues.apache.org/jira/browse/CALCITE-836'>CALCITE-836</a>]
-  Provide a way for the Avatica client to query the server versions
-* [<a href='https://issues.apache.org/jira/browse/CALCITE-1156'>CALCITE-1156</a>]
-  Bump jetty version
-* [<a href='https://issues.apache.org/jira/browse/CALCITE-1184'>CALCITE-1184</a>]
-  Update Kerby dependency to 1.0.0-RC2
-
-Tests
-
-* [<a href='https://issues.apache.org/jira/browse/CALCITE-1190'>CALCITE-1190</a>]
-  Cross-Version Compatibility Test Harness
-* [<a href='https://issues.apache.org/jira/browse/CALCITE-1113'>CALCITE-1113</a>]
-  Parameter precision and scale are not returned from Avatica REST API
-* [<a href='https://issues.apache.org/jira/browse/CALCITE-1186'>CALCITE-1186</a>]
-  Parameter 'signed' metadata is always returned as false
-* [<a href='https://issues.apache.org/jira/browse/CALCITE-1189'>CALCITE-1189</a>]
-  Unit test failure when JVM default charset is not UTF-8
-* [<a href='https://issues.apache.org/jira/browse/CALCITE-1061'>CALCITE-1061</a>]
-  RemoteMetaTest#testRemoteStatementInsert's use of hsqldb isn't guarded
-* [<a href='https://issues.apache.org/jira/browse/CALCITE-1194'>CALCITE-1194</a>]
-  Avatica metrics has non-test dependency on JUnit
-* [<a href='https://issues.apache.org/jira/browse/CALCITE-835'>CALCITE-835</a>]
-  Unicode character seems to be handled incorrectly in Avatica
-
-Web site and documentation
-
-* [<a href='https://issues.apache.org/jira/browse/CALCITE-1251'>CALCITE-1251</a>]
-  Write release notes
-* [<a href='https://issues.apache.org/jira/browse/CALCITE-1201'>CALCITE-1201</a>]
-  Bad character in JSON docs
-* [<a href='https://issues.apache.org/jira/browse/CALCITE-1267'>CALCITE-1267</a>]
-  Point to release notes on website in README
-* [<a href='https://issues.apache.org/jira/browse/CALCITE-1163'>CALCITE-1163</a>]
-  Avatica sub-site logo leads to Calcite site instead of Avatica's
-* [<a href='https://issues.apache.org/jira/browse/CALCITE-1202'>CALCITE-1202</a>]
-  Lock version of Jekyll used by website
-
-## <a href="https://github.com/apache/calcite/releases/tag/calcite-avatica-1.7.1">1.7.1</a> / 2016-03-18
-{: #v1-7-1}
-
-This is the first release of Avatica as an independent project. (It
-is still governed by Apache Calcite's PMC, and stored in the same git
-repository as Calcite, but releases are no longer synchronized, and
-Avatica does not depend on any Calcite modules.)
-
-One notable technical change is that we have replaced JUL (`java.util.logging`)
-with [SLF4J](http://slf4j.org/). SLF4J provides an API that Avatica can use
-independent of the logging implementation. This is more
-flexible for users: they can configure Avatica's logging within their
-own chosen logging framework. This work was done in
-[[CALCITE-669](https://issues.apache.org/jira/browse/CALCITE-669)].
-
-If you have configured JUL in Calcite/Avatica previously, you'll
-notice some differences, because JUL's `FINE`, `FINER` and `FINEST`
-logging levels do not exist in SLF4J. To deal with this, we mapped
-`FINE` to SLF4J's `DEBUG` level, and mapped `FINER` and `FINEST` to
-SLF4J's `TRACE`.
-
-The performance of Avatica was an important focus for this release as well.
-Numerous improvements aimed at reducing the overall latency of Avatica RPCs
-was reduced. Some general testing showed an overall reduction of latency
-by approximately 15% over the previous release.
-
-Compatibility: This release is tested on Linux, Mac OS X, Microsoft
-Windows; using Oracle JDK 1.7, 1.8; Guava versions 12.0.1 to 19.0;
-other software versions as specified in `pom.xml`.
-
-Features and bug fixes
-
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1156">CALCITE-1156</a>]
-  Upgrade Jetty from 9.2.7.v20150116 to 9.2.15.v20160210
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1141">CALCITE-1141</a>]
-  Bump `version.minor` for Avatica
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1132">CALCITE-1132</a>]
-  Update `artifactId`, `groupId` and `name` for Avatica
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1064">CALCITE-1064</a>]
-  Address problematic `maven-remote-resources-plugin`
-* In `TimeUnit` add `WEEK`, `QUARTER`, `MICROSECOND` values, and change type of
-  `multiplier`
-* Update `groupId` when Calcite POMs reference Avatica modules
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1078">CALCITE-1078</a>]
-  Detach avatica from the core calcite Maven project
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1117">CALCITE-1117</a>]
-  Default to a `commons-httpclient` implementation
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1118">CALCITE-1118</a>]
-  Add a noop-JDBC driver for testing Avatica server
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1119">CALCITE-1119</a>]
-  Additional metrics instrumentation for request processing
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1094">CALCITE-1094</a>]
-  Replace `ByteArrayOutputStream` to avoid synchronized writes
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1092">CALCITE-1092</a>]
-  Use singleton descriptor instances for protobuf field presence checks
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1093">CALCITE-1093</a>]
-  Reduce impact of `ArrayList` performance
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1086">CALCITE-1086</a>]
-  Avoid sending `Signature` on `Execute` for updates
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1031">CALCITE-1031</a>]
-  In prepared statement, `CsvScannableTable.scan` is called twice
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1085">CALCITE-1085</a>]
-  Use a `NoopContext` singleton in `NoopTimer`
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-642">CALCITE-642</a>]
-  Add an avatica-metrics API
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1071">CALCITE-1071</a>]
-  Improve hash functions
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-669">CALCITE-669</a>]
-  Mass removal of Java Logging for SLF4J
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1067">CALCITE-1067</a>]
-  Test failures due to clashing temporary table names
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-999">CALCITE-999</a>]
-  Clean up maven POM files
-
-Web site and documentation
-
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1142">CALCITE-1142</a>]
-  Create a `README` for Avatica
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1144">CALCITE-1144</a>]
-  Fix `LICENSE` for Avatica
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1143">CALCITE-1143</a>]
-  Remove unnecessary `NOTICE` for Avatica
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1139">CALCITE-1139</a>]
-  Update Calcite's `KEYS` and add a copy for Avatica
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1140">CALCITE-1140</a>]
-  Release notes and website updates for Avatica 1.7
-* Instructions for Avatica site
-* New logo and color scheme for Avatica site
-* [<a href="https://issues.apache.org/jira/browse/CALCITE-1079">CALCITE-1079</a>]
-  Split out an Avatica website, made to slot into the Calcite site at `/avatica`
-
-## Past releases
-
-Prior to release 1.7.1, Avatica was released as part of Calcite. Maven
-modules had groupId 'org.apache.calcite' and module names
-'calcite-avatica', 'calcite-avatica-server' etc.
-
-Please refer to the
-[Calcite release page](https://calcite.apache.org/docs/history.html)
-for information about previous Avatica releases.

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/site/_docs/howto.md
----------------------------------------------------------------------
diff --git a/avatica/site/_docs/howto.md b/avatica/site/_docs/howto.md
deleted file mode 100644
index 24689b5..0000000
--- a/avatica/site/_docs/howto.md
+++ /dev/null
@@ -1,535 +0,0 @@
----
-layout: docs
-title: HOWTO
-permalink: /docs/howto.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 %}
--->
-
-Here's some miscellaneous documentation about using Calcite and its various
-adapters.
-
-* TOC
-{:toc}
-
-## Building from a source distribution
-
-Prerequisites are maven (3.2.1 or later)
-and Java (JDK 1.7 or later, 1.8 preferred) on your path.
-
-Unpack the source distribution `.tar.gz` or `.zip` file,
-`cd` to the root directory of the unpacked source,
-then build using maven:
-
-{% highlight bash %}
-$ tar xvfz apache-calcite-avatica-1.9.0-src.tar.gz
-$ cd apache-calcite-avatica-1.9.0-src
-$ mvn install
-{% endhighlight %}
-
-[Running tests](#running-tests) describes how to run more or fewer
-tests.
-
-## Building from git
-
-Prerequisites are git, maven (3.2.1 or later)
-and Java (JDK 1.7 or later, 1.8 preferred) on your path.
-
-Create a local copy of the github repository,
-`cd` to its root directory,
-then build using maven:
-
-{% highlight bash %}
-$ git clone git://github.com/apache/calcite.git
-$ cd calcite/avatica
-$ mvn install
-{% endhighlight %}
-
-[Running tests](#running-tests) describes how to run more or fewer
-tests.
-
-## Running tests
-
-The test suite will run by default when you build, unless you specify
-`-DskipTests`:
-
-{% highlight bash %}
-$ mvn clean verify -Dcheckstyle.skip
-{% endhighlight %}
-
-By default, invoking the `verify` Maven lifecycle phase will also cause checkstyle
-rules to be run. It is expected that contributions pass the checkstyle rules; however,
-it is common to ignore these while working on a feature/bug and fix them at the end.
-
-## Contributing
-
-See the [developers guide]({{ site.baseurl }}/develop/#contributing).
-
-## Getting started
-
-See the [developers guide]({{ site.baseurl }}/develop/#getting-started).
-
-# Advanced topics for developers
-
-The following sections might be of interest if you are adding features
-to particular parts of the code base. You don't need to understand
-these topics if you are just building from source and running tests.
-
-## Rebuilding generated Protocol Buffer code
-
-Calcite's Avatica Server component supports RPC serialization
-using [Protocol Buffers](https://developers.google.com/protocol-buffers/).
-In the context of Avatica, Protocol Buffers can
-generate a collection of messages defined by a schema. The library
-itself can parse old serialized messages using a
-new schema. This is highly desirable in an environment where the
-client and server are not guaranteed to have the same version of
-objects.
-
-Typically, the code generated by the Protocol Buffers library doesn't
-need to be re-generated only every build, only when the schema changes.
-
-First, install Protobuf 3.1:
-
-{% highlight bash %}
-$ wget https://github.com/google/protobuf/releases/download/v3.1.0/protobuf-java-3.1.0.tar.gz
-$ tar xf protobuf-java-3.1.0.tar.gz && cd protobuf-3.1.0
-$ ./configure
-$ make
-$ sudo make install
-{% endhighlight %}
-
-Then, re-generate the compiled code:
-
-{% highlight bash %}
-$ cd avatica/core
-$ ./src/main/scripts/generate-protobuf.sh
-{% endhighlight %}
-
-# Advanced topics for committers
-
-The following sections are of interest to Calcite committers and in
-particular release managers.
-
-## Set up PGP signing keys (for Calcite committers)
-
-Follow instructions [here](http://www.apache.org/dev/release-signing) to
-create a key pair. (On Mac OS X, I did `brew install gpg` and
-`gpg --gen-key`.)
-
-Add your public key to the `KEYS` file by following instructions in
-the `KEYS` file.
-
-## Run a GPG agent
-
-By default, Maven plugins which require you to unlock a GPG secret key
-will prompt you in the terminal. To prevent you from having to enter
-this password numerous times, it is highly recommended to install and
-run `gpg-agent`.
-
-This can be started automatically via an `~/.xsession` on Linux or some
-scripting in your shell's configuration script of choice (e.g. `~/.bashrc` or `~/.zshrc`)
-
-{% highlight bash %}
-GPG_AGENT=$(which gpg-agent)
-GPG_TTY=`tty`
-export GPG_TTY
-if [[ -f "$GPG_AGENT" ]]; then
-  envfile="${HOME}/.gnupg/gpg-agent.env"
-
-  if test -f "$envfile" && kill -0 $(grep GPG_AGENT_INFO "$envfile" | cut -d: -f 2) 2>/dev/null; then
-      source "$envfile"
-  else
-      eval "$(gpg-agent --daemon --log-file=~/.gpg/gpg.log --write-env-file "$envfile")"
-  fi
-  export GPG_AGENT_INFO  # the env file does not contain the export statement
-fi
-{% endhighlight %}
-
-Also, ensure that `default-cache-ttl 6000` is set in `~/.gnupg/gpg-agent.conf`
-to guarantee that your credentials will be cached for the duration of the build.
-
-## Making a snapshot (for Calcite committers)
-
-Before you start:
-
-* Set up signing keys as described above.
-* Make sure you are using JDK 1.7 (not 1.8).
-
-{% highlight bash %}
-# Make sure that there are no junk files in the sandbox
-git clean -xn
-
-mvn -Papache-release clean install
-{% endhighlight %}
-
-When the dry-run has succeeded, change `install` to `deploy`.
-
-## Making a release (for Calcite committers)
-
-Before you start:
-
-* Set up signing keys as described above.
-* Make sure you are using JDK 1.7 (not 1.8).
-* Check that `README` and `site/_docs/howto.md` have the correct version number.
-* Set `version.major` and `version.minor` in `pom.xml`.
-* Trigger a
-  <a href="https://scan.coverity.com/projects/2966">Coverity scan</a>
-  by merging the latest code into the `julianhyde/coverity_scan` branch,
-  and when it completes, make sure that there are no important issues.
-* Make sure that
-  <a href="https://issues.apache.org/jira/issues/?jql=project%20%3D%20CALCITE%20AND%20status%20%3D%20Resolved%20and%20fixVersion%20is%20null">
-  every "resolved" JIRA case</a> (including duplicates) has
-  a fix version assigned (most likely the version we are
-  just about to release)
-
-Create a release branch named after the release, e.g.
-`branch-avatica-1.9`, and push it to Apache.
-
-{% highlight bash %}
-$ git checkout -b branch-avatica-X.Y
-$ git push -u origin branch-avatica-X.Y
-{% endhighlight %}
-
-We will use the branch for the entire the release process. Meanwhile,
-we do not allow commits to the master branch. After the release is
-final, we can use `git merge --ff-only` to append the changes on the
-release branch onto the master branch. (Apache does not allow reverts
-to the master branch, which makes it difficult to clean up the kind of
-messy commits that inevitably happen while you are trying to finalize
-a release.)
-
-Now, set up your environment and do a dry run. The dry run will not
-commit any changes back to git and gives you the opportunity to verify
-that the release process will complete as expected.
-
-If any of the steps fail, clean up (see below), fix the problem, and
-start again from the top.
-
-{% highlight bash %}
-# Make sure that there are no junk files in the sandbox
-git clean -xn
-
-# Do a dry run of the release:prepare step, which sets version numbers.
-mvn -DdryRun=true -DreleaseVersion=X.Y.Z -DdevelopmentVersion=X.Y.Z+1-SNAPSHOT -Dtag=calcite-avatica-X.Y.Z-rcN -Papache-release -Duser.name=${asf.username} release:prepare
-{% endhighlight %}
-
-Check the artifacts:
-
-* In the `target` directory should be these 8 files, among others:
-  * apache-calcite-avatica-X.Y.Z-src.tar.gz
-  * apache-calcite-avatica-X.Y.Z-src.tar.gz.asc
-  * apache-calcite-avatica-X.Y.Z-src.tar.gz.md5
-  * apache-calcite-avatica-X.Y.Z-src.tar.gz.sha1
-  * apache-calcite-avatica-X.Y.Z-src.zip
-  * apache-calcite-avatica-X.Y.Z-src.zip.asc
-  * apache-calcite-avatica-X.Y.Z-src.zip.md5
-  * apache-calcite-avatica-X.Y.Z-src.zip.sha1
-* Note that the file names start `apache-calcite-avatica-`.
-* In the two source distros `.tar.gz` and `.zip` (currently there is
-  no binary distro), check that all files belong to a directory called
-  `apache-calcite-avatica-X.Y.Z-src`.
-* That directory must contain files `NOTICE`, `LICENSE`,
-  `README`, `README.md`
-  * Check that the version in `README` is correct
-* For each .jar, verify that the `META-INF` directory contains the correct
-  contents for `DEPENDENCIES`, `LICENSE` and `NOTICE` per the
-  source/classes contained. Refer to the ASF licensing documentation on
-  what is required.
-* Check PGP, per [this](https://httpd.apache.org/dev/verification.html)
-
-If something is not correct, you can invoke the `release:clean` mojo to remove the
-generated files from your workspace:
-
-{% highlight bash %}
-mvn release:clean
-{% endhighlight %}
-
-If successful, remove the `-DdryRun` flag and run the release for real.
-
-{% highlight bash %}
-# Prepare sets the version numbers, creates a tag, and pushes it to git.
-mvn -DreleaseVersion=X.Y.Z -DdevelopmentVersion=X.Y.Z+1-SNAPSHOT -Dtag=calcite-avatica-X.Y.Z-rc0 -Papache-release -Duser.name=${asf.username} release:prepare
-
-# Perform checks out the tagged version, builds, and deploys to the staging repository
-mvn -Papache-release -Duser.name=${asf.username} release:perform -Darguments="-DskipTests"
-{% endhighlight %}
-
-Verify the staged artifacts in the Nexus repository:
-
-* Go to [https://repository.apache.org/](https://repository.apache.org/) and login
-* Under `Build Promotion`, click `Staging Repositories`
-* In the `Staging Repositories` tab there should be a line with profile `org.apache.calcite`
-* Navigate through the artifact tree and make sure the .jar, .pom, .asc files are present
-* Check the box on in the first column of the row,
-  and press the 'Close' button to publish the repository at
-  https://repository.apache.org/content/repositories/orgapachecalcite-1000
-  (or a similar URL)
-
-Upload the artifacts via subversion to a staging area,
-https://dist.apache.org/repos/dist/dev/calcite/apache-calcite-X.Y.Z-rcN:
-
-{% highlight bash %}
-# Create a subversion workspace, if you haven't already
-mkdir -p ~/dist/dev
-pushd ~/dist/dev
-svn co https://dist.apache.org/repos/dist/dev/calcite
-popd
-
-# Move the files into a directory
-cd target
-mkdir ~/dist/dev/calcite/apache-calcite-avatica-X.Y.Z-rcN
-mv apache-calcite-avatica-* ~/dist/dev/calcite/apache-calcite-avatica-X.Y.Z-rcN
-
-# Check in
-cd ~/dist/dev/calcite
-svn add apache-calcite-avatica-X.Y.Z-rcN
-svn ci
-{% endhighlight %}
-
-## Cleaning up after a failed release attempt (for Calcite committers)
-
-{% highlight bash %}
-# Make sure that the tag you are about to generate does not already
-# exist (due to a failed release attempt)
-git tag
-
-# If the tag exists, delete it locally and remotely
-git tag -d apache-calcite-X.Y.Z
-git push origin :refs/tags/apache-calcite-avatica-X.Y.Z
-
-# Remove modified files
-mvn release:clean
-
-# Check whether there are modified files and if so, go back to the
-# original git commit
-git status
-git reset --hard HEAD
-{% endhighlight %}
-
-## Validate a release
-
-{% highlight bash %}
-# Check that the signing key (e.g. 2AD3FAE3) is pushed
-gpg --recv-keys key
-
-# Check keys
-curl -O https://dist.apache.org/repos/dist/release/calcite/KEYS
-
-# Sign/check md5 and sha1 hashes
-# (Assumes your O/S has 'md5' and 'sha1' commands.)
-function checkHash() {
-  cd "$1"
-  for i in *.{zip,pom,gz}; do
-    if [ ! -f $i ]; then
-      continue
-    fi
-    if [ -f $i.md5 ]; then
-      if [ "$(cat $i.md5)" = "$(md5 -q $i)" ]; then
-        echo $i.md5 present and correct
-      else
-        echo $i.md5 does not match
-      fi
-    else
-      md5 -q $i > $i.md5
-      echo $i.md5 created
-    fi
-    if [ -f $i.sha1 ]; then
-      if [ "$(cat $i.sha1)" = "$(sha1 -q $i)" ]; then
-        echo $i.sha1 present and correct
-      else
-        echo $i.sha1 does not match
-      fi
-    else
-      sha1 -q $i > $i.sha1
-      echo $i.sha1 created
-    fi
-  done
-}
-checkHash apache-calcite-X.Y.Z-rcN
-{% endhighlight %}
-
-## Get approval for a release via Apache voting process (for Calcite committers)
-
-Release vote on dev list
-
-{% highlight text %}
-To: dev@calcite.apache.org
-Subject: [VOTE] Release apache-calcite-avatica-X.Y.Z (release candidate N)
-
-Hi all,
-
-I have created a build for Apache Calcite Avatica X.Y.Z, release candidate N.
-
-Thanks to everyone who has contributed to this release.
-<Further details about release.> You can read the release notes here:
-https://github.com/apache/calcite/blob/XXXX/site/_docs/history.md
-
-The commit to be voted upon:
-http://git-wip-us.apache.org/repos/asf/calcite/commit/NNNNNN
-
-Its hash is XXXX.
-
-The artifacts to be voted on are located here:
-https://dist.apache.org/repos/dist/dev/calcite/apache-calcite-avatica-X.Y.Z-rcN/
-
-The hashes of the artifacts are as follows:
-src.tar.gz.md5 XXXX
-src.tar.gz.sha1 XXXX
-src.zip.md5 XXXX
-src.zip.sha1 XXXX
-
-A staged Maven repository is available for review at:
-https://repository.apache.org/content/repositories/orgapachecalcite-NNNN
-
-Release artifacts are signed with the following key:
-https://people.apache.org/keys/committer/jhyde.asc
-
-Please vote on releasing this package as Apache Calcite Avatica X.Y.Z.
-
-The vote is open for the next 72 hours and passes if a majority of
-at least three +1 PMC votes are cast.
-
-[ ] +1 Release this package as Apache Calcite X.Y.Z
-[ ]  0 I don't feel strongly about it, but I'm okay with the release
-[ ] -1 Do not release this package because...
-
-
-Here is my vote:
-
-+1 (binding)
-
-Julian
-{% endhighlight %}
-
-After vote finishes, send out the result:
-
-{% highlight text %}
-Subject: [RESULT] [VOTE] Release apache-calcite-avatica-X.Y.Z (release candidate N)
-To: dev@calcite.apache.org
-
-Thanks to everyone who has tested the release candidate and given
-their comments and votes.
-
-The tally is as follows.
-
-N binding +1s:
-<names>
-
-N non-binding +1s:
-<names>
-
-No 0s or -1s.
-
-Therefore I am delighted to announce that the proposal to release
-Apache Calcite Avatica X.Y.Z has passed.
-
-Thanks everyone. We\u2019ll now roll the release out to the mirrors.
-
-There was some feedback during voting. I shall open a separate
-thread to discuss.
-
-
-Julian
-{% endhighlight %}
-
-Use the [Apache URL shortener](http://s.apache.org) to generate
-shortened URLs for the vote proposal and result emails. Examples:
-[s.apache.org/calcite-1.2-vote](http://s.apache.org/calcite-1.2-vote) and
-[s.apache.org/calcite-1.2-result](http://s.apache.org/calcite-1.2-result).
-
-
-## Publishing a release (for Calcite committers)
-
-After a successful release vote, we need to push the release
-out to mirrors, and other tasks.
-
-Choose a release date.
-This is based on the time when you expect to announce the release.
-This is usually a day after the vote closes.
-Remember that UTC date changes at 4pm Pacific time.
-
-In JIRA, search for
-[all issues resolved in this release](https://issues.apache.org/jira/issues/?jql=project%20%3D%20CALCITE%20and%20fixVersion%20%3D%201.5.0%20and%20status%20%3D%20Resolved%20and%20resolution%20%3D%20Fixed),
-and do a bulk update changing their status to "Closed",
-with a change comment
-"Resolved in release X.Y.Z (YYYY-MM-DD)"
-(fill in release number and date appropriately).
-Uncheck "Send mail for this update".
-
-Promote the staged nexus artifacts.
-
-* Go to [https://repository.apache.org/](https://repository.apache.org/) and login
-* Under "Build Promotion" click "Staging Repositories"
-* In the line with "orgapachecalcite-xxxx", check the box
-* Press "Release" button
-
-Check the artifacts into svn.
-
-{% highlight bash %}
-# Get the release candidate.
-mkdir -p ~/dist/dev
-cd ~/dist/dev
-svn co https://dist.apache.org/repos/dist/dev/calcite
-
-# Copy the artifacts. Note that the copy does not have '-rcN' suffix.
-mkdir -p ~/dist/release
-cd ~/dist/release
-svn co https://dist.apache.org/repos/dist/release/calcite
-cd calcite
-cp -rp ../../dev/calcite/apache-calcite-avatica-X.Y.Z-rcN apache-calcite-avatica-X.Y.Z
-svn add apache-calcite-X.Y.Z
-
-# Check in.
-svn ci
-{% endhighlight %}
-
-Svnpubsub will publish to the
-[release repo](https://dist.apache.org/repos/dist/release/calcite) and propagate to the
-[mirrors](http://www.apache.org/dyn/closer.cgi/calcite) within 24 hours.
-
-If there are now more than 2 releases, clear out the oldest ones:
-
-{% highlight bash %}
-cd ~/dist/release/calcite
-svn rm apache-calcite-avatica-X.Y.Z
-svn ci
-{% endhighlight %}
-
-The old releases will remain available in the
-[release archive](http://archive.apache.org/dist/calcite/).
-
-Add a release note by copying
-[site/_posts/2015-11-10-release-1.5.0.md]({{ site.sourceRoot }}/site/_posts/2015-11-10-release-1.5.0.md),
-generate the javadoc and copy to `site/target/apidocs` and `site/target/testapidocs`,
-[publish the site](#publish-the-web-site),
-and check that it appears in the contents in [news](http://localhost:4000/news/).
-
-After 24 hours, announce the release by sending an email to
-[announce@apache.org](https://mail-archives.apache.org/mod_mbox/www-announce/).
-You can use
-[the 1.6.0 announcement](https://mail-archives.apache.org/mod_mbox/www-announce/201601.mbox/%3C8DB4C1E5-B322-4A33-8E8F-9858FA6A1119%40apache.org%3E)
-as a template. Be sure to include a brief description of the project.
-
-## Publishing the web site (for Calcite committers)
-{: #publish-the-web-site}
-
-See instructions in
-[site/README.md]({{ site.sourceRoot }}/site/README.md).

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/site/_docs/index.md
----------------------------------------------------------------------
diff --git a/avatica/site/_docs/index.md b/avatica/site/_docs/index.md
deleted file mode 100644
index 4b04e33..0000000
--- a/avatica/site/_docs/index.md
+++ /dev/null
@@ -1,176 +0,0 @@
----
-layout: docs
-title: Background
-permalink: /docs/index.html
----
-<!--
-{% comment %}
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements.  See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License.  You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-{% endcomment %}
--->
-
-Avatica is a framework for building JDBC and ODBC drivers for databases,
-and an RPC wire protocol.
-
-![Avatica Architecture](https://raw.githubusercontent.com/julianhyde/share/master/slides/avatica-architecture.png)
-
-Avatica's Java binding has very few dependencies.
-Even though it is part of Apache Calcite it does not depend on other parts of
-Calcite. It depends only on JDK 1.7+ and Jackson.
-
-Avatica's wire protocols are JSON or Protocol Buffers over HTTP. The
-Java implementation of the JSON protocol uses
-[Jackson](https://github.com/FasterXML/jackson) to convert
-request/response command objects to/from JSON.
-
-Avatica-Server is a Java implementation of Avatica RPC.
-
-Core concepts:
-
-* [Meta]({{ site.apiRoot }}/org/apache/calcite/avatica/Meta.html)
-  is a local API sufficient to implement any Avatica provider
-* [AvaticaFactory]({{ site.apiRoot }}/org/apache/calcite/avatica/AvaticaFactory.html)
-  creates implementations of the JDBC classes on top of a `Meta`
-* [Service]({{ site.apiRoot }}/org/apache/calcite/avatica/remote/Service.html)
-  is an interface that implements the functions of `Meta` in terms
-  of request and response command objects
-
-## JDBC
-
-Avatica implements JDBC by means of
-[AvaticaFactory]({{ site.apiRoot }}/org/apache/calcite/avatica/AvaticaFactory.html).
-An implementation of `AvaticaFactory` creates implementations of the
-JDBC classes ([Driver]({{ site.jdkApiRoot }}/java/sql/Driver.html),
-[Connection]({{ site.jdkApiRoot }}/java/sql/Connection.html),
-[Statement]({{ site.jdkApiRoot }}/java/sql/Statement.html),
-[ResultSet]({{ site.jdkApiRoot }}/java/sql/ResultSet.html))
-on top of a `Meta`.
-
-## ODBC
-
-Work has not started on Avatica ODBC.
-
-Avatica ODBC would use the same wire protocol and could use the same server
-implementation in Java. The ODBC client would be written in C or C++.
-
-Since the Avatica protocol abstracts many of the differences between providers,
-the same ODBC client could be used for different databases.
-
-Although the Avatica project does not include an ODBC driver, there
-are ODBC drivers written on top of the Avatica protocol, for example
-[an ODBC driver for Apache Phoenix](http://hortonworks.com/hadoop-tutorial/bi-apache-phoenix-odbc/).
-
-## HTTP Server
-
-Avatica-server embeds the Jetty HTTP server, providing a class
-[HttpServer]({{ site.apiRoot }}/org/apache/calcite/avatica/server/HttpServer.html)
-that implements the Avatica RPC protocol
-and can be run as a standalone Java application.
-
-Connectors in HTTP server can be configured if needed by extending
-`HttpServer` class and overriding its `configureConnector()` method.
-For example, user can set `requestHeaderSize` to 64K bytes as follows:
-
-{% highlight java %}
-HttpServer server = new HttpServer(handler) {
-  @Override
-  protected ServerConnector configureConnector(
-      ServerConnector connector, int port) {
-    HttpConnectionFactory factory = (HttpConnectionFactory)
-        connector.getDefaultConnectionFactory();
-    factory.getHttpConfiguration().setRequestHeaderSize(64 << 10);
-    return super.configureConnector(connector, port);
-  }
-};
-server.start();
-{% endhighlight %}
-
-## Project structure
-
-We know that it is important that client libraries have minimal dependencies.
-
-Avatica is currently part of Apache Calcite.
-It does not depend upon any other part of Calcite.
-At some point Avatica could become a separate project.
-
-Packages:
-
-* [org.apache.calcite.avatica]({{ site.apiRoot }}/org/apache/calcite/avatica/package-summary.html) Core framework
-* [org.apache.calcite.avatica.remote]({{ site.apiRoot }}/org/apache/calcite/avatica/remote/package-summary.html) JDBC driver that uses remote procedure calls
-* [org.apache.calcite.avatica.server]({{ site.apiRoot }}/org/apache/calcite/avatica/server/package-summary.html) HTTP server
-* [org.apache.calcite.avatica.util]({{ site.apiRoot }}/org/apache/calcite/avatica/util/package-summary.html) Utilities
-
-## Status
-
-### Implemented
-
-* Create connection, create statement, metadata, prepare, bind, execute, fetch
-* RPC using JSON over HTTP
-* Local implementation
-* Implementation over an existing JDBC driver
-* Composite RPCs (combining several requests into one round trip)
-  * Execute-Fetch
-  * Metadata-Fetch (metadata calls such as getTables return all rows)
-
-### Not implemented
-
-* ODBC
-* RPCs
-  * CloseStatement
-  * CloseConnection
-* Composite RPCs
-  * CreateStatement-Prepare
-  * CloseStatement-CloseConnection
-  * Prepare-Execute-Fetch (Statement.executeQuery should fetch first N rows)
-* Remove statements from statement table
-* DML (INSERT, UPDATE, DELETE)
-* Statement.execute applied to SELECT statement
-
-## Clients
-
-The following is a list of available Avatica clients. Several describe
-themselves as adapters for
-[Apache Phoenix](http://phoenix.apache.org) but also work with other
-Avatica back-ends. Contributions for clients in other languages are
-highly welcomed!
-
-### Microsoft .NET driver for Apache Phoenix Query Server
-* [Home page](https://github.com/Azure/hdinsight-phoenix-sharp)
-* Language: C#
-* *License*: [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)
-* Avatica version 1.2.0 onwards
-* *Maintainer*: Microsoft Azure
-
-### Boostport
-* [Home page](https://github.com/Boostport/avatica)
-* *Language*: Go
-* *License*: [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)
-* Avatica version 1.8.0 onwards
-* *Maintainer*: Boostport
-
-### Avatica thin client
-* [Home page](https://calcite.apache.org/avatica)
-* *Language*: Java
-* *License*: [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)
-* Any Avatica version
-* *Maintainer*: Apache Calcite community
-
-### Apache Phoenix database adapter for Python
-* [Home page](https://bitbucket.org/lalinsky/python-phoenixdb)
-* Language: Python
-* *License*: [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)
-* Avatica version 1.2.0 to 1.6.0
-* *Maintainer*: Luk�\u0161 Lalinsk�

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/site/_docs/json_reference.md
----------------------------------------------------------------------
diff --git a/avatica/site/_docs/json_reference.md b/avatica/site/_docs/json_reference.md
deleted file mode 100644
index 6340c59..0000000
--- a/avatica/site/_docs/json_reference.md
+++ /dev/null
@@ -1,1191 +0,0 @@
----
-layout: docs
-title: JSON Reference
-sidebar_title: JSON Reference
-permalink: /docs/json_reference.html
-requests:
-  - { name: "CatalogsRequest" }
-  - { name: "CloseConnectionRequest" }
-  - { name: "CloseStatementRequest" }
-  - { name: "ColumnsRequest" }
-  - { name: "CommitRequest" }
-  - { name: "ConnectionSyncRequest" }
-  - { name: "CreateStatementRequest" }
-  - { name: "DatabasePropertyRequest" }
-  - { name: "ExecuteRequest" }
-  - { name: "ExecuteBatchRequest" }
-  - { name: "FetchRequest" }
-  - { name: "OpenConnectionRequest" }
-  - { name: "PrepareAndExecuteBatchRequest" }
-  - { name: "PrepareAndExecuteRequest" }
-  - { name: "PrepareRequest" }
-  - { name: "RollbackRequest" }
-  - { name: "SchemasRequest" }
-  - { name: "SyncResultsRequest" }
-  - { name: "TableTypesRequest" }
-  - { name: "TablesRequest" }
-  - { name: "TypeInfoRequest" }
-miscellaneous:
-  - { name: "AvaticaParameter" }
-  - { name: "AvaticaSeverity" }
-  - { name: "AvaticaType" }
-  - { name: "ColumnMetaData" }
-  - { name: "ConnectionProperties" }
-  - { name: "CursorFactory" }
-  - { name: "DatabaseProperty" }
-  - { name: "Frame" }
-  - { name: "QueryState" }
-  - { name: "Rep" }
-  - { name: "RpcMetadata" }
-  - { name: "Signature" }
-  - { name: "StateType" }
-  - { name: "StatementHandle" }
-  - { name: "StatementType" }
-  - { name: "Style" }
-  - { name: "TypedValue" }
-responses:
-  - { name: "CloseConnectionResponse" }
-  - { name: "CloseStatementResponse" }
-  - { name: "CommitResponse" }
-  - { name: "ConnectionSyncResponse" }
-  - { name: "CreateStatementResponse" }
-  - { name: "DatabasePropertyResponse" }
-  - { name: "ErrorResponse" }
-  - { name: "ExecuteBatchResponse" }
-  - { name: "ExecuteResponse" }
-  - { name: "FetchResponse" }
-  - { name: "OpenConnectionResponse" }
-  - { name: "PrepareResponse" }
-  - { name: "ResultSetResponse" }
-  - { name: "RollbackResponse" }
-  - { name: "SyncResultsResponse" }
----
-
-<!--
-{% 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 Avatica uses JSON to serialize messages sent over an HTTP transport,
-the RPC layer is agnostic of the language used by a client. While the Avatica
-server is written in Java, this enables clients to interact with the server
-using any language instead of being limited to Java.
-
-A specification of the JSON request and response objects are documented
-below. Programmatic bindings for these JSON objects are only available
-in Java. For support outside of Java, see the Protocol Buffer
-[bindings]({{ site.baseurl }}/docs/avatica_protobuf_reference.html)
-
-## Index
-
-### Requests
-<ul>
-  {% for item in page.requests %}<li><a href="#{{ item.name | downcase }}">{{ item.name }}</a></li>{% endfor %}
-</ul>
-
-### Responses
-<ul>
-  {% for item in page.responses %}<li><a href="#{{ item.name | downcase }}">{{ item.name }}</a></li>{% endfor %}
-</ul>
-
-### Miscellaneous
-<ul>
-  {% for item in page.miscellaneous %}<li><a href="#{{ item.name | downcase }}">{{ item.name }}</a></li>{% endfor %}
-</ul>
-
-
-## Requests
-
-The collection of all JSON objects accepted as requests to Avatica. All Requests include a `request` attribute
-which uniquely identifies the concrete Request from all other Requests.
-
-### CatalogsRequest
-
-This request is used to fetch the available catalog names in the database.
-
-{% highlight json %}
-{
-  "request": "getCatalogs",
-  "connectionId": "000000-0000-0000-00000000"
-}
-{% endhighlight %}
-
-`connectionId` (required string) The identifier of the connection to use.
-
-### CloseConnectionRequest
-
-This request is used to close the Connection object in the Avatica server identified by the given IDs.
-
-{% highlight json %}
-{
-  "request": "closeConnection",
-  "connectionId": "000000-0000-0000-00000000"
-}
-{% endhighlight %}
-
-`connectionId` (required string) The identifier of the connection to close.
-
-### CloseStatementRequest
-
-This request is used to close the Statement object in the Avatica server identified by the given IDs.
-
-{% highlight json %}
-{
-  "request": "closeStatement",
-  "connectionId": "000000-0000-0000-00000000",
-  "statementId": 12345
-}
-{% endhighlight %}
-
-`connectionId` (required string) The identifier of the connection to which the statement belongs.
-
-`statementId` (required integer) The identifier of the statement to close.
-
-### ColumnsRequest
-
-This request is used to fetch columns in the database given some optional filtering criteria.
-
-{% highlight json %}
-{
-  "request": "getColumns",
-  "connectionId": "000000-0000-0000-00000000",
-  "catalog": "catalog",
-  "schemaPattern": "schema_pattern.*",
-  "tableNamePattern": "table_pattern.*",
-  "columnNamePattern": "column_pattern.*"
-}
-{% endhighlight %}
-
-`connectionId` (required string) The identifier of the connection on which to fetch the columns.
-
-`catalog` (optional string) The name of a catalog to limit returned columns.
-
-`schemaPattern` (optional string) A Java Pattern against schemas to limit returned columns.
-
-`tableNamePattern` (optional string) A Java Pattern against table names to limit returned columns.
-
-`columnNamePattern` (optional string) A Java Pattern against column names to limit returned columns.
-
-### CommitRequest
-
-This request is used to issue a `commit` on the Connection in the Avatica server identified by the given ID.
-
-{% highlight json %}
-{
-  "request": "commit",
-  "connectionId": "000000-0000-0000-00000000"
-}
-{% endhighlight %}
-
-`connectionId` (required string) The identifier of the connection on which to invoke commit.
-
-### ConnectionSyncRequest
-
-This request is used to ensure that the client and server have a consistent view of the database properties.
-
-{% highlight json %}
-{
-  "request": "connectionSync",
-  "connectionId": "000000-0000-0000-00000000",
-  "connProps": ConnectionProperties
-}
-{% endhighlight %}
-
-`connectionId` (required string) The identifier of the connection to synchronize.
-
-`connProps` (optional nested object) A <a href="#connectionproperties">ConnectionProperties</a> object to synchronize between the client and server.
-
-### CreateStatementRequest
-
-This request is used to create a new Statement in the Avatica server.
-
-{% highlight json %}
-{
-  "request": "createStatement",
-  "connectionId": "000000-0000-0000-00000000"
-}
-{% endhighlight %}
-
-`connectionId` (required string) The identifier of the connection to use in creating a statement.
-
-### DatabasePropertyRequest
-
-This request is used to fetch all <a href="#databaseproperty">database properties</a>.
-
-{% highlight json %}
-{
-  "request": "databaseProperties",
-}
-{% endhighlight %}
-
-`connectionId` (required string) The identifier of the connection to use when fetching the database properties.
-
-### ExecuteBatchRequest
-
-This request is used to execute a batch of updates on a PreparedStatement.
-
-{% highlight json %}
-{
-  "request": "executeBatch",
-  "connectionId": "000000-0000-0000-00000000",
-  "statementId": 12345,
-  "parameterValues": [ [ TypedValue, TypedValue, ... ], [ TypedValue, TypedValue, ...], ... ]
-}
-{% endhighlight %}
-
-`connectionId` (required string) The identifier of the connection to use when fetching the database properties.
-
-`statementId` (required integer) The identifier of the statement created using the above connection.
-
-`parameterValues` (required array of array) An array of arrays of <a href="#typedvalue">TypedValue</a>'s. Each element
-  in the array is an update to a row, while the outer array represents the entire "batch" of updates.
-
-### ExecuteRequest
-
-This request is used to execute a PreparedStatement, optionally with values to bind to the parameters in the Statement.
-
-{% highlight json %}
-{
-  "request": "execute",
-  "statementHandle": StatementHandle,
-  "parameterValues": [TypedValue, TypedValue, ... ],
-  "maxRowCount": 100
-}
-{% endhighlight %}
-
-`statementHandle` (required object) A <a href="#statementhandle">StatementHandle</a> object.
-
-`parameterValues` (optional array of nested objects) The <a href="#typedvalue">TypedValue</a> for each parameter on the prepared statement.
-
-`maxRowCount` (required long) The maximum number of rows returned in the response.
-
-### FetchRequest
-
-This request is used to fetch a batch of rows from a Statement previously created.
-
-{% highlight json %}
-{
-  "request": "fetch",
-  "connectionId": "000000-0000-0000-00000000",
-  "statementId": 12345,
-  "offset": 0,
-  "fetchMaxRowCount": 100
-}
-{% endhighlight %}
-
-`connectionId` (required string) The identifier of the connection to use.
-
-`statementId` (required integer) The identifier of the statement created using the above connection.
-
-`offset` (required integer) The positional offset into a result set to fetch.
-
-`fetchMatchRowCount` (required integer) The maximum number of rows to return in the response to this request.
-
-### OpenConnectionRequest
-
-This request is used to open a new Connection in the Avatica server.
-
-{% highlight json %}
-{
-  "request": "openConnection",
-  "connectionId": "000000-0000-0000-00000000",
-  "info": {"key":"value", ...}
-}
-{% endhighlight %}
-
-`connectionId` (required string) The identifier of the connection to open in the server.
-
-`info` (optional string-to-string map) A Map containing properties to include when creating the Connection.
-
-### PrepareAndExecuteBatchRequest
-
-This request is used as short-hand to create a Statement and execute an batch of SQL commands in that Statement.
-
-{% highlight json %}
-{
-  "request": "prepareAndExecuteBatch",
-  "connectionId": "000000-0000-0000-00000000",
-  "statementId": 12345,
-  "sqlCommands": [ "SQL Command", "SQL Command", ... ]
-}
-{% endhighlight %}
-
-`connectionId` (required string) The identifier for the connection to use.
-
-`statementId` (required integer) The identifier for the statement created by the above connection to use.
-
-`sqlCommands` (required array of strings) An array of SQL commands
-
-### PrepareAndExecuteRequest
-
-This request is used as a short-hand for create a Statement and fetching the first batch of results in a single call without any parameter substitution.
-
-{% highlight json %}
-{
-  "request": "prepareAndExecute",
-  "connectionId": "000000-0000-0000-00000000",
-  "statementId": 12345,
-  "sql": "SELECT * FROM table",
-  "maxRowCount": 100,
-}
-{% endhighlight %}
-
-`connectionId` (required string) The identifier for the connection to use.
-
-`statementId` (required integer) The identifier for the statement created by the above connection to use.
-
-`sql` (required string) A SQL statement
-
-`maxRowCount` (required long) The maximum number of rows returned in the response.
-
-### PrepareRequest
-
-This request is used to create create a new Statement with the given query in the Avatica server.
-
-{% highlight json %}
-{
-  "request": "prepare",
-  "connectionId": "000000-0000-0000-00000000",
-  "sql": "SELECT * FROM table",
-  "maxRowCount": 100,
-}
-{% endhighlight %}
-
-`connectionId` (required string) The identifier for the connection to use.
-
-`sql` (required string) A SQL statement
-
-`maxRowCount` (required long) The maximum number of rows returned in the response.
-
-### SyncResultsRequest
-
-This request is used to reset a ResultSet's iterator to a specific offset in the Avatica server.
-
-{% highlight json %}
-{
-  "request": "syncResults",
-  "connectionId": "000000-0000-0000-00000000",
-  "statementId": 12345,
-  "state": QueryState,
-  "offset": 200
-}
-{% endhighlight %}
-
-`connectionId` (required string) The identifier for the connection to use.
-
-`statementId` (required integer) The identifier for the statement to use.
-
-`state` (required object) The <a href="#querystate">QueryState</a> object.
-
-`offset` (required long) The offset into the ResultSet to seek to.
-
-### RollbackRequest
-
-This request is used to issue a `rollback` on the Connection in the Avatica server identified by the given ID.
-
-{% highlight json %}
-{
-  "request": "rollback",
-  "connectionId": "000000-0000-0000-00000000"
-}
-{% endhighlight %}
-
-`connectionId` (required string) The identifier for the connection on which to invoke rollback.
-
-### SchemasRequest
-
-This request is used to fetch the schemas matching the provided criteria in the database.
-
-{% highlight json %}
-{
-  "request": "getSchemas",
-  "connectionId": "000000-0000-0000-00000000",
-  "catalog": "name",
-  "schemaPattern": "pattern.*"
-}
-{% endhighlight %}
-
-`connection_id` The identifier for the connection to fetch schemas from.
-
-`catalog` (required string) The name of the catalog to fetch the schema from.
-
-`schemaPattern` (required string) A Java pattern of schemas to fetch.
-
-### TableTypesRequest
-
-This request is used to fetch the table types available in this database.
-
-{% highlight json %}
-{
-  "request": "getTableTypes",
-  "connectionId": "000000-0000-0000-00000000"
-}
-{% endhighlight %}
-
-`connectionId` The identifier of the connection to fetch the table types from.
-
-### TablesRequest
-
-This request is used to fetch the tables available in this database filtered by the provided criteria.
-
-{% highlight json %}
-{
-  "request": "getTables",
-  "connectionId": "000000-0000-0000-00000000",
-  "catalog": "catalog_name",
-  "schemaPattern": "schema_pattern.*",
-  "tableNamePattern": "table_name_pattern.*",
-  "typeList": [ "TABLE", "VIEW", ... ]
-}
-{% endhighlight %}
-
-`catalog` (optional string) The name of a catalog to restrict fetched tables.
-
-`connectionId` The identifier of the connection to fetch the tables from.
-
-`schemaPattern` (optional string) A Java Pattern representing schemas to include in fetched tables.
-
-`tableNamePattern` (optional string) A Java Pattern representing table names to include in fetched tables.
-
-`typeList` (optional array of string) A list of table types used to restrict fetched tables.
-
-### TypeInfoRequest
-
-This request is used to fetch the types available in this database.
-
-{% highlight json %}
-{
-  "request": "getTypeInfo",
-  "connectionId": "000000-0000-0000-00000000"
-}
-{% endhighlight %}
-
-`connectionId` The identifier of the connection to fetch the types from.
-
-## Responses
-
-The collection of all JSON objects returned as responses from Avatica. All Responses include a `response` attribute
-which uniquely identifies the concrete Response from all other Responses.
-
-### CloseConnectionResponse
-
-A response to the <a href="#closeconnectionrequest">CloseConnectionRequest</a>.
-
-{% highlight json %}
-{
-  "response": "closeConnection",
-  "rpcMetadata": RpcMetadata
-}
-{% endhighlight %}
-
-`rpcMetadata` <a href="#rpcmetadata">Server metadata</a> about this call.
-
-### CloseStatementResponse
-
-A response to the <a href="#closestatementrequest">CloseStatementRequest</a>.
-
-{% highlight json %}
-{
-  "response": "closeStatement",
-  "rpcMetadata": RpcMetadata
-}
-{% endhighlight %}
-
-`rpcMetadata` <a href="#rpcmetadata">Server metadata</a> about this call.
-
-### CommitResponse
-
-A response to the <a href="#commitrequest">CommitRequest</a>.
-
-{% highlight json %}
-{
-  "response": "commit"
-}
-{% endhighlight %}
-
-There are no extra attributes on this Response.
-
-### ConnectionSyncResponse
-
-A response to the <a href="#connectionsyncrequest">ConnectionSyncRequest</a>. Properties included in the
-response are those of the Connection in the Avatica server.
-
-{% highlight json %}
-{
-  "response": "connectionSync",
-  "connProps": ConnectionProperties,
-  "rpcMetadata": RpcMetadata
-}
-{% endhighlight %}
-
-`connProps` The <a href="#connectionproperties">ConnectionProperties</a> that were synchronized.
-
-`rpcMetadata` <a href="#rpcmetadata">Server metadata</a> about this call.
-
-### CreateStatementResponse
-
-A response to the <a href="#createstatementrequest">CreateStatementRequest</a>. The ID of the statement
-that was created is included in the response. Clients will use this `statementId` in subsequent calls.
-
-{% highlight json %}
-{
-  "response": "createStatement",
-  "connectionId": "000000-0000-0000-00000000",
-  "statementId": 12345,
-  "rpcMetadata": RpcMetadata
-}
-{% endhighlight %}
-
-`connectionId` The identifier for the connection used to create the statement.
-
-`statementId` The identifier for the created statement.
-
-`rpcMetadata` <a href="#rpcmetadata">Server metadata</a> about this call.
-
-### DatabasePropertyResponse
-
-A response to the <a href="#databasepropertyrequest">DatabasePropertyRequest</a>. See <a hred="#databaseproperty">DatabaseProperty</a>
-for information on the available property keys.
-
-{% highlight json %}
-{
-  "response": "databaseProperties",
-  "map": { DatabaseProperty: Object, DatabaseProperty: Object, ... },
-  "rpcMetadata": RpcMetadata
-}
-{% endhighlight %}
-
-`map` A map of <a href="#databaseproperty">DatabaseProperty</a> to value of that property. The value may be some
-primitive type or an array of primitive types.
-
-`rpcMetadata` <a href="#rpcmetadata">Server metadata</a> about this call.
-
-### ErrorResponse
-
-A response when an error was caught executing a request. Any request may return this response.
-
-{% highlight json %}
-{
-  "response": "error",
-  "exceptions": [ "stacktrace", "stacktrace", ... ],
-  "errorMessage": "The error message",
-  "errorCode": 42,
-  "sqlState": "ABC12",
-  "severity": AvaticaSeverity,
-  "rpcMetadata": RpcMetadata
-}
-{% endhighlight %}
-
-`exceptions` A list of stringified Java StackTraces.
-
-`errorMessage` A human-readable error message.
-
-`errorCode` A numeric code for this error.
-
-`sqlState` A five character alphanumeric code for this error.
-
-`severity` An <a href="#avaticaseverity">AvaticaSeverity</a> object which denotes how critical the error is.
-
-`rpcMetadata` <a href="#rpcmetadata">Server metadata</a> about this call.
-
-### ExecuteBatchResponse
-
-A response to <a href="#executebatchrequest">ExecuteBatchRequest</a> and <a href="#prepareandexecutebatchrequest">PrepareAndExecuteRequest</a>
-which encapsulates the update counts for a batch of updates.
-
-{% highlight json %}
-{
-  "response": "executeBatch",
-  "connectionId": "000000-0000-0000-00000000",
-  "statementId": 12345,
-  "updateCounts": [ 1, 1, 0, 1, ... ],
-  "missingStatement": false,
-  "rpcMetadata": RpcMetadata
-}
-{% endhighlight %}
-
-`connectionId` The identifier for the connection used to create the statement.
-
-`statementId` The identifier for the created statement.
-
-`updateCounts` An array of integers corresponding to each update contained in the batch that was executed.
-
-`missingStatement` True if the operation failed because the Statement is not cached in the server, false otherwise.
-
-`rpcMetadata` <a href="#rpcmetadata">Server metadata</a> about this call.
-
-
-### ExecuteResponse
-
-A response to the <a href="#executerequest">ExecuteRequest</a> which contains the results for a metadata query.
-
-{% highlight json %}
-{
-  "response": "executeResults",
-  "resultSets": [ ResultSetResponse, ResultSetResponse, ... ],
-  "missingStatement": false,
-  "rpcMetadata": RpcMetadata
-}
-{% endhighlight %}
-
-`resultSets` An array of <a href="#resultsetresponse">ResultSetResponse</a>s.
-
-`missingStatement` A boolean which denotes if the request failed due to a missing Statement.
-
-`rpcMetadata` <a href="#rpcmetadata">Server metadata</a> about this call.
-
-### FetchResponse
-
-A response to the <a href="#fetchrequest">FetchRequest</a> which contains the request for the query.
-
-{% highlight json %}
-{
-  "response": "fetch",
-  "frame": Frame,
-  "missingStatement": false,
-  "missingResults": false,
-  "rpcMetadata": RpcMetadata
-}
-{% endhighlight %}
-
-`frame` A <a href="#frame">Frame</a> containing the results of the fetch.
-
-`missingStatement` A boolean which denotes if the request failed due to a missing Statement.
-
-`missingResults` A boolean which denotes if the request failed due to a missing ResultSet.
-
-`rpcMetadata` <a href="#rpcmetadata">Server metadata</a> about this call.
-
-### OpenConnectionResponse
-
-A response to the <a href="#openconnectionrequest">OpenConnectionRequest</a>. The ID for the connection that
-the client should use in subsequent calls was provided by the client in the request.
-
-{% highlight json %}
-{
-  "response": "openConnection",
-  "rpcMetadata": RpcMetadata
-}
-{% endhighlight %}
-
-`rpcMetadata` <a href="#rpcmetadata">Server metadata</a> about this call.
-
-### PrepareResponse
-
-A response to the <a href="#preparerequest">PrepareRequest</a>. This response includes a <a href="#statementhandle">StatementHandle</a>
-which clients must use to fetch the results from the Statement.
-
-{% highlight json %}
-{
-  "response": "prepare",
-  "statement": StatementHandle,
-  "rpcMetadata": RpcMetadata
-}
-{% endhighlight %}
-
-`statement` A <a href="#statementhandle">StatementHandle</a> object.
-
-`rpcMetadata` <a href="#rpcmetadata">Server metadata</a> about this call.
-
-### ResultSetResponse
-
-A response which contains the results and type details from a query.
-
-{% highlight json %}
-{
-  "response": "resultSet",
-  "connectionId": "000000-0000-0000-00000000",
-  "statementId": 12345,
-  "ownStatement": true,
-  "signature": Signature,
-  "firstFrame": Frame,
-  "updateCount": 10,
-  "rpcMetadata": RpcMetadata
-}
-{% endhighlight %}
-
-`connectionId` The identifier for the connection used to generate this response.
-
-`statementId` The identifier for the statement used to generate this response.
-
-`ownStatement` Whether the result set has its own dedicated statement. If true, the server must automatically close the
-statement when the result set is closed. This is used for JDBC metadata result sets, for instance.
-
-`signature` A non-optional nested object <a href="#signature">Signature</a>
-
-`firstFrame` A optional nested object <a href="#frame">Frame</a>
-
-`updateCount` A number which is always `-1` for normal result sets. Any other value denotes a "dummy" result set
-that only contains this count and no additional data.
-
-`rpcMetadata` <a href="#rpcmetadata">Server metadata</a> about this call.
-
-### RollbackResponse
-
-A response to the <a href="#rollbackrequest">RollBackRequest</a>.
-
-{% highlight json %}
-{
-  "response": "rollback"
-}
-{% endhighlight %}
-
-There are no extra attributes on this Response.
-
-### SyncResultsResponse
-
-A response to the <a href="#syncresultsrequest">SyncResultsRequest</a>. When `moreResults` is true, a <a href="#fetchrequest">FetchRequest</a>
-should be issued to get the next batch of records. When `missingStatement` is true, the statement must be re-created using <a href="#preparerequest">PrepareRequest</a>
-or the appropriate Request for a DDL request (e.g. <a href="#catalogsrequest">CatalogsRequest</a> or <a href="#schemasrequest">SchemasRequest</a>).
-
-{% highlight json %}
-{
-  "response": "syncResults",
-  "moreResults": true,
-  "missingStatement": false,
-  "rpcMetadata": RpcMetadata
-}
-{% endhighlight %}
-
-`moreResults` A boolean which denotes if results exist for the ResultSet being "synced" per the request.
-
-`missingStatement` A boolean which denotes if the statement for the ResultSet still exists.
-
-`rpcMetadata` <a href="#rpcmetadata">Server metadata</a> about this call.
-
-## Miscellaneous
-
-### AvaticaParameter
-
-This object describes the "simple", or scalar, JDBC type representation of a column in a result. This does not include
-complex types such as arrays.
-
-{% highlight json %}
-{
-  "signed": true,
-  "precision": 10,
-  "scale": 2,
-  "parameterType": 8,
-  "typeName": "integer",
-  "className": "java.lang.Integer",
-  "name": "number"
-}
-{% endhighlight %}
-
-`signed` A boolean denoting whether the column is a signed numeric.
-
-`precision` The maximum numeric precision supported by this column.
-
-`scale` The maximum numeric scale supported by this column.
-
-`parameterType` An integer corresponding to the JDBC Types class denoting the column's type.
-
-`typeName` The JDBC type name for this column.
-
-`className` The Java class backing the JDBC type for this column.
-
-`name` The name of the column.
-
-### AvaticaSeverity
-
-This enumeration describes the various levels of concern for an error in the Avatica server.
-
-One of:
-
-* `UNKNOWN`
-* `FATAL`
-* `ERROR`
-* `WARNING`
-
-### AvaticaType
-
-This object describes a simple or complex type for a column. Complex types will contain
-additional information in the `component` or `columns` attribute which describe the nested
-types of the complex parent type.
-
-{% highlight json %}
-{
-  "type": "scalar",
-  "id": "identifier",
-  "name": "column",
-  "rep": Rep,
-  "columns": [ ColumnMetaData, ColumnMetaData, ... ],
-  "component": AvaticaType
-}
-{% endhighlight %}
-
-`type` One of: `scalar`, `array`, `struct`.
-
-`id` A numeric value corresponding to the type of the object per the JDBC Types class.
-
-`name` The readable name of the JDBC type.
-
-`rep` A nested <a href="#rep">Rep</a> object used by Avatica to hold additional type information.
-
-`columns` For `STRUCT` types, a list of the columns contained in that `STRUCT`.
-
-`component` For `ARRAY` types, the type of the elements contained in that `ARRAY`.
-
-### ColumnMetaData
-
-This object represents the JDBC ResultSetMetaData for a column.
-
-{% highlight json %}
-{
-  "ordinal": 0,
-  "autoIncrement": true,
-  "caseSensitive": true,
-  "searchable": false,
-  "currency": false,
-  "nullable": 0,
-  "signed": true,
-  "displaySize": 20,
-  "label": "Description",
-  "columnName": "col1",
-  "schemaName": "schema",
-  "precision": 10,
-  "scale": 2,
-  "tableName": "table",
-  "catalogName": "catalog",
-  "type": AvaticaType,
-  "readOnly": false,
-  "writable": true,
-  "definitelyWritable": true,
-  "columnClassName": "java.lang.String"
-}
-{% endhighlight %}
-
-`ordinal` A positional offset number.
-
-`autoIncrement` A boolean denoting whether the column is automatically incremented.
-
-`caseSensitive` A boolean denoting whether the column is case sensitive.
-
-`searchable` A boolean denoting whether this column supports all WHERE search clauses.
-
-`currency` A boolean denoting whether this column represents currency.
-
-`nullable` A number denoting whether this column supports null values.
-
-* 0 = No null values are allowed
-* 1 = Null values are allowed
-* 2 = It is unknown if null values are allowed
-
-`signed` A boolean denoting whether the column is a signed numeric.
-
-`displaySize` The character width of the column.
-
-`label` A description for this column.
-
-`columnName` The name of the column.
-
-`schemaName` The schema to which this column belongs.
-
-`precision` The maximum numeric precision supported by this column.
-
-`scale` The maximum numeric scale supported by this column.
-
-`tableName` The name of the table to which this column belongs.
-
-`catalogName` The name of the catalog to which this column belongs.
-
-`type` A nested <a href="#avaticatype">AvaticaType</a> representing the type of the column.
-
-`readOnly` A boolean denoting whether the column is read-only.
-
-`writable` A boolean denoting whether the column is possible to be updated.
-
-`definitelyWritable` A boolean denoting whether the column definitely can be updated.
-
-`columnClassName` The name of the Java class backing the column's type.
-
-### ConnectionProperties
-
-This object represents the properties for a given JDBC Connection.
-
-{% highlight json %}
-{
-  "connProps": "connPropsImpl",
-  "autoCommit": true,
-  "readOnly": true,
-  "transactionIsolation": 0,
-  "catalog": "catalog",
-  "schema": "schema"
-}
-{% endhighlight %}
-
-`autoCommit` (optional boolean) A boolean denoting if autoCommit is enabled for transactions.
-
-`readOnly` (optional boolean) A boolean denoting if a JDBC connection is read-only.
-
-`transactionIsolation` (optional integer) An integer which denotes the level of transactions isolation per the JDBC
-specification. This value is analogous to the values defined in `java.sql.Connection`.
-
-* 0 = Transactions are not supported
-* 1 = Dirty reads, non-repeatable reads and phantom reads may occur.
-* 2 = Dirty reads are prevented, but non-repeatable reads and phantom reads may occur.
-* 4 = Dirty reads and non-repeatable reads are prevented, but phantom reads may occur.
-* 8 = Dirty reads, non-repeatable reads, and phantom reads are all prevented.
-
-`catalog` (optional string) The name of the catalog to include when fetching connection properties.
-
-`schema` (optional string) The name of the schema to include when fetching connection properties.
-
-### CursorFactory
-
-This object represents the information required to cast untyped objects into the necessary type for some results.
-
-{% highlight json %}
-{
-  "style": Style,
-  "clazz": "java.lang.String",
-  "fieldNames": [ "column1", "column2", ... ]
-}
-{% endhighlight %}
-
-`style` A string denoting the <a href="#style">Style</a> of the contained objects.
-
-### DatabaseProperty
-
-This object represents the exposed database properties for a Connection through the Avatica server.
-
-One of:
-
-* `GET_STRING_FUNCTIONS`
-* `GET_NUMERIC_FUNCTIONS`
-* `GET_SYSTEM_FUNCTIONS`
-* `GET_TIME_DATE_FUNCTIONS`
-* `GET_S_Q_L_KEYWORDS`
-* `GET_DEFAULT_TRANSACTION_ISOLATION`
-
-### Frame
-
-This object represents a batch of results, tracking the offset into the results and whether more results still exist
-to be fetched in the Avatica server.
-
-{% highlight json %}
-{
-  "offset": 100,
-  "done": true,
-  "rows": [ [ val1, val2, ... ], ... ]
-}
-{% endhighlight %}
-
-`offset` The starting position of these `rows` in the encompassing result set.
-
-`done` A boolean denoting whether more results exist for this result set.
-
-`rows` An array of arrays corresponding to the rows and columns for the result set.
-
-### QueryState
-
-This object represents the way a ResultSet was created in the Avatica server. A ResultSet could be created by a user-provided
-SQL or by a DatabaseMetaData operation with arguments on that operation.
-
-{% highlight json %}
-{
-  "type": StateType,
-  "sql": "SELECT * FROM table",
-  "metaDataOperation": MetaDataOperation,
-  "operationArgs": ["arg0", "arg1", ... ]
-}
-{% endhighlight %}
-
-`type` A <a href="#statetype">StateType</a> object denoting what type of operation backs the ResultSet for this query.
-
-`sql` The SQL statement which created the ResultSet for this query. Required if the `type` is `SQL`.
-
-`metaDataOperation` The DML operation which created the ResultSet for this query. Required if the `type` is `METADATA`.
-
-`operationArgs` The arguments to the invoked DML operation. Required if the `type` is `METADATA`.
-
-### Rep
-
-This enumeration represents the concrete Java type for some value.
-
-One of:
-
-* `PRIMITIVE_BOOLEAN`
-* `PRIMITIVE_BYTE`
-* `PRIMITIVE_CHAR`
-* `PRIMITIVE_SHORT`
-* `PRIMITIVE_INT`
-* `PRIMITIVE_LONG`
-* `PRIMITIVE_FLOAT`
-* `PRIMITIVE_DOUBLE`
-* `BOOLEAN`
-* `BYTE`
-* `CHARACTER`
-* `SHORT`
-* `INTEGER`
-* `LONG`
-* `FLOAT`
-* `DOUBLE`
-* `JAVA_SQL_TIME`
-* `JAVA_SQL_TIMESTAMP`
-* `JAVA_SQL_DATE`
-* `JAVA_UTIL_DATE`
-* `BYTE_STRING`
-* `STRING`
-* `NUMBER`
-* `OBJECT`
-
-### RpcMetadata
-
-This object contains assorted per-call/contextual metadata returned by the Avatica server.
-
-{% highlight json %}
-{
-  "serverAddress": "localhost:8765"
-}
-{% endhighlight %}
-
-`serverAddress` The `host:port` of the server which created this object.
-
-### Signature
-
-This object represents the result of preparing a Statement in the Avatica server.
-
-{% highlight json %}
-{
-  "columns": [ ColumnMetaData, ColumnMetaData, ... ],
-  "sql": "SELECT * FROM table",
-  "parameters": [ AvaticaParameter, AvaticaParameter, ... ],
-  "cursorFactory": CursorFactory,
-  "statementType": StatementType
-}
-{% endhighlight %}
-
-`columns` An array of <a href="#columnmetadata">ColumnMetaData</a> objects denoting the schema of the result set.
-
-`sql` The SQL executed.
-
-`parameters` An array of <a href="#avaticaparameter">AvaticaParameter</a> objects denoting type-specific details.
-
-`cursorFactory` An <a href="#cursorfactory">CursorFactory</a> object representing the Java representation of the frame.
-
-`statementType` An <a href="#statementtype">StatementType</a> object representing the type of Statement.
-
-### StateType
-
-This enumeration denotes whether user-provided SQL or a DatabaseMetaData operation was used to create some ResultSet.
-
-One of:
-
-* `SQL`
-* `METADATA`
-
-### StatementHandle
-
-This object encapsulates all of the information of a Statement created in the Avatica server.
-
-{% highlight json %}
-{
-  "connectionId": "000000-0000-0000-00000000",
-  "id": 12345,
-  "signature": Signature
-}
-{% endhighlight %}
-
-`connectionId` The identifier of the connection to which this statement belongs.
-
-`id` The identifier of the statement.
-
-`signature` A <a href="#signature">Signature</a> object for the statement.
-
-### StatementType
-
-This enumeration represents what kind the Statement is.
-
-One of:
-
-* `SELECT`
-* `INSERT`
-* `UPDATE`
-* `DELETE`
-* `UPSERT`
-* `MERGE`
-* `OTHER_DML`
-* `CREATE`
-* `DROP`
-* `ALTER`
-* `OTHER_DDL`
-* `CALL`
-
-### Style
-
-This enumeration represents the generic "class" of type for a value.
-
-One of:
-
-* `OBJECT`
-* `RECORD`
-* `RECORD_PROJECTION`
-* `ARRAY`
-* `LIST`
-* `MAP`
-
-### TypedValue
-
-This object encapsulates the type and value for a column in a row.
-
-{% highlight json %}
-{
-  "type": "type_name",
-  "value": object
-}
-{% endhighlight %}
-
-`type` A name referring to the type of the object stored in `value`.
-
-`value` A JSON representation of a JDBC type.
-
-The following chart documents how each <a href="#rep">Rep</a> value is serialized
-into a JSON value. Consult the [JSON documentation](http://json-spec.readthedocs.org/en/latest/reference.html)
-for more information on valid attributes in JSON.
-
-| <a href="#rep">Rep</a> Value | Serialized | Description |
-| PRIMITIVE_BOOLEAN | boolean ||
-| BOOLEAN | boolean ||
-| PRIMITIVE_BYTE | number | The numeric value of the `byte`. |
-| BYTE | number ||
-| PRIMITIVE_CHAR | string ||
-| CHARACTER | string ||
-| PRIMITIVE_SHORT | number ||
-| SHORT | number ||
-| PRIMITIVE_INT | number ||
-| INTEGER | number ||
-| PRIMITIVE_LONG | number ||
-| LONG | number ||
-| PRIMITIVE_FLOAT | number ||
-| FLOAT | number ||
-| PRIMITIVE_DOUBLE | number ||
-| DOUBLE | number ||
-| BIG_INTEGER | number | Implicitly handled by Jackson. |
-| BIG_DECIMAL | number | Implicitly handled by Jackson. |
-| JAVA_SQL_TIME | number | As an integer, milliseconds since midnight. |
-| JAVA_SQL_DATE | number | As an integer, the number of days since the epoch. |
-| JAVA_SQL_TIMESTAMP | number | As a long, milliseconds since the epoch. |
-| JAVA_UTIL_DATE | number | As a long, milliseconds since the epoch. |
-| BYTE_STRING | string | A Base64-encoded string. |
-| STRING | string | |
-| NUMBER | number | A general number, unknown what concrete type. |
-| OBJECT | null | Implicitly converted by Jackson. |
-| NULL | null | Implicitly converted by Jackson. |
-| ARRAY | N/A | Implicitly handled by Jackson. |
-| STRUCT | N/A | Implicitly handled by Jackson. |
-| MULTISET | N/A | Implicitly handled by Jackson. |


[45/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/MetaImpl.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/MetaImpl.java b/avatica/core/src/main/java/org/apache/calcite/avatica/MetaImpl.java
deleted file mode 100644
index 8870e0c..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/MetaImpl.java
+++ /dev/null
@@ -1,1653 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import org.apache.calcite.avatica.remote.TypedValue;
-import org.apache.calcite.avatica.util.ArrayIteratorCursor;
-import org.apache.calcite.avatica.util.Cursor;
-import org.apache.calcite.avatica.util.IteratorCursor;
-import org.apache.calcite.avatica.util.ListIteratorCursor;
-import org.apache.calcite.avatica.util.MapIteratorCursor;
-import org.apache.calcite.avatica.util.RecordIteratorCursor;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.sql.DatabaseMetaData;
-import java.sql.SQLException;
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.sql.Types;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.NoSuchElementException;
-
-/**
- * Basic implementation of {@link Meta}.
- *
- * <p>Each sub-class must implement the two remaining abstract methods,
- * {@link #prepare} and
- * {@link #prepareAndExecute}.
- * It should also override metadata methods such as {@link #getCatalogs(Meta.ConnectionHandle)} and
- * {@link #getTables} for the element types for which it has instances; the
- * default metadata methods return empty collections.
- */
-public abstract class MetaImpl implements Meta {
-  /** The {@link AvaticaConnection} backing {@code this}. */
-  protected final AvaticaConnection connection;
-  /** Represents the various states specific to {@link #connection}.
-   *
-   * <p>Note: this instance is used recursively with {@link #connection}'s getter and setter
-   * methods.</p>
-   */
-  protected final ConnectionPropertiesImpl connProps;
-
-  public MetaImpl(AvaticaConnection connection) {
-    this.connection = connection;
-    this.connProps = new ConnectionPropertiesImpl();
-  }
-
-  /** Uses a {@link org.apache.calcite.avatica.Meta.CursorFactory} to convert
-   * an {@link Iterable} into a
-   * {@link org.apache.calcite.avatica.util.Cursor}. */
-  public static Cursor createCursor(CursorFactory cursorFactory,
-      Iterable<Object> iterable) {
-    switch (cursorFactory.style) {
-    case OBJECT:
-      return new IteratorCursor<Object>(iterable.iterator()) {
-        protected Getter createGetter(int ordinal) {
-          return new ObjectGetter(ordinal);
-        }
-      };
-    case ARRAY:
-      @SuppressWarnings("unchecked") final Iterable<Object[]> iterable1 =
-          (Iterable<Object[]>) (Iterable) iterable;
-      return new ArrayIteratorCursor(iterable1.iterator());
-    case RECORD:
-      @SuppressWarnings("unchecked") final Class<Object> clazz =
-          cursorFactory.clazz;
-      return new RecordIteratorCursor<Object>(iterable.iterator(), clazz);
-    case RECORD_PROJECTION:
-      @SuppressWarnings("unchecked") final Class<Object> clazz2 =
-          cursorFactory.clazz;
-      return new RecordIteratorCursor<Object>(iterable.iterator(), clazz2,
-          cursorFactory.fields);
-    case LIST:
-      @SuppressWarnings("unchecked") final Iterable<List<Object>> iterable2 =
-          (Iterable<List<Object>>) (Iterable) iterable;
-      return new ListIteratorCursor(iterable2.iterator());
-    case MAP:
-      @SuppressWarnings("unchecked") final Iterable<Map<String, Object>>
-          iterable3 =
-          (Iterable<Map<String, Object>>) (Iterable) iterable;
-      return new MapIteratorCursor(iterable3.iterator(),
-          cursorFactory.fieldNames);
-    default:
-      throw new AssertionError("unknown style: " + cursorFactory.style);
-    }
-  }
-
-  public static List<List<Object>> collect(CursorFactory cursorFactory,
-      final Iterator<Object> iterator, List<List<Object>> list) {
-    final Iterable<Object> iterable = new Iterable<Object>() {
-      public Iterator<Object> iterator() {
-        return iterator;
-      }
-    };
-    return collect(cursorFactory, iterable, list);
-  }
-
-  public static List<List<Object>> collect(CursorFactory cursorFactory,
-      Iterable<Object> iterable, final List<List<Object>> list) {
-    switch (cursorFactory.style) {
-    case OBJECT:
-      for (Object o : iterable) {
-        list.add(Collections.singletonList(o));
-      }
-      return list;
-    case ARRAY:
-      @SuppressWarnings("unchecked") final Iterable<Object[]> iterable1 =
-          (Iterable<Object[]>) (Iterable) iterable;
-      for (Object[] objects : iterable1) {
-        list.add(Arrays.asList(objects));
-      }
-      return list;
-    case RECORD:
-    case RECORD_PROJECTION:
-      final Field[] fields;
-      switch (cursorFactory.style) {
-      case RECORD:
-        fields = cursorFactory.clazz.getFields();
-        break;
-      default:
-        fields = cursorFactory.fields.toArray(
-            new Field[cursorFactory.fields.size()]);
-      }
-      for (Object o : iterable) {
-        final Object[] objects = new Object[fields.length];
-        for (int i = 0; i < fields.length; i++) {
-          Field field = fields[i];
-          try {
-            objects[i] = field.get(o);
-          } catch (IllegalAccessException e) {
-            throw new RuntimeException(e);
-          }
-        }
-        list.add(Arrays.asList(objects));
-      }
-      return list;
-    case LIST:
-      @SuppressWarnings("unchecked") final Iterable<List<Object>> iterable2 =
-          (Iterable<List<Object>>) (Iterable) iterable;
-      for (List<Object> objects : iterable2) {
-        list.add(objects);
-      }
-      return list;
-    case MAP:
-      @SuppressWarnings("unchecked") final Iterable<Map<String, Object>>
-          iterable3 =
-          (Iterable<Map<String, Object>>) (Iterable) iterable;
-      for (Map<String, Object> map : iterable3) {
-        final List<Object> objects = new ArrayList<Object>();
-        for (String fieldName : cursorFactory.fieldNames) {
-          objects.add(map.get(fieldName));
-        }
-        list.add(objects);
-      }
-      return list;
-    default:
-      throw new AssertionError("unknown style: " + cursorFactory.style);
-    }
-  }
-
-  @Override public void openConnection(ConnectionHandle ch, Map<String, String> info) {
-    // dummy implementation, connection is already created at this point
-  }
-
-  @Override public void closeConnection(ConnectionHandle ch) {
-    // TODO: implement
-    //
-    // lots of Calcite tests break with this simple implementation,
-    // requires investigation
-
-//    try {
-//      connection.close();
-//    } catch (SQLException e) {
-//      throw new RuntimeException(e);
-//    }
-  }
-
-  @Override public ConnectionProperties connectionSync(ConnectionHandle ch,
-      ConnectionProperties connProps) {
-    this.connProps.merge(connProps);
-    this.connProps.setDirty(false);
-    return this.connProps;
-  }
-
-  public StatementHandle createStatement(ConnectionHandle ch) {
-    return new StatementHandle(ch.id, connection.statementCount++, null);
-  }
-
-  /** Creates an empty result set. Useful for JDBC metadata methods that are
-   * not implemented or which query entities that are not supported (e.g.
-   * triggers in Lingual). */
-  protected <E> MetaResultSet createEmptyResultSet(final Class<E> clazz) {
-    return createResultSet(Collections.<String, Object>emptyMap(),
-        fieldMetaData(clazz).columns,
-        CursorFactory.deduce(fieldMetaData(clazz).columns, null),
-        Frame.EMPTY);
-  }
-
-  public static ColumnMetaData columnMetaData(String name, int index,
-      Class<?> type, boolean columnNullable) {
-    return columnMetaData(name, index, type, columnNullable
-        ? DatabaseMetaData.columnNullable
-        : DatabaseMetaData.columnNoNulls);
-  }
-
-  public static ColumnMetaData columnMetaData(String name, int index,
-      Class<?> type, int columnNullable) {
-    TypeInfo pair = TypeInfo.m.get(type);
-    ColumnMetaData.Rep rep =
-        ColumnMetaData.Rep.VALUE_MAP.get(type);
-    ColumnMetaData.AvaticaType scalarType =
-        ColumnMetaData.scalar(pair.sqlType, pair.sqlTypeName, rep);
-    return new ColumnMetaData(
-        index, false, true, false, false,
-        columnNullable,
-        true, -1, name, name, null,
-        0, 0, null, null, scalarType, true, false, false,
-        scalarType.columnClassName());
-  }
-
-  protected static ColumnMetaData.StructType fieldMetaData(Class<?> clazz) {
-    final List<ColumnMetaData> list = new ArrayList<ColumnMetaData>();
-    for (Field field : clazz.getFields()) {
-      if (Modifier.isPublic(field.getModifiers())
-          && !Modifier.isStatic(field.getModifiers())) {
-        int columnNullable = getColumnNullability(field);
-        list.add(
-            columnMetaData(
-                AvaticaUtils.camelToUpper(field.getName()),
-                list.size(), field.getType(), columnNullable));
-      }
-    }
-    return ColumnMetaData.struct(list);
-  }
-
-  protected static int getColumnNullability(Field field) {
-    // Check annotations first
-    if (field.isAnnotationPresent(ColumnNoNulls.class)) {
-      return DatabaseMetaData.columnNoNulls;
-    }
-
-    if (field.isAnnotationPresent(ColumnNullable.class)) {
-      return DatabaseMetaData.columnNullable;
-    }
-
-    if (field.isAnnotationPresent(ColumnNullableUnknown.class)) {
-      return DatabaseMetaData.columnNullableUnknown;
-    }
-
-    // check the field type to decide if annotated, as a fallback
-    if (field.getType().isPrimitive()) {
-      return DatabaseMetaData.columnNoNulls;
-    }
-
-    return DatabaseMetaData.columnNullable;
-  }
-
-  protected MetaResultSet createResultSet(
-      Map<String, Object> internalParameters, List<ColumnMetaData> columns,
-      CursorFactory cursorFactory, Frame firstFrame) {
-    try {
-      final AvaticaStatement statement = connection.createStatement();
-      final Signature signature =
-          new Signature(columns, "", Collections.<AvaticaParameter>emptyList(),
-              internalParameters, cursorFactory, Meta.StatementType.SELECT);
-      return MetaResultSet.create(connection.id, statement.getId(), true,
-          signature, firstFrame);
-    } catch (SQLException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  /** An object that has a name. */
-  public interface Named {
-    @JsonIgnore String getName();
-  }
-
-  /** Annotation that indicates that a meta field may contain null values. */
-  @Retention(RetentionPolicy.RUNTIME)
-  @Target(ElementType.FIELD)
-  public @interface ColumnNullable {
-  }
-
-  /** Annotation that indicates that it is unknown whether a meta field may contain
-   * null values. */
-  @Retention(RetentionPolicy.RUNTIME)
-  @Target(ElementType.FIELD)
-  public @interface ColumnNullableUnknown {
-  }
-
-  /** Annotation that indicates that a meta field may not contain null
-   * values. */
-  @Retention(RetentionPolicy.RUNTIME)
-  @Target(ElementType.FIELD)
-  public @interface ColumnNoNulls {
-  }
-
-  /** Metadata describing a column. */
-  public static class MetaColumn implements Named {
-    public final String tableCat;
-    public final String tableSchem;
-    @ColumnNoNulls
-    public final String tableName;
-    @ColumnNoNulls
-    public final String columnName;
-    public final int dataType;
-    @ColumnNoNulls
-    public final String typeName;
-    public final Integer columnSize;
-    @ColumnNullableUnknown
-    public final Integer bufferLength = null;
-    public final Integer decimalDigits;
-    public final Integer numPrecRadix;
-    public final int nullable;
-    public final String remarks = null;
-    public final String columnDef = null;
-    @ColumnNullableUnknown
-    public final Integer sqlDataType = null;
-    @ColumnNullableUnknown
-    public final Integer sqlDatetimeSub = null;
-    public final Integer charOctetLength;
-    public final int ordinalPosition;
-    @ColumnNoNulls
-    public final String isNullable;
-    public final String scopeCatalog = null;
-    public final String scopeSchema = null;
-    public final String scopeTable = null;
-    public final Short sourceDataType = null;
-    @ColumnNoNulls
-    public final String isAutoincrement = "";
-    @ColumnNoNulls
-    public final String isGeneratedcolumn = "";
-
-    public MetaColumn(
-        String tableCat,
-        String tableSchem,
-        String tableName,
-        String columnName,
-        int dataType,
-        String typeName,
-        Integer columnSize,
-        Integer decimalDigits,
-        Integer numPrecRadix,
-        int nullable,
-        Integer charOctetLength,
-        int ordinalPosition,
-        String isNullable) {
-      this.tableCat = tableCat;
-      this.tableSchem = tableSchem;
-      this.tableName = tableName;
-      this.columnName = columnName;
-      this.dataType = dataType;
-      this.typeName = typeName;
-      this.columnSize = columnSize;
-      this.decimalDigits = decimalDigits;
-      this.numPrecRadix = numPrecRadix;
-      this.nullable = nullable;
-      this.charOctetLength = charOctetLength;
-      this.ordinalPosition = ordinalPosition;
-      this.isNullable = isNullable;
-    }
-
-    public String getName() {
-      return columnName;
-    }
-  }
-
-  /** Metadata describing a table. */
-  public static class MetaTable implements Named {
-    public final String tableCat;
-    public final String tableSchem;
-    @ColumnNoNulls
-    public final String tableName;
-    @ColumnNoNulls
-    public final String tableType;
-    public final String remarks = null;
-    public final String typeCat = null;
-    public final String typeSchem = null;
-    public final String typeName = null;
-    public final String selfReferencingColName = null;
-    public final String refGeneration = null;
-
-    public MetaTable(
-        String tableCat,
-        String tableSchem,
-        String tableName,
-        String tableType) {
-      this.tableCat = tableCat;
-      this.tableSchem = tableSchem;
-      this.tableName = tableName;
-      this.tableType = tableType;
-    }
-
-    public String getName() {
-      return tableName;
-    }
-  }
-
-  /** Metadata describing a schema. */
-  public static class MetaSchema implements Named {
-    @ColumnNoNulls
-    public final String tableSchem;
-    public final String tableCatalog;
-
-    public MetaSchema(
-        String tableCatalog,
-        String tableSchem) {
-      this.tableCatalog = tableCatalog;
-      this.tableSchem = tableSchem;
-    }
-
-    public String getName() {
-      return tableSchem;
-    }
-  }
-
-  /** Metadata describing a catalog. */
-  public static class MetaCatalog implements Named {
-    @ColumnNoNulls
-    public final String tableCat;
-
-    public MetaCatalog(
-        String tableCatalog) {
-      this.tableCat = tableCatalog;
-    }
-
-    public String getName() {
-      return tableCat;
-    }
-  }
-
-  /** Metadata describing a table type. */
-  public static class MetaTableType {
-    @ColumnNoNulls
-    public final String tableType;
-
-    public MetaTableType(String tableType) {
-      this.tableType = tableType;
-    }
-  }
-
-  /** Metadata describing a procedure. */
-  public static class MetaProcedure {
-    public final String procedureCat;
-    public final String procedureSchem;
-    @ColumnNoNulls
-    public final String procedureName;
-    public final String futureUse1 = null;
-    public final String futureUse2 = null;
-    public final String futureUse3 = null;
-    public final String remarks = null;
-    public final short procedureType;
-    public final String specificName;
-
-    public MetaProcedure(String procedureCat, String procedureSchem, String procedureName,
-        short procedureType, String specificName) {
-      this.procedureCat = procedureCat;
-      this.procedureSchem = procedureSchem;
-      this.procedureName = procedureName;
-      this.procedureType = procedureType;
-      this.specificName = specificName;
-    }
-  }
-
-  /** Metadata describing a procedure column. */
-  public static class MetaProcedureColumn {
-    public final String procedureCat;
-    public final String procedureSchem;
-    @ColumnNoNulls
-    public final String procedureName;
-    @ColumnNoNulls
-    public final String columnName;
-    public final short columnType;
-    public final int dataType;
-    @ColumnNoNulls
-    public final String typeName;
-    public final Integer precision;
-    public final Integer length;
-    public final Short scale;
-    public final Short radix;
-    public final short nullable;
-    public final String remarks = null;
-    public final String columnDef;
-    @ColumnNullableUnknown
-    public final Integer sqlDataType = null;
-    @ColumnNullableUnknown
-    public final Integer sqlDatetimeSub = null;
-    public final Integer charOctetLength;
-    public final int ordinalPosition;
-    @ColumnNoNulls
-    public final String isNullable;
-    public final String specificName;
-
-    public MetaProcedureColumn(
-        String procedureCat,
-        String procedureSchem,
-        String procedureName,
-        String columnName,
-        short columnType,
-        int dataType,
-        String typeName,
-        Integer precision,
-        Integer length,
-        Short scale,
-        Short radix,
-        short nullable,
-        String columnDef,
-        Integer charOctetLength,
-        int ordinalPosition,
-        String isNullable,
-        String specificName) {
-      this.procedureCat = procedureCat;
-      this.procedureSchem = procedureSchem;
-      this.procedureName = procedureName;
-      this.columnName = columnName;
-      this.columnType = columnType;
-      this.dataType = dataType;
-      this.typeName = typeName;
-      this.precision = precision;
-      this.length = length;
-      this.scale = scale;
-      this.radix = radix;
-      this.nullable = nullable;
-      this.columnDef = columnDef;
-      this.charOctetLength = charOctetLength;
-      this.ordinalPosition = ordinalPosition;
-      this.isNullable = isNullable;
-      this.specificName = specificName;
-    }
-  }
-
-  /** Metadata describing a column privilege. */
-  public static class MetaColumnPrivilege {
-    public final String tableCat;
-    public final String tableSchem;
-    @ColumnNoNulls
-    public final String tableName;
-    @ColumnNoNulls
-    public final String columnName;
-    public final String grantor;
-    @ColumnNoNulls
-    public final String grantee;
-    @ColumnNoNulls
-    public final String privilege;
-    public final String isGrantable;
-
-    public MetaColumnPrivilege(
-        String tableCat,
-        String tableSchem,
-        String tableName,
-        String columnName,
-        String grantor,
-        String grantee,
-        String privilege,
-        String isGrantable) {
-      this.tableCat = tableCat;
-      this.tableSchem = tableSchem;
-      this.tableName = tableName;
-      this.columnName = columnName;
-      this.grantor = grantor;
-      this.grantee = grantee;
-      this.privilege = privilege;
-      this.isGrantable = isGrantable;
-    }
-  }
-
-  /** Metadata describing a table privilege. */
-  public static class MetaTablePrivilege {
-    public final String tableCat;
-    public final String tableSchem;
-    @ColumnNoNulls
-    public final String tableName;
-
-    public final String grantor;
-    @ColumnNoNulls
-    public final String grantee;
-    @ColumnNoNulls
-    public final String privilege;
-    public final String isGrantable;
-
-    public MetaTablePrivilege(
-        String tableCat,
-        String tableSchem,
-        String tableName,
-        String grantor,
-        String grantee,
-        String privilege,
-        String isGrantable) {
-      this.tableCat = tableCat;
-      this.tableSchem = tableSchem;
-      this.tableName = tableName;
-      this.grantor = grantor;
-      this.grantee = grantee;
-      this.privilege = privilege;
-      this.isGrantable = isGrantable;
-    }
-  }
-
-  /** Metadata describing the best identifier for a row. */
-  public static class MetaBestRowIdentifier {
-    public final short scope;
-    @ColumnNoNulls
-    public final String columnName;
-    public final int dataType;
-    @ColumnNoNulls
-    public final String typeName;
-    public final Integer columnSize;
-    @ColumnNullableUnknown
-    public final Integer bufferLength = null;
-    public final Short decimalDigits;
-    public short pseudoColumn;
-
-    public MetaBestRowIdentifier(
-        short scope,
-        String columnName,
-        int dataType,
-        String typeName,
-        Integer columnSize,
-        Short decimalDigits,
-        short pseudoColumn) {
-      this.scope = scope;
-      this.columnName = columnName;
-      this.dataType = dataType;
-      this.typeName = typeName;
-      this.columnSize = columnSize;
-      this.decimalDigits = decimalDigits;
-      this.pseudoColumn = pseudoColumn;
-    }
-  }
-
-  /** Metadata describing a version column. */
-  public static class MetaVersionColumn {
-    @ColumnNullableUnknown
-    public final Short scope;
-    @ColumnNoNulls
-    public final String columnName;
-    public final int dataType;
-    @ColumnNoNulls
-    public final String typeName;
-    public final Integer columnSize;
-    public final Integer bufferLength;
-    public final Short decimalDigits;
-    public final short pseudoColumn;
-
-    MetaVersionColumn(
-        Short scope,
-        String columnName,
-        int dataType,
-        String typeName,
-        Integer columnSize,
-        Integer bufferLength,
-        Short decimalDigits,
-        short pseudoColumn) {
-      this.scope = scope;
-      this.columnName = columnName;
-      this.dataType = dataType;
-      this.typeName = typeName;
-      this.columnSize = columnSize;
-      this.bufferLength = bufferLength;
-      this.decimalDigits = decimalDigits;
-      this.pseudoColumn = pseudoColumn;
-    }
-  }
-
-  /** Metadata describing a primary key. */
-  public static class MetaPrimaryKey {
-    public final String tableCat;
-    public final String tableSchem;
-    @ColumnNoNulls
-    public final String tableName;
-    @ColumnNoNulls
-    public final String columnName;
-    public final short keySeq;
-    public final String pkName;
-
-    MetaPrimaryKey(
-        String tableCat,
-        String tableSchem,
-        String tableName,
-        String columnName,
-        short keySeq,
-        String pkName) {
-      this.tableCat = tableCat;
-      this.tableSchem = tableSchem;
-      this.tableName = tableName;
-      this.columnName = columnName;
-      this.keySeq = keySeq;
-      this.pkName = pkName;
-    }
-  }
-
-  /** Metadata describing an imported key. */
-  public static class MetaImportedKey {
-    public final String pktableCat;
-    public final String pktableSchem;
-    @ColumnNoNulls
-    public final String pktableName;
-    @ColumnNoNulls
-    public final String pkcolumnName;
-    public final String fktableCat;
-    public final String fktableSchem;
-    @ColumnNoNulls
-    public final String fktableName;
-    @ColumnNoNulls
-    public final String fkcolumnName;
-    public final short keySeq;
-    public final short updateRule;
-    public final short deleteRule;
-    public final String fkName;
-    public final String pkName;
-    public final short deferability;
-
-    public MetaImportedKey(
-        String pktableCat,
-        String pktableSchem,
-        String pktableName,
-        String pkcolumnName,
-        String fktableCat,
-        String fktableSchem,
-        String fktableName,
-        String fkcolumnName,
-        short keySeq,
-        short updateRule,
-        short deleteRule,
-        String fkName,
-        String pkName,
-        short deferability) {
-      this.pktableCat = pktableCat;
-      this.pktableSchem = pktableSchem;
-      this.pktableName = pktableName;
-      this.pkcolumnName = pkcolumnName;
-      this.fktableCat = fktableCat;
-      this.fktableSchem = fktableSchem;
-      this.fktableName = fktableName;
-      this.fkcolumnName = fkcolumnName;
-      this.keySeq = keySeq;
-      this.updateRule = updateRule;
-      this.deleteRule = deleteRule;
-      this.fkName = fkName;
-      this.pkName = pkName;
-      this.deferability = deferability;
-    }
-  }
-
-  /** Metadata describing an exported key. */
-  public static class MetaExportedKey {
-    public final String pktableCat;
-    public final String pktableSchem;
-    @ColumnNoNulls
-    public final String pktableName;
-    @ColumnNoNulls
-    public final String pkcolumnName;
-    public final String fktableCat;
-    public final String fktableSchem;
-    @ColumnNoNulls
-    public final String fktableName;
-    @ColumnNoNulls
-    public final String fkcolumnName;
-    public final short keySeq;
-    public final short updateRule;
-    public final short deleteRule;
-    public final String fkName;
-    public final String pkName;
-    public final short deferability;
-
-    public MetaExportedKey(
-        String pktableCat,
-        String pktableSchem,
-        String pktableName,
-        String pkcolumnName,
-        String fktableCat,
-        String fktableSchem,
-        String fktableName,
-        String fkcolumnName,
-        short keySeq,
-        short updateRule,
-        short deleteRule,
-        String fkName,
-        String pkName,
-        short deferability) {
-      this.pktableCat = pktableCat;
-      this.pktableSchem = pktableSchem;
-      this.pktableName = pktableName;
-      this.pkcolumnName = pkcolumnName;
-      this.fktableCat = fktableCat;
-      this.fktableSchem = fktableSchem;
-      this.fktableName = fktableName;
-      this.fkcolumnName = fkcolumnName;
-      this.keySeq = keySeq;
-      this.updateRule = updateRule;
-      this.deleteRule = deleteRule;
-      this.fkName = fkName;
-      this.pkName = pkName;
-      this.deferability = deferability;
-    }
-  }
-
-  /** Metadata describing a cross reference. */
-  public static class MetaCrossReference {
-    public final String pktableCat;
-    public final String pktableSchem;
-    @ColumnNoNulls
-    public final String pktableName;
-    @ColumnNoNulls
-    public final String pkcolumnName;
-    public final String fktableCat;
-    public final String fktableSchem;
-    @ColumnNoNulls
-    public final String fktableName;
-    @ColumnNoNulls
-    public final String fkcolumnName;
-    public final short keySeq;
-    public final short updateRule;
-    public final short deleteRule;
-    public final String fkName;
-    public final String pkName;
-    public final short deferability;
-
-    public MetaCrossReference(
-        String pktableCat,
-        String pktableSchem,
-        String pktableName,
-        String pkcolumnName,
-        String fktableCat,
-        String fktableSchem,
-        String fktableName,
-        String fkcolumnName,
-        short keySeq,
-        short updateRule,
-        short deleteRule,
-        String fkName,
-        String pkName,
-        short deferability) {
-      this.pktableCat = pktableCat;
-      this.pktableSchem = pktableSchem;
-      this.pktableName = pktableName;
-      this.pkcolumnName = pkcolumnName;
-      this.fktableCat = fktableCat;
-      this.fktableSchem = fktableSchem;
-      this.fktableName = fktableName;
-      this.fkcolumnName = fkcolumnName;
-      this.keySeq = keySeq;
-      this.updateRule = updateRule;
-      this.deleteRule = deleteRule;
-      this.fkName = fkName;
-      this.pkName = pkName;
-      this.deferability = deferability;
-    }
-  }
-
-  /** Metadata describing type info. */
-  public static class MetaTypeInfo implements Named {
-    @ColumnNoNulls
-    public final String typeName;
-    public final int dataType;
-    public final Integer precision;
-    public final String literalPrefix;
-    public final String literalSuffix;
-    //TODO: Add create parameter for type on DDL
-    public final String createParams = null;
-    public final short nullable;
-    public final boolean caseSensitive;
-    public final short searchable;
-    public final boolean unsignedAttribute;
-    public final boolean fixedPrecScale;
-    public final boolean autoIncrement;
-    public final String localTypeName;
-    public final Short minimumScale;
-    public final Short maximumScale;
-    @ColumnNullableUnknown
-    public final Integer sqlDataType = null;
-    @ColumnNullableUnknown
-    public final Integer sqlDatetimeSub = null;
-    public final Integer numPrecRadix; //nullable int
-
-    public MetaTypeInfo(
-        String typeName,
-        int dataType,
-        Integer precision,
-        String literalPrefix,
-        String literalSuffix,
-        short nullable,
-        boolean caseSensitive,
-        short searchable,
-        boolean unsignedAttribute,
-        boolean fixedPrecScale,
-        boolean autoIncrement,
-        Short minimumScale,
-        Short maximumScale,
-        Integer numPrecRadix) {
-      this.typeName = typeName;
-      this.dataType = dataType;
-      this.precision = precision;
-      this.literalPrefix = literalPrefix;
-      this.literalSuffix = literalSuffix;
-      this.nullable = nullable;
-      this.caseSensitive = caseSensitive;
-      this.searchable = searchable;
-      this.unsignedAttribute = unsignedAttribute;
-      this.fixedPrecScale = fixedPrecScale;
-      this.autoIncrement = autoIncrement;
-      this.localTypeName = typeName;
-      this.minimumScale = minimumScale;
-      this.maximumScale = maximumScale;
-      this.numPrecRadix = numPrecRadix == 0 ? null : numPrecRadix;
-    }
-
-    public String getName() {
-      return typeName;
-    }
-  }
-
-  /** Metadata describing index info. */
-  public static class MetaIndexInfo {
-    public final String tableCat;
-    public final String tableSchem;
-    @ColumnNoNulls
-    public final String tableName;
-    public final boolean nonUnique;
-    public final String indexQualifier;
-    public final String indexName;
-    public final short type;
-    public final short ordinalPosition;
-    public final String columnName;
-    public final String ascOrDesc;
-    public final long cardinality;
-    public final long pages;
-    public final String filterCondition;
-
-    public MetaIndexInfo(
-        String tableCat,
-        String tableSchem,
-        String tableName,
-        boolean nonUnique,
-        String indexQualifier,
-        String indexName,
-        short type,
-        short ordinalPosition,
-        String columnName,
-        String ascOrDesc,
-        long cardinality,
-        long pages,
-        String filterCondition) {
-      this.tableCat = tableCat;
-      this.tableSchem = tableSchem;
-      this.tableName = tableName;
-      this.nonUnique = nonUnique;
-      this.indexQualifier = indexQualifier;
-      this.indexName = indexName;
-      this.type = type;
-      this.ordinalPosition = ordinalPosition;
-      this.columnName = columnName;
-      this.ascOrDesc = ascOrDesc;
-      this.cardinality = cardinality;
-      this.pages = pages;
-      this.filterCondition = filterCondition;
-    }
-  }
-
-  /** Metadata describing a user-defined type. */
-  public static class MetaUdt {
-    public final String typeCat;
-    public final String typeSchem;
-    @ColumnNoNulls
-    public final String typeName;
-    @ColumnNoNulls
-    public final String className;
-    public final int dataType;
-    public final String remarks = null;
-    public final Short baseType;
-
-    public MetaUdt(
-        String typeCat,
-        String typeSchem,
-        String typeName,
-        String className,
-        int dataType,
-        Short baseType) {
-      this.typeCat = typeCat;
-      this.typeSchem = typeSchem;
-      this.typeName = typeName;
-      this.className = className;
-      this.dataType = dataType;
-      this.baseType = baseType;
-    }
-  }
-
-  /** Metadata describing a super-type. */
-  public static class MetaSuperType {
-    public final String typeCat;
-    public final String typeSchem;
-    @ColumnNoNulls
-    public final String typeName;
-    public final String supertypeCat;
-    public final String supertypeSchem;
-    @ColumnNoNulls
-    public final String supertypeName;
-
-    public MetaSuperType(
-        String typeCat,
-        String typeSchem,
-        String typeName,
-        String supertypeCat,
-        String supertypeSchem,
-        String supertypeName) {
-      this.typeCat = typeCat;
-      this.typeSchem = typeSchem;
-      this.typeName = typeName;
-      this.supertypeCat = supertypeCat;
-      this.supertypeSchem = supertypeSchem;
-      this.supertypeName = supertypeName;
-    }
-  }
-
-  /** Metadata describing an attribute. */
-  public static class MetaAttribute {
-    public final String typeCat;
-    public final String typeSchem;
-    @ColumnNoNulls
-    public final String typeName;
-    @ColumnNoNulls
-    public final String attrName;
-    public final int dataType;
-    @ColumnNoNulls
-    public String attrTypeName;
-    public final Integer attrSize;
-    public final Integer decimalDigits;
-    public final Integer numPrecRadix;
-    public final int nullable;
-    public final String remarks = null;
-    public final String attrDef = null;
-    @ColumnNullableUnknown
-    public final Integer sqlDataType = null;
-    @ColumnNullableUnknown
-    public final Integer sqlDatetimeSub = null;
-    public final Integer charOctetLength;
-    public final int ordinalPosition;
-    @ColumnNoNulls
-    public final String isNullable;
-    public final String scopeCatalog = null;
-    public final String scopeSchema = null;
-    public final String scopeTable = null;
-    public final Short sourceDataType = null;
-
-    public MetaAttribute(
-        String typeCat,
-        String typeSchem,
-        String typeName,
-        String attrName,
-        int dataType,
-        String attrTypeName,
-        Integer attrSize,
-        Integer decimalDigits,
-        Integer numPrecRadix,
-        int nullable,
-        Integer charOctetLength,
-        int ordinalPosition,
-        String isNullable) {
-      this.typeCat = typeCat;
-      this.typeSchem = typeSchem;
-      this.typeName = typeName;
-      this.attrName = attrName;
-      this.dataType = dataType;
-      this.attrTypeName = attrTypeName;
-      this.attrSize = attrSize;
-      this.decimalDigits = decimalDigits;
-      this.numPrecRadix = numPrecRadix;
-      this.nullable = nullable;
-      this.charOctetLength = charOctetLength;
-      this.ordinalPosition = ordinalPosition;
-      this.isNullable = isNullable;
-    }
-  }
-
-  /** Metadata describing a client info property. */
-  public static class MetaClientInfoProperty {
-    @ColumnNoNulls
-    public final String name;
-    public final int maxLen;
-    public final String defaultValue;
-    public final String description;
-
-    public MetaClientInfoProperty(
-        String name,
-        int maxLen,
-        String defaultValue,
-        String description) {
-      this.name = name;
-      this.maxLen = maxLen;
-      this.defaultValue = defaultValue;
-      this.description = description;
-    }
-  }
-
-  /** Metadata describing a function. */
-  public static class MetaFunction {
-    public final String functionCat;
-    public final String functionSchem;
-    @ColumnNoNulls
-    public final String functionName;
-    public final String remarks = null;
-    public final short functionType;
-    public final String specificName;
-
-    public MetaFunction(
-        String functionCat,
-        String functionSchem,
-        String functionName,
-        short functionType,
-        String specificName) {
-      this.functionCat = functionCat;
-      this.functionSchem = functionSchem;
-      this.functionName = functionName;
-      this.functionType = functionType;
-      this.specificName = specificName;
-    }
-  }
-
-  /** Metadata describing a function column. */
-  public static class MetaFunctionColumn {
-    public final String functionCat;
-    public final String functionSchem;
-    @ColumnNoNulls
-    public final String functionName;
-    @ColumnNoNulls
-    public final String columnName;
-    public final short columnType;
-    public final int dataType;
-    @ColumnNoNulls
-    public final String typeName;
-    public final Integer precision;
-    public final Integer length;
-    public final Short scale;
-    public final Short radix;
-    public final short nullable;
-    public final String remarks = null;
-    public final Integer charOctetLength;
-    public final int ordinalPosition;
-    @ColumnNoNulls
-    public final String isNullable;
-    public final String specificName;
-
-    public MetaFunctionColumn(
-        String functionCat,
-        String functionSchem,
-        String functionName,
-        String columnName,
-        short columnType,
-        int dataType,
-        String typeName,
-        Integer precision,
-        Integer length,
-        Short scale,
-        Short radix,
-        short nullable,
-        Integer charOctetLength,
-        int ordinalPosition,
-        String isNullable,
-        String specificName) {
-      this.functionCat = functionCat;
-      this.functionSchem = functionSchem;
-      this.functionName = functionName;
-      this.columnName = columnName;
-      this.columnType = columnType;
-      this.dataType = dataType;
-      this.typeName = typeName;
-      this.precision = precision;
-      this.length = length;
-      this.scale = scale;
-      this.radix = radix;
-      this.nullable = nullable;
-      this.charOctetLength = charOctetLength;
-      this.ordinalPosition = ordinalPosition;
-      this.isNullable = isNullable;
-      this.specificName = specificName;
-    }
-  }
-
-  /** Metadata describing a pseudo column. */
-  public static class MetaPseudoColumn {
-    public final String tableCat;
-    public final String tableSchem;
-    @ColumnNoNulls
-    public final String tableName;
-    @ColumnNoNulls
-    public final String columnName;
-    public final int dataType;
-    public final Integer columnSize;
-    public final Integer decimalDigits;
-    public final Integer numPrecRadix;
-    @ColumnNoNulls
-    public final String columnUsage;
-    public final String remarks = null;
-    public final Integer charOctetLength;
-    @ColumnNoNulls
-    public final String isNullable;
-
-    public MetaPseudoColumn(
-        String tableCat,
-        String tableSchem,
-        String tableName,
-        String columnName,
-        int dataType,
-        Integer columnSize,
-        Integer decimalDigits,
-        Integer numPrecRadix,
-        String columnUsage,
-        Integer charOctetLength,
-        String isNullable) {
-      this.tableCat = tableCat;
-      this.tableSchem = tableSchem;
-      this.tableName = tableName;
-      this.columnName = columnName;
-      this.dataType = dataType;
-      this.columnSize = columnSize;
-      this.decimalDigits = decimalDigits;
-      this.numPrecRadix = numPrecRadix;
-      this.columnUsage = columnUsage;
-      this.charOctetLength = charOctetLength;
-      this.isNullable = isNullable;
-    }
-  }
-
-  /** Metadata describing a super-table. */
-  public static class MetaSuperTable {
-    public final String tableCat;
-    public final String tableSchem;
-    @ColumnNoNulls
-    public final String tableName;
-    @ColumnNoNulls
-    public final String supertableName;
-
-    public MetaSuperTable(
-        String tableCat,
-        String tableSchem,
-        String tableName,
-        String supertableName) {
-      this.tableCat = tableCat;
-      this.tableSchem = tableSchem;
-      this.tableName = tableName;
-      this.supertableName = supertableName;
-    }
-  }
-
-  public Map<DatabaseProperty, Object> getDatabaseProperties(ConnectionHandle ch) {
-    return Collections.emptyMap();
-  }
-
-  public MetaResultSet getTables(ConnectionHandle ch,
-      String catalog,
-      Pat schemaPattern,
-      Pat tableNamePattern,
-      List<String> typeList) {
-    return createEmptyResultSet(MetaTable.class);
-  }
-
-  public MetaResultSet getColumns(ConnectionHandle ch, String catalog,
-      Pat schemaPattern,
-      Pat tableNamePattern,
-      Pat columnNamePattern) {
-    return createEmptyResultSet(MetaColumn.class);
-  }
-
-  public MetaResultSet getSchemas(ConnectionHandle ch, String catalog, Pat schemaPattern) {
-    return createEmptyResultSet(MetaSchema.class);
-  }
-
-  public MetaResultSet getCatalogs(ConnectionHandle ch) {
-    return createEmptyResultSet(MetaCatalog.class);
-  }
-
-  public MetaResultSet getTableTypes(ConnectionHandle ch) {
-    return createEmptyResultSet(MetaTableType.class);
-  }
-
-  public MetaResultSet getProcedures(ConnectionHandle ch,
-      String catalog,
-      Pat schemaPattern,
-      Pat procedureNamePattern) {
-    return createEmptyResultSet(MetaProcedure.class);
-  }
-
-  public MetaResultSet getProcedureColumns(ConnectionHandle ch,
-      String catalog,
-      Pat schemaPattern,
-      Pat procedureNamePattern,
-      Pat columnNamePattern) {
-    return createEmptyResultSet(MetaProcedureColumn.class);
-  }
-
-  public MetaResultSet getColumnPrivileges(ConnectionHandle ch,
-      String catalog,
-      String schema,
-      String table,
-      Pat columnNamePattern) {
-    return createEmptyResultSet(MetaColumnPrivilege.class);
-  }
-
-  public MetaResultSet getTablePrivileges(ConnectionHandle ch,
-      String catalog,
-      Pat schemaPattern,
-      Pat tableNamePattern) {
-    return createEmptyResultSet(MetaTablePrivilege.class);
-  }
-
-  public MetaResultSet getBestRowIdentifier(ConnectionHandle ch,
-      String catalog,
-      String schema,
-      String table,
-      int scope,
-      boolean nullable) {
-    return createEmptyResultSet(MetaBestRowIdentifier.class);
-  }
-
-  public MetaResultSet getVersionColumns(ConnectionHandle ch,
-      String catalog,
-      String schema,
-      String table) {
-    return createEmptyResultSet(MetaVersionColumn.class);
-  }
-
-  public MetaResultSet getPrimaryKeys(ConnectionHandle ch,
-      String catalog,
-      String schema,
-      String table) {
-    return createEmptyResultSet(MetaPrimaryKey.class);
-  }
-
-  public MetaResultSet getImportedKeys(ConnectionHandle ch,
-      String catalog,
-      String schema,
-      String table) {
-    return createEmptyResultSet(MetaImportedKey.class);
-  }
-
-  public MetaResultSet getExportedKeys(ConnectionHandle ch,
-      String catalog,
-      String schema,
-      String table) {
-    return createEmptyResultSet(MetaExportedKey.class);
-  }
-
-  public MetaResultSet getCrossReference(ConnectionHandle ch,
-      String parentCatalog,
-      String parentSchema,
-      String parentTable,
-      String foreignCatalog,
-      String foreignSchema,
-      String foreignTable) {
-    return createEmptyResultSet(MetaCrossReference.class);
-  }
-
-  public MetaResultSet getTypeInfo(ConnectionHandle ch) {
-    return createEmptyResultSet(MetaTypeInfo.class);
-  }
-
-  public MetaResultSet getIndexInfo(ConnectionHandle ch,
-      String catalog,
-      String schema,
-      String table,
-      boolean unique,
-      boolean approximate) {
-    return createEmptyResultSet(MetaIndexInfo.class);
-  }
-
-  public MetaResultSet getUDTs(ConnectionHandle ch,
-      String catalog,
-      Pat schemaPattern,
-      Pat typeNamePattern,
-      int[] types) {
-    return createEmptyResultSet(MetaUdt.class);
-  }
-
-  public MetaResultSet getSuperTypes(ConnectionHandle ch,
-      String catalog,
-      Pat schemaPattern,
-      Pat typeNamePattern) {
-    return createEmptyResultSet(MetaSuperType.class);
-  }
-
-  public MetaResultSet getSuperTables(ConnectionHandle ch,
-      String catalog,
-      Pat schemaPattern,
-      Pat tableNamePattern) {
-    return createEmptyResultSet(MetaSuperTable.class);
-  }
-
-  public MetaResultSet getAttributes(ConnectionHandle ch,
-      String catalog,
-      Pat schemaPattern,
-      Pat typeNamePattern,
-      Pat attributeNamePattern) {
-    return createEmptyResultSet(MetaAttribute.class);
-  }
-
-  public MetaResultSet getClientInfoProperties(ConnectionHandle ch) {
-    return createEmptyResultSet(MetaClientInfoProperty.class);
-  }
-
-  public MetaResultSet getFunctions(ConnectionHandle ch,
-      String catalog,
-      Pat schemaPattern,
-      Pat functionNamePattern) {
-    return createEmptyResultSet(MetaFunction.class);
-  }
-
-  public MetaResultSet getFunctionColumns(ConnectionHandle ch,
-      String catalog,
-      Pat schemaPattern,
-      Pat functionNamePattern,
-      Pat columnNamePattern) {
-    return createEmptyResultSet(MetaFunctionColumn.class);
-  }
-
-  public MetaResultSet getPseudoColumns(ConnectionHandle ch,
-      String catalog,
-      Pat schemaPattern,
-      Pat tableNamePattern,
-      Pat columnNamePattern) {
-    return createEmptyResultSet(MetaPseudoColumn.class);
-  }
-
-  @Override public Iterable<Object> createIterable(StatementHandle handle, QueryState state,
-      Signature signature, List<TypedValue> parameterValues, Frame firstFrame) {
-    if (firstFrame != null && firstFrame.done) {
-      return firstFrame.rows;
-    }
-    AvaticaStatement stmt;
-    try {
-      stmt = connection.lookupStatement(handle);
-    } catch (SQLException e) {
-      throw new RuntimeException(e);
-    }
-    return new FetchIterable(stmt, state,
-        firstFrame, parameterValues);
-  }
-
-  public Frame fetch(AvaticaStatement stmt, List<TypedValue> parameterValues,
-      long offset, int fetchMaxRowCount) throws NoSuchStatementException, MissingResultsException {
-    return null;
-  }
-
-  /** Information about a type. */
-  private static class TypeInfo {
-    private static Map<Class<?>, TypeInfo> m =
-        new HashMap<Class<?>, TypeInfo>();
-    static {
-      put(boolean.class, Types.BOOLEAN, "BOOLEAN");
-      put(Boolean.class, Types.BOOLEAN, "BOOLEAN");
-      put(byte.class, Types.TINYINT, "TINYINT");
-      put(Byte.class, Types.TINYINT, "TINYINT");
-      put(short.class, Types.SMALLINT, "SMALLINT");
-      put(Short.class, Types.SMALLINT, "SMALLINT");
-      put(int.class, Types.INTEGER, "INTEGER");
-      put(Integer.class, Types.INTEGER, "INTEGER");
-      put(long.class, Types.BIGINT, "BIGINT");
-      put(Long.class, Types.BIGINT, "BIGINT");
-      put(float.class, Types.FLOAT, "FLOAT");
-      put(Float.class, Types.FLOAT, "FLOAT");
-      put(double.class, Types.DOUBLE, "DOUBLE");
-      put(Double.class, Types.DOUBLE, "DOUBLE");
-      put(String.class, Types.VARCHAR, "VARCHAR");
-      put(java.sql.Date.class, Types.DATE, "DATE");
-      put(Time.class, Types.TIME, "TIME");
-      put(Timestamp.class, Types.TIMESTAMP, "TIMESTAMP");
-    }
-
-    private final int sqlType;
-    private final String sqlTypeName;
-
-    public TypeInfo(int sqlType, String sqlTypeName) {
-      this.sqlType = sqlType;
-      this.sqlTypeName = sqlTypeName;
-    }
-
-    static void put(Class<?> clazz, int sqlType, String sqlTypeName) {
-      m.put(clazz, new TypeInfo(sqlType, sqlTypeName));
-    }
-  }
-
-  /** Iterator that never returns any elements. */
-  private static class EmptyIterator implements Iterator<Object> {
-    public static final Iterator<Object> INSTANCE = new EmptyIterator();
-
-    public void remove() {
-      throw new UnsupportedOperationException();
-    }
-
-    public boolean hasNext() {
-      return false;
-    }
-
-    public Object next() {
-      throw new NoSuchElementException();
-    }
-  }
-
-  /** Iterable that yields an iterator over rows coming from a sequence of
-   * {@link Meta.Frame}s. */
-  private class FetchIterable implements Iterable<Object> {
-    private final AvaticaStatement stmt;
-    private final QueryState state;
-    private final Frame firstFrame;
-    private final List<TypedValue> parameterValues;
-
-    public FetchIterable(AvaticaStatement stmt, QueryState state, Frame firstFrame,
-        List<TypedValue> parameterValues) {
-      this.stmt = stmt;
-      this.state = state;
-      this.firstFrame = firstFrame;
-      this.parameterValues = parameterValues;
-    }
-
-    public Iterator<Object> iterator() {
-      return new FetchIterator(stmt, state, firstFrame, parameterValues);
-    }
-  }
-
-  /** Iterator over rows coming from a sequence of {@link Meta.Frame}s. */
-  private class FetchIterator implements Iterator<Object> {
-    private final AvaticaStatement stmt;
-    private final QueryState state;
-    private Frame frame;
-    private Iterator<Object> rows;
-    private List<TypedValue> parameterValues;
-    private List<TypedValue> originalParameterValues;
-    private long currentOffset = 0;
-
-    public FetchIterator(AvaticaStatement stmt, QueryState state, Frame firstFrame,
-        List<TypedValue> parameterValues) {
-      this.stmt = stmt;
-      this.state = state;
-      this.parameterValues = parameterValues;
-      this.originalParameterValues = parameterValues;
-      if (firstFrame == null) {
-        frame = Frame.MORE;
-        rows = EmptyIterator.INSTANCE;
-      } else {
-        frame = firstFrame;
-        rows = firstFrame.rows.iterator();
-      }
-      moveNext();
-    }
-
-    public void remove() {
-      throw new UnsupportedOperationException("remove");
-    }
-
-    public boolean hasNext() {
-      return rows != null;
-    }
-
-    public Object next() {
-      if (rows == null) {
-        throw new NoSuchElementException();
-      }
-      final Object o = rows.next();
-      currentOffset++;
-      moveNext();
-      return o;
-    }
-
-    private void moveNext() {
-      for (;;) {
-        if (rows.hasNext()) {
-          break;
-        }
-        if (frame.done) {
-          rows = null;
-          break;
-        }
-        try {
-          // currentOffset updated after element is read from `rows` iterator
-          frame = fetch(stmt.handle, currentOffset, AvaticaStatement.DEFAULT_FETCH_SIZE);
-        } catch (NoSuchStatementException e) {
-          resetStatement();
-          // re-fetch the batch where we left off
-          continue;
-        } catch (MissingResultsException e) {
-          try {
-            // We saw the statement, but it didnt' have a resultset initialized. So, reset it.
-            if (!stmt.syncResults(state, currentOffset)) {
-              // This returned false, so there aren't actually any more results to iterate over
-              frame = null;
-              rows = null;
-              break;
-            }
-            // syncResults returning true means we need to fetch those results
-          } catch (NoSuchStatementException e1) {
-            // Tried to reset the result set, but lost the statement, save a loop before retrying.
-            resetStatement();
-            // Will just loop back around to a MissingResultsException, but w/e recursion
-          }
-          // Kick back to the top to try to fetch again (in both branches)
-          continue;
-        }
-        parameterValues = null; // don't execute next time
-        if (frame == null) {
-          rows = null;
-          break;
-        }
-        // It is valid for rows to be empty, so we go around the loop again to
-        // check
-        rows = frame.rows.iterator();
-      }
-    }
-
-    private void resetStatement() {
-      // If we have to reset the statement, we need to reset the parameterValues too
-      parameterValues = originalParameterValues;
-      // Defer to the statement to reset itself
-      stmt.resetStatement();
-    }
-  }
-
-  /** Returns whether a list of parameter values has any null elements. */
-  public static boolean checkParameterValueHasNull(List<TypedValue> parameterValues) {
-    for (TypedValue x : parameterValues) {
-      if (x == null) {
-        return true;
-      }
-    }
-    return false;
-  }
-}
-
-// End MetaImpl.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/MissingResultsException.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/MissingResultsException.java b/avatica/core/src/main/java/org/apache/calcite/avatica/MissingResultsException.java
deleted file mode 100644
index 7746769..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/MissingResultsException.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import org.apache.calcite.avatica.Meta.StatementHandle;
-
-import java.sql.ResultSet;
-
-/**
- * An Exception which denotes that a cached Statement is present but has no {@link ResultSet}.
- */
-public class MissingResultsException extends Exception {
-
-  private static final long serialVersionUID = 1L;
-
-  private final StatementHandle handle;
-
-  public MissingResultsException(StatementHandle handle) {
-    this.handle = handle;
-  }
-
-  public StatementHandle getHandle() {
-    return handle;
-  }
-}
-
-// End MissingResultsException.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/NoSuchConnectionException.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/NoSuchConnectionException.java b/avatica/core/src/main/java/org/apache/calcite/avatica/NoSuchConnectionException.java
deleted file mode 100644
index b5a940d..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/NoSuchConnectionException.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-/**
- * An Exception that denotes that the given Connection is not cached.
- */
-public class NoSuchConnectionException extends RuntimeException {
-
-  private static final long serialVersionUID = 1L;
-
-  private final String connectionId;
-
-  public NoSuchConnectionException(String connectionId) {
-    this.connectionId = connectionId;
-  }
-
-  public String getConnectionId() {
-    return connectionId;
-  }
-}
-
-// End NoSuchConnectionException.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/NoSuchStatementException.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/NoSuchStatementException.java b/avatica/core/src/main/java/org/apache/calcite/avatica/NoSuchStatementException.java
deleted file mode 100644
index 321011b..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/NoSuchStatementException.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import org.apache.calcite.avatica.Meta.StatementHandle;
-
-/**
- * An Exception that denotes that the given Statement is not cached.
- */
-public class NoSuchStatementException extends Exception {
-
-  private static final long serialVersionUID = 1L;
-
-  private final StatementHandle stmtHandle;
-
-  public NoSuchStatementException(StatementHandle stmtHandle) {
-    this.stmtHandle = stmtHandle;
-  }
-
-  public StatementHandle getStatementHandle() {
-    return stmtHandle;
-  }
-}
-
-// End NoSuchStatementException.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/QueryState.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/QueryState.java b/avatica/core/src/main/java/org/apache/calcite/avatica/QueryState.java
deleted file mode 100644
index 4ca9ce1..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/QueryState.java
+++ /dev/null
@@ -1,466 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import org.apache.calcite.avatica.proto.Common;
-import org.apache.calcite.avatica.proto.Common.MetaDataOperationArgument;
-import org.apache.calcite.avatica.proto.Common.MetaDataOperationArgument.ArgumentType;
-import org.apache.calcite.avatica.remote.MetaDataOperation;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.Arrays;
-import java.util.Objects;
-
-/**
- * A struct used to encapsulate the necessary information to reconstitute a ResultSet in the
- * Avatica server.
- */
-public class QueryState {
-
-  /**
-   * An enumeration that represents how a ResultSet was created.
-   */
-  public enum StateType {
-    SQL,
-    METADATA;
-
-    public Common.StateType toProto() {
-      switch (this) {
-      case SQL:
-        return Common.StateType.SQL;
-      case METADATA:
-        return Common.StateType.METADATA;
-      default:
-        return Common.StateType.UNRECOGNIZED;
-      }
-    }
-
-    public static StateType fromProto(Common.StateType protoType) {
-      switch (protoType) {
-      case SQL:
-        return StateType.SQL;
-      case METADATA:
-        return StateType.METADATA;
-      default:
-        throw new IllegalArgumentException("Unhandled StateType " + protoType);
-      }
-    }
-  }
-
-  @JsonProperty("type")
-  public final StateType type;
-
-  @JsonProperty("sql")
-  public final String sql;
-
-  @JsonProperty("metaDataOperation")
-  public final MetaDataOperation metaDataOperation;
-  @JsonProperty("operationArgs")
-  public final Object[] operationArgs;
-
-  /**
-   * Constructor encapsulating a SQL query used to create a result set.
-   *
-   * @param sql The SQL query.
-   */
-  public QueryState(String sql) {
-    // This doesn't to be non-null
-    this.sql = sql;
-    this.type = StateType.SQL;
-
-    // Null out the members we don't use.
-    this.metaDataOperation = null;
-    this.operationArgs = null;
-  }
-
-  /**
-   * Constructor encapsulating a metadata operation's result set.
-   *
-   * @param op A pointer to the {@link DatabaseMetaData} operation being invoked.
-   * @param args The arguments to the method being invoked.
-   */
-  public QueryState(MetaDataOperation op, Object... args) {
-    this.metaDataOperation = Objects.requireNonNull(op);
-    this.operationArgs = Arrays.copyOf(Objects.requireNonNull(args), args.length);
-    this.type = StateType.METADATA;
-
-    // Null out the members we won't use
-    this.sql = null;
-  }
-
-  /**
-   * Not intended for external use. For Jackson-databind only.
-   */
-  public QueryState(StateType type, String sql, MetaDataOperation op, Object... args) {
-    this.type = Objects.requireNonNull(type);
-    switch (type) {
-    case SQL:
-      this.sql = Objects.requireNonNull(sql);
-      if (null != op) {
-        throw new IllegalArgumentException("Expected null MetaDataOperation, but got " + op);
-      }
-      this.metaDataOperation = null;
-      if (null != args) {
-        throw new IllegalArgumentException("Expected null arguments, but got "
-            + Arrays.toString(args));
-      }
-      this.operationArgs = null;
-      break;
-    case METADATA:
-      this.metaDataOperation = Objects.requireNonNull(op);
-      this.operationArgs = Objects.requireNonNull(args);
-      if (null != sql) {
-        throw new IllegalArgumentException("Expected null SQl but got " + sql);
-      }
-      this.sql = null;
-      break;
-    default:
-      throw new IllegalArgumentException("Unable to handle StateType " + type);
-    }
-  }
-
-  /**
-   * Not intended for external use. For Jackson-databind only.
-   */
-  public QueryState() {
-    this.sql = null;
-    this.metaDataOperation = null;
-    this.type = null;
-    this.operationArgs = null;
-  }
-
-  /**
-   * @return The {@link StateType} for this encapsulated state.
-   */
-  public StateType getType() {
-    return type;
-  }
-
-  /**
-   * @return The SQL expression to invoke.
-   */
-  public String getSql() {
-    assert type == StateType.SQL;
-    return sql;
-  }
-
-  /**
-   * @return The metadata operation to invoke.
-   */
-  public MetaDataOperation getMetaDataOperation() {
-    assert type == StateType.METADATA;
-    return metaDataOperation;
-  }
-
-  /**
-   * @return The Arguments for the given metadata operation.
-   */
-  public Object[] getOperationArgs() {
-    assert type == StateType.METADATA;
-    return operationArgs;
-  }
-
-  public ResultSet invoke(Connection conn, Statement statement) throws SQLException {
-    switch (type) {
-    case SQL:
-      boolean ret = Objects.requireNonNull(statement).execute(sql);
-      ResultSet results = statement.getResultSet();
-
-      // Either execute(sql) returned true or the resultSet was null
-      assert ret || null == results;
-
-      return results;
-    case METADATA:
-      DatabaseMetaData metadata = Objects.requireNonNull(conn).getMetaData();
-      switch (metaDataOperation) {
-      case GET_ATTRIBUTES:
-        verifyOpArgs(4);
-        return metadata.getAttributes((String) operationArgs[0],
-            (String) operationArgs[1],
-            (String) operationArgs[2],
-            (String) operationArgs[3]);
-      case GET_BEST_ROW_IDENTIFIER:
-        verifyOpArgs(5);
-        return metadata.getBestRowIdentifier((String) operationArgs[0],
-            (String) operationArgs[1],
-            (String) operationArgs[2],
-            (int) operationArgs[3],
-            (boolean) operationArgs[4]);
-      case GET_CATALOGS:
-        verifyOpArgs(0);
-        return metadata.getCatalogs();
-      case GET_COLUMNS:
-        verifyOpArgs(4);
-        return metadata.getColumns((String) operationArgs[0],
-            (String) operationArgs[1],
-            (String) operationArgs[2],
-            (String) operationArgs[3]);
-      case GET_COLUMN_PRIVILEGES:
-        verifyOpArgs(4);
-        return metadata.getColumnPrivileges((String) operationArgs[0],
-            (String) operationArgs[1],
-            (String) operationArgs[2],
-            (String) operationArgs[3]);
-      case GET_CROSS_REFERENCE:
-        verifyOpArgs(6);
-        return metadata.getCrossReference((String) operationArgs[0],
-            (String) operationArgs[1],
-            (String) operationArgs[2],
-            (String) operationArgs[3],
-            (String) operationArgs[4],
-            (String) operationArgs[5]);
-      case GET_EXPORTED_KEYS:
-        verifyOpArgs(3);
-        return metadata.getExportedKeys((String) operationArgs[0],
-            (String) operationArgs[1],
-            (String) operationArgs[2]);
-      case GET_FUNCTIONS:
-        verifyOpArgs(3);
-        return metadata.getFunctions((String) operationArgs[0],
-            (String) operationArgs[1],
-            (String) operationArgs[2]);
-      case GET_FUNCTION_COLUMNS:
-        verifyOpArgs(4);
-        return metadata.getFunctionColumns((String) operationArgs[0],
-            (String) operationArgs[1],
-            (String) operationArgs[2],
-            (String) operationArgs[3]);
-      case GET_IMPORTED_KEYS:
-        verifyOpArgs(3);
-        return metadata.getImportedKeys((String) operationArgs[0],
-            (String) operationArgs[1],
-            (String) operationArgs[2]);
-      case GET_INDEX_INFO:
-        verifyOpArgs(5);
-        return metadata.getIndexInfo((String) operationArgs[0],
-            (String) operationArgs[1],
-            (String) operationArgs[2],
-            (boolean) operationArgs[3],
-            (boolean) operationArgs[4]);
-      case GET_PRIMARY_KEYS:
-        verifyOpArgs(3);
-        return metadata.getPrimaryKeys((String) operationArgs[0],
-            (String) operationArgs[1],
-            (String) operationArgs[2]);
-      case GET_PROCEDURES:
-        verifyOpArgs(3);
-        return metadata.getProcedures((String) operationArgs[0],
-            (String) operationArgs[1],
-            (String) operationArgs[2]);
-      case GET_PROCEDURE_COLUMNS:
-        verifyOpArgs(4);
-        return metadata.getProcedureColumns((String) operationArgs[0],
-            (String) operationArgs[1],
-            (String) operationArgs[2],
-            (String) operationArgs[3]);
-      case GET_PSEUDO_COLUMNS:
-        verifyOpArgs(4);
-        return metadata.getPseudoColumns((String) operationArgs[0],
-            (String) operationArgs[1],
-            (String) operationArgs[2],
-            (String) operationArgs[3]);
-      case GET_SCHEMAS:
-        verifyOpArgs(0);
-        return metadata.getSchemas();
-      case GET_SCHEMAS_WITH_ARGS:
-        verifyOpArgs(2);
-        return metadata.getSchemas((String) operationArgs[0],
-            (String) operationArgs[1]);
-      case GET_SUPER_TABLES:
-        verifyOpArgs(3);
-        return metadata.getSuperTables((String) operationArgs[0],
-            (String) operationArgs[1],
-            (String) operationArgs[2]);
-      case GET_SUPER_TYPES:
-        verifyOpArgs(3);
-        return metadata.getSuperTypes((String) operationArgs[0],
-            (String) operationArgs[1],
-            (String) operationArgs[2]);
-      case GET_TABLES:
-        verifyOpArgs(4);
-        return metadata.getTables((String) operationArgs[0],
-            (String) operationArgs[1],
-            (String) operationArgs[2],
-            (String[]) operationArgs[3]);
-      case GET_TABLE_PRIVILEGES:
-        verifyOpArgs(3);
-        return metadata.getTablePrivileges((String) operationArgs[0],
-            (String) operationArgs[1],
-            (String) operationArgs[2]);
-      case GET_TABLE_TYPES:
-        verifyOpArgs(0);
-        return metadata.getTableTypes();
-      case GET_TYPE_INFO:
-        verifyOpArgs(0);
-        return metadata.getTypeInfo();
-      case GET_UDTS:
-        verifyOpArgs(4);
-        return metadata.getUDTs((String) operationArgs[0],
-            (String) operationArgs[1],
-            (String) operationArgs[2],
-            (int[]) operationArgs[3]);
-      case GET_VERSION_COLUMNS:
-        verifyOpArgs(3);
-        return metadata.getVersionColumns((String) operationArgs[0],
-            (String) operationArgs[1],
-            (String) operationArgs[2]);
-      default:
-        throw new IllegalArgumentException("Unhandled Metadata operation: " + metaDataOperation);
-      }
-    default:
-      throw new IllegalArgumentException("Unable to process QueryState of type " + type);
-    }
-  }
-
-  private void verifyOpArgs(int expectedArgs) {
-    if (expectedArgs != operationArgs.length) {
-      throw new RuntimeException("Expected " + expectedArgs + " arguments, but got "
-          + Arrays.toString(operationArgs));
-    }
-  }
-
-  public Common.QueryState toProto() {
-    Common.QueryState.Builder builder = Common.QueryState.newBuilder();
-
-    // Required
-    switch (type) {
-    case SQL:
-      builder.setType(Common.StateType.SQL);
-      break;
-    case METADATA:
-      builder.setType(Common.StateType.METADATA);
-      break;
-    default:
-      throw new IllegalStateException("Unhandled type: " + type);
-    }
-
-    // Optional SQL
-    if (null != sql) {
-      builder.setSql(sql).setHasSql(true);
-    }
-
-    // Optional metaDataOperation
-    if (null != metaDataOperation) {
-      builder.setOp(metaDataOperation.toProto()).setHasOp(true);
-    }
-
-    // Optional operationArgs
-    if (null != operationArgs) {
-      builder.setHasArgs(true);
-      for (Object arg : operationArgs) {
-        MetaDataOperationArgument.Builder argBuilder = MetaDataOperationArgument.newBuilder();
-
-        if (null == arg) {
-          builder.addArgs(argBuilder.setType(ArgumentType.NULL).build());
-        } else if (arg instanceof String) {
-          builder.addArgs(argBuilder.setType(ArgumentType.STRING)
-              .setStringValue((String) arg).build());
-        } else if (arg instanceof Integer) {
-          builder.addArgs(argBuilder.setType(ArgumentType.INT).setIntValue((int) arg).build());
-        } else if (arg instanceof Boolean) {
-          builder.addArgs(
-              argBuilder.setType(ArgumentType.BOOL).setBoolValue((boolean) arg).build());
-        } else if (arg instanceof String[]) {
-          argBuilder.setType(ArgumentType.REPEATED_STRING);
-          for (String strArg : (String[]) arg) {
-            argBuilder.addStringArrayValues(strArg);
-          }
-          builder.addArgs(argBuilder.build());
-        } else if (arg instanceof int[]) {
-          argBuilder.setType(ArgumentType.REPEATED_INT);
-          for (int intArg : (int[]) arg) {
-            argBuilder.addIntArrayValues(intArg);
-          }
-          builder.addArgs(argBuilder.build());
-        } else {
-          throw new RuntimeException("Unexpected operation argument: " + arg.getClass());
-        }
-      }
-    } else {
-      builder.setHasArgs(false);
-    }
-
-    return builder.build();
-  }
-
-  public static QueryState fromProto(Common.QueryState protoState) {
-    StateType type = StateType.fromProto(protoState.getType());
-    String sql = protoState.getHasSql() ? protoState.getSql() : null;
-    MetaDataOperation op = protoState.getHasOp()
-        ? MetaDataOperation.fromProto(protoState.getOp()) : null;
-    Object[] opArgs = null;
-    if (protoState.getHasArgs()) {
-      opArgs = new Object[protoState.getArgsCount()];
-      int i = 0;
-      for (Common.MetaDataOperationArgument arg : protoState.getArgsList()) {
-        switch (arg.getType()) {
-        case STRING:
-          opArgs[i] = arg.getStringValue();
-          break;
-        case BOOL:
-          opArgs[i] = arg.getBoolValue();
-          break;
-        case INT:
-          opArgs[i] = arg.getIntValue();
-          break;
-        case REPEATED_STRING:
-          opArgs[i] = arg.getStringArrayValuesList().toArray(
-              new String[arg.getStringArrayValuesCount()]);
-          break;
-        case REPEATED_INT:
-          int[] arr = new int[arg.getIntArrayValuesCount()];
-          int offset = 0;
-          for (Integer val : arg.getIntArrayValuesList()) {
-            arr[offset] = val;
-            offset++;
-          }
-          opArgs[i] = arr;
-          break;
-        case NULL:
-          opArgs[i] = null;
-          break;
-        default:
-          throw new RuntimeException("Could not interpret " + arg.getType());
-        }
-
-        i++;
-      }
-    }
-
-    return new QueryState(type, sql, op, opArgs);
-  }
-
-  @Override public int hashCode() {
-    return Objects.hash(metaDataOperation, Arrays.hashCode(operationArgs), sql);
-  }
-
-  @Override public boolean equals(Object o) {
-    return o == this
-        || o instanceof QueryState
-        && metaDataOperation == ((QueryState) o).metaDataOperation
-        && Arrays.deepEquals(operationArgs, ((QueryState) o).operationArgs)
-        && Objects.equals(sql, ((QueryState) o).sql);
-  }
-}
-
-// End QueryState.java


[47/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaUtils.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaUtils.java b/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaUtils.java
deleted file mode 100644
index 56a23c8..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaUtils.java
+++ /dev/null
@@ -1,423 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import org.apache.calcite.avatica.util.UnsynchronizedBuffer;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.invoke.MethodHandle;
-import java.lang.invoke.MethodHandles;
-import java.lang.invoke.MethodType;
-import java.lang.reflect.Field;
-import java.nio.charset.StandardCharsets;
-import java.sql.PreparedStatement;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.AbstractList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/** Avatica utilities. */
-public class AvaticaUtils {
-
-  private static final Map<Class, Class> BOX;
-
-  private static final MethodHandle SET_LARGE_MAX_ROWS =
-      method(void.class, Statement.class, "setLargeMaxRows", long.class);
-  private static final MethodHandle GET_LARGE_MAX_ROWS =
-      method(long.class, Statement.class, "getLargeMaxRows");
-  private static final MethodHandle GET_LARGE_UPDATE_COUNT =
-      method(void.class, Statement.class, "getLargeUpdateCount");
-  private static final MethodHandle EXECUTE_LARGE_BATCH =
-      method(long[].class, Statement.class, "executeLargeBatch");
-
-  private static final Set<String> UNIQUE_STRINGS = new HashSet<>();
-
-  private static final ThreadLocal<byte[]> PER_THREAD_BUFFER  = new ThreadLocal<byte[]>() {
-    @Override protected byte[] initialValue() {
-      return new byte[4096];
-    }
-  };
-
-  private AvaticaUtils() {}
-
-  static {
-    BOX = new HashMap<>();
-    BOX.put(boolean.class, Boolean.class);
-    BOX.put(byte.class, Byte.class);
-    BOX.put(char.class, Character.class);
-    BOX.put(short.class, Short.class);
-    BOX.put(int.class, Integer.class);
-    BOX.put(long.class, Long.class);
-    BOX.put(float.class, Float.class);
-    BOX.put(double.class, Double.class);
-  }
-
-  private static MethodHandle method(Class returnType, Class targetType,
-      String name, Class... argTypes) {
-    final MethodHandles.Lookup lookup = MethodHandles.lookup();
-    try {
-      return lookup.findVirtual(targetType, name,
-          MethodType.methodType(returnType, targetType, argTypes));
-    } catch (NoSuchMethodException e) {
-      return null;
-    } catch (IllegalAccessException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  /**
-   * Does nothing with its argument. Call this method when you have a value
-   * you are not interested in, but you don't want the compiler to warn that
-   * you are not using it.
-   */
-  public static void discard(Object o) {
-    if (false) {
-      discard(o);
-    }
-  }
-
-  /**
-   * Use this method to flag temporary code.
-   *
-   * <p>Example #1:
-   * <blockquote><pre>
-   * if (AvaticaUtils.remark("baz fixed") == null) {
-   *   baz();
-   * }</pre></blockquote>
-   *
-   * <p>Example #2:
-   * <blockquote><pre>
-   * /&#42;&#42; &#64;see AvaticaUtils#remark Remove before checking in &#42;/
-   * void uselessMethod() {}
-   * </pre></blockquote>
-   */
-  public static <T> T remark(T remark) {
-    return remark;
-  }
-
-  /**
-   * Use this method to flag code that should be re-visited after upgrading
-   * a component.
-   *
-   * <p>If the intended change is that a class or member be removed, flag
-   * instead using a {@link Deprecated} annotation followed by a comment such as
-   * "to be removed before 2.0".
-   */
-  public static boolean upgrade(String remark) {
-    discard(remark);
-    return false;
-  }
-
-  /**
-   * Adapts a primitive array into a {@link List}. For example,
-   * {@code asList(new double[2])} returns a {@code List&lt;Double&gt;}.
-   */
-  public static List<?> primitiveList(final Object array) {
-    // REVIEW: A per-type list might be more efficient. (Or might not.)
-    return new AbstractList() {
-      public Object get(int index) {
-        return java.lang.reflect.Array.get(array, index);
-      }
-
-      public int size() {
-        return java.lang.reflect.Array.getLength(array);
-      }
-    };
-  }
-
-  /**
-   * Converts a camelCase name into an upper-case underscore-separated name.
-   * For example, {@code camelToUpper("myJdbcDriver")} returns
-   * "MY_JDBC_DRIVER".
-   */
-  public static String camelToUpper(String name) {
-    StringBuilder buf = new StringBuilder();
-    for (int i = 0; i < name.length(); i++) {
-      char c = name.charAt(i);
-      if (Character.isUpperCase(c)) {
-        buf.append('_');
-      } else {
-        c = Character.toUpperCase(c);
-      }
-      buf.append(c);
-    }
-    return buf.toString();
-  }
-
-  /**
-   * Converts an underscore-separated name into a camelCase name.
-   * For example, {@code uncamel("MY_JDBC_DRIVER")} returns "myJdbcDriver".
-   */
-  public static String toCamelCase(String name) {
-    StringBuilder buf = new StringBuilder();
-    int nextUpper = -1;
-    for (int i = 0; i < name.length(); i++) {
-      char c = name.charAt(i);
-      if (c == '_') {
-        nextUpper = i + 1;
-        continue;
-      }
-      if (nextUpper == i) {
-        c = Character.toUpperCase(c);
-      } else {
-        c = Character.toLowerCase(c);
-      }
-      buf.append(c);
-    }
-    return buf.toString();
-  }
-
-  /** Returns the boxed class. For example, {@code box(int.class)}
-   * returns {@code java.lang.Integer}. */
-  public static Class box(Class clazz) {
-    if (clazz.isPrimitive()) {
-      return BOX.get(clazz);
-    }
-    return clazz;
-  }
-
-  /** Creates an instance of a plugin class. First looks for a static
-   * member called INSTANCE, then calls a public default constructor.
-   *
-   * <p>If className contains a "#" instead looks for a static field.
-   *
-   * @param pluginClass Class (or interface) to instantiate
-   * @param className Name of implementing class
-   * @param <T> Class
-   * @return Plugin instance
-   */
-  public static <T> T instantiatePlugin(Class<T> pluginClass,
-      String className) {
-    try {
-      // Given a static field, say "com.example.MyClass#FOO_INSTANCE", return
-      // the value of that static field.
-      if (className.contains("#")) {
-        try {
-          int i = className.indexOf('#');
-          String left = className.substring(0, i);
-          String right = className.substring(i + 1);
-          //noinspection unchecked
-          final Class<T> clazz = (Class) Class.forName(left);
-          final Field field;
-          field = clazz.getField(right);
-          return pluginClass.cast(field.get(null));
-        } catch (NoSuchFieldException e) {
-          // ignore
-        }
-      }
-      //noinspection unchecked
-      final Class<T> clazz = (Class) Class.forName(className);
-      assert pluginClass.isAssignableFrom(clazz);
-      try {
-        // We assume that if there is an INSTANCE field it is static and
-        // has the right type.
-        final Field field = clazz.getField("INSTANCE");
-        return pluginClass.cast(field.get(null));
-      } catch (NoSuchFieldException e) {
-        // ignore
-      }
-      return clazz.getConstructor().newInstance();
-    } catch (Exception e) {
-      throw new RuntimeException("Property '" + className
-          + "' not valid for plugin type " + pluginClass.getName(), e);
-    }
-  }
-
-  /** Reads the contents of an input stream and returns as a string. */
-  public static String readFully(InputStream inputStream) throws IOException {
-    return readFully(inputStream, new UnsynchronizedBuffer(1024));
-  }
-
-  /** Reads the contents of an input stream and returns as a string. */
-  public static String readFully(InputStream inputStream, UnsynchronizedBuffer buffer)
-      throws IOException {
-    // Variant that lets us use a pooled Buffer
-    final byte[] bytes = _readFully(inputStream, buffer);
-    return new String(bytes, 0, bytes.length, StandardCharsets.UTF_8);
-  }
-
-  /** Reads the contents of an input stream and returns as a string. */
-  public static byte[] readFullyToBytes(InputStream inputStream) throws IOException {
-    return readFullyToBytes(inputStream, new UnsynchronizedBuffer(1024));
-  }
-
-  /** Reads the contents of an input stream and returns as a string. */
-  public static byte[] readFullyToBytes(InputStream inputStream, UnsynchronizedBuffer buffer)
-      throws IOException {
-    // Variant that lets us use a pooled Buffer
-    return _readFully(inputStream, buffer);
-  }
-
-  /**
-   * Reads the contents of an input stream and returns a byte array.
-   *
-   * @param inputStream the input to read from.
-   * @return A byte array whose length is equal to the number of bytes contained.
-   */
-  static byte[] _readFully(InputStream inputStream, UnsynchronizedBuffer buffer)
-      throws IOException {
-    final byte[] bytes = PER_THREAD_BUFFER.get();
-    for (;;) {
-      int count = inputStream.read(bytes, 0, bytes.length);
-      if (count < 0) {
-        break;
-      }
-      buffer.write(bytes, 0, count);
-    }
-    return buffer.toArray();
-  }
-
-  /** Invokes {@code Statement#setLargeMaxRows}, falling back on
-   * {@link Statement#setMaxRows(int)} if the method does not exist (before
-   * JDK 1.8) or throws {@link UnsupportedOperationException}. */
-  public static void setLargeMaxRows(Statement statement, long n)
-      throws SQLException {
-    if (SET_LARGE_MAX_ROWS != null) {
-      try {
-        // Call Statement.setLargeMaxRows
-        SET_LARGE_MAX_ROWS.invokeExact(n);
-        return;
-      } catch (UnsupportedOperationException e) {
-        // ignore, and fall through to call Statement.setMaxRows
-      } catch (Error | RuntimeException | SQLException e) {
-        throw e;
-      } catch (Throwable e) {
-        throw new RuntimeException(e);
-      }
-    }
-    int i = (int) Math.max(Math.min(n, Integer.MAX_VALUE), Integer.MIN_VALUE);
-    statement.setMaxRows(i);
-  }
-
-  /** Invokes {@code Statement#getLargeMaxRows}, falling back on
-   * {@link Statement#getMaxRows()} if the method does not exist (before
-   * JDK 1.8) or throws {@link UnsupportedOperationException}. */
-  public static long getLargeMaxRows(Statement statement) throws SQLException {
-    if (GET_LARGE_MAX_ROWS != null) {
-      try {
-        // Call Statement.getLargeMaxRows
-        return (long) GET_LARGE_MAX_ROWS.invokeExact();
-      } catch (UnsupportedOperationException e) {
-        // ignore, and fall through to call Statement.getMaxRows
-      } catch (Error | RuntimeException | SQLException e) {
-        throw e;
-      } catch (Throwable e) {
-        throw new RuntimeException(e);
-      }
-    }
-    return statement.getMaxRows();
-  }
-
-  /** Invokes {@code Statement#getLargeUpdateCount}, falling back on
-   * {@link Statement#getUpdateCount()} if the method does not exist (before
-   * JDK 1.8) or throws {@link UnsupportedOperationException}. */
-  public static long getLargeUpdateCount(Statement statement)
-      throws SQLException {
-    if (GET_LARGE_UPDATE_COUNT != null) {
-      try {
-        // Call Statement.getLargeUpdateCount
-        return (long) GET_LARGE_UPDATE_COUNT.invokeExact();
-      } catch (UnsupportedOperationException e) {
-        // ignore, and fall through to call Statement.getUpdateCount
-      } catch (Error | RuntimeException | SQLException e) {
-        throw e;
-      } catch (Throwable e) {
-        throw new RuntimeException(e);
-      }
-    }
-    return statement.getUpdateCount();
-  }
-
-  /** Invokes {@code Statement#executeLargeBatch}, falling back on
-   * {@link PreparedStatement#executeBatch} if the method does not exist
-   * (before JDK 1.8) or throws {@link UnsupportedOperationException}. */
-  public static long[] executeLargeBatch(Statement statement)
-      throws SQLException {
-    if (EXECUTE_LARGE_BATCH != null) {
-      try {
-        // Call Statement.executeLargeBatch
-        return (long[]) EXECUTE_LARGE_BATCH.invokeExact();
-      } catch (UnsupportedOperationException e) {
-        // ignore, and fall through to call Statement.executeBatch
-      } catch (Error | RuntimeException | SQLException e) {
-        throw e;
-      } catch (Throwable e) {
-        throw new RuntimeException(e);
-      }
-    }
-    return toLongs(statement.executeBatch());
-  }
-
-  /** Generates a string that is unique in the execution of the JVM.
-   * It is used by tests to ensure that they create distinct temporary tables.
-   * The strings are never thrown away, so don't put too much in there!
-   * Thread safe. */
-  public static String unique(String base) {
-    synchronized (UNIQUE_STRINGS) {
-      String s = base;
-      while (!UNIQUE_STRINGS.add(s)) {
-        s = base + "_" + UNIQUE_STRINGS.size();
-      }
-      return s;
-    }
-  }
-
-  /** Converts a {@code long} to {@code int}, rounding as little as possible
-   * if the value is outside the legal range for an {@code int}. */
-  public static int toSaturatedInt(long value) {
-    if (value > Integer.MAX_VALUE) {
-      return Integer.MAX_VALUE;
-    }
-    if (value < Integer.MIN_VALUE) {
-      return Integer.MIN_VALUE;
-    }
-    return (int) value;
-  }
-
-  /**
-   * Converts an array of {@code long} values to an array of {@code int}
-   * values, truncating values outside the legal range for an {@code int}
-   * to {@link Integer#MIN_VALUE} or {@link Integer#MAX_VALUE}.
-   *
-   * @param longs An array of {@code long}s
-   * @return An array of {@code int}s
-   */
-  public static int[] toSaturatedInts(long[] longs) {
-    final int[] ints = new int[longs.length];
-    for (int i = 0; i < longs.length; i++) {
-      ints[i] = toSaturatedInt(longs[i]);
-    }
-    return ints;
-  }
-
-  /** Converts an array of {@code int} values to an array of {@code long}
-   * values. */
-  public static long[] toLongs(int[] ints) {
-    final long[] longs = new long[ints.length];
-    for (int i = 0; i < ints.length; i++) {
-      longs[i] = ints[i];
-    }
-    return longs;
-  }
-}
-
-// End AvaticaUtils.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/BuiltInConnectionProperty.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/BuiltInConnectionProperty.java b/avatica/core/src/main/java/org/apache/calcite/avatica/BuiltInConnectionProperty.java
deleted file mode 100644
index d68bae8..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/BuiltInConnectionProperty.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import org.apache.calcite.avatica.remote.AvaticaHttpClientFactoryImpl;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-import static org.apache.calcite.avatica.ConnectionConfigImpl.PropEnv;
-import static org.apache.calcite.avatica.ConnectionConfigImpl.parse;
-
-/**
- * Enumeration of Avatica's built-in connection properties.
- */
-public enum BuiltInConnectionProperty implements ConnectionProperty {
-  /** Factory. */
-  FACTORY("factory", Type.PLUGIN, null, false),
-
-  /** Name of initial schema. */
-  SCHEMA("schema", Type.STRING, null, false),
-
-  /** Time zone, for example 'gmt-3'. Default is the JVM's time zone. */
-  TIME_ZONE("timeZone", Type.STRING, null, false),
-
-  /** Remote URL. */
-  URL("url", Type.STRING, null, false),
-
-  /** Serialization used over remote connections */
-  SERIALIZATION("serialization", Type.STRING, "json", false),
-
-  /** The type of authentication to be used */
-  AUTHENTICATION("authentication", Type.STRING, null, false),
-
-  /** Avatica-based authentication user name */
-  AVATICA_USER("avatica_user", Type.STRING, null, false),
-
-  /** Avatica-based authentication password */
-  AVATICA_PASSWORD("avatica_password", Type.STRING, null, false),
-
-  /** Factory for constructing http clients. */
-  HTTP_CLIENT_FACTORY("httpclient_factory", Type.PLUGIN,
-      AvaticaHttpClientFactoryImpl.class.getName(), false),
-
-  /** HttpClient implementation class name. */
-  HTTP_CLIENT_IMPL("httpclient_impl", Type.STRING, null, false),
-
-  /** Principal to use to perform Kerberos login. */
-  PRINCIPAL("principal", Type.STRING, null, false),
-
-  /** Keytab to use to perform Kerberos login. */
-  KEYTAB("keytab", Type.STRING, null, false),
-
-  /** Truststore for SSL/TLS communication */
-  TRUSTSTORE("truststore", Type.STRING, null, false),
-
-  /** Password for the truststore */
-  TRUSTSTORE_PASSWORD("truststore_password", Type.STRING, null, false);
-
-  private final String camelName;
-  private final Type type;
-  private final Object defaultValue;
-  private Class valueClass;
-  private final boolean required;
-
-  /** Deprecated; use {@link #TIME_ZONE}. */
-  @Deprecated // to be removed before 2.0
-  public static final BuiltInConnectionProperty TIMEZONE = TIME_ZONE;
-
-  private static final Map<String, BuiltInConnectionProperty> NAME_TO_PROPS;
-  private static final Set<String> LOCAL_PROPS;
-
-  static {
-    NAME_TO_PROPS = new HashMap<>();
-    for (BuiltInConnectionProperty p : BuiltInConnectionProperty.values()) {
-      NAME_TO_PROPS.put(p.camelName.toUpperCase(Locale.ROOT), p);
-      NAME_TO_PROPS.put(p.name(), p);
-    }
-
-    LOCAL_PROPS = new HashSet<>();
-    for (BuiltInConnectionProperty p : BuiltInConnectionProperty.values()) {
-      LOCAL_PROPS.add(p.camelName());
-    }
-  }
-
-  BuiltInConnectionProperty(String camelName, Type type, Object defaultValue,
-      boolean required) {
-    this(camelName, type, defaultValue, type.defaultValueClass(), required);
-  }
-
-  BuiltInConnectionProperty(String camelName, Type type, Object defaultValue,
-      Class valueClass, boolean required) {
-    this.camelName = camelName;
-    this.type = type;
-    this.defaultValue = defaultValue;
-    this.valueClass = valueClass;
-    this.required = required;
-    assert type.valid(defaultValue, valueClass);
-  }
-
-  public String camelName() {
-    return camelName;
-  }
-
-  public Object defaultValue() {
-    return defaultValue;
-  }
-
-  public Type type() {
-    return type;
-  }
-
-  public boolean required() {
-    return required;
-  }
-
-  public Class valueClass() {
-    return valueClass;
-  }
-
-  public PropEnv wrap(Properties properties) {
-    return new PropEnv(parse(properties, NAME_TO_PROPS), this);
-  }
-
-  /**
-   * Checks if the given property only applicable to the remote driver (should not be sent to the
-   * Avatica server).
-   *
-   * @param propertyName Name of the property
-   * @return True if the property denoted by the given name is only relevant locally, otherwise
-   *    false.
-   */
-  public static boolean isLocalProperty(Object propertyName) {
-    return LOCAL_PROPS.contains(propertyName);
-  }
-}
-
-// End BuiltInConnectionProperty.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/ColumnMetaData.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/ColumnMetaData.java b/avatica/core/src/main/java/org/apache/calcite/avatica/ColumnMetaData.java
deleted file mode 100644
index 401070e..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/ColumnMetaData.java
+++ /dev/null
@@ -1,599 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import org.apache.calcite.avatica.proto.Common;
-import org.apache.calcite.avatica.util.ByteString;
-
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonSubTypes;
-import com.fasterxml.jackson.annotation.JsonTypeInfo;
-import com.google.protobuf.Descriptors.FieldDescriptor;
-
-import java.lang.reflect.Type;
-import java.sql.Array;
-import java.sql.DatabaseMetaData;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Struct;
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.sql.Types;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-
-/**
- * Metadata for a column.
- *
- * <p>(Compare with {@link java.sql.ResultSetMetaData}.)
- */
-public class ColumnMetaData {
-  private static final FieldDescriptor CATALOG_NAME_DESCRIPTOR = Common.ColumnMetaData
-      .getDescriptor().findFieldByNumber(Common.ColumnMetaData.CATALOG_NAME_FIELD_NUMBER);
-  private static final FieldDescriptor SCHEMA_NAME_DESCRIPTOR = Common.ColumnMetaData
-      .getDescriptor().findFieldByNumber(Common.ColumnMetaData.SCHEMA_NAME_FIELD_NUMBER);
-  private static final FieldDescriptor LABEL_DESCRIPTOR = Common.ColumnMetaData
-      .getDescriptor().findFieldByNumber(Common.ColumnMetaData.LABEL_FIELD_NUMBER);
-  private static final FieldDescriptor COLUMN_NAME_DESCRIPTOR = Common.ColumnMetaData
-      .getDescriptor().findFieldByNumber(Common.ColumnMetaData.COLUMN_NAME_FIELD_NUMBER);
-  private static final FieldDescriptor TABLE_NAME_DESCRIPTOR = Common.ColumnMetaData
-      .getDescriptor().findFieldByNumber(Common.ColumnMetaData.TABLE_NAME_FIELD_NUMBER);
-  private static final FieldDescriptor COLUMN_CLASS_NAME_DESCRIPTOR = Common.ColumnMetaData
-      .getDescriptor().findFieldByNumber(Common.ColumnMetaData.COLUMN_CLASS_NAME_FIELD_NUMBER);
-
-  public final int ordinal; // 0-based
-  public final boolean autoIncrement;
-  public final boolean caseSensitive;
-  public final boolean searchable;
-  public final boolean currency;
-  public final int nullable;
-  public final boolean signed;
-  public final int displaySize;
-  public final String label;
-  public final String columnName;
-  public final String schemaName;
-  public final int precision;
-  public final int scale;
-  public final String tableName;
-  public final String catalogName;
-  public final boolean readOnly;
-  public final boolean writable;
-  public final boolean definitelyWritable;
-  public final String columnClassName;
-  public final AvaticaType type;
-
-  @JsonCreator
-  public ColumnMetaData(
-      @JsonProperty("ordinal") int ordinal,
-      @JsonProperty("autoIncrement") boolean autoIncrement,
-      @JsonProperty("caseSensitive") boolean caseSensitive,
-      @JsonProperty("searchable") boolean searchable,
-      @JsonProperty("currency") boolean currency,
-      @JsonProperty("nullable") int nullable,
-      @JsonProperty("signed") boolean signed,
-      @JsonProperty("displaySize") int displaySize,
-      @JsonProperty("label") String label,
-      @JsonProperty("columnName") String columnName,
-      @JsonProperty("schemaName") String schemaName,
-      @JsonProperty("precision") int precision,
-      @JsonProperty("scale") int scale,
-      @JsonProperty("tableName") String tableName,
-      @JsonProperty("catalogName") String catalogName,
-      @JsonProperty("type") AvaticaType type,
-      @JsonProperty("readOnly") boolean readOnly,
-      @JsonProperty("writable") boolean writable,
-      @JsonProperty("definitelyWritable") boolean definitelyWritable,
-      @JsonProperty("columnClassName") String columnClassName) {
-    this.ordinal = ordinal;
-    this.autoIncrement = autoIncrement;
-    this.caseSensitive = caseSensitive;
-    this.searchable = searchable;
-    this.currency = currency;
-    this.nullable = nullable;
-    this.signed = signed;
-    this.displaySize = displaySize;
-    this.label = label;
-    // Per the JDBC spec this should be just columnName.
-    // For example, the query
-    //     select 1 as x, c as y from t
-    // should give columns
-    //     (label=x, column=null, table=null)
-    //     (label=y, column=c table=t)
-    // But DbUnit requires every column to have a name. Duh.
-    this.columnName = first(columnName, label);
-    this.schemaName = schemaName;
-    this.precision = precision;
-    this.scale = scale;
-    this.tableName = tableName;
-    this.catalogName = catalogName;
-    this.type = type;
-    this.readOnly = readOnly;
-    this.writable = writable;
-    this.definitelyWritable = definitelyWritable;
-    this.columnClassName = columnClassName;
-  }
-
-  public Common.ColumnMetaData toProto() {
-    Common.ColumnMetaData.Builder builder = Common.ColumnMetaData.newBuilder();
-
-    // Primitive fields (can't be null)
-    builder.setOrdinal(ordinal)
-      .setAutoIncrement(autoIncrement)
-      .setCaseSensitive(caseSensitive)
-      .setSearchable(searchable)
-      .setCurrency(currency)
-      .setNullable(nullable)
-      .setSigned(signed)
-      .setDisplaySize(displaySize)
-      .setPrecision(precision)
-      .setScale(scale)
-      .setReadOnly(readOnly)
-      .setWritable(writable)
-      .setDefinitelyWritable(definitelyWritable);
-
-    // Potentially null fields
-    if (null != label) {
-      builder.setLabel(label);
-    }
-
-    if (null != columnName) {
-      builder.setColumnName(columnName);
-    }
-
-    if (null != schemaName) {
-      builder.setSchemaName(schemaName);
-    }
-
-    if (null != tableName) {
-      builder.setTableName(tableName);
-    }
-
-    if (null != catalogName) {
-      builder.setCatalogName(catalogName);
-    }
-
-    if (null != type) {
-      builder.setType(type.toProto());
-    }
-
-    if (null != columnClassName) {
-      builder.setColumnClassName(columnClassName);
-    }
-
-    return builder.build();
-  }
-
-  public static ColumnMetaData fromProto(Common.ColumnMetaData proto) {
-    AvaticaType nestedType = AvaticaType.fromProto(proto.getType());
-
-    String catalogName = null;
-    if (proto.hasField(CATALOG_NAME_DESCRIPTOR)) {
-      catalogName = proto.getCatalogName();
-    }
-
-    String schemaName = null;
-    if (proto.hasField(SCHEMA_NAME_DESCRIPTOR)) {
-      schemaName = proto.getSchemaName();
-    }
-
-    String label = null;
-    if (proto.hasField(LABEL_DESCRIPTOR)) {
-      label = proto.getLabel();
-    }
-
-    String columnName = null;
-    if (proto.hasField(COLUMN_NAME_DESCRIPTOR)) {
-      columnName = proto.getColumnName();
-    }
-
-    String tableName = null;
-    if (proto.hasField(TABLE_NAME_DESCRIPTOR)) {
-      tableName = proto.getTableName();
-    }
-
-    String columnClassName = null;
-    if (proto.hasField(COLUMN_CLASS_NAME_DESCRIPTOR)) {
-      columnClassName = proto.getColumnClassName();
-    }
-
-    // Recreate the ColumnMetaData
-    return new ColumnMetaData(proto.getOrdinal(), proto.getAutoIncrement(),
-        proto.getCaseSensitive(), proto.getSearchable(), proto.getCurrency(), proto.getNullable(),
-        proto.getSigned(), proto.getDisplaySize(), label, columnName,
-        schemaName, proto.getPrecision(), proto.getScale(), tableName,
-        catalogName, nestedType, proto.getReadOnly(), proto.getWritable(),
-        proto.getDefinitelyWritable(), columnClassName);
-  }
-
-  @Override public int hashCode() {
-    return Objects.hash(autoIncrement, caseSensitive, catalogName,
-        columnClassName, columnName, currency, definitelyWritable, displaySize,
-        label, nullable, ordinal, precision, readOnly, scale, schemaName,
-        searchable, signed, tableName, type, writable);
-  }
-
-  @Override public boolean equals(Object o) {
-    return o == this
-        || o instanceof ColumnMetaData
-        && autoIncrement == ((ColumnMetaData) o).autoIncrement
-        && caseSensitive == ((ColumnMetaData) o).caseSensitive
-        && Objects.equals(catalogName, ((ColumnMetaData) o).catalogName)
-        && Objects.equals(columnClassName, ((ColumnMetaData) o).columnClassName)
-        && Objects.equals(columnName, ((ColumnMetaData) o).columnName)
-        && currency == ((ColumnMetaData) o).currency
-        && definitelyWritable == ((ColumnMetaData) o).definitelyWritable
-        && displaySize == ((ColumnMetaData) o).displaySize
-        && Objects.equals(label, ((ColumnMetaData) o).label)
-        && nullable == ((ColumnMetaData) o).nullable
-        && ordinal == ((ColumnMetaData) o).ordinal
-        && precision == ((ColumnMetaData) o).precision
-        && readOnly == ((ColumnMetaData) o).readOnly
-        && scale == ((ColumnMetaData) o).scale
-        && Objects.equals(schemaName, ((ColumnMetaData) o).schemaName)
-        && searchable == ((ColumnMetaData) o).searchable
-        && signed == ((ColumnMetaData) o).signed
-        && Objects.equals(tableName, ((ColumnMetaData) o).tableName)
-        && Objects.equals(type, ((ColumnMetaData) o).type)
-        && writable == ((ColumnMetaData) o).writable;
-  }
-
-  private static <T> T first(T t0, T t1) {
-    return t0 != null ? t0 : t1;
-  }
-
-  /** Creates a {@link ScalarType}. */
-  public static ScalarType scalar(int type, String typeName, Rep rep) {
-    return new ScalarType(type, typeName, rep);
-  }
-
-  /** Creates a {@link StructType}. */
-  public static StructType struct(List<ColumnMetaData> columns) {
-    return new StructType(columns);
-  }
-
-  /** Creates an {@link ArrayType}. */
-  public static ArrayType array(AvaticaType componentType, String typeName,
-      Rep rep) {
-    return new ArrayType(Types.ARRAY, typeName, rep, componentType);
-  }
-
-  /** Creates a ColumnMetaData for result sets that are not based on a struct
-   * but need to have a single 'field' for purposes of
-   * {@link java.sql.ResultSetMetaData}. */
-  public static ColumnMetaData dummy(AvaticaType type, boolean nullable) {
-    return new ColumnMetaData(
-        0,
-        false,
-        true,
-        false,
-        false,
-        nullable
-            ? DatabaseMetaData.columnNullable
-            : DatabaseMetaData.columnNoNulls,
-        true,
-        -1,
-        null,
-        null,
-        null,
-        -1,
-        -1,
-        null,
-        null,
-        type,
-        true,
-        false,
-        false,
-        type.columnClassName());
-  }
-
-  public ColumnMetaData setRep(Rep rep) {
-    return new ColumnMetaData(ordinal, autoIncrement, caseSensitive, searchable,
-        currency, nullable, signed, displaySize, label, columnName, schemaName,
-        precision, scale, tableName, catalogName, type.setRep(rep), readOnly,
-        writable, definitelyWritable, columnClassName);
-  }
-
-  /** Description of the type used to internally represent a value. For example,
-   * a {@link java.sql.Date} might be represented as a {@link #PRIMITIVE_INT}
-   * if not nullable, or a {@link #JAVA_SQL_DATE}. */
-  public enum Rep {
-    PRIMITIVE_BOOLEAN(boolean.class),
-    PRIMITIVE_BYTE(byte.class),
-    PRIMITIVE_CHAR(char.class),
-    PRIMITIVE_SHORT(short.class),
-    PRIMITIVE_INT(int.class),
-    PRIMITIVE_LONG(long.class),
-    PRIMITIVE_FLOAT(float.class),
-    PRIMITIVE_DOUBLE(double.class),
-    BOOLEAN(Boolean.class),
-    BYTE(Byte.class),
-    CHARACTER(Character.class),
-    SHORT(Short.class),
-    INTEGER(Integer.class),
-    LONG(Long.class),
-    FLOAT(Float.class),
-    DOUBLE(Double.class),
-    JAVA_SQL_TIME(Time.class),
-    JAVA_SQL_TIMESTAMP(Timestamp.class),
-    JAVA_SQL_DATE(java.sql.Date.class),
-    JAVA_UTIL_DATE(java.util.Date.class),
-    BYTE_STRING(ByteString.class),
-    STRING(String.class),
-
-    /** Values are represented as some sub-class of {@link Number}.
-     * The JSON encoding does this. */
-    NUMBER(Number.class),
-
-    ARRAY(Array.class),
-    MULTISET(List.class),
-    STRUCT(Struct.class),
-
-    OBJECT(Object.class);
-
-    public final Class clazz;
-
-    public static final Map<Class, Rep> VALUE_MAP;
-
-    static {
-      Map<Class, Rep> builder = new HashMap<>();
-      for (Rep rep : values()) {
-        builder.put(rep.clazz, rep);
-      }
-      VALUE_MAP = Collections.unmodifiableMap(builder);
-    }
-
-    Rep(Class clazz) {
-      this.clazz = clazz;
-    }
-
-    public static Rep of(Type clazz) {
-      //noinspection SuspiciousMethodCalls
-      final Rep rep = VALUE_MAP.get(clazz);
-      return rep != null ? rep : OBJECT;
-    }
-
-    /** Returns the value of a column of this type from a result set. */
-    public Object jdbcGet(ResultSet resultSet, int i) throws SQLException {
-      switch (this) {
-      case PRIMITIVE_BOOLEAN:
-        return resultSet.getBoolean(i);
-      case PRIMITIVE_BYTE:
-        return resultSet.getByte(i);
-      case PRIMITIVE_SHORT:
-        return resultSet.getShort(i);
-      case PRIMITIVE_INT:
-        return resultSet.getInt(i);
-      case PRIMITIVE_LONG:
-        return resultSet.getLong(i);
-      case PRIMITIVE_FLOAT:
-        return resultSet.getFloat(i);
-      case PRIMITIVE_DOUBLE:
-        return resultSet.getDouble(i);
-      case BOOLEAN:
-        final boolean aBoolean = resultSet.getBoolean(i);
-        return resultSet.wasNull() ? null : aBoolean;
-      case BYTE:
-        final byte aByte = resultSet.getByte(i);
-        return resultSet.wasNull() ? null : aByte;
-      case SHORT:
-        final short aShort = resultSet.getShort(i);
-        return resultSet.wasNull() ? null : aShort;
-      case INTEGER:
-        final int anInt = resultSet.getInt(i);
-        return resultSet.wasNull() ? null : anInt;
-      case LONG:
-        final long aLong = resultSet.getLong(i);
-        return resultSet.wasNull() ? null : aLong;
-      case FLOAT:
-        final float aFloat = resultSet.getFloat(i);
-        return resultSet.wasNull() ? null : aFloat;
-      case DOUBLE:
-        final double aDouble = resultSet.getDouble(i);
-        return resultSet.wasNull() ? null : aDouble;
-      case JAVA_SQL_DATE:
-        return resultSet.getDate(i);
-      case JAVA_SQL_TIME:
-        return resultSet.getTime(i);
-      case JAVA_SQL_TIMESTAMP:
-        return resultSet.getTimestamp(i);
-      case ARRAY:
-        return resultSet.getArray(i);
-      case STRUCT:
-        return resultSet.getObject(i, Struct.class);
-      default:
-        return resultSet.getObject(i);
-      }
-    }
-
-    public Common.Rep toProto() {
-      return Common.Rep.valueOf(name());
-    }
-
-    public static Rep fromProto(Common.Rep proto) {
-      if (Common.Rep.BIG_DECIMAL == proto) {
-        // BIG_DECIMAL has to come back as a NUMBER
-        return Rep.NUMBER;
-      } else if (Common.Rep.NULL == proto) {
-        return Rep.OBJECT;
-      }
-      return Rep.valueOf(proto.name());
-    }
-  }
-
-  /** Base class for a column type. */
-  @JsonTypeInfo(
-      use = JsonTypeInfo.Id.NAME,
-      property = "type",
-      defaultImpl = ScalarType.class)
-  @JsonSubTypes({
-      @JsonSubTypes.Type(value = ScalarType.class, name = "scalar"),
-      @JsonSubTypes.Type(value = StructType.class, name = "struct"),
-      @JsonSubTypes.Type(value = ArrayType.class, name = "array") })
-  public static class AvaticaType {
-    public final int id;
-    public final String name;
-
-    /** The type of the field that holds the value. Not a JDBC property. */
-    public final Rep rep;
-
-    public AvaticaType(int id, String name, Rep rep) {
-      this.id = id;
-      this.name = Objects.requireNonNull(name);
-      this.rep = Objects.requireNonNull(rep);
-    }
-
-    public String columnClassName() {
-      return SqlType.valueOf(id).boxedClass().getName();
-    }
-
-    public AvaticaType setRep(Rep rep) {
-      throw new UnsupportedOperationException();
-    }
-
-    public Common.AvaticaType toProto() {
-      Common.AvaticaType.Builder builder = Common.AvaticaType.newBuilder();
-
-      builder.setName(name);
-      builder.setId(id);
-      builder.setRep(rep.toProto());
-
-      return builder.build();
-    }
-
-    public static AvaticaType fromProto(Common.AvaticaType proto) {
-      Common.Rep repProto = proto.getRep();
-      Rep rep = Rep.valueOf(repProto.name());
-      AvaticaType type;
-
-      if (proto.hasComponent()) {
-        // ArrayType
-        // recurse on the type for the array elements
-        AvaticaType nestedType = AvaticaType.fromProto(proto.getComponent());
-        type = ColumnMetaData.array(nestedType, proto.getName(), rep);
-      } else if (proto.getColumnsCount() > 0) {
-        // StructType
-        List<ColumnMetaData> columns = new ArrayList<>(proto.getColumnsCount());
-        for (Common.ColumnMetaData protoColumn : proto.getColumnsList()) {
-          columns.add(ColumnMetaData.fromProto(protoColumn));
-        }
-        type = ColumnMetaData.struct(columns);
-      } else {
-        // ScalarType
-        type = ColumnMetaData.scalar(proto.getId(), proto.getName(), rep);
-      }
-
-      return type;
-    }
-
-    @Override public int hashCode() {
-      return Objects.hash(id, name, rep);
-    }
-
-    @Override public boolean equals(Object o) {
-      return o == this
-          || o instanceof AvaticaType
-          && id == ((AvaticaType) o).id
-          && Objects.equals(name, ((AvaticaType) o).name)
-          && rep == ((AvaticaType) o).rep;
-    }
-  }
-
-  /** Scalar type. */
-  public static class ScalarType extends AvaticaType {
-    @JsonCreator
-    public ScalarType(@JsonProperty("id") int id,
-        @JsonProperty("name") String name,
-        @JsonProperty("rep") Rep rep) {
-      super(id, name, rep);
-    }
-
-    @Override public AvaticaType setRep(Rep rep) {
-      return new ScalarType(id, name, rep);
-    }
-  }
-
-  /** Record type. */
-  public static class StructType extends AvaticaType {
-    public final List<ColumnMetaData> columns;
-
-    @JsonCreator
-    public StructType(List<ColumnMetaData> columns) {
-      super(Types.STRUCT, "STRUCT", ColumnMetaData.Rep.OBJECT);
-      this.columns = columns;
-    }
-
-    @Override public Common.AvaticaType toProto() {
-      Common.AvaticaType.Builder builder = Common.AvaticaType.newBuilder(super.toProto());
-      for (ColumnMetaData valueType : columns) {
-        builder.addColumns(valueType.toProto());
-      }
-      return builder.build();
-    }
-
-    @Override public int hashCode() {
-      return Objects.hash(id, name, rep, columns);
-    }
-
-    @Override public boolean equals(Object o) {
-      return o == this
-          || o instanceof StructType
-          && super.equals(o)
-          && Objects.equals(columns, ((StructType) o).columns);
-    }
-  }
-
-  /** Array type. */
-  public static class ArrayType extends AvaticaType {
-    public final AvaticaType component;
-
-    /**
-     * Not for public use. Use {@link ColumnMetaData#array(AvaticaType, String, Rep)}.
-     */
-    @JsonCreator
-    public ArrayType(@JsonProperty("type") int type, @JsonProperty("name") String typeName,
-        @JsonProperty("rep") Rep representation, @JsonProperty("component") AvaticaType component) {
-      super(type, typeName, representation);
-      this.component = component;
-    }
-
-    @Override public Common.AvaticaType toProto() {
-      Common.AvaticaType.Builder builder = Common.AvaticaType.newBuilder(super.toProto());
-
-      builder.setComponent(component.toProto());
-
-      return builder.build();
-    }
-
-    @Override public int hashCode() {
-      return Objects.hash(id, name, rep, component);
-    }
-
-    @Override public boolean equals(Object o) {
-      return o == this
-          || o instanceof ArrayType
-          && super.equals(o)
-          && Objects.equals(component, ((ArrayType) o).component);
-    }
-  }
-}
-
-// End ColumnMetaData.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/ConnectStringParser.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/ConnectStringParser.java b/avatica/core/src/main/java/org/apache/calcite/avatica/ConnectStringParser.java
deleted file mode 100644
index 9efbcf1..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/ConnectStringParser.java
+++ /dev/null
@@ -1,394 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import java.sql.SQLException;
-import java.util.Map;
-import java.util.Properties;
-
-/**
- * ConnectStringParser is a utility class that parses or creates a JDBC connect
- * string according to the
- * <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/ms722656(v=vs.85).aspx">
- * OLE DB Connection String Syntax</a>.
- *
- * <p>This code was adapted from Mondrian's mondrian.olap.Util class.
- * The primary differences between this and its Mondrian progenitor are:
- *
- * <ul>
- * <li>use of regular {@link Properties} for compatibility with the JDBC API
- * (replaces Mondrian's use of its own order-preserving and case-insensitive
- * PropertyList)</li>
- *
- * <li>ability to pass to {@link #parse} a pre-existing Properties object into
- * which properties are to be parsed, possibly overriding prior values</li>
- *
- * <li>use of {@link SQLException}s rather than unchecked
- * {@link RuntimeException}s</li>
- *
- * <li>static members for parsing and creating connect strings</li>
- *
- * </ul>
- *
- * <p>ConnectStringParser has a private constructor. Callers use the static
- * members:
- *
- * <dl>
- * <dt>{@link #parse(String)}
- * <dd>Parses the connect string into a new Properties object.
- *
- * <dt>{@link #parse(String, Properties)}
- * <dd>Parses the connect string into an existing Properties object.
- *
- * <dt>{@link #getParamString(Properties)}
- * <dd>Returns a param string, quoted and escaped as needed, to represent the
- * supplied name-value pairs.
- * </dl>
- */
-public class ConnectStringParser {
-  //~ Instance fields --------------------------------------------------------
-
-  private final String s;
-  private final int n;
-  private int i;
-  private final StringBuilder nameBuf = new StringBuilder();
-  private final StringBuilder valueBuf = new StringBuilder();
-
-  //~ Constructors -----------------------------------------------------------
-
-  /**
-   * Creates a new connect string parser.
-   *
-   * @param s connect string to parse
-   *
-   * @see #parse(String)
-   * @see #parse(String, Properties)
-   */
-  private ConnectStringParser(String s) {
-    this.s = s;
-    this.i = 0;
-    this.n = s.length();
-  }
-
-  //~ Methods ----------------------------------------------------------------
-
-  /**
-   * Parses the connect string into a new Properties object.
-   *
-   * @param s connect string to parse
-   *
-   * @return properties object with parsed params
-   *
-   * @throws SQLException error parsing name-value pairs
-   */
-  public static Properties parse(String s)
-      throws SQLException {
-    return new ConnectStringParser(s).parseInternal(null);
-  }
-
-  /**
-   * Parses the connect string into an existing Properties object.
-   *
-   * @param s connect string to parse
-   * @param props optional properties object, may be <code>null</code>
-   *
-   * @return properties object with parsed params; if an input <code>
-   * props</code> was supplied, any duplicate properties will have been
-   * replaced by those from the connect string.
-   *
-   * @throws SQLException error parsing name-value pairs
-   */
-  public static Properties parse(String s, Properties props)
-      throws SQLException {
-    return new ConnectStringParser(s).parseInternal(props);
-  }
-
-  /**
-   * Parses the connect string into a Properties object. Note that the string
-   * can only be parsed once. Subsequent calls return empty/unchanged
-   * Properties. The original <code>props</code> argument is not altered.
-   *
-   * @param props optional properties object, may be <code>null</code>
-   *
-   * @return properties object with parsed params; if an input <code>
-   * props</code> was supplied, any duplicate properties will have been
-   * replaced by those from the connect string.
-   *
-   * @throws SQLException error parsing name-value pairs
-   */
-  Properties parseInternal(final Properties props)
-      throws SQLException {
-    final Properties newProps;
-    if (props == null) {
-      newProps = new Properties();
-    } else {
-      newProps = (Properties) props.clone();
-    }
-    while (i < n) {
-      parsePair(newProps);
-    }
-    return newProps;
-  }
-
-  /**
-   * Reads "name=value;" or "name=value&lt;EOF&gt;".
-   *
-   * @throws SQLException error parsing value
-   */
-  void parsePair(Properties props)
-      throws SQLException {
-    String name = parseName();
-    String value;
-    if (i >= n) {
-      value = "";
-    } else if (s.charAt(i) == ';') {
-      i++;
-      value = "";
-    } else {
-      value = parseValue();
-    }
-    props.put(name, value);
-  }
-
-  /**
-   * Reads "name=". Name can contain equals sign if equals sign is doubled.
-   */
-  String parseName() {
-    nameBuf.setLength(0);
-    while (true) {
-      char c = s.charAt(i);
-      switch (c) {
-      case '=':
-        i++;
-        if ((i < n) && ((c = s.charAt(i)) == '=')) {
-          // doubled equals sign; take one of them, and carry on
-          i++;
-          nameBuf.append(c);
-          break;
-        }
-        String name = nameBuf.toString();
-        name = name.trim();
-        return name;
-      case ' ':
-        if (nameBuf.length() == 0) {
-          // ignore preceding spaces
-          i++;
-          break;
-        }
-        // fall through
-      default:
-        nameBuf.append(c);
-        i++;
-        if (i >= n) {
-          return nameBuf.toString().trim();
-        }
-      }
-    }
-  }
-
-  /**
-   * Reads "value;" or "value&lt;EOF&gt;"
-   *
-   * @throws SQLException if find an unterminated quoted value
-   */
-  String parseValue()
-      throws SQLException {
-    char c;
-
-    // skip over leading white space
-    while ((c = s.charAt(i)) == ' ') {
-      i++;
-      if (i >= n) {
-        return "";
-      }
-    }
-    if ((c == '"') || (c == '\'')) {
-      String value = parseQuoted(c);
-
-      // skip over trailing white space
-      while (i < n && s.charAt(i) == ' ') {
-        i++;
-      }
-      if (i >= n) {
-        return value;
-      } else if (s.charAt(i) == ';') {
-        i++;
-        return value;
-      } else {
-        throw new SQLException(
-            "quoted value ended too soon, at position " + i
-                + " in '" + s + "'");
-      }
-    } else {
-      String value;
-      int semi = s.indexOf(';', i);
-      if (semi >= 0) {
-        value = s.substring(i, semi);
-        i = semi + 1;
-      } else {
-        value = s.substring(i);
-        i = n;
-      }
-      return value.trim();
-    }
-  }
-
-  /**
-   * Reads a string quoted by a given character. Occurrences of the quoting
-   * character must be doubled. For example, <code>parseQuoted('"')</code>
-   * reads <code>"a ""new"" string"</code> and returns <code>a "new"
-   * string</code>.
-   *
-   * @throws SQLException if find an unterminated quoted value
-   */
-  String parseQuoted(char q)
-      throws SQLException {
-    char c = s.charAt(i++);
-    if (c != q) {
-      throw new AssertionError("c != q: c=" + c + " q=" + q);
-    }
-    valueBuf.setLength(0);
-    while (i < n) {
-      c = s.charAt(i);
-      if (c == q) {
-        i++;
-        if (i < n) {
-          c = s.charAt(i);
-          if (c == q) {
-            valueBuf.append(c);
-            i++;
-            continue;
-          }
-        }
-        return valueBuf.toString();
-      } else {
-        valueBuf.append(c);
-        i++;
-      }
-    }
-    throw new SQLException(
-        "Connect string '" + s
-            + "' contains unterminated quoted value '"
-            + valueBuf.toString() + "'");
-  }
-
-  /**
-   * Returns a param string, quoted and escaped as needed, to represent the
-   * supplied name-value pairs.
-   *
-   * @param props name-value pairs
-   *
-   * @return param string, never <code>null</code>
-   */
-  public static String getParamString(Properties props) {
-    if (props == null) {
-      return "";
-    }
-
-    StringBuilder buf = new StringBuilder();
-    for (Map.Entry<String, String> entry : toMap(props).entrySet()) {
-      final String name = entry.getKey();
-      final String value = entry.getValue();
-      String quote = "";
-      if (buf.length() > 0) {
-        buf.append(';');
-      }
-
-      // write parameter name
-      if (name.startsWith(" ") || name.endsWith(" ")) {
-        quote = "'";
-        buf.append(quote);
-      }
-      int len = name.length();
-      for (int i = 0; i < len; ++i) {
-        char c = name.charAt(i);
-        if (c == '=') {
-          buf.append('=');
-        }
-        buf.append(c);
-      }
-
-      buf.append(quote); // might be empty
-      quote = "";
-
-      buf.append('=');
-
-      // write parameter value
-      len = value.length();
-      boolean hasSemi = value.indexOf(';') >= 0;
-      boolean hasSQ = value.indexOf('\'') >= 0;
-      boolean hasDQ = value.indexOf('"') >= 0;
-      if (value.startsWith(" ") || value.endsWith(" ")) {
-        quote = "'";
-      } else if (hasSemi || hasSQ || hasDQ) {
-        // try to choose the least painful quote
-        if (value.startsWith("\"")) {
-          quote = "'";
-        } else if (value.startsWith("'")) {
-          quote = "\"";
-        } else {
-          quote = hasSQ ? "\"" : "'";
-        }
-      }
-      char q;
-      if (quote.length() > 0) {
-        buf.append(quote);
-        q = quote.charAt(0);
-      } else {
-        q = '\0';
-      }
-      for (int i = 0; i < len; ++i) {
-        char c = value.charAt(i);
-        if (c == q) {
-          buf.append(q);
-        }
-        buf.append(c);
-      }
-      buf.append(quote); // might be empty
-    }
-
-    return buf.toString();
-  }
-
-  /**
-   * Converts a {@link Properties} object to a <code>{@link Map}&lt;String,
-   * String&gt;</code>.
-   *
-   * <p>This is necessary because {@link Properties} is a dinosaur class. It
-   * ought to extend <code>Map&lt;String,String&gt;</code>, but instead
-   * extends <code>{@link java.util.Hashtable}&lt;Object,Object&gt;</code>.
-   *
-   * <p>Typical usage, to iterate over a {@link Properties}:
-   *
-   * <blockquote>
-   * <code>
-   * Properties properties;<br>
-   * for (Map.Entry&lt;String, String&gt; entry =
-   * Util.toMap(properties).entrySet()) {<br>
-   *   println("key=" + entry.getKey() + ", value=" + entry.getValue());<br>
-   * }
-   * </code>
-   * </blockquote>
-   */
-  public static Map<String, String> toMap(
-      final Properties properties) {
-    //noinspection unchecked
-    return (Map) properties;
-  }
-}
-
-// End ConnectStringParser.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/ConnectionConfig.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/ConnectionConfig.java b/avatica/core/src/main/java/org/apache/calcite/avatica/ConnectionConfig.java
deleted file mode 100644
index e8ff0be..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/ConnectionConfig.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import org.apache.calcite.avatica.remote.AvaticaHttpClientFactory;
-import org.apache.calcite.avatica.remote.Service;
-
-import java.io.File;
-
-/**
- * Connection configuration.
- */
-public interface ConnectionConfig {
-  /** @see BuiltInConnectionProperty#SCHEMA */
-  String schema();
-  /** @see BuiltInConnectionProperty#TIME_ZONE */
-  String timeZone();
-  /** @see BuiltInConnectionProperty#FACTORY */
-  Service.Factory factory();
-  /** @see BuiltInConnectionProperty#URL */
-  String url();
-  /** @see BuiltInConnectionProperty#SERIALIZATION */
-  String serialization();
-  /** @see BuiltInConnectionProperty#AUTHENTICATION */
-  String authentication();
-  /** @see BuiltInConnectionProperty#AVATICA_USER */
-  String avaticaUser();
-  /** @see BuiltInConnectionProperty#AVATICA_PASSWORD */
-  String avaticaPassword();
-  /** @see BuiltInConnectionProperty#HTTP_CLIENT_FACTORY */
-  AvaticaHttpClientFactory httpClientFactory();
-  /** @see BuiltInConnectionProperty#HTTP_CLIENT_IMPL */
-  String httpClientClass();
-  /** @see BuiltInConnectionProperty#PRINCIPAL */
-  String kerberosPrincipal();
-  /** @see BuiltInConnectionProperty#KEYTAB */
-  File kerberosKeytab();
-  /** @see BuiltInConnectionProperty#TRUSTSTORE */
-  File truststore();
-  /** @see BuiltInConnectionProperty#TRUSTSTORE_PASSWORD */
-  String truststorePassword();
-}
-
-// End ConnectionConfig.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/ConnectionConfigImpl.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/ConnectionConfigImpl.java b/avatica/core/src/main/java/org/apache/calcite/avatica/ConnectionConfigImpl.java
deleted file mode 100644
index a003b82..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/ConnectionConfigImpl.java
+++ /dev/null
@@ -1,374 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import org.apache.calcite.avatica.remote.AvaticaHttpClientFactory;
-import org.apache.calcite.avatica.remote.Service;
-
-import java.io.File;
-import java.math.BigDecimal;
-import java.util.LinkedHashMap;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Properties;
-
-/** Implementation of {@link ConnectionConfig}. */
-public class ConnectionConfigImpl implements ConnectionConfig {
-  protected final Properties properties;
-
-  public ConnectionConfigImpl(Properties properties) {
-    this.properties = properties;
-  }
-
-  public String schema() {
-    return BuiltInConnectionProperty.SCHEMA.wrap(properties).getString();
-  }
-
-  public String timeZone() {
-    return BuiltInConnectionProperty.TIME_ZONE.wrap(properties).getString();
-  }
-
-  public Service.Factory factory() {
-    return BuiltInConnectionProperty.FACTORY.wrap(properties)
-        .getPlugin(Service.Factory.class, null);
-  }
-
-  public String url() {
-    return BuiltInConnectionProperty.URL.wrap(properties).getString();
-  }
-
-  public String serialization() {
-    return BuiltInConnectionProperty.SERIALIZATION.wrap(properties).getString();
-  }
-
-  public String authentication() {
-    return BuiltInConnectionProperty.AUTHENTICATION.wrap(properties).getString();
-  }
-
-  public String avaticaUser() {
-    return BuiltInConnectionProperty.AVATICA_USER.wrap(properties).getString();
-  }
-
-  public String avaticaPassword() {
-    return BuiltInConnectionProperty.AVATICA_PASSWORD.wrap(properties).getString();
-  }
-
-  public AvaticaHttpClientFactory httpClientFactory() {
-    return BuiltInConnectionProperty.HTTP_CLIENT_FACTORY.wrap(properties)
-        .getPlugin(AvaticaHttpClientFactory.class, null);
-  }
-
-  public String httpClientClass() {
-    return BuiltInConnectionProperty.HTTP_CLIENT_IMPL.wrap(properties).getString();
-  }
-
-  public String kerberosPrincipal() {
-    return BuiltInConnectionProperty.PRINCIPAL.wrap(properties).getString();
-  }
-
-  public File kerberosKeytab() {
-    String keytabPath = BuiltInConnectionProperty.KEYTAB.wrap(properties).getString();
-    if (null == keytabPath) {
-      return null;
-    }
-    File keytab = new File(keytabPath);
-    if (!keytab.exists() || !keytab.isFile()) {
-      throw new RuntimeException("The " + BuiltInConnectionProperty.KEYTAB.name() + " does not "
-          + " reference a normal, existent file: " + keytabPath);
-    }
-    return keytab;
-  }
-
-  public File truststore() {
-    String filename = BuiltInConnectionProperty.TRUSTSTORE.wrap(properties).getString();
-    if (null == filename) {
-      return null;
-    }
-    return new File(filename);
-  }
-
-  public String truststorePassword() {
-    return BuiltInConnectionProperty.TRUSTSTORE_PASSWORD.wrap(properties).getString();
-  }
-
-  /** Converts a {@link Properties} object containing (name, value)
-   * pairs into a map whose keys are
-   * {@link org.apache.calcite.avatica.InternalProperty} objects.
-   *
-   * <p>Matching is case-insensitive. Throws if a property is not known.
-   * If a property occurs more than once, takes the last occurrence.</p>
-   *
-   * @param properties Properties
-   * @return Map
-   * @throws RuntimeException if a property is not known
-   */
-  public static Map<ConnectionProperty, String> parse(Properties properties,
-      Map<String, ? extends ConnectionProperty> nameToProps) {
-    final Map<ConnectionProperty, String> map =
-        new LinkedHashMap<ConnectionProperty, String>();
-    for (String name : properties.stringPropertyNames()) {
-      final ConnectionProperty connectionProperty =
-          nameToProps.get(name.toUpperCase(Locale.ROOT));
-      if (connectionProperty == null) {
-        // For now, don't throw. It messes up sub-projects.
-        //throw new RuntimeException("Unknown property '" + name + "'");
-        continue;
-      }
-      map.put(connectionProperty, properties.getProperty(name));
-    }
-    return map;
-  }
-
-  /** The combination of a property definition and a map of property values. */
-  public static class PropEnv {
-    final Map<? extends ConnectionProperty, String> map;
-    private final ConnectionProperty property;
-
-    public PropEnv(Map<? extends ConnectionProperty, String> map,
-        ConnectionProperty property) {
-      this.map = map;
-      this.property = property;
-    }
-
-    private <T> T get_(Converter<T> converter, String defaultValue) {
-      final String s = map.get(property);
-      if (s != null) {
-        return converter.apply(property, s);
-      }
-      return converter.apply(property, defaultValue);
-    }
-
-    private <T> T getDefaultNull(Converter<T> converter) {
-      final String s = map.get(property);
-      if (s != null) {
-        return converter.apply(property, s);
-      }
-      return null;
-    }
-
-    /** Returns the string value of this property, or null if not specified and
-     * no default. */
-    public String getString() {
-      return getString((String) property.defaultValue());
-    }
-
-    /** Returns the string value of this property, or null if not specified and
-     * no default. */
-    public String getString(String defaultValue) {
-      assert property.type() == ConnectionProperty.Type.STRING;
-      return get_(IDENTITY_CONVERTER, defaultValue);
-    }
-
-    /** Returns the int value of this property. Throws if not set and no
-     * default. */
-    public int getInt() {
-      return getInt((Number) property.defaultValue());
-    }
-
-    /** Returns the int value of this property. Throws if not set and no
-     * default. */
-    public int getInt(Number defaultValue) {
-      assert property.type() == ConnectionProperty.Type.NUMBER;
-      return get_(NUMBER_CONVERTER, defaultValue.toString()).intValue();
-    }
-
-    /** Returns the long value of this property. Throws if not set and no
-     * default. */
-    public long getLong() {
-      return getLong((Number) property.defaultValue());
-    }
-
-    /** Returns the long value of this property. Throws if not set and no
-     * default. */
-    public long getLong(Number defaultValue) {
-      assert property.type() == ConnectionProperty.Type.NUMBER;
-      return get_(NUMBER_CONVERTER, defaultValue.toString()).longValue();
-    }
-
-    /** Returns the double value of this property. Throws if not set and no
-     * default. */
-    public double getDouble() {
-      return getDouble((Number) property.defaultValue());
-    }
-
-    /** Returns the double value of this property. Throws if not set and no
-     * default. */
-    public double getDouble(Number defaultValue) {
-      assert property.type() == ConnectionProperty.Type.NUMBER;
-      return get_(NUMBER_CONVERTER, defaultValue.toString()).doubleValue();
-    }
-
-    /** Returns the boolean value of this property. Throws if not set and no
-     * default. */
-    public boolean getBoolean() {
-      return getBoolean((Boolean) property.defaultValue());
-    }
-
-    /** Returns the boolean value of this property. Throws if not set and no
-     * default. */
-    public boolean getBoolean(boolean defaultValue) {
-      assert property.type() == ConnectionProperty.Type.BOOLEAN;
-      return get_(BOOLEAN_CONVERTER, Boolean.toString(defaultValue));
-    }
-
-    /** Returns the enum value of this property. Throws if not set and no
-     * default. */
-    public <E extends Enum<E>> E getEnum(Class<E> enumClass) {
-      //noinspection unchecked
-      return getEnum(enumClass, (E) property.defaultValue());
-    }
-
-    /** Returns the enum value of this property. Throws if not set and no
-     * default. */
-    public <E extends Enum<E>> E getEnum(Class<E> enumClass, E defaultValue) {
-      if (property.type() != ConnectionProperty.Type.ENUM) {
-        throw new AssertionError("not an enum");
-      }
-      if (enumClass != property.valueClass()) {
-        throw new AssertionError("wrong value class; expected "
-            + property.valueClass());
-      }
-      if (defaultValue == null) {
-        return getDefaultNull(enumConverter(enumClass));
-      } else {
-        return get_(enumConverter(enumClass), defaultValue.name());
-      }
-    }
-
-    /** Returns an instance of a plugin.
-     *
-     * <p>Throws if not set and no default.
-     * Also throws if the class does not implement the required interface,
-     * or if it does not have a public default constructor or an public static
-     * field called {@code #INSTANCE}. */
-    public <T> T getPlugin(Class<T> pluginClass, T defaultInstance) {
-      return getPlugin(pluginClass, (String) property.defaultValue(),
-          defaultInstance);
-    }
-
-    /** Returns an instance of a plugin, using a given class name if none is
-     * set.
-     *
-     * <p>Throws if not set and no default.
-     * Also throws if the class does not implement the required interface,
-     * or if it does not have a public default constructor or an public static
-     * field called {@code #INSTANCE}. */
-    public <T> T getPlugin(Class<T> pluginClass, String defaultClassName,
-        T defaultInstance) {
-      assert property.type() == ConnectionProperty.Type.PLUGIN;
-      return get_(pluginConverter(pluginClass, defaultInstance),
-          defaultClassName);
-    }
-  }
-
-  /** Callback to parse a property from string to its native type. */
-  public interface Converter<T> {
-    T apply(ConnectionProperty connectionProperty, String s);
-  }
-
-  public static final Converter<Boolean> BOOLEAN_CONVERTER =
-      new Converter<Boolean>() {
-        public Boolean apply(ConnectionProperty connectionProperty, String s) {
-          if (s == null) {
-            throw new RuntimeException("Required property '"
-                + connectionProperty.camelName() + "' not specified");
-          }
-          return Boolean.parseBoolean(s);
-        }
-      };
-
-  static final Map<String, BigDecimal> MULTIPLIER_MAP =
-      new LinkedHashMap<>();
-  static {
-    MULTIPLIER_MAP.put("k", new BigDecimal(1024));
-    MULTIPLIER_MAP.put("K", new BigDecimal(1024));
-    MULTIPLIER_MAP.put("m", new BigDecimal(1024 * 1024));
-    MULTIPLIER_MAP.put("M", new BigDecimal(1024 * 1024));
-    MULTIPLIER_MAP.put("g", new BigDecimal(1024 * 1024 * 1024));
-    MULTIPLIER_MAP.put("G", new BigDecimal(1024 * 1024 * 1024));
-  }
-
-  public static final Converter<Number> NUMBER_CONVERTER =
-      new Converter<Number>() {
-        public Number apply(ConnectionProperty connectionProperty, String s) {
-          if (s == null) {
-            throw new RuntimeException("Required property '"
-                + connectionProperty.camelName() + "' not specified");
-          }
-          BigDecimal multiplier = BigDecimal.ONE;
-          for (Map.Entry<String, BigDecimal> e : MULTIPLIER_MAP.entrySet()) {
-            if (s.endsWith(e.getKey())) {
-              multiplier = e.getValue();
-              s = s.substring(0, s.length() - e.getKey().length());
-            }
-          }
-          return new BigDecimal(s).multiply(multiplier);
-        }
-      };
-
-  public static final Converter<String> IDENTITY_CONVERTER =
-      new Converter<String>() {
-        public String apply(ConnectionProperty connectionProperty, String s) {
-          return s;
-        }
-      };
-
-  public static <E extends Enum> Converter<E> enumConverter(
-      final Class<E> enumClass) {
-    return new Converter<E>() {
-      public E apply(ConnectionProperty connectionProperty, String s) {
-        if (s == null) {
-          throw new RuntimeException("Required property '"
-              + connectionProperty.camelName() + "' not specified");
-        }
-        try {
-          return (E) Enum.valueOf(enumClass, s);
-        } catch (IllegalArgumentException e) {
-          // Case insensitive match is OK too.
-          for (E c : enumClass.getEnumConstants()) {
-            if (c.name().equalsIgnoreCase(s)) {
-              return c;
-            }
-          }
-          throw new RuntimeException("Property '" + s + "' not valid for enum "
-              + enumClass.getName());
-        }
-      }
-    };
-  }
-
-  public static <T> Converter<T> pluginConverter(final Class<T> pluginClass,
-      final T defaultInstance) {
-    return new Converter<T>() {
-      public T apply(ConnectionProperty connectionProperty, String s) {
-        if (s == null) {
-          if (defaultInstance != null) {
-            return defaultInstance;
-          }
-          if (!connectionProperty.required()) {
-            return null;
-          }
-          throw new RuntimeException("Required property '"
-              + connectionProperty.camelName() + "' not specified");
-        }
-        return AvaticaUtils.instantiatePlugin(pluginClass, s);
-      }
-    };
-  }
-}
-
-// End ConnectionConfigImpl.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/ConnectionPropertiesImpl.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/ConnectionPropertiesImpl.java b/avatica/core/src/main/java/org/apache/calcite/avatica/ConnectionPropertiesImpl.java
deleted file mode 100644
index c147ecc..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/ConnectionPropertiesImpl.java
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import org.apache.calcite.avatica.proto.Common;
-
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.google.protobuf.Descriptors.FieldDescriptor;
-
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.util.Objects;
-
-/** Concrete implementation of {@link Meta.ConnectionProperties}. Provides additional state
- * tracking to enable {@code RemoteMeta} to lazily push changes up to a query server.
- *
- * <p>{@code Meta} instances should probably hold authority on the {@code isDirty}
- * flag because {@code AvaticaConnection} instances have no way of knowing if they're local or
- * remote.
- */
-public class ConnectionPropertiesImpl implements Meta.ConnectionProperties {
-  private static final FieldDescriptor CATALOG_DESCRIPTOR = Common.ConnectionProperties
-      .getDescriptor().findFieldByNumber(Common.ConnectionProperties.CATALOG_FIELD_NUMBER);
-  private static final FieldDescriptor SCHEMA_DESCRIPTOR = Common.ConnectionProperties
-      .getDescriptor().findFieldByNumber(Common.ConnectionProperties.SCHEMA_FIELD_NUMBER);
-  private static final FieldDescriptor TRANSACTION_ISOLATION_DESCRIPTOR = Common
-      .ConnectionProperties.getDescriptor().findFieldByNumber(
-          Common.ConnectionProperties.TRANSACTION_ISOLATION_FIELD_NUMBER);
-
-  private boolean isDirty = false;
-  private Boolean autoCommit;
-  private Boolean readOnly;
-  private Integer transactionIsolation;
-  private String catalog;
-  private String schema;
-
-  // TODO: replace with Meta.ConnectionProperties$EMPTY instance?
-  public ConnectionPropertiesImpl() {}
-
-  public ConnectionPropertiesImpl(Connection conn) throws SQLException {
-    this(conn.getAutoCommit(), conn.isReadOnly(), conn.getTransactionIsolation(),
-        conn.getCatalog(), conn.getSchema());
-  }
-
-  @JsonCreator
-  public ConnectionPropertiesImpl(
-      @JsonProperty("autoCommit") Boolean autoCommit,
-      @JsonProperty("readOnly") Boolean readOnly,
-      @JsonProperty("transactionIsolation") Integer transactionIsolation,
-      @JsonProperty("catalog") String catalog,
-      @JsonProperty("schema") String schema) {
-    this.autoCommit = autoCommit;
-    this.readOnly = readOnly;
-    this.transactionIsolation = transactionIsolation;
-    this.catalog = catalog;
-    this.schema = schema;
-  }
-
-  public ConnectionPropertiesImpl setDirty(boolean val) {
-    this.isDirty = val;
-    return this;
-  }
-
-  public boolean isDirty() {
-    return this.isDirty;
-  }
-
-  @Override public boolean isEmpty() {
-    return autoCommit == null && readOnly == null && transactionIsolation == null
-        && catalog == null && schema == null;
-  }
-
-  /** Overwrites fields in {@code this} with any non-null fields in {@code that}. Sets
-   * {@code isDirty} if any fields are changed.
-   *
-   * @return {@code this}
-   */
-  @Override public ConnectionPropertiesImpl merge(Meta.ConnectionProperties that) {
-    if (this == that) {
-      return this;
-    }
-    if (that.isAutoCommit() != null && this.autoCommit != that.isAutoCommit()) {
-      this.autoCommit = that.isAutoCommit();
-      this.isDirty = true;
-    }
-    if (that.isReadOnly() != null && this.readOnly != that.isReadOnly()) {
-      this.readOnly = that.isReadOnly();
-      this.isDirty = true;
-    }
-    if (that.getTransactionIsolation() != null
-        && !that.getTransactionIsolation().equals(this.transactionIsolation)) {
-      this.transactionIsolation = that.getTransactionIsolation();
-      this.isDirty = true;
-    }
-    if (that.getCatalog() != null && !that.getCatalog().equalsIgnoreCase(this.catalog)) {
-      this.catalog = that.getCatalog();
-      this.isDirty = true;
-    }
-    if (that.getSchema() != null && !that.getSchema().equalsIgnoreCase(this.schema)) {
-      this.schema = that.getSchema();
-      this.isDirty = true;
-    }
-    return this;
-  }
-
-  /** Sets {@code autoCommit} status and flag as dirty.
-   *
-   * @return {@code this}
-   */
-  @Override public Meta.ConnectionProperties setAutoCommit(boolean val) {
-    this.autoCommit = val;
-    this.isDirty = true;
-    return this;
-  }
-
-  @Override public Boolean isAutoCommit() {
-    return this.autoCommit;
-  }
-
-  /** Sets {@code readOnly} status and flag as dirty.
-   *
-   * @return {@code this}
-   */
-  @Override public Meta.ConnectionProperties setReadOnly(boolean val) {
-    this.readOnly = val;
-    this.isDirty = true;
-    return this;
-  }
-
-  @Override public Boolean isReadOnly() {
-    return this.readOnly;
-  }
-
-  /** Sets {@code transactionIsolation} status and flag as dirty.
-   *
-   * @return {@code this}
-   */
-  @Override public Meta.ConnectionProperties setTransactionIsolation(int val) {
-    this.transactionIsolation = val;
-    this.isDirty = true;
-    return this;
-  }
-
-  public Integer getTransactionIsolation() {
-    return this.transactionIsolation;
-  }
-
-  /** Sets {@code catalog} and flag as dirty.
-   *
-   * @return {@code this}
-   */
-  @Override public Meta.ConnectionProperties setCatalog(String val) {
-    this.catalog = val;
-    this.isDirty = true;
-    return this;
-  }
-
-  @Override public String getCatalog() {
-    return this.catalog;
-  }
-
-  /** Sets {@code schema} and flag as dirty.
-   *
-   * @return {@code this}
-   */
-  @Override public Meta.ConnectionProperties setSchema(String val) {
-    this.schema = val;
-    this.isDirty = true;
-    return this;
-  }
-
-  public String getSchema() {
-    return this.schema;
-  }
-
-  @Override public int hashCode() {
-    return Objects.hash(autoCommit, catalog, isDirty, readOnly, schema,
-        transactionIsolation);
-  }
-
-  @Override public boolean equals(Object o) {
-    return o == this
-        || o instanceof ConnectionPropertiesImpl
-        && Objects.equals(autoCommit, ((ConnectionPropertiesImpl) o).autoCommit)
-        && Objects.equals(catalog, ((ConnectionPropertiesImpl) o).catalog)
-        && isDirty == ((ConnectionPropertiesImpl) o).isDirty
-        && Objects.equals(readOnly, ((ConnectionPropertiesImpl) o).readOnly)
-        && Objects.equals(schema, ((ConnectionPropertiesImpl) o).schema)
-        && Objects.equals(transactionIsolation,
-            ((ConnectionPropertiesImpl) o).transactionIsolation);
-  }
-
-  public Common.ConnectionProperties toProto() {
-    Common.ConnectionProperties.Builder builder = Common.ConnectionProperties.newBuilder();
-
-    if (null != autoCommit) {
-      builder.setHasAutoCommit(true);
-      builder.setAutoCommit(autoCommit.booleanValue());
-    } else {
-      // Be explicit to avoid default value confusion
-      builder.setHasAutoCommit(false);
-    }
-
-    if (null != catalog) {
-      builder.setCatalog(catalog);
-    }
-
-    builder.setIsDirty(isDirty);
-
-    if (null != readOnly) {
-      builder.setHasReadOnly(true);
-      builder.setReadOnly(readOnly.booleanValue());
-    } else {
-      // Be explicit to avoid default value confusion
-      builder.setHasReadOnly(false);
-    }
-
-    if (null != schema) {
-      builder.setSchema(schema);
-    }
-
-    if (null != transactionIsolation) {
-      builder.setTransactionIsolation(transactionIsolation.intValue());
-    }
-
-    return builder.build();
-  }
-
-  public static ConnectionPropertiesImpl fromProto(Common.ConnectionProperties proto) {
-    String catalog = null;
-    if (proto.hasField(CATALOG_DESCRIPTOR)) {
-      catalog = proto.getCatalog();
-    }
-
-    String schema = null;
-    if (proto.hasField(SCHEMA_DESCRIPTOR)) {
-      schema = proto.getSchema();
-    }
-
-    Boolean autoCommit = null;
-    if (proto.getHasAutoCommit()) {
-      autoCommit = Boolean.valueOf(proto.getAutoCommit());
-    }
-
-    Boolean readOnly = null;
-    if (proto.getHasReadOnly()) {
-      readOnly = Boolean.valueOf(proto.getReadOnly());
-    }
-
-    Integer transactionIsolation = null;
-    if (proto.hasField(TRANSACTION_ISOLATION_DESCRIPTOR)) {
-      transactionIsolation = Integer.valueOf(proto.getTransactionIsolation());
-    }
-
-    ConnectionPropertiesImpl impl = new ConnectionPropertiesImpl(autoCommit, readOnly,
-        transactionIsolation, catalog, schema);
-
-    impl.setDirty(proto.getIsDirty());
-
-    return impl;
-  }
-}
-
-// End ConnectionPropertiesImpl.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/ConnectionProperty.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/ConnectionProperty.java b/avatica/core/src/main/java/org/apache/calcite/avatica/ConnectionProperty.java
deleted file mode 100644
index b41b9a3..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/ConnectionProperty.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import java.util.Properties;
-
-/**
- * Definition of a property that may be specified on the JDBC connect string.
- * {@link BuiltInConnectionProperty} enumerates built-in properties, but
- * there may be others; the list is not closed.
- */
-public interface ConnectionProperty {
-  /** The name of this property. (E.g. "MATERIALIZATIONS_ENABLED".) */
-  String name();
-
-  /** The name of this property in camel-case.
-   * (E.g. "materializationsEnabled".) */
-  String camelName();
-
-  /** Returns the default value of this property. The type must match its data
-   * type. */
-  Object defaultValue();
-
-  /** Returns the data type of this property. */
-  Type type();
-
-  /** Wraps this property with a properties object from which its value can be
-   * obtained when needed. */
-  ConnectionConfigImpl.PropEnv wrap(Properties properties);
-
-  /** Whether the property is mandatory. */
-  boolean required();
-
-  /** Class of values that this property can take. Most useful for
-   * {@link Type#ENUM} properties. */
-  Class valueClass();
-
-  /** Data type of property. */
-  enum Type {
-    BOOLEAN,
-    STRING,
-    NUMBER,
-    ENUM,
-    PLUGIN;
-
-    /** Deduces the class of a property of this type, given the default value
-     * and the user-specified value class (each of which may be null, unless
-     * this is an enum or a plugin). */
-    public Class deduceValueClass(Object defaultValue, Class valueClass) {
-      if (valueClass != null) {
-        return valueClass;
-      }
-      if (defaultValue != null) {
-        final Class<?> c = defaultValue.getClass();
-        if (c.isAnonymousClass()) {
-          // for default values that are anonymous enums
-          return c.getSuperclass();
-        }
-        return c;
-      }
-      return defaultValueClass();
-    }
-
-    /** Returns whether a default value and value types are valid for this
-     * kind of property. */
-    public boolean valid(Object defaultValue, Class clazz) {
-      switch (this) {
-      case BOOLEAN:
-        return clazz == Boolean.class
-            && (defaultValue == null || defaultValue instanceof Boolean);
-      case NUMBER:
-        return Number.class.isAssignableFrom(clazz)
-            && (defaultValue == null || defaultValue instanceof Number);
-      case STRING:
-        return clazz == String.class
-            && (defaultValue == null || defaultValue instanceof String);
-      case PLUGIN:
-        return clazz != null
-            && (defaultValue == null || defaultValue instanceof String);
-      case ENUM:
-        return Enum.class.isAssignableFrom(clazz)
-            && (defaultValue == null || clazz.isInstance(defaultValue));
-      default:
-        throw new AssertionError();
-      }
-    }
-
-    public Class defaultValueClass() {
-      switch (this) {
-      case BOOLEAN:
-        return Boolean.class;
-      case NUMBER:
-        return Number.class;
-      case STRING:
-        return String.class;
-      case PLUGIN:
-        return Object.class;
-      default:
-        throw new AssertionError("must specify value class for an ENUM");
-      }
-    }
-  }
-}
-
-// End ConnectionProperty.java


[42/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/proto/Common.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/proto/Common.java b/avatica/core/src/main/java/org/apache/calcite/avatica/proto/Common.java
deleted file mode 100644
index 892608e..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/proto/Common.java
+++ /dev/null
@@ -1,18319 +0,0 @@
-// Generated by the protocol buffer compiler.  DO NOT EDIT!
-// source: common.proto
-
-package org.apache.calcite.avatica.proto;
-
-public final class Common {
-  private Common() {}
-  public static void registerAllExtensions(
-      com.google.protobuf.ExtensionRegistryLite registry) {
-  }
-
-  public static void registerAllExtensions(
-      com.google.protobuf.ExtensionRegistry registry) {
-    registerAllExtensions(
-        (com.google.protobuf.ExtensionRegistryLite) registry);
-  }
-  /**
-   * <pre>
-   * Has to be consistent with Meta.StatementType
-   * </pre>
-   *
-   * Protobuf enum {@code StatementType}
-   */
-  public enum StatementType
-      implements com.google.protobuf.ProtocolMessageEnum {
-    /**
-     * <code>SELECT = 0;</code>
-     */
-    SELECT(0),
-    /**
-     * <code>INSERT = 1;</code>
-     */
-    INSERT(1),
-    /**
-     * <code>UPDATE = 2;</code>
-     */
-    UPDATE(2),
-    /**
-     * <code>DELETE = 3;</code>
-     */
-    DELETE(3),
-    /**
-     * <code>UPSERT = 4;</code>
-     */
-    UPSERT(4),
-    /**
-     * <code>MERGE = 5;</code>
-     */
-    MERGE(5),
-    /**
-     * <code>OTHER_DML = 6;</code>
-     */
-    OTHER_DML(6),
-    /**
-     * <code>CREATE = 7;</code>
-     */
-    CREATE(7),
-    /**
-     * <code>DROP = 8;</code>
-     */
-    DROP(8),
-    /**
-     * <code>ALTER = 9;</code>
-     */
-    ALTER(9),
-    /**
-     * <code>OTHER_DDL = 10;</code>
-     */
-    OTHER_DDL(10),
-    /**
-     * <code>CALL = 11;</code>
-     */
-    CALL(11),
-    UNRECOGNIZED(-1),
-    ;
-
-    /**
-     * <code>SELECT = 0;</code>
-     */
-    public static final int SELECT_VALUE = 0;
-    /**
-     * <code>INSERT = 1;</code>
-     */
-    public static final int INSERT_VALUE = 1;
-    /**
-     * <code>UPDATE = 2;</code>
-     */
-    public static final int UPDATE_VALUE = 2;
-    /**
-     * <code>DELETE = 3;</code>
-     */
-    public static final int DELETE_VALUE = 3;
-    /**
-     * <code>UPSERT = 4;</code>
-     */
-    public static final int UPSERT_VALUE = 4;
-    /**
-     * <code>MERGE = 5;</code>
-     */
-    public static final int MERGE_VALUE = 5;
-    /**
-     * <code>OTHER_DML = 6;</code>
-     */
-    public static final int OTHER_DML_VALUE = 6;
-    /**
-     * <code>CREATE = 7;</code>
-     */
-    public static final int CREATE_VALUE = 7;
-    /**
-     * <code>DROP = 8;</code>
-     */
-    public static final int DROP_VALUE = 8;
-    /**
-     * <code>ALTER = 9;</code>
-     */
-    public static final int ALTER_VALUE = 9;
-    /**
-     * <code>OTHER_DDL = 10;</code>
-     */
-    public static final int OTHER_DDL_VALUE = 10;
-    /**
-     * <code>CALL = 11;</code>
-     */
-    public static final int CALL_VALUE = 11;
-
-
-    public final int getNumber() {
-      if (this == UNRECOGNIZED) {
-        throw new java.lang.IllegalArgumentException(
-            "Can't get the number of an unknown enum value.");
-      }
-      return value;
-    }
-
-    /**
-     * @deprecated Use {@link #forNumber(int)} instead.
-     */
-    @java.lang.Deprecated
-    public static StatementType valueOf(int value) {
-      return forNumber(value);
-    }
-
-    public static StatementType forNumber(int value) {
-      switch (value) {
-        case 0: return SELECT;
-        case 1: return INSERT;
-        case 2: return UPDATE;
-        case 3: return DELETE;
-        case 4: return UPSERT;
-        case 5: return MERGE;
-        case 6: return OTHER_DML;
-        case 7: return CREATE;
-        case 8: return DROP;
-        case 9: return ALTER;
-        case 10: return OTHER_DDL;
-        case 11: return CALL;
-        default: return null;
-      }
-    }
-
-    public static com.google.protobuf.Internal.EnumLiteMap<StatementType>
-        internalGetValueMap() {
-      return internalValueMap;
-    }
-    private static final com.google.protobuf.Internal.EnumLiteMap<
-        StatementType> internalValueMap =
-          new com.google.protobuf.Internal.EnumLiteMap<StatementType>() {
-            public StatementType findValueByNumber(int number) {
-              return StatementType.forNumber(number);
-            }
-          };
-
-    public final com.google.protobuf.Descriptors.EnumValueDescriptor
-        getValueDescriptor() {
-      return getDescriptor().getValues().get(ordinal());
-    }
-    public final com.google.protobuf.Descriptors.EnumDescriptor
-        getDescriptorForType() {
-      return getDescriptor();
-    }
-    public static final com.google.protobuf.Descriptors.EnumDescriptor
-        getDescriptor() {
-      return org.apache.calcite.avatica.proto.Common.getDescriptor().getEnumTypes().get(0);
-    }
-
-    private static final StatementType[] VALUES = values();
-
-    public static StatementType valueOf(
-        com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
-      if (desc.getType() != getDescriptor()) {
-        throw new java.lang.IllegalArgumentException(
-          "EnumValueDescriptor is not for this type.");
-      }
-      if (desc.getIndex() == -1) {
-        return UNRECOGNIZED;
-      }
-      return VALUES[desc.getIndex()];
-    }
-
-    private final int value;
-
-    private StatementType(int value) {
-      this.value = value;
-    }
-
-    // @@protoc_insertion_point(enum_scope:StatementType)
-  }
-
-  /**
-   * Protobuf enum {@code Rep}
-   */
-  public enum Rep
-      implements com.google.protobuf.ProtocolMessageEnum {
-    /**
-     * <code>PRIMITIVE_BOOLEAN = 0;</code>
-     */
-    PRIMITIVE_BOOLEAN(0),
-    /**
-     * <code>PRIMITIVE_BYTE = 1;</code>
-     */
-    PRIMITIVE_BYTE(1),
-    /**
-     * <code>PRIMITIVE_CHAR = 2;</code>
-     */
-    PRIMITIVE_CHAR(2),
-    /**
-     * <code>PRIMITIVE_SHORT = 3;</code>
-     */
-    PRIMITIVE_SHORT(3),
-    /**
-     * <code>PRIMITIVE_INT = 4;</code>
-     */
-    PRIMITIVE_INT(4),
-    /**
-     * <code>PRIMITIVE_LONG = 5;</code>
-     */
-    PRIMITIVE_LONG(5),
-    /**
-     * <code>PRIMITIVE_FLOAT = 6;</code>
-     */
-    PRIMITIVE_FLOAT(6),
-    /**
-     * <code>PRIMITIVE_DOUBLE = 7;</code>
-     */
-    PRIMITIVE_DOUBLE(7),
-    /**
-     * <code>BOOLEAN = 8;</code>
-     */
-    BOOLEAN(8),
-    /**
-     * <code>BYTE = 9;</code>
-     */
-    BYTE(9),
-    /**
-     * <code>CHARACTER = 10;</code>
-     */
-    CHARACTER(10),
-    /**
-     * <code>SHORT = 11;</code>
-     */
-    SHORT(11),
-    /**
-     * <code>INTEGER = 12;</code>
-     */
-    INTEGER(12),
-    /**
-     * <code>LONG = 13;</code>
-     */
-    LONG(13),
-    /**
-     * <code>FLOAT = 14;</code>
-     */
-    FLOAT(14),
-    /**
-     * <code>DOUBLE = 15;</code>
-     */
-    DOUBLE(15),
-    /**
-     * <code>BIG_INTEGER = 25;</code>
-     */
-    BIG_INTEGER(25),
-    /**
-     * <code>BIG_DECIMAL = 26;</code>
-     */
-    BIG_DECIMAL(26),
-    /**
-     * <code>JAVA_SQL_TIME = 16;</code>
-     */
-    JAVA_SQL_TIME(16),
-    /**
-     * <code>JAVA_SQL_TIMESTAMP = 17;</code>
-     */
-    JAVA_SQL_TIMESTAMP(17),
-    /**
-     * <code>JAVA_SQL_DATE = 18;</code>
-     */
-    JAVA_SQL_DATE(18),
-    /**
-     * <code>JAVA_UTIL_DATE = 19;</code>
-     */
-    JAVA_UTIL_DATE(19),
-    /**
-     * <code>BYTE_STRING = 20;</code>
-     */
-    BYTE_STRING(20),
-    /**
-     * <code>STRING = 21;</code>
-     */
-    STRING(21),
-    /**
-     * <code>NUMBER = 22;</code>
-     */
-    NUMBER(22),
-    /**
-     * <code>OBJECT = 23;</code>
-     */
-    OBJECT(23),
-    /**
-     * <code>NULL = 24;</code>
-     */
-    NULL(24),
-    /**
-     * <code>ARRAY = 27;</code>
-     */
-    ARRAY(27),
-    /**
-     * <code>STRUCT = 28;</code>
-     */
-    STRUCT(28),
-    /**
-     * <code>MULTISET = 29;</code>
-     */
-    MULTISET(29),
-    UNRECOGNIZED(-1),
-    ;
-
-    /**
-     * <code>PRIMITIVE_BOOLEAN = 0;</code>
-     */
-    public static final int PRIMITIVE_BOOLEAN_VALUE = 0;
-    /**
-     * <code>PRIMITIVE_BYTE = 1;</code>
-     */
-    public static final int PRIMITIVE_BYTE_VALUE = 1;
-    /**
-     * <code>PRIMITIVE_CHAR = 2;</code>
-     */
-    public static final int PRIMITIVE_CHAR_VALUE = 2;
-    /**
-     * <code>PRIMITIVE_SHORT = 3;</code>
-     */
-    public static final int PRIMITIVE_SHORT_VALUE = 3;
-    /**
-     * <code>PRIMITIVE_INT = 4;</code>
-     */
-    public static final int PRIMITIVE_INT_VALUE = 4;
-    /**
-     * <code>PRIMITIVE_LONG = 5;</code>
-     */
-    public static final int PRIMITIVE_LONG_VALUE = 5;
-    /**
-     * <code>PRIMITIVE_FLOAT = 6;</code>
-     */
-    public static final int PRIMITIVE_FLOAT_VALUE = 6;
-    /**
-     * <code>PRIMITIVE_DOUBLE = 7;</code>
-     */
-    public static final int PRIMITIVE_DOUBLE_VALUE = 7;
-    /**
-     * <code>BOOLEAN = 8;</code>
-     */
-    public static final int BOOLEAN_VALUE = 8;
-    /**
-     * <code>BYTE = 9;</code>
-     */
-    public static final int BYTE_VALUE = 9;
-    /**
-     * <code>CHARACTER = 10;</code>
-     */
-    public static final int CHARACTER_VALUE = 10;
-    /**
-     * <code>SHORT = 11;</code>
-     */
-    public static final int SHORT_VALUE = 11;
-    /**
-     * <code>INTEGER = 12;</code>
-     */
-    public static final int INTEGER_VALUE = 12;
-    /**
-     * <code>LONG = 13;</code>
-     */
-    public static final int LONG_VALUE = 13;
-    /**
-     * <code>FLOAT = 14;</code>
-     */
-    public static final int FLOAT_VALUE = 14;
-    /**
-     * <code>DOUBLE = 15;</code>
-     */
-    public static final int DOUBLE_VALUE = 15;
-    /**
-     * <code>BIG_INTEGER = 25;</code>
-     */
-    public static final int BIG_INTEGER_VALUE = 25;
-    /**
-     * <code>BIG_DECIMAL = 26;</code>
-     */
-    public static final int BIG_DECIMAL_VALUE = 26;
-    /**
-     * <code>JAVA_SQL_TIME = 16;</code>
-     */
-    public static final int JAVA_SQL_TIME_VALUE = 16;
-    /**
-     * <code>JAVA_SQL_TIMESTAMP = 17;</code>
-     */
-    public static final int JAVA_SQL_TIMESTAMP_VALUE = 17;
-    /**
-     * <code>JAVA_SQL_DATE = 18;</code>
-     */
-    public static final int JAVA_SQL_DATE_VALUE = 18;
-    /**
-     * <code>JAVA_UTIL_DATE = 19;</code>
-     */
-    public static final int JAVA_UTIL_DATE_VALUE = 19;
-    /**
-     * <code>BYTE_STRING = 20;</code>
-     */
-    public static final int BYTE_STRING_VALUE = 20;
-    /**
-     * <code>STRING = 21;</code>
-     */
-    public static final int STRING_VALUE = 21;
-    /**
-     * <code>NUMBER = 22;</code>
-     */
-    public static final int NUMBER_VALUE = 22;
-    /**
-     * <code>OBJECT = 23;</code>
-     */
-    public static final int OBJECT_VALUE = 23;
-    /**
-     * <code>NULL = 24;</code>
-     */
-    public static final int NULL_VALUE = 24;
-    /**
-     * <code>ARRAY = 27;</code>
-     */
-    public static final int ARRAY_VALUE = 27;
-    /**
-     * <code>STRUCT = 28;</code>
-     */
-    public static final int STRUCT_VALUE = 28;
-    /**
-     * <code>MULTISET = 29;</code>
-     */
-    public static final int MULTISET_VALUE = 29;
-
-
-    public final int getNumber() {
-      if (this == UNRECOGNIZED) {
-        throw new java.lang.IllegalArgumentException(
-            "Can't get the number of an unknown enum value.");
-      }
-      return value;
-    }
-
-    /**
-     * @deprecated Use {@link #forNumber(int)} instead.
-     */
-    @java.lang.Deprecated
-    public static Rep valueOf(int value) {
-      return forNumber(value);
-    }
-
-    public static Rep forNumber(int value) {
-      switch (value) {
-        case 0: return PRIMITIVE_BOOLEAN;
-        case 1: return PRIMITIVE_BYTE;
-        case 2: return PRIMITIVE_CHAR;
-        case 3: return PRIMITIVE_SHORT;
-        case 4: return PRIMITIVE_INT;
-        case 5: return PRIMITIVE_LONG;
-        case 6: return PRIMITIVE_FLOAT;
-        case 7: return PRIMITIVE_DOUBLE;
-        case 8: return BOOLEAN;
-        case 9: return BYTE;
-        case 10: return CHARACTER;
-        case 11: return SHORT;
-        case 12: return INTEGER;
-        case 13: return LONG;
-        case 14: return FLOAT;
-        case 15: return DOUBLE;
-        case 25: return BIG_INTEGER;
-        case 26: return BIG_DECIMAL;
-        case 16: return JAVA_SQL_TIME;
-        case 17: return JAVA_SQL_TIMESTAMP;
-        case 18: return JAVA_SQL_DATE;
-        case 19: return JAVA_UTIL_DATE;
-        case 20: return BYTE_STRING;
-        case 21: return STRING;
-        case 22: return NUMBER;
-        case 23: return OBJECT;
-        case 24: return NULL;
-        case 27: return ARRAY;
-        case 28: return STRUCT;
-        case 29: return MULTISET;
-        default: return null;
-      }
-    }
-
-    public static com.google.protobuf.Internal.EnumLiteMap<Rep>
-        internalGetValueMap() {
-      return internalValueMap;
-    }
-    private static final com.google.protobuf.Internal.EnumLiteMap<
-        Rep> internalValueMap =
-          new com.google.protobuf.Internal.EnumLiteMap<Rep>() {
-            public Rep findValueByNumber(int number) {
-              return Rep.forNumber(number);
-            }
-          };
-
-    public final com.google.protobuf.Descriptors.EnumValueDescriptor
-        getValueDescriptor() {
-      return getDescriptor().getValues().get(ordinal());
-    }
-    public final com.google.protobuf.Descriptors.EnumDescriptor
-        getDescriptorForType() {
-      return getDescriptor();
-    }
-    public static final com.google.protobuf.Descriptors.EnumDescriptor
-        getDescriptor() {
-      return org.apache.calcite.avatica.proto.Common.getDescriptor().getEnumTypes().get(1);
-    }
-
-    private static final Rep[] VALUES = values();
-
-    public static Rep valueOf(
-        com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
-      if (desc.getType() != getDescriptor()) {
-        throw new java.lang.IllegalArgumentException(
-          "EnumValueDescriptor is not for this type.");
-      }
-      if (desc.getIndex() == -1) {
-        return UNRECOGNIZED;
-      }
-      return VALUES[desc.getIndex()];
-    }
-
-    private final int value;
-
-    private Rep(int value) {
-      this.value = value;
-    }
-
-    // @@protoc_insertion_point(enum_scope:Rep)
-  }
-
-  /**
-   * <pre>
-   * The severity of some unexpected outcome to an operation.
-   * Protobuf enum values must be unique across all other enums
-   * </pre>
-   *
-   * Protobuf enum {@code Severity}
-   */
-  public enum Severity
-      implements com.google.protobuf.ProtocolMessageEnum {
-    /**
-     * <code>UNKNOWN_SEVERITY = 0;</code>
-     */
-    UNKNOWN_SEVERITY(0),
-    /**
-     * <code>FATAL_SEVERITY = 1;</code>
-     */
-    FATAL_SEVERITY(1),
-    /**
-     * <code>ERROR_SEVERITY = 2;</code>
-     */
-    ERROR_SEVERITY(2),
-    /**
-     * <code>WARNING_SEVERITY = 3;</code>
-     */
-    WARNING_SEVERITY(3),
-    UNRECOGNIZED(-1),
-    ;
-
-    /**
-     * <code>UNKNOWN_SEVERITY = 0;</code>
-     */
-    public static final int UNKNOWN_SEVERITY_VALUE = 0;
-    /**
-     * <code>FATAL_SEVERITY = 1;</code>
-     */
-    public static final int FATAL_SEVERITY_VALUE = 1;
-    /**
-     * <code>ERROR_SEVERITY = 2;</code>
-     */
-    public static final int ERROR_SEVERITY_VALUE = 2;
-    /**
-     * <code>WARNING_SEVERITY = 3;</code>
-     */
-    public static final int WARNING_SEVERITY_VALUE = 3;
-
-
-    public final int getNumber() {
-      if (this == UNRECOGNIZED) {
-        throw new java.lang.IllegalArgumentException(
-            "Can't get the number of an unknown enum value.");
-      }
-      return value;
-    }
-
-    /**
-     * @deprecated Use {@link #forNumber(int)} instead.
-     */
-    @java.lang.Deprecated
-    public static Severity valueOf(int value) {
-      return forNumber(value);
-    }
-
-    public static Severity forNumber(int value) {
-      switch (value) {
-        case 0: return UNKNOWN_SEVERITY;
-        case 1: return FATAL_SEVERITY;
-        case 2: return ERROR_SEVERITY;
-        case 3: return WARNING_SEVERITY;
-        default: return null;
-      }
-    }
-
-    public static com.google.protobuf.Internal.EnumLiteMap<Severity>
-        internalGetValueMap() {
-      return internalValueMap;
-    }
-    private static final com.google.protobuf.Internal.EnumLiteMap<
-        Severity> internalValueMap =
-          new com.google.protobuf.Internal.EnumLiteMap<Severity>() {
-            public Severity findValueByNumber(int number) {
-              return Severity.forNumber(number);
-            }
-          };
-
-    public final com.google.protobuf.Descriptors.EnumValueDescriptor
-        getValueDescriptor() {
-      return getDescriptor().getValues().get(ordinal());
-    }
-    public final com.google.protobuf.Descriptors.EnumDescriptor
-        getDescriptorForType() {
-      return getDescriptor();
-    }
-    public static final com.google.protobuf.Descriptors.EnumDescriptor
-        getDescriptor() {
-      return org.apache.calcite.avatica.proto.Common.getDescriptor().getEnumTypes().get(2);
-    }
-
-    private static final Severity[] VALUES = values();
-
-    public static Severity valueOf(
-        com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
-      if (desc.getType() != getDescriptor()) {
-        throw new java.lang.IllegalArgumentException(
-          "EnumValueDescriptor is not for this type.");
-      }
-      if (desc.getIndex() == -1) {
-        return UNRECOGNIZED;
-      }
-      return VALUES[desc.getIndex()];
-    }
-
-    private final int value;
-
-    private Severity(int value) {
-      this.value = value;
-    }
-
-    // @@protoc_insertion_point(enum_scope:Severity)
-  }
-
-  /**
-   * <pre>
-   * Enumeration corresponding to DatabaseMetaData operations
-   * </pre>
-   *
-   * Protobuf enum {@code MetaDataOperation}
-   */
-  public enum MetaDataOperation
-      implements com.google.protobuf.ProtocolMessageEnum {
-    /**
-     * <code>GET_ATTRIBUTES = 0;</code>
-     */
-    GET_ATTRIBUTES(0),
-    /**
-     * <code>GET_BEST_ROW_IDENTIFIER = 1;</code>
-     */
-    GET_BEST_ROW_IDENTIFIER(1),
-    /**
-     * <code>GET_CATALOGS = 2;</code>
-     */
-    GET_CATALOGS(2),
-    /**
-     * <code>GET_CLIENT_INFO_PROPERTIES = 3;</code>
-     */
-    GET_CLIENT_INFO_PROPERTIES(3),
-    /**
-     * <code>GET_COLUMN_PRIVILEGES = 4;</code>
-     */
-    GET_COLUMN_PRIVILEGES(4),
-    /**
-     * <code>GET_COLUMNS = 5;</code>
-     */
-    GET_COLUMNS(5),
-    /**
-     * <code>GET_CROSS_REFERENCE = 6;</code>
-     */
-    GET_CROSS_REFERENCE(6),
-    /**
-     * <code>GET_EXPORTED_KEYS = 7;</code>
-     */
-    GET_EXPORTED_KEYS(7),
-    /**
-     * <code>GET_FUNCTION_COLUMNS = 8;</code>
-     */
-    GET_FUNCTION_COLUMNS(8),
-    /**
-     * <code>GET_FUNCTIONS = 9;</code>
-     */
-    GET_FUNCTIONS(9),
-    /**
-     * <code>GET_IMPORTED_KEYS = 10;</code>
-     */
-    GET_IMPORTED_KEYS(10),
-    /**
-     * <code>GET_INDEX_INFO = 11;</code>
-     */
-    GET_INDEX_INFO(11),
-    /**
-     * <code>GET_PRIMARY_KEYS = 12;</code>
-     */
-    GET_PRIMARY_KEYS(12),
-    /**
-     * <code>GET_PROCEDURE_COLUMNS = 13;</code>
-     */
-    GET_PROCEDURE_COLUMNS(13),
-    /**
-     * <code>GET_PROCEDURES = 14;</code>
-     */
-    GET_PROCEDURES(14),
-    /**
-     * <code>GET_PSEUDO_COLUMNS = 15;</code>
-     */
-    GET_PSEUDO_COLUMNS(15),
-    /**
-     * <code>GET_SCHEMAS = 16;</code>
-     */
-    GET_SCHEMAS(16),
-    /**
-     * <code>GET_SCHEMAS_WITH_ARGS = 17;</code>
-     */
-    GET_SCHEMAS_WITH_ARGS(17),
-    /**
-     * <code>GET_SUPER_TABLES = 18;</code>
-     */
-    GET_SUPER_TABLES(18),
-    /**
-     * <code>GET_SUPER_TYPES = 19;</code>
-     */
-    GET_SUPER_TYPES(19),
-    /**
-     * <code>GET_TABLE_PRIVILEGES = 20;</code>
-     */
-    GET_TABLE_PRIVILEGES(20),
-    /**
-     * <code>GET_TABLES = 21;</code>
-     */
-    GET_TABLES(21),
-    /**
-     * <code>GET_TABLE_TYPES = 22;</code>
-     */
-    GET_TABLE_TYPES(22),
-    /**
-     * <code>GET_TYPE_INFO = 23;</code>
-     */
-    GET_TYPE_INFO(23),
-    /**
-     * <code>GET_UDTS = 24;</code>
-     */
-    GET_UDTS(24),
-    /**
-     * <code>GET_VERSION_COLUMNS = 25;</code>
-     */
-    GET_VERSION_COLUMNS(25),
-    UNRECOGNIZED(-1),
-    ;
-
-    /**
-     * <code>GET_ATTRIBUTES = 0;</code>
-     */
-    public static final int GET_ATTRIBUTES_VALUE = 0;
-    /**
-     * <code>GET_BEST_ROW_IDENTIFIER = 1;</code>
-     */
-    public static final int GET_BEST_ROW_IDENTIFIER_VALUE = 1;
-    /**
-     * <code>GET_CATALOGS = 2;</code>
-     */
-    public static final int GET_CATALOGS_VALUE = 2;
-    /**
-     * <code>GET_CLIENT_INFO_PROPERTIES = 3;</code>
-     */
-    public static final int GET_CLIENT_INFO_PROPERTIES_VALUE = 3;
-    /**
-     * <code>GET_COLUMN_PRIVILEGES = 4;</code>
-     */
-    public static final int GET_COLUMN_PRIVILEGES_VALUE = 4;
-    /**
-     * <code>GET_COLUMNS = 5;</code>
-     */
-    public static final int GET_COLUMNS_VALUE = 5;
-    /**
-     * <code>GET_CROSS_REFERENCE = 6;</code>
-     */
-    public static final int GET_CROSS_REFERENCE_VALUE = 6;
-    /**
-     * <code>GET_EXPORTED_KEYS = 7;</code>
-     */
-    public static final int GET_EXPORTED_KEYS_VALUE = 7;
-    /**
-     * <code>GET_FUNCTION_COLUMNS = 8;</code>
-     */
-    public static final int GET_FUNCTION_COLUMNS_VALUE = 8;
-    /**
-     * <code>GET_FUNCTIONS = 9;</code>
-     */
-    public static final int GET_FUNCTIONS_VALUE = 9;
-    /**
-     * <code>GET_IMPORTED_KEYS = 10;</code>
-     */
-    public static final int GET_IMPORTED_KEYS_VALUE = 10;
-    /**
-     * <code>GET_INDEX_INFO = 11;</code>
-     */
-    public static final int GET_INDEX_INFO_VALUE = 11;
-    /**
-     * <code>GET_PRIMARY_KEYS = 12;</code>
-     */
-    public static final int GET_PRIMARY_KEYS_VALUE = 12;
-    /**
-     * <code>GET_PROCEDURE_COLUMNS = 13;</code>
-     */
-    public static final int GET_PROCEDURE_COLUMNS_VALUE = 13;
-    /**
-     * <code>GET_PROCEDURES = 14;</code>
-     */
-    public static final int GET_PROCEDURES_VALUE = 14;
-    /**
-     * <code>GET_PSEUDO_COLUMNS = 15;</code>
-     */
-    public static final int GET_PSEUDO_COLUMNS_VALUE = 15;
-    /**
-     * <code>GET_SCHEMAS = 16;</code>
-     */
-    public static final int GET_SCHEMAS_VALUE = 16;
-    /**
-     * <code>GET_SCHEMAS_WITH_ARGS = 17;</code>
-     */
-    public static final int GET_SCHEMAS_WITH_ARGS_VALUE = 17;
-    /**
-     * <code>GET_SUPER_TABLES = 18;</code>
-     */
-    public static final int GET_SUPER_TABLES_VALUE = 18;
-    /**
-     * <code>GET_SUPER_TYPES = 19;</code>
-     */
-    public static final int GET_SUPER_TYPES_VALUE = 19;
-    /**
-     * <code>GET_TABLE_PRIVILEGES = 20;</code>
-     */
-    public static final int GET_TABLE_PRIVILEGES_VALUE = 20;
-    /**
-     * <code>GET_TABLES = 21;</code>
-     */
-    public static final int GET_TABLES_VALUE = 21;
-    /**
-     * <code>GET_TABLE_TYPES = 22;</code>
-     */
-    public static final int GET_TABLE_TYPES_VALUE = 22;
-    /**
-     * <code>GET_TYPE_INFO = 23;</code>
-     */
-    public static final int GET_TYPE_INFO_VALUE = 23;
-    /**
-     * <code>GET_UDTS = 24;</code>
-     */
-    public static final int GET_UDTS_VALUE = 24;
-    /**
-     * <code>GET_VERSION_COLUMNS = 25;</code>
-     */
-    public static final int GET_VERSION_COLUMNS_VALUE = 25;
-
-
-    public final int getNumber() {
-      if (this == UNRECOGNIZED) {
-        throw new java.lang.IllegalArgumentException(
-            "Can't get the number of an unknown enum value.");
-      }
-      return value;
-    }
-
-    /**
-     * @deprecated Use {@link #forNumber(int)} instead.
-     */
-    @java.lang.Deprecated
-    public static MetaDataOperation valueOf(int value) {
-      return forNumber(value);
-    }
-
-    public static MetaDataOperation forNumber(int value) {
-      switch (value) {
-        case 0: return GET_ATTRIBUTES;
-        case 1: return GET_BEST_ROW_IDENTIFIER;
-        case 2: return GET_CATALOGS;
-        case 3: return GET_CLIENT_INFO_PROPERTIES;
-        case 4: return GET_COLUMN_PRIVILEGES;
-        case 5: return GET_COLUMNS;
-        case 6: return GET_CROSS_REFERENCE;
-        case 7: return GET_EXPORTED_KEYS;
-        case 8: return GET_FUNCTION_COLUMNS;
-        case 9: return GET_FUNCTIONS;
-        case 10: return GET_IMPORTED_KEYS;
-        case 11: return GET_INDEX_INFO;
-        case 12: return GET_PRIMARY_KEYS;
-        case 13: return GET_PROCEDURE_COLUMNS;
-        case 14: return GET_PROCEDURES;
-        case 15: return GET_PSEUDO_COLUMNS;
-        case 16: return GET_SCHEMAS;
-        case 17: return GET_SCHEMAS_WITH_ARGS;
-        case 18: return GET_SUPER_TABLES;
-        case 19: return GET_SUPER_TYPES;
-        case 20: return GET_TABLE_PRIVILEGES;
-        case 21: return GET_TABLES;
-        case 22: return GET_TABLE_TYPES;
-        case 23: return GET_TYPE_INFO;
-        case 24: return GET_UDTS;
-        case 25: return GET_VERSION_COLUMNS;
-        default: return null;
-      }
-    }
-
-    public static com.google.protobuf.Internal.EnumLiteMap<MetaDataOperation>
-        internalGetValueMap() {
-      return internalValueMap;
-    }
-    private static final com.google.protobuf.Internal.EnumLiteMap<
-        MetaDataOperation> internalValueMap =
-          new com.google.protobuf.Internal.EnumLiteMap<MetaDataOperation>() {
-            public MetaDataOperation findValueByNumber(int number) {
-              return MetaDataOperation.forNumber(number);
-            }
-          };
-
-    public final com.google.protobuf.Descriptors.EnumValueDescriptor
-        getValueDescriptor() {
-      return getDescriptor().getValues().get(ordinal());
-    }
-    public final com.google.protobuf.Descriptors.EnumDescriptor
-        getDescriptorForType() {
-      return getDescriptor();
-    }
-    public static final com.google.protobuf.Descriptors.EnumDescriptor
-        getDescriptor() {
-      return org.apache.calcite.avatica.proto.Common.getDescriptor().getEnumTypes().get(3);
-    }
-
-    private static final MetaDataOperation[] VALUES = values();
-
-    public static MetaDataOperation valueOf(
-        com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
-      if (desc.getType() != getDescriptor()) {
-        throw new java.lang.IllegalArgumentException(
-          "EnumValueDescriptor is not for this type.");
-      }
-      if (desc.getIndex() == -1) {
-        return UNRECOGNIZED;
-      }
-      return VALUES[desc.getIndex()];
-    }
-
-    private final int value;
-
-    private MetaDataOperation(int value) {
-      this.value = value;
-    }
-
-    // @@protoc_insertion_point(enum_scope:MetaDataOperation)
-  }
-
-  /**
-   * Protobuf enum {@code StateType}
-   */
-  public enum StateType
-      implements com.google.protobuf.ProtocolMessageEnum {
-    /**
-     * <code>SQL = 0;</code>
-     */
-    SQL(0),
-    /**
-     * <code>METADATA = 1;</code>
-     */
-    METADATA(1),
-    UNRECOGNIZED(-1),
-    ;
-
-    /**
-     * <code>SQL = 0;</code>
-     */
-    public static final int SQL_VALUE = 0;
-    /**
-     * <code>METADATA = 1;</code>
-     */
-    public static final int METADATA_VALUE = 1;
-
-
-    public final int getNumber() {
-      if (this == UNRECOGNIZED) {
-        throw new java.lang.IllegalArgumentException(
-            "Can't get the number of an unknown enum value.");
-      }
-      return value;
-    }
-
-    /**
-     * @deprecated Use {@link #forNumber(int)} instead.
-     */
-    @java.lang.Deprecated
-    public static StateType valueOf(int value) {
-      return forNumber(value);
-    }
-
-    public static StateType forNumber(int value) {
-      switch (value) {
-        case 0: return SQL;
-        case 1: return METADATA;
-        default: return null;
-      }
-    }
-
-    public static com.google.protobuf.Internal.EnumLiteMap<StateType>
-        internalGetValueMap() {
-      return internalValueMap;
-    }
-    private static final com.google.protobuf.Internal.EnumLiteMap<
-        StateType> internalValueMap =
-          new com.google.protobuf.Internal.EnumLiteMap<StateType>() {
-            public StateType findValueByNumber(int number) {
-              return StateType.forNumber(number);
-            }
-          };
-
-    public final com.google.protobuf.Descriptors.EnumValueDescriptor
-        getValueDescriptor() {
-      return getDescriptor().getValues().get(ordinal());
-    }
-    public final com.google.protobuf.Descriptors.EnumDescriptor
-        getDescriptorForType() {
-      return getDescriptor();
-    }
-    public static final com.google.protobuf.Descriptors.EnumDescriptor
-        getDescriptor() {
-      return org.apache.calcite.avatica.proto.Common.getDescriptor().getEnumTypes().get(4);
-    }
-
-    private static final StateType[] VALUES = values();
-
-    public static StateType valueOf(
-        com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
-      if (desc.getType() != getDescriptor()) {
-        throw new java.lang.IllegalArgumentException(
-          "EnumValueDescriptor is not for this type.");
-      }
-      if (desc.getIndex() == -1) {
-        return UNRECOGNIZED;
-      }
-      return VALUES[desc.getIndex()];
-    }
-
-    private final int value;
-
-    private StateType(int value) {
-      this.value = value;
-    }
-
-    // @@protoc_insertion_point(enum_scope:StateType)
-  }
-
-  public interface ConnectionPropertiesOrBuilder extends
-      // @@protoc_insertion_point(interface_extends:ConnectionProperties)
-      com.google.protobuf.MessageOrBuilder {
-
-    /**
-     * <code>optional bool is_dirty = 1;</code>
-     */
-    boolean getIsDirty();
-
-    /**
-     * <code>optional bool auto_commit = 2;</code>
-     */
-    boolean getAutoCommit();
-
-    /**
-     * <pre>
-     * field is a Boolean, need to discern null and default value
-     * </pre>
-     *
-     * <code>optional bool has_auto_commit = 7;</code>
-     */
-    boolean getHasAutoCommit();
-
-    /**
-     * <code>optional bool read_only = 3;</code>
-     */
-    boolean getReadOnly();
-
-    /**
-     * <pre>
-     * field is a Boolean, need to discern null and default value
-     * </pre>
-     *
-     * <code>optional bool has_read_only = 8;</code>
-     */
-    boolean getHasReadOnly();
-
-    /**
-     * <code>optional uint32 transaction_isolation = 4;</code>
-     */
-    int getTransactionIsolation();
-
-    /**
-     * <code>optional string catalog = 5;</code>
-     */
-    java.lang.String getCatalog();
-    /**
-     * <code>optional string catalog = 5;</code>
-     */
-    com.google.protobuf.ByteString
-        getCatalogBytes();
-
-    /**
-     * <code>optional string schema = 6;</code>
-     */
-    java.lang.String getSchema();
-    /**
-     * <code>optional string schema = 6;</code>
-     */
-    com.google.protobuf.ByteString
-        getSchemaBytes();
-  }
-  /**
-   * <pre>
-   * Details about a connection
-   * </pre>
-   *
-   * Protobuf type {@code ConnectionProperties}
-   */
-  public  static final class ConnectionProperties extends
-      com.google.protobuf.GeneratedMessageV3 implements
-      // @@protoc_insertion_point(message_implements:ConnectionProperties)
-      ConnectionPropertiesOrBuilder {
-    // Use ConnectionProperties.newBuilder() to construct.
-    private ConnectionProperties(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
-      super(builder);
-    }
-    private ConnectionProperties() {
-      isDirty_ = false;
-      autoCommit_ = false;
-      hasAutoCommit_ = false;
-      readOnly_ = false;
-      hasReadOnly_ = false;
-      transactionIsolation_ = 0;
-      catalog_ = "";
-      schema_ = "";
-    }
-
-    @java.lang.Override
-    public final com.google.protobuf.UnknownFieldSet
-    getUnknownFields() {
-      return com.google.protobuf.UnknownFieldSet.getDefaultInstance();
-    }
-    private ConnectionProperties(
-        com.google.protobuf.CodedInputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      this();
-      int mutable_bitField0_ = 0;
-      try {
-        boolean done = false;
-        while (!done) {
-          int tag = input.readTag();
-          switch (tag) {
-            case 0:
-              done = true;
-              break;
-            default: {
-              if (!input.skipField(tag)) {
-                done = true;
-              }
-              break;
-            }
-            case 8: {
-
-              isDirty_ = input.readBool();
-              break;
-            }
-            case 16: {
-
-              autoCommit_ = input.readBool();
-              break;
-            }
-            case 24: {
-
-              readOnly_ = input.readBool();
-              break;
-            }
-            case 32: {
-
-              transactionIsolation_ = input.readUInt32();
-              break;
-            }
-            case 42: {
-              java.lang.String s = input.readStringRequireUtf8();
-
-              catalog_ = s;
-              break;
-            }
-            case 50: {
-              java.lang.String s = input.readStringRequireUtf8();
-
-              schema_ = s;
-              break;
-            }
-            case 56: {
-
-              hasAutoCommit_ = input.readBool();
-              break;
-            }
-            case 64: {
-
-              hasReadOnly_ = input.readBool();
-              break;
-            }
-          }
-        }
-      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-        throw e.setUnfinishedMessage(this);
-      } catch (java.io.IOException e) {
-        throw new com.google.protobuf.InvalidProtocolBufferException(
-            e).setUnfinishedMessage(this);
-      } finally {
-        makeExtensionsImmutable();
-      }
-    }
-    public static final com.google.protobuf.Descriptors.Descriptor
-        getDescriptor() {
-      return org.apache.calcite.avatica.proto.Common.internal_static_ConnectionProperties_descriptor;
-    }
-
-    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
-        internalGetFieldAccessorTable() {
-      return org.apache.calcite.avatica.proto.Common.internal_static_ConnectionProperties_fieldAccessorTable
-          .ensureFieldAccessorsInitialized(
-              org.apache.calcite.avatica.proto.Common.ConnectionProperties.class, org.apache.calcite.avatica.proto.Common.ConnectionProperties.Builder.class);
-    }
-
-    public static final int IS_DIRTY_FIELD_NUMBER = 1;
-    private boolean isDirty_;
-    /**
-     * <code>optional bool is_dirty = 1;</code>
-     */
-    public boolean getIsDirty() {
-      return isDirty_;
-    }
-
-    public static final int AUTO_COMMIT_FIELD_NUMBER = 2;
-    private boolean autoCommit_;
-    /**
-     * <code>optional bool auto_commit = 2;</code>
-     */
-    public boolean getAutoCommit() {
-      return autoCommit_;
-    }
-
-    public static final int HAS_AUTO_COMMIT_FIELD_NUMBER = 7;
-    private boolean hasAutoCommit_;
-    /**
-     * <pre>
-     * field is a Boolean, need to discern null and default value
-     * </pre>
-     *
-     * <code>optional bool has_auto_commit = 7;</code>
-     */
-    public boolean getHasAutoCommit() {
-      return hasAutoCommit_;
-    }
-
-    public static final int READ_ONLY_FIELD_NUMBER = 3;
-    private boolean readOnly_;
-    /**
-     * <code>optional bool read_only = 3;</code>
-     */
-    public boolean getReadOnly() {
-      return readOnly_;
-    }
-
-    public static final int HAS_READ_ONLY_FIELD_NUMBER = 8;
-    private boolean hasReadOnly_;
-    /**
-     * <pre>
-     * field is a Boolean, need to discern null and default value
-     * </pre>
-     *
-     * <code>optional bool has_read_only = 8;</code>
-     */
-    public boolean getHasReadOnly() {
-      return hasReadOnly_;
-    }
-
-    public static final int TRANSACTION_ISOLATION_FIELD_NUMBER = 4;
-    private int transactionIsolation_;
-    /**
-     * <code>optional uint32 transaction_isolation = 4;</code>
-     */
-    public int getTransactionIsolation() {
-      return transactionIsolation_;
-    }
-
-    public static final int CATALOG_FIELD_NUMBER = 5;
-    private volatile java.lang.Object catalog_;
-    /**
-     * <code>optional string catalog = 5;</code>
-     */
-    public java.lang.String getCatalog() {
-      java.lang.Object ref = catalog_;
-      if (ref instanceof java.lang.String) {
-        return (java.lang.String) ref;
-      } else {
-        com.google.protobuf.ByteString bs = 
-            (com.google.protobuf.ByteString) ref;
-        java.lang.String s = bs.toStringUtf8();
-        catalog_ = s;
-        return s;
-      }
-    }
-    /**
-     * <code>optional string catalog = 5;</code>
-     */
-    public com.google.protobuf.ByteString
-        getCatalogBytes() {
-      java.lang.Object ref = catalog_;
-      if (ref instanceof java.lang.String) {
-        com.google.protobuf.ByteString b = 
-            com.google.protobuf.ByteString.copyFromUtf8(
-                (java.lang.String) ref);
-        catalog_ = b;
-        return b;
-      } else {
-        return (com.google.protobuf.ByteString) ref;
-      }
-    }
-
-    public static final int SCHEMA_FIELD_NUMBER = 6;
-    private volatile java.lang.Object schema_;
-    /**
-     * <code>optional string schema = 6;</code>
-     */
-    public java.lang.String getSchema() {
-      java.lang.Object ref = schema_;
-      if (ref instanceof java.lang.String) {
-        return (java.lang.String) ref;
-      } else {
-        com.google.protobuf.ByteString bs = 
-            (com.google.protobuf.ByteString) ref;
-        java.lang.String s = bs.toStringUtf8();
-        schema_ = s;
-        return s;
-      }
-    }
-    /**
-     * <code>optional string schema = 6;</code>
-     */
-    public com.google.protobuf.ByteString
-        getSchemaBytes() {
-      java.lang.Object ref = schema_;
-      if (ref instanceof java.lang.String) {
-        com.google.protobuf.ByteString b = 
-            com.google.protobuf.ByteString.copyFromUtf8(
-                (java.lang.String) ref);
-        schema_ = b;
-        return b;
-      } else {
-        return (com.google.protobuf.ByteString) ref;
-      }
-    }
-
-    private byte memoizedIsInitialized = -1;
-    public final boolean isInitialized() {
-      byte isInitialized = memoizedIsInitialized;
-      if (isInitialized == 1) return true;
-      if (isInitialized == 0) return false;
-
-      memoizedIsInitialized = 1;
-      return true;
-    }
-
-    public void writeTo(com.google.protobuf.CodedOutputStream output)
-                        throws java.io.IOException {
-      if (isDirty_ != false) {
-        output.writeBool(1, isDirty_);
-      }
-      if (autoCommit_ != false) {
-        output.writeBool(2, autoCommit_);
-      }
-      if (readOnly_ != false) {
-        output.writeBool(3, readOnly_);
-      }
-      if (transactionIsolation_ != 0) {
-        output.writeUInt32(4, transactionIsolation_);
-      }
-      if (!getCatalogBytes().isEmpty()) {
-        com.google.protobuf.GeneratedMessageV3.writeString(output, 5, catalog_);
-      }
-      if (!getSchemaBytes().isEmpty()) {
-        com.google.protobuf.GeneratedMessageV3.writeString(output, 6, schema_);
-      }
-      if (hasAutoCommit_ != false) {
-        output.writeBool(7, hasAutoCommit_);
-      }
-      if (hasReadOnly_ != false) {
-        output.writeBool(8, hasReadOnly_);
-      }
-    }
-
-    public int getSerializedSize() {
-      int size = memoizedSize;
-      if (size != -1) return size;
-
-      size = 0;
-      if (isDirty_ != false) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeBoolSize(1, isDirty_);
-      }
-      if (autoCommit_ != false) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeBoolSize(2, autoCommit_);
-      }
-      if (readOnly_ != false) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeBoolSize(3, readOnly_);
-      }
-      if (transactionIsolation_ != 0) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeUInt32Size(4, transactionIsolation_);
-      }
-      if (!getCatalogBytes().isEmpty()) {
-        size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, catalog_);
-      }
-      if (!getSchemaBytes().isEmpty()) {
-        size += com.google.protobuf.GeneratedMessageV3.computeStringSize(6, schema_);
-      }
-      if (hasAutoCommit_ != false) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeBoolSize(7, hasAutoCommit_);
-      }
-      if (hasReadOnly_ != false) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeBoolSize(8, hasReadOnly_);
-      }
-      memoizedSize = size;
-      return size;
-    }
-
-    private static final long serialVersionUID = 0L;
-    @java.lang.Override
-    public boolean equals(final java.lang.Object obj) {
-      if (obj == this) {
-       return true;
-      }
-      if (!(obj instanceof org.apache.calcite.avatica.proto.Common.ConnectionProperties)) {
-        return super.equals(obj);
-      }
-      org.apache.calcite.avatica.proto.Common.ConnectionProperties other = (org.apache.calcite.avatica.proto.Common.ConnectionProperties) obj;
-
-      boolean result = true;
-      result = result && (getIsDirty()
-          == other.getIsDirty());
-      result = result && (getAutoCommit()
-          == other.getAutoCommit());
-      result = result && (getHasAutoCommit()
-          == other.getHasAutoCommit());
-      result = result && (getReadOnly()
-          == other.getReadOnly());
-      result = result && (getHasReadOnly()
-          == other.getHasReadOnly());
-      result = result && (getTransactionIsolation()
-          == other.getTransactionIsolation());
-      result = result && getCatalog()
-          .equals(other.getCatalog());
-      result = result && getSchema()
-          .equals(other.getSchema());
-      return result;
-    }
-
-    @java.lang.Override
-    public int hashCode() {
-      if (memoizedHashCode != 0) {
-        return memoizedHashCode;
-      }
-      int hash = 41;
-      hash = (19 * hash) + getDescriptorForType().hashCode();
-      hash = (37 * hash) + IS_DIRTY_FIELD_NUMBER;
-      hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(
-          getIsDirty());
-      hash = (37 * hash) + AUTO_COMMIT_FIELD_NUMBER;
-      hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(
-          getAutoCommit());
-      hash = (37 * hash) + HAS_AUTO_COMMIT_FIELD_NUMBER;
-      hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(
-          getHasAutoCommit());
-      hash = (37 * hash) + READ_ONLY_FIELD_NUMBER;
-      hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(
-          getReadOnly());
-      hash = (37 * hash) + HAS_READ_ONLY_FIELD_NUMBER;
-      hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(
-          getHasReadOnly());
-      hash = (37 * hash) + TRANSACTION_ISOLATION_FIELD_NUMBER;
-      hash = (53 * hash) + getTransactionIsolation();
-      hash = (37 * hash) + CATALOG_FIELD_NUMBER;
-      hash = (53 * hash) + getCatalog().hashCode();
-      hash = (37 * hash) + SCHEMA_FIELD_NUMBER;
-      hash = (53 * hash) + getSchema().hashCode();
-      hash = (29 * hash) + unknownFields.hashCode();
-      memoizedHashCode = hash;
-      return hash;
-    }
-
-    public static org.apache.calcite.avatica.proto.Common.ConnectionProperties parseFrom(
-        com.google.protobuf.ByteString data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.apache.calcite.avatica.proto.Common.ConnectionProperties parseFrom(
-        com.google.protobuf.ByteString data,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data, extensionRegistry);
-    }
-    public static org.apache.calcite.avatica.proto.Common.ConnectionProperties parseFrom(byte[] data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.apache.calcite.avatica.proto.Common.ConnectionProperties parseFrom(
-        byte[] data,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data, extensionRegistry);
-    }
-    public static org.apache.calcite.avatica.proto.Common.ConnectionProperties parseFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseWithIOException(PARSER, input);
-    }
-    public static org.apache.calcite.avatica.proto.Common.ConnectionProperties parseFrom(
-        java.io.InputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseWithIOException(PARSER, input, extensionRegistry);
-    }
-    public static org.apache.calcite.avatica.proto.Common.ConnectionProperties parseDelimitedFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseDelimitedWithIOException(PARSER, input);
-    }
-    public static org.apache.calcite.avatica.proto.Common.ConnectionProperties parseDelimitedFrom(
-        java.io.InputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
-    }
-    public static org.apache.calcite.avatica.proto.Common.ConnectionProperties parseFrom(
-        com.google.protobuf.CodedInputStream input)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseWithIOException(PARSER, input);
-    }
-    public static org.apache.calcite.avatica.proto.Common.ConnectionProperties parseFrom(
-        com.google.protobuf.CodedInputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseWithIOException(PARSER, input, extensionRegistry);
-    }
-
-    public Builder newBuilderForType() { return newBuilder(); }
-    public static Builder newBuilder() {
-      return DEFAULT_INSTANCE.toBuilder();
-    }
-    public static Builder newBuilder(org.apache.calcite.avatica.proto.Common.ConnectionProperties prototype) {
-      return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
-    }
-    public Builder toBuilder() {
-      return this == DEFAULT_INSTANCE
-          ? new Builder() : new Builder().mergeFrom(this);
-    }
-
-    @java.lang.Override
-    protected Builder newBuilderForType(
-        com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
-      Builder builder = new Builder(parent);
-      return builder;
-    }
-    /**
-     * <pre>
-     * Details about a connection
-     * </pre>
-     *
-     * Protobuf type {@code ConnectionProperties}
-     */
-    public static final class Builder extends
-        com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
-        // @@protoc_insertion_point(builder_implements:ConnectionProperties)
-        org.apache.calcite.avatica.proto.Common.ConnectionPropertiesOrBuilder {
-      public static final com.google.protobuf.Descriptors.Descriptor
-          getDescriptor() {
-        return org.apache.calcite.avatica.proto.Common.internal_static_ConnectionProperties_descriptor;
-      }
-
-      protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
-          internalGetFieldAccessorTable() {
-        return org.apache.calcite.avatica.proto.Common.internal_static_ConnectionProperties_fieldAccessorTable
-            .ensureFieldAccessorsInitialized(
-                org.apache.calcite.avatica.proto.Common.ConnectionProperties.class, org.apache.calcite.avatica.proto.Common.ConnectionProperties.Builder.class);
-      }
-
-      // Construct using org.apache.calcite.avatica.proto.Common.ConnectionProperties.newBuilder()
-      private Builder() {
-        maybeForceBuilderInitialization();
-      }
-
-      private Builder(
-          com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
-        super(parent);
-        maybeForceBuilderInitialization();
-      }
-      private void maybeForceBuilderInitialization() {
-        if (com.google.protobuf.GeneratedMessageV3
-                .alwaysUseFieldBuilders) {
-        }
-      }
-      public Builder clear() {
-        super.clear();
-        isDirty_ = false;
-
-        autoCommit_ = false;
-
-        hasAutoCommit_ = false;
-
-        readOnly_ = false;
-
-        hasReadOnly_ = false;
-
-        transactionIsolation_ = 0;
-
-        catalog_ = "";
-
-        schema_ = "";
-
-        return this;
-      }
-
-      public com.google.protobuf.Descriptors.Descriptor
-          getDescriptorForType() {
-        return org.apache.calcite.avatica.proto.Common.internal_static_ConnectionProperties_descriptor;
-      }
-
-      public org.apache.calcite.avatica.proto.Common.ConnectionProperties getDefaultInstanceForType() {
-        return org.apache.calcite.avatica.proto.Common.ConnectionProperties.getDefaultInstance();
-      }
-
-      public org.apache.calcite.avatica.proto.Common.ConnectionProperties build() {
-        org.apache.calcite.avatica.proto.Common.ConnectionProperties result = buildPartial();
-        if (!result.isInitialized()) {
-          throw newUninitializedMessageException(result);
-        }
-        return result;
-      }
-
-      public org.apache.calcite.avatica.proto.Common.ConnectionProperties buildPartial() {
-        org.apache.calcite.avatica.proto.Common.ConnectionProperties result = new org.apache.calcite.avatica.proto.Common.ConnectionProperties(this);
-        result.isDirty_ = isDirty_;
-        result.autoCommit_ = autoCommit_;
-        result.hasAutoCommit_ = hasAutoCommit_;
-        result.readOnly_ = readOnly_;
-        result.hasReadOnly_ = hasReadOnly_;
-        result.transactionIsolation_ = transactionIsolation_;
-        result.catalog_ = catalog_;
-        result.schema_ = schema_;
-        onBuilt();
-        return result;
-      }
-
-      public Builder clone() {
-        return (Builder) super.clone();
-      }
-      public Builder setField(
-          com.google.protobuf.Descriptors.FieldDescriptor field,
-          Object value) {
-        return (Builder) super.setField(field, value);
-      }
-      public Builder clearField(
-          com.google.protobuf.Descriptors.FieldDescriptor field) {
-        return (Builder) super.clearField(field);
-      }
-      public Builder clearOneof(
-          com.google.protobuf.Descriptors.OneofDescriptor oneof) {
-        return (Builder) super.clearOneof(oneof);
-      }
-      public Builder setRepeatedField(
-          com.google.protobuf.Descriptors.FieldDescriptor field,
-          int index, Object value) {
-        return (Builder) super.setRepeatedField(field, index, value);
-      }
-      public Builder addRepeatedField(
-          com.google.protobuf.Descriptors.FieldDescriptor field,
-          Object value) {
-        return (Builder) super.addRepeatedField(field, value);
-      }
-      public Builder mergeFrom(com.google.protobuf.Message other) {
-        if (other instanceof org.apache.calcite.avatica.proto.Common.ConnectionProperties) {
-          return mergeFrom((org.apache.calcite.avatica.proto.Common.ConnectionProperties)other);
-        } else {
-          super.mergeFrom(other);
-          return this;
-        }
-      }
-
-      public Builder mergeFrom(org.apache.calcite.avatica.proto.Common.ConnectionProperties other) {
-        if (other == org.apache.calcite.avatica.proto.Common.ConnectionProperties.getDefaultInstance()) return this;
-        if (other.getIsDirty() != false) {
-          setIsDirty(other.getIsDirty());
-        }
-        if (other.getAutoCommit() != false) {
-          setAutoCommit(other.getAutoCommit());
-        }
-        if (other.getHasAutoCommit() != false) {
-          setHasAutoCommit(other.getHasAutoCommit());
-        }
-        if (other.getReadOnly() != false) {
-          setReadOnly(other.getReadOnly());
-        }
-        if (other.getHasReadOnly() != false) {
-          setHasReadOnly(other.getHasReadOnly());
-        }
-        if (other.getTransactionIsolation() != 0) {
-          setTransactionIsolation(other.getTransactionIsolation());
-        }
-        if (!other.getCatalog().isEmpty()) {
-          catalog_ = other.catalog_;
-          onChanged();
-        }
-        if (!other.getSchema().isEmpty()) {
-          schema_ = other.schema_;
-          onChanged();
-        }
-        onChanged();
-        return this;
-      }
-
-      public final boolean isInitialized() {
-        return true;
-      }
-
-      public Builder mergeFrom(
-          com.google.protobuf.CodedInputStream input,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws java.io.IOException {
-        org.apache.calcite.avatica.proto.Common.ConnectionProperties parsedMessage = null;
-        try {
-          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
-        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-          parsedMessage = (org.apache.calcite.avatica.proto.Common.ConnectionProperties) e.getUnfinishedMessage();
-          throw e.unwrapIOException();
-        } finally {
-          if (parsedMessage != null) {
-            mergeFrom(parsedMessage);
-          }
-        }
-        return this;
-      }
-
-      private boolean isDirty_ ;
-      /**
-       * <code>optional bool is_dirty = 1;</code>
-       */
-      public boolean getIsDirty() {
-        return isDirty_;
-      }
-      /**
-       * <code>optional bool is_dirty = 1;</code>
-       */
-      public Builder setIsDirty(boolean value) {
-        
-        isDirty_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>optional bool is_dirty = 1;</code>
-       */
-      public Builder clearIsDirty() {
-        
-        isDirty_ = false;
-        onChanged();
-        return this;
-      }
-
-      private boolean autoCommit_ ;
-      /**
-       * <code>optional bool auto_commit = 2;</code>
-       */
-      public boolean getAutoCommit() {
-        return autoCommit_;
-      }
-      /**
-       * <code>optional bool auto_commit = 2;</code>
-       */
-      public Builder setAutoCommit(boolean value) {
-        
-        autoCommit_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>optional bool auto_commit = 2;</code>
-       */
-      public Builder clearAutoCommit() {
-        
-        autoCommit_ = false;
-        onChanged();
-        return this;
-      }
-
-      private boolean hasAutoCommit_ ;
-      /**
-       * <pre>
-       * field is a Boolean, need to discern null and default value
-       * </pre>
-       *
-       * <code>optional bool has_auto_commit = 7;</code>
-       */
-      public boolean getHasAutoCommit() {
-        return hasAutoCommit_;
-      }
-      /**
-       * <pre>
-       * field is a Boolean, need to discern null and default value
-       * </pre>
-       *
-       * <code>optional bool has_auto_commit = 7;</code>
-       */
-      public Builder setHasAutoCommit(boolean value) {
-        
-        hasAutoCommit_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <pre>
-       * field is a Boolean, need to discern null and default value
-       * </pre>
-       *
-       * <code>optional bool has_auto_commit = 7;</code>
-       */
-      public Builder clearHasAutoCommit() {
-        
-        hasAutoCommit_ = false;
-        onChanged();
-        return this;
-      }
-
-      private boolean readOnly_ ;
-      /**
-       * <code>optional bool read_only = 3;</code>
-       */
-      public boolean getReadOnly() {
-        return readOnly_;
-      }
-      /**
-       * <code>optional bool read_only = 3;</code>
-       */
-      public Builder setReadOnly(boolean value) {
-        
-        readOnly_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>optional bool read_only = 3;</code>
-       */
-      public Builder clearReadOnly() {
-        
-        readOnly_ = false;
-        onChanged();
-        return this;
-      }
-
-      private boolean hasReadOnly_ ;
-      /**
-       * <pre>
-       * field is a Boolean, need to discern null and default value
-       * </pre>
-       *
-       * <code>optional bool has_read_only = 8;</code>
-       */
-      public boolean getHasReadOnly() {
-        return hasReadOnly_;
-      }
-      /**
-       * <pre>
-       * field is a Boolean, need to discern null and default value
-       * </pre>
-       *
-       * <code>optional bool has_read_only = 8;</code>
-       */
-      public Builder setHasReadOnly(boolean value) {
-        
-        hasReadOnly_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <pre>
-       * field is a Boolean, need to discern null and default value
-       * </pre>
-       *
-       * <code>optional bool has_read_only = 8;</code>
-       */
-      public Builder clearHasReadOnly() {
-        
-        hasReadOnly_ = false;
-        onChanged();
-        return this;
-      }
-
-      private int transactionIsolation_ ;
-      /**
-       * <code>optional uint32 transaction_isolation = 4;</code>
-       */
-      public int getTransactionIsolation() {
-        return transactionIsolation_;
-      }
-      /**
-       * <code>optional uint32 transaction_isolation = 4;</code>
-       */
-      public Builder setTransactionIsolation(int value) {
-        
-        transactionIsolation_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>optional uint32 transaction_isolation = 4;</code>
-       */
-      public Builder clearTransactionIsolation() {
-        
-        transactionIsolation_ = 0;
-        onChanged();
-        return this;
-      }
-
-      private java.lang.Object catalog_ = "";
-      /**
-       * <code>optional string catalog = 5;</code>
-       */
-      public java.lang.String getCatalog() {
-        java.lang.Object ref = catalog_;
-        if (!(ref instanceof java.lang.String)) {
-          com.google.protobuf.ByteString bs =
-              (com.google.protobuf.ByteString) ref;
-          java.lang.String s = bs.toStringUtf8();
-          catalog_ = s;
-          return s;
-        } else {
-          return (java.lang.String) ref;
-        }
-      }
-      /**
-       * <code>optional string catalog = 5;</code>
-       */
-      public com.google.protobuf.ByteString
-          getCatalogBytes() {
-        java.lang.Object ref = catalog_;
-        if (ref instanceof String) {
-          com.google.protobuf.ByteString b = 
-              com.google.protobuf.ByteString.copyFromUtf8(
-                  (java.lang.String) ref);
-          catalog_ = b;
-          return b;
-        } else {
-          return (com.google.protobuf.ByteString) ref;
-        }
-      }
-      /**
-       * <code>optional string catalog = 5;</code>
-       */
-      public Builder setCatalog(
-          java.lang.String value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  
-        catalog_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>optional string catalog = 5;</code>
-       */
-      public Builder clearCatalog() {
-        
-        catalog_ = getDefaultInstance().getCatalog();
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>optional string catalog = 5;</code>
-       */
-      public Builder setCatalogBytes(
-          com.google.protobuf.ByteString value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  checkByteStringIsUtf8(value);
-        
-        catalog_ = value;
-        onChanged();
-        return this;
-      }
-
-      private java.lang.Object schema_ = "";
-      /**
-       * <code>optional string schema = 6;</code>
-       */
-      public java.lang.String getSchema() {
-        java.lang.Object ref = schema_;
-        if (!(ref instanceof java.lang.String)) {
-          com.google.protobuf.ByteString bs =
-              (com.google.protobuf.ByteString) ref;
-          java.lang.String s = bs.toStringUtf8();
-          schema_ = s;
-          return s;
-        } else {
-          return (java.lang.String) ref;
-        }
-      }
-      /**
-       * <code>optional string schema = 6;</code>
-       */
-      public com.google.protobuf.ByteString
-          getSchemaBytes() {
-        java.lang.Object ref = schema_;
-        if (ref instanceof String) {
-          com.google.protobuf.ByteString b = 
-              com.google.protobuf.ByteString.copyFromUtf8(
-                  (java.lang.String) ref);
-          schema_ = b;
-          return b;
-        } else {
-          return (com.google.protobuf.ByteString) ref;
-        }
-      }
-      /**
-       * <code>optional string schema = 6;</code>
-       */
-      public Builder setSchema(
-          java.lang.String value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  
-        schema_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>optional string schema = 6;</code>
-       */
-      public Builder clearSchema() {
-        
-        schema_ = getDefaultInstance().getSchema();
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>optional string schema = 6;</code>
-       */
-      public Builder setSchemaBytes(
-          com.google.protobuf.ByteString value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  checkByteStringIsUtf8(value);
-        
-        schema_ = value;
-        onChanged();
-        return this;
-      }
-      public final Builder setUnknownFields(
-          final com.google.protobuf.UnknownFieldSet unknownFields) {
-        return this;
-      }
-
-      public final Builder mergeUnknownFields(
-          final com.google.protobuf.UnknownFieldSet unknownFields) {
-        return this;
-      }
-
-
-      // @@protoc_insertion_point(builder_scope:ConnectionProperties)
-    }
-
-    // @@protoc_insertion_point(class_scope:ConnectionProperties)
-    private static final org.apache.calcite.avatica.proto.Common.ConnectionProperties DEFAULT_INSTANCE;
-    static {
-      DEFAULT_INSTANCE = new org.apache.calcite.avatica.proto.Common.ConnectionProperties();
-    }
-
-    public static org.apache.calcite.avatica.proto.Common.ConnectionProperties getDefaultInstance() {
-      return DEFAULT_INSTANCE;
-    }
-
-    private static final com.google.protobuf.Parser<ConnectionProperties>
-        PARSER = new com.google.protobuf.AbstractParser<ConnectionProperties>() {
-      public ConnectionProperties parsePartialFrom(
-          com.google.protobuf.CodedInputStream input,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws com.google.protobuf.InvalidProtocolBufferException {
-          return new ConnectionProperties(input, extensionRegistry);
-      }
-    };
-
-    public static com.google.protobuf.Parser<ConnectionProperties> parser() {
-      return PARSER;
-    }
-
-    @java.lang.Override
-    public com.google.protobuf.Parser<ConnectionProperties> getParserForType() {
-      return PARSER;
-    }
-
-    public org.apache.calcite.avatica.proto.Common.ConnectionProperties getDefaultInstanceForType() {
-      return DEFAULT_INSTANCE;
-    }
-
-  }
-
-  public interface StatementHandleOrBuilder extends
-      // @@protoc_insertion_point(interface_extends:StatementHandle)
-      com.google.protobuf.MessageOrBuilder {
-
-    /**
-     * <code>optional string connection_id = 1;</code>
-     */
-    java.lang.String getConnectionId();
-    /**
-     * <code>optional string connection_id = 1;</code>
-     */
-    com.google.protobuf.ByteString
-        getConnectionIdBytes();
-
-    /**
-     * <code>optional uint32 id = 2;</code>
-     */
-    int getId();
-
-    /**
-     * <code>optional .Signature signature = 3;</code>
-     */
-    boolean hasSignature();
-    /**
-     * <code>optional .Signature signature = 3;</code>
-     */
-    org.apache.calcite.avatica.proto.Common.Signature getSignature();
-    /**
-     * <code>optional .Signature signature = 3;</code>
-     */
-    org.apache.calcite.avatica.proto.Common.SignatureOrBuilder getSignatureOrBuilder();
-  }
-  /**
-   * <pre>
-   * Statement handle
-   * </pre>
-   *
-   * Protobuf type {@code StatementHandle}
-   */
-  public  static final class StatementHandle extends
-      com.google.protobuf.GeneratedMessageV3 implements
-      // @@protoc_insertion_point(message_implements:StatementHandle)
-      StatementHandleOrBuilder {
-    // Use StatementHandle.newBuilder() to construct.
-    private StatementHandle(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
-      super(builder);
-    }
-    private StatementHandle() {
-      connectionId_ = "";
-      id_ = 0;
-    }
-
-    @java.lang.Override
-    public final com.google.protobuf.UnknownFieldSet
-    getUnknownFields() {
-      return com.google.protobuf.UnknownFieldSet.getDefaultInstance();
-    }
-    private StatementHandle(
-        com.google.protobuf.CodedInputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      this();
-      int mutable_bitField0_ = 0;
-      try {
-        boolean done = false;
-        while (!done) {
-          int tag = input.readTag();
-          switch (tag) {
-            case 0:
-              done = true;
-              break;
-            default: {
-              if (!input.skipField(tag)) {
-                done = true;
-              }
-              break;
-            }
-            case 10: {
-              java.lang.String s = input.readStringRequireUtf8();
-
-              connectionId_ = s;
-              break;
-            }
-            case 16: {
-
-              id_ = input.readUInt32();
-              break;
-            }
-            case 26: {
-              org.apache.calcite.avatica.proto.Common.Signature.Builder subBuilder = null;
-              if (signature_ != null) {
-                subBuilder = signature_.toBuilder();
-              }
-              signature_ = input.readMessage(org.apache.calcite.avatica.proto.Common.Signature.parser(), extensionRegistry);
-              if (subBuilder != null) {
-                subBuilder.mergeFrom(signature_);
-                signature_ = subBuilder.buildPartial();
-              }
-
-              break;
-            }
-          }
-        }
-      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-        throw e.setUnfinishedMessage(this);
-      } catch (java.io.IOException e) {
-        throw new com.google.protobuf.InvalidProtocolBufferException(
-            e).setUnfinishedMessage(this);
-      } finally {
-        makeExtensionsImmutable();
-      }
-    }
-    public static final com.google.protobuf.Descriptors.Descriptor
-        getDescriptor() {
-      return org.apache.calcite.avatica.proto.Common.internal_static_StatementHandle_descriptor;
-    }
-
-    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
-        internalGetFieldAccessorTable() {
-      return org.apache.calcite.avatica.proto.Common.internal_static_StatementHandle_fieldAccessorTable
-          .ensureFieldAccessorsInitialized(
-              org.apache.calcite.avatica.proto.Common.StatementHandle.class, org.apache.calcite.avatica.proto.Common.StatementHandle.Builder.class);
-    }
-
-    public static final int CONNECTION_ID_FIELD_NUMBER = 1;
-    private volatile java.lang.Object connectionId_;
-    /**
-     * <code>optional string connection_id = 1;</code>
-     */
-    public java.lang.String getConnectionId() {
-      java.lang.Object ref = connectionId_;
-      if (ref instanceof java.lang.String) {
-        return (java.lang.String) ref;
-      } else {
-        com.google.protobuf.ByteString bs = 
-            (com.google.protobuf.ByteString) ref;
-        java.lang.String s = bs.toStringUtf8();
-        connectionId_ = s;
-        return s;
-      }
-    }
-    /**
-     * <code>optional string connection_id = 1;</code>
-     */
-    public com.google.protobuf.ByteString
-        getConnectionIdBytes() {
-      java.lang.Object ref = connectionId_;
-      if (ref instanceof java.lang.String) {
-        com.google.protobuf.ByteString b = 
-            com.google.protobuf.ByteString.copyFromUtf8(
-                (java.lang.String) ref);
-        connectionId_ = b;
-        return b;
-      } else {
-        return (com.google.protobuf.ByteString) ref;
-      }
-    }
-
-    public static final int ID_FIELD_NUMBER = 2;
-    private int id_;
-    /**
-     * <code>optional uint32 id = 2;</code>
-     */
-    public int getId() {
-      return id_;
-    }
-
-    public static final int SIGNATURE_FIELD_NUMBER = 3;
-    private org.apache.calcite.avatica.proto.Common.Signature signature_;
-    /**
-     * <code>optional .Signature signature = 3;</code>
-     */
-    public boolean hasSignature() {
-      return signature_ != null;
-    }
-    /**
-     * <code>optional .Signature signature = 3;</code>
-     */
-    public org.apache.calcite.avatica.proto.Common.Signature getSignature() {
-      return signature_ == null ? org.apache.calcite.avatica.proto.Common.Signature.getDefaultInstance() : signature_;
-    }
-    /**
-     * <code>optional .Signature signature = 3;</code>
-     */
-    public org.apache.calcite.avatica.proto.Common.SignatureOrBuilder getSignatureOrBuilder() {
-      return getSignature();
-    }
-
-    private byte memoizedIsInitialized = -1;
-    public final boolean isInitialized() {
-      byte isInitialized = memoizedIsInitialized;
-      if (isInitialized == 1) return true;
-      if (isInitialized == 0) return false;
-
-      memoizedIsInitialized = 1;
-      return true;
-    }
-
-    public void writeTo(com.google.protobuf.CodedOutputStream output)
-                        throws java.io.IOException {
-      if (!getConnectionIdBytes().isEmpty()) {
-        com.google.protobuf.GeneratedMessageV3.writeString(output, 1, connectionId_);
-      }
-      if (id_ != 0) {
-        output.writeUInt32(2, id_);
-      }
-      if (signature_ != null) {
-        output.writeMessage(3, getSignature());
-      }
-    }
-
-    public int getSerializedSize() {
-      int size = memoizedSize;
-      if (size != -1) return size;
-
-      size = 0;
-      if (!getConnectionIdBytes().isEmpty()) {
-        size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, connectionId_);
-      }
-      if (id_ != 0) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeUInt32Size(2, id_);
-      }
-      if (signature_ != null) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeMessageSize(3, getSignature());
-      }
-      memoizedSize = size;
-      return size;
-    }
-
-    private static final long serialVersionUID = 0L;
-    @java.lang.Override
-    public boolean equals(final java.lang.Object obj) {
-      if (obj == this) {
-       return true;
-      }
-      if (!(obj instanceof org.apache.calcite.avatica.proto.Common.StatementHandle)) {
-        return super.equals(obj);
-      }
-      org.apache.calcite.avatica.proto.Common.StatementHandle other = (org.apache.calcite.avatica.proto.Common.StatementHandle) obj;
-
-      boolean result = true;
-      result = result && getConnectionId()
-          .equals(other.getConnectionId());
-      result = result && (getId()
-          == other.getId());
-      result = result && (hasSignature() == other.hasSignature());
-      if (hasSignature()) {
-        result = result && getSignature()
-            .equals(other.getSignature());
-      }
-      return result;
-    }
-
-    @java.lang.Override
-    public int hashCode() {
-      if (memoizedHashCode != 0) {
-        return memoizedHashCode;
-      }
-      int hash = 41;
-      hash = (19 * hash) + getDescriptorForType().hashCode();
-      hash = (37 * hash) + CONNECTION_ID_FIELD_NUMBER;
-      hash = (53 * hash) + getConnectionId().hashCode();
-      hash = (37 * hash) + ID_FIELD_NUMBER;
-      hash = (53 * hash) + getId();
-      if (hasSignature()) {
-        hash = (37 * hash) + SIGNATURE_FIELD_NUMBER;
-        hash = (53 * hash) + getSignature().hashCode();
-      }
-      hash = (29 * hash) + unknownFields.hashCode();
-      memoizedHashCode = hash;
-      return hash;
-    }
-
-    public static org.apache.calcite.avatica.proto.Common.StatementHandle parseFrom(
-        com.google.protobuf.ByteString data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.apache.calcite.avatica.proto.Common.StatementHandle parseFrom(
-        com.google.protobuf.ByteString data,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data, extensionRegistry);
-    }
-    public static org.apache.calcite.avatica.proto.Common.StatementHandle parseFrom(byte[] data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.apache.calcite.avatica.proto.Common.StatementHandle parseFrom(
-        byte[] data,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data, extensionRegistry);
-    }
-    public static org.apache.calcite.avatica.proto.Common.StatementHandle parseFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseWithIOException(PARSER, input);
-    }
-    public static org.apache.calcite.avatica.proto.Common.StatementHandle parseFrom(
-        java.io.InputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseWithIOException(PARSER, input, extensionRegistry);
-    }
-    public static org.apache.calcite.avatica.proto.Common.StatementHandle parseDelimitedFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseDelimitedWithIOException(PARSER, input);
-    }
-    public static org.apache.calcite.avatica.proto.Common.StatementHandle parseDelimitedFrom(
-        java.io.InputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
-    }
-    public static org.apache.calcite.avatica.proto.Common.StatementHandle parseFrom(
-        com.google.protobuf.CodedInputStream input)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseWithIOException(PARSER, input);
-    }
-    public static org.apache.calcite.avatica.proto.Common.StatementHandle parseFrom(
-        com.google.protobuf.CodedInputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseWithIOException(PARSER, input, extensionRegistry);
-    }
-
-    public Builder newBuilderForType() { return newBuilder(); }
-    public static Builder newBuilder() {
-      return DEFAULT_INSTANCE.toBuilder();
-    }
-    public static Builder newBuilder(org.apache.calcite.avatica.proto.Common.StatementHandle prototype) {
-      return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
-    }
-    public Builder toBuilder() {
-      return this == DEFAULT_INSTANCE
-          ? new Builder() : new Builder().mergeFrom(this);
-    }
-
-    @java.lang.Override
-    protected Builder newBuilderForType(
-        com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
-      Builder builder = new Builder(parent);
-      return builder;
-    }
-    /**
-     * <pre>
-     * Statement handle
-     * </pre>
-     *
-     * Protobuf type {@code StatementHandle}
-     */
-    public static final class Builder extends
-        com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
-        // @@protoc_insertion_point(builder_implements:StatementHandle)
-        org.apache.calcite.avatica.proto.Common.StatementHandleOrBuilder {
-      public static final com.google.protobuf.Descriptors.Descriptor
-          getDescriptor() {
-        return org.apache.calcite.avatica.proto.Common.internal_static_StatementHandle_descriptor;
-      }
-
-      protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
-          internalGetFieldAccessorTable() {
-        return org.apache.calcite.avatica.proto.Common.internal_static_StatementHandle_fieldAccessorTable
-            .ensureFieldAccessorsInitialized(
-                org.apache.calcite.avatica.proto.Common.StatementHandle.class, org.apache.calcite.avatica.proto.Common.StatementHandle.Builder.class);
-      }
-
-      // Construct using org.apache.calcite.avatica.proto.Common.StatementHandle.newBuilder()
-      private Builder() {
-        maybeForceBuilderInitialization();
-      }
-
-      private Builder(
-          com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
-        super(parent);
-        maybeForceBuilderInitialization();
-      }
-      private void maybeForceBuilderInitialization() {
-        if (com.google.protobuf.GeneratedMessageV3
-                .alwaysUseFieldBuilders) {
-        }
-      }
-      public Builder clear() {
-        super.clear();
-        connectionId_ = "";
-
-        id_ = 0;
-
-        if (signatureBuilder_ == null) {
-          signature_ = null;
-        } else {
-          signature_ = null;
-          signatureBuilder_ = null;
-        }
-        return this;
-      }
-
-      public com.google.protobuf.Descriptors.Descriptor
-          getDescriptorForType() {
-        return org.apache.calcite.avatica.proto.Common.internal_static_StatementHandle_descriptor;
-      }
-
-      public org.apache.calcite.avatica.proto.Common.StatementHandle getDefaultInstanceForType() {
-        return org.apache.calcite.avatica.proto.Common.StatementHandle.getDefaultInstance();
-      }
-
-      public org.apache.calcite.avatica.proto.Common.StatementHandle build() {
-        org.apache.calcite.avatica.proto.Common.StatementHandle result = buildPartial();
-        if (!result.isInitialized()) {
-          throw newUninitializedMessageException(result);
-        }
-        return result;
-      }
-
-      public org.apache.calcite.avatica.proto.Common.StatementHandle buildPartial() {
-        org.apache.calcite.avatica.proto.Common.StatementHandle result = new org.apache.calcite.avatica.proto.Common.StatementHandle(this);
-        result.connectionId_ = connectionId_;
-        result.id_ = id_;
-        if (signatureBuilder_ == null) {
-          result.signature_ = signature_;
-        } else {
-          result.signature_ = signatureBuilder_.build();
-        }
-        onBuilt();
-        return result;
-      }
-
-      public Builder clone() {
-        return (Builder) super.clone();
-      }
-      public Builder setField(
-          com.google.protobuf.Descriptors.FieldDescriptor field,
-          Object value) {
-        return (Builder) super.setField(field, value);
-      }
-      public Builder clearField(
-          com.google.protobuf.Descriptors.FieldDescriptor field) {
-        return (Builder) super.clearField(field);
-      }
-      public Builder clearOneof(
-          com.google.protobuf.Descriptors.OneofDescriptor oneof) {
-        return (Builder) super.clearOneof(oneof);
-      }
-      public Builder setRepeatedField(
-          com.google.protobuf.Descriptors.FieldDescriptor field,
-          int index, Object value) {
-        return (Builder) super.setRepeatedField(field, index, value);
-      }
-      public Builder addRepeatedField(
-          com.google.protobuf.Descriptors.FieldDescriptor field,
-          Object value) {
-        return (Builder) super.addRepeatedField(field, value);
-      }
-      public Builder mergeFrom(com.google.protobuf.Message other) {
-        if (other instanceof org.apache.calcite.avatica.proto.Common.StatementHandle) {
-          return mergeFrom((org.apache.calcite.avatica.proto.Common.StatementHandle)other);
-        } else {
-          super.mergeFrom(other);
-          return this;
-        }
-      }
-
-      public Builder mergeFrom(org.apache.calcite.avatica.proto.Common.StatementHandle other) {
-        if (other == org.apache.calcite.avatica.proto.Common.StatementHandle.getDefaultInstance()) return this;
-        if (!other.getConnectionId().isEmpty()) {
-          connectionId_ = other.connectionId_;
-          onChanged();
-        }
-        if (other.getId() != 0) {
-          setId(other.getId());
-        }
-        if (other.hasSignature()) {
-          mergeSignature(other.getSignature());
-        }
-        onChanged();
-        return this;
-      }
-
-      public final boolean isInitialized() {
-        return true;
-      }
-
-      public Builder mergeFrom(
-          com.google.protobuf.CodedInputStream input,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws java.io.IOException {
-        org.apache.calcite.avatica.proto.Common.StatementHandle parsedMessage = null;
-        try {
-          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
-        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-          parsedMessage = (org.apache.calcite.avatica.proto.Common.StatementHandle) e.getUnfinishedMessage();
-          throw e.unwrapIOException();
-        } finally {
-          if (parsedMessage != null) {
-            mergeFrom(parsedMessage);
-          }
-        }
-        return this;
-      }
-
-      private java.lang.Object connectionId_ = "";
-      /**
-       * <code>optional string connection_id = 1;</code>
-       */
-      public java.lang.String getConnectionId() {
-        java.lang.Object ref = connectionId_;
-        if (!(ref instanceof java.lang.String)) {
-          com.google.protobuf.ByteString bs =
-              (com.google.protobuf.ByteString) ref;
-          java.lang.String s = bs.toStringUtf8();
-          connectionId_ = s;
-          return s;
-        } else {
-          return (java.lang.String) ref;
-        }
-      }
-      /**
-       * <code>optional string connection_id = 1;</code>
-       */
-      public com.google.protobuf.ByteString
-          getConnectionIdBytes() {
-        java.lang.Object ref = connectionId_;
-        if (ref instanceof String) {
-          com.google.protobuf.ByteString b = 
-              com.google.protobuf.ByteString.copyFromUtf8(
-                  (java.lang.String) ref);
-          connectionId_ = b;
-          return b;
-        } else {
-          return (com.google.protobuf.ByteString) ref;
-        }
-      }
-      /**
-       * <code>optional string connection_id = 1;</code>
-       */
-      public Builder setConnectionId(
-          java.lang.String value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  
-        connectionId_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>optional string connection_id = 1;</code>
-       */
-      public Builder clearConnectionId() {
-        
-        connectionId_ = getDefaultInstance().getConnectionId();
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>optional string connection_id = 1;</code>
-       */
-      public Builder setConnectionIdBytes(
-          com.google.protobuf.ByteString value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  checkByteStringIsUtf8(value);
-        
-        connectionId_ = value;
-        onChanged();
-        return this;
-      }
-
-      private int id_ ;
-      /**
-       * <code>optional uint32 id = 2;</code>
-       */
-      public int getId() {
-        return id_;
-      }
-      /**
-       * <code>optional uint32 id = 2;</code>
-       */
-      public Builder setId(int value) {
-        
-        id_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>optional uint32 id = 2;</code>
-       */
-      public Builder clearId() {
-        
-        id_ = 0;
-        onChanged();
-        return this;
-      }
-
-      private org.apache.calcite.avatica.proto.Common.Signature signature_ = null;
-      private com.google.protobuf.SingleFieldBuilderV3<
-          org.apache.calcite.avatica.proto.Common.Signature, org.apache.calcite.avatica.proto.Common.Signature.Builder, org.apache.calcite.avatica.proto.Common.SignatureOrBuilder> signatureBuilder_;
-      /**
-       * <code>optional .Signature signature = 3;</code>
-       */
-      public boolean hasSignature() {
-        return signatureBuilder_ != null || signature_ != null;
-      }
-      /**
-       * <code>optional .Signature signature = 3;</code>
-       */
-      public org.apache.calcite.avatica.proto.Common.Signature getSignature() {
-        if (signatureBuilder_ == null) {
-          return signature_ == null ? org.apache.calcite.avatica.proto.Common.Signature.getDefaultInstance() : signature_;
-        } else {
-          return signatureBuilder_.getMessage();
-        }
-      }
-      /**
-       * <code>optional .Signature signature = 3;</code>
-       */
-      public Builder setSignature(org.apache.calcite.avatica.proto.Common.Signature value) {
-        if (signatureBuilder_ == null) {
-          if (value == null) {
-            throw new NullPointerException();
-          }
-          signature_ = value;
-          onChanged();
-        } else {
-          signatureBuilder_.setMessage(value);
-        }
-
-        return this;
-      }
-      /**
-       * <code>optional .Signature signature = 3;</code>
-       */
-      public Builder setSignature(
-          org.apache.calcite.avatica.proto.Common.Signature.Builder builderForValue) {
-        if (signatureBuilder_ == null) {
-          signature_ = builderForValue.build();
-          onChanged();
-        } else {
-          signatureBuilder_.setMessage(builderForValue.build());
-        }
-
-        return this;
-      }
-      /**
-       * <code>optional .Signature signature = 3;</code>
-       */
-      public Builder mergeSignature(org.apache.calcite.avatica.proto.Common.Signature value) {
-        if (signatureBuilder_ == null) {
-          if (signature_ != null) {
-            signature_ =
-              org.apache.calcite.avatica.proto.Common.Signature.newBuilder(signature_).mergeFrom(value).buildPartial();
-          } else {
-            signature_ = value;
-          }
-          onChanged();
-        } else {
-          signatureBuilder_.mergeFrom(value);
-        }
-
-        return this;
-      }
-      /**
-       * <code>optional .Signature signature = 3;</code>
-       */
-      public Builder clearSignature() {
-        if (signatureBuilder_ == null) {
-          signature_ = null;
-          onChanged();
-        } else {
-          signature_ = null;
-          signatureBuilder_ = null;
-        }
-
-        return this;
-      }
-      /**
-       * <code>optional .Signature signature = 3;</code>
-       */
-      public org.apache.calcite.avatica.proto.Common.Signature.Builder getSignatureBuilder() {
-        
-        onChanged();
-        return getSignatureFieldBuilder().getBuilder();
-      }
-      /**
-       * <code>optional .Signature signature = 3;</code>
-       */
-      public org.apache.calcite.avatica.proto.Common.SignatureOrBuilder getSignatureOrBuilder() {
-        if (signatureBuilder_ != null) {
-          return signatureBuilder_.getMessageOrBuilder();
-        } else {
-          return signature_ == null ?
-              org.apache.calcite.avatica.proto.Common.Signature.getDefaultI

<TRUNCATED>

[28/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/metrics/pom.xml
----------------------------------------------------------------------
diff --git a/avatica/metrics/pom.xml b/avatica/metrics/pom.xml
deleted file mode 100644
index 4fc32df..0000000
--- a/avatica/metrics/pom.xml
+++ /dev/null
@@ -1,129 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <parent>
-    <groupId>org.apache.calcite.avatica</groupId>
-    <artifactId>avatica-parent</artifactId>
-    <version>1.10.0-SNAPSHOT</version>
-  </parent>
-
-  <artifactId>avatica-metrics</artifactId>
-  <packaging>jar</packaging>
-  <name>Apache Calcite Avatica Metrics</name>
-  <description>A library designed to abstract away any required dependency on a metrics library</description>
-
-  <properties>
-    <top.dir>${project.basedir}/..</top.dir>
-  </properties>
-
-  <dependencies>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-api</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.mockito</groupId>
-      <artifactId>mockito-core</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-log4j12</artifactId>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
-
-  <build>
-    <pluginManagement>
-      <plugins>
-        <plugin>
-          <groupId>org.eclipse.m2e</groupId>
-          <artifactId>lifecycle-mapping</artifactId>
-          <version>1.0.0</version>
-          <configuration>
-            <lifecycleMappingMetadata>
-              <pluginExecutions>
-                <pluginExecution>
-                  <pluginExecutionFilter>
-                    <groupId>org.apache.maven.plugins</groupId>
-                    <artifactId>maven-checkstyle-plugin</artifactId>
-                    <versionRange>[2.12.1,)</versionRange>
-                    <goals>
-                      <goal>check</goal>
-                    </goals>
-                  </pluginExecutionFilter>
-                  <action>
-                    <ignore />
-                  </action>
-                </pluginExecution>
-              </pluginExecutions>
-            </lifecycleMappingMetadata>
-          </configuration>
-        </plugin>
-      </plugins>
-    </pluginManagement>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-dependency-plugin</artifactId>
-        <version>${maven-dependency-plugin.version}</version>
-        <!-- configurations do not cascade, so all of the definition from
-             ../pom.xml:build:plugin-management:plugins:plugin must be repeated in child poms -->
-        <executions>
-          <execution>
-            <id>analyze</id>
-            <goals>
-              <goal>analyze-only</goal>
-            </goals>
-            <configuration>
-              <failOnWarning>true</failOnWarning>
-              <!-- ignore "unused but declared" warnings -->
-              <ignoredUnusedDeclaredDependencies>
-                <ignoredUnusedDeclaredDependency>org.slf4j:slf4j-log4j12</ignoredUnusedDeclaredDependency>
-              </ignoredUnusedDeclaredDependencies>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-      <!-- Parent module has the same plugin and does the work of
-           generating -sources.jar for each project. But without the
-           plugin declared here, IDEs don't know the sources are
-           available. -->
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-source-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>attach-sources</id>
-            <phase>verify</phase>
-            <goals>
-              <goal>jar-no-fork</goal>
-              <goal>test-jar-no-fork</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-</project>

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/Counter.java
----------------------------------------------------------------------
diff --git a/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/Counter.java b/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/Counter.java
deleted file mode 100644
index 87aec1b..0000000
--- a/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/Counter.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.metrics;
-
-/**
- * A mutable number.
- */
-public interface Counter {
-
-  /**
-   * Increment {@code this} by 1.
-   */
-  void increment();
-
-  /**
-   * Increment {@code this} by {@code n}.
-   *
-   * @param n The amount to increment.
-   */
-  void increment(long n);
-
-  /**
-   * Decrement {@code this} by 1.
-   */
-  void decrement();
-
-  /**
-   * Decrement {@code this} by {@code n}.
-   *
-   * @param n The amount to decrement.
-   */
-  void decrement(long n);
-}
-
-// End Counter.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/Gauge.java
----------------------------------------------------------------------
diff --git a/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/Gauge.java b/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/Gauge.java
deleted file mode 100644
index 6313a9a..0000000
--- a/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/Gauge.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.metrics;
-
-/**
- * A metrics which measures a discrete value.
- *
- * @param <T> The value of the Gauge.
- */
-public interface Gauge<T> extends Metric {
-
-  T getValue();
-
-}
-
-// End Gauge.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/Histogram.java
----------------------------------------------------------------------
diff --git a/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/Histogram.java b/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/Histogram.java
deleted file mode 100644
index 633af78..0000000
--- a/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/Histogram.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.metrics;
-
-/**
- * A metric which measures the distribution of values.
- */
-public interface Histogram extends Metric {
-
-  /**
-   * Adds a new value to the distribution.
-   *
-   * @param value The value to add
-   */
-  void update(int value);
-
-  /**
-   * Adds a new value to the distribution.
-   *
-   * @param value The value to add
-   */
-  void update(long value);
-
-}
-
-// End Histogram.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/Meter.java
----------------------------------------------------------------------
diff --git a/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/Meter.java b/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/Meter.java
deleted file mode 100644
index b27f023..0000000
--- a/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/Meter.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.metrics;
-
-/**
- * A metric which measure the rate at which some operation is invoked.
- */
-public interface Meter extends Metric {
-
-  /**
-   * Records one occurrence.
-   */
-  void mark();
-
-  /**
-   * Records {@code events} occurrences.
-   *
-   * @param events Number of occurrences to record.
-   */
-  void mark(long events);
-
-}
-
-// End Meter.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/Metric.java
----------------------------------------------------------------------
diff --git a/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/Metric.java b/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/Metric.java
deleted file mode 100644
index fe133da..0000000
--- a/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/Metric.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.metrics;
-
-/**
- * Parent interface for all metrics.
- */
-public interface Metric {
-
-}
-
-// End Metric.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/MetricsSystem.java
----------------------------------------------------------------------
diff --git a/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/MetricsSystem.java b/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/MetricsSystem.java
deleted file mode 100644
index 0d1cb4b..0000000
--- a/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/MetricsSystem.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.metrics;
-
-/**
- * General purpose factory for creating various metrics. Modeled off of the Dropwizard Metrics API.
- */
-public interface MetricsSystem {
-
-  /**
-   * Get or construct a {@link Timer} used to measure durations and report rates.
-   *
-   * @param name The name of the Timer.
-   * @return An instance of {@link Timer}.
-   */
-  Timer getTimer(String name);
-
-  /**
-   * Get or construct a {@link Histogram} used to measure a distribution of values.
-   *
-   * @param name The name of the Histogram.
-   * @return An instance of {@link Histogram}.
-   */
-  Histogram getHistogram(String name);
-
-  /**
-   * Get or construct a {@link Meter} used to measure durations and report distributions (a
-   * combination of a {@link Timer} and a {@link Histogram}.
-   *
-   * @param name The name of the Meter.
-   * @return An instance of {@link Meter}.
-   */
-  Meter getMeter(String name);
-
-  /**
-   * Get or construct a {@link Counter} used to track a mutable number.
-   *
-   * @param name The name of the Counter
-   * @return An instance of {@link Counter}.
-   */
-  Counter getCounter(String name);
-
-  /**
-   * Register a {@link Gauge}. The Gauge will be invoked at a period defined by the implementation
-   * of {@link MetricsSystem}.
-   *
-   * @param name The name of the Gauge.
-   * @param gauge A callback to compute the current value.
-   */
-  <T> void register(String name, Gauge<T> gauge);
-
-}
-
-// End MetricsSystem.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/MetricsSystemConfiguration.java
----------------------------------------------------------------------
diff --git a/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/MetricsSystemConfiguration.java b/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/MetricsSystemConfiguration.java
deleted file mode 100644
index 99b6e8c..0000000
--- a/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/MetricsSystemConfiguration.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.metrics;
-
-/**
- * A container used by a {@link MetricsSystemFactory} to create a {@link MetricsSystem}.
- *
- * @param <T> Configuration/State for the {@link MetricsSystem}.
- */
-public interface MetricsSystemConfiguration<T> {
-
-  /**
-   * @return Some state or configuration to create a {@link MetricsSystem}.
-   */
-  T get();
-
-}
-
-// End MetricsSystemConfiguration.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/MetricsSystemFactory.java
----------------------------------------------------------------------
diff --git a/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/MetricsSystemFactory.java b/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/MetricsSystemFactory.java
deleted file mode 100644
index 484b230..0000000
--- a/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/MetricsSystemFactory.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.metrics;
-
-/**
- * A factory class for creating instances of {@link MetricsSystem}.
- */
-public interface MetricsSystemFactory {
-
-  /**
-   * Creates an instance of a {@link MetricsSystem}.
-   *
-   * @return A new {@link MetricsSystem}.
-   */
-  MetricsSystem create(MetricsSystemConfiguration<?> config);
-}
-
-// End MetricsSystemFactory.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/MetricsSystemLoader.java
----------------------------------------------------------------------
diff --git a/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/MetricsSystemLoader.java b/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/MetricsSystemLoader.java
deleted file mode 100644
index 3a15c5b..0000000
--- a/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/MetricsSystemLoader.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.metrics;
-
-import org.apache.calcite.avatica.metrics.noop.NoopMetricsSystem;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-import java.util.ServiceLoader;
-
-/**
- * A utility encapsulating use of {@link ServiceLoader} to instantiate a {@link MetricsSystem}.
- */
-public class MetricsSystemLoader {
-  private static final Logger LOG = LoggerFactory.getLogger(MetricsSystemLoader.class);
-  private static final MetricsSystemLoader INSTANCE = new MetricsSystemLoader();
-
-  private MetricsSystemLoader() {}
-
-  /**
-   * Creates a {@link MetricsSystem} instance using the corresponding {@link MetricsSystemFactory}
-   * available to {@link ServiceLoader} on the classpath. If there is not exactly one instance of
-   * a {@link MetricsSystemFactory}, an instance of {@link NoopMetricsSystem} will be returned.
-   *
-   * @param config State to pass to the {@link MetricsSystemFactory}.
-   * @return A {@link MetricsSystem} implementation.
-   */
-  public static MetricsSystem load(MetricsSystemConfiguration<?> config) {
-    return INSTANCE._load(Objects.requireNonNull(config));
-  }
-
-  MetricsSystem _load(MetricsSystemConfiguration<?> config) {
-    List<MetricsSystemFactory> availableFactories = getFactories();
-
-    if (1 == availableFactories.size()) {
-      // One and only one instance -- what we want/expect
-      MetricsSystemFactory factory = availableFactories.get(0);
-      LOG.info("Loaded MetricsSystem {}", factory.getClass());
-      return factory.create(config);
-    } else if (availableFactories.isEmpty()) {
-      // None-provided default to no metrics
-      LOG.info("No metrics implementation available on classpath. Using No-op implementation");
-      return NoopMetricsSystem.getInstance();
-    } else {
-      // Tell the user they're doing something wrong, and choose the first impl.
-      StringBuilder sb = new StringBuilder();
-      for (MetricsSystemFactory factory : availableFactories) {
-        if (sb.length() > 0) {
-          sb.append(", ");
-        }
-        sb.append(factory.getClass());
-      }
-      LOG.warn("Found multiple MetricsSystemFactory implementations: {}."
-          + " Using No-op implementation", sb);
-      return NoopMetricsSystem.getInstance();
-    }
-  }
-
-  List<MetricsSystemFactory> getFactories() {
-    ServiceLoader<MetricsSystemFactory> loader = ServiceLoader.load(MetricsSystemFactory.class);
-    List<MetricsSystemFactory> availableFactories = new ArrayList<>();
-    for (MetricsSystemFactory factory : loader) {
-      availableFactories.add(factory);
-    }
-    return availableFactories;
-  }
-}
-
-// End MetricsSystemLoader.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/PackageMarker.java
----------------------------------------------------------------------
diff --git a/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/PackageMarker.java b/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/PackageMarker.java
deleted file mode 100644
index e627d31..0000000
--- a/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/PackageMarker.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.metrics;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * This is a dummy annotation that forces javac to produce output for
- * otherwise empty package-info.java.
- *
- * <p>The result is maven-compiler-plugin can properly identify the scope of
- * changed files
- *
- * <p>See more details in
- * <a href="https://jira.codehaus.org/browse/MCOMPILER-205">
- *   maven-compiler-plugin: incremental compilation broken</a>
- */
-@Retention(RetentionPolicy.SOURCE)
-public @interface PackageMarker {
-}
-
-// End PackageMarker.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/Timer.java
----------------------------------------------------------------------
diff --git a/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/Timer.java b/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/Timer.java
deleted file mode 100644
index be792cc..0000000
--- a/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/Timer.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.metrics;
-
-/**
- * A metric which encompasses a {@link Histogram} and {@link Meter}.
- */
-public interface Timer extends Metric {
-
-  Context start();
-
-  /**
-   * A object that tracks an active timing state.
-   */
-  public interface Context extends AutoCloseable {
-    /**
-     * Stops the timer.
-     */
-    void close();
-  }
-}
-
-// End Timer.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopCounter.java
----------------------------------------------------------------------
diff --git a/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopCounter.java b/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopCounter.java
deleted file mode 100644
index 9ce8476..0000000
--- a/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopCounter.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.metrics.noop;
-
-import org.apache.calcite.avatica.metrics.Counter;
-
-/**
- * {@link Counter} implementation which does nothing.
- */
-public class NoopCounter implements Counter {
-
-  @Override public void increment() {}
-
-  @Override public void increment(long n) {}
-
-  @Override public void decrement() {}
-
-  @Override public void decrement(long n) {}
-
-}
-
-// End NoopCounter.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopHistogram.java
----------------------------------------------------------------------
diff --git a/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopHistogram.java b/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopHistogram.java
deleted file mode 100644
index ee056e9..0000000
--- a/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopHistogram.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.metrics.noop;
-
-import org.apache.calcite.avatica.metrics.Histogram;
-
-/**
- * {@link Histogram} which does nothing.
- */
-public class NoopHistogram implements Histogram {
-
-  @Override public void update(int value) {}
-
-  @Override public void update(long value) {}
-
-}
-
-// End NoopHistogram.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopMeter.java
----------------------------------------------------------------------
diff --git a/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopMeter.java b/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopMeter.java
deleted file mode 100644
index 4ad68c9..0000000
--- a/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopMeter.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.metrics.noop;
-
-import org.apache.calcite.avatica.metrics.Meter;
-
-/**
- * {@link Meter} which does nothing.
- */
-public class NoopMeter implements Meter {
-
-  @Override public void mark() {}
-
-  @Override public void mark(long events) {}
-
-}
-
-// End NoopMeter.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopMetricsSystem.java
----------------------------------------------------------------------
diff --git a/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopMetricsSystem.java b/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopMetricsSystem.java
deleted file mode 100644
index 12b5af1..0000000
--- a/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopMetricsSystem.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.metrics.noop;
-
-import org.apache.calcite.avatica.metrics.Counter;
-import org.apache.calcite.avatica.metrics.Gauge;
-import org.apache.calcite.avatica.metrics.Histogram;
-import org.apache.calcite.avatica.metrics.Meter;
-import org.apache.calcite.avatica.metrics.Metric;
-import org.apache.calcite.avatica.metrics.MetricsSystem;
-import org.apache.calcite.avatica.metrics.Timer;
-
-/**
- * {@link MetricsSystem} implementation which does nothing. Returns {@link Metric} implementations
- * which also does nothing (avoiding null instances).
- */
-public class NoopMetricsSystem implements MetricsSystem {
-
-  private static final NoopMetricsSystem NOOP_METRICS = new NoopMetricsSystem();
-
-  private static final Timer TIMER = new NoopTimer();
-  private static final Histogram HISTOGRAM = new NoopHistogram();
-  private static final Meter METER = new NoopMeter();
-  private static final Counter COUNTER = new NoopCounter();
-
-  /**
-   * @return A {@link NoopMetricsSystem} instance.
-   */
-  public static NoopMetricsSystem getInstance() {
-    return NOOP_METRICS;
-  }
-
-  private NoopMetricsSystem() {}
-
-  @Override public Timer getTimer(String name) {
-    return TIMER;
-  }
-
-  @Override public Histogram getHistogram(String name) {
-    return HISTOGRAM;
-  }
-
-  @Override public Meter getMeter(String name) {
-    return METER;
-  }
-
-  @Override public Counter getCounter(String name) {
-    return COUNTER;
-  }
-
-  @Override public <T> void register(String name, Gauge<T> gauge) {}
-
-}
-
-// End NoopMetricsSystem.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopMetricsSystemConfiguration.java
----------------------------------------------------------------------
diff --git a/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopMetricsSystemConfiguration.java b/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopMetricsSystemConfiguration.java
deleted file mode 100644
index 42b3f24..0000000
--- a/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopMetricsSystemConfiguration.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.metrics.noop;
-
-import org.apache.calcite.avatica.metrics.MetricsSystemConfiguration;
-
-/**
- * An empty configuration for the {@link NoopMetricsSystem}.
- */
-public class NoopMetricsSystemConfiguration implements MetricsSystemConfiguration<Void> {
-
-  private static final NoopMetricsSystemConfiguration INSTANCE =
-      new NoopMetricsSystemConfiguration();
-
-  public static NoopMetricsSystemConfiguration getInstance() {
-    return INSTANCE;
-  }
-
-  private NoopMetricsSystemConfiguration() {}
-
-  @Override public Void get() {
-    return null;
-  }
-}
-
-// End NoopMetricsSystemConfiguration.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopMetricsSystemFactory.java
----------------------------------------------------------------------
diff --git a/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopMetricsSystemFactory.java b/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopMetricsSystemFactory.java
deleted file mode 100644
index c15f978..0000000
--- a/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopMetricsSystemFactory.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.metrics.noop;
-
-import org.apache.calcite.avatica.metrics.MetricsSystemConfiguration;
-import org.apache.calcite.avatica.metrics.MetricsSystemFactory;
-
-/**
- * A {@link MetricsSystemFactory} for the {@link NoopMetricsSystem}.
- *
- * No service file is provided for this implementation. It is the fallback implementation if
- * no implementation or more than one implementation is found on the classpath.
- */
-public class NoopMetricsSystemFactory implements MetricsSystemFactory {
-
-  @Override public NoopMetricsSystem create(MetricsSystemConfiguration<?> config) {
-    return NoopMetricsSystem.getInstance();
-  }
-}
-
-// End NoopMetricsSystemFactory.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopTimer.java
----------------------------------------------------------------------
diff --git a/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopTimer.java b/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopTimer.java
deleted file mode 100644
index a45cd63..0000000
--- a/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/NoopTimer.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.metrics.noop;
-
-import org.apache.calcite.avatica.metrics.Timer;
-import org.apache.calcite.avatica.metrics.Timer.Context;
-
-/**
- * {@link Timer} which does nothing.
- */
-public class NoopTimer implements Timer {
-
-  private static final NoopContext CONTEXT = new NoopContext();
-
-  @Override public NoopContext start() {
-    return CONTEXT;
-  }
-
-  /**
-   * {@link Context} which does nothing.
-   */
-  public static class NoopContext implements Context {
-
-    @Override public void close() {}
-
-  }
-}
-
-// End NoopTimer.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/package-info.java
----------------------------------------------------------------------
diff --git a/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/package-info.java b/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/package-info.java
deleted file mode 100644
index 826a655..0000000
--- a/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/noop/package-info.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * No-operation implementation for the Avatica Metrics framework.
- */
-@PackageMarker
-package org.apache.calcite.avatica.metrics.noop;
-
-import org.apache.calcite.avatica.metrics.PackageMarker;
-
-// End package-info.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/package-info.java
----------------------------------------------------------------------
diff --git a/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/package-info.java b/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/package-info.java
deleted file mode 100644
index efed28c..0000000
--- a/avatica/metrics/src/main/java/org/apache/calcite/avatica/metrics/package-info.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * Metrics for the Avatica framework.
- */
-@PackageMarker
-package org.apache.calcite.avatica.metrics;
-
-// End package-info.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/metrics/src/test/java/org/apache/calcite/avatica/metrics/MetricsSystemLoaderTest.java
----------------------------------------------------------------------
diff --git a/avatica/metrics/src/test/java/org/apache/calcite/avatica/metrics/MetricsSystemLoaderTest.java b/avatica/metrics/src/test/java/org/apache/calcite/avatica/metrics/MetricsSystemLoaderTest.java
deleted file mode 100644
index 1c405ee..0000000
--- a/avatica/metrics/src/test/java/org/apache/calcite/avatica/metrics/MetricsSystemLoaderTest.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.metrics;
-
-import org.apache.calcite.avatica.metrics.noop.NoopMetricsSystem;
-import org.apache.calcite.avatica.metrics.noop.NoopMetricsSystemConfiguration;
-
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * Test class for {@link MetricsSystemLoader}.
- */
-public class MetricsSystemLoaderTest {
-
-  @Test public void testSingleInstance() {
-    final List<MetricsSystemFactory> factories =
-        Collections.<MetricsSystemFactory>singletonList(new MarkedNoopMetricsSystemFactory());
-    MetricsSystemLoader loader = Mockito.mock(MetricsSystemLoader.class);
-
-    Mockito.when(loader.getFactories()).thenReturn(factories);
-    Mockito.when(loader._load(Mockito.any(MetricsSystemConfiguration.class))).thenCallRealMethod();
-
-    // One MetricsSystemFactory should return the MetricsSystem it creates
-    MetricsSystem system = loader._load(NoopMetricsSystemConfiguration.getInstance());
-    assertEquals(MarkedMetricsSystem.INSTANCE, system);
-  }
-
-  @Test public void testMultipleInstances() {
-    // The type of the factories doesn't matter (we can send duplicates for testing purposes)
-    final List<MetricsSystemFactory> factories =
-        Arrays.<MetricsSystemFactory>asList(new MarkedNoopMetricsSystemFactory(),
-            new MarkedNoopMetricsSystemFactory());
-    MetricsSystemLoader loader = Mockito.mock(MetricsSystemLoader.class);
-
-    Mockito.when(loader.getFactories()).thenReturn(factories);
-    Mockito.when(loader._load(Mockito.any(MetricsSystemConfiguration.class))).thenCallRealMethod();
-
-    // We had two factories loaded, therefore we'll fall back to the NoopMetricsSystem
-    MetricsSystem system = loader._load(NoopMetricsSystemConfiguration.getInstance());
-    assertEquals(NoopMetricsSystem.getInstance(), system);
-  }
-
-  @Test public void testNoInstances() {
-    // The type of the factories doesn't matter (we can send duplicates for testing purposes)
-    final List<MetricsSystemFactory> factories = Collections.emptyList();
-    MetricsSystemLoader loader = Mockito.mock(MetricsSystemLoader.class);
-
-    Mockito.when(loader.getFactories()).thenReturn(factories);
-    Mockito.when(loader._load(Mockito.any(MetricsSystemConfiguration.class))).thenCallRealMethod();
-
-    // We had no factories loaded, therefore we'll fall back to the NoopMetricsSystem
-    MetricsSystem system = loader._load(NoopMetricsSystemConfiguration.getInstance());
-    assertEquals(NoopMetricsSystem.getInstance(), system);
-  }
-
-  /**
-   * A test factory implementation which can return a recognized MetricsSystem implementation.
-   */
-  private static class MarkedNoopMetricsSystemFactory implements MetricsSystemFactory {
-    public MarkedMetricsSystem create(MetricsSystemConfiguration<?> config) {
-      return MarkedMetricsSystem.INSTANCE;
-    }
-  }
-
-  /**
-   * A metrics system implementation that is identifiable for testing.
-   */
-  private static class MarkedMetricsSystem implements MetricsSystem {
-    private static final MarkedMetricsSystem INSTANCE = new MarkedMetricsSystem();
-
-    private MarkedMetricsSystem() {}
-
-    @Override public Timer getTimer(String name) {
-      return null;
-    }
-
-    @Override public Histogram getHistogram(String name) {
-      return null;
-    }
-
-    @Override public Meter getMeter(String name) {
-      return null;
-    }
-
-    @Override public Counter getCounter(String name) {
-      return null;
-    }
-
-    @Override public <T> void register(String name, Gauge<T> gauge) {}
-  }
-}
-
-// End MetricsSystemLoaderTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/metrics/src/test/java/org/apache/calcite/avatica/metrics/noop/NoopMetricsSystemFactoryTest.java
----------------------------------------------------------------------
diff --git a/avatica/metrics/src/test/java/org/apache/calcite/avatica/metrics/noop/NoopMetricsSystemFactoryTest.java b/avatica/metrics/src/test/java/org/apache/calcite/avatica/metrics/noop/NoopMetricsSystemFactoryTest.java
deleted file mode 100644
index 3060b2f..0000000
--- a/avatica/metrics/src/test/java/org/apache/calcite/avatica/metrics/noop/NoopMetricsSystemFactoryTest.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.metrics.noop;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertTrue;
-
-/**
- * Test class for {@link NoopMetricsSystemFactory}.
- */
-public class NoopMetricsSystemFactoryTest {
-
-  @Test public void testSingleton() {
-    NoopMetricsSystemFactory factory = new NoopMetricsSystemFactory();
-    NoopMetricsSystemConfiguration config = NoopMetricsSystemConfiguration.getInstance();
-    assertTrue("The factory should only return one NoopMetricsSystem instance",
-        factory.create(config) == factory.create(config));
-  }
-
-}
-
-// End NoopMetricsSystemFactoryTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/metrics/src/test/java/org/apache/calcite/avatica/metrics/noop/NoopMetricsSystemTest.java
----------------------------------------------------------------------
diff --git a/avatica/metrics/src/test/java/org/apache/calcite/avatica/metrics/noop/NoopMetricsSystemTest.java b/avatica/metrics/src/test/java/org/apache/calcite/avatica/metrics/noop/NoopMetricsSystemTest.java
deleted file mode 100644
index f28d123..0000000
--- a/avatica/metrics/src/test/java/org/apache/calcite/avatica/metrics/noop/NoopMetricsSystemTest.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.metrics.noop;
-
-import org.apache.calcite.avatica.metrics.Counter;
-import org.apache.calcite.avatica.metrics.Gauge;
-import org.apache.calcite.avatica.metrics.Histogram;
-import org.apache.calcite.avatica.metrics.Meter;
-import org.apache.calcite.avatica.metrics.MetricsSystem;
-import org.apache.calcite.avatica.metrics.Timer;
-import org.apache.calcite.avatica.metrics.Timer.Context;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertTrue;
-
-/**
- * Tests for {@link NoopMetricsSystem}.
- */
-public class NoopMetricsSystemTest {
-
-  @Test public void testNoNulls() {
-    // The NOOP implementation should act as a real implementation, no "nulls" allowed.
-    MetricsSystem metrics = NoopMetricsSystem.getInstance();
-
-    Counter counter = metrics.getCounter("counter");
-    counter.decrement();
-    counter.increment();
-    counter.decrement(1L);
-    counter.increment(1L);
-
-    Histogram histogram = metrics.getHistogram("histogram");
-    histogram.update(1);
-    histogram.update(1L);
-
-    Timer timer = metrics.getTimer("timer");
-    Context context = timer.start();
-    context.close();
-    Context contextTwo = timer.start();
-    assertTrue("Timer's context should be a singleton", context == contextTwo);
-
-    Meter meter = metrics.getMeter("meter");
-    meter.mark();
-    meter.mark(5L);
-
-    metrics.register("gauge", new Gauge<Long>() {
-      @Override public Long getValue() {
-        return 42L;
-      }
-    });
-  }
-
-  @Test public void testSingleton() {
-    assertTrue("Should be a singleton",
-        NoopMetricsSystem.getInstance() == NoopMetricsSystem.getInstance());
-  }
-}
-
-// End NoopMetricsSystemTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/metrics/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/avatica/metrics/src/test/resources/log4j.properties b/avatica/metrics/src/test/resources/log4j.properties
deleted file mode 100644
index 834e2db..0000000
--- a/avatica/metrics/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,24 +0,0 @@
-# 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.
-
-# Root logger is configured at INFO and is sent to A1
-log4j.rootLogger=INFO, A1
-
-# A1 goes to the console
-log4j.appender.A1=org.apache.log4j.ConsoleAppender
-
-# Set the pattern for each log message
-log4j.appender.A1.layout=org.apache.log4j.PatternLayout
-log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p - %m%n

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/noop-driver/pom.xml
----------------------------------------------------------------------
diff --git a/avatica/noop-driver/pom.xml b/avatica/noop-driver/pom.xml
deleted file mode 100644
index b15d7a7..0000000
--- a/avatica/noop-driver/pom.xml
+++ /dev/null
@@ -1,108 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <parent>
-    <groupId>org.apache.calcite.avatica</groupId>
-    <artifactId>avatica-parent</artifactId>
-    <version>1.10.0-SNAPSHOT</version>
-  </parent>
-
-  <artifactId>avatica-noop-driver</artifactId>
-  <packaging>jar</packaging>
-  <name>Apache Calcite Avatica Noop Driver</name>
-  <description>A Noop JDBC driver.</description>
-
-  <properties>
-    <top.dir>${project.basedir}/..</top.dir>
-  </properties>
-
-  <build>
-    <pluginManagement>
-      <plugins>
-        <plugin>
-          <groupId>org.eclipse.m2e</groupId>
-          <artifactId>lifecycle-mapping</artifactId>
-          <version>1.0.0</version>
-          <configuration>
-            <lifecycleMappingMetadata>
-              <pluginExecutions>
-                <pluginExecution>
-                  <pluginExecutionFilter>
-                    <groupId>org.apache.maven.plugins</groupId>
-                    <artifactId>maven-checkstyle-plugin</artifactId>
-                    <versionRange>[2.12.1,)</versionRange>
-                    <goals>
-                      <goal>check</goal>
-                    </goals>
-                  </pluginExecutionFilter>
-                  <action>
-                    <ignore />
-                  </action>
-                </pluginExecution>
-              </pluginExecutions>
-            </lifecycleMappingMetadata>
-          </configuration>
-        </plugin>
-      </plugins>
-    </pluginManagement>
-    <plugins>
-      <!-- Parent module has the same plugin and does the work of
-           generating -sources.jar for each project. But without the
-           plugin declared here, IDEs don't know the sources are
-           available. -->
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-source-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>attach-sources</id>
-            <phase>verify</phase>
-            <goals>
-              <goal>jar-no-fork</goal>
-              <goal>test-jar-no-fork</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-
-      <!-- Produce a tests jar so that avatica-server/pom.xml can reference for suite.
-           TODO: remove after moving over to annotation-based TestSuite definitions. -->
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-jar-plugin</artifactId>
-        <executions>
-          <execution>
-            <goals>
-              <goal>test-jar</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.rat</groupId>
-        <artifactId>apache-rat-plugin</artifactId>
-        <configuration>
-          <excludes>
-            <exclude>src/main/resources/META-INF/services/java.sql.Driver</exclude>
-          </excludes>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-</project>

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/noop-driver/src/main/java/org/apache/calcite/avatica/noop/AvaticaNoopConnection.java
----------------------------------------------------------------------
diff --git a/avatica/noop-driver/src/main/java/org/apache/calcite/avatica/noop/AvaticaNoopConnection.java b/avatica/noop-driver/src/main/java/org/apache/calcite/avatica/noop/AvaticaNoopConnection.java
deleted file mode 100644
index 6870717..0000000
--- a/avatica/noop-driver/src/main/java/org/apache/calcite/avatica/noop/AvaticaNoopConnection.java
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.noop;
-
-import java.sql.Array;
-import java.sql.Blob;
-import java.sql.CallableStatement;
-import java.sql.Clob;
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.NClob;
-import java.sql.PreparedStatement;
-import java.sql.SQLClientInfoException;
-import java.sql.SQLException;
-import java.sql.SQLWarning;
-import java.sql.SQLXML;
-import java.sql.Savepoint;
-import java.sql.Statement;
-import java.sql.Struct;
-import java.util.Collections;
-import java.util.Map;
-import java.util.Properties;
-import java.util.concurrent.Executor;
-
-/**
- * A {@link Connection} implementation which does nothing.
- */
-public class AvaticaNoopConnection implements Connection {
-
-  private static final AvaticaNoopConnection INSTANCE = new AvaticaNoopConnection();
-
-  public static AvaticaNoopConnection getInstance() {
-    return INSTANCE;
-  }
-
-  private AvaticaNoopConnection() {}
-
-  private UnsupportedOperationException unsupported() {
-    return new UnsupportedOperationException("Unsupported");
-  }
-
-  @Override public <T> T unwrap(Class<T> iface) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public boolean isWrapperFor(Class<?> iface) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public Statement createStatement() throws SQLException {
-    return AvaticaNoopStatement.getInstance();
-  }
-
-  @Override public PreparedStatement prepareStatement(String sql) throws SQLException {
-    return AvaticaNoopPreparedStatement.getInstance();
-  }
-
-  @Override public CallableStatement prepareCall(String sql) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public String nativeSQL(String sql) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public void setAutoCommit(boolean autoCommit) throws SQLException {}
-
-  @Override public boolean getAutoCommit() throws SQLException {
-    return false;
-  }
-
-  @Override public void commit() throws SQLException {}
-
-  @Override public void rollback() throws SQLException {}
-
-  @Override public void close() throws SQLException {}
-
-  @Override public boolean isClosed() throws SQLException {
-    return true;
-  }
-
-  @Override public DatabaseMetaData getMetaData() throws SQLException {
-    return AvaticaNoopDatabaseMetaData.getInstance();
-  }
-
-  @Override public void setReadOnly(boolean readOnly) throws SQLException {}
-
-  @Override public boolean isReadOnly() throws SQLException {
-    return false;
-  }
-
-  @Override public void setCatalog(String catalog) throws SQLException {}
-
-  @Override public String getCatalog() throws SQLException {
-    return null;
-  }
-
-  @Override public void setTransactionIsolation(int level) throws SQLException {}
-
-  @Override public int getTransactionIsolation() throws SQLException {
-    return 0;
-  }
-
-  @Override public SQLWarning getWarnings() throws SQLException {
-    return null;
-  }
-
-  @Override public void clearWarnings() throws SQLException {}
-
-  @Override public Statement createStatement(int resultSetType, int resultSetConcurrency)
-      throws SQLException {
-    return AvaticaNoopStatement.getInstance();
-  }
-
-  @Override public PreparedStatement prepareStatement(String sql, int resultSetType,
-      int resultSetConcurrency) throws SQLException {
-    return AvaticaNoopPreparedStatement.getInstance();
-  }
-
-  @Override public CallableStatement prepareCall(String sql, int resultSetType,
-      int resultSetConcurrency) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public Map<String, Class<?>> getTypeMap() throws SQLException {
-    return Collections.emptyMap();
-  }
-
-  @Override public void setTypeMap(Map<String, Class<?>> map) throws SQLException {}
-
-  @Override public void setHoldability(int holdability) throws SQLException {}
-
-  @Override public int getHoldability() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public Savepoint setSavepoint() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public Savepoint setSavepoint(String name) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public void rollback(Savepoint savepoint) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public void releaseSavepoint(Savepoint savepoint) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public Statement createStatement(int resultSetType, int resultSetConcurrency,
-      int resultSetHoldability) throws SQLException {
-    return AvaticaNoopStatement.getInstance();
-  }
-
-  @Override public PreparedStatement prepareStatement(String sql, int resultSetType,
-      int resultSetConcurrency, int resultSetHoldability) throws SQLException {
-    return AvaticaNoopPreparedStatement.getInstance();
-  }
-
-  @Override public CallableStatement prepareCall(String sql, int resultSetType,
-      int resultSetConcurrency, int resultSetHoldability) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys)
-      throws SQLException {
-    return AvaticaNoopPreparedStatement.getInstance();
-  }
-
-  @Override public PreparedStatement prepareStatement(String sql, int[] columnIndexes)
-      throws SQLException {
-    return AvaticaNoopPreparedStatement.getInstance();
-  }
-
-  @Override public PreparedStatement prepareStatement(String sql, String[] columnNames)
-      throws SQLException {
-    return AvaticaNoopPreparedStatement.getInstance();
-  }
-
-  @Override public Clob createClob() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public Blob createBlob() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public NClob createNClob() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public SQLXML createSQLXML() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public boolean isValid(int timeout) throws SQLException {
-    return true;
-  }
-
-  @Override public void setClientInfo(String name, String value) throws SQLClientInfoException {}
-
-  @Override public void setClientInfo(Properties properties) throws SQLClientInfoException {}
-
-  @Override public String getClientInfo(String name) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public Properties getClientInfo() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public Array createArrayOf(String typeName, Object[] elements) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public void setSchema(String schema) throws SQLException {}
-
-  @Override public String getSchema() throws SQLException {
-    return null;
-  }
-
-  @Override public void abort(Executor executor) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public void setNetworkTimeout(Executor executor, int milliseconds)
-      throws SQLException {}
-
-  @Override public int getNetworkTimeout() throws SQLException {
-    throw unsupported();
-  }
-
-}
-
-// End AvaticaNoopConnection.java


[17/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/site/fonts/fontawesome-webfont.svg
----------------------------------------------------------------------
diff --git a/avatica/site/fonts/fontawesome-webfont.svg b/avatica/site/fonts/fontawesome-webfont.svg
deleted file mode 100755
index b612969..0000000
--- a/avatica/site/fonts/fontawesome-webfont.svg
+++ /dev/null
@@ -1,520 +0,0 @@
-<?xml version="1.0" standalone="no"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
-<svg xmlns="http://www.w3.org/2000/svg">
-<metadata></metadata>
-<defs>
-<font id="fontawesomeregular" horiz-adv-x="1536" >
-<font-face units-per-em="1792" ascent="1536" descent="-256" />
-<missing-glyph horiz-adv-x="448" />
-<glyph unicode=" "  horiz-adv-x="448" />
-<glyph unicode="&#x09;" horiz-adv-x="448" />
-<glyph unicode="&#xa0;" horiz-adv-x="448" />
-<glyph unicode="&#xa8;" horiz-adv-x="1792" />
-<glyph unicode="&#xa9;" horiz-adv-x="1792" />
-<glyph unicode="&#xae;" horiz-adv-x="1792" />
-<glyph unicode="&#xb4;" horiz-adv-x="1792" />
-<glyph unicode="&#xc6;" horiz-adv-x="1792" />
-<glyph unicode="&#xd8;" horiz-adv-x="1792" />
-<glyph unicode="&#x2000;" horiz-adv-x="768" />
-<glyph unicode="&#x2001;" horiz-adv-x="1537" />
-<glyph unicode="&#x2002;" horiz-adv-x="768" />
-<glyph unicode="&#x2003;" horiz-adv-x="1537" />
-<glyph unicode="&#x2004;" horiz-adv-x="512" />
-<glyph unicode="&#x2005;" horiz-adv-x="384" />
-<glyph unicode="&#x2006;" horiz-adv-x="256" />
-<glyph unicode="&#x2007;" horiz-adv-x="256" />
-<glyph unicode="&#x2008;" horiz-adv-x="192" />
-<glyph unicode="&#x2009;" horiz-adv-x="307" />
-<glyph unicode="&#x200a;" horiz-adv-x="85" />
-<glyph unicode="&#x202f;" horiz-adv-x="307" />
-<glyph unicode="&#x205f;" horiz-adv-x="384" />
-<glyph unicode="&#x2122;" horiz-adv-x="1792" />
-<glyph unicode="&#x221e;" horiz-adv-x="1792" />
-<glyph unicode="&#x2260;" horiz-adv-x="1792" />
-<glyph unicode="&#x25fc;" horiz-adv-x="500" d="M0 0z" />
-<glyph unicode="&#xf000;" horiz-adv-x="1792" d="M1699 1350q0 -35 -43 -78l-632 -632v-768h320q26 0 45 -19t19 -45t-19 -45t-45 -19h-896q-26 0 -45 19t-19 45t19 45t45 19h320v768l-632 632q-43 43 -43 78q0 23 18 36.5t38 17.5t43 4h1408q23 0 43 -4t38 -17.5t18 -36.5z" />
-<glyph unicode="&#xf001;" d="M1536 1312v-1120q0 -50 -34 -89t-86 -60.5t-103.5 -32t-96.5 -10.5t-96.5 10.5t-103.5 32t-86 60.5t-34 89t34 89t86 60.5t103.5 32t96.5 10.5q105 0 192 -39v537l-768 -237v-709q0 -50 -34 -89t-86 -60.5t-103.5 -32t-96.5 -10.5t-96.5 10.5t-103.5 32t-86 60.5t-34 89 t34 89t86 60.5t103.5 32t96.5 10.5q105 0 192 -39v967q0 31 19 56.5t49 35.5l832 256q12 4 28 4q40 0 68 -28t28 -68z" />
-<glyph unicode="&#xf002;" horiz-adv-x="1664" d="M1152 704q0 185 -131.5 316.5t-316.5 131.5t-316.5 -131.5t-131.5 -316.5t131.5 -316.5t316.5 -131.5t316.5 131.5t131.5 316.5zM1664 -128q0 -52 -38 -90t-90 -38q-54 0 -90 38l-343 342q-179 -124 -399 -124q-143 0 -273.5 55.5t-225 150t-150 225t-55.5 273.5 t55.5 273.5t150 225t225 150t273.5 55.5t273.5 -55.5t225 -150t150 -225t55.5 -273.5q0 -220 -124 -399l343 -343q37 -37 37 -90z" />
-<glyph unicode="&#xf003;" horiz-adv-x="1792" d="M1664 32v768q-32 -36 -69 -66q-268 -206 -426 -338q-51 -43 -83 -67t-86.5 -48.5t-102.5 -24.5h-1h-1q-48 0 -102.5 24.5t-86.5 48.5t-83 67q-158 132 -426 338q-37 30 -69 66v-768q0 -13 9.5 -22.5t22.5 -9.5h1472q13 0 22.5 9.5t9.5 22.5zM1664 1083v11v13.5t-0.5 13 t-3 12.5t-5.5 9t-9 7.5t-14 2.5h-1472q-13 0 -22.5 -9.5t-9.5 -22.5q0 -168 147 -284q193 -152 401 -317q6 -5 35 -29.5t46 -37.5t44.5 -31.5t50.5 -27.5t43 -9h1h1q20 0 43 9t50.5 27.5t44.5 31.5t46 37.5t35 29.5q208 165 401 317q54 43 100.5 115.5t46.5 131.5z M1792 1120v-1088q0 -66 -47 -113t-113 -47h-1472q-66 0 -113 47t-47 113v1088q0 66 47 113t113 47h1472q66 0 113 -47t47 -113z" />
-<glyph unicode="&#xf004;" horiz-adv-x="1792" d="M896 -128q-26 0 -44 18l-624 602q-10 8 -27.5 26t-55.5 65.5t-68 97.5t-53.5 121t-23.5 138q0 220 127 344t351 124q62 0 126.5 -21.5t120 -58t95.5 -68.5t76 -68q36 36 76 68t95.5 68.5t120 58t126.5 21.5q224 0 351 -124t127 -344q0 -221 -229 -450l-623 -600 q-18 -18 -44 -18z" />
-<glyph unicode="&#xf005;" horiz-adv-x="1664" d="M1664 889q0 -22 -26 -48l-363 -354l86 -500q1 -7 1 -20q0 -21 -10.5 -35.5t-30.5 -14.5q-19 0 -40 12l-449 236l-449 -236q-22 -12 -40 -12q-21 0 -31.5 14.5t-10.5 35.5q0 6 2 20l86 500l-364 354q-25 27 -25 48q0 37 56 46l502 73l225 455q19 41 49 41t49 -41l225 -455 l502 -73q56 -9 56 -46z" />
-<glyph unicode="&#xf006;" horiz-adv-x="1664" d="M1137 532l306 297l-422 62l-189 382l-189 -382l-422 -62l306 -297l-73 -421l378 199l377 -199zM1664 889q0 -22 -26 -48l-363 -354l86 -500q1 -7 1 -20q0 -50 -41 -50q-19 0 -40 12l-449 236l-449 -236q-22 -12 -40 -12q-21 0 -31.5 14.5t-10.5 35.5q0 6 2 20l86 500 l-364 354q-25 27 -25 48q0 37 56 46l502 73l225 455q19 41 49 41t49 -41l225 -455l502 -73q56 -9 56 -46z" />
-<glyph unicode="&#xf007;" horiz-adv-x="1408" d="M1408 131q0 -120 -73 -189.5t-194 -69.5h-874q-121 0 -194 69.5t-73 189.5q0 53 3.5 103.5t14 109t26.5 108.5t43 97.5t62 81t85.5 53.5t111.5 20q9 0 42 -21.5t74.5 -48t108 -48t133.5 -21.5t133.5 21.5t108 48t74.5 48t42 21.5q61 0 111.5 -20t85.5 -53.5t62 -81 t43 -97.5t26.5 -108.5t14 -109t3.5 -103.5zM1088 1024q0 -159 -112.5 -271.5t-271.5 -112.5t-271.5 112.5t-112.5 271.5t112.5 271.5t271.5 112.5t271.5 -112.5t112.5 -271.5z" />
-<glyph unicode="&#xf008;" horiz-adv-x="1920" d="M384 -64v128q0 26 -19 45t-45 19h-128q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h128q26 0 45 19t19 45zM384 320v128q0 26 -19 45t-45 19h-128q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h128q26 0 45 19t19 45zM384 704v128q0 26 -19 45t-45 19h-128 q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h128q26 0 45 19t19 45zM1408 -64v512q0 26 -19 45t-45 19h-768q-26 0 -45 -19t-19 -45v-512q0 -26 19 -45t45 -19h768q26 0 45 19t19 45zM384 1088v128q0 26 -19 45t-45 19h-128q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45 t45 -19h128q26 0 45 19t19 45zM1792 -64v128q0 26 -19 45t-45 19h-128q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h128q26 0 45 19t19 45zM1408 704v512q0 26 -19 45t-45 19h-768q-26 0 -45 -19t-19 -45v-512q0 -26 19 -45t45 -19h768q26 0 45 19t19 45zM1792 320v128 q0 26 -19 45t-45 19h-128q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h128q26 0 45 19t19 45zM1792 704v128q0 26 -19 45t-45 19h-128q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h128q26 0 45 19t1
 9 45zM1792 1088v128q0 26 -19 45t-45 19h-128q-26 0 -45 -19 t-19 -45v-128q0 -26 19 -45t45 -19h128q26 0 45 19t19 45zM1920 1248v-1344q0 -66 -47 -113t-113 -47h-1600q-66 0 -113 47t-47 113v1344q0 66 47 113t113 47h1600q66 0 113 -47t47 -113z" />
-<glyph unicode="&#xf009;" horiz-adv-x="1664" d="M768 512v-384q0 -52 -38 -90t-90 -38h-512q-52 0 -90 38t-38 90v384q0 52 38 90t90 38h512q52 0 90 -38t38 -90zM768 1280v-384q0 -52 -38 -90t-90 -38h-512q-52 0 -90 38t-38 90v384q0 52 38 90t90 38h512q52 0 90 -38t38 -90zM1664 512v-384q0 -52 -38 -90t-90 -38 h-512q-52 0 -90 38t-38 90v384q0 52 38 90t90 38h512q52 0 90 -38t38 -90zM1664 1280v-384q0 -52 -38 -90t-90 -38h-512q-52 0 -90 38t-38 90v384q0 52 38 90t90 38h512q52 0 90 -38t38 -90z" />
-<glyph unicode="&#xf00a;" horiz-adv-x="1792" d="M512 288v-192q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h320q40 0 68 -28t28 -68zM512 800v-192q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h320q40 0 68 -28t28 -68zM1152 288v-192q0 -40 -28 -68t-68 -28h-320 q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h320q40 0 68 -28t28 -68zM512 1312v-192q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h320q40 0 68 -28t28 -68zM1152 800v-192q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v192q0 40 28 68t68 28 h320q40 0 68 -28t28 -68zM1792 288v-192q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h320q40 0 68 -28t28 -68zM1152 1312v-192q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h320q40 0 68 -28t28 -68zM1792 800v-192 q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h320q40 0 68 -28t28 -68zM1792 1312v-192q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h320q40 0 68 -28
 t28 -68z" />
-<glyph unicode="&#xf00b;" horiz-adv-x="1792" d="M512 288v-192q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h320q40 0 68 -28t28 -68zM512 800v-192q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h320q40 0 68 -28t28 -68zM1792 288v-192q0 -40 -28 -68t-68 -28h-960 q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h960q40 0 68 -28t28 -68zM512 1312v-192q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h320q40 0 68 -28t28 -68zM1792 800v-192q0 -40 -28 -68t-68 -28h-960q-40 0 -68 28t-28 68v192q0 40 28 68t68 28 h960q40 0 68 -28t28 -68zM1792 1312v-192q0 -40 -28 -68t-68 -28h-960q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h960q40 0 68 -28t28 -68z" />
-<glyph unicode="&#xf00c;" horiz-adv-x="1792" d="M1671 970q0 -40 -28 -68l-724 -724l-136 -136q-28 -28 -68 -28t-68 28l-136 136l-362 362q-28 28 -28 68t28 68l136 136q28 28 68 28t68 -28l294 -295l656 657q28 28 68 28t68 -28l136 -136q28 -28 28 -68z" />
-<glyph unicode="&#xf00d;" horiz-adv-x="1408" d="M1298 214q0 -40 -28 -68l-136 -136q-28 -28 -68 -28t-68 28l-294 294l-294 -294q-28 -28 -68 -28t-68 28l-136 136q-28 28 -28 68t28 68l294 294l-294 294q-28 28 -28 68t28 68l136 136q28 28 68 28t68 -28l294 -294l294 294q28 28 68 28t68 -28l136 -136q28 -28 28 -68 t-28 -68l-294 -294l294 -294q28 -28 28 -68z" />
-<glyph unicode="&#xf00e;" horiz-adv-x="1664" d="M1024 736v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-224v-224q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v224h-224q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h224v224q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5v-224h224 q13 0 22.5 -9.5t9.5 -22.5zM1152 704q0 185 -131.5 316.5t-316.5 131.5t-316.5 -131.5t-131.5 -316.5t131.5 -316.5t316.5 -131.5t316.5 131.5t131.5 316.5zM1664 -128q0 -53 -37.5 -90.5t-90.5 -37.5q-54 0 -90 38l-343 342q-179 -124 -399 -124q-143 0 -273.5 55.5 t-225 150t-150 225t-55.5 273.5t55.5 273.5t150 225t225 150t273.5 55.5t273.5 -55.5t225 -150t150 -225t55.5 -273.5q0 -220 -124 -399l343 -343q37 -37 37 -90z" />
-<glyph unicode="&#xf010;" horiz-adv-x="1664" d="M1024 736v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-576q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h576q13 0 22.5 -9.5t9.5 -22.5zM1152 704q0 185 -131.5 316.5t-316.5 131.5t-316.5 -131.5t-131.5 -316.5t131.5 -316.5t316.5 -131.5t316.5 131.5t131.5 316.5z M1664 -128q0 -53 -37.5 -90.5t-90.5 -37.5q-54 0 -90 38l-343 342q-179 -124 -399 -124q-143 0 -273.5 55.5t-225 150t-150 225t-55.5 273.5t55.5 273.5t150 225t225 150t273.5 55.5t273.5 -55.5t225 -150t150 -225t55.5 -273.5q0 -220 -124 -399l343 -343q37 -37 37 -90z " />
-<glyph unicode="&#xf011;" d="M1536 640q0 -156 -61 -298t-164 -245t-245 -164t-298 -61t-298 61t-245 164t-164 245t-61 298q0 182 80.5 343t226.5 270q43 32 95.5 25t83.5 -50q32 -42 24.5 -94.5t-49.5 -84.5q-98 -74 -151.5 -181t-53.5 -228q0 -104 40.5 -198.5t109.5 -163.5t163.5 -109.5 t198.5 -40.5t198.5 40.5t163.5 109.5t109.5 163.5t40.5 198.5q0 121 -53.5 228t-151.5 181q-42 32 -49.5 84.5t24.5 94.5q31 43 84 50t95 -25q146 -109 226.5 -270t80.5 -343zM896 1408v-640q0 -52 -38 -90t-90 -38t-90 38t-38 90v640q0 52 38 90t90 38t90 -38t38 -90z" />
-<glyph unicode="&#xf012;" horiz-adv-x="1792" d="M256 96v-192q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h192q14 0 23 -9t9 -23zM640 224v-320q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v320q0 14 9 23t23 9h192q14 0 23 -9t9 -23zM1024 480v-576q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23 v576q0 14 9 23t23 9h192q14 0 23 -9t9 -23zM1408 864v-960q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v960q0 14 9 23t23 9h192q14 0 23 -9t9 -23zM1792 1376v-1472q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v1472q0 14 9 23t23 9h192q14 0 23 -9t9 -23z" />
-<glyph unicode="&#xf013;" d="M1024 640q0 106 -75 181t-181 75t-181 -75t-75 -181t75 -181t181 -75t181 75t75 181zM1536 749v-222q0 -12 -8 -23t-20 -13l-185 -28q-19 -54 -39 -91q35 -50 107 -138q10 -12 10 -25t-9 -23q-27 -37 -99 -108t-94 -71q-12 0 -26 9l-138 108q-44 -23 -91 -38 q-16 -136 -29 -186q-7 -28 -36 -28h-222q-14 0 -24.5 8.5t-11.5 21.5l-28 184q-49 16 -90 37l-141 -107q-10 -9 -25 -9q-14 0 -25 11q-126 114 -165 168q-7 10 -7 23q0 12 8 23q15 21 51 66.5t54 70.5q-27 50 -41 99l-183 27q-13 2 -21 12.5t-8 23.5v222q0 12 8 23t19 13 l186 28q14 46 39 92q-40 57 -107 138q-10 12 -10 24q0 10 9 23q26 36 98.5 107.5t94.5 71.5q13 0 26 -10l138 -107q44 23 91 38q16 136 29 186q7 28 36 28h222q14 0 24.5 -8.5t11.5 -21.5l28 -184q49 -16 90 -37l142 107q9 9 24 9q13 0 25 -10q129 -119 165 -170q7 -8 7 -22 q0 -12 -8 -23q-15 -21 -51 -66.5t-54 -70.5q26 -50 41 -98l183 -28q13 -2 21 -12.5t8 -23.5z" />
-<glyph unicode="&#xf014;" horiz-adv-x="1408" d="M512 800v-576q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v576q0 14 9 23t23 9h64q14 0 23 -9t9 -23zM768 800v-576q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v576q0 14 9 23t23 9h64q14 0 23 -9t9 -23zM1024 800v-576q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v576 q0 14 9 23t23 9h64q14 0 23 -9t9 -23zM1152 76v948h-896v-948q0 -22 7 -40.5t14.5 -27t10.5 -8.5h832q3 0 10.5 8.5t14.5 27t7 40.5zM480 1152h448l-48 117q-7 9 -17 11h-317q-10 -2 -17 -11zM1408 1120v-64q0 -14 -9 -23t-23 -9h-96v-948q0 -83 -47 -143.5t-113 -60.5h-832 q-66 0 -113 58.5t-47 141.5v952h-96q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h309l70 167q15 37 54 63t79 26h320q40 0 79 -26t54 -63l70 -167h309q14 0 23 -9t9 -23z" />
-<glyph unicode="&#xf015;" horiz-adv-x="1664" d="M1408 544v-480q0 -26 -19 -45t-45 -19h-384v384h-256v-384h-384q-26 0 -45 19t-19 45v480q0 1 0.5 3t0.5 3l575 474l575 -474q1 -2 1 -6zM1631 613l-62 -74q-8 -9 -21 -11h-3q-13 0 -21 7l-692 577l-692 -577q-12 -8 -24 -7q-13 2 -21 11l-62 74q-8 10 -7 23.5t11 21.5 l719 599q32 26 76 26t76 -26l244 -204v195q0 14 9 23t23 9h192q14 0 23 -9t9 -23v-408l219 -182q10 -8 11 -21.5t-7 -23.5z" />
-<glyph unicode="&#xf016;" d="M1468 1156q28 -28 48 -76t20 -88v-1152q0 -40 -28 -68t-68 -28h-1344q-40 0 -68 28t-28 68v1600q0 40 28 68t68 28h896q40 0 88 -20t76 -48zM1024 1400v-376h376q-10 29 -22 41l-313 313q-12 12 -41 22zM1408 -128v1024h-416q-40 0 -68 28t-28 68v416h-768v-1536h1280z " />
-<glyph unicode="&#xf017;" d="M896 992v-448q0 -14 -9 -23t-23 -9h-320q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h224v352q0 14 9 23t23 9h64q14 0 23 -9t9 -23zM1312 640q0 148 -73 273t-198 198t-273 73t-273 -73t-198 -198t-73 -273t73 -273t198 -198t273 -73t273 73t198 198t73 273zM1536 640 q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" />
-<glyph unicode="&#xf018;" horiz-adv-x="1920" d="M1111 540v4l-24 320q-1 13 -11 22.5t-23 9.5h-186q-13 0 -23 -9.5t-11 -22.5l-24 -320v-4q-1 -12 8 -20t21 -8h244q12 0 21 8t8 20zM1870 73q0 -73 -46 -73h-704q13 0 22 9.5t8 22.5l-20 256q-1 13 -11 22.5t-23 9.5h-272q-13 0 -23 -9.5t-11 -22.5l-20 -256 q-1 -13 8 -22.5t22 -9.5h-704q-46 0 -46 73q0 54 26 116l417 1044q8 19 26 33t38 14h339q-13 0 -23 -9.5t-11 -22.5l-15 -192q-1 -14 8 -23t22 -9h166q13 0 22 9t8 23l-15 192q-1 13 -11 22.5t-23 9.5h339q20 0 38 -14t26 -33l417 -1044q26 -62 26 -116z" />
-<glyph unicode="&#xf019;" horiz-adv-x="1664" d="M1280 192q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1536 192q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1664 416v-320q0 -40 -28 -68t-68 -28h-1472q-40 0 -68 28t-28 68v320q0 40 28 68t68 28h465l135 -136 q58 -56 136 -56t136 56l136 136h464q40 0 68 -28t28 -68zM1339 985q17 -41 -14 -70l-448 -448q-18 -19 -45 -19t-45 19l-448 448q-31 29 -14 70q17 39 59 39h256v448q0 26 19 45t45 19h256q26 0 45 -19t19 -45v-448h256q42 0 59 -39z" />
-<glyph unicode="&#xf01a;" d="M1120 608q0 -12 -10 -24l-319 -319q-11 -9 -23 -9t-23 9l-320 320q-15 16 -7 35q8 20 30 20h192v352q0 14 9 23t23 9h192q14 0 23 -9t9 -23v-352h192q14 0 23 -9t9 -23zM768 1184q-148 0 -273 -73t-198 -198t-73 -273t73 -273t198 -198t273 -73t273 73t198 198t73 273 t-73 273t-198 198t-273 73zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" />
-<glyph unicode="&#xf01b;" d="M1118 660q-8 -20 -30 -20h-192v-352q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v352h-192q-14 0 -23 9t-9 23q0 12 10 24l319 319q11 9 23 9t23 -9l320 -320q15 -16 7 -35zM768 1184q-148 0 -273 -73t-198 -198t-73 -273t73 -273t198 -198t273 -73t273 73t198 198 t73 273t-73 273t-198 198t-273 73zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" />
-<glyph unicode="&#xf01c;" d="M1023 576h316q-1 3 -2.5 8t-2.5 8l-212 496h-708l-212 -496q-1 -2 -2.5 -8t-2.5 -8h316l95 -192h320zM1536 546v-482q0 -26 -19 -45t-45 -19h-1408q-26 0 -45 19t-19 45v482q0 62 25 123l238 552q10 25 36.5 42t52.5 17h832q26 0 52.5 -17t36.5 -42l238 -552 q25 -61 25 -123z" />
-<glyph unicode="&#xf01d;" d="M1184 640q0 -37 -32 -55l-544 -320q-15 -9 -32 -9q-16 0 -32 8q-32 19 -32 56v640q0 37 32 56q33 18 64 -1l544 -320q32 -18 32 -55zM1312 640q0 148 -73 273t-198 198t-273 73t-273 -73t-198 -198t-73 -273t73 -273t198 -198t273 -73t273 73t198 198t73 273zM1536 640 q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" />
-<glyph unicode="&#xf01e;" d="M1536 1280v-448q0 -26 -19 -45t-45 -19h-448q-42 0 -59 40q-17 39 14 69l138 138q-148 137 -349 137q-104 0 -198.5 -40.5t-163.5 -109.5t-109.5 -163.5t-40.5 -198.5t40.5 -198.5t109.5 -163.5t163.5 -109.5t198.5 -40.5q119 0 225 52t179 147q7 10 23 12q14 0 25 -9 l137 -138q9 -8 9.5 -20.5t-7.5 -22.5q-109 -132 -264 -204.5t-327 -72.5q-156 0 -298 61t-245 164t-164 245t-61 298t61 298t164 245t245 164t298 61q147 0 284.5 -55.5t244.5 -156.5l130 129q29 31 70 14q39 -17 39 -59z" />
-<glyph unicode="&#xf021;" d="M1511 480q0 -5 -1 -7q-64 -268 -268 -434.5t-478 -166.5q-146 0 -282.5 55t-243.5 157l-129 -129q-19 -19 -45 -19t-45 19t-19 45v448q0 26 19 45t45 19h448q26 0 45 -19t19 -45t-19 -45l-137 -137q71 -66 161 -102t187 -36q134 0 250 65t186 179q11 17 53 117 q8 23 30 23h192q13 0 22.5 -9.5t9.5 -22.5zM1536 1280v-448q0 -26 -19 -45t-45 -19h-448q-26 0 -45 19t-19 45t19 45l138 138q-148 137 -349 137q-134 0 -250 -65t-186 -179q-11 -17 -53 -117q-8 -23 -30 -23h-199q-13 0 -22.5 9.5t-9.5 22.5v7q65 268 270 434.5t480 166.5 q146 0 284 -55.5t245 -156.5l130 129q19 19 45 19t45 -19t19 -45z" />
-<glyph unicode="&#xf022;" horiz-adv-x="1792" d="M384 352v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM384 608v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M384 864v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM1536 352v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-960q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h960q13 0 22.5 -9.5t9.5 -22.5z M1536 608v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-960q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h960q13 0 22.5 -9.5t9.5 -22.5zM1536 864v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-960q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h960q13 0 22.5 -9.5 t9.5 -22.5zM1664 160v832q0 13 -9.5 22.5t-22.5 9.5h-1472q-13 0 -22.5 -9.5t-9.5 -22.5v-832q0 -13 9.5 -22.5t22.5 -9.5h1472q13 0 22.5 9.5t9.5 22.5zM1792 1248v-1088q0 -66 -47 -113t-113 -47h-1472q-66 0 -1
 13 47t-47 113v1088q0 66 47 113t113 47h1472q66 0 113 -47 t47 -113z" />
-<glyph unicode="&#xf023;" horiz-adv-x="1152" d="M320 768h512v192q0 106 -75 181t-181 75t-181 -75t-75 -181v-192zM1152 672v-576q0 -40 -28 -68t-68 -28h-960q-40 0 -68 28t-28 68v576q0 40 28 68t68 28h32v192q0 184 132 316t316 132t316 -132t132 -316v-192h32q40 0 68 -28t28 -68z" />
-<glyph unicode="&#xf024;" horiz-adv-x="1792" d="M320 1280q0 -72 -64 -110v-1266q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v1266q-64 38 -64 110q0 53 37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1792 1216v-763q0 -25 -12.5 -38.5t-39.5 -27.5q-215 -116 -369 -116q-61 0 -123.5 22t-108.5 48 t-115.5 48t-142.5 22q-192 0 -464 -146q-17 -9 -33 -9q-26 0 -45 19t-19 45v742q0 32 31 55q21 14 79 43q236 120 421 120q107 0 200 -29t219 -88q38 -19 88 -19q54 0 117.5 21t110 47t88 47t54.5 21q26 0 45 -19t19 -45z" />
-<glyph unicode="&#xf025;" horiz-adv-x="1664" d="M1664 650q0 -166 -60 -314l-20 -49l-185 -33q-22 -83 -90.5 -136.5t-156.5 -53.5v-32q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v576q0 14 9 23t23 9h64q14 0 23 -9t9 -23v-32q71 0 130 -35.5t93 -95.5l68 12q29 95 29 193q0 148 -88 279t-236.5 209t-315.5 78 t-315.5 -78t-236.5 -209t-88 -279q0 -98 29 -193l68 -12q34 60 93 95.5t130 35.5v32q0 14 9 23t23 9h64q14 0 23 -9t9 -23v-576q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v32q-88 0 -156.5 53.5t-90.5 136.5l-185 33l-20 49q-60 148 -60 314q0 151 67 291t179 242.5 t266 163.5t320 61t320 -61t266 -163.5t179 -242.5t67 -291z" />
-<glyph unicode="&#xf026;" horiz-adv-x="768" d="M768 1184v-1088q0 -26 -19 -45t-45 -19t-45 19l-333 333h-262q-26 0 -45 19t-19 45v384q0 26 19 45t45 19h262l333 333q19 19 45 19t45 -19t19 -45z" />
-<glyph unicode="&#xf027;" horiz-adv-x="1152" d="M768 1184v-1088q0 -26 -19 -45t-45 -19t-45 19l-333 333h-262q-26 0 -45 19t-19 45v384q0 26 19 45t45 19h262l333 333q19 19 45 19t45 -19t19 -45zM1152 640q0 -76 -42.5 -141.5t-112.5 -93.5q-10 -5 -25 -5q-26 0 -45 18.5t-19 45.5q0 21 12 35.5t29 25t34 23t29 35.5 t12 57t-12 57t-29 35.5t-34 23t-29 25t-12 35.5q0 27 19 45.5t45 18.5q15 0 25 -5q70 -27 112.5 -93t42.5 -142z" />
-<glyph unicode="&#xf028;" horiz-adv-x="1664" d="M768 1184v-1088q0 -26 -19 -45t-45 -19t-45 19l-333 333h-262q-26 0 -45 19t-19 45v384q0 26 19 45t45 19h262l333 333q19 19 45 19t45 -19t19 -45zM1152 640q0 -76 -42.5 -141.5t-112.5 -93.5q-10 -5 -25 -5q-26 0 -45 18.5t-19 45.5q0 21 12 35.5t29 25t34 23t29 35.5 t12 57t-12 57t-29 35.5t-34 23t-29 25t-12 35.5q0 27 19 45.5t45 18.5q15 0 25 -5q70 -27 112.5 -93t42.5 -142zM1408 640q0 -153 -85 -282.5t-225 -188.5q-13 -5 -25 -5q-27 0 -46 19t-19 45q0 39 39 59q56 29 76 44q74 54 115.5 135.5t41.5 173.5t-41.5 173.5 t-115.5 135.5q-20 15 -76 44q-39 20 -39 59q0 26 19 45t45 19q13 0 26 -5q140 -59 225 -188.5t85 -282.5zM1664 640q0 -230 -127 -422.5t-338 -283.5q-13 -5 -26 -5q-26 0 -45 19t-19 45q0 36 39 59q7 4 22.5 10.5t22.5 10.5q46 25 82 51q123 91 192 227t69 289t-69 289 t-192 227q-36 26 -82 51q-7 4 -22.5 10.5t-22.5 10.5q-39 23 -39 59q0 26 19 45t45 19q13 0 26 -5q211 -91 338 -283.5t127 -422.5z" />
-<glyph unicode="&#xf029;" horiz-adv-x="1408" d="M384 384v-128h-128v128h128zM384 1152v-128h-128v128h128zM1152 1152v-128h-128v128h128zM128 129h384v383h-384v-383zM128 896h384v384h-384v-384zM896 896h384v384h-384v-384zM640 640v-640h-640v640h640zM1152 128v-128h-128v128h128zM1408 128v-128h-128v128h128z M1408 640v-384h-384v128h-128v-384h-128v640h384v-128h128v128h128zM640 1408v-640h-640v640h640zM1408 1408v-640h-640v640h640z" />
-<glyph unicode="&#xf02a;" horiz-adv-x="1792" d="M63 0h-63v1408h63v-1408zM126 1h-32v1407h32v-1407zM220 1h-31v1407h31v-1407zM377 1h-31v1407h31v-1407zM534 1h-62v1407h62v-1407zM660 1h-31v1407h31v-1407zM723 1h-31v1407h31v-1407zM786 1h-31v1407h31v-1407zM943 1h-63v1407h63v-1407zM1100 1h-63v1407h63v-1407z M1226 1h-63v1407h63v-1407zM1352 1h-63v1407h63v-1407zM1446 1h-63v1407h63v-1407zM1635 1h-94v1407h94v-1407zM1698 1h-32v1407h32v-1407zM1792 0h-63v1408h63v-1408z" />
-<glyph unicode="&#xf02b;" d="M448 1088q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1515 512q0 -53 -37 -90l-491 -492q-39 -37 -91 -37q-53 0 -90 37l-715 716q-38 37 -64.5 101t-26.5 117v416q0 52 38 90t90 38h416q53 0 117 -26.5t102 -64.5 l715 -714q37 -39 37 -91z" />
-<glyph unicode="&#xf02c;" horiz-adv-x="1920" d="M448 1088q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1515 512q0 -53 -37 -90l-491 -492q-39 -37 -91 -37q-53 0 -90 37l-715 716q-38 37 -64.5 101t-26.5 117v416q0 52 38 90t90 38h416q53 0 117 -26.5t102 -64.5 l715 -714q37 -39 37 -91zM1899 512q0 -53 -37 -90l-491 -492q-39 -37 -91 -37q-36 0 -59 14t-53 45l470 470q37 37 37 90q0 52 -37 91l-715 714q-38 38 -102 64.5t-117 26.5h224q53 0 117 -26.5t102 -64.5l715 -714q37 -39 37 -91z" />
-<glyph unicode="&#xf02d;" horiz-adv-x="1664" d="M1639 1058q40 -57 18 -129l-275 -906q-19 -64 -76.5 -107.5t-122.5 -43.5h-923q-77 0 -148.5 53.5t-99.5 131.5q-24 67 -2 127q0 4 3 27t4 37q1 8 -3 21.5t-3 19.5q2 11 8 21t16.5 23.5t16.5 23.5q23 38 45 91.5t30 91.5q3 10 0.5 30t-0.5 28q3 11 17 28t17 23 q21 36 42 92t25 90q1 9 -2.5 32t0.5 28q4 13 22 30.5t22 22.5q19 26 42.5 84.5t27.5 96.5q1 8 -3 25.5t-2 26.5q2 8 9 18t18 23t17 21q8 12 16.5 30.5t15 35t16 36t19.5 32t26.5 23.5t36 11.5t47.5 -5.5l-1 -3q38 9 51 9h761q74 0 114 -56t18 -130l-274 -906 q-36 -119 -71.5 -153.5t-128.5 -34.5h-869q-27 0 -38 -15q-11 -16 -1 -43q24 -70 144 -70h923q29 0 56 15.5t35 41.5l300 987q7 22 5 57q38 -15 59 -43zM575 1056q-4 -13 2 -22.5t20 -9.5h608q13 0 25.5 9.5t16.5 22.5l21 64q4 13 -2 22.5t-20 9.5h-608q-13 0 -25.5 -9.5 t-16.5 -22.5zM492 800q-4 -13 2 -22.5t20 -9.5h608q13 0 25.5 9.5t16.5 22.5l21 64q4 13 -2 22.5t-20 9.5h-608q-13 0 -25.5 -9.5t-16.5 -22.5z" />
-<glyph unicode="&#xf02e;" horiz-adv-x="1280" d="M1164 1408q23 0 44 -9q33 -13 52.5 -41t19.5 -62v-1289q0 -34 -19.5 -62t-52.5 -41q-19 -8 -44 -8q-48 0 -83 32l-441 424l-441 -424q-36 -33 -83 -33q-23 0 -44 9q-33 13 -52.5 41t-19.5 62v1289q0 34 19.5 62t52.5 41q21 9 44 9h1048z" />
-<glyph unicode="&#xf02f;" horiz-adv-x="1664" d="M384 0h896v256h-896v-256zM384 640h896v384h-160q-40 0 -68 28t-28 68v160h-640v-640zM1536 576q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1664 576v-416q0 -13 -9.5 -22.5t-22.5 -9.5h-224v-160q0 -40 -28 -68t-68 -28h-960q-40 0 -68 28t-28 68 v160h-224q-13 0 -22.5 9.5t-9.5 22.5v416q0 79 56.5 135.5t135.5 56.5h64v544q0 40 28 68t68 28h672q40 0 88 -20t76 -48l152 -152q28 -28 48 -76t20 -88v-256h64q79 0 135.5 -56.5t56.5 -135.5z" />
-<glyph unicode="&#xf030;" horiz-adv-x="1920" d="M960 864q119 0 203.5 -84.5t84.5 -203.5t-84.5 -203.5t-203.5 -84.5t-203.5 84.5t-84.5 203.5t84.5 203.5t203.5 84.5zM1664 1280q106 0 181 -75t75 -181v-896q0 -106 -75 -181t-181 -75h-1408q-106 0 -181 75t-75 181v896q0 106 75 181t181 75h224l51 136 q19 49 69.5 84.5t103.5 35.5h512q53 0 103.5 -35.5t69.5 -84.5l51 -136h224zM960 128q185 0 316.5 131.5t131.5 316.5t-131.5 316.5t-316.5 131.5t-316.5 -131.5t-131.5 -316.5t131.5 -316.5t316.5 -131.5z" />
-<glyph unicode="&#xf031;" horiz-adv-x="1664" d="M725 977l-170 -450q33 0 136.5 -2t160.5 -2q19 0 57 2q-87 253 -184 452zM0 -128l2 79q23 7 56 12.5t57 10.5t49.5 14.5t44.5 29t31 50.5l237 616l280 724h75h53q8 -14 11 -21l205 -480q33 -78 106 -257.5t114 -274.5q15 -34 58 -144.5t72 -168.5q20 -45 35 -57 q19 -15 88 -29.5t84 -20.5q6 -38 6 -57q0 -4 -0.5 -13t-0.5 -13q-63 0 -190 8t-191 8q-76 0 -215 -7t-178 -8q0 43 4 78l131 28q1 0 12.5 2.5t15.5 3.5t14.5 4.5t15 6.5t11 8t9 11t2.5 14q0 16 -31 96.5t-72 177.5t-42 100l-450 2q-26 -58 -76.5 -195.5t-50.5 -162.5 q0 -22 14 -37.5t43.5 -24.5t48.5 -13.5t57 -8.5t41 -4q1 -19 1 -58q0 -9 -2 -27q-58 0 -174.5 10t-174.5 10q-8 0 -26.5 -4t-21.5 -4q-80 -14 -188 -14z" />
-<glyph unicode="&#xf032;" horiz-adv-x="1408" d="M555 15q74 -32 140 -32q376 0 376 335q0 114 -41 180q-27 44 -61.5 74t-67.5 46.5t-80.5 25t-84 10.5t-94.5 2q-73 0 -101 -10q0 -53 -0.5 -159t-0.5 -158q0 -8 -1 -67.5t-0.5 -96.5t4.5 -83.5t12 -66.5zM541 761q42 -7 109 -7q82 0 143 13t110 44.5t74.5 89.5t25.5 142 q0 70 -29 122.5t-79 82t-108 43.5t-124 14q-50 0 -130 -13q0 -50 4 -151t4 -152q0 -27 -0.5 -80t-0.5 -79q0 -46 1 -69zM0 -128l2 94q15 4 85 16t106 27q7 12 12.5 27t8.5 33.5t5.5 32.5t3 37.5t0.5 34v35.5v30q0 982 -22 1025q-4 8 -22 14.5t-44.5 11t-49.5 7t-48.5 4.5 t-30.5 3l-4 83q98 2 340 11.5t373 9.5q23 0 68.5 -0.5t67.5 -0.5q70 0 136.5 -13t128.5 -42t108 -71t74 -104.5t28 -137.5q0 -52 -16.5 -95.5t-39 -72t-64.5 -57.5t-73 -45t-84 -40q154 -35 256.5 -134t102.5 -248q0 -100 -35 -179.5t-93.5 -130.5t-138 -85.5t-163.5 -48.5 t-176 -14q-44 0 -132 3t-132 3q-106 0 -307 -11t-231 -12z" />
-<glyph unicode="&#xf033;" horiz-adv-x="1024" d="M0 -126l17 85q6 2 81.5 21.5t111.5 37.5q28 35 41 101q1 7 62 289t114 543.5t52 296.5v25q-24 13 -54.5 18.5t-69.5 8t-58 5.5l19 103q33 -2 120 -6.5t149.5 -7t120.5 -2.5q48 0 98.5 2.5t121 7t98.5 6.5q-5 -39 -19 -89q-30 -10 -101.5 -28.5t-108.5 -33.5 q-8 -19 -14 -42.5t-9 -40t-7.5 -45.5t-6.5 -42q-27 -148 -87.5 -419.5t-77.5 -355.5q-2 -9 -13 -58t-20 -90t-16 -83.5t-6 -57.5l1 -18q17 -4 185 -31q-3 -44 -16 -99q-11 0 -32.5 -1.5t-32.5 -1.5q-29 0 -87 10t-86 10q-138 2 -206 2q-51 0 -143 -9t-121 -11z" />
-<glyph unicode="&#xf034;" horiz-adv-x="1792" d="M1744 128q33 0 42 -18.5t-11 -44.5l-126 -162q-20 -26 -49 -26t-49 26l-126 162q-20 26 -11 44.5t42 18.5h80v1024h-80q-33 0 -42 18.5t11 44.5l126 162q20 26 49 26t49 -26l126 -162q20 -26 11 -44.5t-42 -18.5h-80v-1024h80zM81 1407l54 -27q12 -5 211 -5q44 0 132 2 t132 2q36 0 107.5 -0.5t107.5 -0.5h293q6 0 21 -0.5t20.5 0t16 3t17.5 9t15 17.5l42 1q4 0 14 -0.5t14 -0.5q2 -112 2 -336q0 -80 -5 -109q-39 -14 -68 -18q-25 44 -54 128q-3 9 -11 48t-14.5 73.5t-7.5 35.5q-6 8 -12 12.5t-15.5 6t-13 2.5t-18 0.5t-16.5 -0.5 q-17 0 -66.5 0.5t-74.5 0.5t-64 -2t-71 -6q-9 -81 -8 -136q0 -94 2 -388t2 -455q0 -16 -2.5 -71.5t0 -91.5t12.5 -69q40 -21 124 -42.5t120 -37.5q5 -40 5 -50q0 -14 -3 -29l-34 -1q-76 -2 -218 8t-207 10q-50 0 -151 -9t-152 -9q-3 51 -3 52v9q17 27 61.5 43t98.5 29t78 27 q19 42 19 383q0 101 -3 303t-3 303v117q0 2 0.5 15.5t0.5 25t-1 25.5t-3 24t-5 14q-11 12 -162 12q-33 0 -93 -12t-80 -26q-19 -13 -34 -72.5t-31.5 -111t-42.5 -53.5q-42 26 -56 44v383z" />
-<glyph unicode="&#xf035;" d="M81 1407l54 -27q12 -5 211 -5q44 0 132 2t132 2q70 0 246.5 1t304.5 0.5t247 -4.5q33 -1 56 31l42 1q4 0 14 -0.5t14 -0.5q2 -112 2 -336q0 -80 -5 -109q-39 -14 -68 -18q-25 44 -54 128q-3 9 -11 47.5t-15 73.5t-7 36q-10 13 -27 19q-5 2 -66 2q-30 0 -93 1t-103 1 t-94 -2t-96 -7q-9 -81 -8 -136l1 -152v52q0 -55 1 -154t1.5 -180t0.5 -153q0 -16 -2.5 -71.5t0 -91.5t12.5 -69q40 -21 124 -42.5t120 -37.5q5 -40 5 -50q0 -14 -3 -29l-34 -1q-76 -2 -218 8t-207 10q-50 0 -151 -9t-152 -9q-3 51 -3 52v9q17 27 61.5 43t98.5 29t78 27 q7 16 11.5 74t6 145.5t1.5 155t-0.5 153.5t-0.5 89q0 7 -2.5 21.5t-2.5 22.5q0 7 0.5 44t1 73t0 76.5t-3 67.5t-6.5 32q-11 12 -162 12q-41 0 -163 -13.5t-138 -24.5q-19 -12 -34 -71.5t-31.5 -111.5t-42.5 -54q-42 26 -56 44v383zM1310 125q12 0 42 -19.5t57.5 -41.5 t59.5 -49t36 -30q26 -21 26 -49t-26 -49q-4 -3 -36 -30t-59.5 -49t-57.5 -41.5t-42 -19.5q-13 0 -20.5 10.5t-10 28.5t-2.5 33.5t1.5 33t1.5 19.5h-1024q0 -2 1.5 -19.5t1.5 -33t-2.5 -33.5t-10 -28.5t-20.5 -10.5q-12 0 -42 19.5t-57.5 41
 .5t-59.5 49t-36 30q-26 21 -26 49 t26 49q4 3 36 30t59.5 49t57.5 41.5t42 19.5q13 0 20.5 -10.5t10 -28.5t2.5 -33.5t-1.5 -33t-1.5 -19.5h1024q0 2 -1.5 19.5t-1.5 33t2.5 33.5t10 28.5t20.5 10.5z" />
-<glyph unicode="&#xf036;" horiz-adv-x="1792" d="M1792 192v-128q0 -26 -19 -45t-45 -19h-1664q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1664q26 0 45 -19t19 -45zM1408 576v-128q0 -26 -19 -45t-45 -19h-1280q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1280q26 0 45 -19t19 -45zM1664 960v-128q0 -26 -19 -45 t-45 -19h-1536q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1536q26 0 45 -19t19 -45zM1280 1344v-128q0 -26 -19 -45t-45 -19h-1152q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1152q26 0 45 -19t19 -45z" />
-<glyph unicode="&#xf037;" horiz-adv-x="1792" d="M1792 192v-128q0 -26 -19 -45t-45 -19h-1664q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1664q26 0 45 -19t19 -45zM1408 576v-128q0 -26 -19 -45t-45 -19h-896q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h896q26 0 45 -19t19 -45zM1664 960v-128q0 -26 -19 -45t-45 -19 h-1408q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1408q26 0 45 -19t19 -45zM1280 1344v-128q0 -26 -19 -45t-45 -19h-640q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h640q26 0 45 -19t19 -45z" />
-<glyph unicode="&#xf038;" horiz-adv-x="1792" d="M1792 192v-128q0 -26 -19 -45t-45 -19h-1664q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1664q26 0 45 -19t19 -45zM1792 576v-128q0 -26 -19 -45t-45 -19h-1280q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1280q26 0 45 -19t19 -45zM1792 960v-128q0 -26 -19 -45 t-45 -19h-1536q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1536q26 0 45 -19t19 -45zM1792 1344v-128q0 -26 -19 -45t-45 -19h-1152q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1152q26 0 45 -19t19 -45z" />
-<glyph unicode="&#xf039;" horiz-adv-x="1792" d="M1792 192v-128q0 -26 -19 -45t-45 -19h-1664q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1664q26 0 45 -19t19 -45zM1792 576v-128q0 -26 -19 -45t-45 -19h-1664q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1664q26 0 45 -19t19 -45zM1792 960v-128q0 -26 -19 -45 t-45 -19h-1664q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1664q26 0 45 -19t19 -45zM1792 1344v-128q0 -26 -19 -45t-45 -19h-1664q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1664q26 0 45 -19t19 -45z" />
-<glyph unicode="&#xf03a;" horiz-adv-x="1792" d="M256 224v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-192q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h192q13 0 22.5 -9.5t9.5 -22.5zM256 608v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-192q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h192q13 0 22.5 -9.5 t9.5 -22.5zM256 992v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-192q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h192q13 0 22.5 -9.5t9.5 -22.5zM1792 224v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1344q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1344 q13 0 22.5 -9.5t9.5 -22.5zM256 1376v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-192q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h192q13 0 22.5 -9.5t9.5 -22.5zM1792 608v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1344q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5 t22.5 9.5h1344q13 0 22.5 -9.5t9.5 -22.5zM1792 992v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1344q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1344q13 0 22.5 -9.5t9.5 -22.5zM1792 1376v-192q0 -13 -9.5 -22.5t
 -22.5 -9.5h-1344q-13 0 -22.5 9.5t-9.5 22.5v192 q0 13 9.5 22.5t22.5 9.5h1344q13 0 22.5 -9.5t9.5 -22.5z" />
-<glyph unicode="&#xf03b;" horiz-adv-x="1792" d="M384 992v-576q0 -13 -9.5 -22.5t-22.5 -9.5q-14 0 -23 9l-288 288q-9 9 -9 23t9 23l288 288q9 9 23 9q13 0 22.5 -9.5t9.5 -22.5zM1792 224v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1728q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1728q13 0 22.5 -9.5 t9.5 -22.5zM1792 608v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1088q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1088q13 0 22.5 -9.5t9.5 -22.5zM1792 992v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1088q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1088 q13 0 22.5 -9.5t9.5 -22.5zM1792 1376v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1728q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1728q13 0 22.5 -9.5t9.5 -22.5z" />
-<glyph unicode="&#xf03c;" horiz-adv-x="1792" d="M352 704q0 -14 -9 -23l-288 -288q-9 -9 -23 -9q-13 0 -22.5 9.5t-9.5 22.5v576q0 13 9.5 22.5t22.5 9.5q14 0 23 -9l288 -288q9 -9 9 -23zM1792 224v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1728q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1728q13 0 22.5 -9.5 t9.5 -22.5zM1792 608v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1088q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1088q13 0 22.5 -9.5t9.5 -22.5zM1792 992v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1088q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1088 q13 0 22.5 -9.5t9.5 -22.5zM1792 1376v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1728q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1728q13 0 22.5 -9.5t9.5 -22.5z" />
-<glyph unicode="&#xf03d;" horiz-adv-x="1792" d="M1792 1184v-1088q0 -42 -39 -59q-13 -5 -25 -5q-27 0 -45 19l-403 403v-166q0 -119 -84.5 -203.5t-203.5 -84.5h-704q-119 0 -203.5 84.5t-84.5 203.5v704q0 119 84.5 203.5t203.5 84.5h704q119 0 203.5 -84.5t84.5 -203.5v-165l403 402q18 19 45 19q12 0 25 -5 q39 -17 39 -59z" />
-<glyph unicode="&#xf03e;" horiz-adv-x="1920" d="M640 960q0 -80 -56 -136t-136 -56t-136 56t-56 136t56 136t136 56t136 -56t56 -136zM1664 576v-448h-1408v192l320 320l160 -160l512 512zM1760 1280h-1600q-13 0 -22.5 -9.5t-9.5 -22.5v-1216q0 -13 9.5 -22.5t22.5 -9.5h1600q13 0 22.5 9.5t9.5 22.5v1216 q0 13 -9.5 22.5t-22.5 9.5zM1920 1248v-1216q0 -66 -47 -113t-113 -47h-1600q-66 0 -113 47t-47 113v1216q0 66 47 113t113 47h1600q66 0 113 -47t47 -113z" />
-<glyph unicode="&#xf040;" d="M363 0l91 91l-235 235l-91 -91v-107h128v-128h107zM886 928q0 22 -22 22q-10 0 -17 -7l-542 -542q-7 -7 -7 -17q0 -22 22 -22q10 0 17 7l542 542q7 7 7 17zM832 1120l416 -416l-832 -832h-416v416zM1515 1024q0 -53 -37 -90l-166 -166l-416 416l166 165q36 38 90 38 q53 0 91 -38l235 -234q37 -39 37 -91z" />
-<glyph unicode="&#xf041;" horiz-adv-x="1024" d="M768 896q0 106 -75 181t-181 75t-181 -75t-75 -181t75 -181t181 -75t181 75t75 181zM1024 896q0 -109 -33 -179l-364 -774q-16 -33 -47.5 -52t-67.5 -19t-67.5 19t-46.5 52l-365 774q-33 70 -33 179q0 212 150 362t362 150t362 -150t150 -362z" />
-<glyph unicode="&#xf042;" d="M768 96v1088q-148 0 -273 -73t-198 -198t-73 -273t73 -273t198 -198t273 -73zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" />
-<glyph unicode="&#xf043;" horiz-adv-x="1024" d="M512 384q0 36 -20 69q-1 1 -15.5 22.5t-25.5 38t-25 44t-21 50.5q-4 16 -21 16t-21 -16q-7 -23 -21 -50.5t-25 -44t-25.5 -38t-15.5 -22.5q-20 -33 -20 -69q0 -53 37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1024 512q0 -212 -150 -362t-362 -150t-362 150t-150 362 q0 145 81 275q6 9 62.5 90.5t101 151t99.5 178t83 201.5q9 30 34 47t51 17t51.5 -17t33.5 -47q28 -93 83 -201.5t99.5 -178t101 -151t62.5 -90.5q81 -127 81 -275z" />
-<glyph unicode="&#xf044;" horiz-adv-x="1792" d="M888 352l116 116l-152 152l-116 -116v-56h96v-96h56zM1328 1072q-16 16 -33 -1l-350 -350q-17 -17 -1 -33t33 1l350 350q17 17 1 33zM1408 478v-190q0 -119 -84.5 -203.5t-203.5 -84.5h-832q-119 0 -203.5 84.5t-84.5 203.5v832q0 119 84.5 203.5t203.5 84.5h832 q63 0 117 -25q15 -7 18 -23q3 -17 -9 -29l-49 -49q-14 -14 -32 -8q-23 6 -45 6h-832q-66 0 -113 -47t-47 -113v-832q0 -66 47 -113t113 -47h832q66 0 113 47t47 113v126q0 13 9 22l64 64q15 15 35 7t20 -29zM1312 1216l288 -288l-672 -672h-288v288zM1756 1084l-92 -92 l-288 288l92 92q28 28 68 28t68 -28l152 -152q28 -28 28 -68t-28 -68z" />
-<glyph unicode="&#xf045;" horiz-adv-x="1664" d="M1408 547v-259q0 -119 -84.5 -203.5t-203.5 -84.5h-832q-119 0 -203.5 84.5t-84.5 203.5v832q0 119 84.5 203.5t203.5 84.5h255v0q13 0 22.5 -9.5t9.5 -22.5q0 -27 -26 -32q-77 -26 -133 -60q-10 -4 -16 -4h-112q-66 0 -113 -47t-47 -113v-832q0 -66 47 -113t113 -47h832 q66 0 113 47t47 113v214q0 19 18 29q28 13 54 37q16 16 35 8q21 -9 21 -29zM1645 1043l-384 -384q-18 -19 -45 -19q-12 0 -25 5q-39 17 -39 59v192h-160q-323 0 -438 -131q-119 -137 -74 -473q3 -23 -20 -34q-8 -2 -12 -2q-16 0 -26 13q-10 14 -21 31t-39.5 68.5t-49.5 99.5 t-38.5 114t-17.5 122q0 49 3.5 91t14 90t28 88t47 81.5t68.5 74t94.5 61.5t124.5 48.5t159.5 30.5t196.5 11h160v192q0 42 39 59q13 5 25 5q26 0 45 -19l384 -384q19 -19 19 -45t-19 -45z" />
-<glyph unicode="&#xf046;" horiz-adv-x="1664" d="M1408 606v-318q0 -119 -84.5 -203.5t-203.5 -84.5h-832q-119 0 -203.5 84.5t-84.5 203.5v832q0 119 84.5 203.5t203.5 84.5h832q63 0 117 -25q15 -7 18 -23q3 -17 -9 -29l-49 -49q-10 -10 -23 -10q-3 0 -9 2q-23 6 -45 6h-832q-66 0 -113 -47t-47 -113v-832 q0 -66 47 -113t113 -47h832q66 0 113 47t47 113v254q0 13 9 22l64 64q10 10 23 10q6 0 12 -3q20 -8 20 -29zM1639 1095l-814 -814q-24 -24 -57 -24t-57 24l-430 430q-24 24 -24 57t24 57l110 110q24 24 57 24t57 -24l263 -263l647 647q24 24 57 24t57 -24l110 -110 q24 -24 24 -57t-24 -57z" />
-<glyph unicode="&#xf047;" horiz-adv-x="1792" d="M1792 640q0 -26 -19 -45l-256 -256q-19 -19 -45 -19t-45 19t-19 45v128h-384v-384h128q26 0 45 -19t19 -45t-19 -45l-256 -256q-19 -19 -45 -19t-45 19l-256 256q-19 19 -19 45t19 45t45 19h128v384h-384v-128q0 -26 -19 -45t-45 -19t-45 19l-256 256q-19 19 -19 45 t19 45l256 256q19 19 45 19t45 -19t19 -45v-128h384v384h-128q-26 0 -45 19t-19 45t19 45l256 256q19 19 45 19t45 -19l256 -256q19 -19 19 -45t-19 -45t-45 -19h-128v-384h384v128q0 26 19 45t45 19t45 -19l256 -256q19 -19 19 -45z" />
-<glyph unicode="&#xf048;" horiz-adv-x="1024" d="M979 1395q19 19 32 13t13 -32v-1472q0 -26 -13 -32t-32 13l-710 710q-9 9 -13 19v-678q0 -26 -19 -45t-45 -19h-128q-26 0 -45 19t-19 45v1408q0 26 19 45t45 19h128q26 0 45 -19t19 -45v-678q4 11 13 19z" />
-<glyph unicode="&#xf049;" horiz-adv-x="1792" d="M1747 1395q19 19 32 13t13 -32v-1472q0 -26 -13 -32t-32 13l-710 710q-9 9 -13 19v-710q0 -26 -13 -32t-32 13l-710 710q-9 9 -13 19v-678q0 -26 -19 -45t-45 -19h-128q-26 0 -45 19t-19 45v1408q0 26 19 45t45 19h128q26 0 45 -19t19 -45v-678q4 11 13 19l710 710 q19 19 32 13t13 -32v-710q4 11 13 19z" />
-<glyph unicode="&#xf04a;" horiz-adv-x="1664" d="M1619 1395q19 19 32 13t13 -32v-1472q0 -26 -13 -32t-32 13l-710 710q-8 9 -13 19v-710q0 -26 -13 -32t-32 13l-710 710q-19 19 -19 45t19 45l710 710q19 19 32 13t13 -32v-710q5 11 13 19z" />
-<glyph unicode="&#xf04b;" horiz-adv-x="1408" d="M1384 609l-1328 -738q-23 -13 -39.5 -3t-16.5 36v1472q0 26 16.5 36t39.5 -3l1328 -738q23 -13 23 -31t-23 -31z" />
-<glyph unicode="&#xf04c;" d="M1536 1344v-1408q0 -26 -19 -45t-45 -19h-512q-26 0 -45 19t-19 45v1408q0 26 19 45t45 19h512q26 0 45 -19t19 -45zM640 1344v-1408q0 -26 -19 -45t-45 -19h-512q-26 0 -45 19t-19 45v1408q0 26 19 45t45 19h512q26 0 45 -19t19 -45z" />
-<glyph unicode="&#xf04d;" d="M1536 1344v-1408q0 -26 -19 -45t-45 -19h-1408q-26 0 -45 19t-19 45v1408q0 26 19 45t45 19h1408q26 0 45 -19t19 -45z" />
-<glyph unicode="&#xf04e;" horiz-adv-x="1664" d="M45 -115q-19 -19 -32 -13t-13 32v1472q0 26 13 32t32 -13l710 -710q8 -8 13 -19v710q0 26 13 32t32 -13l710 -710q19 -19 19 -45t-19 -45l-710 -710q-19 -19 -32 -13t-13 32v710q-5 -10 -13 -19z" />
-<glyph unicode="&#xf050;" horiz-adv-x="1792" d="M45 -115q-19 -19 -32 -13t-13 32v1472q0 26 13 32t32 -13l710 -710q8 -8 13 -19v710q0 26 13 32t32 -13l710 -710q8 -8 13 -19v678q0 26 19 45t45 19h128q26 0 45 -19t19 -45v-1408q0 -26 -19 -45t-45 -19h-128q-26 0 -45 19t-19 45v678q-5 -10 -13 -19l-710 -710 q-19 -19 -32 -13t-13 32v710q-5 -10 -13 -19z" />
-<glyph unicode="&#xf051;" horiz-adv-x="1024" d="M45 -115q-19 -19 -32 -13t-13 32v1472q0 26 13 32t32 -13l710 -710q8 -8 13 -19v678q0 26 19 45t45 19h128q26 0 45 -19t19 -45v-1408q0 -26 -19 -45t-45 -19h-128q-26 0 -45 19t-19 45v678q-5 -10 -13 -19z" />
-<glyph unicode="&#xf052;" horiz-adv-x="1538" d="M14 557l710 710q19 19 45 19t45 -19l710 -710q19 -19 13 -32t-32 -13h-1472q-26 0 -32 13t13 32zM1473 0h-1408q-26 0 -45 19t-19 45v256q0 26 19 45t45 19h1408q26 0 45 -19t19 -45v-256q0 -26 -19 -45t-45 -19z" />
-<glyph unicode="&#xf053;" horiz-adv-x="1280" d="M1171 1235l-531 -531l531 -531q19 -19 19 -45t-19 -45l-166 -166q-19 -19 -45 -19t-45 19l-742 742q-19 19 -19 45t19 45l742 742q19 19 45 19t45 -19l166 -166q19 -19 19 -45t-19 -45z" />
-<glyph unicode="&#xf054;" horiz-adv-x="1280" d="M1107 659l-742 -742q-19 -19 -45 -19t-45 19l-166 166q-19 19 -19 45t19 45l531 531l-531 531q-19 19 -19 45t19 45l166 166q19 19 45 19t45 -19l742 -742q19 -19 19 -45t-19 -45z" />
-<glyph unicode="&#xf055;" d="M1216 576v128q0 26 -19 45t-45 19h-256v256q0 26 -19 45t-45 19h-128q-26 0 -45 -19t-19 -45v-256h-256q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h256v-256q0 -26 19 -45t45 -19h128q26 0 45 19t19 45v256h256q26 0 45 19t19 45zM1536 640q0 -209 -103 -385.5 t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" />
-<glyph unicode="&#xf056;" d="M1216 576v128q0 26 -19 45t-45 19h-768q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h768q26 0 45 19t19 45zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5 t103 -385.5z" />
-<glyph unicode="&#xf057;" d="M1149 414q0 26 -19 45l-181 181l181 181q19 19 19 45q0 27 -19 46l-90 90q-19 19 -46 19q-26 0 -45 -19l-181 -181l-181 181q-19 19 -45 19q-27 0 -46 -19l-90 -90q-19 -19 -19 -46q0 -26 19 -45l181 -181l-181 -181q-19 -19 -19 -45q0 -27 19 -46l90 -90q19 -19 46 -19 q26 0 45 19l181 181l181 -181q19 -19 45 -19q27 0 46 19l90 90q19 19 19 46zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" />
-<glyph unicode="&#xf058;" d="M1284 802q0 28 -18 46l-91 90q-19 19 -45 19t-45 -19l-408 -407l-226 226q-19 19 -45 19t-45 -19l-91 -90q-18 -18 -18 -46q0 -27 18 -45l362 -362q19 -19 45 -19q27 0 46 19l543 543q18 18 18 45zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103 t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" />
-<glyph unicode="&#xf059;" d="M896 160v192q0 14 -9 23t-23 9h-192q-14 0 -23 -9t-9 -23v-192q0 -14 9 -23t23 -9h192q14 0 23 9t9 23zM1152 832q0 88 -55.5 163t-138.5 116t-170 41q-243 0 -371 -213q-15 -24 8 -42l132 -100q7 -6 19 -6q16 0 25 12q53 68 86 92q34 24 86 24q48 0 85.5 -26t37.5 -59 q0 -38 -20 -61t-68 -45q-63 -28 -115.5 -86.5t-52.5 -125.5v-36q0 -14 9 -23t23 -9h192q14 0 23 9t9 23q0 19 21.5 49.5t54.5 49.5q32 18 49 28.5t46 35t44.5 48t28 60.5t12.5 81zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5 t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" />
-<glyph unicode="&#xf05a;" d="M1024 160v160q0 14 -9 23t-23 9h-96v512q0 14 -9 23t-23 9h-320q-14 0 -23 -9t-9 -23v-160q0 -14 9 -23t23 -9h96v-320h-96q-14 0 -23 -9t-9 -23v-160q0 -14 9 -23t23 -9h448q14 0 23 9t9 23zM896 1056v160q0 14 -9 23t-23 9h-192q-14 0 -23 -9t-9 -23v-160q0 -14 9 -23 t23 -9h192q14 0 23 9t9 23zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" />
-<glyph unicode="&#xf05b;" d="M1197 512h-109q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h109q-32 108 -112.5 188.5t-188.5 112.5v-109q0 -26 -19 -45t-45 -19h-128q-26 0 -45 19t-19 45v109q-108 -32 -188.5 -112.5t-112.5 -188.5h109q26 0 45 -19t19 -45v-128q0 -26 -19 -45t-45 -19h-109 q32 -108 112.5 -188.5t188.5 -112.5v109q0 26 19 45t45 19h128q26 0 45 -19t19 -45v-109q108 32 188.5 112.5t112.5 188.5zM1536 704v-128q0 -26 -19 -45t-45 -19h-143q-37 -161 -154.5 -278.5t-278.5 -154.5v-143q0 -26 -19 -45t-45 -19h-128q-26 0 -45 19t-19 45v143 q-161 37 -278.5 154.5t-154.5 278.5h-143q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h143q37 161 154.5 278.5t278.5 154.5v143q0 26 19 45t45 19h128q26 0 45 -19t19 -45v-143q161 -37 278.5 -154.5t154.5 -278.5h143q26 0 45 -19t19 -45z" />
-<glyph unicode="&#xf05c;" d="M1097 457l-146 -146q-10 -10 -23 -10t-23 10l-137 137l-137 -137q-10 -10 -23 -10t-23 10l-146 146q-10 10 -10 23t10 23l137 137l-137 137q-10 10 -10 23t10 23l146 146q10 10 23 10t23 -10l137 -137l137 137q10 10 23 10t23 -10l146 -146q10 -10 10 -23t-10 -23 l-137 -137l137 -137q10 -10 10 -23t-10 -23zM1312 640q0 148 -73 273t-198 198t-273 73t-273 -73t-198 -198t-73 -273t73 -273t198 -198t273 -73t273 73t198 198t73 273zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5 t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" />
-<glyph unicode="&#xf05d;" d="M1171 723l-422 -422q-19 -19 -45 -19t-45 19l-294 294q-19 19 -19 45t19 45l102 102q19 19 45 19t45 -19l147 -147l275 275q19 19 45 19t45 -19l102 -102q19 -19 19 -45t-19 -45zM1312 640q0 148 -73 273t-198 198t-273 73t-273 -73t-198 -198t-73 -273t73 -273t198 -198 t273 -73t273 73t198 198t73 273zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" />
-<glyph unicode="&#xf05e;" d="M1312 643q0 161 -87 295l-754 -753q137 -89 297 -89q111 0 211.5 43.5t173.5 116.5t116 174.5t43 212.5zM313 344l755 754q-135 91 -300 91q-148 0 -273 -73t-198 -199t-73 -274q0 -162 89 -299zM1536 643q0 -157 -61 -300t-163.5 -246t-245 -164t-298.5 -61t-298.5 61 t-245 164t-163.5 246t-61 300t61 299.5t163.5 245.5t245 164t298.5 61t298.5 -61t245 -164t163.5 -245.5t61 -299.5z" />
-<glyph unicode="&#xf060;" d="M1536 640v-128q0 -53 -32.5 -90.5t-84.5 -37.5h-704l293 -294q38 -36 38 -90t-38 -90l-75 -76q-37 -37 -90 -37q-52 0 -91 37l-651 652q-37 37 -37 90q0 52 37 91l651 650q38 38 91 38q52 0 90 -38l75 -74q38 -38 38 -91t-38 -91l-293 -293h704q52 0 84.5 -37.5 t32.5 -90.5z" />
-<glyph unicode="&#xf061;" d="M1472 576q0 -54 -37 -91l-651 -651q-39 -37 -91 -37q-51 0 -90 37l-75 75q-38 38 -38 91t38 91l293 293h-704q-52 0 -84.5 37.5t-32.5 90.5v128q0 53 32.5 90.5t84.5 37.5h704l-293 294q-38 36 -38 90t38 90l75 75q38 38 90 38q53 0 91 -38l651 -651q37 -35 37 -90z" />
-<glyph unicode="&#xf062;" horiz-adv-x="1664" d="M1611 565q0 -51 -37 -90l-75 -75q-38 -38 -91 -38q-54 0 -90 38l-294 293v-704q0 -52 -37.5 -84.5t-90.5 -32.5h-128q-53 0 -90.5 32.5t-37.5 84.5v704l-294 -293q-36 -38 -90 -38t-90 38l-75 75q-38 38 -38 90q0 53 38 91l651 651q35 37 90 37q54 0 91 -37l651 -651 q37 -39 37 -91z" />
-<glyph unicode="&#xf063;" horiz-adv-x="1664" d="M1611 704q0 -53 -37 -90l-651 -652q-39 -37 -91 -37q-53 0 -90 37l-651 652q-38 36 -38 90q0 53 38 91l74 75q39 37 91 37q53 0 90 -37l294 -294v704q0 52 38 90t90 38h128q52 0 90 -38t38 -90v-704l294 294q37 37 90 37q52 0 91 -37l75 -75q37 -39 37 -91z" />
-<glyph unicode="&#xf064;" horiz-adv-x="1792" d="M1792 896q0 -26 -19 -45l-512 -512q-19 -19 -45 -19t-45 19t-19 45v256h-224q-98 0 -175.5 -6t-154 -21.5t-133 -42.5t-105.5 -69.5t-80 -101t-48.5 -138.5t-17.5 -181q0 -55 5 -123q0 -6 2.5 -23.5t2.5 -26.5q0 -15 -8.5 -25t-23.5 -10q-16 0 -28 17q-7 9 -13 22 t-13.5 30t-10.5 24q-127 285 -127 451q0 199 53 333q162 403 875 403h224v256q0 26 19 45t45 19t45 -19l512 -512q19 -19 19 -45z" />
-<glyph unicode="&#xf065;" d="M755 480q0 -13 -10 -23l-332 -332l144 -144q19 -19 19 -45t-19 -45t-45 -19h-448q-26 0 -45 19t-19 45v448q0 26 19 45t45 19t45 -19l144 -144l332 332q10 10 23 10t23 -10l114 -114q10 -10 10 -23zM1536 1344v-448q0 -26 -19 -45t-45 -19t-45 19l-144 144l-332 -332 q-10 -10 -23 -10t-23 10l-114 114q-10 10 -10 23t10 23l332 332l-144 144q-19 19 -19 45t19 45t45 19h448q26 0 45 -19t19 -45z" />
-<glyph unicode="&#xf066;" d="M768 576v-448q0 -26 -19 -45t-45 -19t-45 19l-144 144l-332 -332q-10 -10 -23 -10t-23 10l-114 114q-10 10 -10 23t10 23l332 332l-144 144q-19 19 -19 45t19 45t45 19h448q26 0 45 -19t19 -45zM1523 1248q0 -13 -10 -23l-332 -332l144 -144q19 -19 19 -45t-19 -45 t-45 -19h-448q-26 0 -45 19t-19 45v448q0 26 19 45t45 19t45 -19l144 -144l332 332q10 10 23 10t23 -10l114 -114q10 -10 10 -23z" />
-<glyph unicode="&#xf067;" horiz-adv-x="1408" d="M1408 800v-192q0 -40 -28 -68t-68 -28h-416v-416q0 -40 -28 -68t-68 -28h-192q-40 0 -68 28t-28 68v416h-416q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h416v416q0 40 28 68t68 28h192q40 0 68 -28t28 -68v-416h416q40 0 68 -28t28 -68z" />
-<glyph unicode="&#xf068;" horiz-adv-x="1408" d="M1408 800v-192q0 -40 -28 -68t-68 -28h-1216q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h1216q40 0 68 -28t28 -68z" />
-<glyph unicode="&#xf069;" horiz-adv-x="1664" d="M1482 486q46 -26 59.5 -77.5t-12.5 -97.5l-64 -110q-26 -46 -77.5 -59.5t-97.5 12.5l-266 153v-307q0 -52 -38 -90t-90 -38h-128q-52 0 -90 38t-38 90v307l-266 -153q-46 -26 -97.5 -12.5t-77.5 59.5l-64 110q-26 46 -12.5 97.5t59.5 77.5l266 154l-266 154 q-46 26 -59.5 77.5t12.5 97.5l64 110q26 46 77.5 59.5t97.5 -12.5l266 -153v307q0 52 38 90t90 38h128q52 0 90 -38t38 -90v-307l266 153q46 26 97.5 12.5t77.5 -59.5l64 -110q26 -46 12.5 -97.5t-59.5 -77.5l-266 -154z" />
-<glyph unicode="&#xf06a;" d="M768 1408q209 0 385.5 -103t279.5 -279.5t103 -385.5t-103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103zM896 161v190q0 14 -9 23.5t-22 9.5h-192q-13 0 -23 -10t-10 -23v-190q0 -13 10 -23t23 -10h192 q13 0 22 9.5t9 23.5zM894 505l18 621q0 12 -10 18q-10 8 -24 8h-220q-14 0 -24 -8q-10 -6 -10 -18l17 -621q0 -10 10 -17.5t24 -7.5h185q14 0 23.5 7.5t10.5 17.5z" />
-<glyph unicode="&#xf06b;" d="M928 180v56v468v192h-320v-192v-468v-56q0 -25 18 -38.5t46 -13.5h192q28 0 46 13.5t18 38.5zM472 1024h195l-126 161q-26 31 -69 31q-40 0 -68 -28t-28 -68t28 -68t68 -28zM1160 1120q0 40 -28 68t-68 28q-43 0 -69 -31l-125 -161h194q40 0 68 28t28 68zM1536 864v-320 q0 -14 -9 -23t-23 -9h-96v-416q0 -40 -28 -68t-68 -28h-1088q-40 0 -68 28t-28 68v416h-96q-14 0 -23 9t-9 23v320q0 14 9 23t23 9h440q-93 0 -158.5 65.5t-65.5 158.5t65.5 158.5t158.5 65.5q107 0 168 -77l128 -165l128 165q61 77 168 77q93 0 158.5 -65.5t65.5 -158.5 t-65.5 -158.5t-158.5 -65.5h440q14 0 23 -9t9 -23z" />
-<glyph unicode="&#xf06c;" horiz-adv-x="1792" d="M1280 832q0 26 -19 45t-45 19q-172 0 -318 -49.5t-259.5 -134t-235.5 -219.5q-19 -21 -19 -45q0 -26 19 -45t45 -19q24 0 45 19q27 24 74 71t67 66q137 124 268.5 176t313.5 52q26 0 45 19t19 45zM1792 1030q0 -95 -20 -193q-46 -224 -184.5 -383t-357.5 -268 q-214 -108 -438 -108q-148 0 -286 47q-15 5 -88 42t-96 37q-16 0 -39.5 -32t-45 -70t-52.5 -70t-60 -32q-30 0 -51 11t-31 24t-27 42q-2 4 -6 11t-5.5 10t-3 9.5t-1.5 13.5q0 35 31 73.5t68 65.5t68 56t31 48q0 4 -14 38t-16 44q-9 51 -9 104q0 115 43.5 220t119 184.5 t170.5 139t204 95.5q55 18 145 25.5t179.5 9t178.5 6t163.5 24t113.5 56.5l29.5 29.5t29.5 28t27 20t36.5 16t43.5 4.5q39 0 70.5 -46t47.5 -112t24 -124t8 -96z" />
-<glyph unicode="&#xf06d;" horiz-adv-x="1408" d="M1408 -160v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-1344q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h1344q13 0 22.5 -9.5t9.5 -22.5zM1152 896q0 -78 -24.5 -144t-64 -112.5t-87.5 -88t-96 -77.5t-87.5 -72t-64 -81.5t-24.5 -96.5q0 -96 67 -224l-4 1l1 -1 q-90 41 -160 83t-138.5 100t-113.5 122.5t-72.5 150.5t-27.5 184q0 78 24.5 144t64 112.5t87.5 88t96 77.5t87.5 72t64 81.5t24.5 96.5q0 94 -66 224l3 -1l-1 1q90 -41 160 -83t138.5 -100t113.5 -122.5t72.5 -150.5t27.5 -184z" />
-<glyph unicode="&#xf06e;" horiz-adv-x="1792" d="M1664 576q-152 236 -381 353q61 -104 61 -225q0 -185 -131.5 -316.5t-316.5 -131.5t-316.5 131.5t-131.5 316.5q0 121 61 225q-229 -117 -381 -353q133 -205 333.5 -326.5t434.5 -121.5t434.5 121.5t333.5 326.5zM944 960q0 20 -14 34t-34 14q-125 0 -214.5 -89.5 t-89.5 -214.5q0 -20 14 -34t34 -14t34 14t14 34q0 86 61 147t147 61q20 0 34 14t14 34zM1792 576q0 -34 -20 -69q-140 -230 -376.5 -368.5t-499.5 -138.5t-499.5 139t-376.5 368q-20 35 -20 69t20 69q140 229 376.5 368t499.5 139t499.5 -139t376.5 -368q20 -35 20 -69z" />
-<glyph unicode="&#xf070;" horiz-adv-x="1792" d="M555 201l78 141q-87 63 -136 159t-49 203q0 121 61 225q-229 -117 -381 -353q167 -258 427 -375zM944 960q0 20 -14 34t-34 14q-125 0 -214.5 -89.5t-89.5 -214.5q0 -20 14 -34t34 -14t34 14t14 34q0 86 61 147t147 61q20 0 34 14t14 34zM1307 1151q0 -7 -1 -9 q-105 -188 -315 -566t-316 -567l-49 -89q-10 -16 -28 -16q-12 0 -134 70q-16 10 -16 28q0 12 44 87q-143 65 -263.5 173t-208.5 245q-20 31 -20 69t20 69q153 235 380 371t496 136q89 0 180 -17l54 97q10 16 28 16q5 0 18 -6t31 -15.5t33 -18.5t31.5 -18.5t19.5 -11.5 q16 -10 16 -27zM1344 704q0 -139 -79 -253.5t-209 -164.5l280 502q8 -45 8 -84zM1792 576q0 -35 -20 -69q-39 -64 -109 -145q-150 -172 -347.5 -267t-419.5 -95l74 132q212 18 392.5 137t301.5 307q-115 179 -282 294l63 112q95 -64 182.5 -153t144.5 -184q20 -34 20 -69z " />
-<glyph unicode="&#xf071;" horiz-adv-x="1792" d="M1024 161v190q0 14 -9.5 23.5t-22.5 9.5h-192q-13 0 -22.5 -9.5t-9.5 -23.5v-190q0 -14 9.5 -23.5t22.5 -9.5h192q13 0 22.5 9.5t9.5 23.5zM1022 535l18 459q0 12 -10 19q-13 11 -24 11h-220q-11 0 -24 -11q-10 -7 -10 -21l17 -457q0 -10 10 -16.5t24 -6.5h185 q14 0 23.5 6.5t10.5 16.5zM1008 1469l768 -1408q35 -63 -2 -126q-17 -29 -46.5 -46t-63.5 -17h-1536q-34 0 -63.5 17t-46.5 46q-37 63 -2 126l768 1408q17 31 47 49t65 18t65 -18t47 -49z" />
-<glyph unicode="&#xf072;" horiz-adv-x="1408" d="M1376 1376q44 -52 12 -148t-108 -172l-161 -161l160 -696q5 -19 -12 -33l-128 -96q-7 -6 -19 -6q-4 0 -7 1q-15 3 -21 16l-279 508l-259 -259l53 -194q5 -17 -8 -31l-96 -96q-9 -9 -23 -9h-2q-15 2 -24 13l-189 252l-252 189q-11 7 -13 23q-1 13 9 25l96 97q9 9 23 9 q6 0 8 -1l194 -53l259 259l-508 279q-14 8 -17 24q-2 16 9 27l128 128q14 13 30 8l665 -159l160 160q76 76 172 108t148 -12z" />
-<glyph unicode="&#xf073;" horiz-adv-x="1664" d="M128 -128h288v288h-288v-288zM480 -128h320v288h-320v-288zM128 224h288v320h-288v-320zM480 224h320v320h-320v-320zM128 608h288v288h-288v-288zM864 -128h320v288h-320v-288zM480 608h320v288h-320v-288zM1248 -128h288v288h-288v-288zM864 224h320v320h-320v-320z M512 1088v288q0 13 -9.5 22.5t-22.5 9.5h-64q-13 0 -22.5 -9.5t-9.5 -22.5v-288q0 -13 9.5 -22.5t22.5 -9.5h64q13 0 22.5 9.5t9.5 22.5zM1248 224h288v320h-288v-320zM864 608h320v288h-320v-288zM1248 608h288v288h-288v-288zM1280 1088v288q0 13 -9.5 22.5t-22.5 9.5h-64 q-13 0 -22.5 -9.5t-9.5 -22.5v-288q0 -13 9.5 -22.5t22.5 -9.5h64q13 0 22.5 9.5t9.5 22.5zM1664 1152v-1280q0 -52 -38 -90t-90 -38h-1408q-52 0 -90 38t-38 90v1280q0 52 38 90t90 38h128v96q0 66 47 113t113 47h64q66 0 113 -47t47 -113v-96h384v96q0 66 47 113t113 47 h64q66 0 113 -47t47 -113v-96h128q52 0 90 -38t38 -90z" />
-<glyph unicode="&#xf074;" horiz-adv-x="1792" d="M666 1055q-60 -92 -137 -273q-22 45 -37 72.5t-40.5 63.5t-51 56.5t-63 35t-81.5 14.5h-224q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h224q250 0 410 -225zM1792 256q0 -14 -9 -23l-320 -320q-9 -9 -23 -9q-13 0 -22.5 9.5t-9.5 22.5v192q-32 0 -85 -0.5t-81 -1t-73 1 t-71 5t-64 10.5t-63 18.5t-58 28.5t-59 40t-55 53.5t-56 69.5q59 93 136 273q22 -45 37 -72.5t40.5 -63.5t51 -56.5t63 -35t81.5 -14.5h256v192q0 14 9 23t23 9q12 0 24 -10l319 -319q9 -9 9 -23zM1792 1152q0 -14 -9 -23l-320 -320q-9 -9 -23 -9q-13 0 -22.5 9.5t-9.5 22.5 v192h-256q-48 0 -87 -15t-69 -45t-51 -61.5t-45 -77.5q-32 -62 -78 -171q-29 -66 -49.5 -111t-54 -105t-64 -100t-74 -83t-90 -68.5t-106.5 -42t-128 -16.5h-224q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h224q48 0 87 15t69 45t51 61.5t45 77.5q32 62 78 171q29 66 49.5 111 t54 105t64 100t74 83t90 68.5t106.5 42t128 16.5h256v192q0 14 9 23t23 9q12 0 24 -10l319 -319q9 -9 9 -23z" />
-<glyph unicode="&#xf075;" horiz-adv-x="1792" d="M1792 640q0 -174 -120 -321.5t-326 -233t-450 -85.5q-70 0 -145 8q-198 -175 -460 -242q-49 -14 -114 -22q-17 -2 -30.5 9t-17.5 29v1q-3 4 -0.5 12t2 10t4.5 9.5l6 9t7 8.5t8 9q7 8 31 34.5t34.5 38t31 39.5t32.5 51t27 59t26 76q-157 89 -247.5 220t-90.5 281 q0 130 71 248.5t191 204.5t286 136.5t348 50.5q244 0 450 -85.5t326 -233t120 -321.5z" />
-<glyph unicode="&#xf076;" d="M1536 704v-128q0 -201 -98.5 -362t-274 -251.5t-395.5 -90.5t-395.5 90.5t-274 251.5t-98.5 362v128q0 26 19 45t45 19h384q26 0 45 -19t19 -45v-128q0 -52 23.5 -90t53.5 -57t71 -30t64 -13t44 -2t44 2t64 13t71 30t53.5 57t23.5 90v128q0 26 19 45t45 19h384 q26 0 45 -19t19 -45zM512 1344v-384q0 -26 -19 -45t-45 -19h-384q-26 0 -45 19t-19 45v384q0 26 19 45t45 19h384q26 0 45 -19t19 -45zM1536 1344v-384q0 -26 -19 -45t-45 -19h-384q-26 0 -45 19t-19 45v384q0 26 19 45t45 19h384q26 0 45 -19t19 -45z" />
-<glyph unicode="&#xf077;" horiz-adv-x="1792" d="M1683 205l-166 -165q-19 -19 -45 -19t-45 19l-531 531l-531 -531q-19 -19 -45 -19t-45 19l-166 165q-19 19 -19 45.5t19 45.5l742 741q19 19 45 19t45 -19l742 -741q19 -19 19 -45.5t-19 -45.5z" />
-<glyph unicode="&#xf078;" horiz-adv-x="1792" d="M1683 728l-742 -741q-19 -19 -45 -19t-45 19l-742 741q-19 19 -19 45.5t19 45.5l166 165q19 19 45 19t45 -19l531 -531l531 531q19 19 45 19t45 -19l166 -165q19 -19 19 -45.5t-19 -45.5z" />
-<glyph unicode="&#xf079;" horiz-adv-x="1920" d="M1280 32q0 -13 -9.5 -22.5t-22.5 -9.5h-960q-8 0 -13.5 2t-9 7t-5.5 8t-3 11.5t-1 11.5v13v11v160v416h-192q-26 0 -45 19t-19 45q0 24 15 41l320 384q19 22 49 22t49 -22l320 -384q15 -17 15 -41q0 -26 -19 -45t-45 -19h-192v-384h576q16 0 25 -11l160 -192q7 -11 7 -21 zM1920 448q0 -24 -15 -41l-320 -384q-20 -23 -49 -23t-49 23l-320 384q-15 17 -15 41q0 26 19 45t45 19h192v384h-576q-16 0 -25 12l-160 192q-7 9 -7 20q0 13 9.5 22.5t22.5 9.5h960q8 0 13.5 -2t9 -7t5.5 -8t3 -11.5t1 -11.5v-13v-11v-160v-416h192q26 0 45 -19t19 -45z " />
-<glyph unicode="&#xf07a;" horiz-adv-x="1664" d="M640 0q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1536 0q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1664 1088v-512q0 -24 -16 -42.5t-41 -21.5 l-1044 -122q1 -7 4.5 -21.5t6 -26.5t2.5 -22q0 -16 -24 -64h920q26 0 45 -19t19 -45t-19 -45t-45 -19h-1024q-26 0 -45 19t-19 45q0 14 11 39.5t29.5 59.5t20.5 38l-177 823h-204q-26 0 -45 19t-19 45t19 45t45 19h256q16 0 28.5 -6.5t20 -15.5t13 -24.5t7.5 -26.5 t5.5 -29.5t4.5 -25.5h1201q26 0 45 -19t19 -45z" />
-<glyph unicode="&#xf07b;" horiz-adv-x="1664" d="M1664 928v-704q0 -92 -66 -158t-158 -66h-1216q-92 0 -158 66t-66 158v960q0 92 66 158t158 66h320q92 0 158 -66t66 -158v-32h672q92 0 158 -66t66 -158z" />
-<glyph unicode="&#xf07c;" horiz-adv-x="1920" d="M1879 584q0 -31 -31 -66l-336 -396q-43 -51 -120.5 -86.5t-143.5 -35.5h-1088q-34 0 -60.5 13t-26.5 43q0 31 31 66l336 396q43 51 120.5 86.5t143.5 35.5h1088q34 0 60.5 -13t26.5 -43zM1536 928v-160h-832q-94 0 -197 -47.5t-164 -119.5l-337 -396l-5 -6q0 4 -0.5 12.5 t-0.5 12.5v960q0 92 66 158t158 66h320q92 0 158 -66t66 -158v-32h544q92 0 158 -66t66 -158z" />
-<glyph unicode="&#xf07d;" horiz-adv-x="768" d="M704 1216q0 -26 -19 -45t-45 -19h-128v-1024h128q26 0 45 -19t19 -45t-19 -45l-256 -256q-19 -19 -45 -19t-45 19l-256 256q-19 19 -19 45t19 45t45 19h128v1024h-128q-26 0 -45 19t-19 45t19 45l256 256q19 19 45 19t45 -19l256 -256q19 -19 19 -45z" />
-<glyph unicode="&#xf07e;" horiz-adv-x="1792" d="M1792 640q0 -26 -19 -45l-256 -256q-19 -19 -45 -19t-45 19t-19 45v128h-1024v-128q0 -26 -19 -45t-45 -19t-45 19l-256 256q-19 19 -19 45t19 45l256 256q19 19 45 19t45 -19t19 -45v-128h1024v128q0 26 19 45t45 19t45 -19l256 -256q19 -19 19 -45z" />
-<glyph unicode="&#xf080;" horiz-adv-x="2048" d="M640 640v-512h-256v512h256zM1024 1152v-1024h-256v1024h256zM2048 0v-128h-2048v1536h128v-1408h1920zM1408 896v-768h-256v768h256zM1792 1280v-1152h-256v1152h256z" />
-<glyph unicode="&#xf081;" d="M1280 926q-56 -25 -121 -34q68 40 93 117q-65 -38 -134 -51q-61 66 -153 66q-87 0 -148.5 -61.5t-61.5 -148.5q0 -29 5 -48q-129 7 -242 65t-192 155q-29 -50 -29 -106q0 -114 91 -175q-47 1 -100 26v-2q0 -75 50 -133.5t123 -72.5q-29 -8 -51 -8q-13 0 -39 4 q21 -63 74.5 -104t121.5 -42q-116 -90 -261 -90q-26 0 -50 3q148 -94 322 -94q112 0 210 35.5t168 95t120.5 137t75 162t24.5 168.5q0 18 -1 27q63 45 105 109zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5 t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" />
-<glyph unicode="&#xf082;" d="M1536 160q0 -119 -84.5 -203.5t-203.5 -84.5h-192v608h203l30 224h-233v143q0 54 28 83t96 29l132 1v207q-96 9 -180 9q-136 0 -218 -80.5t-82 -225.5v-166h-224v-224h224v-608h-544q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960 q119 0 203.5 -84.5t84.5 -203.5v-960z" />
-<glyph unicode="&#xf083;" horiz-adv-x="1792" d="M928 704q0 14 -9 23t-23 9q-66 0 -113 -47t-47 -113q0 -14 9 -23t23 -9t23 9t9 23q0 40 28 68t68 28q14 0 23 9t9 23zM1152 574q0 -106 -75 -181t-181 -75t-181 75t-75 181t75 181t181 75t181 -75t75 -181zM128 0h1536v128h-1536v-128zM1280 574q0 159 -112.5 271.5 t-271.5 112.5t-271.5 -112.5t-112.5 -271.5t112.5 -271.5t271.5 -112.5t271.5 112.5t112.5 271.5zM256 1216h384v128h-384v-128zM128 1024h1536v118v138h-828l-64 -128h-644v-128zM1792 1280v-1280q0 -53 -37.5 -90.5t-90.5 -37.5h-1536q-53 0 -90.5 37.5t-37.5 90.5v1280 q0 53 37.5 90.5t90.5 37.5h1536q53 0 90.5 -37.5t37.5 -90.5z" />
-<glyph unicode="&#xf084;" horiz-adv-x="1792" d="M832 1024q0 80 -56 136t-136 56t-136 -56t-56 -136q0 -42 19 -83q-41 19 -83 19q-80 0 -136 -56t-56 -136t56 -136t136 -56t136 56t56 136q0 42 -19 83q41 -19 83 -19q80 0 136 56t56 136zM1683 320q0 -17 -49 -66t-66 -49q-9 0 -28.5 16t-36.5 33t-38.5 40t-24.5 26 l-96 -96l220 -220q28 -28 28 -68q0 -42 -39 -81t-81 -39q-40 0 -68 28l-671 671q-176 -131 -365 -131q-163 0 -265.5 102.5t-102.5 265.5q0 160 95 313t248 248t313 95q163 0 265.5 -102.5t102.5 -265.5q0 -189 -131 -365l355 -355l96 96q-3 3 -26 24.5t-40 38.5t-33 36.5 t-16 28.5q0 17 49 66t66 49q13 0 23 -10q6 -6 46 -44.5t82 -79.5t86.5 -86t73 -78t28.5 -41z" />
-<glyph unicode="&#xf085;" horiz-adv-x="1920" d="M896 640q0 106 -75 181t-181 75t-181 -75t-75 -181t75 -181t181 -75t181 75t75 181zM1664 128q0 52 -38 90t-90 38t-90 -38t-38 -90q0 -53 37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1664 1152q0 52 -38 90t-90 38t-90 -38t-38 -90q0 -53 37.5 -90.5t90.5 -37.5 t90.5 37.5t37.5 90.5zM1280 731v-185q0 -10 -7 -19.5t-16 -10.5l-155 -24q-11 -35 -32 -76q34 -48 90 -115q7 -10 7 -20q0 -12 -7 -19q-23 -30 -82.5 -89.5t-78.5 -59.5q-11 0 -21 7l-115 90q-37 -19 -77 -31q-11 -108 -23 -155q-7 -24 -30 -24h-186q-11 0 -20 7.5t-10 17.5 l-23 153q-34 10 -75 31l-118 -89q-7 -7 -20 -7q-11 0 -21 8q-144 133 -144 160q0 9 7 19q10 14 41 53t47 61q-23 44 -35 82l-152 24q-10 1 -17 9.5t-7 19.5v185q0 10 7 19.5t16 10.5l155 24q11 35 32 76q-34 48 -90 115q-7 11 -7 20q0 12 7 20q22 30 82 89t79 59q11 0 21 -7 l115 -90q34 18 77 32q11 108 23 154q7 24 30 24h186q11 0 20 -7.5t10 -17.5l23 -153q34 -10 75 -31l118 89q8 7 20 7q11 0 21 -8q144 -133 144 -160q0 -9 -7 -19q-12 -16 -42 -54t-45 -60q23 -48 34 -82l152 
 -23q10 -2 17 -10.5t7 -19.5zM1920 198v-140q0 -16 -149 -31 q-12 -27 -30 -52q51 -113 51 -138q0 -4 -4 -7q-122 -71 -124 -71q-8 0 -46 47t-52 68q-20 -2 -30 -2t-30 2q-14 -21 -52 -68t-46 -47q-2 0 -124 71q-4 3 -4 7q0 25 51 138q-18 25 -30 52q-149 15 -149 31v140q0 16 149 31q13 29 30 52q-51 113 -51 138q0 4 4 7q4 2 35 20 t59 34t30 16q8 0 46 -46.5t52 -67.5q20 2 30 2t30 -2q51 71 92 112l6 2q4 0 124 -70q4 -3 4 -7q0 -25 -51 -138q17 -23 30 -52q149 -15 149 -31zM1920 1222v-140q0 -16 -149 -31q-12 -27 -30 -52q51 -113 51 -138q0 -4 -4 -7q-122 -71 -124 -71q-8 0 -46 47t-52 68 q-20 -2 -30 -2t-30 2q-14 -21 -52 -68t-46 -47q-2 0 -124 71q-4 3 -4 7q0 25 51 138q-18 25 -30 52q-149 15 -149 31v140q0 16 149 31q13 29 30 52q-51 113 -51 138q0 4 4 7q4 2 35 20t59 34t30 16q8 0 46 -46.5t52 -67.5q20 2 30 2t30 -2q51 71 92 112l6 2q4 0 124 -70 q4 -3 4 -7q0 -25 -51 -138q17 -23 30 -52q149 -15 149 -31z" />
-<glyph unicode="&#xf086;" horiz-adv-x="1792" d="M1408 768q0 -139 -94 -257t-256.5 -186.5t-353.5 -68.5q-86 0 -176 16q-124 -88 -278 -128q-36 -9 -86 -16h-3q-11 0 -20.5 8t-11.5 21q-1 3 -1 6.5t0.5 6.5t2 6l2.5 5t3.5 5.5t4 5t4.5 5t4 4.5q5 6 23 25t26 29.5t22.5 29t25 38.5t20.5 44q-124 72 -195 177t-71 224 q0 139 94 257t256.5 186.5t353.5 68.5t353.5 -68.5t256.5 -186.5t94 -257zM1792 512q0 -120 -71 -224.5t-195 -176.5q10 -24 20.5 -44t25 -38.5t22.5 -29t26 -29.5t23 -25q1 -1 4 -4.5t4.5 -5t4 -5t3.5 -5.5l2.5 -5t2 -6t0.5 -6.5t-1 -6.5q-3 -14 -13 -22t-22 -7 q-50 7 -86 16q-154 40 -278 128q-90 -16 -176 -16q-271 0 -472 132q58 -4 88 -4q161 0 309 45t264 129q125 92 192 212t67 254q0 77 -23 152q129 -71 204 -178t75 -230z" />
-<glyph unicode="&#xf087;" d="M256 192q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1408 768q0 51 -39 89.5t-89 38.5h-352q0 58 48 159.5t48 160.5q0 98 -32 145t-128 47q-26 -26 -38 -85t-30.5 -125.5t-59.5 -109.5q-22 -23 -77 -91q-4 -5 -23 -30t-31.5 -41t-34.5 -42.5 t-40 -44t-38.5 -35.5t-40 -27t-35.5 -9h-32v-640h32q13 0 31.5 -3t33 -6.5t38 -11t35 -11.5t35.5 -12.5t29 -10.5q211 -73 342 -73h121q192 0 192 167q0 26 -5 56q30 16 47.5 52.5t17.5 73.5t-18 69q53 50 53 119q0 25 -10 55.5t-25 47.5q32 1 53.5 47t21.5 81zM1536 769 q0 -89 -49 -163q9 -33 9 -69q0 -77 -38 -144q3 -21 3 -43q0 -101 -60 -178q1 -139 -85 -219.5t-227 -80.5h-36h-93q-96 0 -189.5 22.5t-216.5 65.5q-116 40 -138 40h-288q-53 0 -90.5 37.5t-37.5 90.5v640q0 53 37.5 90.5t90.5 37.5h274q36 24 137 155q58 75 107 128 q24 25 35.5 85.5t30.5 126.5t62 108q39 37 90 37q84 0 151 -32.5t102 -101.5t35 -186q0 -93 -48 -192h176q104 0 180 -76t76 -179z" />
-<glyph unicode="&#xf088;" d="M256 1088q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1408 512q0 35 -21.5 81t-53.5 47q15 17 25 47.5t10 55.5q0 69 -53 119q18 32 18 69t-17.5 73.5t-47.5 52.5q5 30 5 56q0 85 -49 126t-136 41h-128q-131 0 -342 -73q-5 -2 -29 -10.5 t-35.5 -12.5t-35 -11.5t-38 -11t-33 -6.5t-31.5 -3h-32v-640h32q16 0 35.5 -9t40 -27t38.5 -35.5t40 -44t34.5 -42.5t31.5 -41t23 -30q55 -68 77 -91q41 -43 59.5 -109.5t30.5 -125.5t38 -85q96 0 128 47t32 145q0 59 -48 160.5t-48 159.5h352q50 0 89 38.5t39 89.5z M1536 511q0 -103 -76 -179t-180 -76h-176q48 -99 48 -192q0 -118 -35 -186q-35 -69 -102 -101.5t-151 -32.5q-51 0 -90 37q-34 33 -54 82t-25.5 90.5t-17.5 84.5t-31 64q-48 50 -107 127q-101 131 -137 155h-274q-53 0 -90.5 37.5t-37.5 90.5v640q0 53 37.5 90.5t90.5 37.5 h288q22 0 138 40q128 44 223 66t200 22h112q140 0 226.5 -79t85.5 -216v-5q60 -77 60 -178q0 -22 -3 -43q38 -67 38 -144q0 -36 -9 -69q49 -74 49 -163z" />
-<glyph unicode="&#xf089;" horiz-adv-x="896" d="M832 1504v-1339l-449 -236q-22 -12 -40 -12q-21 0 -31.5 14.5t-10.5 35.5q0 6 2 20l86 500l-364 354q-25 27 -25 48q0 37 56 46l502 73l225 455q19 41 49 41z" />
-<glyph unicode="&#xf08a;" horiz-adv-x="1792" d="M1664 940q0 81 -21.5 143t-55 98.5t-81.5 59.5t-94 31t-98 8t-112 -25.5t-110.5 -64t-86.5 -72t-60 -61.5q-18 -22 -49 -22t-49 22q-24 28 -60 61.5t-86.5 72t-110.5 64t-112 25.5t-98 -8t-94 -31t-81.5 -59.5t-55 -98.5t-21.5 -143q0 -168 187 -355l581 -560l580 559 q188 188 188 356zM1792 940q0 -221 -229 -450l-623 -600q-18 -18 -44 -18t-44 18l-624 602q-10 8 -27.5 26t-55.5 65.5t-68 97.5t-53.5 121t-23.5 138q0 220 127 344t351 124q62 0 126.5 -21.5t120 -58t95.5 -68.5t76 -68q36 36 76 68t95.5 68.5t120 58t126.5 21.5 q224 0 351 -124t127 -344z" />
-<glyph unicode="&#xf08b;" horiz-adv-x="1664" d="M640 96q0 -4 1 -20t0.5 -26.5t-3 -23.5t-10 -19.5t-20.5 -6.5h-320q-119 0 -203.5 84.5t-84.5 203.5v704q0 119 84.5 203.5t203.5 84.5h320q13 0 22.5 -9.5t9.5 -22.5q0 -4 1 -20t0.5 -26.5t-3 -23.5t-10 -19.5t-20.5 -6.5h-320q-66 0 -113 -47t-47 -113v-704 q0 -66 47 -113t113 -47h288h11h13t11.5 -1t11.5 -3t8 -5.5t7 -9t2 -13.5zM1568 640q0 -26 -19 -45l-544 -544q-19 -19 -45 -19t-45 19t-19 45v288h-448q-26 0 -45 19t-19 45v384q0 26 19 45t45 19h448v288q0 26 19 45t45 19t45 -19l544 -544q19 -19 19 -45z" />
-<glyph unicode="&#xf08c;" d="M237 122h231v694h-231v-694zM483 1030q-1 52 -36 86t-93 34t-94.5 -34t-36.5 -86q0 -51 35.5 -85.5t92.5 -34.5h1q59 0 95 34.5t36 85.5zM1068 122h231v398q0 154 -73 233t-193 79q-136 0 -209 -117h2v101h-231q3 -66 0 -694h231v388q0 38 7 56q15 35 45 59.5t74 24.5 q116 0 116 -157v-371zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" />
-<glyph unicode="&#xf08d;" horiz-adv-x="1152" d="M480 672v448q0 14 -9 23t-23 9t-23 -9t-9 -23v-448q0 -14 9 -23t23 -9t23 9t9 23zM1152 320q0 -26 -19 -45t-45 -19h-429l-51 -483q-2 -12 -10.5 -20.5t-20.5 -8.5h-1q-27 0 -32 27l-76 485h-404q-26 0 -45 19t-19 45q0 123 78.5 221.5t177.5 98.5v512q-52 0 -90 38 t-38 90t38 90t90 38h640q52 0 90 -38t38 -90t-38 -90t-90 -38v-512q99 0 177.5 -98.5t78.5 -221.5z" />
-<glyph unicode="&#xf08e;" horiz-adv-x="1792" d="M1408 608v-320q0 -119 -84.5 -203.5t-203.5 -84.5h-832q-119 0 -203.5 84.5t-84.5 203.5v832q0 119 84.5 203.5t203.5 84.5h704q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-704q-66 0 -113 -47t-47 -113v-832q0 -66 47 -113t113 -47h832q66 0 113 47t47 113v320 q0 14 9 23t23 9h64q14 0 23 -9t9 -23zM1792 1472v-512q0 -26 -19 -45t-45 -19t-45 19l-176 176l-652 -652q-10 -10 -23 -10t-23 10l-114 114q-10 10 -10 23t10 23l652 652l-176 176q-19 19 -19 45t19 45t45 19h512q26 0 45 -19t19 -45z" />
-<glyph unicode="&#xf090;" d="M1184 640q0 -26 -19 -45l-544 -544q-19 -19 -45 -19t-45 19t-19 45v288h-448q-26 0 -45 19t-19 45v384q0 26 19 45t45 19h448v288q0 26 19 45t45 19t45 -19l544 -544q19 -19 19 -45zM1536 992v-704q0 -119 -84.5 -203.5t-203.5 -84.5h-320q-13 0 -22.5 9.5t-9.5 22.5 q0 4 -1 20t-0.5 26.5t3 23.5t10 19.5t20.5 6.5h320q66 0 113 47t47 113v704q0 66 -47 113t-113 47h-288h-11h-13t-11.5 1t-11.5 3t-8 5.5t-7 9t-2 13.5q0 4 -1 20t-0.5 26.5t3 23.5t10 19.5t20.5 6.5h320q119 0 203.5 -84.5t84.5 -203.5z" />
-<glyph unicode="&#xf091;" horiz-adv-x="1664" d="M458 653q-74 162 -74 371h-256v-96q0 -78 94.5 -162t235.5 -113zM1536 928v96h-256q0 -209 -74 -371q141 29 235.5 113t94.5 162zM1664 1056v-128q0 -71 -41.5 -143t-112 -130t-173 -97.5t-215.5 -44.5q-42 -54 -95 -95q-38 -34 -52.5 -72.5t-14.5 -89.5q0 -54 30.5 -91 t97.5 -37q75 0 133.5 -45.5t58.5 -114.5v-64q0 -14 -9 -23t-23 -9h-832q-14 0 -23 9t-9 23v64q0 69 58.5 114.5t133.5 45.5q67 0 97.5 37t30.5 91q0 51 -14.5 89.5t-52.5 72.5q-53 41 -95 95q-113 5 -215.5 44.5t-173 97.5t-112 130t-41.5 143v128q0 40 28 68t68 28h288v96 q0 66 47 113t113 47h576q66 0 113 -47t47 -113v-96h288q40 0 68 -28t28 -68z" />
-<glyph unicode="&#xf092;" d="M394 184q-8 -9 -20 3q-13 11 -4 19q8 9 20 -3q12 -11 4 -19zM352 245q9 -12 0 -19q-8 -6 -17 7t0 18q9 7 17 -6zM291 305q-5 -7 -13 -2q-10 5 -7 12q3 5 13 2q10 -5 7 -12zM322 271q-6 -7 -16 3q-9 11 -2 16q6 6 16 -3q9 -11 2 -16zM451 159q-4 -12 -19 -6q-17 4 -13 15 t19 7q16 -5 13 -16zM514 154q0 -11 -16 -11q-17 -2 -17 11q0 11 16 11q17 2 17 -11zM572 164q2 -10 -14 -14t-18 8t14 15q16 2 18 -9zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-224q-16 0 -24.5 1t-19.5 5t-16 14.5t-5 27.5v239q0 97 -52 142q57 6 102.5 18t94 39 t81 66.5t53 105t20.5 150.5q0 121 -79 206q37 91 -8 204q-28 9 -81 -11t-92 -44l-38 -24q-93 26 -192 26t-192 -26q-16 11 -42.5 27t-83.5 38.5t-86 13.5q-44 -113 -7 -204q-79 -85 -79 -206q0 -85 20.5 -150t52.5 -105t80.5 -67t94 -39t102.5 -18q-40 -36 -49 -103 q-21 -10 -45 -15t-57 -5t-65.5 21.5t-55.5 62.5q-19 32 -48.5 52t-49.5 24l-20 3q-21 0 -29 -4.5t-5 -11.5t9 -14t13 -12l7 -5q22 -10 43.5 -38t31.5 -51l10 -23q13 -38 44 -61.5t67 -30t69.5 -7t55.5 3.5l23 4q0 -38 0.5 -103t0.5 
 -68q0 -22 -11 -33.5t-22 -13t-33 -1.5 h-224q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" />
-<glyph unicode="&#xf093;" horiz-adv-x="1664" d="M1280 64q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1536 64q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1664 288v-320q0 -40 -28 -68t-68 -28h-1472q-40 0 -68 28t-28 68v320q0 40 28 68t68 28h427q21 -56 70.5 -92 t110.5 -36h256q61 0 110.5 36t70.5 92h427q40 0 68 -28t28 -68zM1339 936q-17 -40 -59 -40h-256v-448q0 -26 -19 -45t-45 -19h-256q-26 0 -45 19t-19 45v448h-256q-42 0 -59 40q-17 39 14 69l448 448q18 19 45 19t45 -19l448 -448q31 -30 14 -69z" />
-<glyph unicode="&#xf094;" d="M1407 710q0 44 -7 113.5t-18 96.5q-12 30 -17 44t-9 36.5t-4 48.5q0 23 5 68.5t5 67.5q0 37 -10 55q-4 1 -13 1q-19 0 -58 -4.5t-59 -4.5q-60 0 -176 24t-175 24q-43 0 -94.5 -11.5t-85 -23.5t-89.5 -34q-137 -54 -202 -103q-96 -73 -159.5 -189.5t-88 -236t-24.5 -248.5 q0 -40 12.5 -120t12.5 -121q0 -23 -11 -66.5t-11 -65.5t12 -36.5t34 -14.5q24 0 72.5 11t73.5 11q57 0 169.5 -15.5t169.5 -15.5q181 0 284 36q129 45 235.5 152.5t166 245.5t59.5 275zM1535 712q0 -165 -70 -327.5t-196 -288t-281 -180.5q-124 -44 -326 -44 q-57 0 -170 14.5t-169 14.5q-24 0 -72.5 -14.5t-73.5 -14.5q-73 0 -123.5 55.5t-50.5 128.5q0 24 11 68t11 67q0 40 -12.5 120.5t-12.5 121.5q0 111 18 217.5t54.5 209.5t100.5 194t150 156q78 59 232 120q194 78 316 78q60 0 175.5 -24t173.5 -24q19 0 57 5t58 5 q81 0 118 -50.5t37 -134.5q0 -23 -5 -68t-5 -68q0 -10 1 -18.5t3 -17t4 -13.5t6.5 -16t6.5 -17q16 -40 25 -118.5t9 -136.5z" />
-<glyph unicode="&#xf095;" horiz-adv-x="1408" d="M1408 296q0 -27 -10 -70.5t-21 -68.5q-21 -50 -122 -106q-94 -51 -186 -51q-27 0 -52.5 3.5t-57.5 12.5t-47.5 14.5t-55.5 20.5t-49 18q-98 35 -175 83q-128 79 -264.5 215.5t-215.5 264.5q-48 77 -83 175q-3 9 -18 49t-20.5 55.5t-14.5 47.5t-12.5 57.5t-3.5 52.5 q0 92 51 186q56 101 106 122q25 11 68.5 21t70.5 10q14 0 21 -3q18 -6 53 -76q11 -19 30 -54t35 -63.5t31 -53.5q3 -4 17.5 -25t21.5 -35.5t7 -28.5q0 -20 -28.5 -50t-62 -55t-62 -53t-28.5 -46q0 -9 5 -22.5t8.5 -20.5t14 -24t11.5 -19q76 -137 174 -235t235 -174 q2 -1 19 -11.5t24 -14t20.5 -8.5t22.5 -5q18 0 46 28.5t53 62t55 62t50 28.5q14 0 28.5 -7t35.5 -21.5t25 -17.5q25 -15 53.5 -31t63.5 -35t54 -30q70 -35 76 -53q3 -7 3 -21z" />
-<glyph unicode="&#xf096;" horiz-adv-x="1408" d="M1120 1280h-832q-66 0 -113 -47t-47 -113v-832q0 -66 47 -113t113 -47h832q66 0 113 47t47 113v832q0 66 -47 113t-113 47zM1408 1120v-832q0 -119 -84.5 -203.5t-203.5 -84.5h-832q-119 0 -203.5 84.5t-84.5 203.5v832q0 119 84.5 203.5t203.5 84.5h832 q119 0 203.5 -84.5t84.5 -203.5z" />
-<glyph unicode="&#xf097;" horiz-adv-x="1280" d="M1152 1280h-1024v-1242l423 406l89 85l89 -85l423 -406v1242zM1164 1408q23 0 44 -9q33 -13 52.5 -41t19.5 -62v-1289q0 -34 -19.5 -62t-52.5 -41q-19 -8 -44 -8q-48 0 -83 32l-441 424l-441 -424q-36 -33 -83 -33q-23 0 -44 9q-33 13 -52.5 41t-19.5 62v1289 q0 34 19.5 62t52.5 41q21 9 44 9h1048z" />
-<glyph unicode="&#xf098;" d="M1280 343q0 11 -2 16q-3 8 -38.5 29.5t-88.5 49.5l-53 29q-5 3 -19 13t-25 15t-21 5q-18 0 -47 -32.5t-57 -65.5t-44 -33q-7 0 -16.5 3.5t-15.5 6.5t-17 9.5t-14 8.5q-99 55 -170.5 126.5t-126.5 170.5q-2 3 -8.5 14t-9.5 17t-6.5 15.5t-3.5 16.5q0 13 20.5 33.5t45 38.5 t45 39.5t20.5 36.5q0 10 -5 21t-15 25t-13 19q-3 6 -15 28.5t-25 45.5t-26.5 47.5t-25 40.5t-16.5 18t-16 2q-48 0 -101 -22q-46 -21 -80 -94.5t-34 -130.5q0 -16 2.5 -34t5 -30.5t9 -33t10 -29.5t12.5 -33t11 -30q60 -164 216.5 -320.5t320.5 -216.5q6 -2 30 -11t33 -12.5 t29.5 -10t33 -9t30.5 -5t34 -2.5q57 0 130.5 34t94.5 80q22 53 22 101zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" />
-<glyph unicode="&#xf099;" horiz-adv-x="1664" d="M1620 1128q-67 -98 -162 -167q1 -14 1 -42q0 -130 -38 -259.5t-115.5 -248.5t-184.5 -210.5t-258 -146t-323 -54.5q-271 0 -496 145q35 -4 78 -4q225 0 401 138q-105 2 -188 64.5t-114 159.5q33 -5 61 -5q43 0 85 11q-112 23 -185.5 111.5t-73.5 205.5v4q68 -38 146 -41 q-66 44 -105 115t-39 154q0 88 44 163q121 -149 294.5 -238.5t371.5 -99.5q-8 38 -8 74q0 134 94.5 228.5t228.5 94.5q140 0 236 -102q109 21 205 78q-37 -115 -142 -178q93 10 186 50z" />
-<glyph unicode="&#xf09a;" horiz-adv-x="1024" d="M959 1524v-264h-157q-86 0 -116 -36t-30 -108v-189h293l-39 -296h-254v-759h-306v759h-255v296h255v218q0 186 104 288.5t277 102.5q147 0 228 -12z" />
-<glyph unicode="&#xf09b;" d="M1536 640q0 -251 -146.5 -451.5t-378.5 -277.5q-27 -5 -39.5 7t-12.5 30v211q0 97 -52 142q57 6 102.5 18t94 39t81 66.5t53 105t20.5 150.5q0 121 -79 206q37 91 -8 204q-28 9 -81 -11t-92 -44l-38 -24q-93 26 -192 26t-192 -26q-16 11 -42.5 27t-83.5 38.5t-86 13.5 q-44 -113 -7 -204q-79 -85 -79 -206q0 -85 20.5 -150t52.5 -105t80.5 -67t94 -39t102.5 -18q-40 -36 -49 -103q-21 -10 -45 -15t-57 -5t-65.5 21.5t-55.5 62.5q-19 32 -48.5 52t-49.5 24l-20 3q-21 0 -29 -4.5t-5 -11.5t9 -14t13 -12l7 -5q22 -10 43.5 -38t31.5 -51l10 -23 q13 -38 44 -61.5t67 -30t69.5 -7t55.5 3.5l23 4q0 -38 0.5 -89t0.5 -54q0 -18 -13 -30t-40 -7q-232 77 -378.5 277.5t-146.5 451.5q0 209 103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" />
-<glyph unicode="&#xf09c;" horiz-adv-x="1664" d="M1664 960v-256q0 -26 -19 -45t-45 -19h-64q-26 0 -45 19t-19 45v256q0 106 -75 181t-181 75t-181 -75t-75 -181v-192h96q40 0 68 -28t28 -68v-576q0 -40 -28 -68t-68 -28h-960q-40 0 -68 28t-28 68v576q0 40 28 68t68 28h672v192q0 185 131.5 316.5t316.5 131.5 t316.5 -131.5t131.5 -316.5z" />
-<glyph unicode="&#xf09d;" horiz-adv-x="1920" d="M1760 1408q66 0 113 -47t47 -113v-1216q0 -66 -47 -113t-113 -47h-1600q-66 0 -113 47t-47 113v1216q0 66 47 113t113 47h1600zM160 1280q-13 0 -22.5 -9.5t-9.5 -22.5v-224h1664v224q0 13 -9.5 22.5t-22.5 9.5h-1600zM1760 0q13 0 22.5 9.5t9.5 22.5v608h-1664v-608 q0 -13 9.5 -22.5t22.5 -9.5h1600zM256 128v128h256v-128h-256zM640 128v128h384v-128h-384z" />
-<glyph unicode="&#xf09e;" horiz-adv-x="1408" d="M384 192q0 -80 -56 -136t-136 -56t-136 56t-56 136t56 136t136 56t136 -56t56 -136zM896 69q2 -28 -17 -48q-18 -21 -47 -21h-135q-25 0 -43 16.5t-20 41.5q-22 229 -184.5 391.5t-391.5 184.5q-25 2 -41.5 20t-16.5 43v135q0 29 21 47q17 17 43 17h5q160 -13 306 -80.5 t259 -181.5q114 -113 181.5 -259t80.5 -306zM1408 67q2 -27 -18 -47q-18 -20 -46 -20h-143q-26 0 -44.5 17.5t-19.5 42.5q-12 215 -101 408.5t-231.5 336t-336 231.5t-408.5 102q-25 1 -42.5 19.5t-17.5 43.5v143q0 28 20 46q18 18 44 18h3q262 -13 501.5 -120t425.5 -294 q187 -186 294 -425.5t120 -501.5z" />
-<glyph unicode="&#xf0a0;" d="M1040 320q0 -33 -23.5 -56.5t-56.5 -23.5t-56.5 23.5t-23.5 56.5t23.5 56.5t56.5 23.5t56.5 -23.5t23.5 -56.5zM1296 320q0 -33 -23.5 -56.5t-56.5 -23.5t-56.5 23.5t-23.5 56.5t23.5 56.5t56.5 23.5t56.5 -23.5t23.5 -56.5zM1408 160v320q0 13 -9.5 22.5t-22.5 9.5 h-1216q-13 0 -22.5 -9.5t-9.5 -22.5v-320q0 -13 9.5 -22.5t22.5 -9.5h1216q13 0 22.5 9.5t9.5 22.5zM178 640h1180l-157 482q-4 13 -16 21.5t-26 8.5h-782q-14 0 -26 -8.5t-16 -21.5zM1536 480v-320q0 -66 -47 -113t-113 -47h-1216q-66 0 -113 47t-47 113v320q0 25 16 75 l197 606q17 53 63 86t101 33h782q55 0 101 -33t63 -86l197 -606q16 -50 16 -75z" />
-<glyph unicode="&#xf0a1;" horiz-adv-x="1792" d="M1664 896q53 0 90.5 -37.5t37.5 -90.5t-37.5 -90.5t-90.5 -37.5v-384q0 -52 -38 -90t-90 -38q-417 347 -812 380q-58 -19 -91 -66t-31 -100.5t40 -92.5q-20 -33 -23 -65.5t6 -58t33.5 -55t48 -50t61.5 -50.5q-29 -58 -111.5 -83t-168.5 -11.5t-132 55.5q-7 23 -29.5 87.5 t-32 94.5t-23 89t-15 101t3.5 98.5t22 110.5h-122q-66 0 -113 47t-47 113v192q0 66 47 113t113 47h480q435 0 896 384q52 0 90 -38t38 -90v-384zM1536 292v954q-394 -302 -768 -343v-270q377 -42 768 -341z" />
-<glyph unicode="&#xf0a2;" horiz-adv-x="1792" d="M912 -160q0 16 -16 16q-59 0 -101.5 42.5t-42.5 101.5q0 16 -16 16t-16 -16q0 -73 51.5 -124.5t124.5 -51.5q16 0 16 16zM246 128h1300q-266 300 -266 832q0 51 -24 105t-69 103t-121.5 80.5t-169.5 31.5t-169.5 -31.5t-121.5 -80.5t-69 -103t-24 -105q0 -532 -266 -832z M1728 128q0 -52 -38 -90t-90 -38h-448q0 -106 -75 -181t-181 -75t-181 75t-75 181h-448q-52 0 -90 38t-38 90q50 42 91 88t85 119.5t74.5 158.5t50 206t19.5 260q0 152 117 282.5t307 158.5q-8 19 -8 39q0 40 28 68t68 28t68 -28t28 -68q0 -20 -8 -39q190 -28 307 -158.5 t117 -282.5q0 -139 19.5 -260t50 -206t74.5 -158.5t85 -119.5t91 -88z" />
-<glyph unicode="&#xf0a3;" d="M1376 640l138 -135q30 -28 20 -70q-12 -41 -52 -51l-188 -48l53 -186q12 -41 -19 -70q-29 -31 -70 -19l-186 53l-48 -188q-10 -40 -51 -52q-12 -2 -19 -2q-31 0 -51 22l-135 138l-135 -138q-28 -30 -70 -20q-41 11 -51 52l-48 188l-186 -53q-41 -12 -70 19q-31 29 -19 70 l53 186l-188 48q-40 10 -52 51q-10 42 20 70l138 135l-138 135q-30 28 -20 70q12 41 52 51l188 48l-53 186q-12 41 19 70q29 31 70 19l186 -53l48 188q10 41 51 51q41 12 70 -19l135 -139l135 139q29 30 70 19q41 -10 51 -51l48 -188l186 53q41 12 70 -19q31 -29 19 -70 l-53 -186l188 -48q40 -10 52 -51q10 -42 -20 -70z" />
-<glyph unicode="&#xf0a4;" horiz-adv-x="1792" d="M256 192q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1664 768q0 51 -39 89.5t-89 38.5h-576q0 20 15 48.5t33 55t33 68t15 84.5q0 67 -44.5 97.5t-115.5 30.5q-24 0 -90 -139q-24 -44 -37 -65q-40 -64 -112 -145q-71 -81 -101 -106 q-69 -57 -140 -57h-32v-640h32q72 0 167 -32t193.5 -64t179.5 -32q189 0 189 167q0 26 -5 56q30 16 47.5 52.5t17.5 73.5t-18 69q53 50 53 119q0 25 -10 55.5t-25 47.5h331q52 0 90 38t38 90zM1792 769q0 -105 -75.5 -181t-180.5 -76h-169q-4 -62 -37 -119q3 -21 3 -43 q0 -101 -60 -178q1 -139 -85 -219.5t-227 -80.5q-133 0 -322 69q-164 59 -223 59h-288q-53 0 -90.5 37.5t-37.5 90.5v640q0 53 37.5 90.5t90.5 37.5h288q10 0 21.5 4.5t23.5 14t22.5 18t24 22.5t20.5 21.5t19 21.5t14 17q65 74 100 129q13 21 33 62t37 72t40.5 63t55 49.5 t69.5 17.5q125 0 206.5 -67t81.5 -189q0 -68 -22 -128h374q104 0 180 -76t76 -179z" />
-<glyph unicode="&#xf0a5;" horiz-adv-x="1792" d="M1376 128h32v640h-32q-35 0 -67.5 12t-62.5 37t-50 46t-49 54q-2 3 -3.5 4.5t-4 4.5t-4.5 5q-72 81 -112 145q-14 22 -38 68q-1 3 -10.5 22.5t-18.5 36t-20 35.5t-21.5 30.5t-18.5 11.5q-71 0 -115.5 -30.5t-44.5 -97.5q0 -43 15 -84.5t33 -68t33 -55t15 -48.5h-576 q-50 0 -89 -38.5t-39 -89.5q0 -52 38 -90t90 -38h331q-15 -17 -25 -47.5t-10 -55.5q0 -69 53 -119q-18 -32 -18 -69t17.5 -73.5t47.5 -52.5q-4 -24 -4 -56q0 -85 48.5 -126t135.5 -41q84 0 183 32t194 64t167 32zM1664 192q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45 t45 -19t45 19t19 45zM1792 768v-640q0 -53 -37.5 -90.5t-90.5 -37.5h-288q-59 0 -223 -59q-190 -69 -317 -69q-142 0 -230 77.5t-87 217.5l1 5q-61 76 -61 178q0 22 3 43q-33 57 -37 119h-169q-105 0 -180.5 76t-75.5 181q0 103 76 179t180 76h374q-22 60 -22 128 q0 122 81.5 189t206.5 67q38 0 69.5 -17.5t55 -49.5t40.5 -63t37 -72t33 -62q35 -55 100 -129q2 -3 14 -17t19 -21.5t20.5 -21.5t24 -22.5t22.5 -18t23.5 -14t21.5 -4.5h288q53 0 90.5 -37.5t37.5 -90.5z" />
-<glyph unicode="&#xf0a6;" d="M1280 -64q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1408 700q0 189 -167 189q-26 0 -56 -5q-16 30 -52.5 47.5t-73.5 17.5t-69 -18q-50 53 -119 53q-25 0 -55.5 -10t-47.5 -25v331q0 52 -38 90t-90 38q-51 0 -89.5 -39t-38.5 -89v-576 q-20 0 -48.5 15t-55 33t-68 33t-84.5 15q-67 0 -97.5 -44.5t-30.5 -115.5q0 -24 139 -90q44 -24 65 -37q64 -40 145 -112q81 -71 106 -101q57 -69 57 -140v-32h640v32q0 72 32 167t64 193.5t32 179.5zM1536 705q0 -133 -69 -322q-59 -164 -59 -223v-288q0 -53 -37.5 -90.5 t-90.5 -37.5h-640q-53 0 -90.5 37.5t-37.5 90.5v288q0 10 -4.5 21.5t-14 23.5t-18 22.5t-22.5 24t-21.5 20.5t-21.5 19t-17 14q-74 65 -129 100q-21 13 -62 33t-72 37t-63 40.5t-49.5 55t-17.5 69.5q0 125 67 206.5t189 81.5q68 0 128 -22v374q0 104 76 180t179 76 q105 0 181 -75.5t76 -180.5v-169q62 -4 119 -37q21 3 43 3q101 0 178 -60q139 1 219.5 -85t80.5 -227z" />
-<glyph unicode="&#xf0a7;" d="M1408 576q0 84 -32 183t-64 194t-32 167v32h-640v-32q0 -35 -12 -67.5t-37 -62.5t-46 -50t-54 -49q-9 -8 -14 -12q-81 -72 -145 -112q-22 -14 -68 -38q-3 -1 -22.5 -10.5t-36 -18.5t-35.5 -20t-30.5 -21.5t-11.5 -18.5q0 -71 30.5 -115.5t97.5 -44.5q43 0 84.5 15t68 33 t55 33t48.5 15v-576q0 -50 38.5 -89t89.5 -39q52 0 90 38t38 90v331q46 -35 103 -35q69 0 119 53q32 -18 69 -18t73.5 17.5t52.5 47.5q24 -4 56 -4q85 0 126 48.5t41 135.5zM1280 1344q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1536 580 q0 -142 -77.5 -230t-217.5 -87l-5 1q-76 -61 -178 -61q-22 0 -43 3q-54 -30 -119 -37v-169q0 -105 -76 -180.5t-181 -75.5q-103 0 -179 76t-76 180v374q-54 -22 -128 -22q-121 0 -188.5 81.5t-67.5 206.5q0 38 17.5 69.5t49.5 55t63 40.5t72 37t62 33q55 35 129 100 q3 2 17 14t21.5 19t21.5 20.5t22.5 24t18 22.5t14 23.5t4.5 21.5v288q0 53 37.5 90.5t90.5 37.5h640q53 0 90.5 -37.5t37.5 -90.5v-288q0 -59 59 -223q69 -190 69 -317z" />
-<glyph unicode="&#xf0a8;" d="M1280 576v128q0 26 -19 45t-45 19h-502l189 189q19 19 19 45t-19 45l-91 91q-18 18 -45 18t-45 -18l-362 -362l-91 -91q-18 -18 -18 -45t18 -45l91 -91l362 -362q18 -18 45 -18t45 18l91 91q18 18 18 45t-18 45l-189 189h502q26 0 45 19t19 45zM1536 640 q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" />
-<glyph unicode="&#xf0a9;" d="M1285 640q0 27 -18 45l-91 91l-362 362q-18 18 -45 18t-45 -18l-91 -91q-18 -18 -18 -45t18 -45l189 -189h-502q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h502l-189 -189q-19 -19 -19 -45t19 -45l91 -91q18 -18 45 -18t45 18l362 362l91 91q18 18 18 45zM1536 640 q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" />
-<glyph unicode="&#xf0aa;" d="M1284 641q0 27 -18 45l-362 362l-91 91q-18 18 -45 18t-45 -18l-91 -91l-362 -362q-18 -18 -18 -45t18 -45l91 -91q18 -18 45 -18t45 18l189 189v-502q0 -26 19 -45t45 -19h128q26 0 45 19t19 45v502l189 -189q19 -19 45 -19t45 19l91 91q18 18 18 45zM1536 640 q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" />
-<glyph unicode="&#xf0ab;" d="M1284 639q0 27 -18 45l-91 91q-18 18 -45 18t-45 -18l-189 -189v502q0 26 -19 45t-45 19h-128q-26 0 -45 -19t-19 -45v-502l-189 189q-19 19 -45 19t-45 -19l-91 -91q-18 -18 -18 -45t18 -45l362 -362l91 -91q18 -18 45 -18t45 18l91 91l362 362q18 18 18 45zM1536 640 q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" />
-<glyph unicode="&#xf0ac;" d="M768 1408q209 0 385.5 -103t279.5 -279.5t103 -385.5t-103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103zM1042 887q-2 -1 -9.5 -9.5t-13.5 -9.5q2 0 4.5 5t5 11t3.5 7q6 7 22 15q14 6 52 12q34 8 51 -11 q-2 2 9.5 13t14.5 12q3 2 15 4.5t15 7.5l2 22q-12 -1 -17.5 7t-6.5 21q0 -2 -6 -8q0 7 -4.5 8t-11.5 -1t-9 -1q-10 3 -15 7.5t-8 16.5t-4 15q-2 5 -9.5 10.5t-9.5 10.5q-1 2 -2.5 5.5t-3 6.5t-4 5.5t-5.5 2.5t-7 -5t-7.5 -10t-4.5 -5q-3 2 -6 1.5t-4.5 -1t-4.5 -3t-5 -3.5 q-3 -2 -8.5 -3t-8.5 -2q15 5 -1 11q-10 4 -16 3q9 4 7.5 12t-8.5 14h5q-1 4 -8.5 8.5t-17.5 8.5t-13 6q-8 5 -34 9.5t-33 0.5q-5 -6 -4.5 -10.5t4 -14t3.5 -12.5q1 -6 -5.5 -13t-6.5 -12q0 -7 14 -15.5t10 -21.5q-3 -8 -16 -16t-16 -12q-5 -8 -1.5 -18.5t10.5 -16.5 q2 -2 1.5 -4t-3.5 -4.5t-5.5 -4t-6.5 -3.5l-3 -2q-11 -5 -20.5 6t-13.5 26q-7 25 -16 30q-23 8 -29 -1q-5 13 -41 26q-25 9 -58 4q6 1 0 15q-7 15 -19 12q3 6 4 17.5t1 13.5q3 13 12 23q1 1 7 8.5t9.5 13.5t0.5 6q35 -4 50 11q5 5 11.5 17
 t10.5 17q9 6 14 5.5t14.5 -5.5 t14.5 -5q14 -1 15.5 11t-7.5 20q12 -1 3 17q-5 7 -8 9q-12 4 -27 -5q-8 -4 2 -8q-1 1 -9.5 -10.5t-16.5 -17.5t-16 5q-1 1 -5.5 13.5t-9.5 13.5q-8 0 -16 -15q3 8 -11 15t-24 8q19 12 -8 27q-7 4 -20.5 5t-19.5 -4q-5 -7 -5.5 -11.5t5 -8t10.5 -5.5t11.5 -4t8.5 -3 q14 -10 8 -14q-2 -1 -8.5 -3.5t-11.5 -4.5t-6 -4q-3 -4 0 -14t-2 -14q-5 5 -9 17.5t-7 16.5q7 -9 -25 -6l-10 1q-4 0 -16 -2t-20.5 -1t-13.5 8q-4 8 0 20q1 4 4 2q-4 3 -11 9.5t-10 8.5q-46 -15 -94 -41q6 -1 12 1q5 2 13 6.5t10 5.5q34 14 42 7l5 5q14 -16 20 -25 q-7 4 -30 1q-20 -6 -22 -12q7 -12 5 -18q-4 3 -11.5 10t-14.5 11t-15 5q-16 0 -22 -1q-146 -80 -235 -222q7 -7 12 -8q4 -1 5 -9t2.5 -11t11.5 3q9 -8 3 -19q1 1 44 -27q19 -17 21 -21q3 -11 -10 -18q-1 2 -9 9t-9 4q-3 -5 0.5 -18.5t10.5 -12.5q-7 0 -9.5 -16t-2.5 -35.5 t-1 -23.5l2 -1q-3 -12 5.5 -34.5t21.5 -19.5q-13 -3 20 -43q6 -8 8 -9q3 -2 12 -7.5t15 -10t10 -10.5q4 -5 10 -22.5t14 -23.5q-2 -6 9.5 -20t10.5 -23q-1 0 -2.5 -1t-2.5 -1q3 -7 15.5 -14t15.5 -13q1 -3 2 -10t3 -11t8 -2q2 20 -24 62q-1
 5 25 -17 29q-3 5 -5.5 15.5 t-4.5 14.5q2 0 6 -1.5t8.5 -3.5t7.5 -4t2 -3q-3 -7 2 -17.5t12 -18.5t17 -19t12 -13q6 -6 14 -19.5t0 -13.5q9 0 20 -10t17 -20q5 -8 8 -26t5 -24q2 -7 8.5 -13.5t12.5 -9.5l16 -8t13 -7q5 -2 18.5 -10.5t21.5 -11.5q10 -4 16 -4t14.5 2.5t13.5 3.5q15 2 29 -15t21 -21 q36 -19 55 -11q-2 -1 0.5 -7.5t8 -15.5t9 -14.5t5.5 -8.5q5 -6 18 -15t18 -15q6 4 7 9q-3 -8 7 -20t18 -10q14 3 14 32q-31 -15 -49 18q0 1 -2.5 5.5t-4 8.5t-2.5 8.5t0 7.5t5 3q9 0 10 3.5t-2 12.5t-4 13q-1 8 -11 20t-12 15q-5 -9 -16 -8t-16 9q0 -1 -1.5 -5.5t-1.5 -6.5 q-13 0 -15 1q1 3 2.5 17.5t3.5 22.5q1 4 5.5 12t7.5 14.5t4 12.5t-4.5 9.5t-17.5 2.5q-19 -1 -26 -20q-1 -3 -3 -10.5t-5 -11.5t-9 -7q-7 -3 -24 -2t-24 5q-13 8 -22.5 29t-9.5 37q0 10 2.5 26.5t3 25t-5.5 24.5q3 2 9 9.5t10 10.5q2 1 4.5 1.5t4.5 0t4 1.5t3 6q-1 1 -4 3 q-3 3 -4 3q7 -3 28.5 1.5t27.5 -1.5q15 -11 22 2q0 1 -2.5 9.5t-0.5 13.5q5 -27 29 -9q3 -3 15.5 -5t17.5 -5q3 -2 7 -5.5t5.5 -4.5t5 0.5t8.5 6.5q10 -14 12 -24q11 -40 19 -44q7 -3 11 -2t4.5 9.5t0 14t-1.5 12.5l-1 8v18l-1 8q
 -15 3 -18.5 12t1.5 18.5t15 18.5q1 1 8 3.5 t15.5 6.5t12.5 8q21 19 15 35q7 0 11 9q-1 0 -5 3t-7.5 5t-4.5 2q9 5 2 16q5 3 7.5 11t7.5 10q9 -12 21 -2q7 8 1 16q5 7 20.5 10.5t18.5 9.5q7 -2 8 2t1 12t3 12q4 5 15 9t13 5l17 11q3 4 0 4q18 -2 31 11q10 11 -6 20q3 6 -3 9.5t-15 5.5q3 1 11.5 0.5t10.5 1.5 q15 10 -7 16q-17 5 -43 -12zM879 10q206 36 351 189q-3 3 -12.5 4.5t-12.5 3.5q-18 7 -24 8q1 7 -2.5 13t-8 9t-12.5 8t-11 7q-2 2 -7 6t-7 5.5t-7.5 4.5t-8.5 2t-10 -1l-3 -1q-3 -1 -5.5 -2.5t-5.5 -3t-4 -3t0 -2.5q-21 17 -36 22q-5 1 -11 5.5t-10.5 7t-10 1.5t-11.5 -7 q-5 -5 -6 -15t-2 -13q-7 5 0 17.5t2 18.5q-3 6 -10.5 4.5t-12 -4.5t-11.5 -8.5t-9 -6.5t-8.5 -5.5t-8.5 -7.5q-3 -4 -6 -12t-5 -11q-2 4 -11.5 6.5t-9.5 5.5q2 -

<TRUNCATED>
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/site/fonts/fontawesome-webfont.ttf
----------------------------------------------------------------------
diff --git a/avatica/site/fonts/fontawesome-webfont.ttf b/avatica/site/fonts/fontawesome-webfont.ttf
deleted file mode 100755
index 96a3639..0000000
Binary files a/avatica/site/fonts/fontawesome-webfont.ttf and /dev/null differ


[41/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/proto/Requests.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/proto/Requests.java b/avatica/core/src/main/java/org/apache/calcite/avatica/proto/Requests.java
deleted file mode 100644
index 8e10849..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/proto/Requests.java
+++ /dev/null
@@ -1,16608 +0,0 @@
-// Generated by the protocol buffer compiler.  DO NOT EDIT!
-// source: requests.proto
-
-package org.apache.calcite.avatica.proto;
-
-public final class Requests {
-  private Requests() {}
-  public static void registerAllExtensions(
-      com.google.protobuf.ExtensionRegistryLite registry) {
-  }
-
-  public static void registerAllExtensions(
-      com.google.protobuf.ExtensionRegistry registry) {
-    registerAllExtensions(
-        (com.google.protobuf.ExtensionRegistryLite) registry);
-  }
-  public interface CatalogsRequestOrBuilder extends
-      // @@protoc_insertion_point(interface_extends:CatalogsRequest)
-      com.google.protobuf.MessageOrBuilder {
-
-    /**
-     * <code>optional string connection_id = 1;</code>
-     */
-    java.lang.String getConnectionId();
-    /**
-     * <code>optional string connection_id = 1;</code>
-     */
-    com.google.protobuf.ByteString
-        getConnectionIdBytes();
-  }
-  /**
-   * <pre>
-   * Request for Meta#getCatalogs()
-   * </pre>
-   *
-   * Protobuf type {@code CatalogsRequest}
-   */
-  public  static final class CatalogsRequest extends
-      com.google.protobuf.GeneratedMessageV3 implements
-      // @@protoc_insertion_point(message_implements:CatalogsRequest)
-      CatalogsRequestOrBuilder {
-    // Use CatalogsRequest.newBuilder() to construct.
-    private CatalogsRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
-      super(builder);
-    }
-    private CatalogsRequest() {
-      connectionId_ = "";
-    }
-
-    @java.lang.Override
-    public final com.google.protobuf.UnknownFieldSet
-    getUnknownFields() {
-      return com.google.protobuf.UnknownFieldSet.getDefaultInstance();
-    }
-    private CatalogsRequest(
-        com.google.protobuf.CodedInputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      this();
-      int mutable_bitField0_ = 0;
-      try {
-        boolean done = false;
-        while (!done) {
-          int tag = input.readTag();
-          switch (tag) {
-            case 0:
-              done = true;
-              break;
-            default: {
-              if (!input.skipField(tag)) {
-                done = true;
-              }
-              break;
-            }
-            case 10: {
-              java.lang.String s = input.readStringRequireUtf8();
-
-              connectionId_ = s;
-              break;
-            }
-          }
-        }
-      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-        throw e.setUnfinishedMessage(this);
-      } catch (java.io.IOException e) {
-        throw new com.google.protobuf.InvalidProtocolBufferException(
-            e).setUnfinishedMessage(this);
-      } finally {
-        makeExtensionsImmutable();
-      }
-    }
-    public static final com.google.protobuf.Descriptors.Descriptor
-        getDescriptor() {
-      return org.apache.calcite.avatica.proto.Requests.internal_static_CatalogsRequest_descriptor;
-    }
-
-    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
-        internalGetFieldAccessorTable() {
-      return org.apache.calcite.avatica.proto.Requests.internal_static_CatalogsRequest_fieldAccessorTable
-          .ensureFieldAccessorsInitialized(
-              org.apache.calcite.avatica.proto.Requests.CatalogsRequest.class, org.apache.calcite.avatica.proto.Requests.CatalogsRequest.Builder.class);
-    }
-
-    public static final int CONNECTION_ID_FIELD_NUMBER = 1;
-    private volatile java.lang.Object connectionId_;
-    /**
-     * <code>optional string connection_id = 1;</code>
-     */
-    public java.lang.String getConnectionId() {
-      java.lang.Object ref = connectionId_;
-      if (ref instanceof java.lang.String) {
-        return (java.lang.String) ref;
-      } else {
-        com.google.protobuf.ByteString bs = 
-            (com.google.protobuf.ByteString) ref;
-        java.lang.String s = bs.toStringUtf8();
-        connectionId_ = s;
-        return s;
-      }
-    }
-    /**
-     * <code>optional string connection_id = 1;</code>
-     */
-    public com.google.protobuf.ByteString
-        getConnectionIdBytes() {
-      java.lang.Object ref = connectionId_;
-      if (ref instanceof java.lang.String) {
-        com.google.protobuf.ByteString b = 
-            com.google.protobuf.ByteString.copyFromUtf8(
-                (java.lang.String) ref);
-        connectionId_ = b;
-        return b;
-      } else {
-        return (com.google.protobuf.ByteString) ref;
-      }
-    }
-
-    private byte memoizedIsInitialized = -1;
-    public final boolean isInitialized() {
-      byte isInitialized = memoizedIsInitialized;
-      if (isInitialized == 1) return true;
-      if (isInitialized == 0) return false;
-
-      memoizedIsInitialized = 1;
-      return true;
-    }
-
-    public void writeTo(com.google.protobuf.CodedOutputStream output)
-                        throws java.io.IOException {
-      if (!getConnectionIdBytes().isEmpty()) {
-        com.google.protobuf.GeneratedMessageV3.writeString(output, 1, connectionId_);
-      }
-    }
-
-    public int getSerializedSize() {
-      int size = memoizedSize;
-      if (size != -1) return size;
-
-      size = 0;
-      if (!getConnectionIdBytes().isEmpty()) {
-        size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, connectionId_);
-      }
-      memoizedSize = size;
-      return size;
-    }
-
-    private static final long serialVersionUID = 0L;
-    @java.lang.Override
-    public boolean equals(final java.lang.Object obj) {
-      if (obj == this) {
-       return true;
-      }
-      if (!(obj instanceof org.apache.calcite.avatica.proto.Requests.CatalogsRequest)) {
-        return super.equals(obj);
-      }
-      org.apache.calcite.avatica.proto.Requests.CatalogsRequest other = (org.apache.calcite.avatica.proto.Requests.CatalogsRequest) obj;
-
-      boolean result = true;
-      result = result && getConnectionId()
-          .equals(other.getConnectionId());
-      return result;
-    }
-
-    @java.lang.Override
-    public int hashCode() {
-      if (memoizedHashCode != 0) {
-        return memoizedHashCode;
-      }
-      int hash = 41;
-      hash = (19 * hash) + getDescriptorForType().hashCode();
-      hash = (37 * hash) + CONNECTION_ID_FIELD_NUMBER;
-      hash = (53 * hash) + getConnectionId().hashCode();
-      hash = (29 * hash) + unknownFields.hashCode();
-      memoizedHashCode = hash;
-      return hash;
-    }
-
-    public static org.apache.calcite.avatica.proto.Requests.CatalogsRequest parseFrom(
-        com.google.protobuf.ByteString data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.apache.calcite.avatica.proto.Requests.CatalogsRequest parseFrom(
-        com.google.protobuf.ByteString data,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data, extensionRegistry);
-    }
-    public static org.apache.calcite.avatica.proto.Requests.CatalogsRequest parseFrom(byte[] data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.apache.calcite.avatica.proto.Requests.CatalogsRequest parseFrom(
-        byte[] data,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data, extensionRegistry);
-    }
-    public static org.apache.calcite.avatica.proto.Requests.CatalogsRequest parseFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseWithIOException(PARSER, input);
-    }
-    public static org.apache.calcite.avatica.proto.Requests.CatalogsRequest parseFrom(
-        java.io.InputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseWithIOException(PARSER, input, extensionRegistry);
-    }
-    public static org.apache.calcite.avatica.proto.Requests.CatalogsRequest parseDelimitedFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseDelimitedWithIOException(PARSER, input);
-    }
-    public static org.apache.calcite.avatica.proto.Requests.CatalogsRequest parseDelimitedFrom(
-        java.io.InputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
-    }
-    public static org.apache.calcite.avatica.proto.Requests.CatalogsRequest parseFrom(
-        com.google.protobuf.CodedInputStream input)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseWithIOException(PARSER, input);
-    }
-    public static org.apache.calcite.avatica.proto.Requests.CatalogsRequest parseFrom(
-        com.google.protobuf.CodedInputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseWithIOException(PARSER, input, extensionRegistry);
-    }
-
-    public Builder newBuilderForType() { return newBuilder(); }
-    public static Builder newBuilder() {
-      return DEFAULT_INSTANCE.toBuilder();
-    }
-    public static Builder newBuilder(org.apache.calcite.avatica.proto.Requests.CatalogsRequest prototype) {
-      return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
-    }
-    public Builder toBuilder() {
-      return this == DEFAULT_INSTANCE
-          ? new Builder() : new Builder().mergeFrom(this);
-    }
-
-    @java.lang.Override
-    protected Builder newBuilderForType(
-        com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
-      Builder builder = new Builder(parent);
-      return builder;
-    }
-    /**
-     * <pre>
-     * Request for Meta#getCatalogs()
-     * </pre>
-     *
-     * Protobuf type {@code CatalogsRequest}
-     */
-    public static final class Builder extends
-        com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
-        // @@protoc_insertion_point(builder_implements:CatalogsRequest)
-        org.apache.calcite.avatica.proto.Requests.CatalogsRequestOrBuilder {
-      public static final com.google.protobuf.Descriptors.Descriptor
-          getDescriptor() {
-        return org.apache.calcite.avatica.proto.Requests.internal_static_CatalogsRequest_descriptor;
-      }
-
-      protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
-          internalGetFieldAccessorTable() {
-        return org.apache.calcite.avatica.proto.Requests.internal_static_CatalogsRequest_fieldAccessorTable
-            .ensureFieldAccessorsInitialized(
-                org.apache.calcite.avatica.proto.Requests.CatalogsRequest.class, org.apache.calcite.avatica.proto.Requests.CatalogsRequest.Builder.class);
-      }
-
-      // Construct using org.apache.calcite.avatica.proto.Requests.CatalogsRequest.newBuilder()
-      private Builder() {
-        maybeForceBuilderInitialization();
-      }
-
-      private Builder(
-          com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
-        super(parent);
-        maybeForceBuilderInitialization();
-      }
-      private void maybeForceBuilderInitialization() {
-        if (com.google.protobuf.GeneratedMessageV3
-                .alwaysUseFieldBuilders) {
-        }
-      }
-      public Builder clear() {
-        super.clear();
-        connectionId_ = "";
-
-        return this;
-      }
-
-      public com.google.protobuf.Descriptors.Descriptor
-          getDescriptorForType() {
-        return org.apache.calcite.avatica.proto.Requests.internal_static_CatalogsRequest_descriptor;
-      }
-
-      public org.apache.calcite.avatica.proto.Requests.CatalogsRequest getDefaultInstanceForType() {
-        return org.apache.calcite.avatica.proto.Requests.CatalogsRequest.getDefaultInstance();
-      }
-
-      public org.apache.calcite.avatica.proto.Requests.CatalogsRequest build() {
-        org.apache.calcite.avatica.proto.Requests.CatalogsRequest result = buildPartial();
-        if (!result.isInitialized()) {
-          throw newUninitializedMessageException(result);
-        }
-        return result;
-      }
-
-      public org.apache.calcite.avatica.proto.Requests.CatalogsRequest buildPartial() {
-        org.apache.calcite.avatica.proto.Requests.CatalogsRequest result = new org.apache.calcite.avatica.proto.Requests.CatalogsRequest(this);
-        result.connectionId_ = connectionId_;
-        onBuilt();
-        return result;
-      }
-
-      public Builder clone() {
-        return (Builder) super.clone();
-      }
-      public Builder setField(
-          com.google.protobuf.Descriptors.FieldDescriptor field,
-          Object value) {
-        return (Builder) super.setField(field, value);
-      }
-      public Builder clearField(
-          com.google.protobuf.Descriptors.FieldDescriptor field) {
-        return (Builder) super.clearField(field);
-      }
-      public Builder clearOneof(
-          com.google.protobuf.Descriptors.OneofDescriptor oneof) {
-        return (Builder) super.clearOneof(oneof);
-      }
-      public Builder setRepeatedField(
-          com.google.protobuf.Descriptors.FieldDescriptor field,
-          int index, Object value) {
-        return (Builder) super.setRepeatedField(field, index, value);
-      }
-      public Builder addRepeatedField(
-          com.google.protobuf.Descriptors.FieldDescriptor field,
-          Object value) {
-        return (Builder) super.addRepeatedField(field, value);
-      }
-      public Builder mergeFrom(com.google.protobuf.Message other) {
-        if (other instanceof org.apache.calcite.avatica.proto.Requests.CatalogsRequest) {
-          return mergeFrom((org.apache.calcite.avatica.proto.Requests.CatalogsRequest)other);
-        } else {
-          super.mergeFrom(other);
-          return this;
-        }
-      }
-
-      public Builder mergeFrom(org.apache.calcite.avatica.proto.Requests.CatalogsRequest other) {
-        if (other == org.apache.calcite.avatica.proto.Requests.CatalogsRequest.getDefaultInstance()) return this;
-        if (!other.getConnectionId().isEmpty()) {
-          connectionId_ = other.connectionId_;
-          onChanged();
-        }
-        onChanged();
-        return this;
-      }
-
-      public final boolean isInitialized() {
-        return true;
-      }
-
-      public Builder mergeFrom(
-          com.google.protobuf.CodedInputStream input,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws java.io.IOException {
-        org.apache.calcite.avatica.proto.Requests.CatalogsRequest parsedMessage = null;
-        try {
-          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
-        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-          parsedMessage = (org.apache.calcite.avatica.proto.Requests.CatalogsRequest) e.getUnfinishedMessage();
-          throw e.unwrapIOException();
-        } finally {
-          if (parsedMessage != null) {
-            mergeFrom(parsedMessage);
-          }
-        }
-        return this;
-      }
-
-      private java.lang.Object connectionId_ = "";
-      /**
-       * <code>optional string connection_id = 1;</code>
-       */
-      public java.lang.String getConnectionId() {
-        java.lang.Object ref = connectionId_;
-        if (!(ref instanceof java.lang.String)) {
-          com.google.protobuf.ByteString bs =
-              (com.google.protobuf.ByteString) ref;
-          java.lang.String s = bs.toStringUtf8();
-          connectionId_ = s;
-          return s;
-        } else {
-          return (java.lang.String) ref;
-        }
-      }
-      /**
-       * <code>optional string connection_id = 1;</code>
-       */
-      public com.google.protobuf.ByteString
-          getConnectionIdBytes() {
-        java.lang.Object ref = connectionId_;
-        if (ref instanceof String) {
-          com.google.protobuf.ByteString b = 
-              com.google.protobuf.ByteString.copyFromUtf8(
-                  (java.lang.String) ref);
-          connectionId_ = b;
-          return b;
-        } else {
-          return (com.google.protobuf.ByteString) ref;
-        }
-      }
-      /**
-       * <code>optional string connection_id = 1;</code>
-       */
-      public Builder setConnectionId(
-          java.lang.String value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  
-        connectionId_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>optional string connection_id = 1;</code>
-       */
-      public Builder clearConnectionId() {
-        
-        connectionId_ = getDefaultInstance().getConnectionId();
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>optional string connection_id = 1;</code>
-       */
-      public Builder setConnectionIdBytes(
-          com.google.protobuf.ByteString value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  checkByteStringIsUtf8(value);
-        
-        connectionId_ = value;
-        onChanged();
-        return this;
-      }
-      public final Builder setUnknownFields(
-          final com.google.protobuf.UnknownFieldSet unknownFields) {
-        return this;
-      }
-
-      public final Builder mergeUnknownFields(
-          final com.google.protobuf.UnknownFieldSet unknownFields) {
-        return this;
-      }
-
-
-      // @@protoc_insertion_point(builder_scope:CatalogsRequest)
-    }
-
-    // @@protoc_insertion_point(class_scope:CatalogsRequest)
-    private static final org.apache.calcite.avatica.proto.Requests.CatalogsRequest DEFAULT_INSTANCE;
-    static {
-      DEFAULT_INSTANCE = new org.apache.calcite.avatica.proto.Requests.CatalogsRequest();
-    }
-
-    public static org.apache.calcite.avatica.proto.Requests.CatalogsRequest getDefaultInstance() {
-      return DEFAULT_INSTANCE;
-    }
-
-    private static final com.google.protobuf.Parser<CatalogsRequest>
-        PARSER = new com.google.protobuf.AbstractParser<CatalogsRequest>() {
-      public CatalogsRequest parsePartialFrom(
-          com.google.protobuf.CodedInputStream input,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws com.google.protobuf.InvalidProtocolBufferException {
-          return new CatalogsRequest(input, extensionRegistry);
-      }
-    };
-
-    public static com.google.protobuf.Parser<CatalogsRequest> parser() {
-      return PARSER;
-    }
-
-    @java.lang.Override
-    public com.google.protobuf.Parser<CatalogsRequest> getParserForType() {
-      return PARSER;
-    }
-
-    public org.apache.calcite.avatica.proto.Requests.CatalogsRequest getDefaultInstanceForType() {
-      return DEFAULT_INSTANCE;
-    }
-
-  }
-
-  public interface DatabasePropertyRequestOrBuilder extends
-      // @@protoc_insertion_point(interface_extends:DatabasePropertyRequest)
-      com.google.protobuf.MessageOrBuilder {
-
-    /**
-     * <code>optional string connection_id = 1;</code>
-     */
-    java.lang.String getConnectionId();
-    /**
-     * <code>optional string connection_id = 1;</code>
-     */
-    com.google.protobuf.ByteString
-        getConnectionIdBytes();
-  }
-  /**
-   * <pre>
-   * Request for Meta#getDatabaseProperties()
-   * </pre>
-   *
-   * Protobuf type {@code DatabasePropertyRequest}
-   */
-  public  static final class DatabasePropertyRequest extends
-      com.google.protobuf.GeneratedMessageV3 implements
-      // @@protoc_insertion_point(message_implements:DatabasePropertyRequest)
-      DatabasePropertyRequestOrBuilder {
-    // Use DatabasePropertyRequest.newBuilder() to construct.
-    private DatabasePropertyRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
-      super(builder);
-    }
-    private DatabasePropertyRequest() {
-      connectionId_ = "";
-    }
-
-    @java.lang.Override
-    public final com.google.protobuf.UnknownFieldSet
-    getUnknownFields() {
-      return com.google.protobuf.UnknownFieldSet.getDefaultInstance();
-    }
-    private DatabasePropertyRequest(
-        com.google.protobuf.CodedInputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      this();
-      int mutable_bitField0_ = 0;
-      try {
-        boolean done = false;
-        while (!done) {
-          int tag = input.readTag();
-          switch (tag) {
-            case 0:
-              done = true;
-              break;
-            default: {
-              if (!input.skipField(tag)) {
-                done = true;
-              }
-              break;
-            }
-            case 10: {
-              java.lang.String s = input.readStringRequireUtf8();
-
-              connectionId_ = s;
-              break;
-            }
-          }
-        }
-      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-        throw e.setUnfinishedMessage(this);
-      } catch (java.io.IOException e) {
-        throw new com.google.protobuf.InvalidProtocolBufferException(
-            e).setUnfinishedMessage(this);
-      } finally {
-        makeExtensionsImmutable();
-      }
-    }
-    public static final com.google.protobuf.Descriptors.Descriptor
-        getDescriptor() {
-      return org.apache.calcite.avatica.proto.Requests.internal_static_DatabasePropertyRequest_descriptor;
-    }
-
-    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
-        internalGetFieldAccessorTable() {
-      return org.apache.calcite.avatica.proto.Requests.internal_static_DatabasePropertyRequest_fieldAccessorTable
-          .ensureFieldAccessorsInitialized(
-              org.apache.calcite.avatica.proto.Requests.DatabasePropertyRequest.class, org.apache.calcite.avatica.proto.Requests.DatabasePropertyRequest.Builder.class);
-    }
-
-    public static final int CONNECTION_ID_FIELD_NUMBER = 1;
-    private volatile java.lang.Object connectionId_;
-    /**
-     * <code>optional string connection_id = 1;</code>
-     */
-    public java.lang.String getConnectionId() {
-      java.lang.Object ref = connectionId_;
-      if (ref instanceof java.lang.String) {
-        return (java.lang.String) ref;
-      } else {
-        com.google.protobuf.ByteString bs = 
-            (com.google.protobuf.ByteString) ref;
-        java.lang.String s = bs.toStringUtf8();
-        connectionId_ = s;
-        return s;
-      }
-    }
-    /**
-     * <code>optional string connection_id = 1;</code>
-     */
-    public com.google.protobuf.ByteString
-        getConnectionIdBytes() {
-      java.lang.Object ref = connectionId_;
-      if (ref instanceof java.lang.String) {
-        com.google.protobuf.ByteString b = 
-            com.google.protobuf.ByteString.copyFromUtf8(
-                (java.lang.String) ref);
-        connectionId_ = b;
-        return b;
-      } else {
-        return (com.google.protobuf.ByteString) ref;
-      }
-    }
-
-    private byte memoizedIsInitialized = -1;
-    public final boolean isInitialized() {
-      byte isInitialized = memoizedIsInitialized;
-      if (isInitialized == 1) return true;
-      if (isInitialized == 0) return false;
-
-      memoizedIsInitialized = 1;
-      return true;
-    }
-
-    public void writeTo(com.google.protobuf.CodedOutputStream output)
-                        throws java.io.IOException {
-      if (!getConnectionIdBytes().isEmpty()) {
-        com.google.protobuf.GeneratedMessageV3.writeString(output, 1, connectionId_);
-      }
-    }
-
-    public int getSerializedSize() {
-      int size = memoizedSize;
-      if (size != -1) return size;
-
-      size = 0;
-      if (!getConnectionIdBytes().isEmpty()) {
-        size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, connectionId_);
-      }
-      memoizedSize = size;
-      return size;
-    }
-
-    private static final long serialVersionUID = 0L;
-    @java.lang.Override
-    public boolean equals(final java.lang.Object obj) {
-      if (obj == this) {
-       return true;
-      }
-      if (!(obj instanceof org.apache.calcite.avatica.proto.Requests.DatabasePropertyRequest)) {
-        return super.equals(obj);
-      }
-      org.apache.calcite.avatica.proto.Requests.DatabasePropertyRequest other = (org.apache.calcite.avatica.proto.Requests.DatabasePropertyRequest) obj;
-
-      boolean result = true;
-      result = result && getConnectionId()
-          .equals(other.getConnectionId());
-      return result;
-    }
-
-    @java.lang.Override
-    public int hashCode() {
-      if (memoizedHashCode != 0) {
-        return memoizedHashCode;
-      }
-      int hash = 41;
-      hash = (19 * hash) + getDescriptorForType().hashCode();
-      hash = (37 * hash) + CONNECTION_ID_FIELD_NUMBER;
-      hash = (53 * hash) + getConnectionId().hashCode();
-      hash = (29 * hash) + unknownFields.hashCode();
-      memoizedHashCode = hash;
-      return hash;
-    }
-
-    public static org.apache.calcite.avatica.proto.Requests.DatabasePropertyRequest parseFrom(
-        com.google.protobuf.ByteString data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.apache.calcite.avatica.proto.Requests.DatabasePropertyRequest parseFrom(
-        com.google.protobuf.ByteString data,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data, extensionRegistry);
-    }
-    public static org.apache.calcite.avatica.proto.Requests.DatabasePropertyRequest parseFrom(byte[] data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.apache.calcite.avatica.proto.Requests.DatabasePropertyRequest parseFrom(
-        byte[] data,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data, extensionRegistry);
-    }
-    public static org.apache.calcite.avatica.proto.Requests.DatabasePropertyRequest parseFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseWithIOException(PARSER, input);
-    }
-    public static org.apache.calcite.avatica.proto.Requests.DatabasePropertyRequest parseFrom(
-        java.io.InputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseWithIOException(PARSER, input, extensionRegistry);
-    }
-    public static org.apache.calcite.avatica.proto.Requests.DatabasePropertyRequest parseDelimitedFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseDelimitedWithIOException(PARSER, input);
-    }
-    public static org.apache.calcite.avatica.proto.Requests.DatabasePropertyRequest parseDelimitedFrom(
-        java.io.InputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
-    }
-    public static org.apache.calcite.avatica.proto.Requests.DatabasePropertyRequest parseFrom(
-        com.google.protobuf.CodedInputStream input)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseWithIOException(PARSER, input);
-    }
-    public static org.apache.calcite.avatica.proto.Requests.DatabasePropertyRequest parseFrom(
-        com.google.protobuf.CodedInputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseWithIOException(PARSER, input, extensionRegistry);
-    }
-
-    public Builder newBuilderForType() { return newBuilder(); }
-    public static Builder newBuilder() {
-      return DEFAULT_INSTANCE.toBuilder();
-    }
-    public static Builder newBuilder(org.apache.calcite.avatica.proto.Requests.DatabasePropertyRequest prototype) {
-      return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
-    }
-    public Builder toBuilder() {
-      return this == DEFAULT_INSTANCE
-          ? new Builder() : new Builder().mergeFrom(this);
-    }
-
-    @java.lang.Override
-    protected Builder newBuilderForType(
-        com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
-      Builder builder = new Builder(parent);
-      return builder;
-    }
-    /**
-     * <pre>
-     * Request for Meta#getDatabaseProperties()
-     * </pre>
-     *
-     * Protobuf type {@code DatabasePropertyRequest}
-     */
-    public static final class Builder extends
-        com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
-        // @@protoc_insertion_point(builder_implements:DatabasePropertyRequest)
-        org.apache.calcite.avatica.proto.Requests.DatabasePropertyRequestOrBuilder {
-      public static final com.google.protobuf.Descriptors.Descriptor
-          getDescriptor() {
-        return org.apache.calcite.avatica.proto.Requests.internal_static_DatabasePropertyRequest_descriptor;
-      }
-
-      protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
-          internalGetFieldAccessorTable() {
-        return org.apache.calcite.avatica.proto.Requests.internal_static_DatabasePropertyRequest_fieldAccessorTable
-            .ensureFieldAccessorsInitialized(
-                org.apache.calcite.avatica.proto.Requests.DatabasePropertyRequest.class, org.apache.calcite.avatica.proto.Requests.DatabasePropertyRequest.Builder.class);
-      }
-
-      // Construct using org.apache.calcite.avatica.proto.Requests.DatabasePropertyRequest.newBuilder()
-      private Builder() {
-        maybeForceBuilderInitialization();
-      }
-
-      private Builder(
-          com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
-        super(parent);
-        maybeForceBuilderInitialization();
-      }
-      private void maybeForceBuilderInitialization() {
-        if (com.google.protobuf.GeneratedMessageV3
-                .alwaysUseFieldBuilders) {
-        }
-      }
-      public Builder clear() {
-        super.clear();
-        connectionId_ = "";
-
-        return this;
-      }
-
-      public com.google.protobuf.Descriptors.Descriptor
-          getDescriptorForType() {
-        return org.apache.calcite.avatica.proto.Requests.internal_static_DatabasePropertyRequest_descriptor;
-      }
-
-      public org.apache.calcite.avatica.proto.Requests.DatabasePropertyRequest getDefaultInstanceForType() {
-        return org.apache.calcite.avatica.proto.Requests.DatabasePropertyRequest.getDefaultInstance();
-      }
-
-      public org.apache.calcite.avatica.proto.Requests.DatabasePropertyRequest build() {
-        org.apache.calcite.avatica.proto.Requests.DatabasePropertyRequest result = buildPartial();
-        if (!result.isInitialized()) {
-          throw newUninitializedMessageException(result);
-        }
-        return result;
-      }
-
-      public org.apache.calcite.avatica.proto.Requests.DatabasePropertyRequest buildPartial() {
-        org.apache.calcite.avatica.proto.Requests.DatabasePropertyRequest result = new org.apache.calcite.avatica.proto.Requests.DatabasePropertyRequest(this);
-        result.connectionId_ = connectionId_;
-        onBuilt();
-        return result;
-      }
-
-      public Builder clone() {
-        return (Builder) super.clone();
-      }
-      public Builder setField(
-          com.google.protobuf.Descriptors.FieldDescriptor field,
-          Object value) {
-        return (Builder) super.setField(field, value);
-      }
-      public Builder clearField(
-          com.google.protobuf.Descriptors.FieldDescriptor field) {
-        return (Builder) super.clearField(field);
-      }
-      public Builder clearOneof(
-          com.google.protobuf.Descriptors.OneofDescriptor oneof) {
-        return (Builder) super.clearOneof(oneof);
-      }
-      public Builder setRepeatedField(
-          com.google.protobuf.Descriptors.FieldDescriptor field,
-          int index, Object value) {
-        return (Builder) super.setRepeatedField(field, index, value);
-      }
-      public Builder addRepeatedField(
-          com.google.protobuf.Descriptors.FieldDescriptor field,
-          Object value) {
-        return (Builder) super.addRepeatedField(field, value);
-      }
-      public Builder mergeFrom(com.google.protobuf.Message other) {
-        if (other instanceof org.apache.calcite.avatica.proto.Requests.DatabasePropertyRequest) {
-          return mergeFrom((org.apache.calcite.avatica.proto.Requests.DatabasePropertyRequest)other);
-        } else {
-          super.mergeFrom(other);
-          return this;
-        }
-      }
-
-      public Builder mergeFrom(org.apache.calcite.avatica.proto.Requests.DatabasePropertyRequest other) {
-        if (other == org.apache.calcite.avatica.proto.Requests.DatabasePropertyRequest.getDefaultInstance()) return this;
-        if (!other.getConnectionId().isEmpty()) {
-          connectionId_ = other.connectionId_;
-          onChanged();
-        }
-        onChanged();
-        return this;
-      }
-
-      public final boolean isInitialized() {
-        return true;
-      }
-
-      public Builder mergeFrom(
-          com.google.protobuf.CodedInputStream input,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws java.io.IOException {
-        org.apache.calcite.avatica.proto.Requests.DatabasePropertyRequest parsedMessage = null;
-        try {
-          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
-        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-          parsedMessage = (org.apache.calcite.avatica.proto.Requests.DatabasePropertyRequest) e.getUnfinishedMessage();
-          throw e.unwrapIOException();
-        } finally {
-          if (parsedMessage != null) {
-            mergeFrom(parsedMessage);
-          }
-        }
-        return this;
-      }
-
-      private java.lang.Object connectionId_ = "";
-      /**
-       * <code>optional string connection_id = 1;</code>
-       */
-      public java.lang.String getConnectionId() {
-        java.lang.Object ref = connectionId_;
-        if (!(ref instanceof java.lang.String)) {
-          com.google.protobuf.ByteString bs =
-              (com.google.protobuf.ByteString) ref;
-          java.lang.String s = bs.toStringUtf8();
-          connectionId_ = s;
-          return s;
-        } else {
-          return (java.lang.String) ref;
-        }
-      }
-      /**
-       * <code>optional string connection_id = 1;</code>
-       */
-      public com.google.protobuf.ByteString
-          getConnectionIdBytes() {
-        java.lang.Object ref = connectionId_;
-        if (ref instanceof String) {
-          com.google.protobuf.ByteString b = 
-              com.google.protobuf.ByteString.copyFromUtf8(
-                  (java.lang.String) ref);
-          connectionId_ = b;
-          return b;
-        } else {
-          return (com.google.protobuf.ByteString) ref;
-        }
-      }
-      /**
-       * <code>optional string connection_id = 1;</code>
-       */
-      public Builder setConnectionId(
-          java.lang.String value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  
-        connectionId_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>optional string connection_id = 1;</code>
-       */
-      public Builder clearConnectionId() {
-        
-        connectionId_ = getDefaultInstance().getConnectionId();
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>optional string connection_id = 1;</code>
-       */
-      public Builder setConnectionIdBytes(
-          com.google.protobuf.ByteString value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  checkByteStringIsUtf8(value);
-        
-        connectionId_ = value;
-        onChanged();
-        return this;
-      }
-      public final Builder setUnknownFields(
-          final com.google.protobuf.UnknownFieldSet unknownFields) {
-        return this;
-      }
-
-      public final Builder mergeUnknownFields(
-          final com.google.protobuf.UnknownFieldSet unknownFields) {
-        return this;
-      }
-
-
-      // @@protoc_insertion_point(builder_scope:DatabasePropertyRequest)
-    }
-
-    // @@protoc_insertion_point(class_scope:DatabasePropertyRequest)
-    private static final org.apache.calcite.avatica.proto.Requests.DatabasePropertyRequest DEFAULT_INSTANCE;
-    static {
-      DEFAULT_INSTANCE = new org.apache.calcite.avatica.proto.Requests.DatabasePropertyRequest();
-    }
-
-    public static org.apache.calcite.avatica.proto.Requests.DatabasePropertyRequest getDefaultInstance() {
-      return DEFAULT_INSTANCE;
-    }
-
-    private static final com.google.protobuf.Parser<DatabasePropertyRequest>
-        PARSER = new com.google.protobuf.AbstractParser<DatabasePropertyRequest>() {
-      public DatabasePropertyRequest parsePartialFrom(
-          com.google.protobuf.CodedInputStream input,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws com.google.protobuf.InvalidProtocolBufferException {
-          return new DatabasePropertyRequest(input, extensionRegistry);
-      }
-    };
-
-    public static com.google.protobuf.Parser<DatabasePropertyRequest> parser() {
-      return PARSER;
-    }
-
-    @java.lang.Override
-    public com.google.protobuf.Parser<DatabasePropertyRequest> getParserForType() {
-      return PARSER;
-    }
-
-    public org.apache.calcite.avatica.proto.Requests.DatabasePropertyRequest getDefaultInstanceForType() {
-      return DEFAULT_INSTANCE;
-    }
-
-  }
-
-  public interface SchemasRequestOrBuilder extends
-      // @@protoc_insertion_point(interface_extends:SchemasRequest)
-      com.google.protobuf.MessageOrBuilder {
-
-    /**
-     * <code>optional string catalog = 1;</code>
-     */
-    java.lang.String getCatalog();
-    /**
-     * <code>optional string catalog = 1;</code>
-     */
-    com.google.protobuf.ByteString
-        getCatalogBytes();
-
-    /**
-     * <code>optional string schema_pattern = 2;</code>
-     */
-    java.lang.String getSchemaPattern();
-    /**
-     * <code>optional string schema_pattern = 2;</code>
-     */
-    com.google.protobuf.ByteString
-        getSchemaPatternBytes();
-
-    /**
-     * <code>optional string connection_id = 3;</code>
-     */
-    java.lang.String getConnectionId();
-    /**
-     * <code>optional string connection_id = 3;</code>
-     */
-    com.google.protobuf.ByteString
-        getConnectionIdBytes();
-  }
-  /**
-   * <pre>
-   * Request for Meta#getSchemas(String, org.apache.calcite.avatica.Meta.Pat)}
-   * </pre>
-   *
-   * Protobuf type {@code SchemasRequest}
-   */
-  public  static final class SchemasRequest extends
-      com.google.protobuf.GeneratedMessageV3 implements
-      // @@protoc_insertion_point(message_implements:SchemasRequest)
-      SchemasRequestOrBuilder {
-    // Use SchemasRequest.newBuilder() to construct.
-    private SchemasRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
-      super(builder);
-    }
-    private SchemasRequest() {
-      catalog_ = "";
-      schemaPattern_ = "";
-      connectionId_ = "";
-    }
-
-    @java.lang.Override
-    public final com.google.protobuf.UnknownFieldSet
-    getUnknownFields() {
-      return com.google.protobuf.UnknownFieldSet.getDefaultInstance();
-    }
-    private SchemasRequest(
-        com.google.protobuf.CodedInputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      this();
-      int mutable_bitField0_ = 0;
-      try {
-        boolean done = false;
-        while (!done) {
-          int tag = input.readTag();
-          switch (tag) {
-            case 0:
-              done = true;
-              break;
-            default: {
-              if (!input.skipField(tag)) {
-                done = true;
-              }
-              break;
-            }
-            case 10: {
-              java.lang.String s = input.readStringRequireUtf8();
-
-              catalog_ = s;
-              break;
-            }
-            case 18: {
-              java.lang.String s = input.readStringRequireUtf8();
-
-              schemaPattern_ = s;
-              break;
-            }
-            case 26: {
-              java.lang.String s = input.readStringRequireUtf8();
-
-              connectionId_ = s;
-              break;
-            }
-          }
-        }
-      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-        throw e.setUnfinishedMessage(this);
-      } catch (java.io.IOException e) {
-        throw new com.google.protobuf.InvalidProtocolBufferException(
-            e).setUnfinishedMessage(this);
-      } finally {
-        makeExtensionsImmutable();
-      }
-    }
-    public static final com.google.protobuf.Descriptors.Descriptor
-        getDescriptor() {
-      return org.apache.calcite.avatica.proto.Requests.internal_static_SchemasRequest_descriptor;
-    }
-
-    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
-        internalGetFieldAccessorTable() {
-      return org.apache.calcite.avatica.proto.Requests.internal_static_SchemasRequest_fieldAccessorTable
-          .ensureFieldAccessorsInitialized(
-              org.apache.calcite.avatica.proto.Requests.SchemasRequest.class, org.apache.calcite.avatica.proto.Requests.SchemasRequest.Builder.class);
-    }
-
-    public static final int CATALOG_FIELD_NUMBER = 1;
-    private volatile java.lang.Object catalog_;
-    /**
-     * <code>optional string catalog = 1;</code>
-     */
-    public java.lang.String getCatalog() {
-      java.lang.Object ref = catalog_;
-      if (ref instanceof java.lang.String) {
-        return (java.lang.String) ref;
-      } else {
-        com.google.protobuf.ByteString bs = 
-            (com.google.protobuf.ByteString) ref;
-        java.lang.String s = bs.toStringUtf8();
-        catalog_ = s;
-        return s;
-      }
-    }
-    /**
-     * <code>optional string catalog = 1;</code>
-     */
-    public com.google.protobuf.ByteString
-        getCatalogBytes() {
-      java.lang.Object ref = catalog_;
-      if (ref instanceof java.lang.String) {
-        com.google.protobuf.ByteString b = 
-            com.google.protobuf.ByteString.copyFromUtf8(
-                (java.lang.String) ref);
-        catalog_ = b;
-        return b;
-      } else {
-        return (com.google.protobuf.ByteString) ref;
-      }
-    }
-
-    public static final int SCHEMA_PATTERN_FIELD_NUMBER = 2;
-    private volatile java.lang.Object schemaPattern_;
-    /**
-     * <code>optional string schema_pattern = 2;</code>
-     */
-    public java.lang.String getSchemaPattern() {
-      java.lang.Object ref = schemaPattern_;
-      if (ref instanceof java.lang.String) {
-        return (java.lang.String) ref;
-      } else {
-        com.google.protobuf.ByteString bs = 
-            (com.google.protobuf.ByteString) ref;
-        java.lang.String s = bs.toStringUtf8();
-        schemaPattern_ = s;
-        return s;
-      }
-    }
-    /**
-     * <code>optional string schema_pattern = 2;</code>
-     */
-    public com.google.protobuf.ByteString
-        getSchemaPatternBytes() {
-      java.lang.Object ref = schemaPattern_;
-      if (ref instanceof java.lang.String) {
-        com.google.protobuf.ByteString b = 
-            com.google.protobuf.ByteString.copyFromUtf8(
-                (java.lang.String) ref);
-        schemaPattern_ = b;
-        return b;
-      } else {
-        return (com.google.protobuf.ByteString) ref;
-      }
-    }
-
-    public static final int CONNECTION_ID_FIELD_NUMBER = 3;
-    private volatile java.lang.Object connectionId_;
-    /**
-     * <code>optional string connection_id = 3;</code>
-     */
-    public java.lang.String getConnectionId() {
-      java.lang.Object ref = connectionId_;
-      if (ref instanceof java.lang.String) {
-        return (java.lang.String) ref;
-      } else {
-        com.google.protobuf.ByteString bs = 
-            (com.google.protobuf.ByteString) ref;
-        java.lang.String s = bs.toStringUtf8();
-        connectionId_ = s;
-        return s;
-      }
-    }
-    /**
-     * <code>optional string connection_id = 3;</code>
-     */
-    public com.google.protobuf.ByteString
-        getConnectionIdBytes() {
-      java.lang.Object ref = connectionId_;
-      if (ref instanceof java.lang.String) {
-        com.google.protobuf.ByteString b = 
-            com.google.protobuf.ByteString.copyFromUtf8(
-                (java.lang.String) ref);
-        connectionId_ = b;
-        return b;
-      } else {
-        return (com.google.protobuf.ByteString) ref;
-      }
-    }
-
-    private byte memoizedIsInitialized = -1;
-    public final boolean isInitialized() {
-      byte isInitialized = memoizedIsInitialized;
-      if (isInitialized == 1) return true;
-      if (isInitialized == 0) return false;
-
-      memoizedIsInitialized = 1;
-      return true;
-    }
-
-    public void writeTo(com.google.protobuf.CodedOutputStream output)
-                        throws java.io.IOException {
-      if (!getCatalogBytes().isEmpty()) {
-        com.google.protobuf.GeneratedMessageV3.writeString(output, 1, catalog_);
-      }
-      if (!getSchemaPatternBytes().isEmpty()) {
-        com.google.protobuf.GeneratedMessageV3.writeString(output, 2, schemaPattern_);
-      }
-      if (!getConnectionIdBytes().isEmpty()) {
-        com.google.protobuf.GeneratedMessageV3.writeString(output, 3, connectionId_);
-      }
-    }
-
-    public int getSerializedSize() {
-      int size = memoizedSize;
-      if (size != -1) return size;
-
-      size = 0;
-      if (!getCatalogBytes().isEmpty()) {
-        size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, catalog_);
-      }
-      if (!getSchemaPatternBytes().isEmpty()) {
-        size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, schemaPattern_);
-      }
-      if (!getConnectionIdBytes().isEmpty()) {
-        size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, connectionId_);
-      }
-      memoizedSize = size;
-      return size;
-    }
-
-    private static final long serialVersionUID = 0L;
-    @java.lang.Override
-    public boolean equals(final java.lang.Object obj) {
-      if (obj == this) {
-       return true;
-      }
-      if (!(obj instanceof org.apache.calcite.avatica.proto.Requests.SchemasRequest)) {
-        return super.equals(obj);
-      }
-      org.apache.calcite.avatica.proto.Requests.SchemasRequest other = (org.apache.calcite.avatica.proto.Requests.SchemasRequest) obj;
-
-      boolean result = true;
-      result = result && getCatalog()
-          .equals(other.getCatalog());
-      result = result && getSchemaPattern()
-          .equals(other.getSchemaPattern());
-      result = result && getConnectionId()
-          .equals(other.getConnectionId());
-      return result;
-    }
-
-    @java.lang.Override
-    public int hashCode() {
-      if (memoizedHashCode != 0) {
-        return memoizedHashCode;
-      }
-      int hash = 41;
-      hash = (19 * hash) + getDescriptorForType().hashCode();
-      hash = (37 * hash) + CATALOG_FIELD_NUMBER;
-      hash = (53 * hash) + getCatalog().hashCode();
-      hash = (37 * hash) + SCHEMA_PATTERN_FIELD_NUMBER;
-      hash = (53 * hash) + getSchemaPattern().hashCode();
-      hash = (37 * hash) + CONNECTION_ID_FIELD_NUMBER;
-      hash = (53 * hash) + getConnectionId().hashCode();
-      hash = (29 * hash) + unknownFields.hashCode();
-      memoizedHashCode = hash;
-      return hash;
-    }
-
-    public static org.apache.calcite.avatica.proto.Requests.SchemasRequest parseFrom(
-        com.google.protobuf.ByteString data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.apache.calcite.avatica.proto.Requests.SchemasRequest parseFrom(
-        com.google.protobuf.ByteString data,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data, extensionRegistry);
-    }
-    public static org.apache.calcite.avatica.proto.Requests.SchemasRequest parseFrom(byte[] data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.apache.calcite.avatica.proto.Requests.SchemasRequest parseFrom(
-        byte[] data,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data, extensionRegistry);
-    }
-    public static org.apache.calcite.avatica.proto.Requests.SchemasRequest parseFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseWithIOException(PARSER, input);
-    }
-    public static org.apache.calcite.avatica.proto.Requests.SchemasRequest parseFrom(
-        java.io.InputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseWithIOException(PARSER, input, extensionRegistry);
-    }
-    public static org.apache.calcite.avatica.proto.Requests.SchemasRequest parseDelimitedFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseDelimitedWithIOException(PARSER, input);
-    }
-    public static org.apache.calcite.avatica.proto.Requests.SchemasRequest parseDelimitedFrom(
-        java.io.InputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
-    }
-    public static org.apache.calcite.avatica.proto.Requests.SchemasRequest parseFrom(
-        com.google.protobuf.CodedInputStream input)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseWithIOException(PARSER, input);
-    }
-    public static org.apache.calcite.avatica.proto.Requests.SchemasRequest parseFrom(
-        com.google.protobuf.CodedInputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseWithIOException(PARSER, input, extensionRegistry);
-    }
-
-    public Builder newBuilderForType() { return newBuilder(); }
-    public static Builder newBuilder() {
-      return DEFAULT_INSTANCE.toBuilder();
-    }
-    public static Builder newBuilder(org.apache.calcite.avatica.proto.Requests.SchemasRequest prototype) {
-      return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
-    }
-    public Builder toBuilder() {
-      return this == DEFAULT_INSTANCE
-          ? new Builder() : new Builder().mergeFrom(this);
-    }
-
-    @java.lang.Override
-    protected Builder newBuilderForType(
-        com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
-      Builder builder = new Builder(parent);
-      return builder;
-    }
-    /**
-     * <pre>
-     * Request for Meta#getSchemas(String, org.apache.calcite.avatica.Meta.Pat)}
-     * </pre>
-     *
-     * Protobuf type {@code SchemasRequest}
-     */
-    public static final class Builder extends
-        com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
-        // @@protoc_insertion_point(builder_implements:SchemasRequest)
-        org.apache.calcite.avatica.proto.Requests.SchemasRequestOrBuilder {
-      public static final com.google.protobuf.Descriptors.Descriptor
-          getDescriptor() {
-        return org.apache.calcite.avatica.proto.Requests.internal_static_SchemasRequest_descriptor;
-      }
-
-      protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
-          internalGetFieldAccessorTable() {
-        return org.apache.calcite.avatica.proto.Requests.internal_static_SchemasRequest_fieldAccessorTable
-            .ensureFieldAccessorsInitialized(
-                org.apache.calcite.avatica.proto.Requests.SchemasRequest.class, org.apache.calcite.avatica.proto.Requests.SchemasRequest.Builder.class);
-      }
-
-      // Construct using org.apache.calcite.avatica.proto.Requests.SchemasRequest.newBuilder()
-      private Builder() {
-        maybeForceBuilderInitialization();
-      }
-
-      private Builder(
-          com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
-        super(parent);
-        maybeForceBuilderInitialization();
-      }
-      private void maybeForceBuilderInitialization() {
-        if (com.google.protobuf.GeneratedMessageV3
-                .alwaysUseFieldBuilders) {
-        }
-      }
-      public Builder clear() {
-        super.clear();
-        catalog_ = "";
-
-        schemaPattern_ = "";
-
-        connectionId_ = "";
-
-        return this;
-      }
-
-      public com.google.protobuf.Descriptors.Descriptor
-          getDescriptorForType() {
-        return org.apache.calcite.avatica.proto.Requests.internal_static_SchemasRequest_descriptor;
-      }
-
-      public org.apache.calcite.avatica.proto.Requests.SchemasRequest getDefaultInstanceForType() {
-        return org.apache.calcite.avatica.proto.Requests.SchemasRequest.getDefaultInstance();
-      }
-
-      public org.apache.calcite.avatica.proto.Requests.SchemasRequest build() {
-        org.apache.calcite.avatica.proto.Requests.SchemasRequest result = buildPartial();
-        if (!result.isInitialized()) {
-          throw newUninitializedMessageException(result);
-        }
-        return result;
-      }
-
-      public org.apache.calcite.avatica.proto.Requests.SchemasRequest buildPartial() {
-        org.apache.calcite.avatica.proto.Requests.SchemasRequest result = new org.apache.calcite.avatica.proto.Requests.SchemasRequest(this);
-        result.catalog_ = catalog_;
-        result.schemaPattern_ = schemaPattern_;
-        result.connectionId_ = connectionId_;
-        onBuilt();
-        return result;
-      }
-
-      public Builder clone() {
-        return (Builder) super.clone();
-      }
-      public Builder setField(
-          com.google.protobuf.Descriptors.FieldDescriptor field,
-          Object value) {
-        return (Builder) super.setField(field, value);
-      }
-      public Builder clearField(
-          com.google.protobuf.Descriptors.FieldDescriptor field) {
-        return (Builder) super.clearField(field);
-      }
-      public Builder clearOneof(
-          com.google.protobuf.Descriptors.OneofDescriptor oneof) {
-        return (Builder) super.clearOneof(oneof);
-      }
-      public Builder setRepeatedField(
-          com.google.protobuf.Descriptors.FieldDescriptor field,
-          int index, Object value) {
-        return (Builder) super.setRepeatedField(field, index, value);
-      }
-      public Builder addRepeatedField(
-          com.google.protobuf.Descriptors.FieldDescriptor field,
-          Object value) {
-        return (Builder) super.addRepeatedField(field, value);
-      }
-      public Builder mergeFrom(com.google.protobuf.Message other) {
-        if (other instanceof org.apache.calcite.avatica.proto.Requests.SchemasRequest) {
-          return mergeFrom((org.apache.calcite.avatica.proto.Requests.SchemasRequest)other);
-        } else {
-          super.mergeFrom(other);
-          return this;
-        }
-      }
-
-      public Builder mergeFrom(org.apache.calcite.avatica.proto.Requests.SchemasRequest other) {
-        if (other == org.apache.calcite.avatica.proto.Requests.SchemasRequest.getDefaultInstance()) return this;
-        if (!other.getCatalog().isEmpty()) {
-          catalog_ = other.catalog_;
-          onChanged();
-        }
-        if (!other.getSchemaPattern().isEmpty()) {
-          schemaPattern_ = other.schemaPattern_;
-          onChanged();
-        }
-        if (!other.getConnectionId().isEmpty()) {
-          connectionId_ = other.connectionId_;
-          onChanged();
-        }
-        onChanged();
-        return this;
-      }
-
-      public final boolean isInitialized() {
-        return true;
-      }
-
-      public Builder mergeFrom(
-          com.google.protobuf.CodedInputStream input,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws java.io.IOException {
-        org.apache.calcite.avatica.proto.Requests.SchemasRequest parsedMessage = null;
-        try {
-          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
-        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-          parsedMessage = (org.apache.calcite.avatica.proto.Requests.SchemasRequest) e.getUnfinishedMessage();
-          throw e.unwrapIOException();
-        } finally {
-          if (parsedMessage != null) {
-            mergeFrom(parsedMessage);
-          }
-        }
-        return this;
-      }
-
-      private java.lang.Object catalog_ = "";
-      /**
-       * <code>optional string catalog = 1;</code>
-       */
-      public java.lang.String getCatalog() {
-        java.lang.Object ref = catalog_;
-        if (!(ref instanceof java.lang.String)) {
-          com.google.protobuf.ByteString bs =
-              (com.google.protobuf.ByteString) ref;
-          java.lang.String s = bs.toStringUtf8();
-          catalog_ = s;
-          return s;
-        } else {
-          return (java.lang.String) ref;
-        }
-      }
-      /**
-       * <code>optional string catalog = 1;</code>
-       */
-      public com.google.protobuf.ByteString
-          getCatalogBytes() {
-        java.lang.Object ref = catalog_;
-        if (ref instanceof String) {
-          com.google.protobuf.ByteString b = 
-              com.google.protobuf.ByteString.copyFromUtf8(
-                  (java.lang.String) ref);
-          catalog_ = b;
-          return b;
-        } else {
-          return (com.google.protobuf.ByteString) ref;
-        }
-      }
-      /**
-       * <code>optional string catalog = 1;</code>
-       */
-      public Builder setCatalog(
-          java.lang.String value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  
-        catalog_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>optional string catalog = 1;</code>
-       */
-      public Builder clearCatalog() {
-        
-        catalog_ = getDefaultInstance().getCatalog();
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>optional string catalog = 1;</code>
-       */
-      public Builder setCatalogBytes(
-          com.google.protobuf.ByteString value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  checkByteStringIsUtf8(value);
-        
-        catalog_ = value;
-        onChanged();
-        return this;
-      }
-
-      private java.lang.Object schemaPattern_ = "";
-      /**
-       * <code>optional string schema_pattern = 2;</code>
-       */
-      public java.lang.String getSchemaPattern() {
-        java.lang.Object ref = schemaPattern_;
-        if (!(ref instanceof java.lang.String)) {
-          com.google.protobuf.ByteString bs =
-              (com.google.protobuf.ByteString) ref;
-          java.lang.String s = bs.toStringUtf8();
-          schemaPattern_ = s;
-          return s;
-        } else {
-          return (java.lang.String) ref;
-        }
-      }
-      /**
-       * <code>optional string schema_pattern = 2;</code>
-       */
-      public com.google.protobuf.ByteString
-          getSchemaPatternBytes() {
-        java.lang.Object ref = schemaPattern_;
-        if (ref instanceof String) {
-          com.google.protobuf.ByteString b = 
-              com.google.protobuf.ByteString.copyFromUtf8(
-                  (java.lang.String) ref);
-          schemaPattern_ = b;
-          return b;
-        } else {
-          return (com.google.protobuf.ByteString) ref;
-        }
-      }
-      /**
-       * <code>optional string schema_pattern = 2;</code>
-       */
-      public Builder setSchemaPattern(
-          java.lang.String value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  
-        schemaPattern_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>optional string schema_pattern = 2;</code>
-       */
-      public Builder clearSchemaPattern() {
-        
-        schemaPattern_ = getDefaultInstance().getSchemaPattern();
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>optional string schema_pattern = 2;</code>
-       */
-      public Builder setSchemaPatternBytes(
-          com.google.protobuf.ByteString value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  checkByteStringIsUtf8(value);
-        
-        schemaPattern_ = value;
-        onChanged();
-        return this;
-      }
-
-      private java.lang.Object connectionId_ = "";
-      /**
-       * <code>optional string connection_id = 3;</code>
-       */
-      public java.lang.String getConnectionId() {
-        java.lang.Object ref = connectionId_;
-        if (!(ref instanceof java.lang.String)) {
-          com.google.protobuf.ByteString bs =
-              (com.google.protobuf.ByteString) ref;
-          java.lang.String s = bs.toStringUtf8();
-          connectionId_ = s;
-          return s;
-        } else {
-          return (java.lang.String) ref;
-        }
-      }
-      /**
-       * <code>optional string connection_id = 3;</code>
-       */
-      public com.google.protobuf.ByteString
-          getConnectionIdBytes() {
-        java.lang.Object ref = connectionId_;
-        if (ref instanceof String) {
-          com.google.protobuf.ByteString b = 
-              com.google.protobuf.ByteString.copyFromUtf8(
-                  (java.lang.String) ref);
-          connectionId_ = b;
-          return b;
-        } else {
-          return (com.google.protobuf.ByteString) ref;
-        }
-      }
-      /**
-       * <code>optional string connection_id = 3;</code>
-       */
-      public Builder setConnectionId(
-          java.lang.String value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  
-        connectionId_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>optional string connection_id = 3;</code>
-       */
-      public Builder clearConnectionId() {
-        
-        connectionId_ = getDefaultInstance().getConnectionId();
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>optional string connection_id = 3;</code>
-       */
-      public Builder setConnectionIdBytes(
-          com.google.protobuf.ByteString value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  checkByteStringIsUtf8(value);
-        
-        connectionId_ = value;
-        onChanged();
-        return this;
-      }
-      public final Builder setUnknownFields(
-          final com.google.protobuf.UnknownFieldSet unknownFields) {
-        return this;
-      }
-
-      public final Builder mergeUnknownFields(
-          final com.google.protobuf.UnknownFieldSet unknownFields) {
-        return this;
-      }
-
-
-      // @@protoc_insertion_point(builder_scope:SchemasRequest)
-    }
-
-    // @@protoc_insertion_point(class_scope:SchemasRequest)
-    private static final org.apache.calcite.avatica.proto.Requests.SchemasRequest DEFAULT_INSTANCE;
-    static {
-      DEFAULT_INSTANCE = new org.apache.calcite.avatica.proto.Requests.SchemasRequest();
-    }
-
-    public static org.apache.calcite.avatica.proto.Requests.SchemasRequest getDefaultInstance() {
-      return DEFAULT_INSTANCE;
-    }
-
-    private static final com.google.protobuf.Parser<SchemasRequest>
-        PARSER = new com.google.protobuf.AbstractParser<SchemasRequest>() {
-      public SchemasRequest parsePartialFrom(
-          com.google.protobuf.CodedInputStream input,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws com.google.protobuf.InvalidProtocolBufferException {
-          return new SchemasRequest(input, extensionRegistry);
-      }
-    };
-
-    public static com.google.protobuf.Parser<SchemasRequest> parser() {
-      return PARSER;
-    }
-
-    @java.lang.Override
-    public com.google.protobuf.Parser<SchemasRequest> getParserForType() {
-      return PARSER;
-    }
-
-    public org.apache.calcite.avatica.proto.Requests.SchemasRequest getDefaultInstanceForType() {
-      return DEFAULT_INSTANCE;
-    }
-
-  }
-
-  public interface TablesRequestOrBuilder extends
-      // @@protoc_insertion_point(interface_extends:TablesRequest)
-      com.google.protobuf.MessageOrBuilder {
-
-    /**
-     * <code>optional string catalog = 1;</code>
-     */
-    java.lang.String getCatalog();
-    /**
-     * <code>optional string catalog = 1;</code>
-     */
-    com.google.protobuf.ByteString
-        getCatalogBytes();
-
-    /**
-     * <code>optional string schema_pattern = 2;</code>
-     */
-    java.lang.String getSchemaPattern();
-    /**
-     * <code>optional string schema_pattern = 2;</code>
-     */
-    com.google.protobuf.ByteString
-        getSchemaPatternBytes();
-
-    /**
-     * <code>optional string table_name_pattern = 3;</code>
-     */
-    java.lang.String getTableNamePattern();
-    /**
-     * <code>optional string table_name_pattern = 3;</code>
-     */
-    com.google.protobuf.ByteString
-        getTableNamePatternBytes();
-
-    /**
-     * <code>repeated string type_list = 4;</code>
-     */
-    java.util.List<java.lang.String>
-        getTypeListList();
-    /**
-     * <code>repeated string type_list = 4;</code>
-     */
-    int getTypeListCount();
-    /**
-     * <code>repeated string type_list = 4;</code>
-     */
-    java.lang.String getTypeList(int index);
-    /**
-     * <code>repeated string type_list = 4;</code>
-     */
-    com.google.protobuf.ByteString
-        getTypeListBytes(int index);
-
-    /**
-     * <pre>
-     * Having an empty type_list is distinct from a null type_list
-     * </pre>
-     *
-     * <code>optional bool has_type_list = 6;</code>
-     */
-    boolean getHasTypeList();
-
-    /**
-     * <code>optional string connection_id = 7;</code>
-     */
-    java.lang.String getConnectionId();
-    /**
-     * <code>optional string connection_id = 7;</code>
-     */
-    com.google.protobuf.ByteString
-        getConnectionIdBytes();
-  }
-  /**
-   * <pre>
-   * Request for Request for Meta#getTables(String, org.apache.calcite.avatica.Meta.Pat,
-   *   org.apache.calcite.avatica.Meta.Pat, java.util.List)
-   * </pre>
-   *
-   * Protobuf type {@code TablesRequest}
-   */
-  public  static final class TablesRequest extends
-      com.google.protobuf.GeneratedMessageV3 implements
-      // @@protoc_insertion_point(message_implements:TablesRequest)
-      TablesRequestOrBuilder {
-    // Use TablesRequest.newBuilder() to construct.
-    private TablesRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
-      super(builder);
-    }
-    private TablesRequest() {
-      catalog_ = "";
-      schemaPattern_ = "";
-      tableNamePattern_ = "";
-      typeList_ = com.google.protobuf.LazyStringArrayList.EMPTY;
-      hasTypeList_ = false;
-      connectionId_ = "";
-    }
-
-    @java.lang.Override
-    public final com.google.protobuf.UnknownFieldSet
-    getUnknownFields() {
-      return com.google.protobuf.UnknownFieldSet.getDefaultInstance();
-    }
-    private TablesRequest(
-        com.google.protobuf.CodedInputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      this();
-      int mutable_bitField0_ = 0;
-      try {
-        boolean done = false;
-        while (!done) {
-          int tag = input.readTag();
-          switch (tag) {
-            case 0:
-              done = true;
-              break;
-            default: {
-              if (!input.skipField(tag)) {
-                done = true;
-              }
-              break;
-            }
-            case 10: {
-              java.lang.String s = input.readStringRequireUtf8();
-
-              catalog_ = s;
-              break;
-            }
-            case 18: {
-              java.lang.String s = input.readStringRequireUtf8();
-
-              schemaPattern_ = s;
-              break;
-            }
-            case 26: {
-              java.lang.String s = input.readStringRequireUtf8();
-
-              tableNamePattern_ = s;
-              break;
-            }
-            case 34: {
-              java.lang.String s = input.readStringRequireUtf8();
-              if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
-                typeList_ = new com.google.protobuf.LazyStringArrayList();
-                mutable_bitField0_ |= 0x00000008;
-              }
-              typeList_.add(s);
-              break;
-            }
-            case 48: {
-
-              hasTypeList_ = input.readBool();
-              break;
-            }
-            case 58: {
-              java.lang.String s = input.readStringRequireUtf8();
-
-              connectionId_ = s;
-              break;
-            }
-          }
-        }
-      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-        throw e.setUnfinishedMessage(this);
-      } catch (java.io.IOException e) {
-        throw new com.google.protobuf.InvalidProtocolBufferException(
-            e).setUnfinishedMessage(this);
-      } finally {
-        if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
-          typeList_ = typeList_.getUnmodifiableView();
-        }
-        makeExtensionsImmutable();
-      }
-    }
-    public static final com.google.protobuf.Descriptors.Descriptor
-        getDescriptor() {
-      return org.apache.calcite.avatica.proto.Requests.internal_static_TablesRequest_descriptor;
-    }
-
-    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
-        internalGetFieldAccessorTable() {
-      return org.apache.calcite.avatica.proto.Requests.internal_static_TablesRequest_fieldAccessorTable
-          .ensureFieldAccessorsInitialized(
-              org.apache.calcite.avatica.proto.Requests.TablesRequest.class, org.apache.calcite.avatica.proto.Requests.TablesRequest.Builder.class);
-    }
-
-    private int bitField0_;
-    public static final int CATALOG_FIELD_NUMBER = 1;
-    private volatile java.lang.Object catalog_;
-    /**
-     * <code>optional string catalog = 1;</code>
-     */
-    public java.lang.String getCatalog() {
-      java.lang.Object ref = catalog_;
-      if (ref instanceof java.lang.String) {
-        return (java.lang.String) ref;
-      } else {
-        com.google.protobuf.ByteString bs = 
-            (com.google.protobuf.ByteString) ref;
-        java.lang.String s = bs.toStringUtf8();
-        catalog_ = s;
-        return s;
-      }
-    }
-    /**
-     * <code>optional string catalog = 1;</code>
-     */
-    public com.google.protobuf.ByteString
-        getCatalogBytes() {
-      java.lang.Object ref = catalog_;
-      if (ref instanceof java.lang.String) {
-        com.google.protobuf.ByteString b = 
-            com.google.protobuf.ByteString.copyFromUtf8(
-                (java.lang.String) ref);
-        catalog_ = b;
-        return b;
-      } else {
-        return (com.google.protobuf.ByteString) ref;
-      }
-    }
-
-    public static final int SCHEMA_PATTERN_FIELD_NUMBER = 2;
-    private volatile java.lang.Object schemaPattern_;
-    /**
-     * <code>optional string schema_pattern = 2;</code>
-     */
-    public java.lang.String getSchemaPattern() {
-      java.lang.Object ref = schemaPattern_;
-      if (ref instanceof java.lang.String) {
-        return (java.lang.String) ref;
-      } else {
-        com.google.protobuf.ByteString bs = 
-            (com.google.protobuf.ByteString) ref;
-        java.lang.String s = bs.toStringUtf8();
-        schemaPattern_ = s;
-        return s;
-      }
-    }
-    /**
-     * <code>optional string schema_pattern = 2;</code>
-     */
-    public com.google.protobuf.ByteString
-        getSchemaPatternBytes() {
-      java.lang.Object ref = schemaPattern_;
-      if (ref instanceof java.lang.String) {
-        com.google.protobuf.ByteString b = 
-            com.google.protobuf.ByteString.copyFromUtf8(
-                (java.lang.String) ref);
-        schemaPattern_ = b;
-        return b;
-      } else {
-        return (com.google.protobuf.ByteString) ref;
-      }
-    }
-
-    public static final int TABLE_NAME_PATTERN_FIELD_NUMBER = 3;
-    private volatile java.lang.Object tableNamePattern_;
-    /**
-     * <code>optional string table_name_pattern = 3;</code>
-     */
-    public java.lang.String getTableNamePattern() {
-      java.lang.Object ref = tableNamePattern_;
-      if (ref instanceof java.lang.String) {
-        return (java.lang.String) ref;
-      } else {
-        com.google.protobuf.ByteString bs = 
-            (com.google.protobuf.ByteString) ref;
-        java.lang.String s = bs.toStringUtf8();
-        tableNamePattern_ = s;
-        return s;
-      }
-    }
-    /**
-     * <code>optional string table_name_pattern = 3;</code>
-     */
-    public com.google.protobuf.ByteString
-        getTableNamePatternBytes() {
-      java.lang.Object ref = tableNamePattern_;
-      if (ref instanceof java.lang.String) {
-        com.google.protobuf.ByteString b = 
-            com.google.protobuf.ByteString.copyFromUtf8(
-                (java.lang.String) ref);
-        tableNamePattern_ = b;
-        return b;
-      } else {
-        return (com.google.protobuf.ByteString) ref;
-      }
-    }
-
-    public static final int TYPE_LIST_FIELD_NUMBER = 4;
-    private com.google.protobuf.LazyStringList typeList_;
-    /**
-     * <code>repeated string type_list = 4;</code>
-     */
-    public com.google.protobuf.ProtocolStringList
-        getTypeListList() {
-      return typeList_;
-    }
-    /**
-     * <code>repeated string type_list = 4;</code>
-     */
-    public int getTypeListCount() {
-      return typeList_.size();
-    }
-    /**
-     * <code>repeated string type_list = 4;</code>
-     */
-    public java.lang.String getTypeList(int index) {
-      return typeList_.get(index);
-    }
-    /**
-     * <code>repeated string type_list = 4;</code>
-     */
-    public com.google.protobuf.ByteString
-        getTypeListBytes(int index) {
-      return typeList_.getByteString(index);
-    }
-
-    public static final int HAS_TYPE_LIST_FIELD_NUMBER = 6;
-    private boolean hasTypeList_;
-    /**
-     * <pre>
-     * Having an empty type_list is distinct from a null type_list
-     * </pre>
-     *
-     * <code>optional bool has_type_list = 6;</code>
-     */
-    public boolean getHasTypeList() {
-      return hasTypeList_;
-    }
-
-    public static final int CONNECTION_ID_FIELD_NUMBER = 7;
-    private volatile java.lang.Object connectionId_;
-    /**
-     * <code>optional string connection_id = 7;</code>
-     */
-    public java.lang.String getConnectionId() {
-      java.lang.Object ref = connectionId_;
-      if (ref instanceof java.lang.String) {
-        return (java.lang.String) ref;
-      } else {
-        com.google.protobuf.ByteString bs = 
-            (com.google.protobuf.ByteString) ref;
-        java.lang.String s = bs.toStringUtf8();
-        connectionId_ = s;
-        return s;
-      }
-    }
-    /**
-     * <code>optional string connection_id = 7;</code>
-     */
-    public com.google.protobuf.ByteString
-        getConnectionIdBytes() {
-      java.lang.Object ref = connectionId_;
-      if (ref instanceof java.lang.String) {
-        com.google.protobuf.ByteString b = 
-            com.google.protobuf.ByteString.copyFromUtf8(
-                (java.lang.String) ref);
-        connectionId_ = b;
-        return b;
-      } else {
-        return (com.google.protobuf.ByteString) ref;
-      }
-    }
-
-    private byte memoizedIsInitialized = -1;
-    public final boolean isInitialized() {
-      byte isInitialized = memoizedIsInitialized;
-      if (isInitialized == 1) return true;
-      if (isInitialized == 0) return false;
-
-      memoizedIsInitialized = 1;
-      return true;
-    }
-
-    public void writeTo(com.google.protobuf.CodedOutputStream output)
-                        throws java.io.IOException {
-      if (!getCatalogBytes().isEmpty()) {
-        com.google.protobuf.GeneratedMessageV3.writeString(output, 1, catalog_);
-      }
-      if (!getSchemaPatternBytes().isEmpty()) {
-        com.google.protobuf.GeneratedMessageV3.writeString(output, 2, schemaPattern_);
-      }
-      if (!getTableNamePatternBytes().isEmpty()) {
-        com.google.protobuf.GeneratedMessageV3.writeString(output, 3, tableNamePattern_);
-      }
-      for (int i = 0; i < typeList_.size(); i++) {
-        com.google.protobuf.GeneratedMessageV3.writeString(output, 4, typeList_.getRaw(i));
-      }
-      if (hasTypeList_ != false) {
-        output.writeBool(6, hasTypeList_);
-      }
-      if (!getConnectionIdBytes().isEmpty()) {
-        com.google.protobuf.GeneratedMessageV3.writeString(output, 7, connectionId_);
-      }
-    }
-
-    public int getSerializedSize() {
-      int size = memoizedSize;
-      if (size != -1) return size;
-
-      size = 0;
-      if (!getCatalogBytes().isEmpty()) {
-        size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, catalog_);
-      }
-      if (!getSchemaPatternBytes().isEmpty()) {
-        size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, schemaPattern_);
-      }
-      if (!getTableNamePatternBytes().isEmpty()) {
-        size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, tableNamePattern_);
-      }
-      {
-        int dataSize = 0;
-        for (int i = 0; i < typeList_.size(); i++) {
-          dataSize += computeStringSizeNoTag(typeList_.getRaw(i));
-        }
-        size += dataSize;
-        size += 1 * getTypeListList().size();
-      }
-      if (hasTypeList_ != false) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeBoolSize(6, hasTypeList_);
-      }
-      if (!getConnectionIdBytes().isEmpty()) {
-        size += com.google.protobuf.GeneratedMessageV3.computeStringSize(7, connectionId_);
-      }
-      memoizedSize = size;
-      return size;
-    }
-
-    private static final long serialVersionUID = 0L;
-    @java.lang.Override
-    public boolean equals(final java.lang.Object obj) {
-      if (obj == this) {
-       return true;
-      }
-      if (!(obj instanceof org.apache.calcite.avatica.proto.Requests.TablesRequest)) {
-        return super.equals(obj);
-      }
-      org.apache.calcite.avatica.proto.Requests.TablesRequest other = (org.apache.calcite.avatica.proto.Requests.TablesRequest) obj;
-
-      boolean result = true;
-      result = result && getCatalog()
-          .equals(other.getCatalog());
-      result = result && getSchemaPattern()
-          .equals(other.getSchemaPattern());
-      result = result && getTableNamePattern()
-          .equals(other.getTableNamePattern());
-      result = result && getTypeListList()
-          .equals(other.getTypeListList());
-      result = result && (getHasTypeList()
-          == other.getHasTypeList());
-      result = result && getConnectionId()
-          .equals(other.getConnectionId());
-      return result;
-    }
-
-    @java.lang.Override
-    public int hashCode() {
-      if (memoizedHashCode != 0) {
-        return memoizedHashCode;
-      }
-      int hash = 41;
-      hash = (19 * hash) + getDescriptorForType().hashCode();
-      hash = (37 * hash) + CATALOG_FIELD_NUMBER;
-      hash = (53 * hash) + getCatalog().hashCode();
-      hash = (37 * hash) + SCHEMA_PATTERN_FIELD_NUMBER;
-      hash = (53 * hash) + getSchemaPattern().hashCode();
-      hash = (37 * hash) + TABLE_NAME_PATTERN_FIELD_NUMBER;
-      hash = (53 * hash) + getTableNamePattern().hashCode();
-      if (getTypeListCount() > 0) {
-        hash = (37 * hash) + TYPE_LIST_FIELD_NUMBER;
-        hash = (53 * hash) + getTypeListList().hashCode();
-      }
-      hash = (37 * hash) + HAS_TYPE_LIST_FIELD_NUMBER;
-      hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(
-          getHasTypeList());
-      hash = (37 * hash) + CONNECTION_ID_FIELD_NUMBER;
-      hash = (53 * hash) + getConnectionId().hashCode();
-      hash = (29 * hash) + unknownFields.hashCode();
-      memoizedHashCode = hash;
-      return hash;
-    }
-
-    public static org.apache.calcite.avatica.proto.Requests.TablesRequest parseFrom(
-        com.google.protobuf.ByteString data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.apache.calcite.avatica.proto.Requests.TablesRequest parseFrom(
-        com.google.protobuf.ByteString data,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data, extensionRegistry);
-    }
-    public static org.apache.calcite.avatica.proto.Requests.TablesRequest parseFrom(byte[] data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.apache.calcite.avatica.proto.Requests.TablesRequest parseFrom(
-        byte[] data,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data, extensionRegistry);
-    }
-    public static org.apache.calcite.avatica.proto.Requests.TablesRequest parseFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseWithIOException(PARSER, input);
-    }
-    public static org.apache.calcite.avatica.proto.Requests.TablesRequest parseFrom(
-        java.io.InputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseWithIOException(PARSER, input, extensionRegistry);
-    }
-    public static org.apache.calcite.avatica.proto.Requests.TablesRequest parseDelimitedFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseDelimitedWithIOException(PARSER, input);
-    }
-    public static org.apache.calcite.avatica.proto.Requests.TablesRequest parseDelimitedFrom(
-        java.io.InputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
-    }
-    public static org.apache.calcite.avatica.proto.Requests.TablesRequest parseFrom(
-        com.google.protobuf.CodedInputStream input)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseWithIOException(PARSER, input);
-    }
-    public static org.apache.calcite.avatica.proto.Requests.TablesRequest parseFrom(
-        com.google.protobuf.CodedInputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseWithIOException(PARSER, input, extensionRegistry);
-    }
-
-    public Builder newBuilderForType() { return newBuilder(); }
-    public static Builder newBuilder() {
-      return DEFAULT_INSTANCE.toBuilder();
-    }
-    public static Builder newBuilder(org.apache.calcite.avatica.proto.Requests.TablesRequest prototype) {
-      return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
-    }
-    public Builder toBuilder() {
-      return this == DEFAULT_INSTANCE
-          ? new Builder() : new Builder().mergeFrom(this);
-    }
-
-    @java.lang.Override
-    protected Builder newBuilderForType(
-        com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
-      Builder builder = new Builder(parent);
-      return builder;
-    }
-    /**
-     * <pre>
-     * Request for Request for Meta#getTables(String, org.apache.calcite.avatica.Meta.Pat,
-     *   org.apache.calcite.avatica.Meta.Pat, java.util.List)
-     * </pre>
-     *
-     * Protobuf type {@code TablesRequest}
-     */
-    public static final class Builder extends
-        com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
-        // @@protoc_insertion_point(builder_implements:TablesRequest)
-        org.apache.calcite.avatica.proto.Requests.TablesRequestOrBuilder {
-      public static final com.google.protobuf.Descriptors.Descriptor
-          getDescriptor() {
-        return org.apache.calcite.avatica.proto.Requests.internal_static_TablesRequest_descriptor;
-      }
-
-      protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
-          internalGetFieldAccessorTable() {
-        return org.apache.calcite.avatica.proto.Requests.internal_static_TablesRequest_fieldAccessorTable
-            .ensureFieldAccessorsInitialized(
-                org.apache.calcite.avatica.proto.Requests.TablesRequest.class, org.apache.calcite.avatica.proto.Requests.TablesRequest.Builder.class);
-      }
-
-      // Construct using org.apache.calcite.avatica.proto.Requests.TablesRequest.newBuilder()
-      private Builder() {
-        maybeForceBuilderInitialization();
-      }
-
-      private Builder(
-          com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
-        super(parent);
-        maybeForceBuilderInitialization();
-      }
-      private void maybeForceBuilderInitialization() {
-        if (com.google.protobuf.GeneratedMessageV3
-                .alwaysUseFieldBuilders) {
-        }
-      }
-      public Builder clear() {
-        super.clear();
-        catalog_ = "";
-
-        schemaPattern_ = "";
-
-        tableNamePattern_ = "";
-
-        typeList_ = com.google.protobuf.LazyStringArrayList.EMPTY;
-        bitField0_ = (bitField0_ & ~0x00000008);
-        hasTypeList_ = false;
-
-        connectionId_ = "";
-
-        return this;
-      }
-
-      public com.google.protobuf.Descriptors.Descriptor
-          getDescriptorForType() {
-        return org.apache.calcite.avatica.proto.Requests.internal_static_TablesRequest_descriptor;
-      }
-
-      public org.apache.calcite.avatica.proto.Requests.TablesRequest getDefaultInstanceForType() {
-        return org.apache.calcite.avatica.proto.Requests.TablesRequest.getDefaultInstance();
-      }
-
-      public org.apache.calcite.avatica.proto.Requests.TablesRequest build() {
-        org.apache.calcite.avatica.proto.Requests.TablesRequest result = buildPartial();
-        if (!result.isInitialized()) {
-          throw newUninitializedMessageException(re

<TRUNCATED>

[27/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/noop-driver/src/main/java/org/apache/calcite/avatica/noop/AvaticaNoopDatabaseMetaData.java
----------------------------------------------------------------------
diff --git a/avatica/noop-driver/src/main/java/org/apache/calcite/avatica/noop/AvaticaNoopDatabaseMetaData.java b/avatica/noop-driver/src/main/java/org/apache/calcite/avatica/noop/AvaticaNoopDatabaseMetaData.java
deleted file mode 100644
index 2b58590..0000000
--- a/avatica/noop-driver/src/main/java/org/apache/calcite/avatica/noop/AvaticaNoopDatabaseMetaData.java
+++ /dev/null
@@ -1,770 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.noop;
-
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.ResultSet;
-import java.sql.RowIdLifetime;
-import java.sql.SQLException;
-
-/**
- * A {@link DatabaseMetaData} implementation which does nothing.
- */
-public class AvaticaNoopDatabaseMetaData implements DatabaseMetaData {
-
-  private static final AvaticaNoopDatabaseMetaData INSTANCE = new AvaticaNoopDatabaseMetaData();
-
-  public static AvaticaNoopDatabaseMetaData getInstance() {
-    return INSTANCE;
-  }
-
-  private AvaticaNoopDatabaseMetaData() {}
-
-  private UnsupportedOperationException unsupported() {
-    return new UnsupportedOperationException("Unsupported");
-  }
-
-  @Override public <T> T unwrap(Class<T> iface) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public boolean isWrapperFor(Class<?> iface) throws SQLException {
-    return false;
-  }
-
-  @Override public boolean allProceduresAreCallable() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean allTablesAreSelectable() throws SQLException {
-    return false;
-  }
-
-  @Override public String getURL() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public String getUserName() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public boolean isReadOnly() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean nullsAreSortedHigh() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean nullsAreSortedLow() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean nullsAreSortedAtStart() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean nullsAreSortedAtEnd() throws SQLException {
-    return false;
-  }
-
-  @Override public String getDatabaseProductName() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public String getDatabaseProductVersion() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public String getDriverName() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public String getDriverVersion() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public int getDriverMajorVersion() {
-    return 0;
-  }
-
-  @Override public int getDriverMinorVersion() {
-    return 0;
-  }
-
-  @Override public boolean usesLocalFiles() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean usesLocalFilePerTable() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsMixedCaseIdentifiers() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean storesUpperCaseIdentifiers() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean storesLowerCaseIdentifiers() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean storesMixedCaseIdentifiers() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean storesUpperCaseQuotedIdentifiers() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean storesLowerCaseQuotedIdentifiers() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean storesMixedCaseQuotedIdentifiers() throws SQLException {
-    return false;
-  }
-
-  @Override public String getIdentifierQuoteString() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public String getSQLKeywords() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public String getNumericFunctions() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public String getStringFunctions() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public String getSystemFunctions() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public String getTimeDateFunctions() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public String getSearchStringEscape() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public String getExtraNameCharacters() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public boolean supportsAlterTableWithAddColumn() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsAlterTableWithDropColumn() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsColumnAliasing() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean nullPlusNonNullIsNull() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsConvert() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsConvert(int fromType, int toType) throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsTableCorrelationNames() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsDifferentTableCorrelationNames() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsExpressionsInOrderBy() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsOrderByUnrelated() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsGroupBy() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsGroupByUnrelated() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsGroupByBeyondSelect() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsLikeEscapeClause() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsMultipleResultSets() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsMultipleTransactions() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsNonNullableColumns() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsMinimumSQLGrammar() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsCoreSQLGrammar() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsExtendedSQLGrammar() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsANSI92EntryLevelSQL() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsANSI92IntermediateSQL() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsANSI92FullSQL() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsIntegrityEnhancementFacility() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsOuterJoins() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsFullOuterJoins() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsLimitedOuterJoins() throws SQLException {
-    return false;
-  }
-
-  @Override public String getSchemaTerm() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public String getProcedureTerm() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public String getCatalogTerm() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public boolean isCatalogAtStart() throws SQLException {
-    return false;
-  }
-
-  @Override public String getCatalogSeparator() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public boolean supportsSchemasInDataManipulation() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsSchemasInProcedureCalls() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsSchemasInTableDefinitions() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsSchemasInIndexDefinitions() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsCatalogsInDataManipulation() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsCatalogsInProcedureCalls() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsCatalogsInTableDefinitions() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsCatalogsInIndexDefinitions() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsPositionedDelete() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsPositionedUpdate() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsSelectForUpdate() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsStoredProcedures() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsSubqueriesInComparisons() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsSubqueriesInExists() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsSubqueriesInIns() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsSubqueriesInQuantifieds() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsCorrelatedSubqueries() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsUnion() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsUnionAll() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsOpenCursorsAcrossCommit() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsOpenCursorsAcrossRollback() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsOpenStatementsAcrossCommit() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsOpenStatementsAcrossRollback() throws SQLException {
-    return false;
-  }
-
-  @Override public int getMaxBinaryLiteralLength() throws SQLException {
-    return 0;
-  }
-
-  @Override public int getMaxCharLiteralLength() throws SQLException {
-    return 0;
-  }
-
-  @Override public int getMaxColumnNameLength() throws SQLException {
-    return 0;
-  }
-
-  @Override public int getMaxColumnsInGroupBy() throws SQLException {
-    return 0;
-  }
-
-  @Override public int getMaxColumnsInIndex() throws SQLException {
-    return 0;
-  }
-
-  @Override public int getMaxColumnsInOrderBy() throws SQLException {
-    return 0;
-  }
-
-  @Override public int getMaxColumnsInSelect() throws SQLException {
-    return 0;
-  }
-
-  @Override public int getMaxColumnsInTable() throws SQLException {
-    return 0;
-  }
-
-  @Override public int getMaxConnections() throws SQLException {
-    return 0;
-  }
-
-  @Override public int getMaxCursorNameLength() throws SQLException {
-    return 0;
-  }
-
-  @Override public int getMaxIndexLength() throws SQLException {
-    return 0;
-  }
-
-  @Override public int getMaxSchemaNameLength() throws SQLException {
-    return 0;
-  }
-
-  @Override public int getMaxProcedureNameLength() throws SQLException {
-    return 0;
-  }
-
-  @Override public int getMaxCatalogNameLength() throws SQLException {
-    return 0;
-  }
-
-  @Override public int getMaxRowSize() throws SQLException {
-    return 0;
-  }
-
-  @Override public boolean doesMaxRowSizeIncludeBlobs() throws SQLException {
-    return false;
-  }
-
-  @Override public int getMaxStatementLength() throws SQLException {
-    return 0;
-  }
-
-  @Override public int getMaxStatements() throws SQLException {
-    return 0;
-  }
-
-  @Override public int getMaxTableNameLength() throws SQLException {
-    return 0;
-  }
-
-  @Override public int getMaxTablesInSelect() throws SQLException {
-    return 0;
-  }
-
-  @Override public int getMaxUserNameLength() throws SQLException {
-    return 0;
-  }
-
-  @Override public int getDefaultTransactionIsolation() throws SQLException {
-    return 0;
-  }
-
-  @Override public boolean supportsTransactions() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsTransactionIsolationLevel(int level) throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsDataDefinitionAndDataManipulationTransactions()
-      throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsDataManipulationTransactionsOnly() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean dataDefinitionCausesTransactionCommit() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean dataDefinitionIgnoredInTransactions() throws SQLException {
-    return false;
-  }
-
-  @Override public ResultSet getProcedures(String catalog, String schemaPattern,
-      String procedureNamePattern) throws SQLException {
-    return AvaticaNoopResultSet.getInstance();
-  }
-
-  @Override public ResultSet getProcedureColumns(String catalog, String schemaPattern,
-      String procedureNamePattern, String columnNamePattern) throws SQLException {
-    return AvaticaNoopResultSet.getInstance();
-  }
-
-  @Override public ResultSet getTables(String catalog, String schemaPattern,
-      String tableNamePattern, String[] types) throws SQLException {
-    return AvaticaNoopResultSet.getInstance();
-  }
-
-  @Override public ResultSet getSchemas() throws SQLException {
-    return AvaticaNoopResultSet.getInstance();
-  }
-
-  @Override public ResultSet getCatalogs() throws SQLException {
-    return AvaticaNoopResultSet.getInstance();
-  }
-
-  @Override public ResultSet getTableTypes() throws SQLException {
-    return AvaticaNoopResultSet.getInstance();
-  }
-
-  @Override public ResultSet getColumns(String catalog, String schemaPattern,
-      String tableNamePattern, String columnNamePattern) throws SQLException {
-    return AvaticaNoopResultSet.getInstance();
-  }
-
-  @Override public ResultSet getColumnPrivileges(String catalog, String schema, String table,
-      String columnNamePattern) throws SQLException {
-    return AvaticaNoopResultSet.getInstance();
-  }
-
-  @Override public ResultSet getTablePrivileges(String catalog, String schemaPattern,
-      String tableNamePattern) throws SQLException {
-    return AvaticaNoopResultSet.getInstance();
-  }
-
-  @Override public ResultSet getBestRowIdentifier(String catalog, String schema, String table,
-      int scope, boolean nullable) throws SQLException {
-    return AvaticaNoopResultSet.getInstance();
-  }
-
-  @Override public ResultSet getVersionColumns(String catalog, String schema, String table)
-      throws SQLException {
-    return AvaticaNoopResultSet.getInstance();
-  }
-
-  @Override public ResultSet getPrimaryKeys(String catalog, String schema, String table)
-      throws SQLException {
-    return AvaticaNoopResultSet.getInstance();
-  }
-
-  @Override public ResultSet getImportedKeys(String catalog, String schema, String table)
-      throws SQLException {
-    return AvaticaNoopResultSet.getInstance();
-  }
-
-  @Override public ResultSet getExportedKeys(String catalog, String schema, String table)
-      throws SQLException {
-    return AvaticaNoopResultSet.getInstance();
-  }
-
-  @Override public ResultSet getCrossReference(String parentCatalog, String parentSchema,
-      String parentTable, String foreignCatalog, String foreignSchema,
-      String foreignTable) throws SQLException {
-    return AvaticaNoopResultSet.getInstance();
-  }
-
-  @Override public ResultSet getTypeInfo() throws SQLException {
-    return AvaticaNoopResultSet.getInstance();
-  }
-
-  @Override public ResultSet getIndexInfo(String catalog, String schema, String table,
-      boolean unique, boolean approximate) throws SQLException {
-    return AvaticaNoopResultSet.getInstance();
-  }
-
-  @Override public boolean supportsResultSetType(int type) throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsResultSetConcurrency(int type, int concurrency)
-      throws SQLException {
-    return false;
-  }
-
-  @Override public boolean ownUpdatesAreVisible(int type) throws SQLException {
-    return false;
-  }
-
-  @Override public boolean ownDeletesAreVisible(int type) throws SQLException {
-    return false;
-  }
-
-  @Override public boolean ownInsertsAreVisible(int type) throws SQLException {
-    return false;
-  }
-
-  @Override public boolean othersUpdatesAreVisible(int type) throws SQLException {
-    return false;
-  }
-
-  @Override public boolean othersDeletesAreVisible(int type) throws SQLException {
-    return false;
-  }
-
-  @Override public boolean othersInsertsAreVisible(int type) throws SQLException {
-    return false;
-  }
-
-  @Override public boolean updatesAreDetected(int type) throws SQLException {
-    return false;
-  }
-
-  @Override public boolean deletesAreDetected(int type) throws SQLException {
-    return false;
-  }
-
-  @Override public boolean insertsAreDetected(int type) throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsBatchUpdates() throws SQLException {
-    return false;
-  }
-
-  @Override public ResultSet getUDTs(String catalog, String schemaPattern, String typeNamePattern,
-      int[] types) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public Connection getConnection() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public boolean supportsSavepoints() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsNamedParameters() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsMultipleOpenResults() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsGetGeneratedKeys() throws SQLException {
-    return false;
-  }
-
-  @Override public ResultSet getSuperTypes(String catalog, String schemaPattern,
-      String typeNamePattern) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public ResultSet getSuperTables(String catalog, String schemaPattern,
-      String tableNamePattern) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public ResultSet getAttributes(String catalog, String schemaPattern,
-      String typeNamePattern, String attributeNamePattern) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public boolean supportsResultSetHoldability(int holdability) throws SQLException {
-    return false;
-  }
-
-  @Override public int getResultSetHoldability() throws SQLException {
-    return 0;
-  }
-
-  @Override public int getDatabaseMajorVersion() throws SQLException {
-    return 0;
-  }
-
-  @Override public int getDatabaseMinorVersion() throws SQLException {
-    return 0;
-  }
-
-  @Override public int getJDBCMajorVersion() throws SQLException {
-    return 0;
-  }
-
-  @Override public int getJDBCMinorVersion() throws SQLException {
-    return 0;
-  }
-
-  @Override public int getSQLStateType() throws SQLException {
-    return 0;
-  }
-
-  @Override public boolean locatorsUpdateCopy() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean supportsStatementPooling() throws SQLException {
-    return false;
-  }
-
-  @Override public RowIdLifetime getRowIdLifetime() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public ResultSet getSchemas(String catalog, String schemaPattern) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException {
-    return false;
-  }
-
-  @Override public boolean autoCommitFailureClosesAllResultSets() throws SQLException {
-    return false;
-  }
-
-  @Override public ResultSet getClientInfoProperties() throws SQLException {
-    return AvaticaNoopResultSet.getInstance();
-  }
-
-  @Override public ResultSet getFunctions(String catalog, String schemaPattern,
-      String functionNamePattern) throws SQLException {
-    return AvaticaNoopResultSet.getInstance();
-  }
-
-  @Override public ResultSet getFunctionColumns(String catalog, String schemaPattern,
-      String functionNamePattern, String columnNamePattern) throws SQLException {
-    return AvaticaNoopResultSet.getInstance();
-  }
-
-  @Override public ResultSet getPseudoColumns(String catalog, String schemaPattern,
-      String tableNamePattern, String columnNamePattern) throws SQLException {
-    return AvaticaNoopResultSet.getInstance();
-  }
-
-  @Override public boolean generatedKeyAlwaysReturned() throws SQLException {
-    return false;
-  }
-}
-
-// End AvaticaNoopDatabaseMetaData.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/noop-driver/src/main/java/org/apache/calcite/avatica/noop/AvaticaNoopDriver.java
----------------------------------------------------------------------
diff --git a/avatica/noop-driver/src/main/java/org/apache/calcite/avatica/noop/AvaticaNoopDriver.java b/avatica/noop-driver/src/main/java/org/apache/calcite/avatica/noop/AvaticaNoopDriver.java
deleted file mode 100644
index 76f5356..0000000
--- a/avatica/noop-driver/src/main/java/org/apache/calcite/avatica/noop/AvaticaNoopDriver.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.noop;
-
-import java.sql.Connection;
-import java.sql.Driver;
-import java.sql.DriverManager;
-import java.sql.DriverPropertyInfo;
-import java.sql.SQLException;
-import java.sql.SQLFeatureNotSupportedException;
-import java.util.Properties;
-import java.util.logging.Logger;
-
-/**
- * A Noop JDBC Driver.
- */
-public class AvaticaNoopDriver implements Driver {
-
-  private static final AvaticaNoopDriver INSTANCE = new AvaticaNoopDriver();
-
-  static {
-    try {
-      DriverManager.registerDriver(INSTANCE);
-    } catch (Exception e) {
-      System.err.println("Failed to register driver");
-      e.printStackTrace(System.err);
-    }
-  }
-
-  @Override public Connection connect(String url, Properties info) throws SQLException {
-    return AvaticaNoopConnection.getInstance();
-  }
-
-  @Override public boolean acceptsURL(String url) throws SQLException {
-    return url.startsWith("jdbc:avatica:noop");
-  }
-
-  @Override public DriverPropertyInfo[] getPropertyInfo(String url, Properties info)
-      throws SQLException {
-    return new DriverPropertyInfo[0];
-  }
-
-  @Override public int getMajorVersion() {
-    return 1;
-  }
-
-  @Override public int getMinorVersion() {
-    return 7;
-  }
-
-  @Override public boolean jdbcCompliant() {
-    return true;
-  }
-
-  @Override public Logger getParentLogger() throws SQLFeatureNotSupportedException {
-    return Logger.getLogger("");
-  }
-}
-
-// End AvaticaNoopDriver.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/noop-driver/src/main/java/org/apache/calcite/avatica/noop/AvaticaNoopParameterMetaData.java
----------------------------------------------------------------------
diff --git a/avatica/noop-driver/src/main/java/org/apache/calcite/avatica/noop/AvaticaNoopParameterMetaData.java b/avatica/noop-driver/src/main/java/org/apache/calcite/avatica/noop/AvaticaNoopParameterMetaData.java
deleted file mode 100644
index f7117e9..0000000
--- a/avatica/noop-driver/src/main/java/org/apache/calcite/avatica/noop/AvaticaNoopParameterMetaData.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.noop;
-
-import java.sql.ParameterMetaData;
-import java.sql.SQLException;
-
-/**
- * An implementation of {@link ParameterMetaData} which does nothing.
- */
-public class AvaticaNoopParameterMetaData implements ParameterMetaData {
-
-  private static final AvaticaNoopParameterMetaData INSTANCE = new AvaticaNoopParameterMetaData();
-
-  public static AvaticaNoopParameterMetaData getInstance() {
-    return INSTANCE;
-  }
-
-  private AvaticaNoopParameterMetaData() {}
-
-  private UnsupportedOperationException unsupported() {
-    return new UnsupportedOperationException("Unsupported");
-  }
-
-  @Override public <T> T unwrap(Class<T> iface) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public boolean isWrapperFor(Class<?> iface) throws SQLException {
-    return false;
-  }
-
-  @Override public int getParameterCount() throws SQLException {
-    return 0;
-  }
-
-  @Override public int isNullable(int param) throws SQLException {
-    return 0;
-  }
-
-  @Override public boolean isSigned(int param) throws SQLException {
-    return false;
-  }
-
-  @Override public int getPrecision(int param) throws SQLException {
-    return 0;
-  }
-
-  @Override public int getScale(int param) throws SQLException {
-    return 0;
-  }
-
-  @Override public int getParameterType(int param) throws SQLException {
-    return 0;
-  }
-
-  @Override public String getParameterTypeName(int param) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public String getParameterClassName(int param) throws SQLException {
-    return "java.lang.Object";
-  }
-
-  @Override public int getParameterMode(int param) throws SQLException {
-    return 0;
-  }
-
-}
-
-// End AvaticaNoopParameterMetaData.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/noop-driver/src/main/java/org/apache/calcite/avatica/noop/AvaticaNoopPreparedStatement.java
----------------------------------------------------------------------
diff --git a/avatica/noop-driver/src/main/java/org/apache/calcite/avatica/noop/AvaticaNoopPreparedStatement.java b/avatica/noop-driver/src/main/java/org/apache/calcite/avatica/noop/AvaticaNoopPreparedStatement.java
deleted file mode 100644
index 0d936ed..0000000
--- a/avatica/noop-driver/src/main/java/org/apache/calcite/avatica/noop/AvaticaNoopPreparedStatement.java
+++ /dev/null
@@ -1,345 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.noop;
-
-import java.io.InputStream;
-import java.io.Reader;
-import java.math.BigDecimal;
-import java.net.URL;
-import java.sql.Array;
-import java.sql.Blob;
-import java.sql.Clob;
-import java.sql.Connection;
-import java.sql.Date;
-import java.sql.NClob;
-import java.sql.ParameterMetaData;
-import java.sql.PreparedStatement;
-import java.sql.Ref;
-import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
-import java.sql.RowId;
-import java.sql.SQLException;
-import java.sql.SQLWarning;
-import java.sql.SQLXML;
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.util.Calendar;
-
-/**
- * A {@link PreparedStatement} instance which does nothing.
- */
-public class AvaticaNoopPreparedStatement implements PreparedStatement {
-
-  private static final AvaticaNoopPreparedStatement INSTANCE = new AvaticaNoopPreparedStatement();
-
-  public static AvaticaNoopPreparedStatement getInstance() {
-    return INSTANCE;
-  }
-
-  private AvaticaNoopPreparedStatement() {}
-
-  private UnsupportedOperationException unsupported() {
-    return new UnsupportedOperationException("Unsupported");
-  }
-
-  @Override public ResultSet executeQuery(String sql) throws SQLException {
-    return AvaticaNoopResultSet.getInstance();
-  }
-
-  @Override public int executeUpdate(String sql) throws SQLException {
-    return 1;
-  }
-
-  @Override public void close() throws SQLException {}
-
-  @Override public int getMaxFieldSize() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public void setMaxFieldSize(int max) throws SQLException {}
-
-  @Override public int getMaxRows() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public void setMaxRows(int max) throws SQLException {}
-
-  @Override public void setEscapeProcessing(boolean enable) throws SQLException {}
-
-  @Override public int getQueryTimeout() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public void setQueryTimeout(int seconds) throws SQLException {}
-
-  @Override public void cancel() throws SQLException {}
-
-  @Override public SQLWarning getWarnings() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public void clearWarnings() throws SQLException {}
-
-  @Override public void setCursorName(String name) throws SQLException {}
-
-  @Override public boolean execute(String sql) throws SQLException {
-    return false;
-  }
-
-  @Override public ResultSet getResultSet() throws SQLException {
-    return AvaticaNoopResultSet.getInstance();
-  }
-
-  @Override public int getUpdateCount() throws SQLException {
-    return 1;
-  }
-
-  @Override public boolean getMoreResults() throws SQLException {
-    return false;
-  }
-
-  @Override public void setFetchDirection(int direction) throws SQLException {}
-
-  @Override public int getFetchDirection() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public void setFetchSize(int rows) throws SQLException {}
-
-  @Override public int getFetchSize() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public int getResultSetConcurrency() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public int getResultSetType() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public void addBatch(String sql) throws SQLException {}
-
-  @Override public void clearBatch() throws SQLException {}
-
-  @Override public int[] executeBatch() throws SQLException {
-    return new int[0];
-  }
-
-  @Override public Connection getConnection() throws SQLException {
-    return AvaticaNoopConnection.getInstance();
-  }
-
-  @Override public boolean getMoreResults(int current) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public ResultSet getGeneratedKeys() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException {
-    return 1;
-  }
-
-  @Override public int executeUpdate(String sql, int[] columnIndexes) throws SQLException {
-    return 1;
-  }
-
-  @Override public int executeUpdate(String sql, String[] columnNames) throws SQLException {
-    return 1;
-  }
-
-  @Override public boolean execute(String sql, int autoGeneratedKeys) throws SQLException {
-    return true;
-  }
-
-  @Override public boolean execute(String sql, int[] columnIndexes) throws SQLException {
-    return true;
-  }
-
-  @Override public boolean execute(String sql, String[] columnNames) throws SQLException {
-    return true;
-  }
-
-  @Override public int getResultSetHoldability() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public boolean isClosed() throws SQLException {
-    return false;
-  }
-
-  @Override public void setPoolable(boolean poolable) throws SQLException {}
-
-  @Override public boolean isPoolable() throws SQLException {
-    return true;
-  }
-
-  @Override public void closeOnCompletion() throws SQLException {}
-
-  @Override public boolean isCloseOnCompletion() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public <T> T unwrap(Class<T> iface) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public boolean isWrapperFor(Class<?> iface) throws SQLException {
-    return false;
-  }
-
-  @Override public ResultSet executeQuery() throws SQLException {
-    return AvaticaNoopResultSet.getInstance();
-  }
-
-  @Override public int executeUpdate() throws SQLException {
-    return 1;
-  }
-
-  @Override public void setNull(int parameterIndex, int sqlType) throws SQLException {}
-
-  @Override public void setBoolean(int parameterIndex, boolean x) throws SQLException {}
-
-  @Override public void setByte(int parameterIndex, byte x) throws SQLException {}
-
-  @Override public void setShort(int parameterIndex, short x) throws SQLException {}
-
-  @Override public void setInt(int parameterIndex, int x) throws SQLException {}
-
-  @Override public void setLong(int parameterIndex, long x) throws SQLException {}
-
-  @Override public void setFloat(int parameterIndex, float x) throws SQLException {}
-
-  @Override public void setDouble(int parameterIndex, double x) throws SQLException {}
-
-  @Override public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException {}
-
-  @Override public void setString(int parameterIndex, String x) throws SQLException {}
-
-  @Override public void setBytes(int parameterIndex, byte[] x) throws SQLException {}
-
-  @Override public void setDate(int parameterIndex, Date x) throws SQLException {}
-
-  @Override public void setTime(int parameterIndex, Time x) throws SQLException {}
-
-  @Override public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException {}
-
-  @Override public void setAsciiStream(int parameterIndex, InputStream x, int length)
-      throws SQLException {}
-
-  @SuppressWarnings("deprecation")
-  @Override public void setUnicodeStream(int parameterIndex, InputStream x, int length)
-      throws SQLException {}
-
-  @Override public void setBinaryStream(int parameterIndex, InputStream x, int length)
-      throws SQLException {}
-
-  @Override public void clearParameters() throws SQLException {}
-
-  @Override public void setObject(int parameterIndex, Object x, int targetSqlType)
-      throws SQLException {}
-
-  @Override public void setObject(int parameterIndex, Object x) throws SQLException {}
-
-  @Override public boolean execute() throws SQLException {
-    return false;
-  }
-
-  @Override public void addBatch() throws SQLException {}
-
-  @Override public void setCharacterStream(int parameterIndex, Reader reader, int length)
-      throws SQLException {}
-
-  @Override public void setRef(int parameterIndex, Ref x) throws SQLException {}
-
-  @Override public void setBlob(int parameterIndex, Blob x) throws SQLException {}
-
-  @Override public void setClob(int parameterIndex, Clob x) throws SQLException {}
-
-  @Override public void setArray(int parameterIndex, Array x) throws SQLException {}
-
-  @Override public ResultSetMetaData getMetaData() throws SQLException {
-    return AvaticaNoopResultSetMetaData.getInstance();
-  }
-
-  @Override public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException {}
-
-  @Override public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException {}
-
-  @Override public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal)
-      throws SQLException {}
-
-  @Override public void setNull(int parameterIndex, int sqlType, String typeName)
-      throws SQLException {}
-
-  @Override public void setURL(int parameterIndex, URL x) throws SQLException {}
-
-  @Override public ParameterMetaData getParameterMetaData() throws SQLException {
-    return AvaticaNoopParameterMetaData.getInstance();
-  }
-
-  @Override public void setRowId(int parameterIndex, RowId x) throws SQLException {}
-
-  @Override public void setNString(int parameterIndex, String value) throws SQLException {}
-
-  @Override public void setNCharacterStream(int parameterIndex, Reader value, long length)
-      throws SQLException {}
-
-  @Override public void setNClob(int parameterIndex, NClob value) throws SQLException {}
-
-  @Override public void setClob(int parameterIndex, Reader reader, long length)
-      throws SQLException {}
-
-  @Override public void setBlob(int parameterIndex, InputStream inputStream, long length)
-      throws SQLException {}
-
-  @Override public void setNClob(int parameterIndex, Reader reader, long length)
-      throws SQLException {}
-
-  @Override public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException {}
-
-  @Override public void setObject(int parameterIndex, Object x, int targetSqlType,
-      int scaleOrLength)
-      throws SQLException {}
-
-  @Override public void setAsciiStream(int parameterIndex, InputStream x, long length)
-      throws SQLException {}
-
-  @Override public void setBinaryStream(int parameterIndex, InputStream x, long length)
-      throws SQLException {}
-
-  @Override public void setCharacterStream(int parameterIndex, Reader reader, long length)
-      throws SQLException {}
-
-  @Override public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException {}
-
-  @Override public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException {}
-
-  @Override public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException {}
-
-  @Override public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException {}
-
-  @Override public void setClob(int parameterIndex, Reader reader) throws SQLException {}
-
-  @Override public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException {}
-
-  @Override public void setNClob(int parameterIndex, Reader reader) throws SQLException {}
-}
-
-// End AvaticaNoopPreparedStatement.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/noop-driver/src/main/java/org/apache/calcite/avatica/noop/AvaticaNoopResultSet.java
----------------------------------------------------------------------
diff --git a/avatica/noop-driver/src/main/java/org/apache/calcite/avatica/noop/AvaticaNoopResultSet.java b/avatica/noop-driver/src/main/java/org/apache/calcite/avatica/noop/AvaticaNoopResultSet.java
deleted file mode 100644
index 022f610..0000000
--- a/avatica/noop-driver/src/main/java/org/apache/calcite/avatica/noop/AvaticaNoopResultSet.java
+++ /dev/null
@@ -1,665 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.noop;
-
-import java.io.InputStream;
-import java.io.Reader;
-import java.math.BigDecimal;
-import java.net.URL;
-import java.sql.Array;
-import java.sql.Blob;
-import java.sql.Clob;
-import java.sql.Date;
-import java.sql.NClob;
-import java.sql.Ref;
-import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
-import java.sql.RowId;
-import java.sql.SQLException;
-import java.sql.SQLWarning;
-import java.sql.SQLXML;
-import java.sql.Statement;
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.util.Calendar;
-import java.util.Map;
-
-/**
- * A {@link ResultSet} implementation which does nothing.
- */
-public class AvaticaNoopResultSet implements ResultSet {
-
-  private static final AvaticaNoopResultSet INSTANCE = new AvaticaNoopResultSet();
-
-  public static AvaticaNoopResultSet getInstance() {
-    return INSTANCE;
-  }
-
-  private AvaticaNoopResultSet() {}
-
-  private UnsupportedOperationException unsupported() {
-    return new UnsupportedOperationException("unsupported");
-  }
-
-  @Override public <T> T unwrap(Class<T> iface) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public boolean isWrapperFor(Class<?> iface) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public boolean next() throws SQLException {
-    return false;
-  }
-
-  @Override public void close() throws SQLException {}
-
-  @Override public boolean wasNull() throws SQLException {
-    return false;
-  }
-
-  @Override public String getString(int columnIndex) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public boolean getBoolean(int columnIndex) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public byte getByte(int columnIndex) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public short getShort(int columnIndex) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public int getInt(int columnIndex) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public long getLong(int columnIndex) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public float getFloat(int columnIndex) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public double getDouble(int columnIndex) throws SQLException {
-    throw unsupported();
-  }
-
-  @SuppressWarnings("deprecation")
-  @Override public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public byte[] getBytes(int columnIndex) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public Date getDate(int columnIndex) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public Time getTime(int columnIndex) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public Timestamp getTimestamp(int columnIndex) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public InputStream getAsciiStream(int columnIndex) throws SQLException {
-    throw unsupported();
-  }
-
-  @SuppressWarnings("deprecation")
-  @Override public InputStream getUnicodeStream(int columnIndex) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public InputStream getBinaryStream(int columnIndex) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public String getString(String columnLabel) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public boolean getBoolean(String columnLabel) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public byte getByte(String columnLabel) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public short getShort(String columnLabel) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public int getInt(String columnLabel) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public long getLong(String columnLabel) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public float getFloat(String columnLabel) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public double getDouble(String columnLabel) throws SQLException {
-    throw unsupported();
-  }
-
-  @SuppressWarnings("deprecation")
-  @Override public BigDecimal getBigDecimal(String columnLabel, int scale) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public byte[] getBytes(String columnLabel) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public Date getDate(String columnLabel) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public Time getTime(String columnLabel) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public Timestamp getTimestamp(String columnLabel) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public InputStream getAsciiStream(String columnLabel) throws SQLException {
-    throw unsupported();
-  }
-
-  @SuppressWarnings("deprecation")
-  @Override public InputStream getUnicodeStream(String columnLabel) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public InputStream getBinaryStream(String columnLabel) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public SQLWarning getWarnings() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public void clearWarnings() throws SQLException {}
-
-  @Override public String getCursorName() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public ResultSetMetaData getMetaData() throws SQLException {
-    return AvaticaNoopResultSetMetaData.getInstance();
-  }
-
-  @Override public Object getObject(int columnIndex) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public Object getObject(String columnLabel) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public int findColumn(String columnLabel) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public Reader getCharacterStream(int columnIndex) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public Reader getCharacterStream(String columnLabel) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public BigDecimal getBigDecimal(int columnIndex) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public BigDecimal getBigDecimal(String columnLabel) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public boolean isBeforeFirst() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public boolean isAfterLast() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public boolean isFirst() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public boolean isLast() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public void beforeFirst() throws SQLException {}
-
-  @Override public void afterLast() throws SQLException {}
-
-  @Override public boolean first() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public boolean last() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public int getRow() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public boolean absolute(int row) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public boolean relative(int rows) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public boolean previous() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public void setFetchDirection(int direction) throws SQLException {}
-
-  @Override public int getFetchDirection() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public void setFetchSize(int rows) throws SQLException {}
-
-  @Override public int getFetchSize() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public int getType() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public int getConcurrency() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public boolean rowUpdated() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public boolean rowInserted() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public boolean rowDeleted() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public void updateNull(int columnIndex) throws SQLException {}
-
-  @Override public void updateBoolean(int columnIndex, boolean x) throws SQLException {}
-
-  @Override public void updateByte(int columnIndex, byte x) throws SQLException {}
-
-  @Override public void updateShort(int columnIndex, short x) throws SQLException {}
-
-  @Override public void updateInt(int columnIndex, int x) throws SQLException {}
-
-  @Override public void updateLong(int columnIndex, long x) throws SQLException {}
-
-  @Override public void updateFloat(int columnIndex, float x) throws SQLException {}
-
-  @Override public void updateDouble(int columnIndex, double x) throws SQLException {}
-
-  @Override public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException {}
-
-  @Override public void updateString(int columnIndex, String x) throws SQLException {}
-
-  @Override public void updateBytes(int columnIndex, byte[] x) throws SQLException {}
-
-  @Override public void updateDate(int columnIndex, Date x) throws SQLException {}
-
-  @Override public void updateTime(int columnIndex, Time x) throws SQLException {}
-
-  @Override public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException {}
-
-  @Override public void updateAsciiStream(int columnIndex, InputStream x, int length)
-      throws SQLException {}
-
-  @Override public void updateBinaryStream(int columnIndex, InputStream x, int length)
-      throws SQLException {}
-
-  @Override public void updateCharacterStream(int columnIndex, Reader x, int length)
-      throws SQLException {}
-
-  @Override public void updateObject(int columnIndex, Object x, int scaleOrLength)
-      throws SQLException {}
-
-  @Override public void updateObject(int columnIndex, Object x) throws SQLException {}
-
-  @Override public void updateNull(String columnLabel) throws SQLException {}
-
-  @Override public void updateBoolean(String columnLabel, boolean x) throws SQLException {}
-
-  @Override public void updateByte(String columnLabel, byte x) throws SQLException {}
-
-  @Override public void updateShort(String columnLabel, short x) throws SQLException {}
-
-  @Override public void updateInt(String columnLabel, int x) throws SQLException {}
-
-  @Override public void updateLong(String columnLabel, long x) throws SQLException {}
-
-  @Override public void updateFloat(String columnLabel, float x) throws SQLException {}
-
-  @Override public void updateDouble(String columnLabel, double x) throws SQLException {}
-
-  @Override public void updateBigDecimal(String columnLabel, BigDecimal x) throws SQLException {}
-
-  @Override public void updateString(String columnLabel, String x) throws SQLException {}
-
-  @Override public void updateBytes(String columnLabel, byte[] x) throws SQLException {}
-
-  @Override public void updateDate(String columnLabel, Date x) throws SQLException {}
-
-  @Override public void updateTime(String columnLabel, Time x) throws SQLException {}
-
-  @Override public void updateTimestamp(String columnLabel, Timestamp x) throws SQLException {}
-
-  @Override public void updateAsciiStream(String columnLabel, InputStream x, int length)
-      throws SQLException {}
-
-  @Override public void updateBinaryStream(String columnLabel, InputStream x, int length)
-      throws SQLException {}
-
-  @Override public void updateCharacterStream(String columnLabel, Reader reader, int length)
-      throws SQLException {}
-
-  @Override public void updateObject(String columnLabel, Object x, int scaleOrLength)
-      throws SQLException {}
-
-  @Override public void updateObject(String columnLabel, Object x) throws SQLException {}
-
-  @Override public void insertRow() throws SQLException {}
-
-  @Override public void updateRow() throws SQLException {}
-
-  @Override public void deleteRow() throws SQLException {}
-
-  @Override public void refreshRow() throws SQLException {}
-
-  @Override public void cancelRowUpdates() throws SQLException {}
-
-  @Override public void moveToInsertRow() throws SQLException {}
-
-  @Override public void moveToCurrentRow() throws SQLException {}
-
-  @Override public Statement getStatement() throws SQLException {
-    return AvaticaNoopStatement.getInstance();
-  }
-
-  @Override public Object getObject(int columnIndex, Map<String, Class<?>> map)
-      throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public Ref getRef(int columnIndex) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public Blob getBlob(int columnIndex) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public Clob getClob(int columnIndex) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public Array getArray(int columnIndex) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public Object getObject(String columnLabel, Map<String, Class<?>> map)
-      throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public Ref getRef(String columnLabel) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public Blob getBlob(String columnLabel) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public Clob getClob(String columnLabel) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public Array getArray(String columnLabel) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public Date getDate(int columnIndex, Calendar cal) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public Date getDate(String columnLabel, Calendar cal) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public Time getTime(int columnIndex, Calendar cal) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public Time getTime(String columnLabel, Calendar cal) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public Timestamp getTimestamp(String columnLabel, Calendar cal) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public URL getURL(int columnIndex) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public URL getURL(String columnLabel) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public void updateRef(int columnIndex, Ref x) throws SQLException {}
-
-  @Override public void updateRef(String columnLabel, Ref x) throws SQLException {}
-
-  @Override public void updateBlob(int columnIndex, Blob x) throws SQLException {}
-
-  @Override public void updateBlob(String columnLabel, Blob x) throws SQLException {}
-
-  @Override public void updateClob(int columnIndex, Clob x) throws SQLException {}
-
-  @Override public void updateClob(String columnLabel, Clob x) throws SQLException {}
-
-  @Override public void updateArray(int columnIndex, Array x) throws SQLException {}
-
-  @Override public void updateArray(String columnLabel, Array x) throws SQLException {}
-
-  @Override public RowId getRowId(int columnIndex) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public RowId getRowId(String columnLabel) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public void updateRowId(int columnIndex, RowId x) throws SQLException {}
-
-  @Override public void updateRowId(String columnLabel, RowId x) throws SQLException {}
-
-  @Override public int getHoldability() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public boolean isClosed() throws SQLException {
-    return false;
-  }
-
-  @Override public void updateNString(int columnIndex, String nString) throws SQLException {}
-
-  @Override public void updateNString(String columnLabel, String nString) throws SQLException {}
-
-  @Override public void updateNClob(int columnIndex, NClob nClob) throws SQLException {}
-
-  @Override public void updateNClob(String columnLabel, NClob nClob) throws SQLException {}
-
-  @Override public NClob getNClob(int columnIndex) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public NClob getNClob(String columnLabel) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public SQLXML getSQLXML(int columnIndex) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public SQLXML getSQLXML(String columnLabel) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public void updateSQLXML(int columnIndex, SQLXML xmlObject) throws SQLException {}
-
-  @Override public void updateSQLXML(String columnLabel, SQLXML xmlObject) throws SQLException {}
-
-  @Override public String getNString(int columnIndex) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public String getNString(String columnLabel) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public Reader getNCharacterStream(int columnIndex) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public Reader getNCharacterStream(String columnLabel) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public void updateNCharacterStream(int columnIndex, Reader x, long length)
-      throws SQLException {}
-
-  @Override public void updateNCharacterStream(String columnLabel, Reader reader, long length)
-      throws SQLException {}
-
-  @Override public void updateAsciiStream(int columnIndex, InputStream x, long length)
-      throws SQLException {}
-
-  @Override public void updateBinaryStream(int columnIndex, InputStream x, long length)
-      throws SQLException {}
-
-  @Override public void updateCharacterStream(int columnIndex, Reader x, long length)
-      throws SQLException {}
-
-  @Override public void updateAsciiStream(String columnLabel, InputStream x, long length)
-      throws SQLException {}
-
-  @Override public void updateBinaryStream(String columnLabel, InputStream x, long length)
-      throws SQLException {}
-
-  @Override public void updateCharacterStream(String columnLabel, Reader reader, long length)
-      throws SQLException {}
-
-  @Override public void updateBlob(int columnIndex, InputStream inputStream, long length)
-      throws SQLException {}
-
-  @Override public void updateBlob(String columnLabel, InputStream inputStream, long length)
-      throws SQLException {}
-
-  @Override public void updateClob(int columnIndex, Reader reader, long length)
-      throws SQLException {}
-
-  @Override public void updateClob(String columnLabel, Reader reader, long length)
-      throws SQLException {}
-
-  @Override public void updateNClob(int columnIndex, Reader reader, long length)
-      throws SQLException {}
-
-  @Override public void updateNClob(String columnLabel, Reader reader, long length)
-      throws SQLException {}
-
-  @Override public void updateNCharacterStream(int columnIndex, Reader x) throws SQLException {}
-
-  @Override public void updateNCharacterStream(String columnLabel, Reader reader)
-      throws SQLException {}
-
-  @Override public void updateAsciiStream(int columnIndex, InputStream x) throws SQLException {}
-
-  @Override public void updateBinaryStream(int columnIndex, InputStream x) throws SQLException {}
-
-  @Override public void updateCharacterStream(int columnIndex, Reader x) throws SQLException {}
-
-  @Override public void updateAsciiStream(String columnLabel, InputStream x) throws SQLException {}
-
-  @Override public void updateBinaryStream(String columnLabel, InputStream x) throws SQLException {}
-
-  @Override public void updateCharacterStream(String columnLabel, Reader reader)
-      throws SQLException {}
-
-  @Override public void updateBlob(int columnIndex, InputStream inputStream) throws SQLException {}
-
-  @Override public void updateBlob(String columnLabel, InputStream inputStream)
-      throws SQLException {}
-
-  @Override public void updateClob(int columnIndex, Reader reader) throws SQLException {}
-
-  @Override public void updateClob(String columnLabel, Reader reader) throws SQLException {}
-
-  @Override public void updateNClob(int columnIndex, Reader reader) throws SQLException {}
-
-  @Override public void updateNClob(String columnLabel, Reader reader) throws SQLException {}
-
-  @Override public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public <T> T getObject(String columnLabel, Class<T> type) throws SQLException {
-    throw unsupported();
-  }
-
-}
-
-// End AvaticaNoopResultSet.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/noop-driver/src/main/java/org/apache/calcite/avatica/noop/AvaticaNoopResultSetMetaData.java
----------------------------------------------------------------------
diff --git a/avatica/noop-driver/src/main/java/org/apache/calcite/avatica/noop/AvaticaNoopResultSetMetaData.java b/avatica/noop-driver/src/main/java/org/apache/calcite/avatica/noop/AvaticaNoopResultSetMetaData.java
deleted file mode 100644
index ddc8c3b..0000000
--- a/avatica/noop-driver/src/main/java/org/apache/calcite/avatica/noop/AvaticaNoopResultSetMetaData.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.noop;
-
-import java.sql.ResultSetMetaData;
-import java.sql.SQLException;
-
-/**
- * A {@link ResultSetMetaData} implementation which does nothing.
- */
-public class AvaticaNoopResultSetMetaData implements ResultSetMetaData {
-
-  private static final AvaticaNoopResultSetMetaData INSTANCE = new AvaticaNoopResultSetMetaData();
-
-  public static AvaticaNoopResultSetMetaData getInstance() {
-    return INSTANCE;
-  }
-
-  private AvaticaNoopResultSetMetaData() {}
-
-  private UnsupportedOperationException unsupported() {
-    return new UnsupportedOperationException("Unsupported");
-  }
-
-  @Override public <T> T unwrap(Class<T> iface) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public boolean isWrapperFor(Class<?> iface) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public int getColumnCount() throws SQLException {
-    return 0;
-  }
-
-  @Override public boolean isAutoIncrement(int column) throws SQLException {
-    return false;
-  }
-
-  @Override public boolean isCaseSensitive(int column) throws SQLException {
-    return false;
-  }
-
-  @Override public boolean isSearchable(int column) throws SQLException {
-    return false;
-  }
-
-  @Override public boolean isCurrency(int column) throws SQLException {
-    return false;
-  }
-
-  @Override public int isNullable(int column) throws SQLException {
-    return 0;
-  }
-
-  @Override public boolean isSigned(int column) throws SQLException {
-    return false;
-  }
-
-  @Override public int getColumnDisplaySize(int column) throws SQLException {
-    return 0;
-  }
-
-  @Override public String getColumnLabel(int column) throws SQLException {
-    return "";
-  }
-
-  @Override public String getColumnName(int column) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public String getSchemaName(int column) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public int getPrecision(int column) throws SQLException {
-    return 0;
-  }
-
-  @Override public int getScale(int column) throws SQLException {
-    return 0;
-  }
-
-  @Override public String getTableName(int column) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public String getCatalogName(int column) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public int getColumnType(int column) throws SQLException {
-    return 0;
-  }
-
-  @Override public String getColumnTypeName(int column) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public boolean isReadOnly(int column) throws SQLException {
-    return false;
-  }
-
-  @Override public boolean isWritable(int column) throws SQLException {
-    return false;
-  }
-
-  @Override public boolean isDefinitelyWritable(int column) throws SQLException {
-    return false;
-  }
-
-  @Override public String getColumnClassName(int column) throws SQLException {
-    throw unsupported();
-  }
-
-}
-
-// End AvaticaNoopResultSetMetaData.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/noop-driver/src/main/java/org/apache/calcite/avatica/noop/AvaticaNoopStatement.java
----------------------------------------------------------------------
diff --git a/avatica/noop-driver/src/main/java/org/apache/calcite/avatica/noop/AvaticaNoopStatement.java b/avatica/noop-driver/src/main/java/org/apache/calcite/avatica/noop/AvaticaNoopStatement.java
deleted file mode 100644
index 079cea4..0000000
--- a/avatica/noop-driver/src/main/java/org/apache/calcite/avatica/noop/AvaticaNoopStatement.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.noop;
-
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.SQLWarning;
-import java.sql.Statement;
-
-/**
- * A {@link Statement} implementation which does nothing.
- */
-public class AvaticaNoopStatement implements Statement {
-
-  private static final AvaticaNoopStatement INSTANCE = new AvaticaNoopStatement();
-
-  public static AvaticaNoopStatement getInstance() {
-    return INSTANCE;
-  }
-
-  private AvaticaNoopStatement() {}
-
-  private UnsupportedOperationException unsupported() {
-    return new UnsupportedOperationException("Unsupported");
-  }
-
-  @Override public ResultSet executeQuery(String sql) throws SQLException {
-    return AvaticaNoopResultSet.getInstance();
-  }
-
-  @Override public int executeUpdate(String sql) throws SQLException {
-    return 1;
-  }
-
-  @Override public void close() throws SQLException {}
-
-  @Override public int getMaxFieldSize() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public void setMaxFieldSize(int max) throws SQLException {}
-
-  @Override public int getMaxRows() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public void setMaxRows(int max) throws SQLException {}
-
-  @Override public void setEscapeProcessing(boolean enable) throws SQLException {}
-
-  @Override public int getQueryTimeout() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public void setQueryTimeout(int seconds) throws SQLException {}
-
-  @Override public void cancel() throws SQLException {}
-
-  @Override public SQLWarning getWarnings() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public void clearWarnings() throws SQLException {}
-
-  @Override public void setCursorName(String name) throws SQLException {}
-
-  @Override public boolean execute(String sql) throws SQLException {
-    return false;
-  }
-
-  @Override public ResultSet getResultSet() throws SQLException {
-    return AvaticaNoopResultSet.getInstance();
-  }
-
-  @Override public int getUpdateCount() throws SQLException {
-    return 1;
-  }
-
-  @Override public boolean getMoreResults() throws SQLException {
-    return false;
-  }
-
-  @Override public void setFetchDirection(int direction) throws SQLException {}
-
-  @Override public int getFetchDirection() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public void setFetchSize(int rows) throws SQLException {}
-
-  @Override public int getFetchSize() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public int getResultSetConcurrency() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public int getResultSetType() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public void addBatch(String sql) throws SQLException {}
-
-  @Override public void clearBatch() throws SQLException {}
-
-  @Override public int[] executeBatch() throws SQLException {
-    return new int[0];
-  }
-
-  @Override public Connection getConnection() throws SQLException {
-    return AvaticaNoopConnection.getInstance();
-  }
-
-  @Override public boolean getMoreResults(int current) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public ResultSet getGeneratedKeys() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException {
-    return 1;
-  }
-
-  @Override public int executeUpdate(String sql, int[] columnIndexes) throws SQLException {
-    return 1;
-  }
-
-  @Override public int executeUpdate(String sql, String[] columnNames) throws SQLException {
-    return 1;
-  }
-
-  @Override public boolean execute(String sql, int autoGeneratedKeys) throws SQLException {
-    return true;
-  }
-
-  @Override public boolean execute(String sql, int[] columnIndexes) throws SQLException {
-    return true;
-  }
-
-  @Override public boolean execute(String sql, String[] columnNames) throws SQLException {
-    return true;
-  }
-
-  @Override public int getResultSetHoldability() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public boolean isClosed() throws SQLException {
-    return false;
-  }
-
-  @Override public void setPoolable(boolean poolable) throws SQLException {}
-
-  @Override public boolean isPoolable() throws SQLException {
-    return true;
-  }
-
-  @Override public void closeOnCompletion() throws SQLException {}
-
-  @Override public boolean isCloseOnCompletion() throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public <T> T unwrap(Class<T> iface) throws SQLException {
-    throw unsupported();
-  }
-
-  @Override public boolean isWrapperFor(Class<?> iface) throws SQLException {
-    throw unsupported();
-  }
-}
-
-// End AvaticaNoopStatement.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/noop-driver/src/main/java/org/apache/calcite/avatica/noop/PackageMarker.java
----------------------------------------------------------------------
diff --git a/avatica/noop-driver/src/main/java/org/apache/calcite/avatica/noop/PackageMarker.java b/avatica/noop-driver/src/main/java/org/apache/calcite/avatica/noop/PackageMarker.java
deleted file mode 100644
index 6ae1905..0000000
--- a/avatica/noop-driver/src/main/java/org/apache/calcite/avatica/noop/PackageMarker.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.noop;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * This is a dummy annotation that forces javac to produce output for
- * otherwise empty package-info.java.
- *
- * <p>The result is maven-compiler-plugin can properly identify the scope of
- * changed files
- *
- * <p>See more details in
- * <a href="https://jira.codehaus.org/browse/MCOMPILER-205">
- *   maven-compiler-plugin: incremental compilation broken</a>
- */
-@Retention(RetentionPolicy.SOURCE)
-public @interface PackageMarker {
-}
-
-// End PackageMarker.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/noop-driver/src/main/java/org/apache/calcite/avatica/noop/package-info.java
----------------------------------------------------------------------
diff --git a/avatica/noop-driver/src/main/java/org/apache/calcite/avatica/noop/package-info.java b/avatica/noop-driver/src/main/java/org/apache/calcite/avatica/noop/package-info.java
deleted file mode 100644
index da1c5c4..0000000
--- a/avatica/noop-driver/src/main/java/org/apache/calcite/avatica/noop/package-info.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * A no-operation implementation of a JDBC driver built for testing Avatica.
- */
-@PackageMarker
-package org.apache.calcite.avatica.noop;
-
-// End package-info.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/noop-driver/src/main/resources/META-INF/services/java.sql.Driver
----------------------------------------------------------------------
diff --git a/avatica/noop-driver/src/main/resources/META-INF/services/java.sql.Driver b/avatica/noop-driver/src/main/resources/META-INF/services/java.sql.Driver
deleted file mode 100644
index 24845b0..0000000
--- a/avatica/noop-driver/src/main/resources/META-INF/services/java.sql.Driver
+++ /dev/null
@@ -1 +0,0 @@
-org.apache.calcite.avatica.noop.AvaticaNoopDriver


[09/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableInterpreterRule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableInterpreterRule.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableInterpreterRule.java
deleted file mode 100644
index 99996fa..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableInterpreterRule.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.interpreter.BindableConvention;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.convert.ConverterRule;
-
-/**
- * Planner rule that converts {@link org.apache.calcite.interpreter.BindableRel}
- * to {@link org.apache.calcite.adapter.enumerable.EnumerableRel} by creating
- * an {@link org.apache.calcite.adapter.enumerable.EnumerableInterpreter}.
- */
-public class EnumerableInterpreterRule extends ConverterRule {
-  public static final EnumerableInterpreterRule INSTANCE =
-      new EnumerableInterpreterRule();
-
-  private EnumerableInterpreterRule() {
-    super(RelNode.class, BindableConvention.INSTANCE,
-        EnumerableConvention.INSTANCE, "EnumerableInterpreterRule");
-  }
-
-  //~ Methods ----------------------------------------------------------------
-
-  @Override public RelNode convert(RelNode rel) {
-    return EnumerableInterpreter.create(rel, 0.5d);
-  }
-}
-
-// End EnumerableInterpreterRule.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableIntersect.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableIntersect.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableIntersect.java
deleted file mode 100644
index 8462f65..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableIntersect.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.linq4j.Ord;
-import org.apache.calcite.linq4j.tree.BlockBuilder;
-import org.apache.calcite.linq4j.tree.Expression;
-import org.apache.calcite.linq4j.tree.Expressions;
-import org.apache.calcite.plan.RelOptCluster;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.core.Intersect;
-import org.apache.calcite.util.BuiltInMethod;
-
-import java.util.List;
-
-/** Implementation of {@link org.apache.calcite.rel.core.Intersect} in
- * {@link org.apache.calcite.adapter.enumerable.EnumerableConvention enumerable calling convention}. */
-public class EnumerableIntersect extends Intersect implements EnumerableRel {
-  public EnumerableIntersect(RelOptCluster cluster, RelTraitSet traitSet,
-      List<RelNode> inputs, boolean all) {
-    super(cluster, traitSet, inputs, all);
-    assert !all;
-  }
-
-  public EnumerableIntersect copy(RelTraitSet traitSet, List<RelNode> inputs,
-      boolean all) {
-    return new EnumerableIntersect(getCluster(), traitSet, inputs, all);
-  }
-
-  public Result implement(EnumerableRelImplementor implementor, Prefer pref) {
-    final BlockBuilder builder = new BlockBuilder();
-    Expression intersectExp = null;
-    for (Ord<RelNode> ord : Ord.zip(inputs)) {
-      EnumerableRel input = (EnumerableRel) ord.e;
-      final Result result = implementor.visitChild(this, ord.i, input, pref);
-      Expression childExp =
-          builder.append(
-              "child" + ord.i,
-              result.block);
-
-      if (intersectExp == null) {
-        intersectExp = childExp;
-      } else {
-        intersectExp =
-            Expressions.call(intersectExp,
-                BuiltInMethod.INTERSECT.method,
-                Expressions.list(childExp)
-                    .appendIfNotNull(result.physType.comparer()));
-      }
-
-      // Once the first input has chosen its format, ask for the same for
-      // other inputs.
-      pref = pref.of(result.format);
-    }
-
-    builder.add(intersectExp);
-    final PhysType physType =
-        PhysTypeImpl.of(
-            implementor.getTypeFactory(),
-            getRowType(),
-            pref.prefer(JavaRowFormat.CUSTOM));
-    return implementor.result(physType, builder.toBlock());
-  }
-}
-
-// End EnumerableIntersect.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableIntersectRule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableIntersectRule.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableIntersectRule.java
deleted file mode 100644
index f906d47..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableIntersectRule.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.plan.Convention;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.convert.ConverterRule;
-import org.apache.calcite.rel.logical.LogicalIntersect;
-
-/**
- * Rule to convert a
- * {@link org.apache.calcite.rel.logical.LogicalIntersect} to an
- * {@link EnumerableIntersect}.
- */
-class EnumerableIntersectRule extends ConverterRule {
-  EnumerableIntersectRule() {
-    super(LogicalIntersect.class, Convention.NONE,
-        EnumerableConvention.INSTANCE, "EnumerableIntersectRule");
-  }
-
-  public RelNode convert(RelNode rel) {
-    final LogicalIntersect intersect = (LogicalIntersect) rel;
-    if (intersect.all) {
-      return null; // INTERSECT ALL not implemented
-    }
-    final EnumerableConvention out = EnumerableConvention.INSTANCE;
-    final RelTraitSet traitSet = intersect.getTraitSet().replace(out);
-    return new EnumerableIntersect(rel.getCluster(), traitSet,
-        convertList(intersect.getInputs(), out), false);
-  }
-}
-
-// End EnumerableIntersectRule.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableJoin.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableJoin.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableJoin.java
deleted file mode 100644
index cfd00a4..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableJoin.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.linq4j.tree.BlockBuilder;
-import org.apache.calcite.linq4j.tree.Expression;
-import org.apache.calcite.linq4j.tree.Expressions;
-import org.apache.calcite.plan.RelOptCluster;
-import org.apache.calcite.plan.RelOptCost;
-import org.apache.calcite.plan.RelOptPlanner;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.InvalidRelException;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.RelNodes;
-import org.apache.calcite.rel.core.CorrelationId;
-import org.apache.calcite.rel.core.EquiJoin;
-import org.apache.calcite.rel.core.JoinInfo;
-import org.apache.calcite.rel.core.JoinRelType;
-import org.apache.calcite.rel.metadata.RelMetadataQuery;
-import org.apache.calcite.rex.RexNode;
-import org.apache.calcite.util.BuiltInMethod;
-import org.apache.calcite.util.ImmutableIntList;
-import org.apache.calcite.util.Util;
-
-import com.google.common.collect.ImmutableList;
-
-import java.util.Set;
-
-/** Implementation of {@link org.apache.calcite.rel.core.Join} in
- * {@link org.apache.calcite.adapter.enumerable.EnumerableConvention enumerable calling convention}. */
-public class EnumerableJoin extends EquiJoin implements EnumerableRel {
-  /** Creates an EnumerableJoin.
-   *
-   * <p>Use {@link #create} unless you know what you're doing. */
-  protected EnumerableJoin(
-      RelOptCluster cluster,
-      RelTraitSet traits,
-      RelNode left,
-      RelNode right,
-      RexNode condition,
-      ImmutableIntList leftKeys,
-      ImmutableIntList rightKeys,
-      Set<CorrelationId> variablesSet,
-      JoinRelType joinType)
-      throws InvalidRelException {
-    super(
-        cluster,
-        traits,
-        left,
-        right,
-        condition,
-        leftKeys,
-        rightKeys,
-        variablesSet,
-        joinType);
-  }
-
-  @Deprecated // to be removed before 2.0
-  protected EnumerableJoin(RelOptCluster cluster, RelTraitSet traits,
-      RelNode left, RelNode right, RexNode condition, ImmutableIntList leftKeys,
-      ImmutableIntList rightKeys, JoinRelType joinType,
-      Set<String> variablesStopped) throws InvalidRelException {
-    this(cluster, traits, left, right, condition, leftKeys, rightKeys,
-        CorrelationId.setOf(variablesStopped), joinType);
-  }
-
-  /** Creates an EnumerableJoin. */
-  public static EnumerableJoin create(
-      RelNode left,
-      RelNode right,
-      RexNode condition,
-      ImmutableIntList leftKeys,
-      ImmutableIntList rightKeys,
-      Set<CorrelationId> variablesSet,
-      JoinRelType joinType)
-      throws InvalidRelException {
-    final RelOptCluster cluster = left.getCluster();
-    final RelTraitSet traitSet =
-        cluster.traitSetOf(EnumerableConvention.INSTANCE);
-    return new EnumerableJoin(cluster, traitSet, left, right, condition,
-        leftKeys, rightKeys, variablesSet, joinType);
-  }
-
-  @Deprecated // to be removed before 2.0
-  public static EnumerableJoin create(
-      RelNode left,
-      RelNode right,
-      RexNode condition,
-      ImmutableIntList leftKeys,
-      ImmutableIntList rightKeys,
-      JoinRelType joinType,
-      Set<String> variablesStopped)
-      throws InvalidRelException {
-    return create(left, right, condition, leftKeys, rightKeys,
-        CorrelationId.setOf(variablesStopped), joinType);
-  }
-
-  @Override public EnumerableJoin copy(RelTraitSet traitSet, RexNode condition,
-      RelNode left, RelNode right, JoinRelType joinType,
-      boolean semiJoinDone) {
-    final JoinInfo joinInfo = JoinInfo.of(left, right, condition);
-    assert joinInfo.isEqui();
-    try {
-      return new EnumerableJoin(getCluster(), traitSet, left, right,
-          condition, joinInfo.leftKeys, joinInfo.rightKeys, variablesSet,
-          joinType);
-    } catch (InvalidRelException e) {
-      // Semantic error not possible. Must be a bug. Convert to
-      // internal error.
-      throw new AssertionError(e);
-    }
-  }
-
-  @Override public RelOptCost computeSelfCost(RelOptPlanner planner,
-      RelMetadataQuery mq) {
-    double rowCount = mq.getRowCount(this);
-
-    // Joins can be flipped, and for many algorithms, both versions are viable
-    // and have the same cost. To make the results stable between versions of
-    // the planner, make one of the versions slightly more expensive.
-    switch (joinType) {
-    case RIGHT:
-      rowCount = addEpsilon(rowCount);
-      break;
-    default:
-      if (RelNodes.COMPARATOR.compare(left, right) > 0) {
-        rowCount = addEpsilon(rowCount);
-      }
-    }
-
-    // Cheaper if the smaller number of rows is coming from the LHS.
-    // Model this by adding L log L to the cost.
-    final double rightRowCount = right.estimateRowCount(mq);
-    final double leftRowCount = left.estimateRowCount(mq);
-    if (Double.isInfinite(leftRowCount)) {
-      rowCount = leftRowCount;
-    } else {
-      rowCount += Util.nLogN(leftRowCount);
-    }
-    if (Double.isInfinite(rightRowCount)) {
-      rowCount = rightRowCount;
-    } else {
-      rowCount += rightRowCount;
-    }
-    return planner.getCostFactory().makeCost(rowCount, 0, 0);
-  }
-
-  private double addEpsilon(double d) {
-    assert d >= 0d;
-    final double d0 = d;
-    if (d < 10) {
-      // For small d, adding 1 would change the value significantly.
-      d *= 1.001d;
-      if (d != d0) {
-        return d;
-      }
-    }
-    // For medium d, add 1. Keeps integral values integral.
-    ++d;
-    if (d != d0) {
-      return d;
-    }
-    // For large d, adding 1 might not change the value. Add .1%.
-    // If d is NaN, this still will probably not change the value. That's OK.
-    d *= 1.001d;
-    return d;
-  }
-
-  public Result implement(EnumerableRelImplementor implementor, Prefer pref) {
-    BlockBuilder builder = new BlockBuilder();
-    final Result leftResult =
-        implementor.visitChild(this, 0, (EnumerableRel) left, pref);
-    Expression leftExpression =
-        builder.append(
-            "left", leftResult.block);
-    final Result rightResult =
-        implementor.visitChild(this, 1, (EnumerableRel) right, pref);
-    Expression rightExpression =
-        builder.append(
-            "right", rightResult.block);
-    final PhysType physType =
-        PhysTypeImpl.of(
-            implementor.getTypeFactory(), getRowType(), pref.preferArray());
-    final PhysType keyPhysType =
-        leftResult.physType.project(
-            leftKeys, JavaRowFormat.LIST);
-    return implementor.result(
-        physType,
-        builder.append(
-            Expressions.call(
-                leftExpression,
-                BuiltInMethod.JOIN.method,
-                Expressions.list(
-                    rightExpression,
-                    leftResult.physType.generateAccessor(leftKeys),
-                    rightResult.physType.generateAccessor(rightKeys),
-                    EnumUtils.joinSelector(joinType,
-                        physType,
-                        ImmutableList.of(
-                            leftResult.physType, rightResult.physType)))
-                    .append(
-                        Util.first(keyPhysType.comparer(),
-                            Expressions.constant(null)))
-                    .append(
-                        Expressions.constant(joinType.generatesNullsOnLeft()))
-                    .append(
-                        Expressions.constant(
-                            joinType.generatesNullsOnRight())))).toBlock());
-  }
-
-}
-
-// End EnumerableJoin.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableJoinRule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableJoinRule.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableJoinRule.java
deleted file mode 100644
index 375568b..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableJoinRule.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.plan.Convention;
-import org.apache.calcite.plan.RelOptCluster;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.InvalidRelException;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.convert.ConverterRule;
-import org.apache.calcite.rel.core.JoinInfo;
-import org.apache.calcite.rel.core.JoinRelType;
-import org.apache.calcite.rel.logical.LogicalJoin;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/** Planner rule that converts a
- * {@link org.apache.calcite.rel.logical.LogicalJoin} relational expression
- * {@link org.apache.calcite.adapter.enumerable.EnumerableConvention enumerable calling convention}. */
-class EnumerableJoinRule extends ConverterRule {
-  EnumerableJoinRule() {
-    super(
-        LogicalJoin.class,
-        Convention.NONE,
-        EnumerableConvention.INSTANCE,
-        "EnumerableJoinRule");
-  }
-
-  @Override public RelNode convert(RelNode rel) {
-    LogicalJoin join = (LogicalJoin) rel;
-    List<RelNode> newInputs = new ArrayList<>();
-    for (RelNode input : join.getInputs()) {
-      if (!(input.getConvention() instanceof EnumerableConvention)) {
-        input =
-            convert(
-                input,
-                input.getTraitSet()
-                    .replace(EnumerableConvention.INSTANCE));
-      }
-      newInputs.add(input);
-    }
-    final RelOptCluster cluster = join.getCluster();
-    final RelTraitSet traitSet =
-        join.getTraitSet().replace(EnumerableConvention.INSTANCE);
-    final RelNode left = newInputs.get(0);
-    final RelNode right = newInputs.get(1);
-    final JoinInfo info = JoinInfo.of(left, right, join.getCondition());
-    if (!info.isEqui() && join.getJoinType() != JoinRelType.INNER) {
-      // EnumerableJoinRel only supports equi-join. We can put a filter on top
-      // if it is an inner join.
-      try {
-        return new EnumerableThetaJoin(cluster, traitSet, left, right,
-            join.getCondition(), join.getVariablesSet(), join.getJoinType());
-      } catch (InvalidRelException e) {
-        EnumerableRules.LOGGER.debug(e.toString());
-        return null;
-      }
-    }
-    RelNode newRel;
-    try {
-      newRel = new EnumerableJoin(
-          cluster,
-          join.getTraitSet().replace(EnumerableConvention.INSTANCE),
-          left,
-          right,
-          info.getEquiCondition(left, right, cluster.getRexBuilder()),
-          info.leftKeys,
-          info.rightKeys,
-          join.getVariablesSet(),
-          join.getJoinType());
-    } catch (InvalidRelException e) {
-      EnumerableRules.LOGGER.debug(e.toString());
-      return null;
-    }
-    if (!info.isEqui()) {
-      newRel = new EnumerableFilter(cluster, newRel.getTraitSet(),
-          newRel, info.getRemaining(cluster.getRexBuilder()));
-    }
-    return newRel;
-  }
-}
-
-// End EnumerableJoinRule.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableLimit.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableLimit.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableLimit.java
deleted file mode 100644
index 827944f..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableLimit.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.linq4j.tree.BlockBuilder;
-import org.apache.calcite.linq4j.tree.Expression;
-import org.apache.calcite.linq4j.tree.Expressions;
-import org.apache.calcite.plan.RelOptCluster;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.RelCollation;
-import org.apache.calcite.rel.RelCollationTraitDef;
-import org.apache.calcite.rel.RelDistribution;
-import org.apache.calcite.rel.RelDistributionTraitDef;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.RelWriter;
-import org.apache.calcite.rel.SingleRel;
-import org.apache.calcite.rel.metadata.RelMdCollation;
-import org.apache.calcite.rel.metadata.RelMdDistribution;
-import org.apache.calcite.rel.metadata.RelMetadataQuery;
-import org.apache.calcite.rex.RexLiteral;
-import org.apache.calcite.rex.RexNode;
-import org.apache.calcite.util.BuiltInMethod;
-
-import com.google.common.base.Supplier;
-
-import java.util.List;
-
-/** Relational expression that applies a limit and/or offset to its input. */
-public class EnumerableLimit extends SingleRel implements EnumerableRel {
-  public final RexNode offset;
-  public final RexNode fetch;
-
-  /** Creates an EnumerableLimit.
-   *
-   * <p>Use {@link #create} unless you know what you're doing. */
-  public EnumerableLimit(
-      RelOptCluster cluster,
-      RelTraitSet traitSet,
-      RelNode input,
-      RexNode offset,
-      RexNode fetch) {
-    super(cluster, traitSet, input);
-    this.offset = offset;
-    this.fetch = fetch;
-    assert getConvention() instanceof EnumerableConvention;
-    assert getConvention() == input.getConvention();
-  }
-
-  /** Creates an EnumerableLimit. */
-  public static EnumerableLimit create(final RelNode input, RexNode offset,
-      RexNode fetch) {
-    final RelOptCluster cluster = input.getCluster();
-    final RelMetadataQuery mq = RelMetadataQuery.instance();
-    final RelTraitSet traitSet =
-        cluster.traitSetOf(EnumerableConvention.INSTANCE)
-            .replaceIfs(
-                RelCollationTraitDef.INSTANCE,
-                new Supplier<List<RelCollation>>() {
-                  public List<RelCollation> get() {
-                    return RelMdCollation.limit(mq, input);
-                  }
-                })
-            .replaceIf(RelDistributionTraitDef.INSTANCE,
-                new Supplier<RelDistribution>() {
-                  public RelDistribution get() {
-                    return RelMdDistribution.limit(mq, input);
-                  }
-                });
-    return new EnumerableLimit(cluster, traitSet, input, offset, fetch);
-  }
-
-  @Override public EnumerableLimit copy(
-      RelTraitSet traitSet,
-      List<RelNode> newInputs) {
-    return new EnumerableLimit(
-        getCluster(),
-        traitSet,
-        sole(newInputs),
-        offset,
-        fetch);
-  }
-
-  @Override public RelWriter explainTerms(RelWriter pw) {
-    return super.explainTerms(pw)
-        .itemIf("offset", offset, offset != null)
-        .itemIf("fetch", fetch, fetch != null);
-  }
-
-  public Result implement(EnumerableRelImplementor implementor, Prefer pref) {
-    final BlockBuilder builder = new BlockBuilder();
-    final EnumerableRel child = (EnumerableRel) getInput();
-    final Result result = implementor.visitChild(this, 0, child, pref);
-    final PhysType physType =
-        PhysTypeImpl.of(
-            implementor.getTypeFactory(),
-            getRowType(),
-            result.format);
-
-    Expression v = builder.append("child", result.block);
-    if (offset != null) {
-      v = builder.append(
-          "offset",
-          Expressions.call(
-              v,
-              BuiltInMethod.SKIP.method,
-              Expressions.constant(RexLiteral.intValue(offset))));
-    }
-    if (fetch != null) {
-      v = builder.append(
-          "fetch",
-          Expressions.call(
-              v,
-              BuiltInMethod.TAKE.method,
-              Expressions.constant(RexLiteral.intValue(fetch))));
-    }
-
-    builder.add(
-        Expressions.return_(
-            null,
-            v));
-    return implementor.result(physType, builder.toBlock());
-  }
-}
-
-// End EnumerableLimit.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableLimitRule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableLimitRule.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableLimitRule.java
deleted file mode 100644
index 4f8ab10..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableLimitRule.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.plan.RelOptRule;
-import org.apache.calcite.plan.RelOptRuleCall;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.core.Sort;
-
-/**
- * Rule to convert an {@link org.apache.calcite.rel.core.Sort} that has
- * {@code offset} or {@code fetch} set to an
- * {@link EnumerableLimit}
- * on top of a "pure" {@code Sort} that has no offset or fetch.
- */
-class EnumerableLimitRule extends RelOptRule {
-  EnumerableLimitRule() {
-    super(
-        operand(Sort.class, any()),
-        "EnumerableLimitRule");
-  }
-
-  @Override public void onMatch(RelOptRuleCall call) {
-    final Sort sort = call.rel(0);
-    if (sort.offset == null && sort.fetch == null) {
-      return;
-    }
-    final RelTraitSet traitSet =
-        sort.getTraitSet().replace(EnumerableConvention.INSTANCE);
-    RelNode input = sort.getInput();
-    if (!sort.getCollation().getFieldCollations().isEmpty()) {
-      // Create a sort with the same sort key, but no offset or fetch.
-      input = sort.copy(
-          sort.getTraitSet(),
-          input,
-          sort.getCollation(),
-          null,
-          null);
-    }
-    RelNode x = convert(
-        input,
-        input.getTraitSet().replace(EnumerableConvention.INSTANCE));
-    call.transformTo(
-        new EnumerableLimit(
-            sort.getCluster(),
-            traitSet,
-            x,
-            sort.offset,
-            sort.fetch));
-  }
-}
-
-// End EnumerableLimitRule.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableMergeJoin.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableMergeJoin.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableMergeJoin.java
deleted file mode 100644
index 95d6239..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableMergeJoin.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.adapter.java.JavaTypeFactory;
-import org.apache.calcite.linq4j.tree.BlockBuilder;
-import org.apache.calcite.linq4j.tree.Expression;
-import org.apache.calcite.linq4j.tree.Expressions;
-import org.apache.calcite.linq4j.tree.ParameterExpression;
-import org.apache.calcite.linq4j.tree.Types;
-import org.apache.calcite.plan.RelOptCluster;
-import org.apache.calcite.plan.RelOptCost;
-import org.apache.calcite.plan.RelOptPlanner;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.InvalidRelException;
-import org.apache.calcite.rel.RelCollation;
-import org.apache.calcite.rel.RelCollationTraitDef;
-import org.apache.calcite.rel.RelCollations;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.core.CorrelationId;
-import org.apache.calcite.rel.core.EquiJoin;
-import org.apache.calcite.rel.core.JoinInfo;
-import org.apache.calcite.rel.core.JoinRelType;
-import org.apache.calcite.rel.metadata.RelMdCollation;
-import org.apache.calcite.rel.metadata.RelMetadataQuery;
-import org.apache.calcite.rel.type.RelDataType;
-import org.apache.calcite.rex.RexLiteral;
-import org.apache.calcite.rex.RexNode;
-import org.apache.calcite.util.BuiltInMethod;
-import org.apache.calcite.util.ImmutableIntList;
-import org.apache.calcite.util.Pair;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-/** Implementation of {@link org.apache.calcite.rel.core.Join} in
- * {@link EnumerableConvention enumerable calling convention} using
- * a merge algorithm. */
-public class EnumerableMergeJoin extends EquiJoin implements EnumerableRel {
-  EnumerableMergeJoin(
-      RelOptCluster cluster,
-      RelTraitSet traits,
-      RelNode left,
-      RelNode right,
-      RexNode condition,
-      ImmutableIntList leftKeys,
-      ImmutableIntList rightKeys,
-      Set<CorrelationId> variablesSet,
-      JoinRelType joinType)
-      throws InvalidRelException {
-    super(cluster, traits, left, right, condition, leftKeys, rightKeys,
-        variablesSet, joinType);
-    final List<RelCollation> collations =
-        traits.getTraits(RelCollationTraitDef.INSTANCE);
-    assert collations == null || RelCollations.contains(collations, leftKeys);
-  }
-
-  @Deprecated // to be removed before 2.0
-  EnumerableMergeJoin(RelOptCluster cluster, RelTraitSet traits, RelNode left,
-      RelNode right, RexNode condition, ImmutableIntList leftKeys,
-      ImmutableIntList rightKeys, JoinRelType joinType,
-      Set<String> variablesStopped) throws InvalidRelException {
-    this(cluster, traits, left, right, condition, leftKeys, rightKeys,
-        CorrelationId.setOf(variablesStopped), joinType);
-  }
-
-  public static EnumerableMergeJoin create(RelNode left, RelNode right,
-      RexLiteral condition, ImmutableIntList leftKeys,
-      ImmutableIntList rightKeys, JoinRelType joinType)
-      throws InvalidRelException {
-    final RelOptCluster cluster = right.getCluster();
-    RelTraitSet traitSet = cluster.traitSet();
-    if (traitSet.isEnabled(RelCollationTraitDef.INSTANCE)) {
-      final RelMetadataQuery mq = RelMetadataQuery.instance();
-      final List<RelCollation> collations =
-          RelMdCollation.mergeJoin(mq, left, right, leftKeys, rightKeys);
-      traitSet = traitSet.replace(collations);
-    }
-    return new EnumerableMergeJoin(cluster, traitSet, left, right, condition,
-        leftKeys, rightKeys, ImmutableSet.<CorrelationId>of(), joinType);
-  }
-
-  @Override public EnumerableMergeJoin copy(RelTraitSet traitSet,
-      RexNode condition, RelNode left, RelNode right, JoinRelType joinType,
-      boolean semiJoinDone) {
-    final JoinInfo joinInfo = JoinInfo.of(left, right, condition);
-    assert joinInfo.isEqui();
-    try {
-      return new EnumerableMergeJoin(getCluster(), traitSet, left, right,
-          condition, joinInfo.leftKeys, joinInfo.rightKeys, variablesSet,
-          joinType);
-    } catch (InvalidRelException e) {
-      // Semantic error not possible. Must be a bug. Convert to
-      // internal error.
-      throw new AssertionError(e);
-    }
-  }
-
-  @Override public RelOptCost computeSelfCost(RelOptPlanner planner,
-      RelMetadataQuery mq) {
-    // We assume that the inputs are sorted. The price of sorting them has
-    // already been paid. The cost of the join is therefore proportional to the
-    // input and output size.
-    final double rightRowCount = right.estimateRowCount(mq);
-    final double leftRowCount = left.estimateRowCount(mq);
-    final double rowCount = mq.getRowCount(this);
-    final double d = leftRowCount + rightRowCount + rowCount;
-    return planner.getCostFactory().makeCost(d, 0, 0);
-  }
-
-  public Result implement(EnumerableRelImplementor implementor, Prefer pref) {
-    BlockBuilder builder = new BlockBuilder();
-    final Result leftResult =
-        implementor.visitChild(this, 0, (EnumerableRel) left, pref);
-    final Expression leftExpression =
-        builder.append("left", leftResult.block);
-    final ParameterExpression left_ =
-        Expressions.parameter(leftResult.physType.getJavaRowType(), "left");
-    final Result rightResult =
-        implementor.visitChild(this, 1, (EnumerableRel) right, pref);
-    final Expression rightExpression =
-        builder.append("right", rightResult.block);
-    final ParameterExpression right_ =
-        Expressions.parameter(rightResult.physType.getJavaRowType(), "right");
-    final JavaTypeFactory typeFactory = implementor.getTypeFactory();
-    final PhysType physType =
-        PhysTypeImpl.of(typeFactory, getRowType(), pref.preferArray());
-    final List<Expression> leftExpressions = new ArrayList<>();
-    final List<Expression> rightExpressions = new ArrayList<>();
-    for (Pair<Integer, Integer> pair : Pair.zip(leftKeys, rightKeys)) {
-      final RelDataType keyType =
-          typeFactory.leastRestrictive(
-              ImmutableList.of(
-                  left.getRowType().getFieldList().get(pair.left).getType(),
-                  right.getRowType().getFieldList().get(pair.right).getType()));
-      final Type keyClass = typeFactory.getJavaClass(keyType);
-      leftExpressions.add(
-         Types.castIfNecessary(keyClass,
-             leftResult.physType.fieldReference(left_, pair.left)));
-      rightExpressions.add(
-         Types.castIfNecessary(keyClass,
-             rightResult.physType.fieldReference(right_, pair.right)));
-    }
-    final PhysType leftKeyPhysType =
-        leftResult.physType.project(leftKeys, JavaRowFormat.LIST);
-    final PhysType rightKeyPhysType =
-        rightResult.physType.project(rightKeys, JavaRowFormat.LIST);
-    return implementor.result(
-        physType,
-        builder.append(
-            Expressions.call(
-                BuiltInMethod.MERGE_JOIN.method,
-                Expressions.list(
-                    leftExpression,
-                    rightExpression,
-                    Expressions.lambda(
-                        leftKeyPhysType.record(leftExpressions), left_),
-                    Expressions.lambda(
-                        rightKeyPhysType.record(rightExpressions), right_),
-                    EnumUtils.joinSelector(joinType,
-                        physType,
-                        ImmutableList.of(
-                            leftResult.physType, rightResult.physType)),
-                    Expressions.constant(
-                        joinType.generatesNullsOnLeft()),
-                    Expressions.constant(
-                        joinType.generatesNullsOnRight())))).toBlock());
-  }
-}
-
-// End EnumerableMergeJoin.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableMergeJoinRule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableMergeJoinRule.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableMergeJoinRule.java
deleted file mode 100644
index 222111c..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableMergeJoinRule.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.linq4j.Ord;
-import org.apache.calcite.plan.Convention;
-import org.apache.calcite.plan.RelOptCluster;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.InvalidRelException;
-import org.apache.calcite.rel.RelCollation;
-import org.apache.calcite.rel.RelCollations;
-import org.apache.calcite.rel.RelFieldCollation;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.convert.ConverterRule;
-import org.apache.calcite.rel.core.JoinInfo;
-import org.apache.calcite.rel.core.JoinRelType;
-import org.apache.calcite.rel.logical.LogicalJoin;
-
-import com.google.common.collect.Lists;
-
-import java.util.List;
-
-/** Planner rule that converts a
- * {@link org.apache.calcite.rel.logical.LogicalJoin} relational expression
- * {@link EnumerableConvention enumerable calling convention}.
- *
- * @see org.apache.calcite.adapter.enumerable.EnumerableJoinRule
- */
-class EnumerableMergeJoinRule extends ConverterRule {
-  EnumerableMergeJoinRule() {
-    super(LogicalJoin.class,
-        Convention.NONE,
-        EnumerableConvention.INSTANCE,
-        "EnumerableMergeJoinRule");
-  }
-
-  @Override public RelNode convert(RelNode rel) {
-    LogicalJoin join = (LogicalJoin) rel;
-    final JoinInfo info =
-        JoinInfo.of(join.getLeft(), join.getRight(), join.getCondition());
-    if (join.getJoinType() != JoinRelType.INNER) {
-      // EnumerableMergeJoin only supports inner join.
-      // (It supports non-equi join, using a post-filter; see below.)
-      return null;
-    }
-    if (info.pairs().size() == 0) {
-      // EnumerableMergeJoin CAN support cartesian join, but disable it for now.
-      return null;
-    }
-    final List<RelNode> newInputs = Lists.newArrayList();
-    final List<RelCollation> collations = Lists.newArrayList();
-    int offset = 0;
-    for (Ord<RelNode> ord : Ord.zip(join.getInputs())) {
-      RelTraitSet traits = ord.e.getTraitSet()
-          .replace(EnumerableConvention.INSTANCE);
-      if (!info.pairs().isEmpty()) {
-        final List<RelFieldCollation> fieldCollations = Lists.newArrayList();
-        for (int key : info.keys().get(ord.i)) {
-          fieldCollations.add(
-              new RelFieldCollation(key,
-                  RelFieldCollation.Direction.ASCENDING,
-                  RelFieldCollation.NullDirection.LAST));
-        }
-        final RelCollation collation = RelCollations.of(fieldCollations);
-        collations.add(RelCollations.shift(collation, offset));
-        traits = traits.replace(collation);
-      }
-      newInputs.add(convert(ord.e, traits));
-      offset += ord.e.getRowType().getFieldCount();
-    }
-    final RelNode left = newInputs.get(0);
-    final RelNode right = newInputs.get(1);
-    final RelOptCluster cluster = join.getCluster();
-    RelNode newRel;
-    try {
-      RelTraitSet traits = join.getTraitSet()
-          .replace(EnumerableConvention.INSTANCE);
-      if (!collations.isEmpty()) {
-        traits = traits.replace(collations);
-      }
-      newRel = new EnumerableMergeJoin(cluster,
-          traits,
-          left,
-          right,
-          info.getEquiCondition(left, right, cluster.getRexBuilder()),
-          info.leftKeys,
-          info.rightKeys,
-          join.getVariablesSet(),
-          join.getJoinType());
-    } catch (InvalidRelException e) {
-      EnumerableRules.LOGGER.debug(e.toString());
-      return null;
-    }
-    if (!info.isEqui()) {
-      newRel = new EnumerableFilter(cluster, newRel.getTraitSet(),
-          newRel, info.getRemaining(cluster.getRexBuilder()));
-    }
-    return newRel;
-  }
-}
-
-// End EnumerableMergeJoinRule.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableMinus.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableMinus.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableMinus.java
deleted file mode 100644
index 7ed4edb..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableMinus.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.linq4j.Ord;
-import org.apache.calcite.linq4j.tree.BlockBuilder;
-import org.apache.calcite.linq4j.tree.Expression;
-import org.apache.calcite.linq4j.tree.Expressions;
-import org.apache.calcite.plan.RelOptCluster;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.core.Minus;
-import org.apache.calcite.util.BuiltInMethod;
-
-import java.util.List;
-
-/** Implementation of {@link org.apache.calcite.rel.core.Minus} in
- * {@link org.apache.calcite.adapter.enumerable.EnumerableConvention enumerable calling convention}. */
-public class EnumerableMinus extends Minus implements EnumerableRel {
-  public EnumerableMinus(RelOptCluster cluster, RelTraitSet traitSet,
-      List<RelNode> inputs, boolean all) {
-    super(cluster, traitSet, inputs, all);
-    assert !all;
-  }
-
-  public EnumerableMinus copy(RelTraitSet traitSet, List<RelNode> inputs,
-      boolean all) {
-    return new EnumerableMinus(getCluster(), traitSet, inputs, all);
-  }
-
-  public Result implement(EnumerableRelImplementor implementor, Prefer pref) {
-    final BlockBuilder builder = new BlockBuilder();
-    Expression minusExp = null;
-    for (Ord<RelNode> ord : Ord.zip(inputs)) {
-      EnumerableRel input = (EnumerableRel) ord.e;
-      final Result result = implementor.visitChild(this, ord.i, input, pref);
-      Expression childExp =
-          builder.append(
-              "child" + ord.i,
-              result.block);
-
-      if (minusExp == null) {
-        minusExp = childExp;
-      } else {
-        minusExp =
-            Expressions.call(minusExp,
-                BuiltInMethod.EXCEPT.method,
-                Expressions.list(childExp)
-                    .appendIfNotNull(result.physType.comparer()));
-      }
-
-      // Once the first input has chosen its format, ask for the same for
-      // other inputs.
-      pref = pref.of(result.format);
-    }
-
-    builder.add(minusExp);
-    final PhysType physType =
-        PhysTypeImpl.of(
-            implementor.getTypeFactory(),
-            getRowType(),
-            pref.prefer(JavaRowFormat.CUSTOM));
-    return implementor.result(physType, builder.toBlock());
-  }
-}
-
-// End EnumerableMinus.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableMinusRule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableMinusRule.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableMinusRule.java
deleted file mode 100644
index 4cbf263..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableMinusRule.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.plan.Convention;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.convert.ConverterRule;
-import org.apache.calcite.rel.logical.LogicalMinus;
-
-/**
- * Rule to convert an {@link org.apache.calcite.rel.logical.LogicalMinus} to an
- * {@link EnumerableMinus}.
- */
-class EnumerableMinusRule extends ConverterRule {
-  EnumerableMinusRule() {
-    super(LogicalMinus.class, Convention.NONE, EnumerableConvention.INSTANCE,
-        "EnumerableMinusRule");
-  }
-
-  public RelNode convert(RelNode rel) {
-    final LogicalMinus minus = (LogicalMinus) rel;
-    if (minus.all) {
-      return null; // EXCEPT ALL not implemented
-    }
-    final EnumerableConvention out = EnumerableConvention.INSTANCE;
-    final RelTraitSet traitSet =
-        rel.getTraitSet().replace(
-            EnumerableConvention.INSTANCE);
-    return new EnumerableMinus(rel.getCluster(), traitSet,
-        convertList(minus.getInputs(), out), false);
-  }
-}
-
-// End EnumerableMinusRule.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableProject.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableProject.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableProject.java
deleted file mode 100644
index fa2b48b..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableProject.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.plan.RelOptCluster;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.RelCollation;
-import org.apache.calcite.rel.RelCollationTraitDef;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.core.Project;
-import org.apache.calcite.rel.metadata.RelMdCollation;
-import org.apache.calcite.rel.metadata.RelMetadataQuery;
-import org.apache.calcite.rel.type.RelDataType;
-import org.apache.calcite.rex.RexNode;
-import org.apache.calcite.util.Util;
-
-import com.google.common.base.Supplier;
-
-import java.util.List;
-
-/** Implementation of {@link org.apache.calcite.rel.core.Project} in
- * {@link org.apache.calcite.adapter.enumerable.EnumerableConvention enumerable calling convention}. */
-public class EnumerableProject extends Project implements EnumerableRel {
-  /**
-   * Creates an EnumerableProject.
-   *
-   * <p>Use {@link #create} unless you know what you're doing.
-   *
-   * @param cluster  Cluster this relational expression belongs to
-   * @param traitSet Traits of this relational expression
-   * @param input    Input relational expression
-   * @param projects List of expressions for the input columns
-   * @param rowType  Output row type
-   */
-  public EnumerableProject(
-      RelOptCluster cluster,
-      RelTraitSet traitSet,
-      RelNode input,
-      List<? extends RexNode> projects,
-      RelDataType rowType) {
-    super(cluster, traitSet, input, projects, rowType);
-    assert getConvention() instanceof EnumerableConvention;
-  }
-
-  @Deprecated // to be removed before 2.0
-  public EnumerableProject(RelOptCluster cluster, RelTraitSet traitSet,
-      RelNode input, List<? extends RexNode> projects, RelDataType rowType,
-      int flags) {
-    this(cluster, traitSet, input, projects, rowType);
-    Util.discard(flags);
-  }
-
-  /** Creates an EnumerableProject, specifying row type rather than field
-   * names. */
-  public static EnumerableProject create(final RelNode input,
-      final List<? extends RexNode> projects, RelDataType rowType) {
-    final RelOptCluster cluster = input.getCluster();
-    final RelMetadataQuery mq = RelMetadataQuery.instance();
-    final RelTraitSet traitSet =
-        cluster.traitSet().replace(EnumerableConvention.INSTANCE)
-            .replaceIfs(RelCollationTraitDef.INSTANCE,
-                new Supplier<List<RelCollation>>() {
-                  public List<RelCollation> get() {
-                    return RelMdCollation.project(mq, input, projects);
-                  }
-                });
-    return new EnumerableProject(cluster, traitSet, input, projects, rowType);
-  }
-
-  public EnumerableProject copy(RelTraitSet traitSet, RelNode input,
-      List<RexNode> projects, RelDataType rowType) {
-    return new EnumerableProject(getCluster(), traitSet, input,
-        projects, rowType);
-  }
-
-  public Result implement(EnumerableRelImplementor implementor, Prefer pref) {
-    // EnumerableCalcRel is always better
-    throw new UnsupportedOperationException();
-  }
-}
-
-// End EnumerableProject.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableProjectRule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableProjectRule.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableProjectRule.java
deleted file mode 100644
index 3f998da..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableProjectRule.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.plan.Convention;
-import org.apache.calcite.plan.RelOptUtil;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.convert.ConverterRule;
-import org.apache.calcite.rel.logical.LogicalProject;
-
-/**
- * Rule to convert a {@link org.apache.calcite.rel.logical.LogicalProject} to an
- * {@link EnumerableProject}.
- */
-class EnumerableProjectRule extends ConverterRule {
-  EnumerableProjectRule() {
-    super(LogicalProject.class, RelOptUtil.PROJECT_PREDICATE, Convention.NONE,
-        EnumerableConvention.INSTANCE, "EnumerableProjectRule");
-  }
-
-  public RelNode convert(RelNode rel) {
-    final LogicalProject project = (LogicalProject) rel;
-    return EnumerableProject.create(
-        convert(project.getInput(),
-            project.getInput().getTraitSet()
-                .replace(EnumerableConvention.INSTANCE)),
-        project.getProjects(),
-        project.getRowType());
-  }
-}
-
-// End EnumerableProjectRule.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableProjectToCalcRule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableProjectToCalcRule.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableProjectToCalcRule.java
deleted file mode 100644
index 2e1a4a8..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableProjectToCalcRule.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.plan.RelOptRule;
-import org.apache.calcite.plan.RelOptRuleCall;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rex.RexProgram;
-
-/** Variant of {@link org.apache.calcite.rel.rules.ProjectToCalcRule} for
- * {@link org.apache.calcite.adapter.enumerable.EnumerableConvention enumerable calling convention}. */
-public class EnumerableProjectToCalcRule extends RelOptRule {
-  EnumerableProjectToCalcRule() {
-    super(operand(EnumerableProject.class, any()));
-  }
-
-  public void onMatch(RelOptRuleCall call) {
-    final EnumerableProject project = call.rel(0);
-    final RelNode input = project.getInput();
-    final RexProgram program =
-        RexProgram.create(input.getRowType(),
-            project.getProjects(),
-            null,
-            project.getRowType(),
-            project.getCluster().getRexBuilder());
-    final EnumerableCalc calc = EnumerableCalc.create(input, program);
-    call.transformTo(calc);
-  }
-}
-
-// End EnumerableProjectToCalcRule.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableRel.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableRel.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableRel.java
deleted file mode 100644
index 5f9b7d3..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableRel.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.linq4j.tree.BlockStatement;
-import org.apache.calcite.plan.RelOptCluster;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.core.RelFactories;
-import org.apache.calcite.rel.type.RelDataType;
-import org.apache.calcite.rex.RexNode;
-import org.apache.calcite.rex.RexUtil;
-import org.apache.calcite.sql.validate.SqlValidatorUtil;
-
-import java.util.List;
-
-/**
- * A relational expression of one of the
- * {@link org.apache.calcite.adapter.enumerable.EnumerableConvention} calling
- * conventions.
- */
-public interface EnumerableRel
-    extends RelNode {
-  RelFactories.FilterFactory FILTER_FACTORY =
-      new RelFactories.FilterFactory() {
-        public RelNode createFilter(RelNode child, RexNode condition) {
-          return EnumerableFilter.create(child, condition);
-        }
-      };
-
-  RelFactories.ProjectFactory PROJECT_FACTORY =
-      new RelFactories.ProjectFactory() {
-        public RelNode createProject(RelNode child,
-            List<? extends RexNode> projects, List<String> fieldNames) {
-          final RelOptCluster cluster = child.getCluster();
-          final RelDataType rowType =
-              RexUtil.createStructType(cluster.getTypeFactory(), projects,
-                  fieldNames, SqlValidatorUtil.F_SUGGESTER);
-          return EnumerableProject.create(child, projects, rowType);
-        }
-      };
-
-  //~ Methods ----------------------------------------------------------------
-
-  /**
-   * Creates a plan for this expression according to a calling convention.
-   *
-   * @param implementor Implementor
-   * @param pref Preferred representation for rows in result expression
-   * @return Plan for this expression according to a calling convention
-   */
-  Result implement(EnumerableRelImplementor implementor, Prefer pref);
-
-  /** Preferred physical type. */
-  enum Prefer {
-    /** Records must be represented as arrays. */
-    ARRAY,
-    /** Consumer would prefer that records are represented as arrays, but can
-     * accommodate records represented as objects. */
-    ARRAY_NICE,
-    /** Records must be represented as objects. */
-    CUSTOM,
-    /** Consumer would prefer that records are represented as objects, but can
-     * accommodate records represented as arrays. */
-    CUSTOM_NICE,
-    /** Consumer has no preferred representation. */
-    ANY;
-
-    public JavaRowFormat preferCustom() {
-      return prefer(JavaRowFormat.CUSTOM);
-    }
-
-    public JavaRowFormat preferArray() {
-      return prefer(JavaRowFormat.ARRAY);
-    }
-
-    public JavaRowFormat prefer(JavaRowFormat format) {
-      switch (this) {
-      case CUSTOM:
-        return JavaRowFormat.CUSTOM;
-      case ARRAY:
-        return JavaRowFormat.ARRAY;
-      default:
-        return format;
-      }
-    }
-
-    public Prefer of(JavaRowFormat format) {
-      switch (format) {
-      case ARRAY:
-        return ARRAY;
-      default:
-        return CUSTOM;
-      }
-    }
-  }
-
-  /** Result of implementing an enumerable relational expression by generating
-   * Java code. */
-  class Result {
-    public final BlockStatement block;
-
-    /**
-     * Describes the Java type returned by this relational expression, and the
-     * mapping between it and the fields of the logical row type.
-     */
-    public final PhysType physType;
-    public final JavaRowFormat format;
-
-    public Result(BlockStatement block, PhysType physType,
-        JavaRowFormat format) {
-      this.block = block;
-      this.physType = physType;
-      this.format = format;
-    }
-  }
-}
-
-// End EnumerableRel.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableRelImplementor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableRelImplementor.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableRelImplementor.java
deleted file mode 100644
index 6e9033c..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableRelImplementor.java
+++ /dev/null
@@ -1,535 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.DataContext;
-import org.apache.calcite.jdbc.JavaTypeFactoryImpl;
-import org.apache.calcite.linq4j.Enumerable;
-import org.apache.calcite.linq4j.function.Function1;
-import org.apache.calcite.linq4j.tree.BlockBuilder;
-import org.apache.calcite.linq4j.tree.BlockStatement;
-import org.apache.calcite.linq4j.tree.Blocks;
-import org.apache.calcite.linq4j.tree.ClassDeclaration;
-import org.apache.calcite.linq4j.tree.ConditionalStatement;
-import org.apache.calcite.linq4j.tree.ConstantExpression;
-import org.apache.calcite.linq4j.tree.Expression;
-import org.apache.calcite.linq4j.tree.Expressions;
-import org.apache.calcite.linq4j.tree.MemberDeclaration;
-import org.apache.calcite.linq4j.tree.MethodCallExpression;
-import org.apache.calcite.linq4j.tree.NewArrayExpression;
-import org.apache.calcite.linq4j.tree.NewExpression;
-import org.apache.calcite.linq4j.tree.ParameterExpression;
-import org.apache.calcite.linq4j.tree.Primitive;
-import org.apache.calcite.linq4j.tree.Statement;
-import org.apache.calcite.linq4j.tree.Types;
-import org.apache.calcite.linq4j.tree.VisitorImpl;
-import org.apache.calcite.rex.RexBuilder;
-import org.apache.calcite.runtime.Bindable;
-import org.apache.calcite.util.BuiltInMethod;
-
-import com.google.common.base.Function;
-import com.google.common.collect.Collections2;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Maps;
-
-import java.io.Serializable;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Subclass of {@link org.apache.calcite.plan.RelImplementor} for relational
- * operators of {@link EnumerableConvention} calling convention.
- */
-public class EnumerableRelImplementor extends JavaRelImplementor {
-  /** Maximum number of arguments to a constructor. See
-   * <a href="https://issues.apache.org/jira/browse/CALCITE-1097">[CALCITE-1097]
-   * Exception when executing query with too many aggregation columns</a> for
-   * details. */
-  private static final int MAX_CONSTRUCTOR_ARG_COUNT = 10;
-
-  public final Map<String, Object> map;
-  private final Map<String, RexToLixTranslator.InputGetter> corrVars =
-      Maps.newHashMap();
-  private final Map<Object, ParameterExpression> stashedParameters =
-      Maps.newIdentityHashMap();
-
-  protected final Function1<String, RexToLixTranslator.InputGetter>
-  allCorrelateVariables =
-    new Function1<String, RexToLixTranslator.InputGetter>() {
-      public RexToLixTranslator.InputGetter apply(String name) {
-        return getCorrelVariableGetter(name);
-      }
-    };
-
-  public EnumerableRelImplementor(RexBuilder rexBuilder,
-      Map<String, Object> internalParameters) {
-    super(rexBuilder);
-    this.map = internalParameters;
-  }
-
-  public EnumerableRel.Result visitChild(
-      EnumerableRel parent,
-      int ordinal,
-      EnumerableRel child,
-      EnumerableRel.Prefer prefer) {
-    if (parent != null) {
-      assert child == parent.getInputs().get(ordinal);
-    }
-    return child.implement(this, prefer);
-  }
-
-  public ClassDeclaration implementRoot(EnumerableRel rootRel,
-      EnumerableRel.Prefer prefer) {
-    final EnumerableRel.Result result = rootRel.implement(this, prefer);
-    final List<MemberDeclaration> memberDeclarations = new ArrayList<>();
-    new TypeRegistrar(memberDeclarations).go(result);
-
-    // The following is a workaround to
-    // http://jira.codehaus.org/browse/JANINO-169. Otherwise we'd remove the
-    // member variable, rename the "root0" parameter as "root", and reference it
-    // directly from inner classes.
-    final ParameterExpression root0_ =
-        Expressions.parameter(Modifier.FINAL, DataContext.class, "root0");
-
-    // This creates the following code
-    // final Integer v1stashed = (Integer) root.get("v1stashed")
-    // It is convenient for passing non-literal "compile-time" constants
-    final Collection<Statement> stashed =
-        Collections2.transform(stashedParameters.values(),
-            new Function<ParameterExpression, Statement>() {
-              public Statement apply(ParameterExpression input) {
-                return Expressions.declare(Modifier.FINAL, input,
-                    Expressions.convert_(
-                        Expressions.call(DataContext.ROOT,
-                            BuiltInMethod.DATA_CONTEXT_GET.method,
-                            Expressions.constant(input.name)),
-                        input.type));
-              }
-            });
-
-    final BlockStatement block = Expressions.block(
-        Iterables.concat(
-            ImmutableList.of(
-                Expressions.statement(
-                    Expressions.assign(DataContext.ROOT, root0_))),
-            stashed,
-            result.block.statements));
-    memberDeclarations.add(
-        Expressions.fieldDecl(0, DataContext.ROOT, null));
-
-    memberDeclarations.add(
-        Expressions.methodDecl(
-            Modifier.PUBLIC,
-            Enumerable.class,
-            BuiltInMethod.BINDABLE_BIND.method.getName(),
-            Expressions.list(root0_),
-            block));
-    memberDeclarations.add(
-        Expressions.methodDecl(Modifier.PUBLIC, Class.class,
-            BuiltInMethod.TYPED_GET_ELEMENT_TYPE.method.getName(),
-            Collections.<ParameterExpression>emptyList(),
-            Blocks.toFunctionBlock(
-                Expressions.return_(null,
-                    Expressions.constant(result.physType.getJavaRowType())))));
-    return Expressions.classDecl(Modifier.PUBLIC,
-        "Baz",
-        null,
-        Collections.<Type>singletonList(Bindable.class),
-        memberDeclarations);
-  }
-
-  private ClassDeclaration classDecl(
-      JavaTypeFactoryImpl.SyntheticRecordType type) {
-    ClassDeclaration classDeclaration =
-        Expressions.classDecl(
-            Modifier.PUBLIC | Modifier.STATIC,
-            type.getName(),
-            null,
-            ImmutableList.<Type>of(Serializable.class),
-            new ArrayList<MemberDeclaration>());
-
-    // For each field:
-    //   public T0 f0;
-    //   ...
-    for (Types.RecordField field : type.getRecordFields()) {
-      classDeclaration.memberDeclarations.add(
-          Expressions.fieldDecl(
-              field.getModifiers(),
-              Expressions.parameter(
-                  field.getType(), field.getName()),
-              null));
-    }
-
-    // Constructor:
-    //   Foo(T0 f0, ...) { this.f0 = f0; ... }
-    final BlockBuilder blockBuilder = new BlockBuilder();
-    final List<ParameterExpression> parameters = new ArrayList<>();
-    final ParameterExpression thisParameter =
-        Expressions.parameter(type, "this");
-
-    // Here a constructor without parameter is used because the generated
-    // code could cause error if number of fields is too large.
-    classDeclaration.memberDeclarations.add(
-        Expressions.constructorDecl(
-            Modifier.PUBLIC,
-            type,
-            parameters,
-            blockBuilder.toBlock()));
-
-    // equals method():
-    //   public boolean equals(Object o) {
-    //       if (this == o) return true;
-    //       if (!(o instanceof MyClass)) return false;
-    //       final MyClass that = (MyClass) o;
-    //       return this.f0 == that.f0
-    //         && equal(this.f1, that.f1)
-    //         ...
-    //   }
-    final BlockBuilder blockBuilder2 = new BlockBuilder();
-    final ParameterExpression thatParameter =
-        Expressions.parameter(type, "that");
-    final ParameterExpression oParameter =
-        Expressions.parameter(Object.class, "o");
-    blockBuilder2.add(
-        Expressions.ifThen(
-            Expressions.equal(thisParameter, oParameter),
-            Expressions.return_(null, Expressions.constant(true))));
-    blockBuilder2.add(
-        Expressions.ifThen(
-            Expressions.not(
-                Expressions.typeIs(oParameter, type)),
-            Expressions.return_(null, Expressions.constant(false))));
-    blockBuilder2.add(
-        Expressions.declare(
-            Modifier.FINAL,
-            thatParameter,
-            Expressions.convert_(oParameter, type)));
-    final List<Expression> conditions = new ArrayList<>();
-    for (Types.RecordField field : type.getRecordFields()) {
-      conditions.add(
-          Primitive.is(field.getType())
-              ? Expressions.equal(
-                  Expressions.field(thisParameter, field.getName()),
-                  Expressions.field(thatParameter, field.getName()))
-              : Expressions.call(BuiltInMethod.OBJECTS_EQUAL.method,
-                  Expressions.field(thisParameter, field.getName()),
-                  Expressions.field(thatParameter, field.getName())));
-    }
-    blockBuilder2.add(
-        Expressions.return_(null, Expressions.foldAnd(conditions)));
-    classDeclaration.memberDeclarations.add(
-        Expressions.methodDecl(
-            Modifier.PUBLIC,
-            boolean.class,
-            "equals",
-            Collections.singletonList(oParameter),
-            blockBuilder2.toBlock()));
-
-    // hashCode method:
-    //   public int hashCode() {
-    //     int h = 0;
-    //     h = hash(h, f0);
-    //     ...
-    //     return h;
-    //   }
-    final BlockBuilder blockBuilder3 = new BlockBuilder();
-    final ParameterExpression hParameter =
-        Expressions.parameter(int.class, "h");
-    final ConstantExpression constantZero =
-        Expressions.constant(0);
-    blockBuilder3.add(
-        Expressions.declare(0, hParameter, constantZero));
-    for (Types.RecordField field : type.getRecordFields()) {
-      final Method method = BuiltInMethod.HASH.method;
-      blockBuilder3.add(
-          Expressions.statement(
-              Expressions.assign(
-                  hParameter,
-                  Expressions.call(
-                      method.getDeclaringClass(),
-                      method.getName(),
-                      ImmutableList.of(
-                          hParameter,
-                          Expressions.field(thisParameter, field))))));
-    }
-    blockBuilder3.add(
-        Expressions.return_(null, hParameter));
-    classDeclaration.memberDeclarations.add(
-        Expressions.methodDecl(
-            Modifier.PUBLIC,
-            int.class,
-            "hashCode",
-            Collections.<ParameterExpression>emptyList(),
-            blockBuilder3.toBlock()));
-
-    // compareTo method:
-    //   public int compareTo(MyClass that) {
-    //     int c;
-    //     c = compare(this.f0, that.f0);
-    //     if (c != 0) return c;
-    //     ...
-    //     return 0;
-    //   }
-    final BlockBuilder blockBuilder4 = new BlockBuilder();
-    final ParameterExpression cParameter =
-        Expressions.parameter(int.class, "c");
-    final int mod = type.getRecordFields().size() == 1 ? Modifier.FINAL : 0;
-    blockBuilder4.add(
-        Expressions.declare(mod, cParameter, null));
-    final ConditionalStatement conditionalStatement =
-        Expressions.ifThen(
-            Expressions.notEqual(cParameter, constantZero),
-            Expressions.return_(null, cParameter));
-    for (Types.RecordField field : type.getRecordFields()) {
-      MethodCallExpression compareCall;
-      try {
-        final Method method = (field.nullable()
-            ? BuiltInMethod.COMPARE_NULLS_LAST
-            : BuiltInMethod.COMPARE).method;
-        compareCall = Expressions.call(method.getDeclaringClass(),
-            method.getName(),
-            Expressions.field(thisParameter, field),
-            Expressions.field(thatParameter, field));
-      } catch (RuntimeException e) {
-        if (e.getCause() instanceof NoSuchMethodException) {
-          // Just ignore the field in compareTo
-          // "create synthetic record class" blindly creates compareTo for
-          // all the fields, however not all the records will actually be used
-          // as sorting keys (e.g. temporary state for aggregate calculation).
-          // In those cases it is fine if we skip the problematic fields.
-          continue;
-        }
-        throw e;
-      }
-      blockBuilder4.add(
-          Expressions.statement(
-              Expressions.assign(
-                  cParameter,
-                  compareCall)));
-      blockBuilder4.add(conditionalStatement);
-    }
-    blockBuilder4.add(
-        Expressions.return_(null, constantZero));
-    classDeclaration.memberDeclarations.add(
-        Expressions.methodDecl(
-            Modifier.PUBLIC,
-            int.class,
-            "compareTo",
-            Collections.singletonList(thatParameter),
-            blockBuilder4.toBlock()));
-
-    // toString method:
-    //   public String toString() {
-    //     return "{f0=" + f0
-    //       + ", f1=" + f1
-    //       ...
-    //       + "}";
-    //   }
-    final BlockBuilder blockBuilder5 = new BlockBuilder();
-    Expression expression5 = null;
-    for (Types.RecordField field : type.getRecordFields()) {
-      if (expression5 == null) {
-        expression5 =
-            Expressions.constant("{" + field.getName() + "=");
-      } else {
-        expression5 =
-            Expressions.add(
-                expression5,
-                Expressions.constant(", " + field.getName() + "="));
-      }
-      expression5 =
-          Expressions.add(
-              expression5,
-              Expressions.field(thisParameter, field.getName()));
-    }
-    expression5 =
-        expression5 == null
-            ? Expressions.constant("{}")
-            : Expressions.add(
-                expression5,
-                Expressions.constant("}"));
-    blockBuilder5.add(
-        Expressions.return_(
-            null,
-            expression5));
-    classDeclaration.memberDeclarations.add(
-        Expressions.methodDecl(
-            Modifier.PUBLIC,
-            String.class,
-            "toString",
-            Collections.<ParameterExpression>emptyList(),
-            blockBuilder5.toBlock()));
-
-    return classDeclaration;
-  }
-
-  /**
-   * Stashes a value for the executor. Given values are de-duplicated if
-   * identical (see {@link java.util.IdentityHashMap}).
-   *
-   * <p>For instance, to pass {@code ArrayList} to your method, you can use
-   * {@code Expressions.call(method, implementor.stash(arrayList))}.
-   *
-   * <p>For simple literals (strings, numbers) the result is equivalent to
-   * {@link org.apache.calcite.linq4j.tree.Expressions#constant(Object, java.lang.reflect.Type)}.
-   *
-   * <p>Note: the input value is held in memory as long as the statement
-   * is alive. If you are using just a subset of its content, consider creating
-   * a slimmer holder.
-   *
-   * @param input Value to be stashed
-   * @param clazz Java class type of the value when it is used
-   * @param <T> Java class type of the value when it is used
-   * @return Expression that will represent {@code input} in runtime
-   */
-  public <T> Expression stash(T input, Class<? super T> clazz) {
-    // Well-known final classes that can be used as literals
-    if (input == null
-        || input instanceof String
-        || input instanceof Boolean
-        || input instanceof Byte
-        || input instanceof Short
-        || input instanceof Integer
-        || input instanceof Long
-        || input instanceof Float
-        || input instanceof Double
-        ) {
-      return Expressions.constant(input, clazz);
-    }
-    ParameterExpression cached = stashedParameters.get(input);
-    if (cached != null) {
-      return cached;
-    }
-    // "stashed" avoids name clash since this name will be used as the variable
-    // name at the very start of the method.
-    final String name = "v" + map.size() + "stashed";
-    final ParameterExpression x = Expressions.variable(clazz, name);
-    map.put(name, input);
-    stashedParameters.put(input, x);
-    return x;
-  }
-
-  public void registerCorrelVariable(final String name,
-      final ParameterExpression pe,
-      final BlockBuilder corrBlock, final PhysType physType) {
-    corrVars.put(name, new RexToLixTranslator.InputGetter() {
-      public Expression field(BlockBuilder list, int index, Type storageType) {
-        Expression fieldReference =
-            physType.fieldReference(pe, index, storageType);
-        return corrBlock.append(name + "_" + index, fieldReference);
-      }
-    });
-  }
-
-  public void clearCorrelVariable(String name) {
-    assert corrVars.containsKey(name) : "Correlation variable " + name
-        + " should be defined";
-    corrVars.remove(name);
-  }
-
-  public RexToLixTranslator.InputGetter getCorrelVariableGetter(String name) {
-    assert corrVars.containsKey(name) : "Correlation variable " + name
-        + " should be defined";
-    return corrVars.get(name);
-  }
-
-  public EnumerableRel.Result result(PhysType physType, BlockStatement block) {
-    return new EnumerableRel.Result(
-        block, physType, ((PhysTypeImpl) physType).format);
-  }
-
-  /** Visitor that finds types in an {@link Expression} tree. */
-  private static class TypeFinder extends VisitorImpl<Void> {
-    private final Collection<Type> types;
-
-    TypeFinder(Collection<Type> types) {
-      this.types = types;
-    }
-
-    @Override public Void visit(NewExpression newExpression) {
-      types.add(newExpression.type);
-      return super.visit(newExpression);
-    }
-
-    @Override public Void visit(NewArrayExpression newArrayExpression) {
-      Type type = newArrayExpression.type;
-      for (;;) {
-        final Type componentType = Types.getComponentType(type);
-        if (componentType == null) {
-          break;
-        }
-        type = componentType;
-      }
-      types.add(type);
-      return super.visit(newArrayExpression);
-    }
-
-    @Override public Void visit(ConstantExpression constantExpression) {
-      if (constantExpression.value instanceof Type) {
-        types.add((Type) constantExpression.value);
-      }
-      return super.visit(constantExpression);
-    }
-  }
-
-  /** Adds a declaration of each synthetic type found in a code block. */
-  private class TypeRegistrar {
-    private final List<MemberDeclaration> memberDeclarations;
-    private final Set<Type> seen = new HashSet<>();
-
-    TypeRegistrar(List<MemberDeclaration> memberDeclarations) {
-      this.memberDeclarations = memberDeclarations;
-    }
-
-    private void register(Type type) {
-      if (!seen.add(type)) {
-        return;
-      }
-      if (type instanceof JavaTypeFactoryImpl.SyntheticRecordType) {
-        memberDeclarations.add(
-            classDecl((JavaTypeFactoryImpl.SyntheticRecordType) type));
-      }
-      if (type instanceof ParameterizedType) {
-        for (Type type1 : ((ParameterizedType) type).getActualTypeArguments()) {
-          register(type1);
-        }
-      }
-    }
-
-    public void go(EnumerableRel.Result result) {
-      final Set<Type> types = new LinkedHashSet<>();
-      result.block.accept(new TypeFinder(types));
-      types.add(result.physType.getJavaRowType());
-      for (Type type : types) {
-        register(type);
-      }
-    }
-  }
-}
-
-// End EnumerableRelImplementor.java


[25/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/server/src/main/java/org/apache/calcite/avatica/jdbc/JdbcResultSet.java
----------------------------------------------------------------------
diff --git a/avatica/server/src/main/java/org/apache/calcite/avatica/jdbc/JdbcResultSet.java b/avatica/server/src/main/java/org/apache/calcite/avatica/jdbc/JdbcResultSet.java
deleted file mode 100644
index 17b33f8..0000000
--- a/avatica/server/src/main/java/org/apache/calcite/avatica/jdbc/JdbcResultSet.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.jdbc;
-
-import org.apache.calcite.avatica.AvaticaStatement;
-import org.apache.calcite.avatica.Meta;
-import org.apache.calcite.avatica.util.DateTimeUtils;
-
-import java.sql.Array;
-import java.sql.Date;
-import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
-import java.sql.SQLException;
-import java.sql.Struct;
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.sql.Types;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.List;
-import java.util.TreeMap;
-
-/** Implementation of {@link org.apache.calcite.avatica.Meta.MetaResultSet}
- *  upon a JDBC {@link java.sql.ResultSet}.
- *
- *  @see org.apache.calcite.avatica.jdbc.JdbcMeta */
-class JdbcResultSet extends Meta.MetaResultSet {
-  protected JdbcResultSet(String connectionId, int statementId,
-      boolean ownStatement, Meta.Signature signature, Meta.Frame firstFrame) {
-    this(connectionId, statementId, ownStatement, signature, firstFrame, -1L);
-  }
-
-  protected JdbcResultSet(String connectionId, int statementId,
-      boolean ownStatement, Meta.Signature signature, Meta.Frame firstFrame,
-      long updateCount) {
-    super(connectionId, statementId, ownStatement, signature, firstFrame, updateCount);
-  }
-
-  /** Creates a result set. */
-  public static JdbcResultSet create(String connectionId, int statementId,
-      ResultSet resultSet) {
-    // -1 still limits to 100 but -2 does not limit to any number
-    return create(connectionId, statementId, resultSet,
-        JdbcMeta.UNLIMITED_COUNT);
-  }
-
-  /** Creates a result set with maxRowCount.
-   *
-   * <p>If {@code maxRowCount} is -2 ({@link JdbcMeta#UNLIMITED_COUNT}),
-   * returns an unlimited number of rows in a single frame; any other
-   * negative value (typically -1) returns an unlimited number of rows
-   * in frames of the default frame size. */
-  public static JdbcResultSet create(String connectionId, int statementId,
-      ResultSet resultSet, int maxRowCount) {
-    try {
-      Meta.Signature sig = JdbcMeta.signature(resultSet.getMetaData());
-      return create(connectionId, statementId, resultSet, maxRowCount, sig);
-    } catch (SQLException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  public static JdbcResultSet create(String connectionId, int statementId,
-      ResultSet resultSet, int maxRowCount, Meta.Signature signature) {
-    try {
-      final Calendar calendar = DateTimeUtils.calendar();
-      final int fetchRowCount;
-      if (maxRowCount == JdbcMeta.UNLIMITED_COUNT) {
-        fetchRowCount = -1;
-      } else if (maxRowCount < 0L) {
-        fetchRowCount = AvaticaStatement.DEFAULT_FETCH_SIZE;
-      } else if (maxRowCount > AvaticaStatement.DEFAULT_FETCH_SIZE) {
-        fetchRowCount = AvaticaStatement.DEFAULT_FETCH_SIZE;
-      } else {
-        fetchRowCount = maxRowCount;
-      }
-      final Meta.Frame firstFrame = frame(null, resultSet, 0, fetchRowCount, calendar);
-      if (firstFrame.done) {
-        resultSet.close();
-      }
-      return new JdbcResultSet(connectionId, statementId, true, signature,
-          firstFrame);
-    } catch (SQLException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  /** Creates a empty result set with empty frame */
-  public static JdbcResultSet empty(String connectionId, int statementId,
-      Meta.Signature signature) {
-    return new JdbcResultSet(connectionId, statementId, true, signature,
-        Meta.Frame.EMPTY);
-  }
-
-  /** Creates a result set that only has an update count. */
-  public static JdbcResultSet count(String connectionId, int statementId,
-      int updateCount) {
-    return new JdbcResultSet(connectionId, statementId, true, null, null, updateCount);
-  }
-
-  /** Creates a frame containing a given number or unlimited number of rows
-   * from a result set. */
-  static Meta.Frame frame(StatementInfo info, ResultSet resultSet, long offset,
-      int fetchMaxRowCount, Calendar calendar) throws SQLException {
-    final ResultSetMetaData metaData = resultSet.getMetaData();
-    final int columnCount = metaData.getColumnCount();
-    final int[] types = new int[columnCount];
-    for (int i = 0; i < types.length; i++) {
-      types[i] = metaData.getColumnType(i + 1);
-    }
-    final List<Object> rows = new ArrayList<>();
-    // Meta prepare/prepareAndExecute 0 return 0 row and done
-    boolean done = fetchMaxRowCount == 0;
-    for (int i = 0; fetchMaxRowCount < 0 || i < fetchMaxRowCount; i++) {
-      final boolean hasRow;
-      if (null != info) {
-        hasRow = info.next();
-      } else {
-        hasRow = resultSet.next();
-      }
-      if (!hasRow) {
-        done = true;
-        resultSet.close();
-        break;
-      }
-      Object[] columns = new Object[columnCount];
-      for (int j = 0; j < columnCount; j++) {
-        columns[j] = getValue(resultSet, types[j], j, calendar);
-      }
-      rows.add(columns);
-    }
-    return new Meta.Frame(offset, done, rows);
-  }
-
-  private static Object getValue(ResultSet resultSet, int type, int j,
-      Calendar calendar) throws SQLException {
-    switch (type) {
-    case Types.BIGINT:
-      final long aLong = resultSet.getLong(j + 1);
-      return aLong == 0 && resultSet.wasNull() ? null : aLong;
-    case Types.INTEGER:
-      final int anInt = resultSet.getInt(j + 1);
-      return anInt == 0 && resultSet.wasNull() ? null : anInt;
-    case Types.SMALLINT:
-      final short aShort = resultSet.getShort(j + 1);
-      return aShort == 0 && resultSet.wasNull() ? null : aShort;
-    case Types.TINYINT:
-      final byte aByte = resultSet.getByte(j + 1);
-      return aByte == 0 && resultSet.wasNull() ? null : aByte;
-    case Types.DOUBLE:
-    case Types.FLOAT:
-      final double aDouble = resultSet.getDouble(j + 1);
-      return aDouble == 0D && resultSet.wasNull() ? null : aDouble;
-    case Types.REAL:
-      final float aFloat = resultSet.getFloat(j + 1);
-      return aFloat == 0D && resultSet.wasNull() ? null : aFloat;
-    case Types.DATE:
-      final Date aDate = resultSet.getDate(j + 1, calendar);
-      return aDate == null
-          ? null
-          : (int) (aDate.getTime() / DateTimeUtils.MILLIS_PER_DAY);
-    case Types.TIME:
-      final Time aTime = resultSet.getTime(j + 1, calendar);
-      return aTime == null
-          ? null
-          : (int) (aTime.getTime() % DateTimeUtils.MILLIS_PER_DAY);
-    case Types.TIMESTAMP:
-      final Timestamp aTimestamp = resultSet.getTimestamp(j + 1, calendar);
-      return aTimestamp == null ? null : aTimestamp.getTime();
-    case Types.ARRAY:
-      final Array array = resultSet.getArray(j + 1);
-      if (null == array) {
-        return null;
-      }
-      ResultSet arrayValues = array.getResultSet();
-      TreeMap<Integer, Object> map = new TreeMap<>();
-      while (arrayValues.next()) {
-        // column 1 is the index in the array, column 2 is the value.
-        // Recurse on `getValue` to unwrap nested types correctly.
-        // `j` is zero-indexed and incremented for us, thus we have `1` being used twice.
-        map.put(arrayValues.getInt(1), getValue(arrayValues, array.getBaseType(), 1, calendar));
-      }
-      // If the result set is not in the same order as the actual Array, TreeMap fixes that.
-      // Need to make a concrete list to ensure Jackson serialization.
-      //return new ListLike<Object>(new ArrayList<>(map.values()), ListLikeType.ARRAY);
-      return new ArrayList<>(map.values());
-    case Types.STRUCT:
-      Struct struct = resultSet.getObject(j + 1, Struct.class);
-      Object[] attrs = struct.getAttributes();
-      List<Object> list = new ArrayList<>(attrs.length);
-      for (Object o : attrs) {
-        list.add(o);
-      }
-      return list;
-    default:
-      return resultSet.getObject(j + 1);
-    }
-  }
-}
-
-// End JdbcResultSet.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/server/src/main/java/org/apache/calcite/avatica/jdbc/StatementInfo.java
----------------------------------------------------------------------
diff --git a/avatica/server/src/main/java/org/apache/calcite/avatica/jdbc/StatementInfo.java b/avatica/server/src/main/java/org/apache/calcite/avatica/jdbc/StatementInfo.java
deleted file mode 100644
index c4f8e21..0000000
--- a/avatica/server/src/main/java/org/apache/calcite/avatica/jdbc/StatementInfo.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.jdbc;
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.SQLFeatureNotSupportedException;
-import java.sql.Statement;
-
-/**
- * All we know about a statement. Encapsulates a {@link ResultSet}.
- */
-public class StatementInfo {
-  private volatile Boolean relativeSupported = null;
-
-  final Statement statement; // sometimes a PreparedStatement
-  private ResultSet resultSet;
-  private long position = 0;
-
-  // True when setResultSet(ResultSet) is called to let us determine the difference between
-  // a null ResultSet (from an update) from the lack of a ResultSet.
-  private boolean resultsInitialized = false;
-
-  public StatementInfo(Statement statement) {
-    // May be null when coming from a DatabaseMetaData call
-    this.statement = statement;
-  }
-
-  // Visible for testing
-  void setPosition(long position) {
-    this.position = position;
-  }
-
-  // Visible for testing
-  long getPosition() {
-    return this.position;
-  }
-
-  /**
-   * Set a ResultSet on this object.
-   *
-   * @param resultSet The current ResultSet
-   */
-  public void setResultSet(ResultSet resultSet) {
-    resultsInitialized = true;
-    this.resultSet = resultSet;
-  }
-
-  /**
-   * @return The {@link ResultSet} for this Statement, may be null.
-   */
-  public ResultSet getResultSet() {
-    return this.resultSet;
-  }
-
-  /**
-   * @return True if {@link #setResultSet(ResultSet)} was ever invoked.
-   */
-  public boolean isResultSetInitialized() {
-    return resultsInitialized;
-  }
-
-  /**
-   * @see ResultSet#next()
-   */
-  public boolean next() throws SQLException {
-    return _next(resultSet);
-  }
-
-  boolean _next(ResultSet results) throws SQLException {
-    boolean ret = results.next();
-    position++;
-    return ret;
-  }
-
-  /**
-   * Consumes <code>offset - position</code> elements from the {@link ResultSet}.
-   *
-   * @param offset The offset to advance to
-   * @return True if the resultSet was advanced to the current point, false if insufficient rows
-   *      were present to advance to the requested offset.
-   */
-  public boolean advanceResultSetToOffset(ResultSet results, long offset) throws SQLException {
-    if (offset < 0 || offset < position) {
-      throw new IllegalArgumentException("Offset should be "
-        + " non-negative and not less than the current position. " + offset + ", " + position);
-    }
-    if (position >= offset) {
-      return true;
-    }
-
-    if (null == relativeSupported) {
-      Boolean moreResults = null;
-      synchronized (this) {
-        if (null == relativeSupported) {
-          try {
-            moreResults = advanceByRelative(results, offset);
-            relativeSupported = true;
-          } catch (SQLFeatureNotSupportedException e) {
-            relativeSupported = false;
-          }
-        }
-      }
-
-      if (null != moreResults) {
-        // We figured out whether or not relative is supported.
-        // Make sure we actually do the necessary work.
-        if (!relativeSupported) {
-          // We avoided calling advanceByNext in the synchronized block earlier.
-          moreResults = advanceByNext(results, offset);
-        }
-
-        return moreResults;
-      }
-
-      // Another thread updated the RELATIVE_SUPPORTED before we did, fall through.
-    }
-
-    if (relativeSupported) {
-      return advanceByRelative(results, offset);
-    } else {
-      return advanceByNext(results, offset);
-    }
-  }
-
-  private boolean advanceByRelative(ResultSet results, long offset) throws SQLException {
-    long diff = offset - position;
-    while (diff > Integer.MAX_VALUE) {
-      if (!results.relative(Integer.MAX_VALUE)) {
-        // Avoid updating position until relative succeeds.
-        position += Integer.MAX_VALUE;
-        return false;
-      }
-      // Avoid updating position until relative succeeds.
-      position += Integer.MAX_VALUE;
-      diff -= Integer.MAX_VALUE;
-    }
-    boolean ret = results.relative((int) diff);
-    // Make sure we only update the position after successfully calling relative(int).
-    position += diff;
-    return ret;
-  }
-
-  private boolean advanceByNext(ResultSet results, long offset) throws SQLException {
-    while (position < offset) {
-      // Advance while maintaining `position`
-      if (!_next(results)) {
-        return false;
-      }
-    }
-
-    return true;
-  }
-}
-
-// End StatementInfo.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/server/src/main/java/org/apache/calcite/avatica/jdbc/package-info.java
----------------------------------------------------------------------
diff --git a/avatica/server/src/main/java/org/apache/calcite/avatica/jdbc/package-info.java b/avatica/server/src/main/java/org/apache/calcite/avatica/jdbc/package-info.java
deleted file mode 100644
index 8b8fb76..0000000
--- a/avatica/server/src/main/java/org/apache/calcite/avatica/jdbc/package-info.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * 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.
- */
-
-/** Implements an Avatica provider on top of an existing JDBC data source. */
-package org.apache.calcite.avatica.jdbc;
-
-
-// End package-info.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/server/src/main/java/org/apache/calcite/avatica/server/AbstractAvaticaHandler.java
----------------------------------------------------------------------
diff --git a/avatica/server/src/main/java/org/apache/calcite/avatica/server/AbstractAvaticaHandler.java b/avatica/server/src/main/java/org/apache/calcite/avatica/server/AbstractAvaticaHandler.java
deleted file mode 100644
index 3a7ccf3..0000000
--- a/avatica/server/src/main/java/org/apache/calcite/avatica/server/AbstractAvaticaHandler.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.server;
-
-import org.apache.calcite.avatica.AvaticaSeverity;
-import org.apache.calcite.avatica.remote.AuthenticationType;
-import org.apache.calcite.avatica.remote.Service.ErrorResponse;
-
-import org.eclipse.jetty.server.handler.AbstractHandler;
-
-import java.io.IOException;
-import java.net.HttpURLConnection;
-import java.util.Collections;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * Base-class for Avatica implemented Jetty Handlers.
- */
-public abstract class AbstractAvaticaHandler extends AbstractHandler
-    implements MetricsAwareAvaticaHandler {
-
-  private static final ErrorResponse UNAUTHORIZED_ERROR = new ErrorResponse(
-      Collections.<String>emptyList(), "User is not authenticated",
-      ErrorResponse.UNAUTHORIZED_ERROR_CODE, ErrorResponse.UNAUTHORIZED_SQL_STATE,
-      AvaticaSeverity.ERROR, null);
-
-  /**
-   * Determines if a request is permitted to be executed. The server may require authentication
-   * and the login mechanism might have failed. This check verifies that only authenticated
-   * users are permitted through when the server is requiring authentication. When a user
-   * is disallowed, a status code and response will be automatically written to the provided
-   * <code>response</code> and the caller should return immediately.
-   *
-   * @param serverConfig The server's configuration
-   * @param request The user's request
-   * @param response The response to the user's request
-   * @return True if request can proceed, false otherwise.
-   */
-  public boolean isUserPermitted(AvaticaServerConfiguration serverConfig,
-      HttpServletRequest request, HttpServletResponse response) throws IOException {
-    // Make sure that we drop any unauthenticated users out first.
-    if (null != serverConfig) {
-      if (AuthenticationType.SPNEGO == serverConfig.getAuthenticationType()) {
-        String remoteUser = request.getRemoteUser();
-        if (null == remoteUser) {
-          response.setStatus(HttpURLConnection.HTTP_UNAUTHORIZED);
-          response.getOutputStream().write(UNAUTHORIZED_ERROR.serialize().toByteArray());
-          return false;
-        }
-      }
-    }
-
-    return true;
-  }
-}
-
-// End AbstractAvaticaHandler.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/server/src/main/java/org/apache/calcite/avatica/server/AvaticaHandler.java
----------------------------------------------------------------------
diff --git a/avatica/server/src/main/java/org/apache/calcite/avatica/server/AvaticaHandler.java b/avatica/server/src/main/java/org/apache/calcite/avatica/server/AvaticaHandler.java
deleted file mode 100644
index 42b13c9..0000000
--- a/avatica/server/src/main/java/org/apache/calcite/avatica/server/AvaticaHandler.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.server;
-
-import org.apache.calcite.avatica.remote.Service.RpcMetadataResponse;
-
-import org.eclipse.jetty.server.Handler;
-
-/**
- * A custom interface that extends the Jetty interface to enable extra control within Avatica.
- */
-public interface AvaticaHandler extends Handler {
-
-  void setServerRpcMetadata(RpcMetadataResponse metadata);
-
-}
-
-// End AvaticaHandler.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/server/src/main/java/org/apache/calcite/avatica/server/AvaticaJsonHandler.java
----------------------------------------------------------------------
diff --git a/avatica/server/src/main/java/org/apache/calcite/avatica/server/AvaticaJsonHandler.java b/avatica/server/src/main/java/org/apache/calcite/avatica/server/AvaticaJsonHandler.java
deleted file mode 100644
index b639183..0000000
--- a/avatica/server/src/main/java/org/apache/calcite/avatica/server/AvaticaJsonHandler.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.server;
-
-import org.apache.calcite.avatica.AvaticaUtils;
-import org.apache.calcite.avatica.metrics.MetricsSystem;
-import org.apache.calcite.avatica.metrics.Timer;
-import org.apache.calcite.avatica.metrics.Timer.Context;
-import org.apache.calcite.avatica.metrics.noop.NoopMetricsSystem;
-import org.apache.calcite.avatica.remote.Handler.HandlerResponse;
-import org.apache.calcite.avatica.remote.JsonHandler;
-import org.apache.calcite.avatica.remote.Service;
-import org.apache.calcite.avatica.remote.Service.RpcMetadataResponse;
-import org.apache.calcite.avatica.util.UnsynchronizedBuffer;
-
-import org.eclipse.jetty.server.Request;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.Objects;
-import java.util.concurrent.Callable;
-
-import javax.servlet.ServletException;
-import javax.servlet.ServletInputStream;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import static org.apache.calcite.avatica.remote.MetricsHelper.concat;
-
-/**
- * Jetty handler that executes Avatica JSON request-responses.
- */
-public class AvaticaJsonHandler extends AbstractAvaticaHandler {
-  private static final Logger LOG = LoggerFactory.getLogger(AvaticaJsonHandler.class);
-
-  final Service service;
-  final JsonHandler jsonHandler;
-
-  final MetricsSystem metrics;
-  final Timer requestTimer;
-
-  final ThreadLocal<UnsynchronizedBuffer> threadLocalBuffer;
-
-  final AvaticaServerConfiguration serverConfig;
-
-  public AvaticaJsonHandler(Service service) {
-    this(service, NoopMetricsSystem.getInstance(), null);
-  }
-
-  public AvaticaJsonHandler(Service service, MetricsSystem metrics) {
-    this(service, metrics, null);
-  }
-
-  public AvaticaJsonHandler(Service service, MetricsSystem metrics,
-      AvaticaServerConfiguration serverConfig) {
-    this.service = Objects.requireNonNull(service);
-    this.metrics = Objects.requireNonNull(metrics);
-    // Avatica doesn't have a Guava dependency
-    this.jsonHandler = new JsonHandler(service, this.metrics);
-
-    // Metrics
-    this.requestTimer = this.metrics.getTimer(
-        concat(AvaticaJsonHandler.class, MetricsAwareAvaticaHandler.REQUEST_TIMER_NAME));
-
-    this.threadLocalBuffer = new ThreadLocal<UnsynchronizedBuffer>() {
-      @Override public UnsynchronizedBuffer initialValue() {
-        return new UnsynchronizedBuffer();
-      }
-    };
-
-    this.serverConfig = serverConfig;
-  }
-
-  public void handle(String target, Request baseRequest,
-      HttpServletRequest request, HttpServletResponse response)
-      throws IOException, ServletException {
-    try (final Context ctx = requestTimer.start()) {
-      if (!isUserPermitted(serverConfig, request, response)) {
-        LOG.debug("HTTP request from {} is unauthenticated and authentication is required",
-            request.getRemoteAddr());
-        return;
-      }
-
-      response.setContentType("application/json;charset=utf-8");
-      response.setStatus(HttpServletResponse.SC_OK);
-      if (request.getMethod().equals("POST")) {
-        // First look for a request in the header, then look in the body.
-        // The latter allows very large requests without hitting HTTP 413.
-        String rawRequest = request.getHeader("request");
-        if (rawRequest == null) {
-          // Avoid a new buffer creation for every HTTP request
-          final UnsynchronizedBuffer buffer = threadLocalBuffer.get();
-          try (ServletInputStream inputStream = request.getInputStream()) {
-            rawRequest = AvaticaUtils.readFully(inputStream, buffer);
-          } finally {
-            // Reset the offset into the buffer after we're done
-            buffer.reset();
-          }
-        }
-        final String jsonRequest =
-            new String(rawRequest.getBytes("ISO-8859-1"), "UTF-8");
-        LOG.trace("request: {}", jsonRequest);
-
-        HandlerResponse<String> jsonResponse;
-        try {
-          if (null != serverConfig && serverConfig.supportsImpersonation()) {
-            jsonResponse = serverConfig.doAsRemoteUser(request.getRemoteUser(),
-                request.getRemoteAddr(), new Callable<HandlerResponse<String>>() {
-                  @Override public HandlerResponse<String> call() {
-                    return jsonHandler.apply(jsonRequest);
-                  }
-                });
-          } else {
-            jsonResponse = jsonHandler.apply(jsonRequest);
-          }
-        } catch (Exception e) {
-          LOG.debug("Error invoking request from {}", baseRequest.getRemoteAddr(), e);
-          jsonResponse = jsonHandler.convertToErrorResponse(e);
-        }
-
-        LOG.trace("response: {}", jsonResponse);
-        baseRequest.setHandled(true);
-        // Set the status code and write out the response.
-        response.setStatus(jsonResponse.getStatusCode());
-        response.getWriter().println(jsonResponse.getResponse());
-      }
-    }
-  }
-
-  @Override public void setServerRpcMetadata(RpcMetadataResponse metadata) {
-    // Set the metadata for the normal service calls
-    service.setRpcMetadata(metadata);
-    // Also add it to the handler to include with exceptions
-    jsonHandler.setRpcMetadata(metadata);
-  }
-
-  @Override public MetricsSystem getMetrics() {
-    return metrics;
-  }
-}
-
-// End AvaticaJsonHandler.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/server/src/main/java/org/apache/calcite/avatica/server/AvaticaProtobufHandler.java
----------------------------------------------------------------------
diff --git a/avatica/server/src/main/java/org/apache/calcite/avatica/server/AvaticaProtobufHandler.java b/avatica/server/src/main/java/org/apache/calcite/avatica/server/AvaticaProtobufHandler.java
deleted file mode 100644
index f8723f1..0000000
--- a/avatica/server/src/main/java/org/apache/calcite/avatica/server/AvaticaProtobufHandler.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.server;
-
-import org.apache.calcite.avatica.AvaticaUtils;
-import org.apache.calcite.avatica.metrics.MetricsSystem;
-import org.apache.calcite.avatica.metrics.Timer;
-import org.apache.calcite.avatica.metrics.Timer.Context;
-import org.apache.calcite.avatica.metrics.noop.NoopMetricsSystem;
-import org.apache.calcite.avatica.remote.Handler.HandlerResponse;
-import org.apache.calcite.avatica.remote.MetricsHelper;
-import org.apache.calcite.avatica.remote.ProtobufHandler;
-import org.apache.calcite.avatica.remote.ProtobufTranslation;
-import org.apache.calcite.avatica.remote.ProtobufTranslationImpl;
-import org.apache.calcite.avatica.remote.Service;
-import org.apache.calcite.avatica.remote.Service.RpcMetadataResponse;
-import org.apache.calcite.avatica.util.UnsynchronizedBuffer;
-
-import org.eclipse.jetty.server.Request;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.Objects;
-import java.util.concurrent.Callable;
-
-import javax.servlet.ServletException;
-import javax.servlet.ServletInputStream;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * Jetty handler that executes Avatica JSON request-responses.
- */
-public class AvaticaProtobufHandler extends AbstractAvaticaHandler {
-  private static final Logger LOG = LoggerFactory.getLogger(AvaticaJsonHandler.class);
-
-  private final Service service;
-  private final ProtobufHandler pbHandler;
-  private final ProtobufTranslation protobufTranslation;
-  private final MetricsSystem metrics;
-  private final Timer requestTimer;
-  private final AvaticaServerConfiguration serverConfig;
-
-  final ThreadLocal<UnsynchronizedBuffer> threadLocalBuffer;
-
-  public AvaticaProtobufHandler(Service service) {
-    this(service, NoopMetricsSystem.getInstance());
-  }
-
-  public AvaticaProtobufHandler(Service service, MetricsSystem metrics) {
-    this(service, metrics, null);
-  }
-
-  public AvaticaProtobufHandler(Service service, MetricsSystem metrics,
-      AvaticaServerConfiguration serverConfig) {
-    this.service = Objects.requireNonNull(service);
-    this.metrics = Objects.requireNonNull(metrics);
-
-    this.requestTimer = this.metrics.getTimer(
-        MetricsHelper.concat(AvaticaProtobufHandler.class,
-            MetricsAwareAvaticaHandler.REQUEST_TIMER_NAME));
-
-    this.protobufTranslation = new ProtobufTranslationImpl();
-    this.pbHandler = new ProtobufHandler(service, protobufTranslation, metrics);
-
-    this.threadLocalBuffer = new ThreadLocal<UnsynchronizedBuffer>() {
-      @Override public UnsynchronizedBuffer initialValue() {
-        return new UnsynchronizedBuffer();
-      }
-    };
-
-    this.serverConfig = serverConfig;
-  }
-
-  public void handle(String target, Request baseRequest,
-      HttpServletRequest request, HttpServletResponse response)
-      throws IOException, ServletException {
-    try (final Context ctx = this.requestTimer.start()) {
-      // Check if the user is OK to proceed.
-      if (!isUserPermitted(serverConfig, request, response)) {
-        LOG.debug("HTTP request from {} is unauthenticated and authentication is required",
-            request.getRemoteAddr());
-        return;
-      }
-
-      response.setContentType("application/octet-stream;charset=utf-8");
-      response.setStatus(HttpServletResponse.SC_OK);
-      if (request.getMethod().equals("POST")) {
-        final byte[] requestBytes;
-        // Avoid a new buffer creation for every HTTP request
-        final UnsynchronizedBuffer buffer = threadLocalBuffer.get();
-        try (ServletInputStream inputStream = request.getInputStream()) {
-          requestBytes = AvaticaUtils.readFullyToBytes(inputStream, buffer);
-        } finally {
-          buffer.reset();
-        }
-
-        HandlerResponse<byte[]> handlerResponse;
-        try {
-          if (null != serverConfig && serverConfig.supportsImpersonation()) {
-            // Invoke the ProtobufHandler inside as doAs for the remote user.
-            handlerResponse = serverConfig.doAsRemoteUser(request.getRemoteUser(),
-              request.getRemoteAddr(), new Callable<HandlerResponse<byte[]>>() {
-                @Override public HandlerResponse<byte[]> call() {
-                  return pbHandler.apply(requestBytes);
-                }
-              });
-          } else {
-            handlerResponse = pbHandler.apply(requestBytes);
-          }
-        } catch (Exception e) {
-          LOG.debug("Error invoking request from {}", baseRequest.getRemoteAddr(), e);
-          // Catch at the highest level of exceptions
-          handlerResponse = pbHandler.convertToErrorResponse(e);
-        }
-
-        baseRequest.setHandled(true);
-        response.setStatus(handlerResponse.getStatusCode());
-        response.getOutputStream().write(handlerResponse.getResponse());
-      }
-    }
-  }
-
-  @Override public void setServerRpcMetadata(RpcMetadataResponse metadata) {
-    // Set the metadata for the normal service calls
-    service.setRpcMetadata(metadata);
-    // Also add it to the handler to include with exceptions
-    pbHandler.setRpcMetadata(metadata);
-  }
-
-  @Override public MetricsSystem getMetrics() {
-    return this.metrics;
-  }
-
-}
-
-// End AvaticaProtobufHandler.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/server/src/main/java/org/apache/calcite/avatica/server/AvaticaServerConfiguration.java
----------------------------------------------------------------------
diff --git a/avatica/server/src/main/java/org/apache/calcite/avatica/server/AvaticaServerConfiguration.java b/avatica/server/src/main/java/org/apache/calcite/avatica/server/AvaticaServerConfiguration.java
deleted file mode 100644
index dd843a4..0000000
--- a/avatica/server/src/main/java/org/apache/calcite/avatica/server/AvaticaServerConfiguration.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.server;
-
-import org.apache.calcite.avatica.remote.AuthenticationType;
-
-import java.util.concurrent.Callable;
-
-/**
- * A generic configuration interface that users can implement to configure the {@link HttpServer}.
- */
-public interface AvaticaServerConfiguration {
-
-  /**
-   * Returns the type of authentication the {@link HttpServer} should use.
-   * @return An enum corresponding to an authentication mechanism
-   */
-  AuthenticationType getAuthenticationType();
-
-  /**
-   * Returns the Kerberos realm to use for the server's login. Only relevant when
-   * {@link #getAuthenticationType()} returns {@link AuthenticationType#SPNEGO}.
-   *
-   * @return The Kerberos realm for the server login, or null if not applicable.
-   */
-  String getKerberosRealm();
-
-  /**
-   * Returns the Kerberos principal that the Avatica server should log in as.
-   *
-   * @return A Kerberos principal, or null if not applicable.
-   */
-  String getKerberosPrincipal();
-
-  /**
-   * Returns the array of allowed roles for login. Only applicable when
-   * {@link #getAuthenticationType()} returns {@link AuthenticationType#BASIC} or
-   * {@link AuthenticationType#DIGEST}.
-   *
-   * @return An array of allowed login roles, or null.
-   */
-  String[] getAllowedRoles();
-
-  /**
-   * Returns the name of the realm to use in coordination with the properties files specified
-   * by {@link #getHashLoginServiceProperties()}. Only applicable when
-   * {@link #getAuthenticationType()} returns {@link AuthenticationType#BASIC} or
-   * {@link AuthenticationType#DIGEST}.
-   *
-   * @return A realm for the HashLoginService, or null.
-   */
-  String getHashLoginServiceRealm();
-
-  /**
-   * Returns the path to a properties file that contains users and realms. Only applicable when
-   * {@link #getAuthenticationType()} returns {@link AuthenticationType#BASIC} or
-   * {@link AuthenticationType#DIGEST}.
-   *
-   * @return A realm for the HashLoginService, or null.
-   */
-  String getHashLoginServiceProperties();
-
-  /**
-   * Returns true if the Avatica server should run user requests at that remote user. Otherwise,
-   * all requests are run as the Avatica server user (which is the default).
-   *
-   * @return True if impersonation is enabled, false otherwise.
-   */
-  boolean supportsImpersonation();
-
-  /**
-   * Invokes the given <code>action</code> as the <code>remoteUserName</code>. This will only be
-   * invoked if {@link #supportsImpersonation()} returns <code>true</code>.
-   *
-   * @param remoteUserName The remote user making a request to the Avatica server.
-   * @param remoteAddress The address the remote user is making the request from.
-   * @return The result from the Callable.
-   */
-  <T> T doAsRemoteUser(String remoteUserName, String remoteAddress, Callable<T> action)
-      throws Exception;
-}
-
-// End AvaticaServerConfiguration.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/server/src/main/java/org/apache/calcite/avatica/server/DelegatingAvaticaHandler.java
----------------------------------------------------------------------
diff --git a/avatica/server/src/main/java/org/apache/calcite/avatica/server/DelegatingAvaticaHandler.java b/avatica/server/src/main/java/org/apache/calcite/avatica/server/DelegatingAvaticaHandler.java
deleted file mode 100644
index fff176d..0000000
--- a/avatica/server/src/main/java/org/apache/calcite/avatica/server/DelegatingAvaticaHandler.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.server;
-
-import org.apache.calcite.avatica.remote.Service.RpcMetadataResponse;
-
-import org.eclipse.jetty.server.Handler;
-import org.eclipse.jetty.server.Request;
-import org.eclipse.jetty.server.Server;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.Objects;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * An AvaticaHandler implementation that delegates to a provided Jetty Handler instance.
- *
- * <p>This implementation provides a no-op implementation for
- * {@link #setServerRpcMetadata(org.apache.calcite.avatica.remote.Service.RpcMetadataResponse)}.
- *
- * <p>Does not implement {@link MetricsAwareAvaticaHandler} as this implementation is only presented
- * for backwards compatibility.
- */
-public class DelegatingAvaticaHandler implements AvaticaHandler {
-  private static final Logger LOG = LoggerFactory.getLogger(DelegatingAvaticaHandler.class);
-
-  private final Handler handler;
-
-  public DelegatingAvaticaHandler(Handler handler) {
-    this.handler = Objects.requireNonNull(handler);
-  }
-
-  @Override public void handle(String target, Request baseRequest, HttpServletRequest request,
-      HttpServletResponse response) throws IOException, ServletException {
-    handler.handle(target, baseRequest, request, response);
-  }
-
-  @Override public void setServer(Server server) {
-    handler.setServer(server);
-  }
-
-  @Override public Server getServer() {
-    return handler.getServer();
-  }
-
-  @Override public void destroy() {
-    handler.destroy();
-  }
-
-  @Override public void start() throws Exception {
-    handler.start();
-  }
-
-  @Override public void stop() throws Exception {
-    handler.stop();
-  }
-
-  @Override public boolean isRunning() {
-    return handler.isRunning();
-  }
-
-  @Override public boolean isStarted() {
-    return handler.isStarted();
-  }
-
-  @Override public boolean isStarting() {
-    return handler.isStarting();
-  }
-
-  @Override public boolean isStopping() {
-    return handler.isStopping();
-  }
-
-  @Override public boolean isStopped() {
-    return handler.isStopped();
-  }
-
-  @Override public boolean isFailed() {
-    return handler.isFailed();
-  }
-
-  @Override public void addLifeCycleListener(Listener listener) {
-    handler.addLifeCycleListener(listener);
-  }
-
-  @Override public void removeLifeCycleListener(Listener listener) {
-    handler.removeLifeCycleListener(listener);
-  }
-
-  @Override public void setServerRpcMetadata(RpcMetadataResponse metadata) {
-    LOG.warn("Setting RpcMetadata is not implemented for DelegatingAvaticaHandler");
-  }
-
-}
-
-// End DelegatingAvaticaHandler.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/server/src/main/java/org/apache/calcite/avatica/server/DoAsRemoteUserCallback.java
----------------------------------------------------------------------
diff --git a/avatica/server/src/main/java/org/apache/calcite/avatica/server/DoAsRemoteUserCallback.java b/avatica/server/src/main/java/org/apache/calcite/avatica/server/DoAsRemoteUserCallback.java
deleted file mode 100644
index c2be80f..0000000
--- a/avatica/server/src/main/java/org/apache/calcite/avatica/server/DoAsRemoteUserCallback.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.server;
-
-import java.util.concurrent.Callable;
-
-/**
- * A callback which the server can invoke to allow implementations to control additional logic
- * about whether or not a client from a specific host should be run.
- * <p>For example, complex logic could be supplied to control whether clientA from host1 is
- * permitted to execute queries. This logic is deferred upon the user to implement.
- */
-public interface DoAsRemoteUserCallback {
-
-  /**
-   * Invokes the given <code>action</code> as the <code>remoteUserName</code>.
-   *
-   * @param remoteUserName The remote user making a request to the Avatica server.
-   * @param remoteAddress The address the remote user is making the request from.
-   * @param action The operation the Avatica server wants to run as <code>remoteUserName</code>.
-   * @return The result from the Callable.
-   */
-  <T> T doAsRemoteUser(String remoteUserName, String remoteAddress, Callable<T> action)
-      throws Exception;
-
-}
-
-// End DoAsRemoteUserCallback.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/server/src/main/java/org/apache/calcite/avatica/server/HandlerFactory.java
----------------------------------------------------------------------
diff --git a/avatica/server/src/main/java/org/apache/calcite/avatica/server/HandlerFactory.java b/avatica/server/src/main/java/org/apache/calcite/avatica/server/HandlerFactory.java
deleted file mode 100644
index 6c70d1b..0000000
--- a/avatica/server/src/main/java/org/apache/calcite/avatica/server/HandlerFactory.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.server;
-
-import org.apache.calcite.avatica.metrics.MetricsSystem;
-import org.apache.calcite.avatica.metrics.MetricsSystemConfiguration;
-import org.apache.calcite.avatica.metrics.MetricsSystemFactory;
-import org.apache.calcite.avatica.metrics.MetricsSystemLoader;
-import org.apache.calcite.avatica.metrics.noop.NoopMetricsSystem;
-import org.apache.calcite.avatica.metrics.noop.NoopMetricsSystemConfiguration;
-import org.apache.calcite.avatica.remote.Driver;
-import org.apache.calcite.avatica.remote.Service;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.ServiceLoader;
-
-/**
- * Factory that instantiates the desired implementation, typically differing on the method
- * used to serialize messages, for use in the Avatica server.
- */
-public class HandlerFactory {
-  private static final Logger LOG = LoggerFactory.getLogger(HandlerFactory.class);
-
-  /**
-   * Constructs the desired implementation for the given serialization method with metrics.
-   *
-   * @param service The underlying {@link Service}.
-   * @param serialization The desired message serialization.
-   * @return The {@link AvaticaHandler}.
-   */
-  public AvaticaHandler getHandler(Service service, Driver.Serialization serialization) {
-    return getHandler(service, serialization, NoopMetricsSystemConfiguration.getInstance());
-  }
-
-  /**
-   * Constructs the desired implementation for the given serialization method and server
-   * configuration with metrics.
-   *
-   * @param service The underlying {@link Service}.
-   * @param serialization The desired message serialization.
-   * @param serverConfig Avatica server configuration or null.
-   * @return The {@link AvaticaHandler}.
-   */
-  public AvaticaHandler getHandler(Service service, Driver.Serialization serialization,
-      AvaticaServerConfiguration serverConfig) {
-    return getHandler(service, serialization, NoopMetricsSystemConfiguration.getInstance(),
-        serverConfig);
-  }
-
-  /**
-   * Constructs the desired implementation for the given serialization method with metrics.
-   *
-   * @param service The underlying {@link Service}.
-   * @param serialization The desired message serialization.
-   * @param metricsConfig Configuration for the {@link MetricsSystem}.
-   * @return The {@link AvaticaHandler}.
-   */
-  public AvaticaHandler getHandler(Service service, Driver.Serialization serialization,
-      MetricsSystemConfiguration<?> metricsConfig) {
-    return getHandler(service, serialization, metricsConfig, null);
-  }
-
-  /**
-   * Constructs the desired implementation for the given serialization method and server
-   * configuration with metrics.
-   *
-   * @param service The underlying {@link Service}
-   * @param serialization The serializatio mechanism to use
-   * @param metricsConfig Configuration for the {@link MetricsSystem}.
-   * @param serverConfig Avatica server configuration or null
-   * @return An {@link AvaticaHandler}
-   */
-  public AvaticaHandler getHandler(Service service, Driver.Serialization serialization,
-      MetricsSystemConfiguration<?> metricsConfig, AvaticaServerConfiguration serverConfig) {
-    if (null == metricsConfig) {
-      metricsConfig = NoopMetricsSystemConfiguration.getInstance();
-    }
-    MetricsSystem metrics = MetricsSystemLoader.load(metricsConfig);
-
-    switch (serialization) {
-    case JSON:
-      return new AvaticaJsonHandler(service, metrics, serverConfig);
-    case PROTOBUF:
-      return new AvaticaProtobufHandler(service, metrics, serverConfig);
-    default:
-      throw new IllegalArgumentException("Unknown Avatica handler for " + serialization.name());
-    }
-  }
-
-  /**
-   * Load a {@link MetricsSystem} using ServiceLoader to create a {@link MetricsSystemFactory}.
-   *
-   * @param config State to pass to the factory for initialization.
-   * @return A {@link MetricsSystem} instance.
-   */
-  MetricsSystem loadMetricsSystem(MetricsSystemConfiguration<?> config) {
-    ServiceLoader<MetricsSystemFactory> loader = ServiceLoader.load(MetricsSystemFactory.class);
-    List<MetricsSystemFactory> availableFactories = new ArrayList<>();
-    for (MetricsSystemFactory factory : loader) {
-      availableFactories.add(factory);
-    }
-
-    if (1 == availableFactories.size()) {
-      // One and only one instance -- what we want
-      MetricsSystemFactory factory = availableFactories.get(0);
-      LOG.info("Loaded MetricsSystem {}", factory.getClass());
-      return factory.create(config);
-    } else if (availableFactories.isEmpty()) {
-      // None-provided default to no metrics
-      LOG.info("No metrics implementation available on classpath. Using No-op implementation");
-      return NoopMetricsSystem.getInstance();
-    } else {
-      // Tell the user they're doing something wrong, and choose the first impl.
-      StringBuilder sb = new StringBuilder();
-      for (MetricsSystemFactory factory : availableFactories) {
-        if (sb.length() > 0) {
-          sb.append(", ");
-        }
-        sb.append(factory.getClass());
-      }
-      LOG.warn("Found multiple MetricsSystemFactory implementations: {}."
-          + " Using No-op implementation", sb);
-      return NoopMetricsSystem.getInstance();
-    }
-  }
-}
-
-// End HandlerFactory.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/server/src/main/java/org/apache/calcite/avatica/server/HttpServer.java
----------------------------------------------------------------------
diff --git a/avatica/server/src/main/java/org/apache/calcite/avatica/server/HttpServer.java b/avatica/server/src/main/java/org/apache/calcite/avatica/server/HttpServer.java
deleted file mode 100644
index 4c871f0..0000000
--- a/avatica/server/src/main/java/org/apache/calcite/avatica/server/HttpServer.java
+++ /dev/null
@@ -1,826 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.server;
-
-import org.apache.calcite.avatica.metrics.MetricsSystemConfiguration;
-import org.apache.calcite.avatica.remote.AuthenticationType;
-import org.apache.calcite.avatica.remote.Driver.Serialization;
-import org.apache.calcite.avatica.remote.Service;
-import org.apache.calcite.avatica.remote.Service.RpcMetadataResponse;
-
-import org.eclipse.jetty.security.Authenticator;
-import org.eclipse.jetty.security.ConstraintMapping;
-import org.eclipse.jetty.security.ConstraintSecurityHandler;
-import org.eclipse.jetty.security.HashLoginService;
-import org.eclipse.jetty.security.LoginService;
-import org.eclipse.jetty.security.authentication.BasicAuthenticator;
-import org.eclipse.jetty.security.authentication.DigestAuthenticator;
-import org.eclipse.jetty.security.authentication.SpnegoAuthenticator;
-import org.eclipse.jetty.server.Connector;
-import org.eclipse.jetty.server.Handler;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.ServerConnector;
-import org.eclipse.jetty.server.handler.DefaultHandler;
-import org.eclipse.jetty.server.handler.HandlerList;
-import org.eclipse.jetty.util.security.Constraint;
-import org.eclipse.jetty.util.ssl.SslContextFactory;
-import org.eclipse.jetty.util.thread.QueuedThreadPool;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.security.Principal;
-import java.security.PrivilegedAction;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-import java.util.concurrent.Callable;
-
-import javax.security.auth.Subject;
-import javax.security.auth.kerberos.KerberosPrincipal;
-import javax.security.auth.login.AppConfigurationEntry;
-import javax.security.auth.login.LoginContext;
-import javax.security.auth.login.LoginException;
-
-/**
- * Avatica HTTP server.
- *
- * <p>If you need to change the server's configuration, override the
- * {@link #configureConnector(ServerConnector, int)} method in a derived class.
- */
-public class HttpServer {
-  private static final Logger LOG = LoggerFactory.getLogger(HttpServer.class);
-
-  private Server server;
-  private int port = -1;
-  private final AvaticaHandler handler;
-  private final AvaticaServerConfiguration config;
-  private final Subject subject;
-  private final SslContextFactory sslFactory;
-
-  @Deprecated
-  public HttpServer(Handler handler) {
-    this(wrapJettyHandler(handler));
-  }
-
-  /**
-   * Constructs an {@link HttpServer} which binds to an ephemeral port.
-   * @param handler The Handler to run
-   */
-  public HttpServer(AvaticaHandler handler) {
-    this(0, handler);
-  }
-
-  @Deprecated
-  public HttpServer(int port, Handler handler) {
-    this(port, wrapJettyHandler(handler));
-  }
-
-  /**
-   * Constructs an {@link HttpServer} with no additional configuration.
-   * @param port The listen port
-   * @param handler The Handler to run
-   */
-  public HttpServer(int port, AvaticaHandler handler) {
-    this(port, handler, null);
-  }
-
-  /**
-   * Constructs an {@link HttpServer}.
-   * @param port The listen port
-   * @param handler The Handler to run
-   * @param config Optional configuration for the server
-   */
-  public HttpServer(int port, AvaticaHandler handler, AvaticaServerConfiguration config) {
-    this(port, handler, config, null);
-  }
-
-  /**
-   * Constructs an {@link HttpServer}.
-   * @param port The listen port
-   * @param handler The Handler to run
-   * @param config Optional configuration for the server
-   * @param subject The javax.security Subject for the server, or null
-   */
-  public HttpServer(int port, AvaticaHandler handler, AvaticaServerConfiguration config,
-      Subject subject) {
-    this(port, handler, config, subject, null);
-  }
-
-  /**
-   * Constructs an {@link HttpServer}.
-   * @param port The listen port
-   * @param handler The Handler to run
-   * @param config Optional configuration for the server
-   * @param subject The javax.security Subject for the server, or null
-   * @param sslFactory A configured SslContextFactory, or null
-   */
-  public HttpServer(int port, AvaticaHandler handler, AvaticaServerConfiguration config,
-      Subject subject, SslContextFactory sslFactory) {
-    this.port = port;
-    this.handler = handler;
-    this.config = config;
-    this.subject = subject;
-    this.sslFactory = sslFactory;
-  }
-
-  static AvaticaHandler wrapJettyHandler(Handler handler) {
-    if (handler instanceof AvaticaHandler) {
-      return (AvaticaHandler) handler;
-    }
-    // Backwards compatibility, noop's the AvaticaHandler interface
-    return new DelegatingAvaticaHandler(handler);
-  }
-
-  public void start() {
-    if (null != subject) {
-      // Run the start in the privileged block (as the kerberos-identified user)
-      Subject.doAs(subject, new PrivilegedAction<Void>() {
-        @Override public Void run() {
-          internalStart();
-          return null;
-        }
-      });
-    } else {
-      internalStart();
-    }
-  }
-
-  protected void internalStart() {
-    if (server != null) {
-      throw new RuntimeException("Server is already started");
-    }
-
-    final QueuedThreadPool threadPool = new QueuedThreadPool();
-    threadPool.setDaemon(true);
-    server = new Server(threadPool);
-    server.manage(threadPool);
-
-    final ServerConnector connector = configureConnector(getConnector(), port);
-    ConstraintSecurityHandler securityHandler = null;
-
-    if (null != this.config) {
-      switch (config.getAuthenticationType()) {
-      case SPNEGO:
-        // Get the Handler for SPNEGO authentication
-        securityHandler = configureSpnego(server, connector, this.config);
-        break;
-      case BASIC:
-        securityHandler = configureBasicAuthentication(server, connector, config);
-        break;
-      case DIGEST:
-        securityHandler = configureDigestAuthentication(server, connector, config);
-        break;
-      default:
-        // Pass
-        break;
-      }
-    }
-
-    server.setConnectors(new Connector[] { connector });
-
-    // Default to using the handler that was passed in
-    final HandlerList handlerList = new HandlerList();
-    Handler avaticaHandler = handler;
-
-    // Wrap the provided handler for security if we made one
-    if (null != securityHandler) {
-      securityHandler.setHandler(handler);
-      avaticaHandler = securityHandler;
-    }
-
-    handlerList.setHandlers(new Handler[] {avaticaHandler, new DefaultHandler()});
-
-    server.setHandler(handlerList);
-    try {
-      server.start();
-    } catch (Exception e) {
-      throw new RuntimeException(e);
-    }
-    port = connector.getLocalPort();
-
-    LOG.info("Service listening on port {}.", getPort());
-
-    // Set the information about the address for this server
-    try {
-      this.handler.setServerRpcMetadata(createRpcServerMetadata(connector));
-    } catch (UnknownHostException e) {
-      // Failed to do the DNS lookup, bail out.
-      throw new RuntimeException(e);
-    }
-  }
-
-  private ServerConnector getConnector() {
-    if (null == sslFactory) {
-      return new ServerConnector(server);
-    }
-    return new ServerConnector(server, sslFactory);
-  }
-
-  private RpcMetadataResponse createRpcServerMetadata(ServerConnector connector) throws
-      UnknownHostException {
-    String host = connector.getHost();
-    if (null == host) {
-      // "null" means binding to all interfaces, we need to pick one so the client gets a real
-      // address and not "0.0.0.0" or similar.
-      host = InetAddress.getLocalHost().getHostName();
-    }
-
-    final int port = connector.getLocalPort();
-
-    return new RpcMetadataResponse(
-        String.format(Locale.ROOT, "%s:%d", host, port));
-  }
-
-  /**
-   * Configures the <code>connector</code> given the <code>config</code> for using SPNEGO.
-   *
-   * @param connector The connector to configure
-   * @param config The configuration
-   */
-  protected ConstraintSecurityHandler configureSpnego(Server server, ServerConnector connector,
-      AvaticaServerConfiguration config) {
-    final String realm = Objects.requireNonNull(config.getKerberosRealm());
-    final String principal = Objects.requireNonNull(config.getKerberosPrincipal());
-
-    // A customization of SpnegoLoginService to explicitly set the server's principal, otherwise
-    // we would have to require a custom file to set the server's principal.
-    PropertyBasedSpnegoLoginService spnegoLoginService =
-        new PropertyBasedSpnegoLoginService(realm, principal);
-
-    // Roles are "realms" for Kerberos/SPNEGO
-    final String[] allowedRealms = getAllowedRealms(realm, config);
-
-    return configureCommonAuthentication(server, connector, config, Constraint.__SPNEGO_AUTH,
-        allowedRealms, new SpnegoAuthenticator(), realm, spnegoLoginService);
-  }
-
-  protected String[] getAllowedRealms(String serverRealm, AvaticaServerConfiguration config) {
-    // Roles are "realms" for Kerberos/SPNEGO
-    String[] allowedRealms = new String[] {serverRealm};
-    // By default, only the server's realm is allowed, but other realms can also be allowed.
-    if (null != config.getAllowedRoles()) {
-      allowedRealms = new String[config.getAllowedRoles().length + 1];
-      allowedRealms[0] = serverRealm;
-      System.arraycopy(config.getAllowedRoles(), 0, allowedRealms, 1,
-          config.getAllowedRoles().length);
-    }
-    return allowedRealms;
-  }
-
-  protected ConstraintSecurityHandler configureBasicAuthentication(Server server,
-      ServerConnector connector, AvaticaServerConfiguration config) {
-    final String[] allowedRoles = config.getAllowedRoles();
-    final String realm = config.getHashLoginServiceRealm();
-    final String loginServiceProperties = config.getHashLoginServiceProperties();
-
-    HashLoginService loginService = new HashLoginService(realm, loginServiceProperties);
-    server.addBean(loginService);
-
-    return configureCommonAuthentication(server, connector, config, Constraint.__BASIC_AUTH,
-        allowedRoles, new BasicAuthenticator(), null, loginService);
-  }
-
-  protected ConstraintSecurityHandler configureDigestAuthentication(Server server,
-      ServerConnector connector, AvaticaServerConfiguration config) {
-    final String[] allowedRoles = config.getAllowedRoles();
-    final String realm = config.getHashLoginServiceRealm();
-    final String loginServiceProperties = config.getHashLoginServiceProperties();
-
-    HashLoginService loginService = new HashLoginService(realm, loginServiceProperties);
-    server.addBean(loginService);
-
-    return configureCommonAuthentication(server, connector, config, Constraint.__DIGEST_AUTH,
-        allowedRoles, new DigestAuthenticator(), null, loginService);
-  }
-
-  protected ConstraintSecurityHandler configureCommonAuthentication(Server server,
-      ServerConnector connector, AvaticaServerConfiguration config, String constraintName,
-      String[] allowedRoles, Authenticator authenticator, String realm,
-      LoginService loginService) {
-
-    Constraint constraint = new Constraint();
-    constraint.setName(constraintName);
-    constraint.setRoles(allowedRoles);
-    // This is telling Jetty to not allow unauthenticated requests through (very important!)
-    constraint.setAuthenticate(true);
-
-    ConstraintMapping cm = new ConstraintMapping();
-    cm.setConstraint(constraint);
-    cm.setPathSpec("/*");
-
-    ConstraintSecurityHandler sh = new ConstraintSecurityHandler();
-    sh.setAuthenticator(authenticator);
-    sh.setLoginService(loginService);
-    sh.setConstraintMappings(new ConstraintMapping[]{cm});
-    sh.setRealmName(realm);
-
-    return sh;
-  }
-
-  /**
-   * Configures the server connector.
-   *
-   * <p>The default configuration sets a timeout of 1 minute and disables
-   * TCP linger time.
-   *
-   * <p>To change the configuration, override this method in a derived class.
-   * The overriding method must call its super method.
-   *
-   * @param connector connector to be configured
-   * @param port port number handed over in constructor
-   */
-  protected ServerConnector configureConnector(ServerConnector connector, int port) {
-    connector.setIdleTimeout(60 * 1000);
-    connector.setSoLingerTime(-1);
-    connector.setPort(port);
-    return connector;
-  }
-
-  protected AvaticaServerConfiguration getConfig() {
-    return this.config;
-  }
-
-  public void stop() {
-    if (server == null) {
-      throw new RuntimeException("Server is already stopped");
-    }
-
-    LOG.info("Service terminating.");
-    try {
-      final Server server1 = server;
-      port = -1;
-      server = null;
-      server1.stop();
-    } catch (Exception e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  public void join() throws InterruptedException {
-    server.join();
-  }
-
-  public int getPort() {
-    return port;
-  }
-
-  /**
-   * Builder class for creating instances of {@link HttpServer}.
-   */
-  public static class Builder {
-    private int port;
-
-    private Service service;
-    private Serialization serialization;
-    private AvaticaHandler handler = null;
-
-    private MetricsSystemConfiguration<?> metricsConfig;
-
-    private AuthenticationType authenticationType = AuthenticationType.NONE;
-
-    private String kerberosPrincipal;
-    private String kerberosRealm;
-    private File keytab;
-
-    private DoAsRemoteUserCallback remoteUserCallback;
-
-    private String loginServiceRealm;
-    private String loginServiceProperties;
-    private String[] loginServiceAllowedRoles;
-
-    private boolean usingTLS = false;
-    private File keystore;
-    private String keystorePassword;
-    private File truststore;
-    private String truststorePassword;
-
-    public Builder() {}
-
-    public Builder withPort(int port) {
-      this.port = port;
-      return this;
-    }
-
-    /**
-     * Sets the {@link Service} and {@link Serialization} information necessary to construct
-     * the appropriate {@link AvaticaHandler}.
-     *
-     * @param service The Avatica service
-     * @param serialization The serialization method
-     * @return <code>this</code>
-     */
-    public Builder withHandler(Service service, Serialization serialization) {
-      this.service = Objects.requireNonNull(service);
-      this.serialization = Objects.requireNonNull(serialization);
-      return this;
-    }
-
-    /**
-     * Sets an {@link AvaticaHandler} directly on the builder. Most users will not want to use
-     * this method and should instead use {@link #withHandler(Service, Serialization)}.
-     *
-     * @param handler The handler
-     * @return <code>this</code>
-     */
-    public Builder withHandler(AvaticaHandler handler) {
-      this.handler = Objects.requireNonNull(handler);
-      return this;
-    }
-
-    /**
-     * Sets the given configuration to enable metrics collection in the server.
-     *
-     * @param metricsConfig Configuration object for metrics.
-     * @return <code>this</code>
-     */
-    public Builder withMetricsConfiguration(MetricsSystemConfiguration<?> metricsConfig) {
-      this.metricsConfig = Objects.requireNonNull(metricsConfig);
-      return this;
-    }
-
-    /**
-     * Configures the server to use SPNEGO authentication. This method requires that the
-     * <code>principal</code> contains the Kerberos realm. Invoking this method overrides any
-     * previous call which configures authentication.
-     *
-     * @param principal A kerberos principal with the realm required.
-     * @return <code>this</code>
-     */
-    public Builder withSpnego(String principal) {
-      return withSpnego(principal, (String[]) null);
-    }
-
-    /**
-     * Configures the server to use SPNEGO authentication. This method requires that the
-     * <code>principal</code> contains the Kerberos realm. Invoking this method overrides any
-     * previous call which configures authentication. Invoking this method overrides any previous
-     * call which configures authentication. By default, only principals from the server's realm are
-     * permitted, but additional realms can be allowed using <code>additionalAllowedRealms</code>.
-     *
-     * @param principal A kerberos principal with the realm required.
-     * @param additionalAllowedRealms Any additional realms, other than the server's realm, which
-     *    should be allowed to authenticate against the server. Can be null.
-     * @return <code>this</code>
-     */
-    public Builder withSpnego(String principal, String[] additionalAllowedRealms) {
-      int index = Objects.requireNonNull(principal).lastIndexOf('@');
-      if (-1 == index) {
-        throw new IllegalArgumentException("Could not find '@' symbol in '" + principal
-            + "' to parse the Kerberos realm from the principal");
-      }
-      final String realm = principal.substring(index + 1);
-      return withSpnego(principal, realm, additionalAllowedRealms);
-    }
-
-    /**
-     * Configures the server to use SPNEGO authentication. It is required that callers are logged
-     * in via Kerberos already or have provided the necessary configuration to automatically log
-     * in via JAAS (using the <code>java.security.auth.login.config</code> system property) before
-     * starting the {@link HttpServer}. Invoking this method overrides any previous call which
-     * configures authentication.
-     *
-     * @param principal The kerberos principal
-     * @param realm The kerberos realm
-     * @return <code>this</code>
-     */
-    public Builder withSpnego(String principal, String realm) {
-      return this.withSpnego(principal, realm, null);
-    }
-
-    /**
-     * Configures the server to use SPNEGO authentication. It is required that callers are logged
-     * in via Kerberos already or have provided the necessary configuration to automatically log
-     * in via JAAS (using the <code>java.security.auth.login.config</code> system property) before
-     * starting the {@link HttpServer}. Invoking this method overrides any previous call which
-     * configures authentication. By default, only principals from the server's realm are permitted,
-     * but additional realms can be allowed using <code>additionalAllowedRealms</code>.
-     *
-     * @param principal The kerberos principal
-     * @param realm The kerberos realm
-     * @param additionalAllowedRealms Any additional realms, other than the server's realm, which
-     *    should be allowed to authenticate against the server. Can be null.
-     * @return <code>this</code>
-     */
-    public Builder withSpnego(String principal, String realm, String[] additionalAllowedRealms) {
-      this.authenticationType = AuthenticationType.SPNEGO;
-      this.kerberosPrincipal = Objects.requireNonNull(principal);
-      this.kerberosRealm = Objects.requireNonNull(realm);
-      this.loginServiceAllowedRoles = additionalAllowedRealms;
-      return this;
-    }
-
-    /**
-     * Sets a keytab to be used to perform a Kerberos login automatically (without the use of JAAS).
-     *
-     * @param keytab A KeyTab file for the server's login.
-     * @return <code>this</code>
-     */
-    public Builder withAutomaticLogin(File keytab) {
-      this.keytab = Objects.requireNonNull(keytab);
-      return this;
-    }
-
-    /**
-     * Sets a callback implementation to defer the logic on how to run an action as a given user and
-     * if the action should be permitted for that user.
-     *
-     * @param remoteUserCallback User-provided implementation of the callback
-     * @return <code>this</code>
-     */
-    public Builder withImpersonation(DoAsRemoteUserCallback remoteUserCallback) {
-      this.remoteUserCallback = Objects.requireNonNull(remoteUserCallback);
-      return this;
-    }
-
-    /**
-     * Configures the server to use HTTP Basic authentication. The <code>properties</code> must
-     * be in a form consumable by Jetty. Invoking this method overrides any previous call which
-     * configures authentication. This authentication is supplementary to the JDBC-provided user
-     * authentication interfaces and should only be used when those interfaces are not used.
-     *
-     * @param properties Location of a properties file parseable by Jetty which contains users and
-     *     passwords.
-     * @param allowedRoles An array of allowed roles in the properties file
-     * @return <code>this</code>
-     */
-    public Builder withBasicAuthentication(String properties, String[] allowedRoles) {
-      return withAuthentication(AuthenticationType.BASIC, properties, allowedRoles);
-    }
-
-    /**
-     * Configures the server to use HTTP Digest authentication. The <code>properties</code> must
-     * be in a form consumable by Jetty. Invoking this method overrides any previous call which
-     * configures authentication. This authentication is supplementary to the JDBC-provided user
-     * authentication interfaces and should only be used when those interfaces are not used.
-     *
-     * @param properties Location of a properties file parseable by Jetty which contains users and
-     *     passwords.
-     * @param allowedRoles An array of allowed roles in the properties file
-     * @return <code>this</code>
-     */
-    public Builder withDigestAuthentication(String properties, String[] allowedRoles) {
-      return withAuthentication(AuthenticationType.DIGEST, properties, allowedRoles);
-    }
-
-    private Builder withAuthentication(AuthenticationType authType, String properties,
-        String[] allowedRoles) {
-      this.loginServiceRealm = "Avatica";
-      this.authenticationType = authType;
-      this.loginServiceProperties = Objects.requireNonNull(properties);
-      this.loginServiceAllowedRoles = Objects.requireNonNull(allowedRoles);
-      return this;
-    }
-
-    /**
-     * Configures the server to use TLS for wire encryption.
-     *
-     * @param keystore The server's keystore
-     * @param keystorePassword The keystore's password
-     * @param truststore The truststore containing the key used to generate the server's key
-     * @param truststorePassword The truststore's password
-     * @return <code>this</code>
-     */
-    public Builder withTLS(File keystore, String keystorePassword, File truststore,
-        String truststorePassword) {
-      this.usingTLS = true;
-      this.keystore = Objects.requireNonNull(keystore);
-      this.keystorePassword = Objects.requireNonNull(keystorePassword);
-      this.truststore = Objects.requireNonNull(truststore);
-      this.truststorePassword = Objects.requireNonNull(truststorePassword);
-      return this;
-    }
-
-    /**
-     * Builds the HttpServer instance from <code>this</code>.
-     * @return An HttpServer.
-     */
-    public HttpServer build() {
-      final AvaticaServerConfiguration serverConfig;
-      final Subject subject;
-      switch (authenticationType) {
-      case NONE:
-        serverConfig = null;
-        subject = null;
-        break;
-      case BASIC:
-      case DIGEST:
-        // Build the configuration for BASIC or DIGEST authentication.
-        serverConfig = buildUserAuthenticationConfiguration(this);
-        subject = null;
-        break;
-      case SPNEGO:
-        if (usingTLS) {
-          throw new IllegalArgumentException("TLS has not been tested wtih SPNEGO");
-        }
-        if (null != keytab) {
-          LOG.debug("Performing Kerberos login with {} as {}", keytab, kerberosPrincipal);
-          subject = loginViaKerberos(this);
-        } else {
-          LOG.debug("Not performing Kerberos login");
-          subject = null;
-        }
-        serverConfig = buildSpnegoConfiguration(this);
-        break;
-      default:
-        throw new IllegalArgumentException("Unhandled AuthenticationType");
-      }
-
-      AvaticaHandler handler = buildHandler(this, serverConfig);
-      SslContextFactory sslFactory = null;
-      if (usingTLS) {
-        sslFactory = new SslContextFactory();
-        sslFactory.setKeyStorePath(this.keystore.getAbsolutePath());
-        sslFactory.setKeyStorePassword(keystorePassword);
-        sslFactory.setTrustStorePath(truststore.getAbsolutePath());
-        sslFactory.setTrustStorePassword(truststorePassword);
-      }
-
-      return new HttpServer(port, handler, serverConfig, subject, sslFactory);
-    }
-
-    /**
-     * Creates the appropriate {@link AvaticaHandler}.
-     *
-     * @param b The {@link Builder}.
-     * @param config The Avatica server configuration
-     * @return An {@link AvaticaHandler}.
-     */
-    private AvaticaHandler buildHandler(Builder b, AvaticaServerConfiguration config) {
-      // The user provided a handler explicitly.
-      if (null != b.handler) {
-        return b.handler;
-      }
-
-      // Normal case, we create the handler for the user.
-      HandlerFactory factory = new HandlerFactory();
-      return factory.getHandler(b.service, b.serialization, b.metricsConfig, config);
-    }
-
-    /**
-     * Builds an {@link AvaticaServerConfiguration} implementation for SPNEGO-based authentication.
-     * @param b The {@link Builder}.
-     * @return A configuration instance.
-     */
-    private AvaticaServerConfiguration buildSpnegoConfiguration(Builder b) {
-      final String principal = b.kerberosPrincipal;
-      final String realm = b.kerberosRealm;
-      final String[] additionalAllowedRealms = b.loginServiceAllowedRoles;
-      final DoAsRemoteUserCallback callback = b.remoteUserCallback;
-      return new AvaticaServerConfiguration() {
-
-        @Override public AuthenticationType getAuthenticationType() {
-          return AuthenticationType.SPNEGO;
-        }
-
-        @Override public String getKerberosRealm() {
-          return realm;
-        }
-
-        @Override public String getKerberosPrincipal() {
-          return principal;
-        }
-
-        @Override public boolean supportsImpersonation() {
-          return null != callback;
-        }
-
-        @Override public <T> T doAsRemoteUser(String remoteUserName, String remoteAddress,
-            Callable<T> action) throws Exception {
-          return callback.doAsRemoteUser(remoteUserName, remoteAddress, action);
-        }
-
-        @Override public String[] getAllowedRoles() {
-          return additionalAllowedRealms;
-        }
-
-        @Override public String getHashLoginServiceRealm() {
-          return null;
-        }
-
-        @Override public String getHashLoginServiceProperties() {
-          return null;
-        }
-      };
-    }
-
-    private AvaticaServerConfiguration buildUserAuthenticationConfiguration(Builder b) {
-      final AuthenticationType authType = b.authenticationType;
-      final String[] allowedRoles = b.loginServiceAllowedRoles;
-      final String realm = b.loginServiceRealm;
-      final String properties = b.loginServiceProperties;
-
-      return new AvaticaServerConfiguration() {
-        @Override public AuthenticationType getAuthenticationType() {
-          return authType;
-        }
-
-        @Override public String[] getAllowedRoles() {
-          return allowedRoles;
-        }
-
-        @Override public String getHashLoginServiceRealm() {
-          return realm;
-        }
-
-        @Override public String getHashLoginServiceProperties() {
-          return properties;
-        }
-
-        // Unused
-
-        @Override public String getKerberosRealm() {
-          return null;
-        }
-
-        @Override public String getKerberosPrincipal() {
-          return null;
-        }
-
-        @Override public boolean supportsImpersonation() {
-          return false;
-        }
-
-        @Override public <T> T doAsRemoteUser(String remoteUserName, String remoteAddress,
-            Callable<T> action) throws Exception {
-          return null;
-        }
-      };
-    }
-
-    private Subject loginViaKerberos(Builder b) {
-      Set<Principal> principals = new HashSet<Principal>();
-      principals.add(new KerberosPrincipal(b.kerberosPrincipal));
-
-      Subject subject = new Subject(false, principals, new HashSet<Object>(),
-          new HashSet<Object>());
-
-      KeytabJaasConf conf = new KeytabJaasConf(b.kerberosPrincipal, b.keytab.toString());
-      String confName = "NotUsed";
-      try {
-        LoginContext loginContext = new LoginContext(confName, subject, null, conf);
-        loginContext.login();
-        return loginContext.getSubject();
-      } catch (LoginException e) {
-        throw new RuntimeException(e);
-      }
-    }
-
-    /**
-     * Javax Configuration class which always returns a configuration for our keytab-based
-     * login.
-     */
-    private static class KeytabJaasConf extends javax.security.auth.login.Configuration {
-      private final String principal;
-      private final String keytab;
-
-      private KeytabJaasConf(String principal, String keytab) {
-        this.principal = principal;
-        this.keytab = keytab;
-      }
-
-      @Override public AppConfigurationEntry[] getAppConfigurationEntry(String name) {
-        Map<String, String> options = new HashMap<String, String>();
-        options.put("storeKey", "true");
-        options.put("principal", principal);
-        options.put("keyTab", keytab);
-        options.put("doNotPrompt", "true");
-        options.put("useKeyTab", "true");
-        options.put("isInitiator", "false");
-        options.put("debug",
-            System.getProperty("sun.security.krb5.debug", "false")
-                .toLowerCase(Locale.ROOT));
-
-        return new AppConfigurationEntry[] {new AppConfigurationEntry(getKrb5LoginModuleName(),
-            AppConfigurationEntry.LoginModuleControlFlag.REQUIRED, options)};
-      }
-    }
-
-    private static String getKrb5LoginModuleName() {
-      return System.getProperty("java.vendor").contains("IBM")
-          ? "com.ibm.security.auth.module.Krb5LoginModule"
-          : "com.sun.security.auth.module.Krb5LoginModule";
-    }
-  }
-}
-
-// End HttpServer.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/server/src/main/java/org/apache/calcite/avatica/server/Main.java
----------------------------------------------------------------------
diff --git a/avatica/server/src/main/java/org/apache/calcite/avatica/server/Main.java b/avatica/server/src/main/java/org/apache/calcite/avatica/server/Main.java
deleted file mode 100644
index f2d546b..0000000
--- a/avatica/server/src/main/java/org/apache/calcite/avatica/server/Main.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.server;
-
-import org.apache.calcite.avatica.Meta;
-import org.apache.calcite.avatica.remote.LocalService;
-import org.apache.calcite.avatica.remote.Service;
-
-import org.eclipse.jetty.server.handler.AbstractHandler;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.Arrays;
-
-/**
- * Jetty handler that executes Avatica JSON request-responses.
- */
-public class Main {
-  private Main() {}
-
-  public static void main(String[] args) throws InterruptedException, ClassNotFoundException,
-      IllegalAccessException, InstantiationException, NoSuchMethodException,
-      InvocationTargetException {
-    HttpServer server = start(args);
-    server.join();
-  }
-
-  /**
-   * Factory that instantiates Jetty Handlers
-   */
-  public interface HandlerFactory {
-    AbstractHandler createHandler(Service service);
-  }
-
-  private static final HandlerFactory JSON_HANDLER_FACTORY = new HandlerFactory() {
-    public AbstractHandler createHandler(Service service) {
-      return new AvaticaJsonHandler(service);
-    }
-  };
-
-  /**
-   * Creates and starts an {@link HttpServer} using JSON POJO serialization of requests/responses.
-   *
-   * <p>Arguments are as follows:
-   * <ul>
-   *   <li>args[0]: the {@link org.apache.calcite.avatica.Meta.Factory} class
-   *       name
-   *   <li>args[1+]: arguments passed along to
-   *   {@link org.apache.calcite.avatica.Meta.Factory#create(java.util.List)}
-   * </ul>
-   *
-   * @param args Command-line arguments
-   */
-  public static HttpServer start(String[] args) throws ClassNotFoundException,
-      InstantiationException, IllegalAccessException, NoSuchMethodException,
-      InvocationTargetException {
-    return start(args, 8765, JSON_HANDLER_FACTORY);
-  }
-
-  /**
-   * Creates and starts an {@link HttpServer} using the given factory to create the Handler.
-   *
-   * <p>Arguments are as follows:
-   * <ul>
-   *   <li>args[0]: the {@link org.apache.calcite.avatica.Meta.Factory} class
-   *       name
-   *   <li>args[1+]: arguments passed along to
-   *   {@link org.apache.calcite.avatica.Meta.Factory#create(java.util.List)}
-   * </ul>
-   *
-   * @param args Command-line arguments
-   * @param port Server port to bind
-   * @param handlerFactory Factory to create the handler used by the server
-   */
-  public static HttpServer start(String[] args, int port, HandlerFactory handlerFactory)
-      throws ClassNotFoundException, InstantiationException, IllegalAccessException,
-      NoSuchMethodException, InvocationTargetException {
-    String factoryClassName = args[0];
-    @SuppressWarnings("unchecked") Class<Meta.Factory> factoryClass =
-        (Class<Meta.Factory>) Class.forName(factoryClassName);
-    Meta.Factory factory = factoryClass.getConstructor().newInstance();
-    Meta meta = factory.create(Arrays.asList(args).subList(1, args.length));
-    Service service = new LocalService(meta);
-    HttpServer server = new HttpServer(port,
-        HttpServer.wrapJettyHandler(handlerFactory.createHandler(service)));
-    server.start();
-    return server;
-  }
-}
-
-// End Main.java


[34/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/util/Base64.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/util/Base64.java b/avatica/core/src/main/java/org/apache/calcite/avatica/util/Base64.java
deleted file mode 100644
index c42b1f5..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/util/Base64.java
+++ /dev/null
@@ -1,2093 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.util;
-
-//CHECKSTYLE: OFF
-
-import java.nio.charset.StandardCharsets;
-import java.util.Locale;
-
-/**
- * <p>Encodes and decodes to and from Base64 notation.</p>
- * <p>Homepage: <a href="http://iharder.net/base64">http://iharder.net/base64</a>.</p>
- *
- * <p>Example:</p>
- *
- * <code>String encoded = Base64.encode( myByteArray );</code>
- * <br>
- * <code>byte[] myByteArray = Base64.decode( encoded );</code>
- *
- * <p>The <tt>options</tt> parameter, which appears in a few places, is used to pass
- * several pieces of information to the encoder. In the "higher level" methods such as
- * encodeBytes( bytes, options ) the options parameter can be used to indicate such
- * things as first gzipping the bytes before encoding them, not inserting linefeeds,
- * and encoding using the URL-safe and Ordered dialects.</p>
- *
- * <p>Note, according to <a href="http://www.faqs.org/rfcs/rfc3548.html">RFC3548</a>,
- * Section 2.1, implementations should not add line feeds unless explicitly told
- * to do so. I've got Base64 set to this behavior now, although earlier versions
- * broke lines by default.</p>
- *
- * <p>The constants defined in Base64 can be OR-ed together to combine options, so you
- * might make a call like this:</p>
- *
- * <code>String encoded = Base64.encodeBytes( mybytes, Base64.GZIP | Base64.DO_BREAK_LINES );</code>
- * <p>to compress the data before encoding it and then making the output have newline characters.</p>
- * <p>Also...</p>
- * <code>String encoded = Base64.encodeBytes( crazyString.getBytes() );</code>
- *
- *
- *
- * <p>
- * Change Log:
- * </p>
- * <ul>
- *  <li>v2.3.7 - Fixed subtle bug when base 64 input stream contained the
- *   value 01111111, which is an invalid base 64 character but should not
- *   throw an ArrayIndexOutOfBoundsException either. Led to discovery of
- *   mishandling (or potential for better handling) of other bad input
- *   characters. You should now get an IOException if you try decoding
- *   something that has bad characters in it.</li>
- *  <li>v2.3.6 - Fixed bug when breaking lines and the final byte of the encoded
- *   string ended in the last column; the buffer was not properly shrunk and
- *   contained an extra (null) byte that made it into the string.</li>
- *  <li>v2.3.5 - Fixed bug in {@link #encodeFromFile} where estimated buffer size
- *   was wrong for files of size 31, 34, and 37 bytes.</li>
- *  <li>v2.3.4 - Fixed bug when working with gzipped streams whereby flushing
- *   the Base64.OutputStream closed the Base64 encoding (by padding with equals
- *   signs) too soon. Also added an option to suppress the automatic decoding
- *   of gzipped streams. Also added experimental support for specifying a
- *   class loader when using the
- *   {@link #decodeToObject(java.lang.String, int, java.lang.ClassLoader)}
- *   method.</li>
- *  <li>v2.3.3 - Changed default char encoding to US-ASCII which reduces the internal Java
- *   footprint with its CharEncoders and so forth. Fixed some javadocs that were
- *   inconsistent. Removed imports and specified things like java.io.IOException
- *   explicitly inline.</li>
- *  <li>v2.3.2 - Reduced memory footprint! Finally refined the "guessing" of how big the
- *   final encoded data will be so that the code doesn't have to create two output
- *   arrays: an oversized initial one and then a final, exact-sized one. Big win
- *   when using the {@link #encodeBytesToBytes(byte[])} family of methods (and not
- *   using the gzip options which uses a different mechanism with streams and stuff).</li>
- *  <li>v2.3.1 - Added {@link #encodeBytesToBytes(byte[], int, int, int)} and some
- *   similar helper methods to be more efficient with memory by not returning a
- *   String but just a byte array.</li>
- *  <li>v2.3 - <strong>This is not a drop-in replacement!</strong> This is two years of comments
- *   and bug fixes queued up and finally executed. Thanks to everyone who sent
- *   me stuff, and I'm sorry I wasn't able to distribute your fixes to everyone else.
- *   Much bad coding was cleaned up including throwing exceptions where necessary
- *   instead of returning null values or something similar. Here are some changes
- *   that may affect you:
- *   <ul>
- *    <li><em>Does not break lines, by default.</em> This is to keep in compliance with
- *      <a href="http://www.faqs.org/rfcs/rfc3548.html">RFC3548</a>.</li>
- *    <li><em>Throws exceptions instead of returning null values.</em> Because some operations
- *      (especially those that may permit the GZIP option) use IO streams, there
- *      is a possiblity of an java.io.IOException being thrown. After some discussion and
- *      thought, I've changed the behavior of the methods to throw java.io.IOExceptions
- *      rather than return null if ever there's an error. I think this is more
- *      appropriate, though it will require some changes to your code. Sorry,
- *      it should have been done this way to begin with.</li>
- *    <li><em>Removed all references to System.out, System.err, and the like.</em>
- *      Shame on me. All I can say is sorry they were ever there.</li>
- *    <li><em>Throws NullPointerExceptions and IllegalArgumentExceptions</em> as needed
- *      such as when passed arrays are null or offsets are invalid.</li>
- *    <li>Cleaned up as much javadoc as I could to avoid any javadoc warnings.
- *      This was especially annoying before for people who were thorough in their
- *      own projects and then had gobs of javadoc warnings on this file.</li>
- *   </ul>
- *  <li>v2.2.1 - Fixed bug using URL_SAFE and ORDERED encodings. Fixed bug
- *   when using very small files (~&lt; 40 bytes).</li>
- *  <li>v2.2 - Added some helper methods for encoding/decoding directly from
- *   one file to the next. Also added a main() method to support command line
- *   encoding/decoding from one file to the next. Also added these Base64 dialects:
- *   <ol>
- *   <li>The default is RFC3548 format.</li>
- *   <li>Calling Base64.setFormat(Base64.BASE64_FORMAT.URLSAFE_FORMAT) generates
- *   URL and file name friendly format as described in Section 4 of RFC3548.
- *   http://www.faqs.org/rfcs/rfc3548.html</li>
- *   <li>Calling Base64.setFormat(Base64.BASE64_FORMAT.ORDERED_FORMAT) generates
- *   URL and file name friendly format that preserves lexical ordering as described
- *   in http://www.faqs.org/qa/rfcc-1940.html</li>
- *   </ol>
- *   Special thanks to Jim Kellerman at <a href="http://www.powerset.com/">http://www.powerset.com/</a>
- *   for contributing the new Base64 dialects.
- *  </li>
- *
- *  <li>v2.1 - Cleaned up javadoc comments and unused variables and methods. Added
- *   some convenience methods for reading and writing to and from files.</li>
- *  <li>v2.0.2 - Now specifies UTF-8 encoding in places where the code fails on systems
- *   with other encodings (like EBCDIC).</li>
- *  <li>v2.0.1 - Fixed an error when decoding a single byte, that is, when the
- *   encoded data was a single byte.</li>
- *  <li>v2.0 - I got rid of methods that used booleans to set options.
- *   Now everything is more consolidated and cleaner. The code now detects
- *   when data that's being decoded is gzip-compressed and will decompress it
- *   automatically. Generally things are cleaner. You'll probably have to
- *   change some method calls that you were making to support the new
- *   options format (<tt>int</tt>s that you "OR" together).</li>
- *  <li>v1.5.1 - Fixed bug when decompressing and decoding to a
- *   byte[] using <tt>decode( String s, boolean gzipCompressed )</tt>.
- *   Added the ability to "suspend" encoding in the Output Stream so
- *   you can turn on and off the encoding if you need to embed base64
- *   data in an otherwise "normal" stream (like an XML file).</li>
- *  <li>v1.5 - Output stream pases on flush() command but doesn't do anything itself.
- *      This helps when using GZIP streams.
- *      Added the ability to GZip-compress objects before encoding them.</li>
- *  <li>v1.4 - Added helper methods to read/write files.</li>
- *  <li>v1.3.6 - Fixed OutputStream.flush() so that 'position' is reset.</li>
- *  <li>v1.3.5 - Added flag to turn on and off line breaks. Fixed bug in input stream
- *      where last buffer being read, if not completely full, was not returned.</li>
- *  <li>v1.3.4 - Fixed when "improperly padded stream" error was thrown at the wrong time.</li>
- *  <li>v1.3.3 - Fixed I/O streams which were totally messed up.</li>
- * </ul>
- *
- * <p>
- * I am placing this code in the Public Domain. Do with it as you will.
- * This software comes with no guarantees or warranties but with
- * plenty of well-wishing instead!
- * Please visit <a href="http://iharder.net/base64">http://iharder.net/base64</a>
- * periodically to check for updates or to contribute improvements.
- * </p>
- *
- * @author Robert Harder
- * @author rob@iharder.net
- * @version 2.3.7
- */
-public class Base64
-{
-
-/* ********  P U B L I C   F I E L D S  ******** */
-
-
-  /** No options specified. Value is zero. */
-  public final static int NO_OPTIONS = 0;
-
-  /** Specify encoding in first bit. Value is one. */
-  public final static int ENCODE = 1;
-
-
-  /** Specify decoding in first bit. Value is zero. */
-  public final static int DECODE = 0;
-
-
-  /** Specify that data should be gzip-compressed in second bit. Value is two. */
-  public final static int GZIP = 2;
-
-  /** Specify that gzipped data should <em>not</em> be automatically gunzipped. */
-  public final static int DONT_GUNZIP = 4;
-
-
-  /** Do break lines when encoding. Value is 8. */
-  public final static int DO_BREAK_LINES = 8;
-
-  /**
-   * Encode using Base64-like encoding that is URL- and Filename-safe as described
-   * in Section 4 of RFC3548:
-   * <a href="http://www.faqs.org/rfcs/rfc3548.html">http://www.faqs.org/rfcs/rfc3548.html</a>.
-   * It is important to note that data encoded this way is <em>not</em> officially valid Base64,
-   * or at the very least should not be called Base64 without also specifying that is
-   * was encoded using the URL- and Filename-safe dialect.
-   */
-  public final static int URL_SAFE = 16;
-
-
-  /**
-   * Encode using the special "ordered" dialect of Base64 described here:
-   * <a href="http://www.faqs.org/qa/rfcc-1940.html">http://www.faqs.org/qa/rfcc-1940.html</a>.
-   */
-  public final static int ORDERED = 32;
-
-
-/* ********  P R I V A T E   F I E L D S  ******** */
-
-
-  /** Maximum line length (76) of Base64 output. */
-  private final static int MAX_LINE_LENGTH = 76;
-
-
-  /** The equals sign (=) as a byte. */
-  private final static byte EQUALS_SIGN = (byte)'=';
-
-
-  /** The new line character (\n) as a byte. */
-  private final static byte NEW_LINE = (byte)'\n';
-
-
-  /** Preferred encoding. */
-  private final static String PREFERRED_ENCODING = "US-ASCII";
-
-
-  private final static byte WHITE_SPACE_ENC = -5; // Indicates white space in encoding
-  private final static byte EQUALS_SIGN_ENC = -1; // Indicates equals sign in encoding
-
-
-/* ********  S T A N D A R D   B A S E 6 4   A L P H A B E T  ******** */
-
-  /** The 64 valid Base64 values. */
-    /* Host platform me be something funny like EBCDIC, so we hardcode these values. */
-  private final static byte[] _STANDARD_ALPHABET = {
-      (byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G',
-      (byte)'H', (byte)'I', (byte)'J', (byte)'K', (byte)'L', (byte)'M', (byte)'N',
-      (byte)'O', (byte)'P', (byte)'Q', (byte)'R', (byte)'S', (byte)'T', (byte)'U',
-      (byte)'V', (byte)'W', (byte)'X', (byte)'Y', (byte)'Z',
-      (byte)'a', (byte)'b', (byte)'c', (byte)'d', (byte)'e', (byte)'f', (byte)'g',
-      (byte)'h', (byte)'i', (byte)'j', (byte)'k', (byte)'l', (byte)'m', (byte)'n',
-      (byte)'o', (byte)'p', (byte)'q', (byte)'r', (byte)'s', (byte)'t', (byte)'u',
-      (byte)'v', (byte)'w', (byte)'x', (byte)'y', (byte)'z',
-      (byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4', (byte)'5',
-      (byte)'6', (byte)'7', (byte)'8', (byte)'9', (byte)'+', (byte)'/'
-  };
-
-
-  /**
-   * Translates a Base64 value to either its 6-bit reconstruction value
-   * or a negative number indicating some other meaning.
-   **/
-  private final static byte[] _STANDARD_DECODABET = {
-      -9,-9,-9,-9,-9,-9,-9,-9,-9,                 // Decimal  0 -  8
-      -5,-5,                                      // Whitespace: Tab and Linefeed
-      -9,-9,                                      // Decimal 11 - 12
-      -5,                                         // Whitespace: Carriage Return
-      -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 14 - 26
-      -9,-9,-9,-9,-9,                             // Decimal 27 - 31
-      -5,                                         // Whitespace: Space
-      -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,              // Decimal 33 - 42
-      62,                                         // Plus sign at decimal 43
-      -9,-9,-9,                                   // Decimal 44 - 46
-      63,                                         // Slash at decimal 47
-      52,53,54,55,56,57,58,59,60,61,              // Numbers zero through nine
-      -9,-9,-9,                                   // Decimal 58 - 60
-      -1,                                         // Equals sign at decimal 61
-      -9,-9,-9,                                      // Decimal 62 - 64
-      0,1,2,3,4,5,6,7,8,9,10,11,12,13,            // Letters 'A' through 'N'
-      14,15,16,17,18,19,20,21,22,23,24,25,        // Letters 'O' through 'Z'
-      -9,-9,-9,-9,-9,-9,                          // Decimal 91 - 96
-      26,27,28,29,30,31,32,33,34,35,36,37,38,     // Letters 'a' through 'm'
-      39,40,41,42,43,44,45,46,47,48,49,50,51,     // Letters 'n' through 'z'
-      -9,-9,-9,-9,-9                              // Decimal 123 - 127
-      ,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,       // Decimal 128 - 139
-      -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 140 - 152
-      -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 153 - 165
-      -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 166 - 178
-      -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 179 - 191
-      -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 192 - 204
-      -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 205 - 217
-      -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 218 - 230
-      -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 231 - 243
-      -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9         // Decimal 244 - 255
-  };
-
-
-/* ********  U R L   S A F E   B A S E 6 4   A L P H A B E T  ******** */
-
-  /**
-   * Used in the URL- and Filename-safe dialect described in Section 4 of RFC3548:
-   * <a href="http://www.faqs.org/rfcs/rfc3548.html">http://www.faqs.org/rfcs/rfc3548.html</a>.
-   * Notice that the last two bytes become "hyphen" and "underscore" instead of "plus" and "slash."
-   */
-  private final static byte[] _URL_SAFE_ALPHABET = {
-      (byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G',
-      (byte)'H', (byte)'I', (byte)'J', (byte)'K', (byte)'L', (byte)'M', (byte)'N',
-      (byte)'O', (byte)'P', (byte)'Q', (byte)'R', (byte)'S', (byte)'T', (byte)'U',
-      (byte)'V', (byte)'W', (byte)'X', (byte)'Y', (byte)'Z',
-      (byte)'a', (byte)'b', (byte)'c', (byte)'d', (byte)'e', (byte)'f', (byte)'g',
-      (byte)'h', (byte)'i', (byte)'j', (byte)'k', (byte)'l', (byte)'m', (byte)'n',
-      (byte)'o', (byte)'p', (byte)'q', (byte)'r', (byte)'s', (byte)'t', (byte)'u',
-      (byte)'v', (byte)'w', (byte)'x', (byte)'y', (byte)'z',
-      (byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4', (byte)'5',
-      (byte)'6', (byte)'7', (byte)'8', (byte)'9', (byte)'-', (byte)'_'
-  };
-
-  /**
-   * Used in decoding URL- and Filename-safe dialects of Base64.
-   */
-  private final static byte[] _URL_SAFE_DECODABET = {
-      -9,-9,-9,-9,-9,-9,-9,-9,-9,                 // Decimal  0 -  8
-      -5,-5,                                      // Whitespace: Tab and Linefeed
-      -9,-9,                                      // Decimal 11 - 12
-      -5,                                         // Whitespace: Carriage Return
-      -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 14 - 26
-      -9,-9,-9,-9,-9,                             // Decimal 27 - 31
-      -5,                                         // Whitespace: Space
-      -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,              // Decimal 33 - 42
-      -9,                                         // Plus sign at decimal 43
-      -9,                                         // Decimal 44
-      62,                                         // Minus sign at decimal 45
-      -9,                                         // Decimal 46
-      -9,                                         // Slash at decimal 47
-      52,53,54,55,56,57,58,59,60,61,              // Numbers zero through nine
-      -9,-9,-9,                                   // Decimal 58 - 60
-      -1,                                         // Equals sign at decimal 61
-      -9,-9,-9,                                   // Decimal 62 - 64
-      0,1,2,3,4,5,6,7,8,9,10,11,12,13,            // Letters 'A' through 'N'
-      14,15,16,17,18,19,20,21,22,23,24,25,        // Letters 'O' through 'Z'
-      -9,-9,-9,-9,                                // Decimal 91 - 94
-      63,                                         // Underscore at decimal 95
-      -9,                                         // Decimal 96
-      26,27,28,29,30,31,32,33,34,35,36,37,38,     // Letters 'a' through 'm'
-      39,40,41,42,43,44,45,46,47,48,49,50,51,     // Letters 'n' through 'z'
-      -9,-9,-9,-9,-9                              // Decimal 123 - 127
-      ,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 128 - 139
-      -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 140 - 152
-      -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 153 - 165
-      -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 166 - 178
-      -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 179 - 191
-      -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 192 - 204
-      -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 205 - 217
-      -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 218 - 230
-      -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 231 - 243
-      -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9         // Decimal 244 - 255
-  };
-
-
-
-/* ********  O R D E R E D   B A S E 6 4   A L P H A B E T  ******** */
-
-  /**
-   * I don't get the point of this technique, but someone requested it,
-   * and it is described here:
-   * <a href="http://www.faqs.org/qa/rfcc-1940.html">http://www.faqs.org/qa/rfcc-1940.html</a>.
-   */
-  private final static byte[] _ORDERED_ALPHABET = {
-      (byte)'-',
-      (byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4',
-      (byte)'5', (byte)'6', (byte)'7', (byte)'8', (byte)'9',
-      (byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G',
-      (byte)'H', (byte)'I', (byte)'J', (byte)'K', (byte)'L', (byte)'M', (byte)'N',
-      (byte)'O', (byte)'P', (byte)'Q', (byte)'R', (byte)'S', (byte)'T', (byte)'U',
-      (byte)'V', (byte)'W', (byte)'X', (byte)'Y', (byte)'Z',
-      (byte)'_',
-      (byte)'a', (byte)'b', (byte)'c', (byte)'d', (byte)'e', (byte)'f', (byte)'g',
-      (byte)'h', (byte)'i', (byte)'j', (byte)'k', (byte)'l', (byte)'m', (byte)'n',
-      (byte)'o', (byte)'p', (byte)'q', (byte)'r', (byte)'s', (byte)'t', (byte)'u',
-      (byte)'v', (byte)'w', (byte)'x', (byte)'y', (byte)'z'
-  };
-
-  /**
-   * Used in decoding the "ordered" dialect of Base64.
-   */
-  private final static byte[] _ORDERED_DECODABET = {
-      -9,-9,-9,-9,-9,-9,-9,-9,-9,                 // Decimal  0 -  8
-      -5,-5,                                      // Whitespace: Tab and Linefeed
-      -9,-9,                                      // Decimal 11 - 12
-      -5,                                         // Whitespace: Carriage Return
-      -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 14 - 26
-      -9,-9,-9,-9,-9,                             // Decimal 27 - 31
-      -5,                                         // Whitespace: Space
-      -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,              // Decimal 33 - 42
-      -9,                                         // Plus sign at decimal 43
-      -9,                                         // Decimal 44
-      0,                                          // Minus sign at decimal 45
-      -9,                                         // Decimal 46
-      -9,                                         // Slash at decimal 47
-      1,2,3,4,5,6,7,8,9,10,                       // Numbers zero through nine
-      -9,-9,-9,                                   // Decimal 58 - 60
-      -1,                                         // Equals sign at decimal 61
-      -9,-9,-9,                                   // Decimal 62 - 64
-      11,12,13,14,15,16,17,18,19,20,21,22,23,     // Letters 'A' through 'M'
-      24,25,26,27,28,29,30,31,32,33,34,35,36,     // Letters 'N' through 'Z'
-      -9,-9,-9,-9,                                // Decimal 91 - 94
-      37,                                         // Underscore at decimal 95
-      -9,                                         // Decimal 96
-      38,39,40,41,42,43,44,45,46,47,48,49,50,     // Letters 'a' through 'm'
-      51,52,53,54,55,56,57,58,59,60,61,62,63,     // Letters 'n' through 'z'
-      -9,-9,-9,-9,-9                                 // Decimal 123 - 127
-      ,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 128 - 139
-      -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 140 - 152
-      -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 153 - 165
-      -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 166 - 178
-      -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 179 - 191
-      -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 192 - 204
-      -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 205 - 217
-      -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 218 - 230
-      -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,     // Decimal 231 - 243
-      -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9         // Decimal 244 - 255
-  };
-
-
-/* ********  D E T E R M I N E   W H I C H   A L H A B E T  ******** */
-
-
-  /**
-   * Returns one of the _SOMETHING_ALPHABET byte arrays depending on
-   * the options specified.
-   * It's possible, though silly, to specify ORDERED <b>and</b> URLSAFE
-   * in which case one of them will be picked, though there is
-   * no guarantee as to which one will be picked.
-   */
-  private final static byte[] getAlphabet( int options ) {
-    if ((options & URL_SAFE) == URL_SAFE) {
-      return _URL_SAFE_ALPHABET;
-    } else if ((options & ORDERED) == ORDERED) {
-      return _ORDERED_ALPHABET;
-    } else {
-      return _STANDARD_ALPHABET;
-    }
-  } // end getAlphabet
-
-
-  /**
-   * Returns one of the _SOMETHING_DECODABET byte arrays depending on
-   * the options specified.
-   * It's possible, though silly, to specify ORDERED and URL_SAFE
-   * in which case one of them will be picked, though there is
-   * no guarantee as to which one will be picked.
-   */
-  private final static byte[] getDecodabet( int options ) {
-    if( (options & URL_SAFE) == URL_SAFE) {
-      return _URL_SAFE_DECODABET;
-    } else if ((options & ORDERED) == ORDERED) {
-      return _ORDERED_DECODABET;
-    } else {
-      return _STANDARD_DECODABET;
-    }
-  } // end getAlphabet
-
-
-
-  /** Defeats instantiation. */
-  private Base64(){}
-
-
-
-
-/* ********  E N C O D I N G   M E T H O D S  ******** */
-
-
-  /**
-   * Encodes up to the first three bytes of array <var>threeBytes</var>
-   * and returns a four-byte array in Base64 notation.
-   * The actual number of significant bytes in your array is
-   * given by <var>numSigBytes</var>.
-   * The array <var>threeBytes</var> needs only be as big as
-   * <var>numSigBytes</var>.
-   * Code can reuse a byte array by passing a four-byte array as <var>b4</var>.
-   *
-   * @param b4 A reusable byte array to reduce array instantiation
-   * @param threeBytes the array to convert
-   * @param numSigBytes the number of significant bytes in your array
-   * @return four byte array in Base64 notation.
-   * @since 1.5.1
-   */
-  private static byte[] encode3to4( byte[] b4, byte[] threeBytes, int numSigBytes, int options ) {
-    encode3to4( threeBytes, 0, numSigBytes, b4, 0, options );
-    return b4;
-  }   // end encode3to4
-
-
-  /**
-   * <p>Encodes up to three bytes of the array <var>source</var>
-   * and writes the resulting four Base64 bytes to <var>destination</var>.
-   * The source and destination arrays can be manipulated
-   * anywhere along their length by specifying
-   * <var>srcOffset</var> and <var>destOffset</var>.
-   * This method does not check to make sure your arrays
-   * are large enough to accomodate <var>srcOffset</var> + 3 for
-   * the <var>source</var> array or <var>destOffset</var> + 4 for
-   * the <var>destination</var> array.
-   * The actual number of significant bytes in your array is
-   * given by <var>numSigBytes</var>.</p>
-   * <p>This is the lowest level of the encoding methods with
-   * all possible parameters.</p>
-   *
-   * @param source the array to convert
-   * @param srcOffset the index where conversion begins
-   * @param numSigBytes the number of significant bytes in your array
-   * @param destination the array to hold the conversion
-   * @param destOffset the index where output will be put
-   * @return the <var>destination</var> array
-   * @since 1.3
-   */
-  private static byte[] encode3to4(
-      byte[] source, int srcOffset, int numSigBytes,
-      byte[] destination, int destOffset, int options ) {
-
-    byte[] ALPHABET = getAlphabet( options );
-
-    //           1         2         3
-    // 01234567890123456789012345678901 Bit position
-    // --------000000001111111122222222 Array position from threeBytes
-    // --------|    ||    ||    ||    | Six bit groups to index ALPHABET
-    //          >>18  >>12  >> 6  >> 0  Right shift necessary
-    //                0x3f  0x3f  0x3f  Additional AND
-
-    // Create buffer with zero-padding if there are only one or two
-    // significant bytes passed in the array.
-    // We have to shift left 24 in order to flush out the 1's that appear
-    // when Java treats a value as negative that is cast from a byte to an int.
-    int inBuff =   ( numSigBytes > 0 ? ((source[ srcOffset     ] << 24) >>>  8) : 0 )
-        | ( numSigBytes > 1 ? ((source[ srcOffset + 1 ] << 24) >>> 16) : 0 )
-        | ( numSigBytes > 2 ? ((source[ srcOffset + 2 ] << 24) >>> 24) : 0 );
-
-    switch( numSigBytes )
-    {
-    case 3:
-      destination[ destOffset     ] = ALPHABET[ (inBuff >>> 18)        ];
-      destination[ destOffset + 1 ] = ALPHABET[ (inBuff >>> 12) & 0x3f ];
-      destination[ destOffset + 2 ] = ALPHABET[ (inBuff >>>  6) & 0x3f ];
-      destination[ destOffset + 3 ] = ALPHABET[ (inBuff       ) & 0x3f ];
-      return destination;
-
-    case 2:
-      destination[ destOffset     ] = ALPHABET[ (inBuff >>> 18)        ];
-      destination[ destOffset + 1 ] = ALPHABET[ (inBuff >>> 12) & 0x3f ];
-      destination[ destOffset + 2 ] = ALPHABET[ (inBuff >>>  6) & 0x3f ];
-      destination[ destOffset + 3 ] = EQUALS_SIGN;
-      return destination;
-
-    case 1:
-      destination[ destOffset     ] = ALPHABET[ (inBuff >>> 18)        ];
-      destination[ destOffset + 1 ] = ALPHABET[ (inBuff >>> 12) & 0x3f ];
-      destination[ destOffset + 2 ] = EQUALS_SIGN;
-      destination[ destOffset + 3 ] = EQUALS_SIGN;
-      return destination;
-
-    default:
-      return destination;
-    }   // end switch
-  }   // end encode3to4
-
-
-
-  /**
-   * Performs Base64 encoding on the <code>raw</code> ByteBuffer,
-   * writing it to the <code>encoded</code> ByteBuffer.
-   * This is an experimental feature. Currently it does not
-   * pass along any options (such as {@link #DO_BREAK_LINES}
-   * or {@link #GZIP}.
-   *
-   * @param raw input buffer
-   * @param encoded output buffer
-   * @since 2.3
-   */
-  public static void encode( java.nio.ByteBuffer raw, java.nio.ByteBuffer encoded ){
-    byte[] raw3 = new byte[3];
-    byte[] enc4 = new byte[4];
-
-    while( raw.hasRemaining() ){
-      int rem = Math.min(3,raw.remaining());
-      raw.get(raw3,0,rem);
-      Base64.encode3to4(enc4, raw3, rem, Base64.NO_OPTIONS );
-      encoded.put(enc4);
-    }   // end input remaining
-  }
-
-
-  /**
-   * Performs Base64 encoding on the <code>raw</code> ByteBuffer,
-   * writing it to the <code>encoded</code> CharBuffer.
-   * This is an experimental feature. Currently it does not
-   * pass along any options (such as {@link #DO_BREAK_LINES}
-   * or {@link #GZIP}.
-   *
-   * @param raw input buffer
-   * @param encoded output buffer
-   * @since 2.3
-   */
-  public static void encode( java.nio.ByteBuffer raw, java.nio.CharBuffer encoded ){
-    byte[] raw3 = new byte[3];
-    byte[] enc4 = new byte[4];
-
-    while( raw.hasRemaining() ){
-      int rem = Math.min(3,raw.remaining());
-      raw.get(raw3,0,rem);
-      Base64.encode3to4(enc4, raw3, rem, Base64.NO_OPTIONS );
-      for( int i = 0; i < 4; i++ ){
-        encoded.put( (char)(enc4[i] & 0xFF) );
-      }
-    }   // end input remaining
-  }
-
-
-
-
-  /**
-   * Serializes an object and returns the Base64-encoded
-   * version of that serialized object.
-   *
-   * <p>As of v 2.3, if the object
-   * cannot be serialized or there is another error,
-   * the method will throw an java.io.IOException. <b>This is new to v2.3!</b>
-   * In earlier versions, it just returned a null value, but
-   * in retrospect that's a pretty poor way to handle it.</p>
-   *
-   * The object is not GZip-compressed before being encoded.
-   *
-   * @param serializableObject The object to encode
-   * @return The Base64-encoded object
-   * @throws java.io.IOException if there is an error
-   * @throws NullPointerException if serializedObject is null
-   * @since 1.4
-   */
-  public static String encodeObject( java.io.Serializable serializableObject )
-      throws java.io.IOException {
-    return encodeObject( serializableObject, NO_OPTIONS );
-  }   // end encodeObject
-
-
-
-  /**
-   * Serializes an object and returns the Base64-encoded
-   * version of that serialized object.
-   *
-   * <p>As of v 2.3, if the object
-   * cannot be serialized or there is another error,
-   * the method will throw an java.io.IOException. <b>This is new to v2.3!</b>
-   * In earlier versions, it just returned a null value, but
-   * in retrospect that's a pretty poor way to handle it.</p>
-   *
-   * The object is not GZip-compressed before being encoded.
-   * <p>
-   * Example options:<pre>
-   *   GZIP: gzip-compresses object before encoding it.
-   *   DO_BREAK_LINES: break lines at 76 characters
-   * </pre>
-   * <p>
-   * Example: <code>encodeObject( myObj, Base64.GZIP )</code> or
-   * <p>
-   * Example: <code>encodeObject( myObj, Base64.GZIP | Base64.DO_BREAK_LINES )</code>
-   *
-   * @param serializableObject The object to encode
-   * @param options Specified options
-   * @return The Base64-encoded object
-   * @see Base64#GZIP
-   * @see Base64#DO_BREAK_LINES
-   * @throws java.io.IOException if there is an error
-   * @since 2.0
-   */
-  public static String encodeObject( java.io.Serializable serializableObject, int options )
-      throws java.io.IOException {
-
-    if( serializableObject == null ){
-      throw new NullPointerException( "Cannot serialize a null object." );
-    }   // end if: null
-
-    // Streams
-    java.io.ByteArrayOutputStream  baos  = null;
-    java.io.OutputStream           b64os = null;
-    java.util.zip.GZIPOutputStream gzos  = null;
-    java.io.ObjectOutputStream     oos   = null;
-
-
-    try {
-      // ObjectOutputStream -> (GZIP) -> Base64 -> ByteArrayOutputStream
-      baos  = new java.io.ByteArrayOutputStream();
-      b64os = new Base64.OutputStream( baos, ENCODE | options );
-      if( (options & GZIP) != 0 ){
-        // Gzip
-        gzos = new java.util.zip.GZIPOutputStream(b64os);
-        oos = new java.io.ObjectOutputStream( gzos );
-      } else {
-        // Not gzipped
-        oos = new java.io.ObjectOutputStream( b64os );
-      }
-      oos.writeObject( serializableObject );
-    }   // end try
-    catch( java.io.IOException e ) {
-      // Catch it and then throw it immediately so that
-      // the finally{} block is called for cleanup.
-      throw e;
-    }   // end catch
-    finally {
-      try{ oos.close();   } catch( Exception e ){}
-      try{ gzos.close();  } catch( Exception e ){}
-      try{ b64os.close(); } catch( Exception e ){}
-      try{ baos.close();  } catch( Exception e ){}
-    }   // end finally
-
-    // Return value according to relevant encoding.
-    try {
-      return new String( baos.toByteArray(), PREFERRED_ENCODING );
-    }   // end try
-    catch (java.io.UnsupportedEncodingException uue){
-      // Fall back to some Java default
-      return new String( baos.toByteArray(), StandardCharsets.UTF_8 );
-    }   // end catch
-
-  }   // end encode
-
-
-
-  /**
-   * Encodes a byte array into Base64 notation.
-   * Does not GZip-compress data.
-   *
-   * @param source The data to convert
-   * @return The data in Base64-encoded form
-   * @throws NullPointerException if source array is null
-   * @since 1.4
-   */
-  public static String encodeBytes( byte[] source ) {
-    // Since we're not going to have the GZIP encoding turned on,
-    // we're not going to have an java.io.IOException thrown, so
-    // we should not force the user to have to catch it.
-    String encoded = null;
-    try {
-      encoded = encodeBytes(source, 0, source.length, NO_OPTIONS);
-    } catch (java.io.IOException ex) {
-      assert false : ex.getMessage();
-    }   // end catch
-    assert encoded != null;
-    return encoded;
-  }   // end encodeBytes
-
-
-
-  /**
-   * Encodes a byte array into Base64 notation.
-   * <p>
-   * Example options:<pre>
-   *   GZIP: gzip-compresses object before encoding it.
-   *   DO_BREAK_LINES: break lines at 76 characters
-   *     <i>Note: Technically, this makes your encoding non-compliant.</i>
-   * </pre>
-   * <p>
-   * Example: <code>encodeBytes( myData, Base64.GZIP )</code> or
-   * <p>
-   * Example: <code>encodeBytes( myData, Base64.GZIP | Base64.DO_BREAK_LINES )</code>
-   *
-   *
-   * <p>As of v 2.3, if there is an error with the GZIP stream,
-   * the method will throw an java.io.IOException. <b>This is new to v2.3!</b>
-   * In earlier versions, it just returned a null value, but
-   * in retrospect that's a pretty poor way to handle it.</p>
-   *
-   *
-   * @param source The data to convert
-   * @param options Specified options
-   * @return The Base64-encoded data as a String
-   * @see Base64#GZIP
-   * @see Base64#DO_BREAK_LINES
-   * @throws java.io.IOException if there is an error
-   * @throws NullPointerException if source array is null
-   * @since 2.0
-   */
-  public static String encodeBytes( byte[] source, int options ) throws java.io.IOException {
-    return encodeBytes( source, 0, source.length, options );
-  }   // end encodeBytes
-
-
-  /**
-   * Encodes a byte array into Base64 notation.
-   * Does not GZip-compress data.
-   *
-   * <p>As of v 2.3, if there is an error,
-   * the method will throw an java.io.IOException. <b>This is new to v2.3!</b>
-   * In earlier versions, it just returned a null value, but
-   * in retrospect that's a pretty poor way to handle it.</p>
-   *
-   *
-   * @param source The data to convert
-   * @param off Offset in array where conversion should begin
-   * @param len Length of data to convert
-   * @return The Base64-encoded data as a String
-   * @throws NullPointerException if source array is null
-   * @throws IllegalArgumentException if source array, offset, or length are invalid
-   * @since 1.4
-   */
-  public static String encodeBytes( byte[] source, int off, int len ) {
-    // Since we're not going to have the GZIP encoding turned on,
-    // we're not going to have an java.io.IOException thrown, so
-    // we should not force the user to have to catch it.
-    String encoded = null;
-    try {
-      encoded = encodeBytes( source, off, len, NO_OPTIONS );
-    } catch (java.io.IOException ex) {
-      assert false : ex.getMessage();
-    }   // end catch
-    assert encoded != null;
-    return encoded;
-  }   // end encodeBytes
-
-
-
-  /**
-   * Encodes a byte array into Base64 notation.
-   * <p>
-   * Example options:<pre>
-   *   GZIP: gzip-compresses object before encoding it.
-   *   DO_BREAK_LINES: break lines at 76 characters
-   *     <i>Note: Technically, this makes your encoding non-compliant.</i>
-   * </pre>
-   * <p>
-   * Example: <code>encodeBytes( myData, Base64.GZIP )</code> or
-   * <p>
-   * Example: <code>encodeBytes( myData, Base64.GZIP | Base64.DO_BREAK_LINES )</code>
-   *
-   *
-   * <p>As of v 2.3, if there is an error with the GZIP stream,
-   * the method will throw an java.io.IOException. <b>This is new to v2.3!</b>
-   * In earlier versions, it just returned a null value, but
-   * in retrospect that's a pretty poor way to handle it.</p>
-   *
-   *
-   * @param source The data to convert
-   * @param off Offset in array where conversion should begin
-   * @param len Length of data to convert
-   * @param options Specified options
-   * @return The Base64-encoded data as a String
-   * @see Base64#GZIP
-   * @see Base64#DO_BREAK_LINES
-   * @throws java.io.IOException if there is an error
-   * @throws NullPointerException if source array is null
-   * @throws IllegalArgumentException if source array, offset, or length are invalid
-   * @since 2.0
-   */
-  public static String encodeBytes( byte[] source, int off, int len, int options ) throws java.io.IOException {
-    byte[] encoded = encodeBytesToBytes( source, off, len, options );
-
-    // Return value according to relevant encoding.
-    try {
-      return new String( encoded, PREFERRED_ENCODING );
-    }   // end try
-    catch (java.io.UnsupportedEncodingException uue) {
-      return new String( encoded, StandardCharsets.UTF_8 );
-    }   // end catch
-
-  }   // end encodeBytes
-
-
-
-
-  /**
-   * Similar to {@link #encodeBytes(byte[])} but returns
-   * a byte array instead of instantiating a String. This is more efficient
-   * if you're working with I/O streams and have large data sets to encode.
-   *
-   *
-   * @param source The data to convert
-   * @return The Base64-encoded data as a byte[] (of ASCII characters)
-   * @throws NullPointerException if source array is null
-   * @since 2.3.1
-   */
-  public static byte[] encodeBytesToBytes( byte[] source ) {
-    byte[] encoded = null;
-    try {
-      encoded = encodeBytesToBytes( source, 0, source.length, Base64.NO_OPTIONS );
-    } catch( java.io.IOException ex ) {
-      assert false : "IOExceptions only come from GZipping, which is turned off: " + ex.getMessage();
-    }
-    return encoded;
-  }
-
-
-  /**
-   * Similar to {@link #encodeBytes(byte[], int, int, int)} but returns
-   * a byte array instead of instantiating a String. This is more efficient
-   * if you're working with I/O streams and have large data sets to encode.
-   *
-   *
-   * @param source The data to convert
-   * @param off Offset in array where conversion should begin
-   * @param len Length of data to convert
-   * @param options Specified options
-   * @return The Base64-encoded data as a String
-   * @see Base64#GZIP
-   * @see Base64#DO_BREAK_LINES
-   * @throws java.io.IOException if there is an error
-   * @throws NullPointerException if source array is null
-   * @throws IllegalArgumentException if source array, offset, or length are invalid
-   * @since 2.3.1
-   */
-  public static byte[] encodeBytesToBytes( byte[] source, int off, int len, int options ) throws java.io.IOException {
-
-    if( source == null ){
-      throw new NullPointerException( "Cannot serialize a null array." );
-    }   // end if: null
-
-    if( off < 0 ){
-      throw new IllegalArgumentException( "Cannot have negative offset: " + off );
-    }   // end if: off < 0
-
-    if( len < 0 ){
-      throw new IllegalArgumentException( "Cannot have length offset: " + len );
-    }   // end if: len < 0
-
-    if( off + len > source.length  ){
-      throw new IllegalArgumentException(
-          String.format( Locale.ROOT,
-              "Cannot have offset of %d and length of %d with array of length %d",
-              off,len,source.length ) );
-    }   // end if: off < 0
-
-
-
-    // Compress?
-    if( (options & GZIP) != 0 ) {
-      java.io.ByteArrayOutputStream  baos  = null;
-      java.util.zip.GZIPOutputStream gzos  = null;
-      Base64.OutputStream            b64os = null;
-
-      try {
-        // GZip -> Base64 -> ByteArray
-        baos = new java.io.ByteArrayOutputStream();
-        b64os = new Base64.OutputStream( baos, ENCODE | options );
-        gzos  = new java.util.zip.GZIPOutputStream( b64os );
-
-        gzos.write( source, off, len );
-        gzos.close();
-      }   // end try
-      catch( java.io.IOException e ) {
-        // Catch it and then throw it immediately so that
-        // the finally{} block is called for cleanup.
-        throw e;
-      }   // end catch
-      finally {
-        try{ gzos.close();  } catch( Exception e ){}
-        try{ b64os.close(); } catch( Exception e ){}
-        try{ baos.close();  } catch( Exception e ){}
-      }   // end finally
-
-      return baos.toByteArray();
-    }   // end if: compress
-
-    // Else, don't compress. Better not to use streams at all then.
-    else {
-      boolean breakLines = (options & DO_BREAK_LINES) != 0;
-
-      //int    len43   = len * 4 / 3;
-      //byte[] outBuff = new byte[   ( len43 )                      // Main 4:3
-      //                           + ( (len % 3) > 0 ? 4 : 0 )      // Account for padding
-      //                           + (breakLines ? ( len43 / MAX_LINE_LENGTH ) : 0) ]; // New lines
-      // Try to determine more precisely how big the array needs to be.
-      // If we get it right, we don't have to do an array copy, and
-      // we save a bunch of memory.
-      int encLen = ( len / 3 ) * 4 + ( len % 3 > 0 ? 4 : 0 ); // Bytes needed for actual encoding
-      if( breakLines ){
-        encLen += encLen / MAX_LINE_LENGTH; // Plus extra newline characters
-      }
-      byte[] outBuff = new byte[ encLen ];
-
-
-      int d = 0;
-      int e = 0;
-      int len2 = len - 2;
-      int lineLength = 0;
-      for( ; d < len2; d+=3, e+=4 ) {
-        encode3to4( source, d+off, 3, outBuff, e, options );
-
-        lineLength += 4;
-        if( breakLines && lineLength >= MAX_LINE_LENGTH )
-        {
-          outBuff[e+4] = NEW_LINE;
-          e++;
-          lineLength = 0;
-        }   // end if: end of line
-      }   // en dfor: each piece of array
-
-      if( d < len ) {
-        encode3to4( source, d+off, len - d, outBuff, e, options );
-        e += 4;
-      }   // end if: some padding needed
-
-
-      // Only resize array if we didn't guess it right.
-      if( e <= outBuff.length - 1 ){
-        // If breaking lines and the last byte falls right at
-        // the line length (76 bytes per line), there will be
-        // one extra byte, and the array will need to be resized.
-        // Not too bad of an estimate on array size, I'd say.
-        byte[] finalOut = new byte[e];
-        System.arraycopy(outBuff,0, finalOut,0,e);
-        //System.err.println("Having to resize array from " + outBuff.length + " to " + e );
-        return finalOut;
-      } else {
-        //System.err.println("No need to resize array.");
-        return outBuff;
-      }
-
-    }   // end else: don't compress
-
-  }   // end encodeBytesToBytes
-
-
-
-
-
-/* ********  D E C O D I N G   M E T H O D S  ******** */
-
-
-  /**
-   * Decodes four bytes from array <var>source</var>
-   * and writes the resulting bytes (up to three of them)
-   * to <var>destination</var>.
-   * The source and destination arrays can be manipulated
-   * anywhere along their length by specifying
-   * <var>srcOffset</var> and <var>destOffset</var>.
-   * This method does not check to make sure your arrays
-   * are large enough to accomodate <var>srcOffset</var> + 4 for
-   * the <var>source</var> array or <var>destOffset</var> + 3 for
-   * the <var>destination</var> array.
-   * This method returns the actual number of bytes that
-   * were converted from the Base64 encoding.
-   * <p>This is the lowest level of the decoding methods with
-   * all possible parameters.</p>
-   *
-   *
-   * @param source the array to convert
-   * @param srcOffset the index where conversion begins
-   * @param destination the array to hold the conversion
-   * @param destOffset the index where output will be put
-   * @param options alphabet type is pulled from this (standard, url-safe, ordered)
-   * @return the number of decoded bytes converted
-   * @throws NullPointerException if source or destination arrays are null
-   * @throws IllegalArgumentException if srcOffset or destOffset are invalid
-   *         or there is not enough room in the array.
-   * @since 1.3
-   */
-  private static int decode4to3(
-      byte[] source, int srcOffset,
-      byte[] destination, int destOffset, int options ) {
-
-    // Lots of error checking and exception throwing
-    if( source == null ){
-      throw new NullPointerException( "Source array was null." );
-    }   // end if
-    if( destination == null ){
-      throw new NullPointerException( "Destination array was null." );
-    }   // end if
-    if( srcOffset < 0 || srcOffset + 3 >= source.length ){
-      throw new IllegalArgumentException( String.format( Locale.ROOT,
-          "Source array with length %d cannot have offset of %d and still process four bytes.", source.length, srcOffset ) );
-    }   // end if
-    if( destOffset < 0 || destOffset +2 >= destination.length ){
-      throw new IllegalArgumentException( String.format( Locale.ROOT,
-          "Destination array with length %d cannot have offset of %d and still store three bytes.", destination.length, destOffset ) );
-    }   // end if
-
-
-    byte[] DECODABET = getDecodabet( options );
-
-    // Example: Dk==
-    if( source[ srcOffset + 2] == EQUALS_SIGN ) {
-      // Two ways to do the same thing. Don't know which way I like best.
-      //int outBuff =   ( ( DECODABET[ source[ srcOffset    ] ] << 24 ) >>>  6 )
-      //              | ( ( DECODABET[ source[ srcOffset + 1] ] << 24 ) >>> 12 );
-      int outBuff =   ( ( DECODABET[ source[ srcOffset    ] ] & 0xFF ) << 18 )
-          | ( ( DECODABET[ source[ srcOffset + 1] ] & 0xFF ) << 12 );
-
-      destination[ destOffset ] = (byte)( outBuff >>> 16 );
-      return 1;
-    }
-
-    // Example: DkL=
-    else if( source[ srcOffset + 3 ] == EQUALS_SIGN ) {
-      // Two ways to do the same thing. Don't know which way I like best.
-      //int outBuff =   ( ( DECODABET[ source[ srcOffset     ] ] << 24 ) >>>  6 )
-      //              | ( ( DECODABET[ source[ srcOffset + 1 ] ] << 24 ) >>> 12 )
-      //              | ( ( DECODABET[ source[ srcOffset + 2 ] ] << 24 ) >>> 18 );
-      int outBuff =   ( ( DECODABET[ source[ srcOffset     ] ] & 0xFF ) << 18 )
-          | ( ( DECODABET[ source[ srcOffset + 1 ] ] & 0xFF ) << 12 )
-          | ( ( DECODABET[ source[ srcOffset + 2 ] ] & 0xFF ) <<  6 );
-
-      destination[ destOffset     ] = (byte)( outBuff >>> 16 );
-      destination[ destOffset + 1 ] = (byte)( outBuff >>>  8 );
-      return 2;
-    }
-
-    // Example: DkLE
-    else {
-      // Two ways to do the same thing. Don't know which way I like best.
-      //int outBuff =   ( ( DECODABET[ source[ srcOffset     ] ] << 24 ) >>>  6 )
-      //              | ( ( DECODABET[ source[ srcOffset + 1 ] ] << 24 ) >>> 12 )
-      //              | ( ( DECODABET[ source[ srcOffset + 2 ] ] << 24 ) >>> 18 )
-      //              | ( ( DECODABET[ source[ srcOffset + 3 ] ] << 24 ) >>> 24 );
-      int outBuff =   ( ( DECODABET[ source[ srcOffset     ] ] & 0xFF ) << 18 )
-          | ( ( DECODABET[ source[ srcOffset + 1 ] ] & 0xFF ) << 12 )
-          | ( ( DECODABET[ source[ srcOffset + 2 ] ] & 0xFF ) <<  6)
-          | ( ( DECODABET[ source[ srcOffset + 3 ] ] & 0xFF )      );
-
-
-      destination[ destOffset     ] = (byte)( outBuff >> 16 );
-      destination[ destOffset + 1 ] = (byte)( outBuff >>  8 );
-      destination[ destOffset + 2 ] = (byte)( outBuff       );
-
-      return 3;
-    }
-  }   // end decodeToBytes
-
-
-
-
-
-  /**
-   * Low-level access to decoding ASCII characters in
-   * the form of a byte array. <strong>Ignores GUNZIP option, if
-   * it's set.</strong> This is not generally a recommended method,
-   * although it is used internally as part of the decoding process.
-   * Special case: if len = 0, an empty array is returned. Still,
-   * if you need more speed and reduced memory footprint (and aren't
-   * gzipping), consider this method.
-   *
-   * @param source The Base64 encoded data
-   * @return decoded data
-   * @since 2.3.1
-   */
-  public static byte[] decode( byte[] source )
-      throws java.io.IOException {
-    byte[] decoded = null;
-//        try {
-    decoded = decode( source, 0, source.length, Base64.NO_OPTIONS );
-//        } catch( java.io.IOException ex ) {
-//            assert false : "IOExceptions only come from GZipping, which is turned off: " + ex.getMessage();
-//        }
-    return decoded;
-  }
-
-
-
-  /**
-   * Low-level access to decoding ASCII characters in
-   * the form of a byte array. <strong>Ignores GUNZIP option, if
-   * it's set.</strong> This is not generally a recommended method,
-   * although it is used internally as part of the decoding process.
-   * Special case: if len = 0, an empty array is returned. Still,
-   * if you need more speed and reduced memory footprint (and aren't
-   * gzipping), consider this method.
-   *
-   * @param source The Base64 encoded data
-   * @param off    The offset of where to begin decoding
-   * @param len    The length of characters to decode
-   * @param options Can specify options such as alphabet type to use
-   * @return decoded data
-   * @throws java.io.IOException If bogus characters exist in source data
-   * @since 1.3
-   */
-  public static byte[] decode( byte[] source, int off, int len, int options )
-      throws java.io.IOException {
-
-    // Lots of error checking and exception throwing
-    if( source == null ){
-      throw new NullPointerException( "Cannot decode null source array." );
-    }   // end if
-    if( off < 0 || off + len > source.length ){
-      throw new IllegalArgumentException( String.format( Locale.ROOT,
-          "Source array with length %d cannot have offset of %d and process %d bytes.", source.length, off, len ) );
-    }   // end if
-
-    if( len == 0 ){
-      return new byte[0];
-    }else if( len < 4 ){
-      throw new IllegalArgumentException(
-          "Base64-encoded string must have at least four characters, but length specified was " + len );
-    }   // end if
-
-    byte[] DECODABET = getDecodabet( options );
-
-    int    len34   = len * 3 / 4;       // Estimate on array size
-    byte[] outBuff = new byte[ len34 ]; // Upper limit on size of output
-    int    outBuffPosn = 0;             // Keep track of where we're writing
-
-    byte[] b4        = new byte[4];     // Four byte buffer from source, eliminating white space
-    int    b4Posn    = 0;               // Keep track of four byte input buffer
-    int    i         = 0;               // Source array counter
-    byte   sbiDecode = 0;               // Special value from DECODABET
-
-    for( i = off; i < off+len; i++ ) {  // Loop through source
-
-      sbiDecode = DECODABET[ source[i]&0xFF ];
-
-      // White space, Equals sign, or legit Base64 character
-      // Note the values such as -5 and -9 in the
-      // DECODABETs at the top of the file.
-      if( sbiDecode >= WHITE_SPACE_ENC )  {
-        if( sbiDecode >= EQUALS_SIGN_ENC ) {
-          b4[ b4Posn++ ] = source[i];         // Save non-whitespace
-          if( b4Posn > 3 ) {                  // Time to decode?
-            outBuffPosn += decode4to3( b4, 0, outBuff, outBuffPosn, options );
-            b4Posn = 0;
-
-            // If that was the equals sign, break out of 'for' loop
-            if( source[i] == EQUALS_SIGN ) {
-              break;
-            }   // end if: equals sign
-          }   // end if: quartet built
-        }   // end if: equals sign or better
-      }   // end if: white space, equals sign or better
-      else {
-        // There's a bad input character in the Base64 stream.
-        throw new java.io.IOException( String.format( Locale.ROOT,
-            "Bad Base64 input character decimal %d in array position %d",
-            ((int)source[i])&0xFF, i ) );
-      }   // end else:
-    }   // each input character
-
-    byte[] out = new byte[ outBuffPosn ];
-    System.arraycopy( outBuff, 0, out, 0, outBuffPosn );
-    return out;
-  }   // end decode
-
-
-
-
-  /**
-   * Decodes data from Base64 notation, automatically
-   * detecting gzip-compressed data and decompressing it.
-   *
-   * @param s the string to decode
-   * @return the decoded data
-   * @throws java.io.IOException If there is a problem
-   * @since 1.4
-   */
-  public static byte[] decode( String s ) throws java.io.IOException {
-    return decode( s, NO_OPTIONS );
-  }
-
-
-
-  /**
-   * Decodes data from Base64 notation, automatically
-   * detecting gzip-compressed data and decompressing it.
-   *
-   * @param s the string to decode
-   * @param options encode options such as URL_SAFE
-   * @return the decoded data
-   * @throws java.io.IOException if there is an error
-   * @throws NullPointerException if <tt>s</tt> is null
-   * @since 1.4
-   */
-  public static byte[] decode( String s, int options ) throws java.io.IOException {
-
-    if( s == null ){
-      throw new NullPointerException( "Input string was null." );
-    }   // end if
-
-    byte[] bytes;
-    try {
-      bytes = s.getBytes( PREFERRED_ENCODING );
-    }   // end try
-    catch( java.io.UnsupportedEncodingException uee ) {
-      bytes = s.getBytes( StandardCharsets.UTF_8 );
-    }   // end catch
-    //</change>
-
-    // Decode
-    bytes = decode( bytes, 0, bytes.length, options );
-
-    // Check to see if it's gzip-compressed
-    // GZIP Magic Two-Byte Number: 0x8b1f (35615)
-    boolean dontGunzip = (options & DONT_GUNZIP) != 0;
-    if( (bytes != null) && (bytes.length >= 4) && (!dontGunzip) ) {
-
-      int head = ((int)bytes[0] & 0xff) | ((bytes[1] << 8) & 0xff00);
-      if( java.util.zip.GZIPInputStream.GZIP_MAGIC == head )  {
-        java.io.ByteArrayInputStream  bais = null;
-        java.util.zip.GZIPInputStream gzis = null;
-        java.io.ByteArrayOutputStream baos = null;
-        byte[] buffer = new byte[2048];
-        int    length = 0;
-
-        try {
-          baos = new java.io.ByteArrayOutputStream();
-          bais = new java.io.ByteArrayInputStream( bytes );
-          gzis = new java.util.zip.GZIPInputStream( bais );
-
-          while( ( length = gzis.read( buffer ) ) >= 0 ) {
-            baos.write(buffer,0,length);
-          }   // end while: reading input
-
-          // No error? Get new bytes.
-          bytes = baos.toByteArray();
-
-        }   // end try
-        catch( java.io.IOException e ) {
-          e.printStackTrace();
-          // Just return originally-decoded bytes
-        }   // end catch
-        finally {
-          try{ baos.close(); } catch( Exception e ){}
-          try{ gzis.close(); } catch( Exception e ){}
-          try{ bais.close(); } catch( Exception e ){}
-        }   // end finally
-
-      }   // end if: gzipped
-    }   // end if: bytes.length >= 2
-
-    return bytes;
-  }   // end decode
-
-
-
-  /**
-   * Attempts to decode Base64 data and deserialize a Java
-   * Object within. Returns <tt>null</tt> if there was an error.
-   *
-   * @param encodedObject The Base64 data to decode
-   * @return The decoded and deserialized object
-   * @throws NullPointerException if encodedObject is null
-   * @throws java.io.IOException if there is a general error
-   * @throws ClassNotFoundException if the decoded object is of a
-   *         class that cannot be found by the JVM
-   * @since 1.5
-   */
-  public static Object decodeToObject( String encodedObject )
-      throws java.io.IOException, java.lang.ClassNotFoundException {
-    return decodeToObject(encodedObject,NO_OPTIONS,null);
-  }
-
-
-  /**
-   * Attempts to decode Base64 data and deserialize a Java
-   * Object within. Returns <tt>null</tt> if there was an error.
-   * If <tt>loader</tt> is not null, it will be the class loader
-   * used when deserializing.
-   *
-   * @param encodedObject The Base64 data to decode
-   * @param options Various parameters related to decoding
-   * @param loader Optional class loader to use in deserializing classes.
-   * @return The decoded and deserialized object
-   * @throws NullPointerException if encodedObject is null
-   * @throws java.io.IOException if there is a general error
-   * @throws ClassNotFoundException if the decoded object is of a
-   *         class that cannot be found by the JVM
-   * @since 2.3.4
-   */
-  public static Object decodeToObject(
-      String encodedObject, int options, final ClassLoader loader )
-      throws java.io.IOException, java.lang.ClassNotFoundException {
-
-    // Decode and gunzip if necessary
-    byte[] objBytes = decode( encodedObject, options );
-
-    java.io.ByteArrayInputStream  bais = null;
-    java.io.ObjectInputStream     ois  = null;
-    Object obj = null;
-
-    try {
-      bais = new java.io.ByteArrayInputStream( objBytes );
-
-      // If no custom class loader is provided, use Java's builtin OIS.
-      if( loader == null ){
-        ois  = new java.io.ObjectInputStream( bais );
-      }   // end if: no loader provided
-
-      // Else make a customized object input stream that uses
-      // the provided class loader.
-      else {
-        ois = new java.io.ObjectInputStream(bais){
-          @Override
-          public Class<?> resolveClass(java.io.ObjectStreamClass streamClass)
-              throws java.io.IOException, ClassNotFoundException {
-            Class c = Class.forName(streamClass.getName(), false, loader);
-            if( c == null ){
-              return super.resolveClass(streamClass);
-            } else {
-              return c;   // Class loader knows of this class.
-            }   // end else: not null
-          }   // end resolveClass
-        };  // end ois
-      }   // end else: no custom class loader
-
-      obj = ois.readObject();
-    }   // end try
-    catch( java.io.IOException e ) {
-      throw e;    // Catch and throw in order to execute finally{}
-    }   // end catch
-    catch( java.lang.ClassNotFoundException e ) {
-      throw e;    // Catch and throw in order to execute finally{}
-    }   // end catch
-    finally {
-      try{ bais.close(); } catch( Exception e ){}
-      try{ ois.close();  } catch( Exception e ){}
-    }   // end finally
-
-    return obj;
-  }   // end decodeObject
-
-
-
-  /**
-   * Convenience method for encoding data to a file.
-   *
-   * <p>As of v 2.3, if there is a error,
-   * the method will throw an java.io.IOException. <b>This is new to v2.3!</b>
-   * In earlier versions, it just returned false, but
-   * in retrospect that's a pretty poor way to handle it.</p>
-   *
-   * @param dataToEncode byte array of data to encode in base64 form
-   * @param filename Filename for saving encoded data
-   * @throws java.io.IOException if there is an error
-   * @throws NullPointerException if dataToEncode is null
-   * @since 2.1
-   */
-  public static void encodeToFile( byte[] dataToEncode, String filename )
-      throws java.io.IOException {
-
-    if( dataToEncode == null ){
-      throw new NullPointerException( "Data to encode was null." );
-    }   // end iff
-
-    Base64.OutputStream bos = null;
-    try {
-      bos = new Base64.OutputStream(
-          new java.io.FileOutputStream( filename ), Base64.ENCODE );
-      bos.write( dataToEncode );
-    }   // end try
-    catch( java.io.IOException e ) {
-      throw e; // Catch and throw to execute finally{} block
-    }   // end catch: java.io.IOException
-    finally {
-      try{ bos.close(); } catch( Exception e ){}
-    }   // end finally
-
-  }   // end encodeToFile
-
-
-  /**
-   * Convenience method for decoding data to a file.
-   *
-   * <p>As of v 2.3, if there is a error,
-   * the method will throw an java.io.IOException. <b>This is new to v2.3!</b>
-   * In earlier versions, it just returned false, but
-   * in retrospect that's a pretty poor way to handle it.</p>
-   *
-   * @param dataToDecode Base64-encoded data as a string
-   * @param filename Filename for saving decoded data
-   * @throws java.io.IOException if there is an error
-   * @since 2.1
-   */
-  public static void decodeToFile( String dataToDecode, String filename )
-      throws java.io.IOException {
-
-    Base64.OutputStream bos = null;
-    try{
-      bos = new Base64.OutputStream(
-          new java.io.FileOutputStream( filename ), Base64.DECODE );
-      bos.write( dataToDecode.getBytes( PREFERRED_ENCODING ) );
-    }   // end try
-    catch( java.io.IOException e ) {
-      throw e; // Catch and throw to execute finally{} block
-    }   // end catch: java.io.IOException
-    finally {
-      try{ bos.close(); } catch( Exception e ){}
-    }   // end finally
-
-  }   // end decodeToFile
-
-
-
-
-  /**
-   * Convenience method for reading a base64-encoded
-   * file and decoding it.
-   *
-   * <p>As of v 2.3, if there is a error,
-   * the method will throw an java.io.IOException. <b>This is new to v2.3!</b>
-   * In earlier versions, it just returned false, but
-   * in retrospect that's a pretty poor way to handle it.</p>
-   *
-   * @param filename Filename for reading encoded data
-   * @return decoded byte array
-   * @throws java.io.IOException if there is an error
-   * @since 2.1
-   */
-  public static byte[] decodeFromFile( String filename )
-      throws java.io.IOException {
-
-    byte[] decodedData = null;
-    Base64.InputStream bis = null;
-    try
-    {
-      // Set up some useful variables
-      java.io.File file = new java.io.File( filename );
-      byte[] buffer = null;
-      int length   = 0;
-      int numBytes = 0;
-
-      // Check for size of file
-      if( file.length() > Integer.MAX_VALUE )
-      {
-        throw new java.io.IOException( "File is too big for this convenience method (" + file.length() + " bytes)." );
-      }   // end if: file too big for int index
-      buffer = new byte[ (int)file.length() ];
-
-      // Open a stream
-      bis = new Base64.InputStream(
-          new java.io.BufferedInputStream(
-              new java.io.FileInputStream( file ) ), Base64.DECODE );
-
-      // Read until done
-      while( ( numBytes = bis.read( buffer, length, 4096 ) ) >= 0 ) {
-        length += numBytes;
-      }   // end while
-
-      // Save in a variable to return
-      decodedData = new byte[ length ];
-      System.arraycopy( buffer, 0, decodedData, 0, length );
-
-    }   // end try
-    catch( java.io.IOException e ) {
-      throw e; // Catch and release to execute finally{}
-    }   // end catch: java.io.IOException
-    finally {
-      try{ bis.close(); } catch( Exception e) {}
-    }   // end finally
-
-    return decodedData;
-  }   // end decodeFromFile
-
-
-
-  /**
-   * Convenience method for reading a binary file
-   * and base64-encoding it.
-   *
-   * <p>As of v 2.3, if there is a error,
-   * the method will throw an java.io.IOException. <b>This is new to v2.3!</b>
-   * In earlier versions, it just returned false, but
-   * in retrospect that's a pretty poor way to handle it.</p>
-   *
-   * @param filename Filename for reading binary data
-   * @return base64-encoded string
-   * @throws java.io.IOException if there is an error
-   * @since 2.1
-   */
-  public static String encodeFromFile( String filename )
-      throws java.io.IOException {
-
-    String encodedData = null;
-    Base64.InputStream bis = null;
-    try
-    {
-      // Set up some useful variables
-      java.io.File file = new java.io.File( filename );
-      byte[] buffer = new byte[ Math.max((int)(file.length() * 1.4+1),40) ]; // Need max() for math on small files (v2.2.1); Need +1 for a few corner cases (v2.3.5)
-      int length   = 0;
-      int numBytes = 0;
-
-      // Open a stream
-      bis = new Base64.InputStream(
-          new java.io.BufferedInputStream(
-              new java.io.FileInputStream( file ) ), Base64.ENCODE );
-
-      // Read until done
-      while( ( numBytes = bis.read( buffer, length, 4096 ) ) >= 0 ) {
-        length += numBytes;
-      }   // end while
-
-      // Save in a variable to return
-      encodedData = new String( buffer, 0, length, Base64.PREFERRED_ENCODING );
-
-    }   // end try
-    catch( java.io.IOException e ) {
-      throw e; // Catch and release to execute finally{}
-    }   // end catch: java.io.IOException
-    finally {
-      try{ bis.close(); } catch( Exception e) {}
-    }   // end finally
-
-    return encodedData;
-  }   // end encodeFromFile
-
-  /**
-   * Reads <tt>infile</tt> and encodes it to <tt>outfile</tt>.
-   *
-   * @param infile Input file
-   * @param outfile Output file
-   * @throws java.io.IOException if there is an error
-   * @since 2.2
-   */
-  public static void encodeFileToFile( String infile, String outfile )
-      throws java.io.IOException {
-
-    String encoded = Base64.encodeFromFile( infile );
-    java.io.OutputStream out = null;
-    try{
-      out = new java.io.BufferedOutputStream(
-          new java.io.FileOutputStream( outfile ) );
-      out.write( encoded.getBytes("US-ASCII") ); // Strict, 7-bit output.
-    }   // end try
-    catch( java.io.IOException e ) {
-      throw e; // Catch and release to execute finally{}
-    }   // end catch
-    finally {
-      try { out.close(); }
-      catch( Exception ex ){}
-    }   // end finally
-  }   // end encodeFileToFile
-
-
-  /**
-   * Reads <tt>infile</tt> and decodes it to <tt>outfile</tt>.
-   *
-   * @param infile Input file
-   * @param outfile Output file
-   * @throws java.io.IOException if there is an error
-   * @since 2.2
-   */
-  public static void decodeFileToFile( String infile, String outfile )
-      throws java.io.IOException {
-
-    byte[] decoded = Base64.decodeFromFile( infile );
-    java.io.OutputStream out = null;
-    try{
-      out = new java.io.BufferedOutputStream(
-          new java.io.FileOutputStream( outfile ) );
-      out.write( decoded );
-    }   // end try
-    catch( java.io.IOException e ) {
-      throw e; // Catch and release to execute finally{}
-    }   // end catch
-    finally {
-      try { out.close(); }
-      catch( Exception ex ){}
-    }   // end finally
-  }   // end decodeFileToFile
-
-
-    /* ********  I N N E R   C L A S S   I N P U T S T R E A M  ******** */
-
-
-
-  /**
-   * A {@link Base64.InputStream} will read data from another
-   * <tt>java.io.InputStream</tt>, given in the constructor,
-   * and encode/decode to/from Base64 notation on the fly.
-   *
-   * @see Base64
-   * @since 1.3
-   */
-  public static class InputStream extends java.io.FilterInputStream {
-
-    private boolean encode;         // Encoding or decoding
-    private int     position;       // Current position in the buffer
-    private byte[]  buffer;         // Small buffer holding converted data
-    private int     bufferLength;   // Length of buffer (3 or 4)
-    private int     numSigBytes;    // Number of meaningful bytes in the buffer
-    private int     lineLength;
-    private boolean breakLines;     // Break lines at less than 80 characters
-    private int     options;        // Record options used to create the stream.
-    private byte[]  decodabet;      // Local copies to avoid extra method calls
-
-
-    /**
-     * Constructs a {@link Base64.InputStream} in DECODE mode.
-     *
-     * @param in the <tt>java.io.InputStream</tt> from which to read data.
-     * @since 1.3
-     */
-    public InputStream( java.io.InputStream in ) {
-      this( in, DECODE );
-    }   // end constructor
-
-
-    /**
-     * Constructs a {@link Base64.InputStream} in
-     * either ENCODE or DECODE mode.
-     * <p>
-     * Valid options:<pre>
-     *   ENCODE or DECODE: Encode or Decode as data is read.
-     *   DO_BREAK_LINES: break lines at 76 characters
-     *     (only meaningful when encoding)
-     * </pre>
-     * <p>
-     * Example: <code>new Base64.InputStream( in, Base64.DECODE )</code>
-     *
-     *
-     * @param in the <tt>java.io.InputStream</tt> from which to read data.
-     * @param options Specified options
-     * @see Base64#ENCODE
-     * @see Base64#DECODE
-     * @see Base64#DO_BREAK_LINES
-     * @since 2.0
-     */
-    public InputStream( java.io.InputStream in, int options ) {
-
-      super( in );
-      this.options      = options; // Record for later
-      this.breakLines   = (options & DO_BREAK_LINES) > 0;
-      this.encode       = (options & ENCODE) > 0;
-      this.bufferLength = encode ? 4 : 3;
-      this.buffer       = new byte[ bufferLength ];
-      this.position     = -1;
-      this.lineLength   = 0;
-      this.decodabet    = getDecodabet(options);
-    }   // end constructor
-
-    /**
-     * Reads enough of the input stream to convert
-     * to/from Base64 and returns the next byte.
-     *
-     * @return next byte
-     * @since 1.3
-     */
-    @Override
-    public int read() throws java.io.IOException  {
-
-      // Do we need to get data?
-      if( position < 0 ) {
-        if( encode ) {
-          byte[] b3 = new byte[3];
-          int numBinaryBytes = 0;
-          for( int i = 0; i < 3; i++ ) {
-            int b = in.read();
-
-            // If end of stream, b is -1.
-            if( b >= 0 ) {
-              b3[i] = (byte)b;
-              numBinaryBytes++;
-            } else {
-              break; // out of for loop
-            }   // end else: end of stream
-
-          }   // end for: each needed input byte
-
-          if( numBinaryBytes > 0 ) {
-            encode3to4( b3, 0, numBinaryBytes, buffer, 0, options );
-            position = 0;
-            numSigBytes = 4;
-          }   // end if: got data
-          else {
-            return -1;  // Must be end of stream
-          }   // end else
-        }   // end if: encoding
-
-        // Else decoding
-        else {
-          byte[] b4 = new byte[4];
-          int i = 0;
-          for( i = 0; i < 4; i++ ) {
-            // Read four "meaningful" bytes:
-            int b = 0;
-            do{ b = in.read(); }
-            while( b >= 0 && decodabet[ b & 0x7f ] <= WHITE_SPACE_ENC );
-
-            if( b < 0 ) {
-              break; // Reads a -1 if end of stream
-            }   // end if: end of stream
-
-            b4[i] = (byte)b;
-          }   // end for: each needed input byte
-
-          if( i == 4 ) {
-            numSigBytes = decode4to3( b4, 0, buffer, 0, options );
-            position = 0;
-          }   // end if: got four characters
-          else if( i == 0 ){
-            return -1;
-          }   // end else if: also padded correctly
-          else {
-            // Must have broken out from above.
-            throw new java.io.IOException( "Improperly padded Base64 input." );
-          }   // end
-
-        }   // end else: decode
-      }   // end else: get data
-
-      // Got data?
-      if( position >= 0 ) {
-        // End of relevant data?
-        if( /*!encode &&*/ position >= numSigBytes ){
-          return -1;
-        }   // end if: got data
-
-        if( encode && breakLines && lineLength >= MAX_LINE_LENGTH ) {
-          lineLength = 0;
-          return '\n';
-        }   // end if
-        else {
-          lineLength++;   // This isn't important when decoding
-          // but throwing an extra "if" seems
-          // just as wasteful.
-
-          int b = buffer[ position++ ];
-
-          if( position >= bufferLength ) {
-            position = -1;
-          }   // end if: end
-
-          return b & 0xFF; // This is how you "cast" a byte that's
-          // intended to be unsigned.
-        }   // end else
-      }   // end if: position >= 0
-
-      // Else error
-      else {
-        throw new java.io.IOException( "Error in Base64 code reading stream." );
-      }   // end else
-    }   // end read
-
-
-    /**
-     * Calls {@link #read()} repeatedly until the end of stream
-     * is reached or <var>len</var> bytes are read.
-     * Returns number of bytes read into array or -1 if
-     * end of stream is encountered.
-     *
-     * @param dest array to hold values
-     * @param off offset for array
-     * @param len max number of bytes to read into array
-     * @return bytes read into array or -1 if end of stream is encountered.
-     * @since 1.3
-     */
-    @Override
-    public int read( byte[] dest, int off, int len )
-        throws java.io.IOException {
-      int i;
-      int b;
-      for( i = 0; i < len; i++ ) {
-        b = read();
-
-        if( b >= 0 ) {
-          dest[off + i] = (byte) b;
-        }
-        else if( i == 0 ) {
-          return -1;
-        }
-        else {
-          break; // Out of 'for' loop
-        } // Out of 'for' loop
-      }   // end for: each byte read
-      return i;
-    }   // end read
-
-  }   // end inner class InputStream
-
-
-
-
-
-
-    /* ********  I N N E R   C L A S S   O U T P U T S T R E A M  ******** */
-
-
-
-  /**
-   * A {@link Base64.OutputStream} will write data to another
-   * <tt>java.io.OutputStream</tt>, given in the constructor,
-   * and encode/decode to/from Base64 notation on the fly.
-   *
-   * @see Base64
-   * @since 1.3
-   */
-  public static class OutputStream extends java.io.FilterOutputStream {
-
-    private boolean encode;
-    private int     position;
-    private byte[]  buffer;
-    private int     bufferLength;
-    private int     lineLength;
-    private boolean breakLines;
-    private byte[]  b4;         // Scratch used in a few places
-    private boolean suspendEncoding;
-    private int     options;    // Record for later
-    private byte[]  decodabet;  // Local copies to avoid extra method calls
-
-    /**
-     * Constructs a {@link Base64.OutputStream} in ENCODE mode.
-     *
-     * @param out the <tt>java.io.OutputStream</tt> to which data will be written.
-     * @since 1.3
-     */
-    public OutputStream( java.io.OutputStream out ) {
-      this( out, ENCODE );
-    }   // end constructor
-
-
-    /**
-     * Constructs a {@link Base64.OutputStream} in
-     * either ENCODE or DECODE mode.
-     * <p>
-     * Valid options:<pre>
-     *   ENCODE or DECODE: Encode or Decode as data is read.
-     *   DO_BREAK_LINES: don't break lines at 76 characters
-     *     (only meaningful when encoding)
-     * </pre>
-     * <p>
-     * Example: <code>new Base64.OutputStream( out, Base64.ENCODE )</code>
-     *
-     * @param out the <tt>java.io.OutputStream</tt> to which data will be written.
-     * @param options Specified options.
-     * @see Base64#ENCODE
-     * @see Base64#DECODE
-     * @see Base64#DO_BREAK_LINES
-     * @since 1.3
-     */
-    public OutputStream( java.io.OutputStream out, int options ) {
-      super( out );
-      this.breakLines   = (options & DO_BREAK_LINES) != 0;
-      this.encode       = (options & ENCODE) != 0;
-      this.bufferLength = encode ? 3 : 4;
-      this.buffer       = new byte[ bufferLength ];
-      this.position     = 0;
-      this.lineLength   = 0;
-      this.suspendEncoding = false;
-      this.b4           = new byte[4];
-      this.options      = options;
-      this.decodabet    = getDecodabet(options);
-    }   // end constructor
-
-
-    /**
-     * Writes the byte to the output stream after
-     * converting to/from Base64 notation.
-     * When encoding, bytes are buffered three
-     * at a time before the output stream actually
-     * gets a write() call.
-     * When decoding, bytes are buffered four
-     * at a time.
-     *
-     * @param theByte the byte to write
-     * @since 1.3
-     */
-    @Override
-    public void write(int theByte)
-        throws java.io.IOException {
-      // Encoding suspended?
-      if( suspendEncoding ) {
-        this.out.write( theByte );
-        return;
-      }   // end if: supsended
-
-      // Encode?
-      if( encode ) {
-        buffer[ position++ ] = (byte)theByte;
-        if( position >= bufferLength ) { // Enough to encode.
-
-          this.out.write( encode3to4( b4, buffer, bufferLength, options ) );
-
-          lineLength += 4;
-          if( breakLines && lineLength >= MAX_LINE_LENGTH ) {
-            this.out.write( NEW_LINE );
-            lineLength = 0;
-          }   // end if: end of line
-
-          position = 0;
-        }   // end if: enough to output
-      }   // end if: encoding
-
-      // Else, Decoding
-      else {
-        // Meaningful Base64 character?
-        if( decodabet[ theByte & 0x7f ] > WHITE_SPACE_ENC ) {
-          buffer[ position++ ] = (byte)theByte;
-          if( position >= bufferLength ) { // Enough to output.
-
-            int len = Base64.decode4to3( buffer, 0, b4, 0, options );
-            out.write( b4, 0, len );
-            position = 0;
-          }   // end if: enough to output
-        }   // end if: meaningful base64 character
-        else if( decodabet[ theByte & 0x7f ] != WHITE_SPACE_ENC ) {
-          throw new java.io.IOException( "Invalid character in Base64 data." );
-        }   // end else: not white space either
-      }   // end else: decoding
-    }   // end write
-
-
-
-    /**
-     * Calls {@link #write(int)} repeatedly until <var>len</var>
-     * bytes are written.
-     *
-     * @param theBytes array from which to read bytes
-     * @param off offset for array
-     * @param len max number of bytes to read into array
-     * @since 1.3
-     */
-    @Override
-    public void write( byte[] theBytes, int off, int len )
-        throws java.io.IOException {
-      // Encoding suspended?
-      if( suspendEncoding ) {
-        this.out.write( theBytes, off, len );
-        return;
-      }   // end if: supsended
-
-      for( int i = 0; i < len; i++ ) {
-        write( theBytes[ off + i ] );
-      }   // end for: each byte written
-
-    }   // end write
-
-
-
-    /**
-     * Method added by PHIL. [Thanks, PHIL. -Rob]
-     * This pads the buffer without closing the stream.
-     * @throws java.io.IOException  if there's an error.
-     */
-    public void flushBase64() throws java.io.IOException  {
-      if( position > 0 ) {
-        if( encode ) {
-          out.write( encode3to4( b4, buffer, position, options ) );
-          position = 0;
-        }   // end if: encoding
-        else {
-          throw new java.io.IOException( "Base64 input not properly padded." );
-        }   // end else: decoding
-      }   // end if: buffer partially full
-
-    }   // end flush
-
-
-    /**
-     * Flushes and closes (I think, in the superclass) the stream.
-     *
-     * @since 1.3
-     */
-    @Override
-    public void close() throws java.io.IOException {
-      // 1. Ensure that pending characters are written
-      flushBase64();
-
-      // 2. Actually close the stream
-      // Base class both flushes and closes.
-      super.close();
-
-      buffer = null;
-      out    = null;
-    }   // end close
-
-
-
-    /**
-     * Suspends encoding of the stream.
-     * May be helpful if you need to embed a piece of
-     * base64-encoded data in a stream.
-     *
-     * @throws java.io.IOException  if there's an error flushing
-     * @since 1.5.1
-     */
-    public void suspendEncoding() throws java.io.IOException  {
-      flushBase64();
-      this.suspendEncoding = true;
-    }   // end suspendEncoding
-
-
-    /**
-     * Resumes encoding of the stream.
-     * May be helpful if you need to embed a piece of
-     * base64-encoded data in a stream.
-     *
-     * @since 1.5.1
-     */
-    public void resumeEncoding() {
-      this.suspendEncoding = false;
-    }   // end resumeEncoding
-
-
-
-  }   // end inner class OutputStream
-
-
-}   // end class Base64
-
-//CHECKSTYLE: ON
-
-// End Base64.java


[07/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableWindow.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableWindow.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableWindow.java
deleted file mode 100644
index 5b5c418..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableWindow.java
+++ /dev/null
@@ -1,972 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.adapter.enumerable.impl.WinAggAddContextImpl;
-import org.apache.calcite.adapter.enumerable.impl.WinAggResetContextImpl;
-import org.apache.calcite.adapter.enumerable.impl.WinAggResultContextImpl;
-import org.apache.calcite.adapter.java.JavaTypeFactory;
-import org.apache.calcite.linq4j.tree.BinaryExpression;
-import org.apache.calcite.linq4j.tree.BlockBuilder;
-import org.apache.calcite.linq4j.tree.BlockStatement;
-import org.apache.calcite.linq4j.tree.DeclarationStatement;
-import org.apache.calcite.linq4j.tree.Expression;
-import org.apache.calcite.linq4j.tree.Expressions;
-import org.apache.calcite.linq4j.tree.ParameterExpression;
-import org.apache.calcite.linq4j.tree.Primitive;
-import org.apache.calcite.linq4j.tree.Statement;
-import org.apache.calcite.linq4j.tree.Types;
-import org.apache.calcite.plan.RelOptCluster;
-import org.apache.calcite.plan.RelOptCost;
-import org.apache.calcite.plan.RelOptPlanner;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.prepare.CalcitePrepareImpl;
-import org.apache.calcite.rel.RelFieldCollation;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.core.AggregateCall;
-import org.apache.calcite.rel.core.Window;
-import org.apache.calcite.rel.metadata.RelMetadataQuery;
-import org.apache.calcite.rel.type.RelDataType;
-import org.apache.calcite.rel.type.RelDataTypeFactory;
-import org.apache.calcite.rex.RexInputRef;
-import org.apache.calcite.rex.RexLiteral;
-import org.apache.calcite.rex.RexNode;
-import org.apache.calcite.rex.RexWindowBound;
-import org.apache.calcite.runtime.SortedMultiMap;
-import org.apache.calcite.sql.SqlAggFunction;
-import org.apache.calcite.util.BuiltInMethod;
-import org.apache.calcite.util.Pair;
-import org.apache.calcite.util.Util;
-
-import com.google.common.base.Function;
-import com.google.common.collect.ImmutableList;
-
-import java.lang.reflect.Modifier;
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
-/** Implementation of {@link org.apache.calcite.rel.core.Window} in
- * {@link org.apache.calcite.adapter.enumerable.EnumerableConvention enumerable calling convention}. */
-public class EnumerableWindow extends Window implements EnumerableRel {
-  /** Creates an EnumerableWindowRel. */
-  EnumerableWindow(RelOptCluster cluster, RelTraitSet traits, RelNode child,
-      List<RexLiteral> constants, RelDataType rowType, List<Group> groups) {
-    super(cluster, traits, child, constants, rowType, groups);
-  }
-
-  @Override public RelNode copy(RelTraitSet traitSet, List<RelNode> inputs) {
-    return new EnumerableWindow(getCluster(), traitSet, sole(inputs),
-        constants, rowType, groups);
-  }
-
-  public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) {
-    return super.computeSelfCost(planner, mq)
-        .multiplyBy(EnumerableConvention.COST_MULTIPLIER);
-  }
-
-  /** Implementation of {@link RexToLixTranslator.InputGetter}
-   * suitable for generating implementations of windowed aggregate
-   * functions. */
-  private static class WindowRelInputGetter
-      implements RexToLixTranslator.InputGetter {
-    private final Expression row;
-    private final PhysType rowPhysType;
-    private final int actualInputFieldCount;
-    private final List<Expression> constants;
-
-    private WindowRelInputGetter(Expression row,
-        PhysType rowPhysType, int actualInputFieldCount,
-        List<Expression> constants) {
-      this.row = row;
-      this.rowPhysType = rowPhysType;
-      this.actualInputFieldCount = actualInputFieldCount;
-      this.constants = constants;
-    }
-
-    public Expression field(BlockBuilder list, int index, Type storageType) {
-      if (index < actualInputFieldCount) {
-        Expression current = list.append("current", row);
-        return rowPhysType.fieldReference(current, index, storageType);
-      }
-      return constants.get(index - actualInputFieldCount);
-    }
-  }
-
-  private void sampleOfTheGeneratedWindowedAggregate() {
-    // Here's overview of the generated code
-    // For each list of rows that have the same partitioning key, evaluate
-    // all of the windowed aggregate functions.
-
-    // builder
-    Iterator<Integer[]> iterator = null;
-
-    // builder3
-    Integer[] rows = iterator.next();
-
-    int prevStart = -1;
-    int prevEnd = -1;
-
-    for (int i = 0; i < rows.length; i++) {
-      // builder4
-      Integer row = rows[i];
-
-      int start = 0;
-      int end = 100;
-      if (start != prevStart || end != prevEnd) {
-        // builder5
-        int actualStart = 0;
-        if (start != prevStart || end < prevEnd) {
-          // builder6
-          // recompute
-          actualStart = start;
-          // implementReset
-        } else { // must be start == prevStart && end > prevEnd
-          actualStart = prevEnd + 1;
-        }
-        prevStart = start;
-        prevEnd = end;
-
-        if (start != -1) {
-          for (int j = actualStart; j <= end; j++) {
-            // builder7
-            // implementAdd
-          }
-        }
-        // implementResult
-        // list.add(new Xxx(row.deptno, row.empid, sum, count));
-      }
-    }
-    // multiMap.clear(); // allows gc
-    // source = Linq4j.asEnumerable(list);
-  }
-
-  public Result implement(EnumerableRelImplementor implementor, Prefer pref) {
-    final JavaTypeFactory typeFactory = implementor.getTypeFactory();
-    final EnumerableRel child = (EnumerableRel) getInput();
-    final BlockBuilder builder = new BlockBuilder();
-    final Result result = implementor.visitChild(this, 0, child, pref);
-    Expression source_ = builder.append("source", result.block);
-
-    final List<Expression> translatedConstants =
-        new ArrayList<Expression>(constants.size());
-    for (RexLiteral constant : constants) {
-      translatedConstants.add(
-          RexToLixTranslator.translateLiteral(constant, constant.getType(),
-              typeFactory, RexImpTable.NullAs.NULL));
-    }
-
-    PhysType inputPhysType = result.physType;
-
-    ParameterExpression prevStart =
-        Expressions.parameter(int.class, builder.newName("prevStart"));
-    ParameterExpression prevEnd =
-        Expressions.parameter(int.class, builder.newName("prevEnd"));
-
-    builder.add(Expressions.declare(0, prevStart, null));
-    builder.add(Expressions.declare(0, prevEnd, null));
-
-    for (int windowIdx = 0; windowIdx < groups.size(); windowIdx++) {
-      Group group = groups.get(windowIdx);
-      // Comparator:
-      // final Comparator<JdbcTest.Employee> comparator =
-      //    new Comparator<JdbcTest.Employee>() {
-      //      public int compare(JdbcTest.Employee o1,
-      //          JdbcTest.Employee o2) {
-      //        return Integer.compare(o1.empid, o2.empid);
-      //      }
-      //    };
-      final Expression comparator_ =
-          builder.append(
-              "comparator",
-              inputPhysType.generateComparator(
-                  group.collation()));
-
-      Pair<Expression, Expression> partitionIterator =
-          getPartitionIterator(builder, source_, inputPhysType, group,
-              comparator_);
-      final Expression collectionExpr = partitionIterator.left;
-      final Expression iterator_ = partitionIterator.right;
-
-      List<AggImpState> aggs = new ArrayList<AggImpState>();
-      List<AggregateCall> aggregateCalls = group.getAggregateCalls(this);
-      for (int aggIdx = 0; aggIdx < aggregateCalls.size(); aggIdx++) {
-        AggregateCall call = aggregateCalls.get(aggIdx);
-        aggs.add(new AggImpState(aggIdx, call, true));
-      }
-
-      // The output from this stage is the input plus the aggregate functions.
-      final RelDataTypeFactory.FieldInfoBuilder typeBuilder =
-          typeFactory.builder();
-      typeBuilder.addAll(inputPhysType.getRowType().getFieldList());
-      for (AggImpState agg : aggs) {
-        typeBuilder.add(agg.call.name, agg.call.type);
-      }
-      RelDataType outputRowType = typeBuilder.build();
-      final PhysType outputPhysType =
-          PhysTypeImpl.of(
-              typeFactory, outputRowType, pref.prefer(result.format));
-
-      final Expression list_ =
-          builder.append(
-              "list",
-              Expressions.new_(
-                  ArrayList.class,
-                  Expressions.call(
-                      collectionExpr, BuiltInMethod.COLLECTION_SIZE.method)),
-              false);
-
-      Pair<Expression, Expression> collationKey =
-          getRowCollationKey(builder, inputPhysType, group, windowIdx);
-      Expression keySelector = collationKey.left;
-      Expression keyComparator = collationKey.right;
-      final BlockBuilder builder3 = new BlockBuilder();
-      final Expression rows_ =
-          builder3.append(
-              "rows",
-              Expressions.convert_(
-                  Expressions.call(
-                      iterator_, BuiltInMethod.ITERATOR_NEXT.method),
-                  Object[].class),
-              false);
-
-      builder3.add(
-          Expressions.statement(
-              Expressions.assign(prevStart, Expressions.constant(-1))));
-      builder3.add(
-          Expressions.statement(
-              Expressions.assign(prevEnd,
-                  Expressions.constant(Integer.MAX_VALUE))));
-
-      final BlockBuilder builder4 = new BlockBuilder();
-
-      final ParameterExpression i_ =
-          Expressions.parameter(int.class, builder4.newName("i"));
-
-      final Expression row_ =
-          builder4.append(
-              "row",
-              RexToLixTranslator.convert(
-                  Expressions.arrayIndex(rows_, i_),
-                  inputPhysType.getJavaRowType()));
-
-      final RexToLixTranslator.InputGetter inputGetter =
-          new WindowRelInputGetter(row_, inputPhysType,
-              result.physType.getRowType().getFieldCount(),
-              translatedConstants);
-
-      final RexToLixTranslator translator =
-          RexToLixTranslator.forAggregation(typeFactory, builder4,
-              inputGetter);
-
-      final List<Expression> outputRow = new ArrayList<Expression>();
-      int fieldCountWithAggResults =
-        inputPhysType.getRowType().getFieldCount();
-      for (int i = 0; i < fieldCountWithAggResults; i++) {
-        outputRow.add(
-            inputPhysType.fieldReference(
-                row_, i,
-                outputPhysType.getJavaFieldType(i)));
-      }
-
-      declareAndResetState(typeFactory, builder, result, windowIdx, aggs,
-          outputPhysType, outputRow);
-
-      // There are assumptions that minX==0. If ever change this, look for
-      // frameRowCount, bounds checking, etc
-      final Expression minX = Expressions.constant(0);
-      final Expression partitionRowCount =
-          builder3.append("partRows", Expressions.field(rows_, "length"));
-      final Expression maxX = builder3.append("maxX",
-          Expressions.subtract(
-              partitionRowCount, Expressions.constant(1)));
-
-      final Expression startUnchecked = builder4.append("start",
-          translateBound(translator, i_, row_, minX, maxX, rows_,
-              group, true,
-              inputPhysType, comparator_, keySelector, keyComparator));
-      final Expression endUnchecked = builder4.append("end",
-          translateBound(translator, i_, row_, minX, maxX, rows_,
-              group, false,
-              inputPhysType, comparator_, keySelector, keyComparator));
-
-      final Expression startX;
-      final Expression endX;
-      final Expression hasRows;
-      if (group.isAlwaysNonEmpty()) {
-        startX = startUnchecked;
-        endX = endUnchecked;
-        hasRows = Expressions.constant(true);
-      } else {
-        Expression startTmp =
-            group.lowerBound.isUnbounded() || startUnchecked == i_
-                ? startUnchecked
-                : builder4.append("startTmp",
-                    Expressions.call(null, BuiltInMethod.MATH_MAX.method,
-                        startUnchecked, minX));
-        Expression endTmp =
-            group.upperBound.isUnbounded() || endUnchecked == i_
-                ? endUnchecked
-                : builder4.append("endTmp",
-                    Expressions.call(null, BuiltInMethod.MATH_MIN.method,
-                        endUnchecked, maxX));
-
-        ParameterExpression startPe = Expressions.parameter(0, int.class,
-            builder4.newName("startChecked"));
-        ParameterExpression endPe = Expressions.parameter(0, int.class,
-            builder4.newName("endChecked"));
-        builder4.add(Expressions.declare(Modifier.FINAL, startPe, null));
-        builder4.add(Expressions.declare(Modifier.FINAL, endPe, null));
-
-        hasRows = builder4.append("hasRows",
-            Expressions.lessThanOrEqual(startTmp, endTmp));
-        builder4.add(
-            Expressions.ifThenElse(hasRows,
-                Expressions.block(
-                    Expressions.statement(
-                        Expressions.assign(startPe, startTmp)),
-                    Expressions.statement(
-                      Expressions.assign(endPe, endTmp))),
-            Expressions.block(
-                Expressions.statement(
-                    Expressions.assign(startPe, Expressions.constant(-1))),
-                Expressions.statement(
-                    Expressions.assign(endPe, Expressions.constant(-1))))));
-        startX = startPe;
-        endX = endPe;
-      }
-
-      final BlockBuilder builder5 = new BlockBuilder(true, builder4);
-
-      BinaryExpression rowCountWhenNonEmpty = Expressions.add(
-          startX == minX ? endX : Expressions.subtract(endX, startX),
-          Expressions.constant(1));
-
-      final Expression frameRowCount;
-
-      if (hasRows.equals(Expressions.constant(true))) {
-        frameRowCount =
-            builder4.append("totalRows", rowCountWhenNonEmpty);
-      } else {
-        frameRowCount =
-            builder4.append("totalRows",
-                Expressions.condition(hasRows, rowCountWhenNonEmpty,
-                    Expressions.constant(0)));
-      }
-
-      ParameterExpression actualStart = Expressions.parameter(
-          0, int.class, builder5.newName("actualStart"));
-
-      final BlockBuilder builder6 = new BlockBuilder(true, builder5);
-      builder6.add(
-          Expressions.statement(Expressions.assign(actualStart, startX)));
-
-      for (final AggImpState agg : aggs) {
-        agg.implementor.implementReset(agg.context,
-            new WinAggResetContextImpl(builder6, agg.state, i_, startX, endX,
-                hasRows, partitionRowCount, frameRowCount));
-      }
-
-      Expression lowerBoundCanChange =
-          group.lowerBound.isUnbounded() && group.lowerBound.isPreceding()
-          ? Expressions.constant(false)
-          : Expressions.notEqual(startX, prevStart);
-      Expression needRecomputeWindow = Expressions.orElse(
-          lowerBoundCanChange,
-          Expressions.lessThan(endX, prevEnd));
-
-      BlockStatement resetWindowState = builder6.toBlock();
-      if (resetWindowState.statements.size() == 1) {
-        builder5.add(
-            Expressions.declare(0, actualStart,
-                Expressions.condition(needRecomputeWindow, startX,
-                    Expressions.add(prevEnd, Expressions.constant(1)))));
-      } else {
-        builder5.add(
-            Expressions.declare(0, actualStart, null));
-        builder5.add(
-            Expressions.ifThenElse(needRecomputeWindow,
-                resetWindowState,
-                Expressions.statement(
-                    Expressions.assign(actualStart,
-                    Expressions.add(prevEnd, Expressions.constant(1))))));
-      }
-
-      if (lowerBoundCanChange instanceof BinaryExpression) {
-        builder5.add(
-            Expressions.statement(Expressions.assign(prevStart, startX)));
-      }
-      builder5.add(
-          Expressions.statement(Expressions.assign(prevEnd, endX)));
-
-      final BlockBuilder builder7 = new BlockBuilder(true, builder5);
-      final DeclarationStatement jDecl =
-          Expressions.declare(0, "j", actualStart);
-
-      final PhysType inputPhysTypeFinal = inputPhysType;
-      final Function<BlockBuilder, WinAggFrameResultContext>
-          resultContextBuilder =
-          getBlockBuilderWinAggFrameResultContextFunction(typeFactory, result,
-              translatedConstants, comparator_, rows_, i_, startX, endX,
-              minX, maxX,
-              hasRows, frameRowCount, partitionRowCount,
-              jDecl, inputPhysTypeFinal);
-
-      final Function<AggImpState, List<RexNode>> rexArguments =
-          new Function<AggImpState, List<RexNode>>() {
-            public List<RexNode> apply(AggImpState agg) {
-              List<Integer> argList = agg.call.getArgList();
-              List<RelDataType> inputTypes =
-                  EnumUtils.fieldRowTypes(
-                      result.physType.getRowType(),
-                      constants,
-                      argList);
-              List<RexNode> args = new ArrayList<RexNode>(
-                  inputTypes.size());
-              for (int i = 0; i < argList.size(); i++) {
-                Integer idx = argList.get(i);
-                args.add(new RexInputRef(idx, inputTypes.get(i)));
-              }
-              return args;
-            }
-          };
-
-      implementAdd(aggs, builder7, resultContextBuilder, rexArguments, jDecl);
-
-      BlockStatement forBlock = builder7.toBlock();
-      if (!forBlock.statements.isEmpty()) {
-        // For instance, row_number does not use for loop to compute the value
-        Statement forAggLoop = Expressions.for_(
-            Arrays.asList(jDecl),
-            Expressions.lessThanOrEqual(jDecl.parameter, endX),
-            Expressions.preIncrementAssign(jDecl.parameter),
-            forBlock);
-        if (!hasRows.equals(Expressions.constant(true))) {
-          forAggLoop = Expressions.ifThen(hasRows, forAggLoop);
-        }
-        builder5.add(forAggLoop);
-      }
-
-      if (implementResult(aggs, builder5, resultContextBuilder, rexArguments,
-              true)) {
-        builder4.add(
-            Expressions.ifThen(
-                Expressions.orElse(lowerBoundCanChange,
-                    Expressions.notEqual(endX, prevEnd)),
-                builder5.toBlock()));
-      }
-
-      implementResult(aggs, builder4, resultContextBuilder, rexArguments,
-          false);
-
-      builder4.add(
-          Expressions.statement(
-              Expressions.call(
-                  list_,
-                  BuiltInMethod.COLLECTION_ADD.method,
-                  outputPhysType.record(outputRow))));
-
-      builder3.add(
-          Expressions.for_(
-              Expressions.declare(0, i_, Expressions.constant(0)),
-              Expressions.lessThan(
-                  i_,
-                  Expressions.field(rows_, "length")),
-              Expressions.preIncrementAssign(i_),
-              builder4.toBlock()));
-
-      builder.add(
-          Expressions.while_(
-              Expressions.call(
-                  iterator_,
-                  BuiltInMethod.ITERATOR_HAS_NEXT.method),
-              builder3.toBlock()));
-      builder.add(
-          Expressions.statement(
-              Expressions.call(
-                  collectionExpr,
-                  BuiltInMethod.MAP_CLEAR.method)));
-
-      // We're not assigning to "source". For each group, create a new
-      // final variable called "source" or "sourceN".
-      source_ =
-          builder.append(
-              "source",
-              Expressions.call(
-                  BuiltInMethod.AS_ENUMERABLE.method, list_));
-
-      inputPhysType = outputPhysType;
-    }
-
-    //   return Linq4j.asEnumerable(list);
-    builder.add(
-        Expressions.return_(null, source_));
-    return implementor.result(inputPhysType, builder.toBlock());
-  }
-
-  private Function<BlockBuilder, WinAggFrameResultContext>
-  getBlockBuilderWinAggFrameResultContextFunction(
-      final JavaTypeFactory typeFactory, final Result result,
-      final List<Expression> translatedConstants,
-      final Expression comparator_,
-      final Expression rows_, final ParameterExpression i_,
-      final Expression startX, final Expression endX,
-      final Expression minX, final Expression maxX,
-      final Expression hasRows, final Expression frameRowCount,
-      final Expression partitionRowCount,
-      final DeclarationStatement jDecl,
-      final PhysType inputPhysType) {
-    return new Function<BlockBuilder,
-        WinAggFrameResultContext>() {
-      public WinAggFrameResultContext apply(
-          final BlockBuilder block) {
-        return new WinAggFrameResultContext() {
-          public RexToLixTranslator rowTranslator(Expression rowIndex) {
-            Expression row =
-                getRow(rowIndex);
-            final RexToLixTranslator.InputGetter inputGetter =
-                new WindowRelInputGetter(row, inputPhysType,
-                    result.physType.getRowType().getFieldCount(),
-                    translatedConstants);
-
-            return RexToLixTranslator.forAggregation(typeFactory,
-                block, inputGetter);
-          }
-
-          public Expression computeIndex(Expression offset,
-              WinAggImplementor.SeekType seekType) {
-            Expression index;
-            if (seekType == WinAggImplementor.SeekType.AGG_INDEX) {
-              index = jDecl.parameter;
-            } else if (seekType == WinAggImplementor.SeekType.SET) {
-              index = i_;
-            } else if (seekType == WinAggImplementor.SeekType.START) {
-              index = startX;
-            } else if (seekType == WinAggImplementor.SeekType.END) {
-              index = endX;
-            } else {
-              throw new IllegalArgumentException("SeekSet " + seekType
-                  + " is not supported");
-            }
-            if (!Expressions.constant(0).equals(offset)) {
-              index = block.append("idx", Expressions.add(index, offset));
-            }
-            return index;
-          }
-
-          private Expression checkBounds(Expression rowIndex,
-              Expression minIndex, Expression maxIndex) {
-            if (rowIndex == i_ || rowIndex == startX || rowIndex == endX) {
-              // No additional bounds check required
-              return hasRows;
-            }
-
-            //noinspection UnnecessaryLocalVariable
-            Expression res = block.append("rowInFrame",
-                Expressions.foldAnd(
-                    ImmutableList.of(hasRows,
-                        Expressions.greaterThanOrEqual(rowIndex, minIndex),
-                        Expressions.lessThanOrEqual(rowIndex, maxIndex))));
-
-            return res;
-          }
-
-          public Expression rowInFrame(Expression rowIndex) {
-            return checkBounds(rowIndex, startX, endX);
-          }
-
-          public Expression rowInPartition(Expression rowIndex) {
-            return checkBounds(rowIndex, minX, maxX);
-          }
-
-          public Expression compareRows(Expression a, Expression b) {
-            return Expressions.call(comparator_,
-                BuiltInMethod.COMPARATOR_COMPARE.method,
-                getRow(a), getRow(b));
-          }
-
-          public Expression getRow(Expression rowIndex) {
-            return block.append(
-                "jRow",
-                RexToLixTranslator.convert(
-                    Expressions.arrayIndex(rows_, rowIndex),
-                    inputPhysType.getJavaRowType()));
-          }
-
-          public Expression index() {
-            return i_;
-          }
-
-          public Expression startIndex() {
-            return startX;
-          }
-
-          public Expression endIndex() {
-            return endX;
-          }
-
-          public Expression hasRows() {
-            return hasRows;
-          }
-
-          public Expression getFrameRowCount() {
-            return frameRowCount;
-          }
-
-          public Expression getPartitionRowCount() {
-            return partitionRowCount;
-          }
-        };
-      }
-    };
-  }
-
-  private Pair<Expression, Expression> getPartitionIterator(
-      BlockBuilder builder,
-      Expression source_,
-      PhysType inputPhysType,
-      Group group,
-      Expression comparator_) {
-    // Populate map of lists, one per partition
-    //   final Map<Integer, List<Employee>> multiMap =
-    //     new SortedMultiMap<Integer, List<Employee>>();
-    //    source.foreach(
-    //      new Function1<Employee, Void>() {
-    //        public Void apply(Employee v) {
-    //          final Integer k = v.deptno;
-    //          multiMap.putMulti(k, v);
-    //          return null;
-    //        }
-    //      });
-    //   final List<Xxx> list = new ArrayList<Xxx>(multiMap.size());
-    //   Iterator<Employee[]> iterator = multiMap.arrays(comparator);
-    //
-    if (group.keys.isEmpty()) {
-      // If partition key is empty, no need to partition.
-      //
-      //   final List<Employee> tempList =
-      //       source.into(new ArrayList<Employee>());
-      //   Iterator<Employee[]> iterator =
-      //       SortedMultiMap.singletonArrayIterator(comparator, tempList);
-      //   final List<Xxx> list = new ArrayList<Xxx>(tempList.size());
-
-      final Expression tempList_ = builder.append(
-          "tempList",
-          Expressions.convert_(
-              Expressions.call(
-                  source_,
-                  BuiltInMethod.INTO.method,
-                  Expressions.new_(ArrayList.class)),
-              List.class));
-      return Pair.of(tempList_,
-          builder.append(
-            "iterator",
-            Expressions.call(
-                null,
-                BuiltInMethod.SORTED_MULTI_MAP_SINGLETON.method,
-                comparator_,
-                tempList_)));
-    }
-    Expression multiMap_ =
-        builder.append(
-            "multiMap", Expressions.new_(SortedMultiMap.class));
-    final BlockBuilder builder2 = new BlockBuilder();
-    final ParameterExpression v_ =
-        Expressions.parameter(inputPhysType.getJavaRowType(),
-            builder2.newName("v"));
-
-    Pair<Type, List<Expression>> selector =
-        inputPhysType.selector(v_, group.keys.asList(), JavaRowFormat.CUSTOM);
-    final ParameterExpression key_;
-    if (selector.left instanceof Types.RecordType) {
-      Types.RecordType keyJavaType = (Types.RecordType) selector.left;
-      List<Expression> initExpressions = selector.right;
-      key_ = Expressions.parameter(keyJavaType, "key");
-      builder2.add(Expressions.declare(0, key_, null));
-      builder2.add(
-          Expressions.statement(
-              Expressions.assign(key_, Expressions.new_(keyJavaType))));
-      List<Types.RecordField> fieldList = keyJavaType.getRecordFields();
-      for (int i = 0; i < initExpressions.size(); i++) {
-        Expression right = initExpressions.get(i);
-        builder2.add(
-            Expressions.statement(
-                Expressions.assign(
-                    Expressions.field(key_, fieldList.get(i)), right)));
-      }
-    } else {
-      DeclarationStatement declare =
-          Expressions.declare(0, "key", selector.right.get(0));
-      builder2.add(declare);
-      key_ = declare.parameter;
-    }
-    builder2.add(
-        Expressions.statement(
-            Expressions.call(
-                multiMap_,
-                BuiltInMethod.SORTED_MULTI_MAP_PUT_MULTI.method,
-                key_,
-                v_)));
-    builder2.add(
-        Expressions.return_(
-            null, Expressions.constant(null)));
-
-    builder.add(
-        Expressions.statement(
-            Expressions.call(
-                source_,
-                BuiltInMethod.ENUMERABLE_FOREACH.method,
-                Expressions.lambda(
-                    builder2.toBlock(), v_))));
-
-    return Pair.of(multiMap_,
-      builder.append(
-        "iterator",
-        Expressions.call(
-            multiMap_,
-            BuiltInMethod.SORTED_MULTI_MAP_ARRAYS.method,
-            comparator_)));
-  }
-
-  private Pair<Expression, Expression> getRowCollationKey(
-      BlockBuilder builder, PhysType inputPhysType,
-      Group group, int windowIdx) {
-    if (!(group.isRows || (group.upperBound.isUnbounded()
-        && group.lowerBound.isUnbounded()))) {
-      Pair<Expression, Expression> pair =
-          inputPhysType.generateCollationKey(
-              group.collation().getFieldCollations());
-      // optimize=false to prevent inlining of object create into for-loops
-      return Pair.of(
-          builder.append("keySelector" + windowIdx, pair.left, false),
-          builder.append("keyComparator" + windowIdx, pair.right, false));
-    } else {
-      return Pair.of(null, null);
-    }
-  }
-
-  private void declareAndResetState(final JavaTypeFactory typeFactory,
-      BlockBuilder builder, final Result result, int windowIdx,
-      List<AggImpState> aggs, PhysType outputPhysType,
-      List<Expression> outputRow) {
-    for (final AggImpState agg : aggs) {
-      agg.context =
-          new WinAggContext() {
-            public SqlAggFunction aggregation() {
-              return agg.call.getAggregation();
-            }
-
-            public RelDataType returnRelType() {
-              return agg.call.type;
-            }
-
-            public Type returnType() {
-              return EnumUtils.javaClass(typeFactory, returnRelType());
-            }
-
-            public List<? extends Type> parameterTypes() {
-              return EnumUtils.fieldTypes(typeFactory,
-                  parameterRelTypes());
-            }
-
-            public List<? extends RelDataType> parameterRelTypes() {
-              return EnumUtils.fieldRowTypes(result.physType.getRowType(),
-                  constants, agg.call.getArgList());
-            }
-          };
-      String aggName = "a" + agg.aggIdx;
-      if (CalcitePrepareImpl.DEBUG) {
-        aggName = Util.toJavaId(agg.call.getAggregation().getName(), 0)
-            .substring("ID$0$".length()) + aggName;
-      }
-      List<Type> state = agg.implementor.getStateType(agg.context);
-      final List<Expression> decls =
-          new ArrayList<Expression>(state.size());
-      for (int i = 0; i < state.size(); i++) {
-        Type type = state.get(i);
-        ParameterExpression pe =
-            Expressions.parameter(type,
-                builder.newName(aggName
-                    + "s" + i + "w" + windowIdx));
-        builder.add(Expressions.declare(0, pe, null));
-        decls.add(pe);
-      }
-      agg.state = decls;
-      Type aggHolderType = agg.context.returnType();
-      Type aggStorageType =
-          outputPhysType.getJavaFieldType(outputRow.size());
-      if (Primitive.is(aggHolderType) && !Primitive.is(aggStorageType)) {
-        aggHolderType = Primitive.box(aggHolderType);
-      }
-      ParameterExpression aggRes = Expressions.parameter(0,
-          aggHolderType,
-          builder.newName(aggName + "w" + windowIdx));
-
-      builder.add(
-          Expressions.declare(0, aggRes,
-              Expressions.constant(Primitive.is(aggRes.getType())
-                  ? Primitive.of(aggRes.getType()).defaultValue
-                  : null,
-                  aggRes.getType())));
-      agg.result = aggRes;
-      outputRow.add(aggRes);
-      agg.implementor.implementReset(agg.context,
-          new WinAggResetContextImpl(builder, agg.state,
-              null, null, null, null, null, null));
-    }
-  }
-
-  private void implementAdd(List<AggImpState> aggs,
-      final BlockBuilder builder7,
-      final Function<BlockBuilder, WinAggFrameResultContext> frame,
-      final Function<AggImpState, List<RexNode>> rexArguments,
-      final DeclarationStatement jDecl) {
-    for (final AggImpState agg : aggs) {
-      final WinAggAddContext addContext =
-          new WinAggAddContextImpl(builder7, agg.state, frame) {
-            public Expression currentPosition() {
-              return jDecl.parameter;
-            }
-
-            public List<RexNode> rexArguments() {
-              return rexArguments.apply(agg);
-            }
-
-            public RexNode rexFilterArgument() {
-              return null; // REVIEW
-            }
-          };
-      agg.implementor.implementAdd(agg.context, addContext);
-    }
-  }
-
-  private boolean implementResult(List<AggImpState> aggs,
-      final BlockBuilder builder,
-      final Function<BlockBuilder, WinAggFrameResultContext> frame,
-      final Function<AggImpState, List<RexNode>> rexArguments,
-      boolean cachedBlock) {
-    boolean nonEmpty = false;
-    for (final AggImpState agg : aggs) {
-      boolean needCache = true;
-      if (agg.implementor instanceof WinAggImplementor) {
-        WinAggImplementor imp = (WinAggImplementor) agg.implementor;
-        needCache = imp.needCacheWhenFrameIntact();
-      }
-      if (needCache ^ cachedBlock) {
-        // Regular aggregates do not change when the windowing frame keeps
-        // the same. Ths
-        continue;
-      }
-      nonEmpty = true;
-      Expression res = agg.implementor.implementResult(agg.context,
-          new WinAggResultContextImpl(builder, agg.state, frame) {
-            public List<RexNode> rexArguments() {
-              return rexArguments.apply(agg);
-            }
-          });
-      // Several count(a) and count(b) might share the result
-      Expression aggRes = builder.append("a" + agg.aggIdx + "res",
-          RexToLixTranslator.convert(res, agg.result.getType()));
-      builder.add(
-          Expressions.statement(Expressions.assign(agg.result, aggRes)));
-    }
-    return nonEmpty;
-  }
-
-  private Expression translateBound(RexToLixTranslator translator,
-      ParameterExpression i_, Expression row_, Expression min_,
-      Expression max_, Expression rows_, Group group,
-      boolean lower,
-      PhysType physType, Expression rowComparator,
-      Expression keySelector, Expression keyComparator) {
-    RexWindowBound bound = lower ? group.lowerBound : group.upperBound;
-    if (bound.isUnbounded()) {
-      return bound.isPreceding() ? min_ : max_;
-    }
-    if (group.isRows) {
-      if (bound.isCurrentRow()) {
-        return i_;
-      }
-      RexNode node = bound.getOffset();
-      Expression offs = translator.translate(node);
-      // Floating offset does not make sense since we refer to array index.
-      // Nulls do not make sense as well.
-      offs = RexToLixTranslator.convert(offs, int.class);
-
-      Expression b = i_;
-      if (bound.isFollowing()) {
-        b = Expressions.add(b, offs);
-      } else {
-        b = Expressions.subtract(b, offs);
-      }
-      return b;
-    }
-    Expression searchLower = min_;
-    Expression searchUpper = max_;
-    if (bound.isCurrentRow()) {
-      if (lower) {
-        searchUpper = i_;
-      } else {
-        searchLower = i_;
-      }
-    }
-
-    List<RelFieldCollation> fieldCollations =
-        group.collation().getFieldCollations();
-    if (bound.isCurrentRow() && fieldCollations.size() != 1) {
-      return Expressions.call(
-          (lower
-              ? BuiltInMethod.BINARY_SEARCH5_LOWER
-              : BuiltInMethod.BINARY_SEARCH5_UPPER).method,
-          rows_, row_, searchLower, searchUpper, keySelector, keyComparator);
-    }
-    assert fieldCollations.size() == 1
-        : "When using range window specification, ORDER BY should have"
-        + " exactly one expression."
-        + " Actual collation is " + group.collation();
-    // isRange
-    int orderKey =
-        fieldCollations.get(0).getFieldIndex();
-    RelDataType keyType =
-        physType.getRowType().getFieldList().get(orderKey).getType();
-    Type desiredKeyType = translator.typeFactory.getJavaClass(keyType);
-    if (bound.getOffset() == null) {
-      desiredKeyType = Primitive.box(desiredKeyType);
-    }
-    Expression val = translator.translate(
-        new RexInputRef(orderKey, keyType), desiredKeyType);
-    if (!bound.isCurrentRow()) {
-      RexNode node = bound.getOffset();
-      Expression offs = translator.translate(node);
-      // TODO: support date + interval somehow
-      if (bound.isFollowing()) {
-        val = Expressions.add(val, offs);
-      } else {
-        val = Expressions.subtract(val, offs);
-      }
-    }
-    return Expressions.call(
-        (lower
-            ? BuiltInMethod.BINARY_SEARCH6_LOWER
-            : BuiltInMethod.BINARY_SEARCH6_UPPER).method,
-        rows_, val, searchLower, searchUpper, keySelector, keyComparator);
-  }
-}
-
-// End EnumerableWindow.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableWindowRule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableWindowRule.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableWindowRule.java
deleted file mode 100644
index a295470..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableWindowRule.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.plan.Convention;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.convert.ConverterRule;
-import org.apache.calcite.rel.logical.LogicalWindow;
-
-/**
- * Rule to convert a {@link org.apache.calcite.rel.logical.LogicalWindow} to
- * an {@link org.apache.calcite.adapter.enumerable.EnumerableWindow}.
- */
-class EnumerableWindowRule extends ConverterRule {
-  EnumerableWindowRule() {
-    super(LogicalWindow.class, Convention.NONE, EnumerableConvention.INSTANCE,
-        "EnumerableWindowRule");
-  }
-
-  public RelNode convert(RelNode rel) {
-    final LogicalWindow winAgg = (LogicalWindow) rel;
-    final RelTraitSet traitSet =
-        winAgg.getTraitSet().replace(EnumerableConvention.INSTANCE);
-    final RelNode child = winAgg.getInput();
-    final RelNode convertedChild =
-        convert(child,
-            child.getTraitSet().replace(EnumerableConvention.INSTANCE));
-    return new EnumerableWindow(rel.getCluster(), traitSet, convertedChild,
-        winAgg.getConstants(), winAgg.getRowType(), winAgg.groups);
-  }
-}
-
-// End EnumerableWindowRule.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/JavaRelImplementor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/JavaRelImplementor.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/JavaRelImplementor.java
deleted file mode 100644
index c4209a3..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/JavaRelImplementor.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.DataContext;
-import org.apache.calcite.adapter.java.JavaTypeFactory;
-import org.apache.calcite.linq4j.tree.ParameterExpression;
-import org.apache.calcite.plan.RelImplementor;
-import org.apache.calcite.rex.RexBuilder;
-
-/**
- * Abstract base class for implementations of {@link RelImplementor}
- * that generate java code.
- */
-public abstract class JavaRelImplementor implements RelImplementor {
-  private final RexBuilder rexBuilder;
-
-  public JavaRelImplementor(RexBuilder rexBuilder) {
-    this.rexBuilder = rexBuilder;
-    assert rexBuilder.getTypeFactory() instanceof JavaTypeFactory
-        : "Type factory of rexBuilder should be a JavaTypeFactory";
-  }
-
-  public RexBuilder getRexBuilder() {
-    return rexBuilder;
-  }
-
-  public JavaTypeFactory getTypeFactory() {
-    return (JavaTypeFactory) rexBuilder.getTypeFactory();
-  }
-
-  /**
-   * Returns the expression used to access
-   * {@link org.apache.calcite.DataContext}.
-   *
-   * @return expression used to access {@link org.apache.calcite.DataContext}.
-   */
-  public ParameterExpression getRootExpression() {
-    return DataContext.ROOT;
-  }
-}
-
-// End JavaRelImplementor.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/JavaRowFormat.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/JavaRowFormat.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/JavaRowFormat.java
deleted file mode 100644
index 86f0002..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/JavaRowFormat.java
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.adapter.java.JavaTypeFactory;
-import org.apache.calcite.interpreter.Row;
-import org.apache.calcite.linq4j.tree.Expression;
-import org.apache.calcite.linq4j.tree.Expressions;
-import org.apache.calcite.linq4j.tree.IndexExpression;
-import org.apache.calcite.linq4j.tree.MemberExpression;
-import org.apache.calcite.linq4j.tree.MethodCallExpression;
-import org.apache.calcite.linq4j.tree.Types;
-import org.apache.calcite.rel.type.RelDataType;
-import org.apache.calcite.runtime.FlatLists;
-import org.apache.calcite.runtime.Unit;
-import org.apache.calcite.util.BuiltInMethod;
-
-import java.lang.reflect.Type;
-import java.util.List;
-
-/**
- * How a row is represented as a Java value.
- */
-public enum JavaRowFormat {
-  CUSTOM {
-    Type javaRowClass(
-        JavaTypeFactory typeFactory,
-        RelDataType type) {
-      assert type.getFieldCount() > 1;
-      return typeFactory.getJavaClass(type);
-    }
-
-    @Override Type javaFieldClass(JavaTypeFactory typeFactory, RelDataType type,
-        int index) {
-      return typeFactory.getJavaClass(type.getFieldList().get(index).getType());
-    }
-
-    public Expression record(
-        Type javaRowClass, List<Expression> expressions) {
-      switch (expressions.size()) {
-      case 0:
-        assert javaRowClass == Unit.class;
-        return Expressions.field(null, javaRowClass, "INSTANCE");
-      default:
-        return Expressions.new_(javaRowClass, expressions);
-      }
-    }
-
-    public MemberExpression field(Expression expression, int field,
-        Type fromType, Type fieldType) {
-      final Type type = expression.getType();
-      if (type instanceof Types.RecordType) {
-        Types.RecordType recordType = (Types.RecordType) type;
-        Types.RecordField recordField =
-            recordType.getRecordFields().get(field);
-        return Expressions.field(expression, recordField.getDeclaringClass(),
-            recordField.getName());
-      } else {
-        return Expressions.field(expression, Types.nthField(field, type));
-      }
-    }
-  },
-
-  SCALAR {
-    Type javaRowClass(
-        JavaTypeFactory typeFactory,
-        RelDataType type) {
-      assert type.getFieldCount() == 1;
-      return typeFactory.getJavaClass(
-          type.getFieldList().get(0).getType());
-    }
-
-    @Override Type javaFieldClass(JavaTypeFactory typeFactory, RelDataType type,
-        int index) {
-      return javaRowClass(typeFactory, type);
-    }
-
-    public Expression record(Type javaRowClass, List<Expression> expressions) {
-      assert expressions.size() == 1;
-      return expressions.get(0);
-    }
-
-    public Expression field(Expression expression, int field, Type fromType,
-        Type fieldType) {
-      assert field == 0;
-      return expression;
-    }
-  },
-
-  /** A list that is comparable and immutable. Useful for records with 0 fields
-   * (empty list is a good singleton) but sometimes also for records with 2 or
-   * more fields that you need to be comparable, say as a key in a lookup. */
-  LIST {
-    Type javaRowClass(
-        JavaTypeFactory typeFactory,
-        RelDataType type) {
-      return FlatLists.ComparableList.class;
-    }
-
-    @Override Type javaFieldClass(JavaTypeFactory typeFactory, RelDataType type,
-        int index) {
-      return Object.class;
-    }
-
-    public Expression record(
-        Type javaRowClass, List<Expression> expressions) {
-      switch (expressions.size()) {
-      case 0:
-        return Expressions.field(
-          null,
-          FlatLists.class,
-          "COMPARABLE_EMPTY_LIST");
-      case 2:
-        return Expressions.convert_(
-            Expressions.call(
-                List.class,
-                null,
-                BuiltInMethod.LIST2.method,
-                expressions),
-            List.class);
-      case 3:
-        return Expressions.convert_(
-            Expressions.call(
-                List.class,
-                null,
-                BuiltInMethod.LIST3.method,
-                expressions),
-            List.class);
-      case 4:
-        return Expressions.convert_(
-            Expressions.call(
-                List.class,
-                null,
-                BuiltInMethod.LIST4.method,
-                expressions),
-            List.class);
-      case 5:
-        return Expressions.convert_(
-            Expressions.call(
-                List.class,
-                null,
-                BuiltInMethod.LIST5.method,
-                expressions),
-            List.class);
-      case 6:
-        return Expressions.convert_(
-            Expressions.call(
-                List.class,
-                null,
-                BuiltInMethod.LIST6.method,
-                expressions),
-            List.class);
-      default:
-        return Expressions.convert_(
-            Expressions.call(
-                List.class,
-                null,
-                BuiltInMethod.LIST_N.method,
-                Expressions.newArrayInit(
-                    Comparable.class,
-                    expressions)),
-            List.class);
-      }
-    }
-
-    public Expression field(Expression expression, int field, Type fromType,
-        Type fieldType) {
-      final MethodCallExpression e = Expressions.call(expression,
-          BuiltInMethod.LIST_GET.method, Expressions.constant(field));
-      if (fromType == null) {
-        fromType = e.getType();
-      }
-      return RexToLixTranslator.convert(e, fromType, fieldType);
-    }
-  },
-
-  /**
-   * See {@link org.apache.calcite.interpreter.Row}
-   */
-  ROW {
-    @Override Type javaRowClass(JavaTypeFactory typeFactory, RelDataType type) {
-      return Row.class;
-    }
-
-    @Override Type javaFieldClass(JavaTypeFactory typeFactory, RelDataType type,
-        int index) {
-      return Object.class;
-    }
-
-    @Override public Expression record(Type javaRowClass,
-        List<Expression> expressions) {
-      return Expressions.call(BuiltInMethod.ROW_AS_COPY.method, expressions);
-    }
-
-    public Expression field(Expression expression, int field, Type fromType,
-        Type fieldType) {
-      final Expression e = Expressions.call(expression,
-          BuiltInMethod.ROW_VALUE.method, Expressions.constant(field));
-      if (fromType == null) {
-        fromType = e.getType();
-      }
-      return RexToLixTranslator.convert(e, fromType, fieldType);
-    }
-  },
-
-  ARRAY {
-    Type javaRowClass(
-        JavaTypeFactory typeFactory,
-        RelDataType type) {
-      return Object[].class;
-    }
-
-    @Override Type javaFieldClass(JavaTypeFactory typeFactory, RelDataType type,
-        int index) {
-      return Object.class;
-    }
-
-    public Expression record(Type javaRowClass, List<Expression> expressions) {
-      return Expressions.newArrayInit(Object.class, expressions);
-    }
-
-    @Override public Expression comparer() {
-      return Expressions.call(BuiltInMethod.ARRAY_COMPARER.method);
-    }
-
-    public Expression field(Expression expression, int field, Type fromType,
-        Type fieldType) {
-      final IndexExpression e = Expressions.arrayIndex(expression,
-          Expressions.constant(field));
-      if (fromType == null) {
-        fromType = e.getType();
-      }
-      return RexToLixTranslator.convert(e, fromType, fieldType);
-    }
-  };
-
-  public JavaRowFormat optimize(RelDataType rowType) {
-    switch (rowType.getFieldCount()) {
-    case 0:
-      return LIST;
-    case 1:
-      return SCALAR;
-    default:
-      if (this == SCALAR) {
-        return LIST;
-      }
-      return this;
-    }
-  }
-
-  abstract Type javaRowClass(JavaTypeFactory typeFactory, RelDataType type);
-
-  /**
-   * Returns the java class that is used to physically store the given field.
-   * For instance, a non-null int field can still be stored in a field of type
-   * {@code Object.class} in {@link JavaRowFormat#ARRAY} case.
-   *
-   * @param typeFactory type factory to resolve java types
-   * @param type row type
-   * @param index field index
-   * @return java type used to store the field
-   */
-  abstract Type javaFieldClass(JavaTypeFactory typeFactory, RelDataType type,
-      int index);
-
-  public abstract Expression record(
-      Type javaRowClass, List<Expression> expressions);
-
-  public Expression comparer() {
-    return null;
-  }
-
-  /** Returns a reference to a particular field.
-   *
-   * <p>{@code fromType} may be null; if null, uses the natural type of the
-   * field.
-   */
-  public abstract Expression field(Expression expression, int field,
-      Type fromType, Type fieldType);
-}
-
-// End JavaRowFormat.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/NestedBlockBuilder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/NestedBlockBuilder.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/NestedBlockBuilder.java
deleted file mode 100644
index c78a25c..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/NestedBlockBuilder.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.linq4j.tree.BlockBuilder;
-import org.apache.calcite.rex.RexNode;
-
-import java.util.Map;
-
-/**
- * Allows to build nested code blocks with tracking of current context and the
- * nullability of particular {@link org.apache.calcite.rex.RexNode} expressions.
- *
- * @see org.apache.calcite.adapter.enumerable.StrictAggImplementor#implementAdd(AggContext, AggAddContext)
- */
-public interface NestedBlockBuilder {
-  /**
-   * Starts nested code block. The resulting block can optimize expressions
-   * and reuse already calculated values from the parent blocks.
-   * @return new code block that can optimize expressions and reuse already
-   * calculated values from the parent blocks.
-   */
-  BlockBuilder nestBlock();
-
-  /**
-   * Uses given block as the new code context.
-   * The current block will be restored after {@link #exitBlock()} call.
-   * @param block new code block
-   * @see #exitBlock()
-   */
-  void nestBlock(BlockBuilder block);
-
-  /**
-   * Uses given block as the new code context and the map of nullability.
-   * The current block will be restored after {@link #exitBlock()} call.
-   * @param block new code block
-   * @param nullables map of expression to its nullability state
-   * @see #exitBlock()
-   */
-  void nestBlock(BlockBuilder block,
-      Map<RexNode, Boolean> nullables);
-
-  /**
-   * Returns the current code block
-   * @return current code block
-   */
-  BlockBuilder currentBlock();
-
-  /**
-   * Returns the current nullability state of rex nodes.
-   * The resulting value is the summary of all the maps in the block hierarchy.
-   * @return current nullability state of rex nodes
-   */
-  Map<RexNode, Boolean> currentNullables();
-
-  /**
-   * Leaves the current code block.
-   * @see #nestBlock()
-   */
-  void exitBlock();
-}
-
-// End NestedBlockBuilder.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/NestedBlockBuilderImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/NestedBlockBuilderImpl.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/NestedBlockBuilderImpl.java
deleted file mode 100644
index 1caa47e..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/NestedBlockBuilderImpl.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.linq4j.tree.BlockBuilder;
-import org.apache.calcite.rex.RexNode;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Allows to build nested code blocks with tracking of current context and the
- * nullability of particular {@link org.apache.calcite.rex.RexNode} expressions.
- *
- * @see org.apache.calcite.adapter.enumerable.StrictAggImplementor#implementAdd(AggContext, AggAddContext)
- */
-public class NestedBlockBuilderImpl implements NestedBlockBuilder {
-  private final List<BlockBuilder> blocks = new ArrayList<BlockBuilder>();
-  private final List<Map<RexNode, Boolean>> nullables =
-      new ArrayList<Map<RexNode, Boolean>>();
-
-  /**
-   * Constructs nested block builders starting of a given code block.
-   * @param block root code block
-   */
-  public NestedBlockBuilderImpl(BlockBuilder block) {
-    nestBlock(block);
-  }
-
-  /**
-   * Starts nested code block. The resulting block can optimize expressions
-   * and reuse already calculated values from the parent blocks.
-   * @return new code block that can optimize expressions and reuse already
-   * calculated values from the parent blocks.
-   */
-  public final BlockBuilder nestBlock() {
-    BlockBuilder block = new BlockBuilder(true, currentBlock());
-    nestBlock(block, Collections.<RexNode, Boolean>emptyMap());
-    return block;
-  }
-
-  /**
-   * Uses given block as the new code context.
-   * The current block will be restored after {@link #exitBlock()} call.
-   * @param block new code block
-   * @see #exitBlock()
-   */
-  public final void nestBlock(BlockBuilder block) {
-    nestBlock(block, Collections.<RexNode, Boolean>emptyMap());
-  }
-
-  /**
-   * Uses given block as the new code context and the map of nullability.
-   * The current block will be restored after {@link #exitBlock()} call.
-   * @param block new code block
-   * @param nullables map of expression to its nullability state
-   * @see #exitBlock()
-   */
-  public final void nestBlock(BlockBuilder block,
-      Map<RexNode, Boolean> nullables) {
-    blocks.add(block);
-    Map<RexNode, Boolean> prev = this.nullables.isEmpty()
-        ? Collections.<RexNode, Boolean>emptyMap()
-        : this.nullables.get(this.nullables.size() - 1);
-    Map<RexNode, Boolean> next;
-    if (nullables == null || nullables.isEmpty()) {
-      next = prev;
-    } else {
-      next = new HashMap<RexNode, Boolean>(nullables);
-      next.putAll(prev);
-      next = Collections.unmodifiableMap(next);
-    }
-    this.nullables.add(next);
-  }
-
-  /**
-   * Returns the current code block
-   * @return current code block
-   */
-  public final BlockBuilder currentBlock() {
-    return blocks.get(blocks.size() - 1);
-  }
-
-  /**
-   * Returns the current nullability state of rex nodes.
-   * The resulting value is the summary of all the maps in the block hierarchy.
-   * @return current nullability state of rex nodes
-   */
-  public final Map<RexNode, Boolean> currentNullables() {
-    return nullables.get(nullables.size() - 1);
-  }
-
-  /**
-   * Leaves the current code block.
-   * @see #nestBlock()
-   */
-  public final void exitBlock() {
-    blocks.remove(blocks.size() - 1);
-    nullables.remove(nullables.size() - 1);
-  }
-}
-
-// End NestedBlockBuilderImpl.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/NotNullImplementor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/NotNullImplementor.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/NotNullImplementor.java
deleted file mode 100644
index 0144d3a..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/NotNullImplementor.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.linq4j.tree.Expression;
-import org.apache.calcite.rex.RexCall;
-
-import java.util.List;
-
-/**
- * Simplified version of
- * {@link org.apache.calcite.adapter.enumerable.CallImplementor}
- * that does not know about null semantics.
- *
- * @see org.apache.calcite.adapter.enumerable.RexImpTable
- * @see org.apache.calcite.adapter.enumerable.CallImplementor
- */
-public interface NotNullImplementor {
-  /**
-   * Implements a call with assumption that all the null-checking is
-   * implemented by caller.
-   *
-   * @param translator translator to implement the code
-   * @param call call to implement
-   * @param translatedOperands arguments of a call
-   * @return expression that implements given call
-   */
-  Expression implement(
-      RexToLixTranslator translator,
-      RexCall call,
-      List<Expression> translatedOperands);
-}
-
-// End NotNullImplementor.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/NullPolicy.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/NullPolicy.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/NullPolicy.java
deleted file mode 100644
index dedf300..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/NullPolicy.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-/**
- * Describes when a function/operator will return null.
- *
- * <p>STRICT and ANY are similar. STRICT says f(a0, a1) will NEVER return
- * null if a0 and a1 are not null. This means that we can check whether f
- * returns null just by checking its arguments. Use STRICT in preference to
- * ANY whenever possible.</p>
- */
-public enum NullPolicy {
-  /** Returns null if and only if one of the arguments are null. */
-  STRICT,
-  /** If any of the arguments are null, return null. */
-  ANY,
-  /** If any of the arguments are false, result is false; else if any
-   * arguments are null, result is null; else true. */
-  AND,
-  /** If any of the arguments are true, result is true; else if any
-   * arguments are null, result is null; else false. */
-  OR,
-  /** If any argument is true, result is false; else if any argument is null,
-   * result is null; else true. */
-  NOT,
-  NONE
-}
-
-// End NullPolicy.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/PhysType.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/PhysType.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/PhysType.java
deleted file mode 100644
index 20ae559..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/PhysType.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.linq4j.tree.Expression;
-import org.apache.calcite.linq4j.tree.ParameterExpression;
-import org.apache.calcite.rel.RelCollation;
-import org.apache.calcite.rel.RelFieldCollation;
-import org.apache.calcite.rel.type.RelDataType;
-import org.apache.calcite.util.Pair;
-
-import java.lang.reflect.Type;
-import java.util.List;
-
-/**
- * Physical type of a row.
- *
- * <p>Consists of the SQL row type (returned by {@link #getRowType()}), the Java
- * type of the row (returned by {@link #getJavaRowType()}), and methods to
- * generate expressions to access fields, generate records, and so forth.
- * Together, the records encapsulate how the logical type maps onto the physical
- * type.</p>
- */
-public interface PhysType {
-  /** Returns the Java type (often a Class) that represents a row. For
-   * example, in one row format, always returns {@code Object[].class}. */
-  Type getJavaRowType();
-
-  /**
-   * Returns the Java class that is used to store the field with the given
-   * ordinal.
-   *
-   * <p>For instance, when the java row type is {@code Object[]}, the java
-   * field type is {@code Object} even if the field is not nullable.</p> */
-  Type getJavaFieldType(int field);
-
-  /** Returns the physical type of a field. */
-  PhysType field(int ordinal);
-
-  /** Returns the physical type of a given field's component type. */
-  PhysType component(int field);
-
-  /** Returns the SQL row type. */
-  RelDataType getRowType();
-
-  /** Returns the Java class of the field with the given ordinal. */
-  Class fieldClass(int field);
-
-  /** Returns whether a given field allows null values. */
-  boolean fieldNullable(int index);
-
-  /** Generates a reference to a given field in an expression.
-   *
-   * <p>For example given {@code expression=employee} and {@code field=2},
-   * generates</p>
-   *
-   * <pre>{@code employee.deptno}</pre>
-   *
-   * @param expression Expression
-   * @param field Ordinal of field
-   * @return Expression to access the field of the expression
-   */
-  Expression fieldReference(Expression expression, int field);
-
-  /** Generates a reference to a given field in an expression.
-   *
-   * <p>This method optimizes for the target storage type (i.e. avoids
-   * casts).</p>
-   *
-   * <p>For example given {@code expression=employee} and {@code field=2},
-   * generates</p>
-   *
-   * <pre>{@code employee.deptno}</pre>
-   *
-   * @param expression Expression
-   * @param field Ordinal of field
-   * @param storageType optional hint for storage class
-   * @return Expression to access the field of the expression
-   */
-  Expression fieldReference(Expression expression, int field,
-      Type storageType);
-
-  /** Generates an accessor function for a given list of fields.  The resulting
-   * object is a {@link List} (implementing {@link Object#hashCode()} and
-   * {@link Object#equals(Object)} per that interface) and also implements
-   * {@link Comparable}.
-   *
-   * <p>For example:</p>
-   *
-   * <pre>{@code
-   * new Function1<Employee, Object[]> {
-   *    public Object[] apply(Employee v1) {
-   *        return FlatLists.of(v1.<fieldN>, v1.<fieldM>);
-   *    }
-   * }
-   * }</pre>
-   */
-  Expression generateAccessor(List<Integer> fields);
-
-  /** Generates a selector for the given fields from an expression, with the
-   * default row format. */
-  Expression generateSelector(
-      ParameterExpression parameter,
-      List<Integer> fields);
-
-  /** Generates a lambda expression that is a selector for the given fields from
-   * an expression. */
-  Expression generateSelector(
-      ParameterExpression parameter,
-      List<Integer> fields,
-      JavaRowFormat targetFormat);
-
-  /** Generates a lambda expression that is a selector for the given fields from
-   * an expression.
-   *
-   * <p>{@code usedFields} must be a subset of {@code fields}.
-   * For each field, there is a corresponding indicator field.
-   * If a field is used, its value is assigned and its indicator is left
-   * {@code false}.
-   * If a field is not used, its value is not assigned and its indicator is
-   * set to {@code true};
-   * This will become a value of 1 when {@code GROUPING(field)} is called. */
-  Expression generateSelector(
-      ParameterExpression parameter,
-      List<Integer> fields,
-      List<Integer> usedFields,
-      JavaRowFormat targetFormat);
-
-  /** Generates a selector for the given fields from an expression.
-   * Only used by EnumerableWindow. */
-  Pair<Type, List<Expression>> selector(
-      ParameterExpression parameter,
-      List<Integer> fields,
-      JavaRowFormat targetFormat);
-
-  /** Projects a given collection of fields from this input record, into
-   * a particular preferred output format. The output format is optimized
-   * if there are 0 or 1 fields. */
-  PhysType project(
-      List<Integer> integers,
-      JavaRowFormat format);
-
-  /** Projects a given collection of fields from this input record, optionally
-   * with indicator fields, into a particular preferred output format.
-   *
-   * <p>The output format is optimized if there are 0 or 1 fields
-   * and indicators are disabled. */
-  PhysType project(
-      List<Integer> integers,
-      boolean indicator,
-      JavaRowFormat format);
-
-  /** Returns a lambda to create a collation key and a comparator. The
-   * comparator is sometimes null. */
-  Pair<Expression, Expression> generateCollationKey(
-      List<RelFieldCollation> collations);
-
-  /** Returns a comparator. Unlike the comparator returned by
-   * {@link #generateCollationKey(java.util.List)}, this comparator acts on the
-   * whole element. */
-  Expression generateComparator(
-      RelCollation collation);
-
-  /** Returns a expression that yields a comparer, or null if this type
-   * is comparable. */
-  Expression comparer();
-
-  /** Generates an expression that creates a record for a row, initializing
-   * its fields with the given expressions. There must be one expression per
-   * field.
-   *
-   * @param expressions Expression to initialize each field
-   * @return Expression to create a row
-   */
-  Expression record(List<Expression> expressions);
-
-  /** Returns the format. */
-  JavaRowFormat getFormat();
-
-  List<Expression> accessors(Expression parameter, List<Integer> argList);
-
-  /** Returns a copy of this type that allows nulls if {@code nullable} is
-   * true. */
-  PhysType makeNullable(boolean nullable);
-
-  /** Converts an enumerable of this physical type to an enumerable that uses a
-   * given physical type for its rows. */
-  Expression convertTo(Expression expression, PhysType targetPhysType);
-}
-
-// End PhysType.java


[37/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/remote/ProtobufTranslationImpl.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/ProtobufTranslationImpl.java b/avatica/core/src/main/java/org/apache/calcite/avatica/remote/ProtobufTranslationImpl.java
deleted file mode 100644
index e1dd06d..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/ProtobufTranslationImpl.java
+++ /dev/null
@@ -1,399 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import org.apache.calcite.avatica.proto.Common.WireMessage;
-import org.apache.calcite.avatica.proto.Requests.CatalogsRequest;
-import org.apache.calcite.avatica.proto.Requests.CloseConnectionRequest;
-import org.apache.calcite.avatica.proto.Requests.CloseStatementRequest;
-import org.apache.calcite.avatica.proto.Requests.ColumnsRequest;
-import org.apache.calcite.avatica.proto.Requests.CommitRequest;
-import org.apache.calcite.avatica.proto.Requests.ConnectionSyncRequest;
-import org.apache.calcite.avatica.proto.Requests.CreateStatementRequest;
-import org.apache.calcite.avatica.proto.Requests.DatabasePropertyRequest;
-import org.apache.calcite.avatica.proto.Requests.ExecuteBatchRequest;
-import org.apache.calcite.avatica.proto.Requests.ExecuteRequest;
-import org.apache.calcite.avatica.proto.Requests.FetchRequest;
-import org.apache.calcite.avatica.proto.Requests.OpenConnectionRequest;
-import org.apache.calcite.avatica.proto.Requests.PrepareAndExecuteBatchRequest;
-import org.apache.calcite.avatica.proto.Requests.PrepareAndExecuteRequest;
-import org.apache.calcite.avatica.proto.Requests.PrepareRequest;
-import org.apache.calcite.avatica.proto.Requests.RollbackRequest;
-import org.apache.calcite.avatica.proto.Requests.SchemasRequest;
-import org.apache.calcite.avatica.proto.Requests.SyncResultsRequest;
-import org.apache.calcite.avatica.proto.Requests.TableTypesRequest;
-import org.apache.calcite.avatica.proto.Requests.TablesRequest;
-import org.apache.calcite.avatica.proto.Requests.TypeInfoRequest;
-import org.apache.calcite.avatica.proto.Responses.CloseConnectionResponse;
-import org.apache.calcite.avatica.proto.Responses.CloseStatementResponse;
-import org.apache.calcite.avatica.proto.Responses.CommitResponse;
-import org.apache.calcite.avatica.proto.Responses.ConnectionSyncResponse;
-import org.apache.calcite.avatica.proto.Responses.CreateStatementResponse;
-import org.apache.calcite.avatica.proto.Responses.DatabasePropertyResponse;
-import org.apache.calcite.avatica.proto.Responses.ErrorResponse;
-import org.apache.calcite.avatica.proto.Responses.ExecuteBatchResponse;
-import org.apache.calcite.avatica.proto.Responses.ExecuteResponse;
-import org.apache.calcite.avatica.proto.Responses.FetchResponse;
-import org.apache.calcite.avatica.proto.Responses.OpenConnectionResponse;
-import org.apache.calcite.avatica.proto.Responses.PrepareResponse;
-import org.apache.calcite.avatica.proto.Responses.ResultSetResponse;
-import org.apache.calcite.avatica.proto.Responses.RollbackResponse;
-import org.apache.calcite.avatica.proto.Responses.RpcMetadata;
-import org.apache.calcite.avatica.proto.Responses.SyncResultsResponse;
-import org.apache.calcite.avatica.remote.Service.Request;
-import org.apache.calcite.avatica.remote.Service.Response;
-import org.apache.calcite.avatica.remote.Service.RpcMetadataResponse;
-import org.apache.calcite.avatica.util.UnsynchronizedBuffer;
-
-import com.google.protobuf.ByteString;
-import com.google.protobuf.CodedInputStream;
-import com.google.protobuf.Message;
-import com.google.protobuf.TextFormat;
-import com.google.protobuf.UnsafeByteOperations;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import static java.nio.charset.StandardCharsets.UTF_8;
-
-/**
- * Implementation of {@link ProtobufTranslationImpl} that translates
- * protobuf requests to POJO requests.
- */
-public class ProtobufTranslationImpl implements ProtobufTranslation {
-  private static final Logger LOG = LoggerFactory.getLogger(ProtobufTranslationImpl.class);
-
-  // Extremely ugly mapping of PB class name into a means to convert it to the POJO
-  private static final Map<String, RequestTranslator> REQUEST_PARSERS;
-  private static final Map<String, ResponseTranslator> RESPONSE_PARSERS;
-  private static final Map<Class<?>, ByteString> MESSAGE_CLASSES;
-
-  static {
-    Map<String, RequestTranslator> reqParsers = new ConcurrentHashMap<>();
-    reqParsers.put(CatalogsRequest.class.getName(),
-        new RequestTranslator(CatalogsRequest.parser(), new Service.CatalogsRequest()));
-    reqParsers.put(OpenConnectionRequest.class.getName(),
-        new RequestTranslator(OpenConnectionRequest.parser(), new Service.OpenConnectionRequest()));
-    reqParsers.put(CloseConnectionRequest.class.getName(),
-        new RequestTranslator(CloseConnectionRequest.parser(),
-          new Service.CloseConnectionRequest()));
-    reqParsers.put(CloseStatementRequest.class.getName(),
-        new RequestTranslator(CloseStatementRequest.parser(), new Service.CloseStatementRequest()));
-    reqParsers.put(ColumnsRequest.class.getName(),
-        new RequestTranslator(ColumnsRequest.parser(), new Service.ColumnsRequest()));
-    reqParsers.put(ConnectionSyncRequest.class.getName(),
-        new RequestTranslator(ConnectionSyncRequest.parser(), new Service.ConnectionSyncRequest()));
-    reqParsers.put(CreateStatementRequest.class.getName(),
-        new RequestTranslator(CreateStatementRequest.parser(),
-          new Service.CreateStatementRequest()));
-    reqParsers.put(DatabasePropertyRequest.class.getName(),
-        new RequestTranslator(DatabasePropertyRequest.parser(),
-            new Service.DatabasePropertyRequest()));
-    reqParsers.put(FetchRequest.class.getName(),
-        new RequestTranslator(FetchRequest.parser(), new Service.FetchRequest()));
-    reqParsers.put(PrepareAndExecuteRequest.class.getName(),
-        new RequestTranslator(PrepareAndExecuteRequest.parser(),
-            new Service.PrepareAndExecuteRequest()));
-    reqParsers.put(PrepareRequest.class.getName(),
-        new RequestTranslator(PrepareRequest.parser(), new Service.PrepareRequest()));
-    reqParsers.put(SchemasRequest.class.getName(),
-        new RequestTranslator(SchemasRequest.parser(), new Service.SchemasRequest()));
-    reqParsers.put(TablesRequest.class.getName(),
-        new RequestTranslator(TablesRequest.parser(), new Service.TablesRequest()));
-    reqParsers.put(TableTypesRequest.class.getName(),
-        new RequestTranslator(TableTypesRequest.parser(), new Service.TableTypesRequest()));
-    reqParsers.put(TypeInfoRequest.class.getName(),
-        new RequestTranslator(TypeInfoRequest.parser(), new Service.TypeInfoRequest()));
-    reqParsers.put(ExecuteRequest.class.getName(),
-        new RequestTranslator(ExecuteRequest.parser(), new Service.ExecuteRequest()));
-    reqParsers.put(SyncResultsRequest.class.getName(),
-        new RequestTranslator(SyncResultsRequest.parser(), new Service.SyncResultsRequest()));
-    reqParsers.put(CommitRequest.class.getName(),
-        new RequestTranslator(CommitRequest.parser(), new Service.CommitRequest()));
-    reqParsers.put(RollbackRequest.class.getName(),
-        new RequestTranslator(RollbackRequest.parser(), new Service.RollbackRequest()));
-    reqParsers.put(PrepareAndExecuteBatchRequest.class.getName(),
-        new RequestTranslator(PrepareAndExecuteBatchRequest.parser(),
-            new Service.PrepareAndExecuteBatchRequest()));
-    reqParsers.put(ExecuteBatchRequest.class.getName(),
-        new RequestTranslator(ExecuteBatchRequest.parser(),
-            new Service.ExecuteBatchRequest()));
-
-    REQUEST_PARSERS = Collections.unmodifiableMap(reqParsers);
-
-    Map<String, ResponseTranslator> respParsers = new ConcurrentHashMap<>();
-    respParsers.put(OpenConnectionResponse.class.getName(),
-        new ResponseTranslator(OpenConnectionResponse.parser(),
-            new Service.OpenConnectionResponse()));
-    respParsers.put(CloseConnectionResponse.class.getName(),
-        new ResponseTranslator(CloseConnectionResponse.parser(),
-            new Service.CloseConnectionResponse()));
-    respParsers.put(CloseStatementResponse.class.getName(),
-        new ResponseTranslator(CloseStatementResponse.parser(),
-            new Service.CloseStatementResponse()));
-    respParsers.put(ConnectionSyncResponse.class.getName(),
-        new ResponseTranslator(ConnectionSyncResponse.parser(),
-            new Service.ConnectionSyncResponse()));
-    respParsers.put(CreateStatementResponse.class.getName(),
-        new ResponseTranslator(CreateStatementResponse.parser(),
-            new Service.CreateStatementResponse()));
-    respParsers.put(DatabasePropertyResponse.class.getName(),
-        new ResponseTranslator(DatabasePropertyResponse.parser(),
-            new Service.DatabasePropertyResponse()));
-    respParsers.put(ExecuteResponse.class.getName(),
-        new ResponseTranslator(ExecuteResponse.parser(), new Service.ExecuteResponse()));
-    respParsers.put(FetchResponse.class.getName(),
-        new ResponseTranslator(FetchResponse.parser(), new Service.FetchResponse()));
-    respParsers.put(PrepareResponse.class.getName(),
-        new ResponseTranslator(PrepareResponse.parser(), new Service.PrepareResponse()));
-    respParsers.put(ResultSetResponse.class.getName(),
-        new ResponseTranslator(ResultSetResponse.parser(), new Service.ResultSetResponse()));
-    respParsers.put(ErrorResponse.class.getName(),
-        new ResponseTranslator(ErrorResponse.parser(), new Service.ErrorResponse()));
-    respParsers.put(SyncResultsResponse.class.getName(),
-        new ResponseTranslator(SyncResultsResponse.parser(), new Service.SyncResultsResponse()));
-    respParsers.put(RpcMetadata.class.getName(),
-        new ResponseTranslator(RpcMetadata.parser(), new RpcMetadataResponse()));
-    respParsers.put(CommitResponse.class.getName(),
-        new ResponseTranslator(CommitResponse.parser(), new Service.CommitResponse()));
-    respParsers.put(RollbackResponse.class.getName(),
-        new ResponseTranslator(RollbackResponse.parser(), new Service.RollbackResponse()));
-    respParsers.put(ExecuteBatchResponse.class.getName(),
-        new ResponseTranslator(ExecuteBatchResponse.parser(), new Service.ExecuteBatchResponse()));
-
-    RESPONSE_PARSERS = Collections.unmodifiableMap(respParsers);
-
-    Map<Class<?>, ByteString> messageClassNames = new ConcurrentHashMap<>();
-    for (Class<?> msgClz : getAllMessageClasses()) {
-      messageClassNames.put(msgClz, wrapClassName(msgClz));
-    }
-    MESSAGE_CLASSES = Collections.unmodifiableMap(messageClassNames);
-  }
-
-  private static List<Class<?>> getAllMessageClasses() {
-    List<Class<?>> messageClasses = new ArrayList<>();
-    messageClasses.add(CatalogsRequest.class);
-    messageClasses.add(CloseConnectionRequest.class);
-    messageClasses.add(CloseStatementRequest.class);
-    messageClasses.add(ColumnsRequest.class);
-    messageClasses.add(CommitRequest.class);
-    messageClasses.add(ConnectionSyncRequest.class);
-    messageClasses.add(CreateStatementRequest.class);
-    messageClasses.add(DatabasePropertyRequest.class);
-    messageClasses.add(ExecuteRequest.class);
-    messageClasses.add(FetchRequest.class);
-    messageClasses.add(OpenConnectionRequest.class);
-    messageClasses.add(PrepareAndExecuteRequest.class);
-    messageClasses.add(PrepareRequest.class);
-    messageClasses.add(RollbackRequest.class);
-    messageClasses.add(SchemasRequest.class);
-    messageClasses.add(SyncResultsRequest.class);
-    messageClasses.add(TableTypesRequest.class);
-    messageClasses.add(TablesRequest.class);
-    messageClasses.add(TypeInfoRequest.class);
-    messageClasses.add(PrepareAndExecuteBatchRequest.class);
-    messageClasses.add(ExecuteBatchRequest.class);
-
-    messageClasses.add(CloseConnectionResponse.class);
-    messageClasses.add(CloseStatementResponse.class);
-    messageClasses.add(CommitResponse.class);
-    messageClasses.add(ConnectionSyncResponse.class);
-    messageClasses.add(CreateStatementResponse.class);
-    messageClasses.add(DatabasePropertyResponse.class);
-    messageClasses.add(ErrorResponse.class);
-    messageClasses.add(ExecuteResponse.class);
-    messageClasses.add(FetchResponse.class);
-    messageClasses.add(OpenConnectionResponse.class);
-    messageClasses.add(PrepareResponse.class);
-    messageClasses.add(ResultSetResponse.class);
-    messageClasses.add(RollbackResponse.class);
-    messageClasses.add(RpcMetadata.class);
-    messageClasses.add(SyncResultsResponse.class);
-    messageClasses.add(ExecuteBatchResponse.class);
-
-    return messageClasses;
-  }
-
-  private static ByteString wrapClassName(Class<?> clz) {
-    return UnsafeByteOperations.unsafeWrap(clz.getName().getBytes(UTF_8));
-  }
-
-  private final ThreadLocal<UnsynchronizedBuffer> threadLocalBuffer =
-      new ThreadLocal<UnsynchronizedBuffer>() {
-        @Override protected UnsynchronizedBuffer initialValue() {
-          return new UnsynchronizedBuffer();
-        }
-      };
-
-  /**
-   * Fetches the concrete message's Parser implementation.
-   *
-   * @param className The protocol buffer class name
-   * @return The Parser for the class
-   * @throws IllegalArgumentException If the argument is null or if a Parser for the given
-   *     class name is not found.
-   */
-  public static RequestTranslator getParserForRequest(String className) {
-    if (null == className || className.isEmpty()) {
-      throw new IllegalArgumentException("Cannot fetch parser for Request with "
-          + (null == className ? "null" : "missing") + " class name");
-    }
-
-    RequestTranslator translator = REQUEST_PARSERS.get(className);
-    if (null == translator) {
-      throw new IllegalArgumentException("Cannot find request parser for " + className);
-    }
-
-    return translator;
-  }
-
-  /**
-   * Fetches the concrete message's Parser implementation.
-   *
-   * @param className The protocol buffer class name
-   * @return The Parser for the class
-   * @throws IllegalArgumentException If the argument is null or if a Parser for the given
-   *     class name is not found.
-   */
-  public static ResponseTranslator getParserForResponse(String className) {
-    if (null == className || className.isEmpty()) {
-      throw new IllegalArgumentException("Cannot fetch parser for Response with "
-          + (null == className ? "null" : "missing") + " class name");
-    }
-
-    ResponseTranslator translator = RESPONSE_PARSERS.get(className);
-    if (null == translator) {
-      throw new IllegalArgumentException("Cannot find response parser for " + className);
-    }
-
-    return translator;
-  }
-
-  @Override public byte[] serializeResponse(Response response) throws IOException {
-    // Avoid BAOS for its synchronized write methods, we don't need that concurrency control
-    UnsynchronizedBuffer out = threadLocalBuffer.get();
-    try {
-      Message responseMsg = response.serialize();
-      // Serialization of the response may be large
-      if (LOG.isTraceEnabled()) {
-        LOG.trace("Serializing response '{}'", TextFormat.shortDebugString(responseMsg));
-      }
-      serializeMessage(out, responseMsg);
-      return out.toArray();
-    } finally {
-      out.reset();
-    }
-  }
-
-  @Override public byte[] serializeRequest(Request request) throws IOException {
-    // Avoid BAOS for its synchronized write methods, we don't need that concurrency control
-    UnsynchronizedBuffer out = threadLocalBuffer.get();
-    try {
-      Message requestMsg = request.serialize();
-      // Serialization of the request may be large
-      if (LOG.isTraceEnabled()) {
-        LOG.trace("Serializing request '{}'", TextFormat.shortDebugString(requestMsg));
-      }
-      serializeMessage(out, requestMsg);
-      return out.toArray();
-    } finally {
-      out.reset();
-    }
-  }
-
-  void serializeMessage(OutputStream out, Message msg) throws IOException {
-    // Serialize the protobuf message
-    UnsynchronizedBuffer buffer = threadLocalBuffer.get();
-    ByteString serializedMsg;
-    try {
-      msg.writeTo(buffer);
-      // Make a bytestring from it
-      serializedMsg = UnsafeByteOperations.unsafeWrap(buffer.toArray());
-    } finally {
-      buffer.reset();
-    }
-
-    // Wrap the serialized message in a WireMessage
-    WireMessage wireMsg = WireMessage.newBuilder().setNameBytes(getClassNameBytes(msg.getClass()))
-        .setWrappedMessage(serializedMsg).build();
-
-    // Write the WireMessage to the provided OutputStream
-    wireMsg.writeTo(out);
-  }
-
-  ByteString getClassNameBytes(Class<?> clz) {
-    ByteString byteString = MESSAGE_CLASSES.get(clz);
-    if (null == byteString) {
-      throw new IllegalArgumentException("Missing ByteString for " + clz.getName());
-    }
-    return byteString;
-  }
-
-  @Override public Request parseRequest(byte[] bytes) throws IOException {
-    ByteString byteString = UnsafeByteOperations.unsafeWrap(bytes);
-    CodedInputStream inputStream = byteString.newCodedInput();
-    // Enable aliasing to avoid an extra copy to get at the serialized Request inside of the
-    // WireMessage.
-    inputStream.enableAliasing(true);
-    WireMessage wireMsg = WireMessage.parseFrom(inputStream);
-
-    String serializedMessageClassName = wireMsg.getName();
-
-    try {
-      RequestTranslator translator = getParserForRequest(serializedMessageClassName);
-
-      // The ByteString should be logical offsets into the original byte array
-      return translator.transform(wireMsg.getWrappedMessage());
-    } catch (RuntimeException e) {
-      if (LOG.isDebugEnabled()) {
-        LOG.debug("Failed to parse request message '{}'", TextFormat.shortDebugString(wireMsg));
-      }
-      throw e;
-    }
-  }
-
-  @Override public Response parseResponse(byte[] bytes) throws IOException {
-    ByteString byteString = UnsafeByteOperations.unsafeWrap(bytes);
-    CodedInputStream inputStream = byteString.newCodedInput();
-    // Enable aliasing to avoid an extra copy to get at the serialized Response inside of the
-    // WireMessage.
-    inputStream.enableAliasing(true);
-    WireMessage wireMsg = WireMessage.parseFrom(inputStream);
-
-    String serializedMessageClassName = wireMsg.getName();
-    try {
-      ResponseTranslator translator = getParserForResponse(serializedMessageClassName);
-
-      return translator.transform(wireMsg.getWrappedMessage());
-    } catch (RuntimeException e) {
-      if (LOG.isDebugEnabled()) {
-        LOG.debug("Failed to parse response message '{}'", TextFormat.shortDebugString(wireMsg));
-      }
-      throw e;
-    }
-  }
-}
-
-// End ProtobufTranslationImpl.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/remote/RemoteMeta.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/RemoteMeta.java b/avatica/core/src/main/java/org/apache/calcite/avatica/remote/RemoteMeta.java
deleted file mode 100644
index 75b9d58..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/RemoteMeta.java
+++ /dev/null
@@ -1,436 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import org.apache.calcite.avatica.AvaticaConnection;
-import org.apache.calcite.avatica.AvaticaConnection.CallableWithoutException;
-import org.apache.calcite.avatica.AvaticaParameter;
-import org.apache.calcite.avatica.AvaticaUtils;
-import org.apache.calcite.avatica.ColumnMetaData;
-import org.apache.calcite.avatica.ConnectionPropertiesImpl;
-import org.apache.calcite.avatica.Meta;
-import org.apache.calcite.avatica.MetaImpl;
-import org.apache.calcite.avatica.MissingResultsException;
-import org.apache.calcite.avatica.NoSuchStatementException;
-import org.apache.calcite.avatica.QueryState;
-
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Implementation of {@link org.apache.calcite.avatica.Meta} for the remote
- * driver.
- */
-class RemoteMeta extends MetaImpl {
-  final Service service;
-  final Map<String, ConnectionPropertiesImpl> propsMap = new HashMap<>();
-  private Map<DatabaseProperty, Object> databaseProperties;
-
-  public RemoteMeta(AvaticaConnection connection, Service service) {
-    super(connection);
-    this.service = service;
-  }
-
-  private MetaResultSet toResultSet(Class clazz,
-      Service.ResultSetResponse response) {
-    if (response.updateCount != -1) {
-      return MetaResultSet.count(response.connectionId, response.statementId,
-          response.updateCount);
-    }
-    Signature signature0 = response.signature;
-    if (signature0 == null) {
-      final List<ColumnMetaData> columns =
-          clazz == null
-              ? Collections.<ColumnMetaData>emptyList()
-              : fieldMetaData(clazz).columns;
-      signature0 = Signature.create(columns,
-          "?", Collections.<AvaticaParameter>emptyList(), CursorFactory.ARRAY,
-          Meta.StatementType.SELECT);
-    }
-    return MetaResultSet.create(response.connectionId, response.statementId,
-        response.ownStatement, signature0, response.firstFrame);
-  }
-
-  @Override public Map<DatabaseProperty, Object> getDatabaseProperties(ConnectionHandle ch) {
-    synchronized (this) {
-      // Compute map on first use, and cache
-      if (databaseProperties == null) {
-        databaseProperties =
-            service.apply(new Service.DatabasePropertyRequest(ch.id)).map;
-      }
-      return databaseProperties;
-    }
-  }
-
-  @Override public StatementHandle createStatement(final ConnectionHandle ch) {
-    return connection.invokeWithRetries(
-        new CallableWithoutException<StatementHandle>() {
-          public StatementHandle call() {
-            // sync connection state if necessary
-            connectionSync(ch, new ConnectionPropertiesImpl());
-            final Service.CreateStatementResponse response =
-                service.apply(new Service.CreateStatementRequest(ch.id));
-            return new StatementHandle(response.connectionId, response.statementId, null);
-          }
-        });
-  }
-
-  @Override public void closeStatement(final StatementHandle h) {
-    connection.invokeWithRetries(
-        new CallableWithoutException<Void>() {
-          public Void call() {
-            final Service.CloseStatementResponse response =
-                service.apply(
-                    new Service.CloseStatementRequest(h.connectionId, h.id));
-            return null;
-          }
-        });
-  }
-
-  @Override public void openConnection(final ConnectionHandle ch, final Map<String, String> info) {
-    connection.invokeWithRetries(
-        new CallableWithoutException<Void>() {
-          public Void call() {
-            final Service.OpenConnectionResponse response =
-                service.apply(new Service.OpenConnectionRequest(ch.id, info));
-            return null;
-          }
-        });
-  }
-
-  @Override public void closeConnection(final ConnectionHandle ch) {
-    connection.invokeWithRetries(
-        new CallableWithoutException<Void>() {
-          public Void call() {
-            final Service.CloseConnectionResponse response =
-                service.apply(new Service.CloseConnectionRequest(ch.id));
-            propsMap.remove(ch.id);
-            return null;
-          }
-        });
-  }
-
-  @Override public ConnectionProperties connectionSync(final ConnectionHandle ch,
-      final ConnectionProperties connProps) {
-    return connection.invokeWithRetries(
-        new CallableWithoutException<ConnectionProperties>() {
-          public ConnectionProperties call() {
-            ConnectionPropertiesImpl localProps = propsMap.get(ch.id);
-            if (localProps == null) {
-              localProps = new ConnectionPropertiesImpl();
-              localProps.setDirty(true);
-              propsMap.put(ch.id, localProps);
-            }
-
-            // Only make an RPC if necessary. RPC is necessary when we have local changes that need
-            // flushed to the server (be sure to introduce any new changes from connProps before
-            // checking AND when connProps.isEmpty() (meaning, this was a request for a value, not
-            // overriding a value). Otherwise, accumulate the change locally and return immediately.
-            if (localProps.merge(connProps).isDirty() && connProps.isEmpty()) {
-              final Service.ConnectionSyncResponse response = service.apply(
-                  new Service.ConnectionSyncRequest(ch.id, localProps));
-              propsMap.put(ch.id, (ConnectionPropertiesImpl) response.connProps);
-              return response.connProps;
-            } else {
-              return localProps;
-            }
-          }
-        });
-  }
-
-  @Override public MetaResultSet getCatalogs(final ConnectionHandle ch) {
-    return connection.invokeWithRetries(
-        new CallableWithoutException<MetaResultSet>() {
-          public MetaResultSet call() {
-            final Service.ResultSetResponse response =
-                service.apply(new Service.CatalogsRequest(ch.id));
-            return toResultSet(MetaCatalog.class, response);
-          }
-        });
-  }
-
-  @Override public MetaResultSet getSchemas(final ConnectionHandle ch, final String catalog,
-      final Pat schemaPattern) {
-    return connection.invokeWithRetries(
-        new CallableWithoutException<MetaResultSet>() {
-          public MetaResultSet call() {
-            final Service.ResultSetResponse response =
-                service.apply(
-                    new Service.SchemasRequest(ch.id, catalog, schemaPattern.s));
-            return toResultSet(MetaSchema.class, response);
-          }
-        });
-  }
-
-  @Override public MetaResultSet getTables(final ConnectionHandle ch, final String catalog,
-      final Pat schemaPattern, final Pat tableNamePattern, final List<String> typeList) {
-    return connection.invokeWithRetries(
-        new CallableWithoutException<MetaResultSet>() {
-          public MetaResultSet call() {
-            final Service.ResultSetResponse response =
-                service.apply(
-                    new Service.TablesRequest(ch.id, catalog, schemaPattern.s,
-                        tableNamePattern.s, typeList));
-            return toResultSet(MetaTable.class, response);
-          }
-        });
-  }
-
-  @Override public MetaResultSet getTableTypes(final ConnectionHandle ch) {
-    return connection.invokeWithRetries(
-        new CallableWithoutException<MetaResultSet>() {
-          public MetaResultSet call() {
-            final Service.ResultSetResponse response =
-                service.apply(new Service.TableTypesRequest(ch.id));
-            return toResultSet(MetaTableType.class, response);
-          }
-        });
-  }
-
-  @Override public MetaResultSet getTypeInfo(final ConnectionHandle ch) {
-    return connection.invokeWithRetries(
-        new CallableWithoutException<MetaResultSet>() {
-          public MetaResultSet call() {
-            final Service.ResultSetResponse response =
-                service.apply(new Service.TypeInfoRequest(ch.id));
-            return toResultSet(MetaTypeInfo.class, response);
-          }
-        });
-  }
-
-  @Override public MetaResultSet getColumns(final ConnectionHandle ch, final String catalog,
-      final Pat schemaPattern, final Pat tableNamePattern, final Pat columnNamePattern) {
-    return connection.invokeWithRetries(
-        new CallableWithoutException<MetaResultSet>() {
-          public MetaResultSet call() {
-            final Service.ResultSetResponse response =
-                service.apply(
-                    new Service.ColumnsRequest(ch.id, catalog, schemaPattern.s,
-                        tableNamePattern.s, columnNamePattern.s));
-            return toResultSet(MetaColumn.class, response);
-          }
-        });
-  }
-
-  @Override public StatementHandle prepare(final ConnectionHandle ch, final String sql,
-      final long maxRowCount) {
-    return connection.invokeWithRetries(
-        new CallableWithoutException<StatementHandle>() {
-          public StatementHandle call() {
-            connectionSync(ch,
-                new ConnectionPropertiesImpl()); // sync connection state if necessary
-            final Service.PrepareResponse response = service.apply(
-                new Service.PrepareRequest(ch.id, sql, maxRowCount));
-            return response.statement;
-          }
-        });
-  }
-
-  @SuppressWarnings("deprecation")
-  @Override public ExecuteResult prepareAndExecute(StatementHandle h, String sql, long maxRowCount,
-      PrepareCallback callback) throws NoSuchStatementException {
-    // The old semantics were that maxRowCount was also treated as the maximum number of
-    // elements in the first Frame of results. A value of -1 would also preserve this, but an
-    // explicit (positive) number is easier to follow, IMO.
-    return prepareAndExecute(h, sql, maxRowCount, AvaticaUtils.toSaturatedInt(maxRowCount),
-        callback);
-  }
-
-  @Override public ExecuteResult prepareAndExecute(final StatementHandle h, final String sql,
-      final long maxRowCount, int maxRowsInFirstFrame, final PrepareCallback callback)
-      throws NoSuchStatementException {
-    try {
-      return connection.invokeWithRetries(
-          new CallableWithoutException<ExecuteResult>() {
-            public ExecuteResult call() {
-              // sync connection state if necessary
-              connectionSync(new ConnectionHandle(h.connectionId), new ConnectionPropertiesImpl());
-              final Service.ExecuteResponse response;
-              try {
-                synchronized (callback.getMonitor()) {
-                  callback.clear();
-                  response = service.apply(
-                      new Service.PrepareAndExecuteRequest(h.connectionId,
-                          h.id, sql, maxRowCount));
-                  if (response.missingStatement) {
-                    throw new RuntimeException(new NoSuchStatementException(h));
-                  }
-                  if (response.results.size() > 0) {
-                    final Service.ResultSetResponse result = response.results.get(0);
-                    callback.assign(result.signature, result.firstFrame,
-                        result.updateCount);
-                  }
-                }
-                callback.execute();
-                List<MetaResultSet> metaResultSets = new ArrayList<>();
-                for (Service.ResultSetResponse result : response.results) {
-                  metaResultSets.add(toResultSet(null, result));
-                }
-                return new ExecuteResult(metaResultSets);
-              } catch (SQLException e) {
-                throw new RuntimeException(e);
-              }
-            }
-          });
-    } catch (RuntimeException e) {
-      Throwable cause = e.getCause();
-      if (cause instanceof NoSuchStatementException) {
-        throw (NoSuchStatementException) cause;
-      }
-      throw e;
-    }
-  }
-
-  @Override public Frame fetch(final StatementHandle h, final long offset,
-      final int fetchMaxRowCount) throws NoSuchStatementException, MissingResultsException {
-    try {
-      return connection.invokeWithRetries(
-          new CallableWithoutException<Frame>() {
-            public Frame call() {
-              final Service.FetchResponse response =
-                  service.apply(
-                      new Service.FetchRequest(h.connectionId, h.id, offset, fetchMaxRowCount));
-              if (response.missingStatement) {
-                throw new RuntimeException(new NoSuchStatementException(h));
-              }
-              if (response.missingResults) {
-                throw new RuntimeException(new MissingResultsException(h));
-              }
-              return response.frame;
-            }
-          });
-    } catch (RuntimeException e) {
-      Throwable cause = e.getCause();
-      if (cause instanceof NoSuchStatementException) {
-        throw (NoSuchStatementException) cause;
-      } else if (cause instanceof MissingResultsException) {
-        throw (MissingResultsException) cause;
-      }
-      throw e;
-    }
-  }
-
-  @SuppressWarnings("deprecation")
-  @Override public ExecuteResult execute(StatementHandle h, List<TypedValue> parameterValues,
-      long maxRowCount) throws NoSuchStatementException {
-    return execute(h, parameterValues, AvaticaUtils.toSaturatedInt(maxRowCount));
-  }
-
-  @Override public ExecuteResult execute(final StatementHandle h,
-      final List<TypedValue> parameterValues, final int maxRowsInFirstFrame)
-      throws NoSuchStatementException {
-    try {
-      return connection.invokeWithRetries(
-          new CallableWithoutException<ExecuteResult>() {
-            public ExecuteResult call() {
-              final Service.ExecuteResponse response = service.apply(
-                  new Service.ExecuteRequest(h, parameterValues, maxRowsInFirstFrame));
-
-              if (response.missingStatement) {
-                throw new RuntimeException(new NoSuchStatementException(h));
-              }
-
-              List<MetaResultSet> metaResultSets = new ArrayList<>();
-              for (Service.ResultSetResponse result : response.results) {
-                metaResultSets.add(toResultSet(null, result));
-              }
-
-              return new ExecuteResult(metaResultSets);
-            }
-          });
-    } catch (RuntimeException e) {
-      Throwable cause = e.getCause();
-      if (cause instanceof NoSuchStatementException) {
-        throw (NoSuchStatementException) cause;
-      }
-      throw e;
-    }
-  }
-
-  @Override public boolean syncResults(final StatementHandle h, final QueryState state,
-      final long offset) throws NoSuchStatementException {
-    try {
-      return connection.invokeWithRetries(
-          new CallableWithoutException<Boolean>() {
-            public Boolean call() {
-              final Service.SyncResultsResponse response =
-                  service.apply(
-                      new Service.SyncResultsRequest(h.connectionId, h.id, state, offset));
-              if (response.missingStatement) {
-                throw new RuntimeException(new NoSuchStatementException(h));
-              }
-              return response.moreResults;
-            }
-          });
-    } catch (RuntimeException e) {
-      Throwable cause = e.getCause();
-      if (cause instanceof NoSuchStatementException) {
-        throw (NoSuchStatementException) cause;
-      }
-      throw e;
-    }
-  }
-
-  @Override public void commit(final ConnectionHandle ch) {
-    connection.invokeWithRetries(new CallableWithoutException<Void>() {
-      public Void call() {
-        final Service.CommitResponse response =
-            service.apply(new Service.CommitRequest(ch.id));
-        return null;
-      }
-    });
-  }
-
-  @Override public void rollback(final ConnectionHandle ch) {
-    connection.invokeWithRetries(new CallableWithoutException<Void>() {
-      public Void call() {
-        final Service.RollbackResponse response =
-            service.apply(new Service.RollbackRequest(ch.id));
-        return null;
-      }
-    });
-  }
-
-  @Override public ExecuteBatchResult prepareAndExecuteBatch(final StatementHandle h,
-      final List<String> sqlCommands) throws NoSuchStatementException {
-    return connection.invokeWithRetries(new CallableWithoutException<ExecuteBatchResult>() {
-      @Override public ExecuteBatchResult call() {
-        Service.ExecuteBatchResponse response =
-            service.apply(
-                new Service.PrepareAndExecuteBatchRequest(h.connectionId, h.id, sqlCommands));
-        return new ExecuteBatchResult(response.updateCounts);
-      }
-    });
-  }
-
-  @Override public ExecuteBatchResult executeBatch(final StatementHandle h,
-      final List<List<TypedValue>> parameterValues) throws NoSuchStatementException {
-    return connection.invokeWithRetries(new CallableWithoutException<ExecuteBatchResult>() {
-      @Override public ExecuteBatchResult call() {
-        Service.ExecuteBatchResponse response =
-            service.apply(new Service.ExecuteBatchRequest(h.connectionId, h.id, parameterValues));
-        return new ExecuteBatchResult(response.updateCounts);
-      }
-    });
-  }
-}
-
-// End RemoteMeta.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/remote/RemoteProtobufService.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/RemoteProtobufService.java b/avatica/core/src/main/java/org/apache/calcite/avatica/remote/RemoteProtobufService.java
deleted file mode 100644
index 0f4cbfb..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/RemoteProtobufService.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.nio.charset.StandardCharsets;
-
-
-/**
- * ProtobufService implementation that queries against a remote implementation, using
- * protocol buffers as the serialized form.
- */
-public class RemoteProtobufService extends ProtobufService {
-  private static final Logger LOG = LoggerFactory.getLogger(RemoteProtobufService.class);
-
-  private final AvaticaHttpClient client;
-  private final ProtobufTranslation translation;
-
-  public RemoteProtobufService(AvaticaHttpClient client, ProtobufTranslation translation) {
-    this.client = client;
-    this.translation = translation;
-  }
-
-  @Override public Response _apply(Request request) {
-    final Response resp;
-    byte[] response = null;
-    try {
-      response = client.send(translation.serializeRequest(request));
-    } catch (IOException e) {
-      LOG.debug("Failed to execute remote request: {}", request);
-      // Failed to get a response from the server for the request.
-      throw new RuntimeException(e);
-    }
-
-    try {
-      resp = translation.parseResponse(response);
-    } catch (IOException e) {
-      LOG.debug("Failed to deserialize reponse to {}. '{}'", request,
-          new String(response, StandardCharsets.UTF_8));
-      // Not a protobuf that we could parse.
-      throw new RuntimeException(e);
-    }
-
-    // The server had an error, throw an Exception for that.
-    if (resp instanceof ErrorResponse) {
-      throw ((ErrorResponse) resp).toException();
-    }
-
-    return resp;
-  }
-}
-
-// End RemoteProtobufService.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/remote/RemoteService.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/RemoteService.java b/avatica/core/src/main/java/org/apache/calcite/avatica/remote/RemoteService.java
deleted file mode 100644
index d4828b5..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/RemoteService.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import java.nio.charset.StandardCharsets;
-
-/**
- * Implementation of {@link org.apache.calcite.avatica.remote.Service}
- * that translates requests into JSON and sends them to a remote server,
- * usually an HTTP server.
- */
-public class RemoteService extends JsonService {
-  private final AvaticaHttpClient client;
-
-  public RemoteService(AvaticaHttpClient client) {
-    this.client = client;
-  }
-
-  @Override public String apply(String request) {
-    byte[] response = client.send(request.getBytes(StandardCharsets.UTF_8));
-    return new String(response, StandardCharsets.UTF_8);
-  }
-}
-
-// End RemoteService.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/remote/RequestTranslator.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/RequestTranslator.java b/avatica/core/src/main/java/org/apache/calcite/avatica/remote/RequestTranslator.java
deleted file mode 100644
index 417c6ed..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/RequestTranslator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import com.google.protobuf.ByteString;
-import com.google.protobuf.InvalidProtocolBufferException;
-import com.google.protobuf.Message;
-import com.google.protobuf.Parser;
-
-/**
- * Encapsulate the logic of transforming a protobuf Request message into the Avatica POJO request.
- */
-public class RequestTranslator {
-
-  private final Parser<? extends Message> parser;
-  private final Service.Request impl;
-
-  public RequestTranslator(Parser<? extends Message> parser, Service.Request impl) {
-    this.parser = parser;
-    this.impl = impl;
-  }
-
-  public Service.Request transform(ByteString serializedMessage) throws
-      InvalidProtocolBufferException {
-    // This should already be an aliased CodedInputStream from the WireMessage parsing.
-    Message msg = parser.parseFrom(serializedMessage.newCodedInput());
-    return impl.deserialize(msg);
-  }
-}
-
-// End RequestTranslator.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/remote/ResponseTranslator.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/ResponseTranslator.java b/avatica/core/src/main/java/org/apache/calcite/avatica/remote/ResponseTranslator.java
deleted file mode 100644
index 0311e13..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/ResponseTranslator.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import com.google.protobuf.ByteString;
-import com.google.protobuf.InvalidProtocolBufferException;
-import com.google.protobuf.Message;
-import com.google.protobuf.Parser;
-
-/**
- * Encapsulate the logic of transforming a protobuf Response message into the Avatica POJO Response.
- */
-public class ResponseTranslator {
-
-  private final Parser<? extends Message> parser;
-  private final Service.Response impl;
-
-  public ResponseTranslator(Parser<? extends Message> parser, Service.Response impl) {
-    this.parser = parser;
-    this.impl = impl;
-  }
-
-  public Service.Response transform(ByteString serializedMessage) throws
-      InvalidProtocolBufferException {
-    Message msg = parser.parseFrom(serializedMessage);
-    return impl.deserialize(msg);
-  }
-}
-
-// End ResponseTranslator.java


[30/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/test/java/org/apache/calcite/avatica/remote/KerberosConnectionTest.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/test/java/org/apache/calcite/avatica/remote/KerberosConnectionTest.java b/avatica/core/src/test/java/org/apache/calcite/avatica/remote/KerberosConnectionTest.java
deleted file mode 100644
index ad98569..0000000
--- a/avatica/core/src/test/java/org/apache/calcite/avatica/remote/KerberosConnectionTest.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import org.apache.calcite.avatica.remote.KerberosConnection.RenewalTask;
-
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import java.io.File;
-import java.util.Locale;
-import java.util.Map.Entry;
-
-import javax.security.auth.Subject;
-import javax.security.auth.login.Configuration;
-import javax.security.auth.login.LoginContext;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.nullable;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-/**
- * Test case for KerberosConnection
- */
-public class KerberosConnectionTest {
-
-  @Test(expected = NullPointerException.class) public void testNullArgs() {
-    new KerberosConnection(null, null);
-  }
-
-  @Test public void testThreadConfiguration() {
-    KerberosConnection krbUtil = new KerberosConnection("foo", new File("/bar.keytab"));
-    Subject subject = new Subject();
-    LoginContext context = Mockito.mock(LoginContext.class);
-
-    Entry<RenewalTask, Thread> entry = krbUtil.createRenewalThread(context, subject, 10);
-    assertNotNull("RenewalTask should not be null", entry.getKey());
-    Thread t = entry.getValue();
-    assertTrue("Thread name should contain 'Avatica', but is '" + t.getName() + "'",
-        t.getName().contains("Avatica"));
-    assertTrue(t.isDaemon());
-    assertNotNull(t.getUncaughtExceptionHandler());
-  }
-
-  @Test public void noPreviousContextOnLogin() throws Exception {
-    KerberosConnection krbUtil = mock(KerberosConnection.class);
-    Subject subject = new Subject();
-    Subject loggedInSubject = new Subject();
-    Configuration conf = mock(Configuration.class);
-    LoginContext context = mock(LoginContext.class);
-
-    // Call the real login(LoginContext, Configuration, Subject) method
-    when(krbUtil.login(nullable(LoginContext.class), any(Configuration.class), any(Subject.class)))
-        .thenCallRealMethod();
-    // Return a fake LoginContext
-    when(krbUtil.createLoginContext(conf)).thenReturn(context);
-    // Return a fake Subject from that fake LoginContext
-    when(context.getSubject()).thenReturn(loggedInSubject);
-
-    Entry<LoginContext, Subject> pair = krbUtil.login(null, conf, subject);
-
-    // Verify we get the fake LoginContext and Subject
-    assertEquals(context, pair.getKey());
-    assertEquals(loggedInSubject, pair.getValue());
-
-    // login should be called on the LoginContext
-    verify(context).login();
-  }
-
-  @Test public void previousContextLoggedOut() throws Exception {
-    KerberosConnection krbUtil = mock(KerberosConnection.class);
-    Subject subject = new Subject();
-    Subject loggedInSubject = new Subject();
-    Configuration conf = mock(Configuration.class);
-    LoginContext originalContext = mock(LoginContext.class);
-    LoginContext context = mock(LoginContext.class);
-
-    // Call the real login(LoginContext, Configuration, Subject) method
-    when(krbUtil.login(any(LoginContext.class), any(Configuration.class), any(Subject.class)))
-        .thenCallRealMethod();
-    // Return a fake LoginContext
-    when(krbUtil.createLoginContext(conf)).thenReturn(context);
-    // Return a fake Subject from that fake LoginContext
-    when(context.getSubject()).thenReturn(loggedInSubject);
-
-    Entry<LoginContext, Subject> pair = krbUtil.login(originalContext, conf, subject);
-
-    // Verify we get the fake LoginContext and Subject
-    assertEquals(context, pair.getKey());
-    assertEquals(loggedInSubject, pair.getValue());
-
-    verify(originalContext).logout();
-
-    // login should be called on the LoginContext
-    verify(context).login();
-  }
-
-  @Test public void testTicketRenewalTime() {
-    RenewalTask renewal = mock(RenewalTask.class);
-    when(renewal.shouldRenew(any(long.class), any(long.class), any(long.class)))
-        .thenCallRealMethod();
-
-    long start = 0;
-    long end = 200;
-    long now = 100;
-    assertFalse(renewal.shouldRenew(start, end, now));
-
-    // Renewal should happen at 80%
-    start = 0;
-    end = 100;
-    now = 80;
-    assertTrue(renewal.shouldRenew(start, end, now));
-
-    start = 5000;
-    // One day
-    end = start + 1000 * 60 * 60 * 24;
-    // Ten minutes prior to expiration
-    now = end - 1000 * 60 * 10;
-    assertTrue(
-        String.format(Locale.ROOT, "start=%d, end=%d, now=%d", start, end, now),
-        renewal.shouldRenew(start, end, now));
-  }
-}
-
-// End KerberosConnectionTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/test/java/org/apache/calcite/avatica/remote/MetaDataOperationTest.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/test/java/org/apache/calcite/avatica/remote/MetaDataOperationTest.java b/avatica/core/src/test/java/org/apache/calcite/avatica/remote/MetaDataOperationTest.java
deleted file mode 100644
index c64b32c..0000000
--- a/avatica/core/src/test/java/org/apache/calcite/avatica/remote/MetaDataOperationTest.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * Tests for {@link MetaDataOperation}
- */
-public class MetaDataOperationTest {
-
-  @Test
-  public void testProtobufSerialization() {
-    for (MetaDataOperation metadataOp : MetaDataOperation.values()) {
-      assertEquals(metadataOp, MetaDataOperation.fromProto(metadataOp.toProto()));
-    }
-  }
-
-}
-
-// End MetaDataOperationTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/test/java/org/apache/calcite/avatica/remote/ProtobufHandlerTest.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/test/java/org/apache/calcite/avatica/remote/ProtobufHandlerTest.java b/avatica/core/src/test/java/org/apache/calcite/avatica/remote/ProtobufHandlerTest.java
deleted file mode 100644
index afb15c3..0000000
--- a/avatica/core/src/test/java/org/apache/calcite/avatica/remote/ProtobufHandlerTest.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import org.apache.calcite.avatica.Meta;
-import org.apache.calcite.avatica.Meta.Frame;
-import org.apache.calcite.avatica.metrics.noop.NoopMetricsSystem;
-import org.apache.calcite.avatica.proto.Common;
-import org.apache.calcite.avatica.proto.Common.ColumnValue;
-import org.apache.calcite.avatica.proto.Requests;
-import org.apache.calcite.avatica.proto.Responses;
-import org.apache.calcite.avatica.remote.Handler.HandlerResponse;
-import org.apache.calcite.avatica.remote.Service.FetchRequest;
-import org.apache.calcite.avatica.remote.Service.FetchResponse;
-import org.apache.calcite.avatica.remote.Service.RpcMetadataResponse;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.when;
-
-/**
- * Test basic serialization of objects with protocol buffers.
- */
-public class ProtobufHandlerTest {
-
-  // Mocks
-  private Service service;
-  private ProtobufTranslation translation;
-
-  // Real objects
-  private ProtobufHandler handler;
-
-  @Before
-  public void setupMocks() {
-    // Mocks
-    service = Mockito.mock(Service.class);
-    translation = Mockito.mock(ProtobufTranslation.class);
-
-    // Real objects
-    handler = new ProtobufHandler(service, translation, NoopMetricsSystem.getInstance());
-  }
-
-  @Test
-  public void testFetch() throws Exception {
-    final String connectionId = "cnxn1";
-    final int statementId = 30;
-    final long offset = 10;
-    final int fetchMaxRowCount = 100;
-    final List<Common.TypedValue> values = new ArrayList<>();
-
-    values.add(Common.TypedValue.newBuilder().setType(Common.Rep.BOOLEAN).setBoolValue(true)
-        .build());
-    values.add(Common.TypedValue.newBuilder().setType(Common.Rep.STRING)
-        .setStringValue("my_string").build());
-
-    Requests.FetchRequest protoRequest = Requests.FetchRequest.newBuilder()
-        .setConnectionId(connectionId).setStatementId(statementId)
-        .setOffset(offset).setFetchMaxRowCount(fetchMaxRowCount)
-        .build();
-    byte[] serializedRequest = protoRequest.toByteArray();
-
-    FetchRequest request = new FetchRequest().deserialize(protoRequest);
-
-    List<Object> frameRows = new ArrayList<>();
-    frameRows.add(new Object[] {true, "my_string"});
-
-    Meta.Frame frame = Frame.create(0, true, frameRows);
-    RpcMetadataResponse metadata = new RpcMetadataResponse("localhost:8765");
-    FetchResponse response = new FetchResponse(frame, false, false, metadata);
-
-    when(translation.parseRequest(serializedRequest)).thenReturn(request);
-    when(service.apply(request)).thenReturn(response);
-    when(translation.serializeResponse(response))
-        .thenReturn(response.serialize().toByteArray());
-
-    HandlerResponse<byte[]> handlerResponse = handler.apply(serializedRequest);
-    byte[] serializedResponse = handlerResponse.getResponse();
-    assertEquals(200, handlerResponse.getStatusCode());
-
-    Responses.FetchResponse protoResponse = Responses.FetchResponse.parseFrom(serializedResponse);
-
-    Common.Frame protoFrame = protoResponse.getFrame();
-
-    assertEquals(frame.offset, protoFrame.getOffset());
-    assertEquals(frame.done, protoFrame.getDone());
-
-    List<Common.Row> rows = protoFrame.getRowsList();
-    assertEquals(1, rows.size());
-    Common.Row row = rows.get(0);
-    List<Common.ColumnValue> columnValues = row.getValueList();
-    assertEquals(2, columnValues.size());
-
-    Iterator<Common.ColumnValue> iter = columnValues.iterator();
-    assertTrue(iter.hasNext());
-    Common.ColumnValue column = iter.next();
-    assertTrue("The Column should have contained a scalar: " + column,
-        column.hasField(ColumnValue.getDescriptor()
-            .findFieldByNumber(ColumnValue.SCALAR_VALUE_FIELD_NUMBER)));
-
-    Common.TypedValue value = column.getScalarValue();
-    assertEquals(Common.Rep.BOOLEAN, value.getType());
-    assertEquals(true, value.getBoolValue());
-
-    assertTrue(iter.hasNext());
-    column = iter.next();
-    assertTrue("The Column should have contained a scalar: " + column,
-        column.hasField(ColumnValue.getDescriptor()
-            .findFieldByNumber(ColumnValue.SCALAR_VALUE_FIELD_NUMBER)));
-    value = column.getScalarValue();
-    assertEquals(Common.Rep.STRING, value.getType());
-    assertEquals("my_string", value.getStringValue());
-  }
-
-}
-
-// End ProtobufHandlerTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/test/java/org/apache/calcite/avatica/remote/ProtobufSerializationTest.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/test/java/org/apache/calcite/avatica/remote/ProtobufSerializationTest.java b/avatica/core/src/test/java/org/apache/calcite/avatica/remote/ProtobufSerializationTest.java
deleted file mode 100644
index 39787dd..0000000
--- a/avatica/core/src/test/java/org/apache/calcite/avatica/remote/ProtobufSerializationTest.java
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import org.apache.calcite.avatica.AvaticaUtils;
-import org.apache.calcite.avatica.ColumnMetaData.Rep;
-import org.apache.calcite.avatica.Meta.Signature;
-import org.apache.calcite.avatica.Meta.StatementHandle;
-import org.apache.calcite.avatica.proto.Common.WireMessage;
-import org.apache.calcite.avatica.proto.Requests;
-import org.apache.calcite.avatica.remote.Service.Request;
-
-import com.google.protobuf.UnsafeByteOperations;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.io.ByteArrayOutputStream;
-import java.util.Arrays;
-import java.util.List;
-import java.util.UUID;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * Protobuf serialization tests.
- */
-public class ProtobufSerializationTest {
-
-  private Signature getSignature() {
-    return null;
-  }
-
-  private List<TypedValue> getTypedValues() {
-    List<TypedValue> paramValues =
-        Arrays.asList(TypedValue.create(Rep.BOOLEAN.name(), Boolean.TRUE),
-            TypedValue.create(Rep.STRING.name(), "string"));
-    return paramValues;
-  }
-
-  @Test public void testExecuteSerialization() throws Exception {
-    Service.ExecuteRequest executeRequest = new Service.ExecuteRequest(
-        new StatementHandle("connection", 12345, getSignature()), getTypedValues(), 0);
-
-    Requests.ExecuteRequest pbExecuteRequest = executeRequest.serialize();
-    ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
-    pbExecuteRequest.writeTo(baos);
-
-    byte[] serialized = baos.toByteArray();
-    baos.reset();
-    WireMessage wireMsg = WireMessage.newBuilder().setName(Requests.ExecuteRequest.class.getName())
-        .setWrappedMessage(UnsafeByteOperations.unsafeWrap(serialized)).build();
-    wireMsg.writeTo(baos);
-    serialized = baos.toByteArray();
-
-    ProtobufTranslation translator = new ProtobufTranslationImpl();
-
-    Request newRequest = translator.parseRequest(serialized);
-
-    Assert.assertEquals(executeRequest, newRequest);
-  }
-
-  @Test public void testPrepareSerialization() throws Exception {
-    final String sql = "SELECT * FROM FOO";
-    final String connectionId = UUID.randomUUID().toString();
-
-    for (long maxRowCount : Arrays.asList(-1L, 0L, 1L, Long.MAX_VALUE)) {
-      Service.PrepareRequest prepareReq = new Service.PrepareRequest(connectionId, sql,
-          maxRowCount);
-
-      Requests.PrepareRequest prepareProtoReq = prepareReq.serialize();
-      assertEquals(maxRowCount, prepareProtoReq.getMaxRowCount());
-      assertEquals(maxRowCount, prepareProtoReq.getMaxRowsTotal());
-
-      assertEquals(prepareReq, prepareReq.deserialize(prepareProtoReq));
-    }
-  }
-
-  @Test public void testPrepareDeserialization() throws Exception {
-    final String sql = "SELECT * FROM FOO";
-    final String connectionId = UUID.randomUUID().toString();
-    final long maxRowCount = 200L;
-
-    // The "current" serialization strategy.
-    Requests.PrepareRequest protoPrepare = Requests.PrepareRequest.newBuilder().
-        setConnectionId(connectionId).setSql(sql).setMaxRowsTotal(maxRowCount).build();
-
-    Service.PrepareRequest prepareReq = new Service.PrepareRequest().deserialize(protoPrepare);
-    assertEquals(maxRowCount, prepareReq.maxRowCount);
-
-    // The "old" serialization strategy.
-    protoPrepare = Requests.PrepareRequest.newBuilder().
-        setConnectionId(connectionId).setSql(sql).setMaxRowCount(maxRowCount).build();
-
-    prepareReq = new Service.PrepareRequest().deserialize(protoPrepare);
-    assertEquals(maxRowCount, prepareReq.maxRowCount);
-
-    // Both the new and old provided should default to the new
-    protoPrepare = Requests.PrepareRequest.newBuilder().
-        setConnectionId(connectionId).setSql(sql).setMaxRowCount(500L)
-        .setMaxRowsTotal(maxRowCount).build();
-
-    prepareReq = new Service.PrepareRequest().deserialize(protoPrepare);
-    assertEquals(maxRowCount, prepareReq.maxRowCount);
-  }
-
-  @Test public void testPrepareAndExecuteSerialization() throws Exception {
-    final String sql = "SELECT * FROM FOO";
-    final int statementId = 12345;
-    final String connectionId = UUID.randomUUID().toString();
-
-    for (long maxRowCount : Arrays.asList(-1L, 0L, 1L, Long.MAX_VALUE)) {
-      Service.PrepareAndExecuteRequest prepareAndExecuteReq =
-          new Service.PrepareAndExecuteRequest(connectionId, statementId, sql, maxRowCount);
-
-      Requests.PrepareAndExecuteRequest prepareAndExecuteProtoReq =
-          prepareAndExecuteReq.serialize();
-      assertEquals(maxRowCount, prepareAndExecuteProtoReq.getMaxRowCount());
-      assertEquals(maxRowCount, prepareAndExecuteProtoReq.getMaxRowsTotal());
-      assertEquals(AvaticaUtils.toSaturatedInt(maxRowCount),
-          prepareAndExecuteProtoReq.getFirstFrameMaxSize());
-
-      assertEquals(prepareAndExecuteReq,
-          prepareAndExecuteReq.deserialize(prepareAndExecuteProtoReq));
-    }
-
-    int maxRowsInFirstFrame = 50;
-    for (long maxRowCount : Arrays.asList(-1L, 0L, 1L, Long.MAX_VALUE)) {
-      Service.PrepareAndExecuteRequest prepareAndExecuteReq =
-          new Service.PrepareAndExecuteRequest(connectionId, statementId, sql, maxRowCount,
-              maxRowsInFirstFrame);
-
-      Requests.PrepareAndExecuteRequest prepareAndExecuteProtoReq =
-          prepareAndExecuteReq.serialize();
-      assertEquals(maxRowCount, prepareAndExecuteProtoReq.getMaxRowCount());
-      assertEquals(maxRowCount, prepareAndExecuteProtoReq.getMaxRowsTotal());
-      assertEquals(maxRowsInFirstFrame, prepareAndExecuteProtoReq.getFirstFrameMaxSize());
-
-      assertEquals(prepareAndExecuteReq,
-          prepareAndExecuteReq.deserialize(prepareAndExecuteProtoReq));
-    }
-  }
-
-  @Test public void testPrepareAndExecuteDeserialization() throws Exception {
-    final String sql = "SELECT * FROM FOO";
-    final String connectionId = UUID.randomUUID().toString();
-    final long maxRowCount = 200L;
-    final int maxRowsInFirstFrame = 50;
-
-    // The "current" serialization strategy (maxRowsTotal and firstFrameMaxSize)
-    Requests.PrepareAndExecuteRequest protoPrepare = Requests.PrepareAndExecuteRequest.newBuilder().
-        setConnectionId(connectionId).setSql(sql).setMaxRowsTotal(maxRowCount).
-        setFirstFrameMaxSize(maxRowsInFirstFrame).build();
-
-    Service.PrepareAndExecuteRequest prepareAndExecuteReq = new Service.PrepareAndExecuteRequest().
-        deserialize(protoPrepare);
-    assertEquals(maxRowCount, prepareAndExecuteReq.maxRowCount);
-    assertEquals(maxRowsInFirstFrame, prepareAndExecuteReq.maxRowsInFirstFrame);
-
-    // The "old" serialization strategy (maxRowCount)
-    protoPrepare = Requests.PrepareAndExecuteRequest.newBuilder().
-        setConnectionId(connectionId).setSql(sql).setMaxRowCount(maxRowCount).build();
-
-    prepareAndExecuteReq = new Service.PrepareAndExecuteRequest().deserialize(protoPrepare);
-    assertEquals(maxRowCount, prepareAndExecuteReq.maxRowCount);
-    assertEquals(AvaticaUtils.toSaturatedInt(maxRowCount),
-        prepareAndExecuteReq.maxRowsInFirstFrame);
-
-    // Both the new and old provided should default to the new (firstFrameMaxSize should be the
-    // the same as what ultimately is set to maxRowCount)
-    protoPrepare = Requests.PrepareAndExecuteRequest.newBuilder().
-        setConnectionId(connectionId).setSql(sql).setMaxRowCount(500L)
-        .setMaxRowsTotal(maxRowCount).build();
-
-    prepareAndExecuteReq = new Service.PrepareAndExecuteRequest().deserialize(protoPrepare);
-    assertEquals(maxRowCount, prepareAndExecuteReq.maxRowCount);
-    assertEquals(AvaticaUtils.toSaturatedInt(maxRowCount),
-        prepareAndExecuteReq.maxRowsInFirstFrame);
-
-    // Same as previous example, but explicitly setting maxRowsInFirstFrame too
-    protoPrepare = Requests.PrepareAndExecuteRequest.newBuilder().
-        setConnectionId(connectionId).setSql(sql).setMaxRowCount(500L)
-        .setMaxRowsTotal(maxRowCount).setFirstFrameMaxSize(maxRowsInFirstFrame).build();
-
-    prepareAndExecuteReq = new Service.PrepareAndExecuteRequest().deserialize(protoPrepare);
-    assertEquals(maxRowCount, prepareAndExecuteReq.maxRowCount);
-    assertEquals(maxRowsInFirstFrame, prepareAndExecuteReq.maxRowsInFirstFrame);
-  }
-
-  @Test public void testFetchRequestSerialization() throws Exception {
-    final String connectionId = UUID.randomUUID().toString();
-    final int statementId = 12345;
-    final long offset = 0L;
-
-    for (int maxRowCount : Arrays.asList(-1, 0, 1, Integer.MAX_VALUE)) {
-      Service.FetchRequest fetchReq = new Service.FetchRequest(connectionId, statementId,
-          offset, maxRowCount);
-
-      Requests.FetchRequest fetchProtoReq = fetchReq.serialize();
-      assertEquals(maxRowCount, fetchProtoReq.getFetchMaxRowCount());
-      assertEquals(maxRowCount, fetchProtoReq.getFrameMaxSize());
-
-      assertEquals(fetchReq, fetchReq.deserialize(fetchProtoReq));
-    }
-  }
-
-  @Test public void testFetchRequestDeserialization() throws Exception {
-    final String connectionId = UUID.randomUUID().toString();
-    final int statementId = 12345;
-    final long offset = 0L;
-    final int maxSize = 200;
-
-    // The "current" serialization strategy.
-    Requests.FetchRequest protoFetch = Requests.FetchRequest.newBuilder().
-        setConnectionId(connectionId).setStatementId(statementId).
-        setOffset(offset).setFrameMaxSize(maxSize).build();
-
-    Service.FetchRequest fetchReq = new Service.FetchRequest().deserialize(protoFetch);
-    assertEquals(maxSize, fetchReq.fetchMaxRowCount);
-
-    // The "old" serialization strategy.
-    protoFetch = Requests.FetchRequest.newBuilder().
-        setConnectionId(connectionId).setStatementId(statementId).
-        setOffset(offset).setFetchMaxRowCount(maxSize).build();
-
-    fetchReq = new Service.FetchRequest().deserialize(protoFetch);
-    assertEquals(maxSize, fetchReq.fetchMaxRowCount);
-
-    // Both the new and old provided should default to the new
-    protoFetch = Requests.FetchRequest.newBuilder().
-        setConnectionId(connectionId).setStatementId(statementId).
-        setOffset(offset).setFetchMaxRowCount(100).setFrameMaxSize(maxSize).build();
-
-    fetchReq = new Service.FetchRequest().deserialize(protoFetch);
-    assertEquals(maxSize, fetchReq.fetchMaxRowCount);
-  }
-}
-
-// End ProtobufSerializationTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/test/java/org/apache/calcite/avatica/remote/ProtobufServiceTest.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/test/java/org/apache/calcite/avatica/remote/ProtobufServiceTest.java b/avatica/core/src/test/java/org/apache/calcite/avatica/remote/ProtobufServiceTest.java
deleted file mode 100644
index a29ee34..0000000
--- a/avatica/core/src/test/java/org/apache/calcite/avatica/remote/ProtobufServiceTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import org.apache.calcite.avatica.proto.Requests;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-/**
- * Test class for ProtobufService.
- */
-public class ProtobufServiceTest {
-
-  @Test public void testCastProtobufMessage() {
-    final Requests.CommitRequest commitReq =
-        Requests.CommitRequest.newBuilder().setConnectionId("cnxn1").build();
-    final Requests.RollbackRequest rollbackReq =
-        Requests.RollbackRequest.newBuilder().setConnectionId("cnxn1").build();
-
-    assertEquals(commitReq,
-        ProtobufService.castProtobufMessage(commitReq, Requests.CommitRequest.class));
-    assertEquals(rollbackReq,
-        ProtobufService.castProtobufMessage(rollbackReq, Requests.RollbackRequest.class));
-
-    try {
-      ProtobufService.castProtobufMessage(commitReq, Requests.RollbackRequest.class);
-      fail("Should have seen IllegalArgumentException casting CommitRequest into RollbackRequest");
-    } catch (IllegalArgumentException e) {
-      // Expected
-    }
-
-    try {
-      ProtobufService.castProtobufMessage(rollbackReq, Requests.CommitRequest.class);
-      fail("Should have seen IllegalArgumentException casting RollbackRequest into CommitRequest");
-    } catch (IllegalArgumentException e) {
-      // Expected
-    }
-  }
-}
-
-// End ProtobufServiceTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/test/java/org/apache/calcite/avatica/remote/ProtobufTranslationImplTest.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/test/java/org/apache/calcite/avatica/remote/ProtobufTranslationImplTest.java b/avatica/core/src/test/java/org/apache/calcite/avatica/remote/ProtobufTranslationImplTest.java
deleted file mode 100644
index ebb2df4..0000000
--- a/avatica/core/src/test/java/org/apache/calcite/avatica/remote/ProtobufTranslationImplTest.java
+++ /dev/null
@@ -1,387 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import org.apache.calcite.avatica.AvaticaParameter;
-import org.apache.calcite.avatica.AvaticaSeverity;
-import org.apache.calcite.avatica.ColumnMetaData;
-import org.apache.calcite.avatica.ColumnMetaData.ArrayType;
-import org.apache.calcite.avatica.ColumnMetaData.Rep;
-import org.apache.calcite.avatica.ColumnMetaData.ScalarType;
-import org.apache.calcite.avatica.ConnectionPropertiesImpl;
-import org.apache.calcite.avatica.Meta;
-import org.apache.calcite.avatica.Meta.Frame;
-import org.apache.calcite.avatica.Meta.Signature;
-import org.apache.calcite.avatica.Meta.Style;
-import org.apache.calcite.avatica.MetaImpl;
-import org.apache.calcite.avatica.QueryState;
-import org.apache.calcite.avatica.remote.Service.CatalogsRequest;
-import org.apache.calcite.avatica.remote.Service.CloseConnectionRequest;
-import org.apache.calcite.avatica.remote.Service.CloseConnectionResponse;
-import org.apache.calcite.avatica.remote.Service.CloseStatementRequest;
-import org.apache.calcite.avatica.remote.Service.CloseStatementResponse;
-import org.apache.calcite.avatica.remote.Service.ColumnsRequest;
-import org.apache.calcite.avatica.remote.Service.CommitRequest;
-import org.apache.calcite.avatica.remote.Service.CommitResponse;
-import org.apache.calcite.avatica.remote.Service.ConnectionSyncRequest;
-import org.apache.calcite.avatica.remote.Service.ConnectionSyncResponse;
-import org.apache.calcite.avatica.remote.Service.CreateStatementRequest;
-import org.apache.calcite.avatica.remote.Service.CreateStatementResponse;
-import org.apache.calcite.avatica.remote.Service.DatabasePropertyRequest;
-import org.apache.calcite.avatica.remote.Service.DatabasePropertyResponse;
-import org.apache.calcite.avatica.remote.Service.ErrorResponse;
-import org.apache.calcite.avatica.remote.Service.ExecuteBatchResponse;
-import org.apache.calcite.avatica.remote.Service.ExecuteResponse;
-import org.apache.calcite.avatica.remote.Service.FetchRequest;
-import org.apache.calcite.avatica.remote.Service.FetchResponse;
-import org.apache.calcite.avatica.remote.Service.OpenConnectionRequest;
-import org.apache.calcite.avatica.remote.Service.OpenConnectionResponse;
-import org.apache.calcite.avatica.remote.Service.PrepareAndExecuteBatchRequest;
-import org.apache.calcite.avatica.remote.Service.PrepareAndExecuteRequest;
-import org.apache.calcite.avatica.remote.Service.PrepareRequest;
-import org.apache.calcite.avatica.remote.Service.PrepareResponse;
-import org.apache.calcite.avatica.remote.Service.Request;
-import org.apache.calcite.avatica.remote.Service.Response;
-import org.apache.calcite.avatica.remote.Service.ResultSetResponse;
-import org.apache.calcite.avatica.remote.Service.RollbackRequest;
-import org.apache.calcite.avatica.remote.Service.RollbackResponse;
-import org.apache.calcite.avatica.remote.Service.RpcMetadataResponse;
-import org.apache.calcite.avatica.remote.Service.SchemasRequest;
-import org.apache.calcite.avatica.remote.Service.SyncResultsRequest;
-import org.apache.calcite.avatica.remote.Service.SyncResultsResponse;
-import org.apache.calcite.avatica.remote.Service.TableTypesRequest;
-import org.apache.calcite.avatica.remote.Service.TablesRequest;
-import org.apache.calcite.avatica.remote.Service.TypeInfoRequest;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.sql.DatabaseMetaData;
-import java.sql.Types;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * Tests serialization of requests and response objects.
- *
- * @param <T> The object class being tested
- */
-@RunWith(Parameterized.class)
-public class ProtobufTranslationImplTest<T> {
-
-  /**
-   * Simple function definition that acts as an identity.
-   *
-   * @param <A> Argument type
-   */
-  private interface IdentityFunction<A> {
-    A apply(A obj) throws IOException;
-  }
-
-  /**
-   * Identity function that accepts a request, serializes it to protobuf, and converts it back.
-   */
-  private static class RequestFunc implements IdentityFunction<Request> {
-    private final ProtobufTranslation translation;
-
-    public RequestFunc(ProtobufTranslation translation) {
-      this.translation = translation;
-    }
-
-    public Request apply(Request request) throws IOException {
-      // Serialize and then re-parse the request
-      return translation.parseRequest(translation.serializeRequest(request));
-    }
-  }
-
-  /**
-   * Identity function that accepts a response, serializes it to protobuf, and converts it back.
-   */
-  private static class ResponseFunc implements IdentityFunction<Response> {
-    private final ProtobufTranslation translation;
-
-    public ResponseFunc(ProtobufTranslation translation) {
-      this.translation = translation;
-    }
-
-    public Response apply(Response response) throws IOException {
-      // Serialize and then re-pare the response
-      return translation.parseResponse(translation.serializeResponse(response));
-    }
-  }
-
-  @Parameters
-  public static List<Object[]> parameters() {
-    List<Object[]> params = new ArrayList<>();
-
-    // The impl we're testing
-    ProtobufTranslationImpl translation = new ProtobufTranslationImpl();
-
-    // Identity transformation for Requests
-    RequestFunc requestFunc = new RequestFunc(translation);
-    // Identity transformation for Responses
-    ResponseFunc responseFunc = new ResponseFunc(translation);
-
-    List<Request> requests = getRequests();
-    List<Request> requestsWithNulls = getRequestsWithNulls();
-    List<Response> responses = getResponses();
-
-    // Requests
-    for (Request request : requests) {
-      params.add(new Object[] {request, requestFunc});
-    }
-
-    // Requests with nulls in parameters
-    for (Request request : requestsWithNulls) {
-      params.add(new Object[] {request, requestFunc});
-    }
-
-    // Responses
-    for (Response response : responses) {
-      params.add(new Object[] {response, responseFunc});
-    }
-
-    return params;
-  }
-
-  /**
-   * Generates a collection of Requests whose serialization will be tested.
-   */
-  private static List<Request> getRequests() {
-    LinkedList<Request> requests = new LinkedList<>();
-
-    requests.add(new CatalogsRequest());
-    requests.add(new DatabasePropertyRequest());
-    requests.add(new SchemasRequest("connectionId", "catalog", "schemaPattern"));
-    requests.add(
-        new TablesRequest("connectionId", "catalog", "schemaPattern", "tableNamePattern",
-            Arrays.asList("STRING", "BOOLEAN", "INT")));
-    requests.add(new TableTypesRequest());
-    requests.add(
-        new ColumnsRequest("connectionId", "catalog", "schemaPattern", "tableNamePattern",
-            "columnNamePattern"));
-    requests.add(new TypeInfoRequest());
-    requests.add(
-        new PrepareAndExecuteRequest("connectionId", Integer.MAX_VALUE, "sql",
-            Long.MAX_VALUE));
-    requests.add(new PrepareRequest("connectionId", "sql", Long.MAX_VALUE));
-
-    List<TypedValue> paramValues =
-        Arrays.asList(TypedValue.create(Rep.BOOLEAN.name(), Boolean.TRUE),
-            TypedValue.create(Rep.STRING.name(), "string"));
-    FetchRequest fetchRequest = new FetchRequest("connectionId", Integer.MAX_VALUE,
-        Long.MAX_VALUE, Integer.MAX_VALUE);
-    requests.add(fetchRequest);
-
-    requests.add(new CreateStatementRequest("connectionId"));
-    requests.add(new CloseStatementRequest("connectionId", Integer.MAX_VALUE));
-    Map<String, String> info = new HashMap<>();
-    info.put("param1", "value1");
-    info.put("param2", "value2");
-    requests.add(new OpenConnectionRequest("connectionId", info));
-    requests.add(new CloseConnectionRequest("connectionId"));
-    requests.add(
-        new ConnectionSyncRequest("connectionId",
-            new ConnectionPropertiesImpl(Boolean.FALSE, Boolean.FALSE,
-                Integer.MAX_VALUE, "catalog", "schema")));
-
-    requests.add(new SyncResultsRequest("connectionId", 12345, getSqlQueryState(), 150));
-    requests.add(new SyncResultsRequest("connectionId2", 54321, getMetadataQueryState1(), 0));
-    requests.add(new SyncResultsRequest("connectionId3", 5, getMetadataQueryState2(), 10));
-
-    requests.add(new CommitRequest("connectionId"));
-    requests.add(new RollbackRequest("connectionId"));
-
-    // ExecuteBatchRequest omitted because of the special protobuf conversion it does
-
-    List<String> commands = Arrays.asList("command1", "command2", "command3");
-    requests.add(new PrepareAndExecuteBatchRequest("connectionId", 12345, commands));
-
-    return requests;
-  }
-
-  private static QueryState getSqlQueryState() {
-    return new QueryState("SELECT * from TABLE");
-  }
-
-  private static QueryState getMetadataQueryState1() {
-    return new QueryState(MetaDataOperation.GET_COLUMNS, new Object[] {
-      "",
-      null,
-      "%",
-      "%"
-    });
-  }
-
-  private static QueryState getMetadataQueryState2() {
-    return new QueryState(MetaDataOperation.GET_CATALOGS, new Object[0]);
-  }
-
-  private static List<Request> getRequestsWithNulls() {
-    LinkedList<Request> requests = new LinkedList<>();
-
-    // We're pretty fast and loose on what can be null.
-    requests.add(new SchemasRequest(null, null, null));
-    // Repeated fields default to an empty list
-    requests.add(new TablesRequest(null, null, null, null, Collections.<String>emptyList()));
-    requests.add(new ColumnsRequest(null, null, null, null, null));
-    requests.add(new PrepareAndExecuteRequest(null, 0, null, 0));
-    requests.add(new PrepareRequest(null, null, 0));
-    requests.add(new CreateStatementRequest(null));
-    requests.add(new CloseStatementRequest(null, 0));
-    requests.add(new OpenConnectionRequest(null, null));
-    requests.add(new CloseConnectionRequest(null));
-    requests.add(new ConnectionSyncRequest(null, null));
-
-    return requests;
-  }
-
-  private static ColumnMetaData getArrayColumnMetaData(ScalarType componentType, int index,
-      String name) {
-    ArrayType arrayType = ColumnMetaData.array(componentType, "Array", Rep.ARRAY);
-    return new ColumnMetaData(
-        index, false, true, false, false, DatabaseMetaData.columnNullable,
-        true, -1, name, name, null,
-        0, 0, null, null, arrayType, true, false, false,
-        "ARRAY");
-  }
-
-  /**
-   * Generates a collection of Responses whose serialization will be tested.
-   */
-  private static List<Response> getResponses() {
-    final RpcMetadataResponse rpcMetadata = new RpcMetadataResponse("localhost:8765");
-    LinkedList<Response> responses = new LinkedList<>();
-
-    // Nested classes (Signature, ColumnMetaData, CursorFactory, etc) are implicitly getting tested)
-
-    // Stub out the metadata for a row
-    ScalarType arrayComponentType = ColumnMetaData.scalar(Types.INTEGER, "integer", Rep.INTEGER);
-    ColumnMetaData arrayColumnMetaData = getArrayColumnMetaData(arrayComponentType, 2, "counts");
-    List<ColumnMetaData> columns =
-        Arrays.asList(MetaImpl.columnMetaData("str", 0, String.class, true),
-            MetaImpl.columnMetaData("count", 1, Integer.class, true),
-            arrayColumnMetaData);
-    List<AvaticaParameter> params =
-        Arrays.asList(
-            new AvaticaParameter(false, 10, 0, Types.VARCHAR, "VARCHAR",
-                String.class.getName(), "str"));
-    Meta.CursorFactory cursorFactory = Meta.CursorFactory.create(Style.LIST, Object.class,
-        Arrays.asList("str", "count", "counts"));
-    // The row values
-    List<Object> rows = new ArrayList<>();
-    rows.add(new Object[] {"str_value1", 50, Arrays.asList(1, 2, 3)});
-    rows.add(new Object[] {"str_value2", 100, Arrays.asList(1)});
-
-    // Create the signature and frame using the metadata and values
-    Signature signature = Signature.create(columns, "sql", params, cursorFactory,
-        Meta.StatementType.SELECT);
-    Frame frame = Frame.create(Integer.MAX_VALUE, true, rows);
-
-    // And then create a ResultSetResponse
-    ResultSetResponse results1 = new ResultSetResponse("connectionId", Integer.MAX_VALUE, true,
-        signature, frame, Long.MAX_VALUE, rpcMetadata);
-    responses.add(results1);
-
-    responses.add(new CloseStatementResponse(rpcMetadata));
-
-    ConnectionPropertiesImpl connProps = new ConnectionPropertiesImpl(false, true,
-        Integer.MAX_VALUE, "catalog", "schema");
-    responses.add(new ConnectionSyncResponse(connProps, rpcMetadata));
-
-    responses.add(new OpenConnectionResponse(rpcMetadata));
-    responses.add(new CloseConnectionResponse(rpcMetadata));
-
-    responses.add(new CreateStatementResponse("connectionId", Integer.MAX_VALUE, rpcMetadata));
-
-    Map<Meta.DatabaseProperty, Object> propertyMap = new HashMap<>();
-    for (Meta.DatabaseProperty prop : Meta.DatabaseProperty.values()) {
-      propertyMap.put(prop, prop.defaultValue);
-    }
-    responses.add(new DatabasePropertyResponse(propertyMap, rpcMetadata));
-
-    responses.add(
-        new ExecuteResponse(Arrays.asList(results1, results1, results1), false, rpcMetadata));
-    responses.add(new FetchResponse(frame, false, false, rpcMetadata));
-    responses.add(new FetchResponse(frame, true, true, rpcMetadata));
-    responses.add(new FetchResponse(frame, false, true, rpcMetadata));
-    responses.add(
-        new PrepareResponse(
-            new Meta.StatementHandle("connectionId", Integer.MAX_VALUE, signature),
-            rpcMetadata));
-
-    StringWriter sw = new StringWriter();
-    new Exception().printStackTrace(new PrintWriter(sw));
-    responses.add(
-        new ErrorResponse(Collections.singletonList(sw.toString()), "Test Error Message",
-            ErrorResponse.UNKNOWN_ERROR_CODE, ErrorResponse.UNKNOWN_SQL_STATE,
-            AvaticaSeverity.WARNING, rpcMetadata));
-
-    // No more results, statement not missing
-    responses.add(new SyncResultsResponse(false, false, rpcMetadata));
-    // Missing statement, no results
-    responses.add(new SyncResultsResponse(false, true, rpcMetadata));
-    // More results, no missing statement
-    responses.add(new SyncResultsResponse(true, false, rpcMetadata));
-
-    // Some tests to make sure ErrorResponse doesn't fail.
-    responses.add(new ErrorResponse((List<String>) null, null, 0, null, null, null));
-    responses.add(
-        new ErrorResponse(Arrays.asList("stacktrace1", "stacktrace2"), null, 0, null, null, null));
-
-    responses.add(new CommitResponse());
-    responses.add(new RollbackResponse());
-
-    long[] updateCounts = new long[]{1, 0, 1, 1};
-    responses.add(
-        new ExecuteBatchResponse("connectionId", 12345, updateCounts, false, rpcMetadata));
-
-    return responses;
-  }
-
-  private final T object;
-  private final IdentityFunction<T> function;
-
-  public ProtobufTranslationImplTest(T object, IdentityFunction<T> func) {
-    this.object = object;
-    this.function = func;
-  }
-
-  @Test
-  public void testSerialization() throws Exception {
-    // Function acts as opposite sides of the transport.
-    // An object (a request or response) starts on one side
-    // of the transport, serialized, "sent" over the transport
-    // and then reconstituted. The object on either side should
-    // be equivalent.
-    assertEquals(object, this.function.apply(object));
-  }
-}
-
-// End ProtobufTranslationImplTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/test/java/org/apache/calcite/avatica/remote/TypedValueTest.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/test/java/org/apache/calcite/avatica/remote/TypedValueTest.java b/avatica/core/src/test/java/org/apache/calcite/avatica/remote/TypedValueTest.java
deleted file mode 100644
index 7606a87..0000000
--- a/avatica/core/src/test/java/org/apache/calcite/avatica/remote/TypedValueTest.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import org.apache.calcite.avatica.ColumnMetaData.Rep;
-import org.apache.calcite.avatica.proto.Common;
-import org.apache.calcite.avatica.util.Base64;
-import org.apache.calcite.avatica.util.ByteString;
-import org.apache.calcite.avatica.util.DateTimeUtils;
-
-import org.junit.Test;
-
-import java.math.BigDecimal;
-import java.util.Calendar;
-
-import static org.hamcrest.CoreMatchers.instanceOf;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
-
-import static java.nio.charset.StandardCharsets.UTF_8;
-
-/**
- * Test serialization of TypedValue.
- */
-public class TypedValueTest {
-
-  private void serializeAndEqualityCheck(TypedValue value) {
-    TypedValue copy = TypedValue.fromProto(value.toProto());
-
-    assertEquals(value.type, copy.type);
-    assertEquals(value.value, copy.value);
-  }
-
-  @Test public void testBoolean() {
-    serializeAndEqualityCheck(TypedValue.ofLocal(Rep.PRIMITIVE_BOOLEAN, true));
-    serializeAndEqualityCheck(TypedValue.ofLocal(Rep.BOOLEAN, Boolean.TRUE));
-  }
-
-  @Test public void testByte() {
-    serializeAndEqualityCheck(TypedValue.ofLocal(Rep.PRIMITIVE_BYTE, (byte) 4));
-    serializeAndEqualityCheck(TypedValue.ofLocal(Rep.BYTE, Byte.valueOf((byte) 4)));
-  }
-
-  @Test public void testShort() {
-    serializeAndEqualityCheck(TypedValue.ofLocal(Rep.PRIMITIVE_SHORT, (short) 42));
-    serializeAndEqualityCheck(TypedValue.ofLocal(Rep.SHORT, Short.valueOf((short) 42)));
-  }
-
-  @Test public void testInteger() {
-    serializeAndEqualityCheck(TypedValue.ofLocal(Rep.PRIMITIVE_INT, (int) 42000));
-    serializeAndEqualityCheck(TypedValue.ofLocal(Rep.INTEGER, Integer.valueOf((int) 42000)));
-  }
-
-  @Test public void testLong() {
-    serializeAndEqualityCheck(TypedValue.ofLocal(Rep.PRIMITIVE_LONG, Long.MAX_VALUE));
-    serializeAndEqualityCheck(TypedValue.ofLocal(Rep.LONG, Long.valueOf(Long.MAX_VALUE)));
-  }
-
-  @Test public void testFloat() {
-    serializeAndEqualityCheck(TypedValue.ofLocal(Rep.PRIMITIVE_FLOAT, 3.14159f));
-    serializeAndEqualityCheck(TypedValue.ofLocal(Rep.FLOAT, Float.valueOf(3.14159f)));
-  }
-
-  @Test public void testDouble() {
-    serializeAndEqualityCheck(TypedValue.ofLocal(Rep.PRIMITIVE_DOUBLE, Double.MAX_VALUE));
-    serializeAndEqualityCheck(TypedValue.ofLocal(Rep.DOUBLE, Double.valueOf(Double.MAX_VALUE)));
-  }
-
-  @Test public void testDecimal() {
-    final BigDecimal decimal = new BigDecimal("1.2345");
-    final TypedValue decimalTypedValue = TypedValue.ofLocal(Rep.NUMBER, decimal);
-    serializeAndEqualityCheck(decimalTypedValue);
-
-    final Common.TypedValue protoTypedValue = decimalTypedValue.toProto();
-    assertEquals(Common.Rep.BIG_DECIMAL, protoTypedValue.getType());
-    final String strValue = protoTypedValue.getStringValue();
-    assertNotNull(strValue);
-    assertEquals(decimal.toPlainString(), strValue);
-  }
-
-  @Test public void testChar() {
-    serializeAndEqualityCheck(TypedValue.ofLocal(Rep.PRIMITIVE_CHAR, 'c'));
-    serializeAndEqualityCheck(TypedValue.ofLocal(Rep.CHARACTER, Character.valueOf('c')));
-  }
-
-  @Test public void testString() {
-    serializeAndEqualityCheck(TypedValue.ofLocal(Rep.STRING, "qwertyasdf"));
-  }
-
-  @Test public void testByteString() {
-    serializeAndEqualityCheck(
-        TypedValue.ofLocal(Rep.BYTE_STRING,
-            new ByteString("qwertyasdf".getBytes(UTF_8))));
-  }
-
-  @Test public void testBase64() {
-    byte[] bytes = "qwertyasdf".getBytes(UTF_8);
-    // Plain bytes get put into protobuf for simplicitly
-    Common.TypedValue proto = Common.TypedValue.newBuilder().setBytesValue(
-        com.google.protobuf.ByteString.copyFrom(bytes))
-        .setType(Common.Rep.BYTE_STRING).build();
-
-    // But we should get back a b64-string to make sure TypedValue doesn't get confused.
-    Object deserializedObj = TypedValue.getSerialFromProto(proto);
-    assertThat(deserializedObj, is(instanceOf(String.class)));
-    assertEquals(new ByteString(bytes).toBase64String(), (String) deserializedObj);
-
-    // But we should get a non-b64 byte array as the JDBC representation
-    deserializedObj =
-        TypedValue.protoToJdbc(proto, DateTimeUtils.calendar());
-    assertThat(deserializedObj, is(instanceOf(byte[].class)));
-    assertArrayEquals(bytes, (byte[]) deserializedObj);
-  }
-
-  @Test public void testSqlDate() {
-    // days since epoch
-    serializeAndEqualityCheck(TypedValue.ofLocal(Rep.JAVA_SQL_DATE, 25));
-  }
-
-  @Test public void testUtilDate() {
-    serializeAndEqualityCheck(
-        TypedValue.ofLocal(Rep.JAVA_UTIL_DATE, System.currentTimeMillis()));
-  }
-
-  @Test public void testSqlTime() {
-    // millis since epoch
-    serializeAndEqualityCheck(
-        TypedValue.ofLocal(Rep.JAVA_SQL_TIME, 42 * 1024 * 1024));
-  }
-
-  @Test public void testSqlTimestamp() {
-    serializeAndEqualityCheck(
-        TypedValue.ofLocal(Rep.JAVA_SQL_TIMESTAMP, 42L * 1024 * 1024 * 1024));
-  }
-
-  @Test public void testLegacyDecimalParsing() {
-    final BigDecimal decimal = new BigDecimal("123451234512345");
-    final Calendar calendar = DateTimeUtils.calendar();
-
-    // CALCITE-1103 Decimals were (incorrectly) getting serialized as normal "numbers" which
-    // caused them to use the numberValue field. TypedValue should still be able to handle
-    // values like this (but large values will be truncated and return bad values).
-    Common.TypedValue oldProtoStyle = Common.TypedValue.newBuilder().setType(Common.Rep.NUMBER)
-        .setNumberValue(decimal.longValue()).build();
-
-    TypedValue fromProtoTv = TypedValue.fromProto(oldProtoStyle);
-    Object o = fromProtoTv.toJdbc(calendar);
-    assertEquals(decimal, o);
-  }
-
-  @Test public void testProtobufBytesNotSentAsBase64() {
-    final byte[] bytes = "asdf".getBytes(UTF_8);
-    final byte[] b64Bytes = Base64.encodeBytes(bytes).getBytes(UTF_8);
-    TypedValue tv = TypedValue.ofLocal(Rep.BYTE_STRING, new ByteString(bytes));
-    // JSON encodes it as base64
-    assertEquals(new String(b64Bytes, UTF_8), tv.value);
-
-    // Get the protobuf variant
-    Common.TypedValue protoTv = tv.toProto();
-    Common.Rep protoRep = protoTv.getType();
-    assertEquals(Common.Rep.BYTE_STRING, protoRep);
-
-    // The pb variant should have the native bytes of the original value
-    com.google.protobuf.ByteString protoByteString = protoTv.getBytesValue();
-    assertNotNull(protoByteString);
-    assertArrayEquals(bytes, protoByteString.toByteArray());
-
-    // We should have the b64 string as a backwards compatibility feature
-    assertEquals(new String(b64Bytes, UTF_8),
-        protoTv.getStringValue());
-  }
-
-  @Test public void testLegacyBase64StringEncodingForBytes() {
-    // CALCITE-1103 CALCITE-1209 We observed that binary data was being
-    // serialized as base-64 encoded strings instead of the native binary
-    // data type in protobufs. We need to still handle older clients sending
-    // data in this form.
-    final byte[] bytes = "asdf".getBytes(UTF_8);
-    final String base64Str = Base64.encodeBytes(bytes);
-    Common.TypedValue.Builder builder = Common.TypedValue.newBuilder();
-    builder.setStringValue(base64Str);
-    builder.setType(Common.Rep.BYTE_STRING);
-    Common.TypedValue protoTv = builder.build();
-
-    TypedValue tv = TypedValue.fromProto(protoTv);
-    assertEquals(Rep.BYTE_STRING, tv.type);
-    assertEquals(base64Str, tv.value);
-  }
-}
-
-// End TypedValueTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/test/java/org/apache/calcite/avatica/test/AvaticaClientRuntimeExceptionTest.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/test/java/org/apache/calcite/avatica/test/AvaticaClientRuntimeExceptionTest.java b/avatica/core/src/test/java/org/apache/calcite/avatica/test/AvaticaClientRuntimeExceptionTest.java
deleted file mode 100644
index 411f29c..0000000
--- a/avatica/core/src/test/java/org/apache/calcite/avatica/test/AvaticaClientRuntimeExceptionTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.test;
-
-import org.apache.calcite.avatica.AvaticaClientRuntimeException;
-import org.apache.calcite.avatica.AvaticaSeverity;
-import org.apache.calcite.avatica.remote.Service.RpcMetadataResponse;
-
-import org.junit.Test;
-
-import java.util.Arrays;
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * Test class for {@link AvaticaClientRuntimeException}.
- */
-public class AvaticaClientRuntimeExceptionTest {
-
-  @Test public void testGetters() {
-    final String errorMsg = "My error message";
-    final int errorCode = 10;
-    final String sqlState = "abc12";
-    final AvaticaSeverity severity = AvaticaSeverity.ERROR;
-    final List<String> stacktraces = Arrays.asList("my stack trace");
-    final RpcMetadataResponse metadata = new RpcMetadataResponse("localhost:8765");
-    AvaticaClientRuntimeException e = new AvaticaClientRuntimeException(errorMsg, errorCode,
-        sqlState, severity, stacktraces, metadata);
-    assertEquals(errorMsg, e.getMessage());
-    assertEquals(errorCode, e.getErrorCode());
-    assertEquals(severity, e.getSeverity());
-    assertEquals(stacktraces, e.getServerExceptions());
-    assertEquals(metadata, e.getRpcMetadata());
-  }
-
-}
-
-// End AvaticaClientRuntimeExceptionTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/test/java/org/apache/calcite/avatica/test/AvaticaSeverityTest.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/test/java/org/apache/calcite/avatica/test/AvaticaSeverityTest.java b/avatica/core/src/test/java/org/apache/calcite/avatica/test/AvaticaSeverityTest.java
deleted file mode 100644
index 945f959..0000000
--- a/avatica/core/src/test/java/org/apache/calcite/avatica/test/AvaticaSeverityTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.test;
-
-import org.apache.calcite.avatica.AvaticaSeverity;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * Tests for {@link AvaticaSeverity}.
- */
-public class AvaticaSeverityTest {
-
-  @Test
-  public void testProtobufSerialization() {
-    for (AvaticaSeverity severity : AvaticaSeverity.values()) {
-      assertEquals(severity, AvaticaSeverity.fromProto(severity.toProto()));
-    }
-  }
-
-}
-
-// End AvaticaSeverityTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/test/java/org/apache/calcite/avatica/test/AvaticaSqlExceptionTest.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/test/java/org/apache/calcite/avatica/test/AvaticaSqlExceptionTest.java b/avatica/core/src/test/java/org/apache/calcite/avatica/test/AvaticaSqlExceptionTest.java
deleted file mode 100644
index 3d7b5b0..0000000
--- a/avatica/core/src/test/java/org/apache/calcite/avatica/test/AvaticaSqlExceptionTest.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.test;
-
-import org.apache.calcite.avatica.AvaticaSqlException;
-
-import org.junit.Test;
-
-import java.util.Arrays;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-/**
- * Tests for {@link AvaticaSqlException}.
- */
-public class AvaticaSqlExceptionTest {
-
-  @Test public void testGetters() {
-    final String msg = "My query failed!";
-    final int code = 42;
-    final String sql = "SELECT foo FROM bar;";
-    final String stacktrace = "My Stack Trace";
-    final String server = "localhost:8765";
-
-    AvaticaSqlException e = new AvaticaSqlException(msg, sql, code, Arrays.asList(stacktrace),
-        server);
-    assertTrue(e.getMessage().contains(msg));
-    assertEquals(code, e.getErrorCode());
-    assertEquals(sql, e.getSQLState());
-    assertEquals(1, e.getStackTraces().size());
-    assertEquals(stacktrace, e.getStackTraces().get(0));
-    assertEquals(server, e.getRemoteServer());
-  }
-
-}
-
-// End AvaticaSqlExceptionTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/test/java/org/apache/calcite/avatica/test/AvaticaUtilsTest.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/test/java/org/apache/calcite/avatica/test/AvaticaUtilsTest.java b/avatica/core/src/test/java/org/apache/calcite/avatica/test/AvaticaUtilsTest.java
deleted file mode 100644
index b1a422c..0000000
--- a/avatica/core/src/test/java/org/apache/calcite/avatica/test/AvaticaUtilsTest.java
+++ /dev/null
@@ -1,340 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.test;
-
-import org.apache.calcite.avatica.AvaticaUtils;
-import org.apache.calcite.avatica.ConnectionConfigImpl;
-import org.apache.calcite.avatica.ConnectionProperty;
-import org.apache.calcite.avatica.util.ByteString;
-
-import org.junit.Test;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.LinkedHashSet;
-import java.util.Locale;
-import java.util.Properties;
-import java.util.Set;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
-
-/**
- * Unit test for Avatica utilities.
- */
-public class AvaticaUtilsTest {
-  @Test public void testInstantiatePlugin() {
-    final String s =
-        AvaticaUtils.instantiatePlugin(String.class, "java.lang.String");
-    assertThat(s, is(""));
-
-    // No default constructor or INSTANCE member
-    try {
-      final Integer i =
-          AvaticaUtils.instantiatePlugin(Integer.class, "java.lang.Integer");
-      fail("expected error, got " + i);
-    } catch (Throwable e) {
-      assertThat(e.getMessage(),
-          is("Property 'java.lang.Integer' not valid for plugin type java.lang.Integer"));
-    }
-
-    final BigInteger b =
-        AvaticaUtils.instantiatePlugin(BigInteger.class, "java.math.BigInteger#ONE");
-    assertThat(b, is(BigInteger.ONE));
-
-    try {
-      final BigInteger b2 =
-          AvaticaUtils.instantiatePlugin(BigInteger.class,
-              "java.math.BigInteger.ONE");
-      fail("expected error, got " + b2);
-    } catch (Throwable e) {
-      assertThat(e.getMessage(),
-          is("Property 'java.math.BigInteger.ONE' not valid for plugin type java.math.BigInteger"));
-    }
-  }
-
-  /** Unit test for
-   * {@link org.apache.calcite.avatica.AvaticaUtils#unique(java.lang.String)}. */
-  @Test public void testUnique() {
-    // Below, the "probably" comments indicate the strings that will be
-    // generated the first time you run the test.
-    final Set<String> list = new LinkedHashSet<>();
-    list.add(AvaticaUtils.unique("a")); // probably "a"
-    assertThat(list.size(), is(1));
-    list.add(AvaticaUtils.unique("a")); // probably "a_1"
-    assertThat(list.size(), is(2));
-    list.add(AvaticaUtils.unique("b")); // probably "b"
-    assertThat(list.size(), is(3));
-    list.add(AvaticaUtils.unique("a_1")); // probably "a_1_3"
-    assertThat(list.size(), is(4));
-    list.add(AvaticaUtils.unique("A")); // probably "A"
-    assertThat(list.size(), is(5));
-    list.add(AvaticaUtils.unique("a")); // probably "a_5"
-    assertThat(list.size(), is(6));
-  }
-
-  /** Tests connect string properties. */
-  @Test public void testConnectionProperty() {
-    final ConnectionPropertyImpl n = new ConnectionPropertyImpl("N",
-        BigDecimal.valueOf(100), ConnectionProperty.Type.NUMBER);
-
-    final Properties properties = new Properties();
-    ConnectionConfigImpl.PropEnv env = n.wrap(properties);
-    assertThat(env.getInt(), is(100));
-    assertThat(env.getInt(-45), is(-45));
-    properties.setProperty(n.name, "123");
-    assertThat(env.getInt(), is(100));
-    env = n.wrap(properties);
-    assertThat(env.getInt(), is(123));
-    assertThat(env.getInt(-45), is(123));
-
-    properties.setProperty(n.name, "10k");
-    env = n.wrap(properties);
-    assertThat(env.getInt(), is(10 * 1024));
-
-    properties.setProperty(n.name, "-0.5k");
-    env = n.wrap(properties);
-    assertThat(env.getInt(), is(-512));
-
-    properties.setProperty(n.name, "10m");
-    env = n.wrap(properties);
-    assertThat(env.getInt(), is(10 * 1024 * 1024));
-    assertThat(env.getLong(), is(10L * 1024 * 1024));
-    assertThat(env.getDouble(), is(10D * 1024 * 1024));
-
-    properties.setProperty(n.name, "-2M");
-    env = n.wrap(properties);
-    assertThat(env.getInt(), is(-2 * 1024 * 1024));
-
-    properties.setProperty(n.name, "10g");
-    env = n.wrap(properties);
-    assertThat(env.getLong(), is(10L * 1024 * 1024 * 1024));
-
-    final ConnectionPropertyImpl b = new ConnectionPropertyImpl("B",
-        true, ConnectionProperty.Type.BOOLEAN);
-
-    env = b.wrap(properties);
-    assertThat(env.getBoolean(), is(true));
-    assertThat(env.getBoolean(true), is(true));
-    assertThat(env.getBoolean(false), is(false));
-
-    properties.setProperty(b.name, "false");
-    env = b.wrap(properties);
-    assertThat(env.getBoolean(), is(false));
-
-    final ConnectionPropertyImpl s = new ConnectionPropertyImpl("S",
-        "foo", ConnectionProperty.Type.STRING);
-
-    env = s.wrap(properties);
-    assertThat(env.getString(), is("foo"));
-    assertThat(env.getString("baz"), is("baz"));
-
-    properties.setProperty(s.name, "  ");
-    env = s.wrap(properties);
-    assertThat(env.getString(), is("  "));
-
-    try {
-      final ConnectionPropertyImpl t =
-          new ConnectionPropertyImpl("T", null, ConnectionProperty.Type.ENUM);
-      fail("should throw if you specify an enum property without a class, got "
-          + t);
-    } catch (AssertionError e) {
-      assertThat(e.getMessage(), is("must specify value class for an ENUM"));
-      // ok
-    }
-
-    // An enum with a default value
-    final ConnectionPropertyImpl t = new ConnectionPropertyImpl("T", Size.BIG,
-        ConnectionProperty.Type.ENUM, Size.class);
-    env = t.wrap(properties);
-    assertThat(env.getEnum(Size.class), is(Size.BIG));
-    assertThat(env.getEnum(Size.class, Size.SMALL), is(Size.SMALL));
-    assertThat(env.getEnum(Size.class, null), nullValue());
-    try {
-      final Weight envEnum = env.getEnum(Weight.class, null);
-      fail("expected error, got " + envEnum);
-    } catch (AssertionError e) {
-      assertThat(e.getMessage(),
-          is("wrong value class; expected " + Size.class));
-    }
-
-    // An enum with a default value that is an anonymous enum,
-    // not specifying value type.
-    final ConnectionPropertyImpl v = new ConnectionPropertyImpl("V",
-        Size.SMALL, ConnectionProperty.Type.ENUM);
-    env = v.wrap(properties);
-    assertThat(env.getEnum(Size.class), is(Size.SMALL));
-    assertThat(env.getEnum(Size.class, Size.BIG), is(Size.BIG));
-    assertThat(env.getEnum(Size.class, null), nullValue());
-    try {
-      final Weight envEnum = env.getEnum(Weight.class, null);
-      fail("expected error, got " + envEnum);
-    } catch (AssertionError e) {
-      assertThat(e.getMessage(),
-          is("wrong value class; expected " + Size.class));
-    }
-
-    // An enum with no default value
-    final ConnectionPropertyImpl u = new ConnectionPropertyImpl("U", null,
-        ConnectionProperty.Type.ENUM, Size.class);
-    env = u.wrap(properties);
-    assertThat(env.getEnum(Size.class), nullValue());
-    assertThat(env.getEnum(Size.class, Size.SMALL), is(Size.SMALL));
-    assertThat(env.getEnum(Size.class, null), nullValue());
-    try {
-      final Weight envEnum = env.getEnum(Weight.class, null);
-      fail("expected error, got " + envEnum);
-    } catch (AssertionError e) {
-      assertThat(e.getMessage(),
-          is("wrong value class; expected " + Size.class));
-    }
-  }
-
-  @Test public void testLongToIntegerTranslation() {
-    long[] longValues = new long[] {Integer.MIN_VALUE, -5, 0, 1, Integer.MAX_VALUE,
-      ((long) Integer.MAX_VALUE) + 1L, Long.MAX_VALUE};
-    int[] convertedValues = AvaticaUtils.toSaturatedInts(longValues);
-    int[] intValues = new int[] {Integer.MIN_VALUE, -5, 0, 1, Integer.MAX_VALUE,
-      Integer.MAX_VALUE, Integer.MAX_VALUE};
-    assertArrayEquals(convertedValues, intValues);
-  }
-
-  @Test public void testByteString() {
-    final byte[] bytes = {3, 14, 15, 92, 0, 65, 35, 0};
-    final ByteString s = new ByteString(bytes);
-    final ByteString s2 = new ByteString(bytes.clone());
-    final ByteString s3 = new ByteString(new byte[0]);
-    final ByteString s4 = new ByteString(new byte[] {0});
-    final ByteString s5 = new ByteString(new byte[]{15, 92});
-
-    // length
-    assertThat(s.length(), is(8));
-    assertThat(s3.length(), is(0));
-    assertThat(s4.length(), is(1));
-
-    // equals and hashCode
-    assertThat(s.hashCode(), is(s2.hashCode()));
-    assertThat(s.equals(s2), is(true));
-    assertThat(s2.equals(s), is(true));
-    assertThat(s.equals(s3), is(false));
-    assertThat(s3.equals(s), is(false));
-
-    // toString
-    assertThat(s.toString(), is("030e0f5c00412300"));
-    assertThat(s3.toString(), is(""));
-    assertThat(s4.toString(), is("00"));
-
-    // indexOf
-    assertThat(s.indexOf(s3), is(0));
-    assertThat(s.indexOf(s3, 5), is(5));
-    assertThat(s.indexOf(s3, 15), is(-1));
-    assertThat(s.indexOf(s4), is(4));
-    assertThat(s.indexOf(s4, 4), is(4));
-    assertThat(s.indexOf(s4, 5), is(7));
-    assertThat(s.indexOf(s5), is(2));
-    assertThat(s.indexOf(s5, 2), is(2));
-    assertThat(s.indexOf(s5, 3), is(-1));
-    assertThat(s.indexOf(s5, 7), is(-1));
-
-    // substring
-    assertThat(s.substring(8), is(s3));
-    assertThat(s.substring(7), is(s4));
-    assertThat(s.substring(0), is(s));
-
-    // getBytes
-    assertThat(s.getBytes().length, is(8));
-    assertThat(Arrays.equals(s.getBytes(), bytes), is(true));
-    assertThat(s.getBytes()[3], is((byte) 92));
-    final byte[] copyBytes = s.getBytes();
-    copyBytes[3] = 11;
-    assertThat(s.getBytes()[3], is((byte) 92));
-    assertThat(s, is(s2));
-  }
-
-  /** Dummy implementation of {@link ConnectionProperty}. */
-  private static class ConnectionPropertyImpl implements ConnectionProperty {
-    private final String name;
-    private final Object defaultValue;
-    private final Class<?> valueClass;
-    private Type type;
-
-    ConnectionPropertyImpl(String name, Object defaultValue, Type type) {
-      this(name, defaultValue, type, null);
-    }
-
-    ConnectionPropertyImpl(String name, Object defaultValue, Type type,
-        Class valueClass) {
-      this.name = name;
-      this.defaultValue = defaultValue;
-      this.type = type;
-      this.valueClass = type.deduceValueClass(defaultValue, valueClass);
-      if (!type.valid(defaultValue, this.valueClass)) {
-        throw new AssertionError(name);
-      }
-    }
-
-    public String name() {
-      return name.toUpperCase(Locale.ROOT);
-    }
-
-    public String camelName() {
-      return name.toLowerCase(Locale.ROOT);
-    }
-
-    public Object defaultValue() {
-      return defaultValue;
-    }
-
-    public Type type() {
-      return type;
-    }
-
-    public Class valueClass() {
-      return valueClass;
-    }
-
-    public ConnectionConfigImpl.PropEnv wrap(Properties properties) {
-      final HashMap<String, ConnectionProperty> map = new HashMap<>();
-      map.put(name, this);
-      return new ConnectionConfigImpl.PropEnv(
-          ConnectionConfigImpl.parse(properties, map), this);
-    }
-
-    public boolean required() {
-      return false;
-    }
-  }
-
-  /** How large? */
-  private enum Size {
-    BIG,
-    SMALL {
-    }
-  }
-
-  /** How heavy? */
-  private enum Weight {
-    HEAVY, LIGHT
-  }
-}
-
-// End AvaticaUtilsTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/test/java/org/apache/calcite/avatica/test/ConnectStringParserTest.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/test/java/org/apache/calcite/avatica/test/ConnectStringParserTest.java b/avatica/core/src/test/java/org/apache/calcite/avatica/test/ConnectStringParserTest.java
deleted file mode 100644
index cdc8d8a..0000000
--- a/avatica/core/src/test/java/org/apache/calcite/avatica/test/ConnectStringParserTest.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.test;
-
-import org.apache.calcite.avatica.ConnectStringParser;
-
-import org.junit.Test;
-
-import java.sql.SQLException;
-import java.util.Properties;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
-
-/**
- * Unit test for JDBC connect string parser, {@link ConnectStringParser}. The
- * ConnectStringParser is adapted from code in Mondrian, but most of the tests
- * below were unfortunately "reinvented" prior to having the Mondrian unit tests
- * in hand.
- */
-public class ConnectStringParserTest {
-  /**
-   * Tests simple connect string. Adapted from Mondrian tests.
-   */
-  @Test public void testSimpleStrings() throws Throwable {
-    Properties props = ConnectStringParser.parse("foo=x;bar=y;foo=z");
-    assertEquals(
-        "bar",
-        "y",
-        props.get("bar"));
-    assertNull(
-        "BAR",
-        props.get("BAR")); // case-sensitive, unlike Mondrian
-    assertEquals(
-        "last foo",
-        "z",
-        props.get("foo"));
-    assertNull(
-        "key=\" bar\"",
-        props.get(" bar"));
-    assertNull(
-        "bogus key",
-        props.get("kipper"));
-    assertEquals(
-        "param count",
-        2,
-        props.size());
-
-    String synth = ConnectStringParser.getParamString(props);
-    Properties synthProps = ConnectStringParser.parse(synth);
-    assertEquals("reversible", props, synthProps);
-  }
-
-  /**
-   * Tests complex connect strings. Adapted directly from Mondrian tests.
-   */
-  @Test public void testComplexStrings() throws Throwable {
-    Properties props =
-        ConnectStringParser.parse("normalProp=value;"
-            + "emptyValue=;"
-            + " spaceBeforeProp=abc;"
-            + " spaceBeforeAndAfterProp =def;"
-            + " space in prop = foo bar ;"
-            + "equalsInValue=foo=bar;"
-            + "semiInProp;Name=value;"
-            + " singleQuotedValue = 'single quoted value ending in space ' ;"
-            + " doubleQuotedValue = "
-            + "\"=double quoted value preceded by equals\" ;"
-            + " singleQuotedValueWithSemi = 'one; two';"
-            + " singleQuotedValueWithSpecials = 'one; two \"three''four=five'");
-
-    assertEquals(
-        "param count",
-        11,
-        props.size());
-
-    String value;
-    value = (String) props.get("normalProp");
-    assertEquals("value", value);
-    value = (String) props.get("emptyValue");
-    assertEquals("", value); // empty string, not null!
-    value = (String) props.get("spaceBeforeProp");
-    assertEquals("abc", value);
-    value = (String) props.get("spaceBeforeAndAfterProp");
-    assertEquals("def", value);
-    value = (String) props.get("space in prop");
-    assertEquals(value, "foo bar");
-    value = (String) props.get("equalsInValue");
-    assertEquals("foo=bar", value);
-    value = (String) props.get("semiInProp;Name");
-    assertEquals("value", value);
-    value = (String) props.get("singleQuotedValue");
-    assertEquals("single quoted value ending in space ", value);
-    value = (String) props.get("doubleQuotedValue");
-    assertEquals("=double quoted value preceded by equals", value);
-    value = (String) props.get("singleQuotedValueWithSemi");
-    assertEquals(value, "one; two");
-    value = (String) props.get("singleQuotedValueWithSpecials");
-    assertEquals(value, "one; two \"three'four=five");
-  }
-
-  /**
-   * Tests for specific errors thrown by the parser.
-   */
-  @Test public void testConnectStringErrors() throws Throwable {
-    // force some parsing errors
-    try {
-      ConnectStringParser.parse("key='can't parse'");
-      fail("quoted value ended too soon");
-    } catch (SQLException e) {
-      assertExceptionMatches(e, ".*quoted value ended.*position 9.*");
-    }
-
-    try {
-      ConnectStringParser.parse("key='\"can''t parse\"");
-      fail("unterminated quoted value");
-    } catch (SQLException e) {
-      assertExceptionMatches(e, ".*unterminated quoted value.*");
-    }
-  }
-
-  /**
-   * Tests most of the examples from the <a
-   * href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/oledb/htm/oledbconnectionstringsyntax.asp">
-   * OLE DB spec</a>. Omitted are cases for Window handles, returning multiple
-   * values, and special handling of "Provider" keyword.
-   */
-  @Test public void testOleDbExamples() throws Throwable {
-    // test the parser with examples from OLE DB documentation
-    Quad[] quads = {
-      // {reason for test, key, val, string to parse},
-      new Quad(
-          "printable chars",
-          "Jet OLE DB:System Database", "c:\\system.mda",
-          "Jet OLE DB:System Database=c:\\system.mda"),
-      new Quad(
-          "key embedded semi",
-          "Authentication;Info", "Column 5",
-          "Authentication;Info=Column 5"),
-      new Quad(
-          "key embedded equal",
-          "Verification=Security", "True",
-          "Verification==Security=True"),
-      new Quad(
-          "key many equals",
-          "Many==One", "Valid",
-          "Many====One=Valid"),
-      new Quad(
-          "key too many equal",
-          "TooMany=", "False",
-          "TooMany===False"),
-      new Quad(
-          "value embedded quote and semi",
-          "ExtProps", "Data Source='localhost';Key Two='value 2'",
-          "ExtProps=\"Data Source='localhost';Key Two='value 2'\""),
-      new Quad(
-          "value embedded double quote and semi",
-          "ExtProps", "Integrated Security=\"SSPI\";Key Two=\"value 2\"",
-          "ExtProps='Integrated Security=\"SSPI\";Key Two=\"value 2\"'"),
-      new Quad(
-          "value double quoted",
-          "DataSchema", "\"MyCustTable\"",
-          "DataSchema='\"MyCustTable\"'"),
-      new Quad(
-          "value single quoted",
-          "DataSchema", "'MyCustTable'",
-          "DataSchema=\"'MyCustTable'\""),
-      new Quad(
-          "value double quoted double trouble",
-          "Caption", "\"Company's \"new\" customer\"",
-          "Caption=\"\"\"Company's \"\"new\"\" customer\"\"\""),
-      new Quad(
-          "value single quoted double trouble",
-          "Caption", "\"Company's \"new\" customer\"",
-          "Caption='\"Company''s \"new\" customer\"'"),
-      new Quad(
-          "embedded blanks and trim",
-          "My Keyword", "My Value",
-          " My Keyword = My Value ;MyNextValue=Value"),
-      new Quad(
-          "value single quotes preserve blanks",
-          "My Keyword", " My Value ",
-          " My Keyword =' My Value ';MyNextValue=Value"),
-      new Quad(
-          "value double quotes preserve blanks",
-          "My Keyword", " My Value ",
-          " My Keyword =\" My Value \";MyNextValue=Value"),
-      new Quad(
-          "last redundant key wins",
-          "SomeKey", "NextValue",
-          "SomeKey=FirstValue;SomeKey=NextValue"),
-    };
-    for (Quad quad : quads) {
-      Properties props = ConnectStringParser.parse(quad.str);
-
-      assertEquals(quad.why, quad.val, props.get(quad.key));
-      String synth = ConnectStringParser.getParamString(props);
-
-      try {
-        assertEquals("reversible " + quad.why, quad.str, synth);
-      } catch (Throwable e) {
-        // it's OK that the strings don't match as long as the
-        // two strings parse out the same way and are thus
-        // "semantically reversible"
-        Properties synthProps = ConnectStringParser.parse(synth);
-        assertEquals("equivalent " + quad.why, props, synthProps);
-      }
-    }
-  }
-
-  static void assertExceptionMatches(
-      Throwable e,
-      String expectedPattern) {
-    if (e == null) {
-      fail("Expected an error which matches pattern '" + expectedPattern + "'");
-    }
-    String msg = e.toString();
-    if (!msg.matches(expectedPattern)) {
-      fail("Got a different error '" + msg + "' than expected '"
-          + expectedPattern + "'");
-    }
-  }
-
-  /** Collection of values comprising a test. */
-  static class Quad {
-    private final String why;
-    private final String key;
-    private final String val;
-    private final String str;
-
-    Quad(String why, String key, String val, String str) {
-      this.why = why;
-      this.key = key;
-      this.val = val;
-      this.str = str;
-    }
-  }
-}
-
-// End ConnectStringParserTest.java


[26/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/pom.xml
----------------------------------------------------------------------
diff --git a/avatica/pom.xml b/avatica/pom.xml
deleted file mode 100644
index 5860bd9..0000000
--- a/avatica/pom.xml
+++ /dev/null
@@ -1,815 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <parent>
-    <groupId>org.apache</groupId>
-    <artifactId>apache</artifactId>
-    <version>18</version>
-    <!-- Tell Maven that it's OK that we're not attached to the parent directory -->
-    <relativePath />
-  </parent>
-
-  <!-- The basics. -->
-  <groupId>org.apache.calcite.avatica</groupId>
-  <artifactId>avatica-parent</artifactId>
-  <packaging>pom</packaging>
-  <version>1.10.0-SNAPSHOT</version>
-
-  <!-- More project information. -->
-  <name>Apache Calcite Avatica Project</name>
-  <description>Avatica is a JDBC driver framework which is a part of Apache Calcite</description>
-  <url>https://calcite.apache.org/avatica</url>
-  <inceptionYear>2012</inceptionYear>
-
-  <mailingLists>
-    <mailingList>
-      <name>Apache Calcite developers list</name>
-      <subscribe>dev-subscribe@calcite.apache.org</subscribe>
-      <unsubscribe>dev-unsubscribe@calcite.apache.org</unsubscribe>
-      <post>dev@calcite.apache.org</post>
-      <archive>https://mail-archives.apache.org/mod_mbox/calcite-dev</archive>
-    </mailingList>
-  </mailingLists>
-
-  <properties>
-    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-    <top.dir>${project.basedir}</top.dir>
-    <avatica.release.version>${project.version}</avatica.release.version>
-    <version.major>1</version.major>
-    <version.minor>9</version.minor>
-    <!-- This list is in alphabetical order. -->
-    <bouncycastle.version>1.55</bouncycastle.version>
-    <build-helper-maven-plugin.version>1.9</build-helper-maven-plugin.version>
-    <checksum-maven-plugin.version>1.2</checksum-maven-plugin.version>
-    <dropwizard-metrics3.version>3.1.2</dropwizard-metrics3.version>
-    <forbiddenapis.version>2.3</forbiddenapis.version>
-    <freemarker.version>2.3.19</freemarker.version>
-    <git-commit-id-plugin.version>2.1.9</git-commit-id-plugin.version>
-    <!-- We support guava versions as old as 14.0.1 (the version used by Hive)
-         but prefer more recent versions. -->
-    <guava.version>14.0.1</guava.version>
-    <h2.version>1.4.185</h2.version>
-    <hamcrest.version>1.3</hamcrest.version>
-    <hsqldb.version>2.3.1</hsqldb.version>
-    <httpclient.version>4.5.2</httpclient.version>
-    <httpcore.version>4.4.4</httpcore.version>
-    <hydromatic-toolbox.version>0.3</hydromatic-toolbox.version>
-    <jackson.version>2.6.3</jackson.version>
-    <jcip-annotations.version>1.0-1</jcip-annotations.version>
-    <jcommander.version>1.48</jcommander.version>
-    <jetty.version>9.2.19.v20160908</jetty.version>
-    <junit.version>4.12</junit.version>
-    <kerby.version>1.0.0-RC2</kerby.version>
-    <maven-checkstyle-plugin.version>2.12.1</maven-checkstyle-plugin.version>
-    <maven-dependency-plugin.version>2.10</maven-dependency-plugin.version>
-    <!-- Apache 18 has 2.10.3, need 2.10.4 for [MJAVADOC-442]. -->
-    <maven-javadoc-plugin.version>2.10.4</maven-javadoc-plugin.version>
-    <maven-scm-provider.version>1.9.4</maven-scm-provider.version>
-    <maven-shade-plugin.version>2.1</maven-shade-plugin.version>
-    <mockito.version>2.5.5</mockito.version>
-    <protobuf.version>3.1.0</protobuf.version>
-    <scott-data-hsqldb.version>0.1</scott-data-hsqldb.version>
-    <servlet.version>3.0.1</servlet.version>
-    <slf4j.version>1.7.13</slf4j.version>
-  </properties>
-
-  <issueManagement>
-    <system>Jira</system>
-    <url>https://issues.apache.org/jira/browse/CALCITE</url>
-  </issueManagement>
-
-  <scm>
-    <connection>scm:git:https://git-wip-us.apache.org/repos/asf/calcite.git</connection>
-    <developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/calcite.git</developerConnection>
-    <url>https://github.com/apache/calcite</url>
-    <tag>HEAD</tag>
-  </scm>
-
-  <modules>
-    <module>core</module>
-    <module>metrics</module>
-    <module>metrics-dropwizardmetrics3</module>
-    <module>noop-driver</module>
-    <module>server</module>
-    <module>tck</module>
-    <module>standalone-server</module>
-    <module>shaded/core</module>
-  </modules>
-
-  <!-- No dependencies here. Declare dependency VERSIONS in
-       dependencyManagement, below, and each dependency in the module that uses
-       it. -->
-  <dependencies />
-
-  <dependencyManagement>
-    <dependencies>
-      <!-- Sorted by groupId, artifactId; calcite dependencies first. -->
-      <dependency>
-        <groupId>org.apache.calcite.avatica</groupId>
-        <artifactId>avatica</artifactId>
-        <version>${project.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.apache.calcite.avatica</groupId>
-        <artifactId>avatica-core</artifactId>
-        <version>${project.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.apache.calcite.avatica</groupId>
-        <artifactId>avatica-metrics</artifactId>
-        <version>${project.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.apache.calcite.avatica</groupId>
-        <artifactId>avatica-noop</artifactId>
-        <version>${project.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.apache.calcite.avatica</groupId>
-        <artifactId>avatica-tck</artifactId>
-        <version>${project.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.apache.calcite.avatica</groupId>
-        <artifactId>avatica-server</artifactId>
-        <version>${project.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.apache.calcite.avatica</groupId>
-        <artifactId>avatica-core</artifactId>
-        <version>${project.version}</version>
-        <type>test-jar</type>
-      </dependency>
-
-      <!-- Now third-party dependencies, sorted by groupId and artifactId. -->
-      <dependency>
-        <groupId>com.beust</groupId>
-        <artifactId>jcommander</artifactId>
-        <version>${jcommander.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>com.fasterxml.jackson.core</groupId>
-        <artifactId>jackson-core</artifactId>
-        <version>${jackson.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>com.fasterxml.jackson.core</groupId>
-        <artifactId>jackson-annotations</artifactId>
-        <version>${jackson.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>com.fasterxml.jackson.core</groupId>
-        <artifactId>jackson-databind</artifactId>
-        <version>${jackson.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>com.github.stephenc.jcip</groupId>
-        <artifactId>jcip-annotations</artifactId>
-        <version>${jcip-annotations.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>com.google.guava</groupId>
-        <artifactId>guava</artifactId>
-        <version>${guava.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>com.google.protobuf</groupId>
-        <artifactId>protobuf-java</artifactId>
-        <version>${protobuf.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>com.h2database</groupId>
-        <artifactId>h2</artifactId>
-        <version>${h2.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>javax.servlet</groupId>
-        <artifactId>javax.servlet-api</artifactId>
-        <version>${servlet.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>junit</groupId>
-        <artifactId>junit</artifactId>
-        <version>${junit.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>net.hydromatic</groupId>
-        <artifactId>scott-data-hsqldb</artifactId>
-        <version>${scott-data-hsqldb.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.apache.kerby</groupId>
-        <artifactId>kerb-client</artifactId>
-        <version>${kerby.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.apache.kerby</groupId>
-        <artifactId>kerb-core</artifactId>
-        <version>${kerby.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.apache.kerby</groupId>
-        <artifactId>kerb-simplekdc</artifactId>
-        <version>${kerby.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.apache.httpcomponents</groupId>
-        <artifactId>httpclient</artifactId>
-        <version>${httpclient.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.apache.httpcomponents</groupId>
-        <artifactId>httpcore</artifactId>
-        <version>${httpcore.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.bouncycastle</groupId>
-        <artifactId>bcpkix-jdk15on</artifactId>
-        <version>${bouncycastle.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.bouncycastle</groupId>
-        <artifactId>bcprov-jdk15on</artifactId>
-        <version>${bouncycastle.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.mockito</groupId>
-        <artifactId>mockito-core</artifactId>
-        <version>${mockito.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.hamcrest</groupId>
-        <artifactId>hamcrest-core</artifactId>
-        <version>${hamcrest.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.hsqldb</groupId>
-        <artifactId>hsqldb</artifactId>
-        <version>${hsqldb.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.eclipse.jetty</groupId>
-        <artifactId>jetty-security</artifactId>
-        <version>${jetty.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.eclipse.jetty</groupId>
-        <artifactId>jetty-server</artifactId>
-        <version>${jetty.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.eclipse.jetty</groupId>
-        <artifactId>jetty-util</artifactId>
-        <version>${jetty.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.slf4j</groupId>
-        <artifactId>slf4j-api</artifactId>
-        <version>${slf4j.version}</version>
-      </dependency>
-      <dependency>
-        <groupId>org.slf4j</groupId>
-        <artifactId>slf4j-log4j12</artifactId>
-        <version>${slf4j.version}</version>
-      </dependency>
-    </dependencies>
-  </dependencyManagement>
-
-  <build>
-    <extensions>
-      <extension>
-        <groupId>kr.motd.maven</groupId>
-        <artifactId>os-maven-plugin</artifactId>
-        <version>1.5.0.Final</version>
-      </extension>
-    </extensions>
-    <plugins>
-      <plugin>
-        <groupId>de.thetaphi</groupId>
-        <artifactId>forbiddenapis</artifactId>
-        <configuration>
-          <!-- if the used Java version is too new, don't fail, just do nothing: -->
-          <failOnUnsupportedJava>false</failOnUnsupportedJava>
-          <bundledSignatures>
-            <!--
-              This will automatically choose the right
-              signatures based on 'maven.compiler.target':
-            -->
-            <bundledSignature>jdk-unsafe</bundledSignature>
-            <bundledSignature>jdk-deprecated</bundledSignature>
-            <!-- disallow undocumented classes like sun.misc.Unsafe: -->
-            <bundledSignature>jdk-non-portable</bundledSignature>
-          </bundledSignatures>
-          <signaturesFiles>
-            <signaturesFile>${top.dir}/src/main/config/forbidden-apis/signatures.txt</signaturesFile>
-          </signaturesFiles>
-          <excludes>
-            <exclude>**/org/apache/calcite/avatica/tck/Unsafe.class</exclude>
-            <exclude>**/org/apache/calcite/avatica/util/Unsafe.class</exclude>
-          </excludes>
-        </configuration>
-        <executions>
-          <execution>
-            <goals>
-              <goal>check</goal>
-              <goal>testCheck</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.rat</groupId>
-        <artifactId>apache-rat-plugin</artifactId>
-        <configuration>
-          <excludes>
-            <!-- Do not exclude site/target; it should not exist
-                 in any sandbox from which you are making a
-                 release. Also, do not exclude site/.sass-cache. -->
-            <!-- Files generated by Jekyll. -->
-            <exclude>site/_includes/anchor_links.html</exclude>
-            <exclude>site/_includes/docs_contents.html</exclude>
-            <exclude>site/_includes/docs_contents_mobile.html</exclude>
-            <exclude>site/_includes/docs_option.html</exclude>
-            <exclude>site/_includes/docs_ul.html</exclude>
-            <exclude>site/_includes/footer.html</exclude>
-            <exclude>site/_includes/header.html</exclude>
-            <exclude>site/_includes/news_contents.html</exclude>
-            <exclude>site/_includes/news_contents_mobile.html</exclude>
-            <exclude>site/_includes/news_item.html</exclude>
-            <exclude>site/_includes/primary-nav-items.html</exclude>
-            <exclude>site/_includes/section_nav.html</exclude>
-            <exclude>site/_includes/top.html</exclude>
-            <exclude>site/_layouts/default.html</exclude>
-            <exclude>site/_layouts/docs.html</exclude>
-            <exclude>site/_layouts/external.html</exclude>
-            <exclude>site/_layouts/news.html</exclude>
-            <exclude>site/_layouts/news_item.html</exclude>
-            <exclude>site/_layouts/page.html</exclude>
-            <exclude>site/_sass/**</exclude>
-            <exclude>site/css/screen.scss</exclude>
-            <exclude>site/fonts/**</exclude>
-            <exclude>site/js/**</exclude>
-            <!-- Images -->
-            <exclude>site/img/*.png</exclude>
-            <exclude>site/favicon.ico</exclude>
-          </excludes>
-        </configuration>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-source-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>attach-sources</id>
-            <phase>verify</phase>
-            <goals>
-              <goal>jar-no-fork</goal>
-              <goal>test-jar-no-fork</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-compiler-plugin</artifactId>
-        <configuration>
-          <source>1.7</source>
-          <target>1.7</target>
-          <compilerArgument>-Xlint:deprecation</compilerArgument>
-        </configuration>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-checkstyle-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>validate</id>
-            <phase>validate</phase>
-            <configuration>
-              <configLocation>${top.dir}/src/main/config/checkstyle/checker.xml</configLocation>
-              <suppressionsLocation>${top.dir}/src/main/config/checkstyle/suppressions.xml</suppressionsLocation>
-              <consoleOutput>true</consoleOutput>
-              <headerLocation>${top.dir}/src/main/config/checkstyle/header.txt</headerLocation>
-              <failOnViolation>true</failOnViolation>
-              <includeTestSourceDirectory>true</includeTestSourceDirectory>
-            </configuration>
-            <goals>
-              <goal>check</goal>
-            </goals>
-          </execution>
-        </executions>
-        <dependencies>
-          <dependency>
-            <groupId>net.hydromatic</groupId>
-            <artifactId>toolbox</artifactId>
-            <version>${hydromatic-toolbox.version}</version>
-          </dependency>
-        </dependencies>
-      </plugin>
-      <plugin>
-        <!-- override default version 2.8 for access to additional config settings -->
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-dependency-plugin</artifactId>
-        <version>${maven-dependency-plugin.version}</version>
-        <executions>
-          <execution>
-            <id>analyze</id>
-            <goals>
-              <goal>analyze-only</goal>
-            </goals>
-            <configuration>
-              <failOnWarning>true</failOnWarning>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <!-- This is the configuration used by "mvn javadoc:javadoc". It is
-             configured strict, so that it shows errors such as broken links in
-             javadoc on private methods. The configuration for "mvn site" is
-             under "reporting", and is more lenient. -->
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-javadoc-plugin</artifactId>
-        <configuration>
-          <links>
-            <link>https://docs.oracle.com/javase/8/docs/api/</link>
-          </links>
-          <show>private</show>
-        </configuration>
-      </plugin>
-      <plugin>
-        <!-- Override apache parent POM's definition of release
-             plugin. If we don't specify gitexe version, git doesn't
-             commit during release process. -->
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-release-plugin</artifactId>
-        <dependencies>
-          <dependency>
-            <groupId>org.apache.maven.scm</groupId>
-            <artifactId>maven-scm-provider-gitexe</artifactId>
-            <version>${maven-scm-provider.version}</version>
-          </dependency>
-        </dependencies>
-      </plugin>
-      <plugin>
-        <groupId>org.codehaus.mojo</groupId>
-        <artifactId>build-helper-maven-plugin</artifactId>
-        <!-- Make sure every sub-project has LICENSE, NOTICE and
-             git.properties in its jar's META-INF directory. -->
-        <executions>
-          <execution>
-            <id>add-resource</id>
-            <phase>generate-resources</phase>
-            <goals>
-              <goal>add-resource</goal>
-              <goal>add-test-resource</goal>
-            </goals>
-            <configuration>
-              <resources>
-                <resource>
-                  <directory>${top.dir}</directory>
-                  <targetPath>META-INF</targetPath>
-                  <includes>
-                    <include>LICENSE</include>
-                    <include>NOTICE</include>
-                  </includes>
-                </resource>
-                <resource>
-                  <directory>${top.dir}/target</directory>
-                  <targetPath>META-INF</targetPath>
-                  <includes>
-                    <include>git.properties</include>
-                  </includes>
-                </resource>
-              </resources>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-
-    <pluginManagement>
-      <plugins>
-        <!-- Sorted by groupId, artifactId. -->
-        <plugin>
-          <groupId>com.googlecode.fmpp-maven-plugin</groupId>
-          <artifactId>fmpp-maven-plugin</artifactId>
-          <version>${fmpp-maven-plugin.version}</version>
-          <dependencies>
-            <dependency>
-              <groupId>org.freemarker</groupId>
-              <artifactId>freemarker</artifactId>
-              <version>${freemarker.version}</version>
-            </dependency>
-          </dependencies>
-        </plugin>
-        <plugin>
-          <groupId>de.thetaphi</groupId>
-          <artifactId>forbiddenapis</artifactId>
-          <version>${forbiddenapis.version}</version>
-        </plugin>
-        <plugin>
-          <groupId>net.hydromatic</groupId>
-          <artifactId>hydromatic-resource-maven-plugin</artifactId>
-          <version>${hydromatic-resource.version}</version>
-        </plugin>
-        <plugin>
-          <groupId>net.ju-n.maven.plugins</groupId>
-          <artifactId>checksum-maven-plugin</artifactId>
-          <version>${checksum-maven-plugin.version}</version>
-        </plugin>
-        <plugin>
-          <groupId>org.apache.maven.plugins</groupId>
-          <artifactId>maven-checkstyle-plugin</artifactId>
-          <version>${maven-checkstyle-plugin.version}</version>
-        </plugin>
-        <plugin>
-          <groupId>org.apache.maven.plugins</groupId>
-          <artifactId>maven-failsafe-plugin</artifactId>
-          <executions>
-            <execution>
-              <id>failsafe-integration-test</id>
-              <goals>
-                <goal>integration-test</goal>
-              </goals>
-              <phase>integration-test</phase>
-              <configuration>
-                <threadCount>6</threadCount>
-                <parallel>both</parallel>
-                <argLine>-Xmx1024m</argLine>
-              </configuration>
-            </execution>
-            <execution>
-              <id>failsafe-verify</id>
-              <goals>
-                <goal>verify</goal>
-              </goals>
-              <phase>verify</phase>
-            </execution>
-          </executions>
-        </plugin>
-        <plugin>
-          <groupId>org.apache.maven.plugins</groupId>
-          <artifactId>maven-javadoc-plugin</artifactId>
-          <version>${maven-javadoc-plugin.version}</version>
-        </plugin>
-        <plugin>
-          <groupId>org.apache.maven.plugins</groupId>
-          <artifactId>maven-shade-plugin</artifactId>
-          <version>${maven-shade-plugin.version}</version>
-        </plugin>
-        <plugin>
-          <groupId>org.apache.maven.plugins</groupId>
-          <artifactId>maven-source-plugin</artifactId>
-        </plugin>
-        <plugin>
-          <groupId>org.apache.maven.plugins</groupId>
-          <artifactId>maven-surefire-plugin</artifactId>
-          <configuration>
-            <argLine>-Xmx1536m -XX:MaxPermSize=256m -Duser.timezone=${user.timezone}</argLine>
-          </configuration>
-        </plugin>
-        <plugin>
-          <groupId>org.codehaus.mojo</groupId>
-          <artifactId>build-helper-maven-plugin</artifactId>
-          <version>${build-helper-maven-plugin.version}</version>
-        </plugin>
-        <plugin>
-          <groupId>org.codehaus.mojo</groupId>
-          <artifactId>javacc-maven-plugin</artifactId>
-          <version>${javacc-maven-plugin.version}</version>
-        </plugin>
-        <plugin>
-          <groupId>pl.project13.maven</groupId>
-          <artifactId>git-commit-id-plugin</artifactId>
-          <version>${git-commit-id-plugin.version}</version>
-        </plugin>
-        <plugin>
-          <groupId>org.xolstice.maven.plugins</groupId>
-          <artifactId>protobuf-maven-plugin</artifactId>
-          <version>0.5.0</version>
-          <configuration>
-            <protocArtifact>com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier}</protocArtifact>
-            <protoSourceRoot>${basedir}/src/main/protobuf/</protoSourceRoot>
-            <outputDirectory>${basedir}/src/main/java/</outputDirectory>
-            <clearOutputDirectory>false</clearOutputDirectory>
-            <checkStaleness>true</checkStaleness>
-          </configuration>
-        </plugin>
-      </plugins>
-    </pluginManagement>
-  </build>
-
-  <reporting>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-javadoc-plugin</artifactId>
-        <configuration>
-          <links>
-            <link>https://docs.oracle.com/javase/8/docs/api/</link>
-          </links>
-          <notimestamp>true</notimestamp>
-          <windowtitle>Apache Calcite Avatica API</windowtitle>
-        </configuration>
-      </plugin>
-    </plugins>
-  </reporting>
-
-  <repositories>
-    <repository>
-      <id>central</id>
-      <name>Central Repository</name>
-      <url>http://repo.maven.apache.org/maven2</url>
-      <layout>default</layout>
-      <snapshots>
-        <enabled>false</enabled>
-      </snapshots>
-    </repository>
-  </repositories>
-
-  <profiles>
-    <profile>
-      <!-- This profile adds/overrides few features of the 'apache-release'
-           profile in the parent pom. -->
-      <id>apache-release</id>
-      <build>
-        <plugins>
-          <!-- Apache-RAT checks for files without headers.
-               If run on a messy developer's sandbox, it will fail.
-               This serves as a reminder to only build a release in a clean
-               sandbox! -->
-          <plugin>
-            <groupId>org.apache.rat</groupId>
-            <artifactId>apache-rat-plugin</artifactId>
-            <executions>
-              <execution>
-                <phase>verify</phase>
-                <goals>
-                  <goal>check</goal>
-                </goals>
-              </execution>
-            </executions>
-          </plugin>
-          <plugin>
-            <groupId>net.ju-n.maven.plugins</groupId>
-            <artifactId>checksum-maven-plugin</artifactId>
-            <executions>
-              <execution>
-                <goals>
-                  <goal>artifacts</goal>
-                </goals>
-              </execution>
-            </executions>
-            <configuration>
-              <algorithms>
-                <algorithm>MD5</algorithm>
-                <algorithm>SHA-1</algorithm>
-              </algorithms>
-              <failOnError>false</failOnError>
-            </configuration>
-          </plugin>
-          <!-- Override the parent assembly execution to customize the assembly
-               descriptor and final name. -->
-          <plugin>
-            <artifactId>maven-assembly-plugin</artifactId>
-            <executions>
-              <execution>
-                <id>source-release-assembly</id>
-                <phase>none</phase>
-              </execution>
-              <execution>
-                <id>source-release-assembly-calcite</id>
-                <phase>package</phase>
-                <goals>
-                  <goal>single</goal>
-                </goals>
-                <configuration>
-                  <runOnlyAtExecutionRoot>true</runOnlyAtExecutionRoot>
-                  <appendAssemblyId>false</appendAssemblyId>
-                  <descriptor>${top.dir}/src/main/config/assemblies/source-assembly.xml</descriptor>
-                  <finalName>apache-calcite-avatica-${project.version}-src</finalName>
-                  <tarLongFileMode>gnu</tarLongFileMode>
-                </configuration>
-              </execution>
-            </executions>
-          </plugin>
-          <plugin>
-            <artifactId>maven-remote-resources-plugin</artifactId>
-            <executions>
-              <execution>
-                <id>root-resources</id>
-                <goals>
-                  <goal>process</goal>
-                </goals>
-                <configuration>
-                  <runOnlyAtExecutionRoot>true</runOnlyAtExecutionRoot>
-                  <resourceBundles>
-                    <resourceBundle>org.apache:apache-jar-resource-bundle:1.4</resourceBundle>
-                  </resourceBundles>
-                </configuration>
-              </execution>
-            </executions>
-          </plugin>
-        </plugins>
-      </build>
-    </profile>
-    <profile>
-      <id>it</id>
-      <build>
-        <plugins>
-          <plugin>
-            <groupId>org.apache.maven.plugins</groupId>
-            <artifactId>maven-failsafe-plugin</artifactId>
-          </plugin>
-        </plugins>
-      </build>
-    </profile>
-    <profile>
-      <!-- CALCITE-537: workaround for MRRESOURCES-91
-        Avoid overwrite of the destination file if the produced
-        contents is the same.
-        Apache pom overwrites NOTICE, DEPENDENCIES, and LICENSE files, however
-        we do not want recompile the module every time. -->
-      <id>skip-apache-licenses</id>
-      <activation>
-        <activeByDefault>true</activeByDefault>
-        <file><exists>target/maven-shared-archive-resources/META-INF/LICENSE</exists></file>
-      </activation>
-      <build>
-        <plugins>
-          <plugin>
-            <groupId>org.apache.maven.plugins</groupId>
-            <artifactId>maven-remote-resources-plugin</artifactId>
-            <configuration>
-              <skip>true</skip>
-            </configuration>
-          </plugin>
-        </plugins>
-      </build>
-    </profile>
-    <profile>
-      <!-- Generate git.properties on first build -->
-      <id>generate-git-id</id>
-      <activation>
-        <activeByDefault>false</activeByDefault>
-        <!-- Note: <missing> here does NOT support interpolation,
-        so technically, this profile is active for sub-modules.
-        It would be nice to use ${top.dir}/target/... here, but
-        it is not possible.
-        However sub-modules lack .git folder, so no git.properties
-        is generated. -->
-        <file>
-          <missing>target/git.properties</missing>
-        </file>
-      </activation>
-      <build>
-        <plugins>
-          <plugin>
-            <groupId>pl.project13.maven</groupId>
-            <artifactId>git-commit-id-plugin</artifactId>
-            <inherited>false</inherited>
-            <executions>
-              <execution>
-                <goals>
-                  <goal>revision</goal>
-                </goals>
-              </execution>
-            </executions>
-            <configuration>
-              <dateFormat>yyyy-MM-dd'T'HH:mm:ssZ</dateFormat>
-              <verbose>false</verbose>
-              <skipPoms>false</skipPoms>
-              <generateGitPropertiesFile>true</generateGitPropertiesFile>
-              <generateGitPropertiesFilename>target/git.properties</generateGitPropertiesFilename>
-              <failOnNoGitDirectory>false</failOnNoGitDirectory>
-              <gitDescribe>
-                <skip>false</skip>
-                <always>false</always>
-                <abbrev>7</abbrev>
-                <dirty>-dirty</dirty>
-                <forceLongFormat>true</forceLongFormat>
-              </gitDescribe>
-            </configuration>
-          </plugin>
-        </plugins>
-      </build>
-    </profile>
-  </profiles>
-</project>

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/server/pom.xml
----------------------------------------------------------------------
diff --git a/avatica/server/pom.xml b/avatica/server/pom.xml
deleted file mode 100644
index f2eee25..0000000
--- a/avatica/server/pom.xml
+++ /dev/null
@@ -1,223 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <parent>
-    <groupId>org.apache.calcite.avatica</groupId>
-    <artifactId>avatica-parent</artifactId>
-    <version>1.10.0-SNAPSHOT</version>
-  </parent>
-
-  <artifactId>avatica-server</artifactId>
-  <packaging>jar</packaging>
-  <name>Apache Calcite Avatica Server</name>
-  <description>JDBC server.</description>
-
-  <properties>
-    <top.dir>${project.basedir}/..</top.dir>
-  </properties>
-
-  <dependencies>
-    <!-- Sorted by groupId, artifactId; calcite dependencies first. Put versions
-         in dependencyManagement in the root POM, not here. -->
-    <dependency>
-      <groupId>org.apache.calcite.avatica</groupId>
-      <artifactId>avatica-core</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.calcite.avatica</groupId>
-      <artifactId>avatica-metrics</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>javax.servlet</groupId>
-      <artifactId>javax.servlet-api</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>com.google.guava</groupId>
-      <artifactId>guava</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-api</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.eclipse.jetty</groupId>
-      <artifactId>jetty-security</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.eclipse.jetty</groupId>
-      <artifactId>jetty-server</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.eclipse.jetty</groupId>
-      <artifactId>jetty-util</artifactId>
-    </dependency>
-
-    <!-- test dependencies -->
-    <dependency>
-      <groupId>org.apache.calcite.avatica</groupId>
-      <artifactId>avatica-core</artifactId>
-      <type>test-jar</type>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>com.fasterxml.jackson.core</groupId>
-      <artifactId>jackson-databind</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <!-- Used in RemoteDriverTest but dependency not detected by maven-dependency-plugin:2.8:analyze -->
-      <groupId>net.hydromatic</groupId>
-      <artifactId>scott-data-hsqldb</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.kerby</groupId>
-      <artifactId>kerb-client</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.kerby</groupId>
-      <artifactId>kerb-core</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.kerby</groupId>
-      <artifactId>kerb-simplekdc</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.hamcrest</groupId>
-      <artifactId>hamcrest-core</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <!-- Used in RemoteDriverTest but dependency not detected by maven-dependency-plugin:2.8:analyze -->
-      <groupId>org.hsqldb</groupId>
-      <artifactId>hsqldb</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.mockito</groupId>
-      <artifactId>mockito-core</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>com.github.stephenc.jcip</groupId>
-      <artifactId>jcip-annotations</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-log4j12</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.bouncycastle</groupId>
-      <artifactId>bcpkix-jdk15on</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.bouncycastle</groupId>
-      <artifactId>bcprov-jdk15on</artifactId>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
-
-  <build>
-    <pluginManagement>
-      <plugins>
-        <plugin>
-          <groupId>org.eclipse.m2e</groupId>
-          <artifactId>lifecycle-mapping</artifactId>
-          <version>1.0.0</version>
-          <configuration>
-            <lifecycleMappingMetadata>
-              <pluginExecutions>
-                <pluginExecution>
-                  <pluginExecutionFilter>
-                    <groupId>org.apache.maven.plugins</groupId>
-                    <artifactId>maven-checkstyle-plugin</artifactId>
-                    <versionRange>[2.12.1,)</versionRange>
-                    <goals>
-                      <goal>check</goal>
-                    </goals>
-                  </pluginExecutionFilter>
-                  <action>
-                    <ignore />
-                  </action>
-                </pluginExecution>
-              </pluginExecutions>
-            </lifecycleMappingMetadata>
-          </configuration>
-        </plugin>
-      </plugins>
-    </pluginManagement>
-    <plugins>
-      <!-- Parent module has the same plugin and does the work of
-           generating -sources.jar for each project. But without the
-           plugin declared here, IDEs don't know the sources are
-           available. -->
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-source-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>attach-sources</id>
-            <phase>verify</phase>
-            <goals>
-              <goal>jar-no-fork</goal>
-              <goal>test-jar-no-fork</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-dependency-plugin</artifactId>
-        <version>${maven-dependency-plugin.version}</version>
-        <!-- configurations do not cascade, so all of the definition from
-             ../pom.xml:build:plugin-management:plugins:plugin must be repeated in child poms -->
-        <executions>
-          <execution>
-            <id>analyze</id>
-            <goals>
-              <goal>analyze-only</goal>
-            </goals>
-            <configuration>
-              <failOnWarning>true</failOnWarning>
-              <!-- ignore "unused but declared" warnings -->
-              <ignoredUnusedDeclaredDependencies>
-                <ignoredUnusedDeclaredDependency>io.dropwizard.metrics:metrics-core</ignoredUnusedDeclaredDependency>
-                <ignoredUnusedDeclaredDependency>net.hydromatic:scott-data-hsqldb</ignoredUnusedDeclaredDependency>
-                <ignoredUnusedDeclaredDependency>org.hsqldb:hsqldb</ignoredUnusedDeclaredDependency>
-                <ignoredUnusedDeclaredDependency>org.slf4j:slf4j-api</ignoredUnusedDeclaredDependency>
-                <ignoredUnusedDeclaredDependency>org.slf4j:slf4j-log4j12</ignoredUnusedDeclaredDependency>
-              </ignoredUnusedDeclaredDependencies>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-</project>

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/server/src/main/java/org/apache/calcite/avatica/jdbc/JdbcMeta.java
----------------------------------------------------------------------
diff --git a/avatica/server/src/main/java/org/apache/calcite/avatica/jdbc/JdbcMeta.java b/avatica/server/src/main/java/org/apache/calcite/avatica/jdbc/JdbcMeta.java
deleted file mode 100644
index 4756e8d..0000000
--- a/avatica/server/src/main/java/org/apache/calcite/avatica/jdbc/JdbcMeta.java
+++ /dev/null
@@ -1,1101 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.jdbc;
-
-import org.apache.calcite.avatica.AvaticaParameter;
-import org.apache.calcite.avatica.AvaticaPreparedStatement;
-import org.apache.calcite.avatica.AvaticaUtils;
-import org.apache.calcite.avatica.ColumnMetaData;
-import org.apache.calcite.avatica.ConnectionPropertiesImpl;
-import org.apache.calcite.avatica.Meta;
-import org.apache.calcite.avatica.MetaImpl;
-import org.apache.calcite.avatica.MissingResultsException;
-import org.apache.calcite.avatica.NoSuchConnectionException;
-import org.apache.calcite.avatica.NoSuchStatementException;
-import org.apache.calcite.avatica.QueryState;
-import org.apache.calcite.avatica.SqlType;
-import org.apache.calcite.avatica.metrics.Gauge;
-import org.apache.calcite.avatica.metrics.MetricsSystem;
-import org.apache.calcite.avatica.metrics.noop.NoopMetricsSystem;
-import org.apache.calcite.avatica.proto.Common;
-import org.apache.calcite.avatica.proto.Requests;
-import org.apache.calcite.avatica.remote.ProtobufMeta;
-import org.apache.calcite.avatica.remote.TypedValue;
-import org.apache.calcite.avatica.util.Unsafe;
-
-import com.google.common.cache.Cache;
-import com.google.common.cache.CacheBuilder;
-import com.google.common.cache.RemovalListener;
-import com.google.common.cache.RemovalNotification;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import static org.apache.calcite.avatica.remote.MetricsHelper.concat;
-
-import java.lang.reflect.InvocationTargetException;
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.DriverManager;
-import java.sql.ParameterMetaData;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.sql.Types;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Properties;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-
-/** Implementation of {@link Meta} upon an existing JDBC data source. */
-public class JdbcMeta implements ProtobufMeta {
-  private static final Logger LOG = LoggerFactory.getLogger(JdbcMeta.class);
-
-  private static final String CONN_CACHE_KEY_BASE = "avatica.connectioncache";
-
-  private static final String STMT_CACHE_KEY_BASE = "avatica.statementcache";
-
-  /** Special value for {@code Statement#getLargeMaxRows()} that means fetch
-   * an unlimited number of rows in a single batch.
-   *
-   * <p>Any other negative value will return an unlimited number of rows but
-   * will do it in the default batch size, namely 100. */
-  public static final int UNLIMITED_COUNT = -2;
-
-  // End of constants, start of member variables
-
-  final Calendar calendar = Unsafe.localCalendar();
-
-  /** Generates ids for statements. The ids are unique across all connections
-   * created by this JdbcMeta. */
-  private final AtomicInteger statementIdGenerator = new AtomicInteger();
-
-  private final String url;
-  private final Properties info;
-  private final Cache<String, Connection> connectionCache;
-  private final Cache<Integer, StatementInfo> statementCache;
-  private final MetricsSystem metrics;
-
-  /**
-   * Creates a JdbcMeta.
-   *
-   * @param url a database url of the form
-   *  <code>jdbc:<em>subprotocol</em>:<em>subname</em></code>
-   */
-  public JdbcMeta(String url) throws SQLException {
-    this(url, new Properties());
-  }
-
-  /**
-   * Creates a JdbcMeta.
-   *
-   * @param url a database url of the form
-   * <code>jdbc:<em>subprotocol</em>:<em>subname</em></code>
-   * @param user the database user on whose behalf the connection is being
-   *   made
-   * @param password the user's password
-   */
-  public JdbcMeta(final String url, final String user, final String password)
-      throws SQLException {
-    this(url, new Properties() {
-      {
-        put("user", user);
-        put("password", password);
-      }
-    });
-  }
-
-  public JdbcMeta(String url, Properties info) throws SQLException {
-    this(url, info, NoopMetricsSystem.getInstance());
-  }
-
-  /**
-   * Creates a JdbcMeta.
-   *
-   * @param url a database url of the form
-   * <code> jdbc:<em>subprotocol</em>:<em>subname</em></code>
-   * @param info a list of arbitrary string tag/value pairs as
-   * connection arguments; normally at least a "user" and
-   * "password" property should be included
-   */
-  public JdbcMeta(String url, Properties info, MetricsSystem metrics)
-      throws SQLException {
-    this.url = url;
-    this.info = info;
-    this.metrics = Objects.requireNonNull(metrics);
-
-    int concurrencyLevel = Integer.parseInt(
-        info.getProperty(ConnectionCacheSettings.CONCURRENCY_LEVEL.key(),
-            ConnectionCacheSettings.CONCURRENCY_LEVEL.defaultValue()));
-    int initialCapacity = Integer.parseInt(
-        info.getProperty(ConnectionCacheSettings.INITIAL_CAPACITY.key(),
-            ConnectionCacheSettings.INITIAL_CAPACITY.defaultValue()));
-    long maxCapacity = Long.parseLong(
-        info.getProperty(ConnectionCacheSettings.MAX_CAPACITY.key(),
-            ConnectionCacheSettings.MAX_CAPACITY.defaultValue()));
-    long connectionExpiryDuration = Long.parseLong(
-        info.getProperty(ConnectionCacheSettings.EXPIRY_DURATION.key(),
-            ConnectionCacheSettings.EXPIRY_DURATION.defaultValue()));
-    TimeUnit connectionExpiryUnit = TimeUnit.valueOf(
-        info.getProperty(ConnectionCacheSettings.EXPIRY_UNIT.key(),
-            ConnectionCacheSettings.EXPIRY_UNIT.defaultValue()));
-    this.connectionCache = CacheBuilder.newBuilder()
-        .concurrencyLevel(concurrencyLevel)
-        .initialCapacity(initialCapacity)
-        .maximumSize(maxCapacity)
-        .expireAfterAccess(connectionExpiryDuration, connectionExpiryUnit)
-        .removalListener(new ConnectionExpiryHandler())
-        .build();
-    LOG.debug("instantiated connection cache: {}", connectionCache.stats());
-
-    concurrencyLevel = Integer.parseInt(
-        info.getProperty(StatementCacheSettings.CONCURRENCY_LEVEL.key(),
-            StatementCacheSettings.CONCURRENCY_LEVEL.defaultValue()));
-    initialCapacity = Integer.parseInt(
-        info.getProperty(StatementCacheSettings.INITIAL_CAPACITY.key(),
-            StatementCacheSettings.INITIAL_CAPACITY.defaultValue()));
-    maxCapacity = Long.parseLong(
-        info.getProperty(StatementCacheSettings.MAX_CAPACITY.key(),
-            StatementCacheSettings.MAX_CAPACITY.defaultValue()));
-    connectionExpiryDuration = Long.parseLong(
-        info.getProperty(StatementCacheSettings.EXPIRY_DURATION.key(),
-            StatementCacheSettings.EXPIRY_DURATION.defaultValue()));
-    connectionExpiryUnit = TimeUnit.valueOf(
-        info.getProperty(StatementCacheSettings.EXPIRY_UNIT.key(),
-            StatementCacheSettings.EXPIRY_UNIT.defaultValue()));
-    this.statementCache = CacheBuilder.newBuilder()
-        .concurrencyLevel(concurrencyLevel)
-        .initialCapacity(initialCapacity)
-        .maximumSize(maxCapacity)
-        .expireAfterAccess(connectionExpiryDuration, connectionExpiryUnit)
-        .removalListener(new StatementExpiryHandler())
-        .build();
-
-    LOG.debug("instantiated statement cache: {}", statementCache.stats());
-
-    // Register some metrics
-    this.metrics.register(concat(JdbcMeta.class, "ConnectionCacheSize"), new Gauge<Long>() {
-      @Override public Long getValue() {
-        return connectionCache.size();
-      }
-    });
-
-    this.metrics.register(concat(JdbcMeta.class, "StatementCacheSize"), new Gauge<Long>() {
-      @Override public Long getValue() {
-        return statementCache.size();
-      }
-    });
-  }
-
-  // For testing purposes
-  protected AtomicInteger getStatementIdGenerator() {
-    return statementIdGenerator;
-  }
-
-  // For testing purposes
-  protected Cache<Integer, StatementInfo> getStatementCache() {
-    return statementCache;
-  }
-
-  /**
-   * Converts from JDBC metadata to Avatica columns.
-   */
-  protected static List<ColumnMetaData>
-  columns(ResultSetMetaData metaData) throws SQLException {
-    if (metaData == null) {
-      return Collections.emptyList();
-    }
-    final List<ColumnMetaData> columns = new ArrayList<>();
-    for (int i = 1; i <= metaData.getColumnCount(); i++) {
-      final SqlType sqlType = SqlType.valueOf(metaData.getColumnType(i));
-      final ColumnMetaData.Rep rep = ColumnMetaData.Rep.of(sqlType.internal);
-      final ColumnMetaData.AvaticaType t;
-      if (sqlType == SqlType.ARRAY || sqlType == SqlType.STRUCT || sqlType == SqlType.MULTISET) {
-        ColumnMetaData.AvaticaType arrayValueType = ColumnMetaData.scalar(Types.JAVA_OBJECT,
-            metaData.getColumnTypeName(i), ColumnMetaData.Rep.OBJECT);
-        t = ColumnMetaData.array(arrayValueType, metaData.getColumnTypeName(i), rep);
-      } else {
-        t = ColumnMetaData.scalar(metaData.getColumnType(i), metaData.getColumnTypeName(i), rep);
-      }
-      ColumnMetaData md =
-          new ColumnMetaData(i - 1, metaData.isAutoIncrement(i),
-              metaData.isCaseSensitive(i), metaData.isSearchable(i),
-              metaData.isCurrency(i), metaData.isNullable(i),
-              metaData.isSigned(i), metaData.getColumnDisplaySize(i),
-              metaData.getColumnLabel(i), metaData.getColumnName(i),
-              metaData.getSchemaName(i), metaData.getPrecision(i),
-              metaData.getScale(i), metaData.getTableName(i),
-              metaData.getCatalogName(i), t, metaData.isReadOnly(i),
-              metaData.isWritable(i), metaData.isDefinitelyWritable(i),
-              metaData.getColumnClassName(i));
-      columns.add(md);
-    }
-    return columns;
-  }
-
-  /**
-   * Converts from JDBC metadata to Avatica parameters
-   */
-  protected static List<AvaticaParameter> parameters(ParameterMetaData metaData)
-      throws SQLException {
-    if (metaData == null) {
-      return Collections.emptyList();
-    }
-    final List<AvaticaParameter> params = new ArrayList<>();
-    for (int i = 1; i <= metaData.getParameterCount(); i++) {
-      params.add(
-          new AvaticaParameter(metaData.isSigned(i), metaData.getPrecision(i),
-              metaData.getScale(i), metaData.getParameterType(i),
-              metaData.getParameterTypeName(i),
-              metaData.getParameterClassName(i), "?" + i));
-    }
-    return params;
-  }
-
-  protected static Signature signature(ResultSetMetaData metaData,
-      ParameterMetaData parameterMetaData, String sql,
-      Meta.StatementType statementType) throws  SQLException {
-    final CursorFactory cf = CursorFactory.LIST;  // because JdbcResultSet#frame
-    return new Signature(columns(metaData), sql, parameters(parameterMetaData),
-        null, cf, statementType);
-  }
-
-  protected static Signature signature(ResultSetMetaData metaData)
-      throws SQLException {
-    return signature(metaData, null, null, null);
-  }
-
-  public Map<DatabaseProperty, Object> getDatabaseProperties(ConnectionHandle ch) {
-    try {
-      final Map<DatabaseProperty, Object> map = new HashMap<>();
-      final Connection conn = getConnection(ch.id);
-      final DatabaseMetaData metaData = conn.getMetaData();
-      for (DatabaseProperty p : DatabaseProperty.values()) {
-        addProperty(map, metaData, p);
-      }
-      return map;
-    } catch (SQLException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  private static Object addProperty(Map<DatabaseProperty, Object> map,
-      DatabaseMetaData metaData, DatabaseProperty p) throws SQLException {
-    Object propertyValue;
-    if (p.isJdbc) {
-      try {
-        propertyValue = p.method.invoke(metaData);
-      } catch (IllegalAccessException | InvocationTargetException e) {
-        throw new RuntimeException(e);
-      }
-    } else {
-      propertyValue = p.defaultValue;
-    }
-
-    return map.put(p, propertyValue);
-  }
-
-  public MetaResultSet getTables(ConnectionHandle ch, String catalog, Pat schemaPattern,
-      Pat tableNamePattern, List<String> typeList) {
-    try {
-      final ResultSet rs =
-          getConnection(ch.id).getMetaData().getTables(catalog, schemaPattern.s,
-              tableNamePattern.s, toArray(typeList));
-      int stmtId = registerMetaStatement(rs);
-      return JdbcResultSet.create(ch.id, stmtId, rs);
-    } catch (SQLException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  /**
-    * Registers a StatementInfo for the given ResultSet, returning the id under
-    * which it is registered. This should be used for metadata ResultSets, which
-    * have an implicit statement created.
-    */
-  private int registerMetaStatement(ResultSet rs) throws SQLException {
-    final int id = statementIdGenerator.getAndIncrement();
-    StatementInfo statementInfo = new StatementInfo(rs.getStatement());
-    statementInfo.setResultSet(rs);
-    statementCache.put(id, statementInfo);
-    return id;
-  }
-
-  public MetaResultSet getColumns(ConnectionHandle ch, String catalog, Pat schemaPattern,
-      Pat tableNamePattern, Pat columnNamePattern) {
-    try {
-      final ResultSet rs =
-          getConnection(ch.id).getMetaData().getColumns(catalog, schemaPattern.s,
-              tableNamePattern.s, columnNamePattern.s);
-      int stmtId = registerMetaStatement(rs);
-      return JdbcResultSet.create(ch.id, stmtId, rs);
-    } catch (SQLException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  public MetaResultSet getSchemas(ConnectionHandle ch, String catalog, Pat schemaPattern) {
-    try {
-      final ResultSet rs =
-          getConnection(ch.id).getMetaData().getSchemas(catalog, schemaPattern.s);
-      int stmtId = registerMetaStatement(rs);
-      return JdbcResultSet.create(ch.id, stmtId, rs);
-    } catch (SQLException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  public MetaResultSet getCatalogs(ConnectionHandle ch) {
-    try {
-      final ResultSet rs = getConnection(ch.id).getMetaData().getCatalogs();
-      int stmtId = registerMetaStatement(rs);
-      return JdbcResultSet.create(ch.id, stmtId, rs);
-    } catch (SQLException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  public MetaResultSet getTableTypes(ConnectionHandle ch) {
-    try {
-      final ResultSet rs = getConnection(ch.id).getMetaData().getTableTypes();
-      int stmtId = registerMetaStatement(rs);
-      return JdbcResultSet.create(ch.id, stmtId, rs);
-    } catch (SQLException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  public MetaResultSet getProcedures(ConnectionHandle ch, String catalog, Pat schemaPattern,
-      Pat procedureNamePattern) {
-    try {
-      final ResultSet rs =
-          getConnection(ch.id).getMetaData().getProcedures(catalog, schemaPattern.s,
-              procedureNamePattern.s);
-      int stmtId = registerMetaStatement(rs);
-      return JdbcResultSet.create(ch.id, stmtId, rs);
-    } catch (SQLException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  public MetaResultSet getProcedureColumns(ConnectionHandle ch, String catalog, Pat schemaPattern,
-      Pat procedureNamePattern, Pat columnNamePattern) {
-    try {
-      final ResultSet rs =
-          getConnection(ch.id).getMetaData().getProcedureColumns(catalog,
-              schemaPattern.s, procedureNamePattern.s, columnNamePattern.s);
-      int stmtId = registerMetaStatement(rs);
-      return JdbcResultSet.create(ch.id, stmtId, rs);
-    } catch (SQLException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  public MetaResultSet getColumnPrivileges(ConnectionHandle ch, String catalog, String schema,
-      String table, Pat columnNamePattern) {
-    try {
-      final ResultSet rs =
-          getConnection(ch.id).getMetaData().getColumnPrivileges(catalog, schema,
-              table, columnNamePattern.s);
-      int stmtId = registerMetaStatement(rs);
-      return JdbcResultSet.create(ch.id, stmtId, rs);
-    } catch (SQLException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  public MetaResultSet getTablePrivileges(ConnectionHandle ch, String catalog, Pat schemaPattern,
-      Pat tableNamePattern) {
-    try {
-      final ResultSet rs =
-          getConnection(ch.id).getMetaData().getTablePrivileges(catalog,
-              schemaPattern.s, tableNamePattern.s);
-      int stmtId = registerMetaStatement(rs);
-      return JdbcResultSet.create(ch.id, stmtId, rs);
-    } catch (SQLException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  public MetaResultSet getBestRowIdentifier(ConnectionHandle ch, String catalog, String schema,
-      String table, int scope, boolean nullable) {
-    LOG.trace("getBestRowIdentifier catalog:{} schema:{} table:{} scope:{} nullable:{}", catalog,
-        schema, table, scope, nullable);
-    try {
-      final ResultSet rs =
-          getConnection(ch.id).getMetaData().getBestRowIdentifier(catalog, schema,
-              table, scope, nullable);
-      int stmtId = registerMetaStatement(rs);
-      return JdbcResultSet.create(ch.id, stmtId, rs);
-    } catch (SQLException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  public MetaResultSet getVersionColumns(ConnectionHandle ch, String catalog, String schema,
-      String table) {
-    LOG.trace("getVersionColumns catalog:{} schema:{} table:{}", catalog, schema, table);
-    try {
-      final ResultSet rs =
-          getConnection(ch.id).getMetaData().getVersionColumns(catalog, schema, table);
-      int stmtId = registerMetaStatement(rs);
-      return JdbcResultSet.create(ch.id, stmtId, rs);
-    } catch (SQLException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  public MetaResultSet getPrimaryKeys(ConnectionHandle ch, String catalog, String schema,
-      String table) {
-    LOG.trace("getPrimaryKeys catalog:{} schema:{} table:{}", catalog, schema, table);
-    try {
-      final ResultSet rs =
-          getConnection(ch.id).getMetaData().getPrimaryKeys(catalog, schema, table);
-      int stmtId = registerMetaStatement(rs);
-      return JdbcResultSet.create(ch.id, stmtId, rs);
-    } catch (SQLException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  public MetaResultSet getImportedKeys(ConnectionHandle ch, String catalog, String schema,
-      String table) {
-    return null;
-  }
-
-  public MetaResultSet getExportedKeys(ConnectionHandle ch, String catalog, String schema,
-      String table) {
-    return null;
-  }
-
-  public MetaResultSet getCrossReference(ConnectionHandle ch, String parentCatalog,
-      String parentSchema, String parentTable, String foreignCatalog,
-      String foreignSchema, String foreignTable) {
-    return null;
-  }
-
-  public MetaResultSet getTypeInfo(ConnectionHandle ch) {
-    try {
-      final ResultSet rs = getConnection(ch.id).getMetaData().getTypeInfo();
-      int stmtId = registerMetaStatement(rs);
-      return JdbcResultSet.create(ch.id, stmtId, rs);
-    } catch (SQLException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  public MetaResultSet getIndexInfo(ConnectionHandle ch, String catalog, String schema,
-      String table, boolean unique, boolean approximate) {
-    return null;
-  }
-
-  public MetaResultSet getUDTs(ConnectionHandle ch, String catalog, Pat schemaPattern,
-      Pat typeNamePattern, int[] types) {
-    return null;
-  }
-
-  public MetaResultSet getSuperTypes(ConnectionHandle ch, String catalog, Pat schemaPattern,
-      Pat typeNamePattern) {
-    return null;
-  }
-
-  public MetaResultSet getSuperTables(ConnectionHandle ch, String catalog, Pat schemaPattern,
-      Pat tableNamePattern) {
-    return null;
-  }
-
-  public MetaResultSet getAttributes(ConnectionHandle ch, String catalog, Pat schemaPattern,
-      Pat typeNamePattern, Pat attributeNamePattern) {
-    return null;
-  }
-
-  public MetaResultSet getClientInfoProperties(ConnectionHandle ch) {
-    return null;
-  }
-
-  public MetaResultSet getFunctions(ConnectionHandle ch, String catalog, Pat schemaPattern,
-      Pat functionNamePattern) {
-    return null;
-  }
-
-  public MetaResultSet getFunctionColumns(ConnectionHandle ch, String catalog, Pat schemaPattern,
-      Pat functionNamePattern, Pat columnNamePattern) {
-    return null;
-  }
-
-  public MetaResultSet getPseudoColumns(ConnectionHandle ch, String catalog, Pat schemaPattern,
-      Pat tableNamePattern, Pat columnNamePattern) {
-    return null;
-  }
-
-  public Iterable<Object> createIterable(StatementHandle handle, QueryState state,
-      Signature signature, List<TypedValue> parameterValues, Frame firstFrame) {
-    return null;
-  }
-
-  protected Connection getConnection(String id) throws SQLException {
-    if (id == null) {
-      throw new NullPointerException("Connection id is null.");
-    }
-    Connection conn = connectionCache.getIfPresent(id);
-    if (conn == null) {
-      throw new NoSuchConnectionException("Connection not found: invalid id, closed, or expired: "
-          + id);
-    }
-    return conn;
-  }
-
-  public StatementHandle createStatement(ConnectionHandle ch) {
-    try {
-      final Connection conn = getConnection(ch.id);
-      final Statement statement = conn.createStatement();
-      final int id = statementIdGenerator.getAndIncrement();
-      statementCache.put(id, new StatementInfo(statement));
-      StatementHandle h = new StatementHandle(ch.id, id, null);
-      LOG.trace("created statement {}", h);
-      return h;
-    } catch (SQLException e) {
-      throw propagate(e);
-    }
-  }
-
-  @Override public void closeStatement(StatementHandle h) {
-    StatementInfo info = statementCache.getIfPresent(h.id);
-    if (info == null || info.statement == null) {
-      LOG.debug("client requested close unknown statement {}", h);
-      return;
-    }
-    LOG.trace("closing statement {}", h);
-    try {
-      ResultSet results = info.getResultSet();
-      if (info.isResultSetInitialized() && null != results) {
-        results.close();
-      }
-      info.statement.close();
-    } catch (SQLException e) {
-      throw propagate(e);
-    } finally {
-      statementCache.invalidate(h.id);
-    }
-  }
-
-  @Override public void openConnection(ConnectionHandle ch,
-      Map<String, String> info) {
-    Properties fullInfo = new Properties();
-    fullInfo.putAll(this.info);
-    if (info != null) {
-      fullInfo.putAll(info);
-    }
-
-    synchronized (this) {
-      try {
-        if (connectionCache.asMap().containsKey(ch.id)) {
-          throw new RuntimeException("Connection already exists: " + ch.id);
-        }
-        Connection conn = DriverManager.getConnection(url, fullInfo);
-        connectionCache.put(ch.id, conn);
-      } catch (SQLException e) {
-        throw new RuntimeException(e);
-      }
-    }
-  }
-
-  @Override public void closeConnection(ConnectionHandle ch) {
-    Connection conn = connectionCache.getIfPresent(ch.id);
-    if (conn == null) {
-      LOG.debug("client requested close unknown connection {}", ch);
-      return;
-    }
-    LOG.trace("closing connection {}", ch);
-    try {
-      conn.close();
-    } catch (SQLException e) {
-      throw propagate(e);
-    } finally {
-      connectionCache.invalidate(ch.id);
-    }
-  }
-
-  protected void apply(Connection conn, ConnectionProperties connProps)
-      throws SQLException {
-    if (connProps.isAutoCommit() != null) {
-      conn.setAutoCommit(connProps.isAutoCommit());
-    }
-    if (connProps.isReadOnly() != null) {
-      conn.setReadOnly(connProps.isReadOnly());
-    }
-    if (connProps.getTransactionIsolation() != null) {
-      conn.setTransactionIsolation(connProps.getTransactionIsolation());
-    }
-    if (connProps.getCatalog() != null) {
-      conn.setCatalog(connProps.getCatalog());
-    }
-    if (connProps.getSchema() != null) {
-      conn.setSchema(connProps.getSchema());
-    }
-  }
-
-  @Override public ConnectionProperties connectionSync(ConnectionHandle ch,
-      ConnectionProperties connProps) {
-    LOG.trace("syncing properties for connection {}", ch);
-    try {
-      Connection conn = getConnection(ch.id);
-      ConnectionPropertiesImpl props = new ConnectionPropertiesImpl(conn).merge(connProps);
-      if (props.isDirty()) {
-        apply(conn, props);
-        props.setDirty(false);
-      }
-      return props;
-    } catch (SQLException e) {
-      throw propagate(e);
-    }
-  }
-
-  RuntimeException propagate(Throwable e) {
-    if (e instanceof RuntimeException) {
-      throw (RuntimeException) e;
-    } else if (e instanceof Error) {
-      throw (Error) e;
-    } else {
-      throw new RuntimeException(e);
-    }
-  }
-
-  public StatementHandle prepare(ConnectionHandle ch, String sql,
-      long maxRowCount) {
-    try {
-      final Connection conn = getConnection(ch.id);
-      final PreparedStatement statement = conn.prepareStatement(sql);
-      final int id = getStatementIdGenerator().getAndIncrement();
-      Meta.StatementType statementType = null;
-      if (statement.isWrapperFor(AvaticaPreparedStatement.class)) {
-        final AvaticaPreparedStatement avaticaPreparedStatement;
-        avaticaPreparedStatement =
-            statement.unwrap(AvaticaPreparedStatement.class);
-        statementType = avaticaPreparedStatement.getStatementType();
-      }
-      // Set the maximum number of rows
-      setMaxRows(statement, maxRowCount);
-      getStatementCache().put(id, new StatementInfo(statement));
-      StatementHandle h = new StatementHandle(ch.id, id,
-          signature(statement.getMetaData(), statement.getParameterMetaData(),
-              sql, statementType));
-      LOG.trace("prepared statement {}", h);
-      return h;
-    } catch (SQLException e) {
-      throw propagate(e);
-    }
-  }
-
-  @SuppressWarnings("deprecation")
-  public ExecuteResult prepareAndExecute(StatementHandle h, String sql,
-      long maxRowCount, PrepareCallback callback) throws NoSuchStatementException {
-    return prepareAndExecute(h, sql, maxRowCount, AvaticaUtils.toSaturatedInt(maxRowCount),
-        callback);
-  }
-
-  public ExecuteResult prepareAndExecute(StatementHandle h, String sql, long maxRowCount,
-      int maxRowsInFirstFrame, PrepareCallback callback) throws NoSuchStatementException {
-    try {
-      final StatementInfo info = getStatementCache().getIfPresent(h.id);
-      if (info == null) {
-        throw new NoSuchStatementException(h);
-      }
-      final Statement statement = info.statement;
-      // Make sure that we limit the number of rows for the query
-      setMaxRows(statement, maxRowCount);
-      boolean ret = statement.execute(sql);
-      info.setResultSet(statement.getResultSet());
-      // Either execute(sql) returned true or the resultSet was null
-      assert ret || null == info.getResultSet();
-      final List<MetaResultSet> resultSets = new ArrayList<>();
-      if (null == info.getResultSet()) {
-        // Create a special result set that just carries update count
-        resultSets.add(
-            JdbcResultSet.count(h.connectionId, h.id,
-                AvaticaUtils.getLargeUpdateCount(statement)));
-      } else {
-        resultSets.add(
-            JdbcResultSet.create(h.connectionId, h.id, info.getResultSet(), maxRowsInFirstFrame));
-      }
-      LOG.trace("prepAndExec statement {}", h);
-      // TODO: review client to ensure statementId is updated when appropriate
-      return new ExecuteResult(resultSets);
-    } catch (SQLException e) {
-      throw propagate(e);
-    }
-  }
-
-  /**
-   * Sets the provided maximum number of rows on the given statement.
-   *
-   * @param statement The JDBC Statement to operate on
-   * @param maxRowCount The maximum number of rows which should be returned for the query
-   */
-  void setMaxRows(Statement statement, long maxRowCount) throws SQLException {
-    // Special handling of maxRowCount as JDBC 0 is unlimited, our meta 0 row
-    if (maxRowCount > 0) {
-      AvaticaUtils.setLargeMaxRows(statement, maxRowCount);
-    } else if (maxRowCount < 0) {
-      statement.setMaxRows(0);
-    }
-  }
-
-  public boolean syncResults(StatementHandle sh, QueryState state, long offset)
-      throws NoSuchStatementException {
-    try {
-      final Connection conn = getConnection(sh.connectionId);
-      final StatementInfo info = statementCache.getIfPresent(sh.id);
-      if (null == info) {
-        throw new NoSuchStatementException(sh);
-      }
-      final Statement statement = info.statement;
-      // Let the state recreate the necessary ResultSet on the Statement
-      info.setResultSet(state.invoke(conn, statement));
-
-      if (null != info.getResultSet()) {
-        // If it is non-null, try to advance to the requested offset.
-        return info.advanceResultSetToOffset(info.getResultSet(), offset);
-      }
-
-      // No results, nothing to do. Client can move on.
-      return false;
-    } catch (SQLException e) {
-      throw propagate(e);
-    }
-  }
-
-  public Frame fetch(StatementHandle h, long offset, int fetchMaxRowCount) throws
-      NoSuchStatementException, MissingResultsException {
-    LOG.trace("fetching {} offset:{} fetchMaxRowCount:{}", h, offset, fetchMaxRowCount);
-    try {
-      final StatementInfo statementInfo = statementCache.getIfPresent(h.id);
-      if (null == statementInfo) {
-        // Statement might have expired, or never existed on this server.
-        throw new NoSuchStatementException(h);
-      }
-
-      if (!statementInfo.isResultSetInitialized()) {
-        // The Statement exists, but the results are missing. Need to call syncResults(...)
-        throw new MissingResultsException(h);
-      }
-      if (statementInfo.getResultSet() == null) {
-        return Frame.EMPTY;
-      } else {
-        return JdbcResultSet.frame(statementInfo, statementInfo.getResultSet(), offset,
-            fetchMaxRowCount, calendar);
-      }
-    } catch (SQLException e) {
-      throw propagate(e);
-    }
-  }
-
-  private static String[] toArray(List<String> typeList) {
-    if (typeList == null) {
-      return null;
-    }
-    return typeList.toArray(new String[typeList.size()]);
-  }
-
-  @SuppressWarnings("deprecation")
-  @Override public ExecuteResult execute(StatementHandle h, List<TypedValue> parameterValues,
-      long maxRowCount) throws NoSuchStatementException {
-    return execute(h, parameterValues, AvaticaUtils.toSaturatedInt(maxRowCount));
-  }
-
-  @Override public ExecuteResult execute(StatementHandle h,
-      List<TypedValue> parameterValues, int maxRowsInFirstFrame) throws NoSuchStatementException {
-    try {
-      if (MetaImpl.checkParameterValueHasNull(parameterValues)) {
-        throw new SQLException("exception while executing query: unbound parameter");
-      }
-
-      final StatementInfo statementInfo = statementCache.getIfPresent(h.id);
-      if (null == statementInfo) {
-        throw new NoSuchStatementException(h);
-      }
-      final List<MetaResultSet> resultSets;
-      final PreparedStatement preparedStatement =
-          (PreparedStatement) statementInfo.statement;
-
-      if (parameterValues != null) {
-        for (int i = 0; i < parameterValues.size(); i++) {
-          TypedValue o = parameterValues.get(i);
-          preparedStatement.setObject(i + 1, o.toJdbc(calendar));
-        }
-      }
-
-      if (preparedStatement.execute()) {
-        final Meta.Frame frame;
-        final Signature signature2;
-        if (preparedStatement.isWrapperFor(AvaticaPreparedStatement.class)) {
-          signature2 = h.signature;
-        } else {
-          h.signature = signature(preparedStatement.getMetaData(),
-              preparedStatement.getParameterMetaData(), h.signature.sql,
-              Meta.StatementType.SELECT);
-          signature2 = h.signature;
-        }
-
-        // Make sure we set this for subsequent fetch()'s to find the result set.
-        statementInfo.setResultSet(preparedStatement.getResultSet());
-
-        if (statementInfo.getResultSet() == null) {
-          frame = Frame.EMPTY;
-          resultSets = Collections.<MetaResultSet>singletonList(
-              JdbcResultSet.empty(h.connectionId, h.id, signature2));
-        } else {
-          resultSets = Collections.<MetaResultSet>singletonList(
-              JdbcResultSet.create(h.connectionId, h.id, statementInfo.getResultSet(),
-                  maxRowsInFirstFrame, signature2));
-        }
-      } else {
-        resultSets = Collections.<MetaResultSet>singletonList(
-            JdbcResultSet.count(h.connectionId, h.id, preparedStatement.getUpdateCount()));
-      }
-
-      return new ExecuteResult(resultSets);
-    } catch (SQLException e) {
-      throw propagate(e);
-    }
-  }
-
-  @Override public void commit(ConnectionHandle ch) {
-    try {
-      final Connection conn = getConnection(ch.id);
-      conn.commit();
-    } catch (SQLException e) {
-      throw propagate(e);
-    }
-  }
-
-  @Override public void rollback(ConnectionHandle ch) {
-    try {
-      final Connection conn = getConnection(ch.id);
-      conn.rollback();
-    } catch (SQLException e) {
-      throw propagate(e);
-    }
-  }
-
-  @Override public ExecuteBatchResult prepareAndExecuteBatch(StatementHandle h,
-      List<String> sqlCommands) throws NoSuchStatementException {
-    try {
-      // Get the statement
-      final StatementInfo info = statementCache.getIfPresent(h.id);
-      if (info == null) {
-        throw new NoSuchStatementException(h);
-      }
-
-      // addBatch() for each sql command
-      final Statement stmt = info.statement;
-      for (String sqlCommand : sqlCommands) {
-        stmt.addBatch(sqlCommand);
-      }
-
-      // Execute the batch and return the results
-      return new ExecuteBatchResult(AvaticaUtils.executeLargeBatch(stmt));
-    } catch (SQLException e) {
-      throw propagate(e);
-    }
-  }
-
-  @Override public ExecuteBatchResult executeBatch(StatementHandle h,
-      List<List<TypedValue>> updateBatches) throws NoSuchStatementException {
-    try {
-      final StatementInfo info = statementCache.getIfPresent(h.id);
-      if (null == info) {
-        throw new NoSuchStatementException(h);
-      }
-
-      final PreparedStatement preparedStmt = (PreparedStatement) info.statement;
-      int rowUpdate = 1;
-      for (List<TypedValue> batch : updateBatches) {
-        int i = 1;
-        for (TypedValue value : batch) {
-          // Set the TypedValue in the PreparedStatement
-          try {
-            preparedStmt.setObject(i, value.toJdbc(calendar));
-            i++;
-          } catch (SQLException e) {
-            throw new RuntimeException("Failed to set value on row #" + rowUpdate
-                + " and column #" + i, e);
-          }
-          // Track the update number for better error messages
-          rowUpdate++;
-        }
-        preparedStmt.addBatch();
-      }
-      return new ExecuteBatchResult(AvaticaUtils.executeLargeBatch(preparedStmt));
-    } catch (SQLException e) {
-      throw propagate(e);
-    }
-  }
-
-  @Override public ExecuteBatchResult executeBatchProtobuf(StatementHandle h,
-      List<Requests.UpdateBatch> updateBatches) throws NoSuchStatementException {
-    try {
-      final StatementInfo info = statementCache.getIfPresent(h.id);
-      if (null == info) {
-        throw new NoSuchStatementException(h);
-      }
-
-      final PreparedStatement preparedStmt = (PreparedStatement) info.statement;
-      for (Requests.UpdateBatch update : updateBatches) {
-        int i = 1;
-        for (Common.TypedValue value : update.getParameterValuesList()) {
-          // Use the value and then increment
-          preparedStmt.setObject(i++, TypedValue.protoToJdbc(value, calendar));
-        }
-        preparedStmt.addBatch();
-      }
-      return new ExecuteBatchResult(AvaticaUtils.executeLargeBatch(preparedStmt));
-    } catch (SQLException e) {
-      throw propagate(e);
-    }
-  }
-
-  /** Configurable statement cache settings. */
-  public enum StatementCacheSettings {
-    /** JDBC connection property for setting connection cache concurrency level. */
-    CONCURRENCY_LEVEL(STMT_CACHE_KEY_BASE + ".concurrency", "100"),
-
-    /** JDBC connection property for setting connection cache initial capacity. */
-    INITIAL_CAPACITY(STMT_CACHE_KEY_BASE + ".initialcapacity", "1000"),
-
-    /** JDBC connection property for setting connection cache maximum capacity. */
-    MAX_CAPACITY(STMT_CACHE_KEY_BASE + ".maxcapacity", "10000"),
-
-    /** JDBC connection property for setting connection cache expiration duration.
-     *
-     * <p>Used in conjunction with {@link #EXPIRY_UNIT}.</p>
-     */
-    EXPIRY_DURATION(STMT_CACHE_KEY_BASE + ".expirydiration", "5"),
-
-    /** JDBC connection property for setting connection cache expiration unit.
-     *
-     * <p>Used in conjunction with {@link #EXPIRY_DURATION}.</p>
-     */
-    EXPIRY_UNIT(STMT_CACHE_KEY_BASE + ".expiryunit", TimeUnit.MINUTES.name());
-
-    private final String key;
-    private final String defaultValue;
-
-    StatementCacheSettings(String key, String defaultValue) {
-      this.key = key;
-      this.defaultValue = defaultValue;
-    }
-
-    /** The configuration key for specifying this setting. */
-    public String key() {
-      return key;
-    }
-
-    /** The default value for this setting. */
-    public String defaultValue() {
-      return defaultValue;
-    }
-  }
-
-  /** Configurable connection cache settings. */
-  public enum ConnectionCacheSettings {
-    /** JDBC connection property for setting connection cache concurrency level. */
-    CONCURRENCY_LEVEL(CONN_CACHE_KEY_BASE + ".concurrency", "10"),
-
-    /** JDBC connection property for setting connection cache initial capacity. */
-    INITIAL_CAPACITY(CONN_CACHE_KEY_BASE + ".initialcapacity", "100"),
-
-    /** JDBC connection property for setting connection cache maximum capacity. */
-    MAX_CAPACITY(CONN_CACHE_KEY_BASE + ".maxcapacity", "1000"),
-
-    /** JDBC connection property for setting connection cache expiration duration. */
-    EXPIRY_DURATION(CONN_CACHE_KEY_BASE + ".expiryduration", "10"),
-
-    /** JDBC connection property for setting connection cache expiration unit. */
-    EXPIRY_UNIT(CONN_CACHE_KEY_BASE + ".expiryunit", TimeUnit.MINUTES.name());
-
-    private final String key;
-    private final String defaultValue;
-
-    ConnectionCacheSettings(String key, String defaultValue) {
-      this.key = key;
-      this.defaultValue = defaultValue;
-    }
-
-    /** The configuration key for specifying this setting. */
-    public String key() {
-      return key;
-    }
-
-    /** The default value for this setting. */
-    public String defaultValue() {
-      return defaultValue;
-    }
-  }
-
-  /** Callback for {@link #connectionCache} member expiration. */
-  private class ConnectionExpiryHandler
-      implements RemovalListener<String, Connection> {
-
-    public void onRemoval(RemovalNotification<String, Connection> notification) {
-      String connectionId = notification.getKey();
-      Connection doomed = notification.getValue();
-      LOG.debug("Expiring connection {} because {}", connectionId, notification.getCause());
-      try {
-        if (doomed != null) {
-          doomed.close();
-        }
-      } catch (Throwable t) {
-        LOG.info("Exception thrown while expiring connection {}", connectionId, t);
-      }
-    }
-  }
-
-  /** Callback for {@link #statementCache} member expiration. */
-  private class StatementExpiryHandler
-      implements RemovalListener<Integer, StatementInfo> {
-    public void onRemoval(RemovalNotification<Integer, StatementInfo> notification) {
-      Integer stmtId = notification.getKey();
-      StatementInfo doomed = notification.getValue();
-      if (doomed == null) {
-        // log/throw?
-        return;
-      }
-      LOG.debug("Expiring statement {} because {}", stmtId, notification.getCause());
-      try {
-        if (doomed.getResultSet() != null) {
-          doomed.getResultSet().close();
-        }
-        if (doomed.statement != null) {
-          doomed.statement.close();
-        }
-      } catch (Throwable t) {
-        LOG.info("Exception thrown while expiring statement {}", stmtId, t);
-      }
-    }
-  }
-}
-
-// End JdbcMeta.java


[36/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/remote/Service.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/Service.java b/avatica/core/src/main/java/org/apache/calcite/avatica/remote/Service.java
deleted file mode 100644
index 786d07a..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/Service.java
+++ /dev/null
@@ -1,3114 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import org.apache.calcite.avatica.AvaticaClientRuntimeException;
-import org.apache.calcite.avatica.AvaticaConnection;
-import org.apache.calcite.avatica.AvaticaSeverity;
-import org.apache.calcite.avatica.AvaticaUtils;
-import org.apache.calcite.avatica.BuiltInConnectionProperty;
-import org.apache.calcite.avatica.ConnectionPropertiesImpl;
-import org.apache.calcite.avatica.Meta;
-import org.apache.calcite.avatica.QueryState;
-import org.apache.calcite.avatica.proto.Common;
-import org.apache.calcite.avatica.proto.Requests;
-import org.apache.calcite.avatica.proto.Responses;
-
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonSubTypes;
-import com.fasterxml.jackson.annotation.JsonTypeInfo;
-import com.google.protobuf.ByteString;
-import com.google.protobuf.Descriptors.FieldDescriptor;
-import com.google.protobuf.Message;
-import com.google.protobuf.UnsafeByteOperations;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Objects;
-import java.util.Properties;
-
-import static java.nio.charset.StandardCharsets.UTF_8;
-
-/**
- * API for request-response calls to an Avatica server.
- */
-public interface Service {
-  ResultSetResponse apply(CatalogsRequest request);
-  ResultSetResponse apply(SchemasRequest request);
-  ResultSetResponse apply(TablesRequest request);
-  ResultSetResponse apply(TableTypesRequest request);
-  ResultSetResponse apply(TypeInfoRequest request);
-  ResultSetResponse apply(ColumnsRequest request);
-  PrepareResponse apply(PrepareRequest request);
-  ExecuteResponse apply(ExecuteRequest request);
-  ExecuteResponse apply(PrepareAndExecuteRequest request);
-  SyncResultsResponse apply(SyncResultsRequest request);
-  FetchResponse apply(FetchRequest request);
-  CreateStatementResponse apply(CreateStatementRequest request);
-  CloseStatementResponse apply(CloseStatementRequest request);
-  OpenConnectionResponse apply(OpenConnectionRequest request);
-  CloseConnectionResponse apply(CloseConnectionRequest request);
-  ConnectionSyncResponse apply(ConnectionSyncRequest request);
-  DatabasePropertyResponse apply(DatabasePropertyRequest request);
-  CommitResponse apply(CommitRequest request);
-  RollbackResponse apply(RollbackRequest request);
-  ExecuteBatchResponse apply(PrepareAndExecuteBatchRequest request);
-  ExecuteBatchResponse apply(ExecuteBatchRequest request);
-
-  /**
-   * Sets server-level metadata for RPCs. This includes information that is static across all RPCs.
-   *
-   * @param metadata The server-level metadata.
-   */
-  void setRpcMetadata(RpcMetadataResponse metadata);
-
-  /** Factory that creates a {@code Service}. */
-  interface Factory {
-    Service create(AvaticaConnection connection);
-  }
-
-  /** Base class for request and response. */
-  abstract class Base {
-    static final int PRIME = 31;
-
-    protected static int p(int result, Object o) {
-      return PRIME * result + ((o == null) ? 0 : o.hashCode());
-    }
-
-    protected static int p(int result, boolean v) {
-      return PRIME * result + (v ? 1231 : 1237);
-    }
-
-    protected static int p(int result, int v) {
-      return PRIME * result + v;
-    }
-
-    protected static int p(int result, long v) {
-      return PRIME * result + (int) (v ^ (v >>> 32));
-    }
-  }
-
-  /** Base class for all service request messages. */
-  @JsonTypeInfo(
-      use = JsonTypeInfo.Id.NAME,
-      property = "request",
-      defaultImpl = SchemasRequest.class)
-  @JsonSubTypes({
-      @JsonSubTypes.Type(value = CatalogsRequest.class, name = "getCatalogs"),
-      @JsonSubTypes.Type(value = SchemasRequest.class, name = "getSchemas"),
-      @JsonSubTypes.Type(value = TablesRequest.class, name = "getTables"),
-      @JsonSubTypes.Type(value = TableTypesRequest.class, name = "getTableTypes"),
-      @JsonSubTypes.Type(value = TypeInfoRequest.class, name = "getTypeInfo"),
-      @JsonSubTypes.Type(value = ColumnsRequest.class, name = "getColumns"),
-      @JsonSubTypes.Type(value = ExecuteRequest.class, name = "execute"),
-      @JsonSubTypes.Type(value = PrepareRequest.class, name = "prepare"),
-      @JsonSubTypes.Type(value = PrepareAndExecuteRequest.class,
-          name = "prepareAndExecute"),
-      @JsonSubTypes.Type(value = FetchRequest.class, name = "fetch"),
-      @JsonSubTypes.Type(value = CreateStatementRequest.class,
-          name = "createStatement"),
-      @JsonSubTypes.Type(value = CloseStatementRequest.class,
-          name = "closeStatement"),
-      @JsonSubTypes.Type(value = OpenConnectionRequest.class,
-          name = "openConnection"),
-      @JsonSubTypes.Type(value = CloseConnectionRequest.class,
-          name = "closeConnection"),
-      @JsonSubTypes.Type(value = ConnectionSyncRequest.class, name = "connectionSync"),
-      @JsonSubTypes.Type(value = DatabasePropertyRequest.class, name = "databaseProperties"),
-      @JsonSubTypes.Type(value = SyncResultsRequest.class, name = "syncResults"),
-      @JsonSubTypes.Type(value = CommitRequest.class, name = "commit"),
-      @JsonSubTypes.Type(value = RollbackRequest.class, name = "rollback"),
-      @JsonSubTypes.Type(value = PrepareAndExecuteBatchRequest.class,
-          name = "prepareAndExecuteBatch"),
-      @JsonSubTypes.Type(value = ExecuteBatchRequest.class, name = "executeBatch") })
-  abstract class Request extends Base {
-    abstract Response accept(Service service);
-    abstract Request deserialize(Message genericMsg);
-    abstract Message serialize();
-  }
-
-  /** Base class for all service response messages. */
-  @JsonTypeInfo(
-      use = JsonTypeInfo.Id.NAME,
-      property = "response",
-      defaultImpl = ResultSetResponse.class)
-  @JsonSubTypes({
-      @JsonSubTypes.Type(value = OpenConnectionResponse.class, name = "openConnection"),
-      @JsonSubTypes.Type(value = ResultSetResponse.class, name = "resultSet"),
-      @JsonSubTypes.Type(value = PrepareResponse.class, name = "prepare"),
-      @JsonSubTypes.Type(value = FetchResponse.class, name = "fetch"),
-      @JsonSubTypes.Type(value = CreateStatementResponse.class,
-          name = "createStatement"),
-      @JsonSubTypes.Type(value = CloseStatementResponse.class,
-          name = "closeStatement"),
-      @JsonSubTypes.Type(value = CloseConnectionResponse.class,
-          name = "closeConnection"),
-      @JsonSubTypes.Type(value = ConnectionSyncResponse.class, name = "connectionSync"),
-      @JsonSubTypes.Type(value = DatabasePropertyResponse.class, name = "databaseProperties"),
-      @JsonSubTypes.Type(value = ExecuteResponse.class, name = "executeResults"),
-      @JsonSubTypes.Type(value = ErrorResponse.class, name = "error"),
-      @JsonSubTypes.Type(value = SyncResultsResponse.class, name = "syncResults"),
-      @JsonSubTypes.Type(value = RpcMetadataResponse.class, name = "rpcMetadata"),
-      @JsonSubTypes.Type(value = CommitResponse.class, name = "commit"),
-      @JsonSubTypes.Type(value = RollbackResponse.class, name = "rollback"),
-      @JsonSubTypes.Type(value = ExecuteBatchResponse.class, name = "executeBatch") })
-  abstract class Response extends Base {
-    abstract Response deserialize(Message genericMsg);
-    abstract Message serialize();
-  }
-
-  /** Request for
-   * {@link org.apache.calcite.avatica.Meta#getCatalogs(Meta.ConnectionHandle)}. */
-  class CatalogsRequest extends Request {
-    private static final FieldDescriptor CONNECTION_ID_DESCRIPTOR = Requests.CatalogsRequest.
-        getDescriptor().findFieldByNumber(Requests.CatalogsRequest.CONNECTION_ID_FIELD_NUMBER);
-    public final String connectionId;
-
-    public CatalogsRequest() {
-      connectionId = null;
-    }
-
-    @JsonCreator
-    public CatalogsRequest(@JsonProperty("connectionId") String connectionId) {
-      this.connectionId = connectionId;
-    }
-
-    ResultSetResponse accept(Service service) {
-      return service.apply(this);
-    }
-
-    @Override CatalogsRequest deserialize(Message genericMsg) {
-      final Requests.CatalogsRequest msg = ProtobufService.castProtobufMessage(genericMsg,
-          Requests.CatalogsRequest.class);
-      String connectionId = null;
-      if (msg.hasField(CONNECTION_ID_DESCRIPTOR)) {
-        connectionId = msg.getConnectionId();
-      }
-
-      return new CatalogsRequest(connectionId);
-    }
-
-    @Override Requests.CatalogsRequest serialize() {
-      Requests.CatalogsRequest.Builder builder = Requests.CatalogsRequest.newBuilder();
-
-      if (null != connectionId) {
-        builder.setConnectionId(connectionId);
-      }
-
-      return builder.build();
-    }
-
-    @Override public int hashCode() {
-      int result = 1;
-      result = p(result, connectionId);
-      return result;
-    }
-
-    @Override public boolean equals(Object o) {
-      return o == this
-          || o instanceof CatalogsRequest
-          && Objects.equals(connectionId, ((CatalogsRequest) o).connectionId);
-    }
-  }
-
-  /** Request for
-   * {@link org.apache.calcite.avatica.Meta#getDatabaseProperties(Meta.ConnectionHandle)}. */
-  class DatabasePropertyRequest extends Request {
-    private static final FieldDescriptor CONNECTION_ID_DESCRIPTOR =
-        Requests.DatabasePropertyRequest.getDescriptor().
-        findFieldByNumber(Requests.DatabasePropertyRequest.CONNECTION_ID_FIELD_NUMBER);
-
-    public final String connectionId;
-
-    public DatabasePropertyRequest() {
-      connectionId = null;
-    }
-
-    @JsonCreator
-    public DatabasePropertyRequest(@JsonProperty("connectionId") String connectionId) {
-      this.connectionId = connectionId;
-    }
-
-    DatabasePropertyResponse accept(Service service) {
-      return service.apply(this);
-    }
-
-    @Override DatabasePropertyRequest deserialize(Message genericMsg) {
-      final Requests.DatabasePropertyRequest msg = ProtobufService.castProtobufMessage(genericMsg,
-          Requests.DatabasePropertyRequest.class);
-
-      String connectionId = null;
-      if (msg.hasField(CONNECTION_ID_DESCRIPTOR)) {
-        connectionId = msg.getConnectionId();
-      }
-
-      return new DatabasePropertyRequest(connectionId);
-    }
-
-    @Override Requests.DatabasePropertyRequest serialize() {
-      Requests.DatabasePropertyRequest.Builder builder =
-          Requests.DatabasePropertyRequest.newBuilder();
-
-      if (null != connectionId) {
-        builder.setConnectionId(connectionId);
-      }
-
-      return builder.build();
-    }
-
-    @Override public int hashCode() {
-      int result = 1;
-      result = p(result, connectionId);
-      return result;
-    }
-
-    @Override public boolean equals(Object o) {
-      return o == this
-          || o instanceof DatabasePropertyRequest
-          && Objects.equals(connectionId, ((DatabasePropertyRequest) o).connectionId);
-    }
-  }
-
-  /** Request for
-   * {@link Meta#getSchemas(Meta.ConnectionHandle, String, Meta.Pat)}. */
-  class SchemasRequest extends Request {
-    private static final FieldDescriptor CONNECTION_ID_DESCRIPTOR = Requests.SchemasRequest.
-        getDescriptor().findFieldByNumber(Requests.SchemasRequest.CONNECTION_ID_FIELD_NUMBER);
-    private static final FieldDescriptor CATALOG_DESCRIPTOR = Requests.SchemasRequest.
-        getDescriptor().findFieldByNumber(Requests.SchemasRequest.CATALOG_FIELD_NUMBER);
-    private static final FieldDescriptor SCHEMA_PATTERN_DESCRIPTOR = Requests.SchemasRequest.
-        getDescriptor().findFieldByNumber(Requests.SchemasRequest.SCHEMA_PATTERN_FIELD_NUMBER);
-
-    public final String connectionId;
-    public final String catalog;
-    public final String schemaPattern;
-
-    SchemasRequest() {
-      connectionId = null;
-      catalog = null;
-      schemaPattern = null;
-    }
-
-    @JsonCreator
-    public SchemasRequest(@JsonProperty("connectionId") String connectionId,
-        @JsonProperty("catalog") String catalog,
-        @JsonProperty("schemaPattern") String schemaPattern) {
-      this.connectionId = connectionId;
-      this.catalog = catalog;
-      this.schemaPattern = schemaPattern;
-    }
-
-    ResultSetResponse accept(Service service) {
-      return service.apply(this);
-    }
-
-    @Override SchemasRequest deserialize(Message genericMsg) {
-      final Requests.SchemasRequest msg = ProtobufService.castProtobufMessage(genericMsg,
-          Requests.SchemasRequest.class);
-
-      String connectionId = null;
-      if (msg.hasField(CONNECTION_ID_DESCRIPTOR)) {
-        connectionId = msg.getConnectionId();
-      }
-
-      String catalog = null;
-      if (msg.hasField(CATALOG_DESCRIPTOR)) {
-        catalog = msg.getCatalog();
-      }
-
-      String schemaPattern = null;
-      if (msg.hasField(SCHEMA_PATTERN_DESCRIPTOR)) {
-        schemaPattern = msg.getSchemaPattern();
-      }
-
-      return new SchemasRequest(connectionId, catalog, schemaPattern);
-    }
-
-    @Override Requests.SchemasRequest serialize() {
-      Requests.SchemasRequest.Builder builder = Requests.SchemasRequest.newBuilder();
-      if (null != connectionId) {
-        builder.setConnectionId(connectionId);
-      }
-      if (null != catalog) {
-        builder.setCatalog(catalog);
-      }
-      if (null != schemaPattern) {
-        builder.setSchemaPattern(schemaPattern);
-      }
-
-      return builder.build();
-    }
-
-    @Override public int hashCode() {
-      int result = 1;
-      result = p(result, connectionId);
-      result = p(result, catalog);
-      result = p(result, schemaPattern);
-      return result;
-    }
-
-    @Override public boolean equals(Object o) {
-      return o == this
-          || o instanceof SchemasRequest
-          && Objects.equals(connectionId, ((SchemasRequest) o).connectionId)
-          && Objects.equals(catalog, ((SchemasRequest) o).catalog)
-          && Objects.equals(schemaPattern, ((SchemasRequest) o).schemaPattern);
-    }
-  }
-
-  /** Request for
-   * {@link Meta#getTables(Meta.ConnectionHandle, String, org.apache.calcite.avatica.Meta.Pat, org.apache.calcite.avatica.Meta.Pat, java.util.List)}
-   */
-  class TablesRequest extends Request {
-    private static final FieldDescriptor CONNECTION_ID_DESCRIPTOR = Requests.TablesRequest.
-        getDescriptor().findFieldByNumber(Requests.TablesRequest.CONNECTION_ID_FIELD_NUMBER);
-    private static final FieldDescriptor CATALOG_DESCRIPTOR = Requests.TablesRequest.
-        getDescriptor().findFieldByNumber(Requests.TablesRequest.CATALOG_FIELD_NUMBER);
-    private static final FieldDescriptor SCHEMA_PATTERN_DESCRIPTOR = Requests.TablesRequest.
-        getDescriptor().findFieldByNumber(Requests.TablesRequest.SCHEMA_PATTERN_FIELD_NUMBER);
-    private static final FieldDescriptor TABLE_NAME_PATTERN_DESCRIPTOR = Requests.TablesRequest.
-        getDescriptor().findFieldByNumber(Requests.TablesRequest.TABLE_NAME_PATTERN_FIELD_NUMBER);
-
-    public final String connectionId;
-    public final String catalog;
-    public final String schemaPattern;
-    public final String tableNamePattern;
-    public final List<String> typeList;
-
-    TablesRequest() {
-      connectionId = null;
-      catalog = null;
-      schemaPattern = null;
-      tableNamePattern = null;
-      typeList = null;
-    }
-
-    @JsonCreator
-    public TablesRequest(@JsonProperty("connectionId") String connectionId,
-        @JsonProperty("catalog") String catalog,
-        @JsonProperty("schemaPattern") String schemaPattern,
-        @JsonProperty("tableNamePattern") String tableNamePattern,
-        @JsonProperty("typeList") List<String> typeList) {
-      this.connectionId = connectionId;
-      this.catalog = catalog;
-      this.schemaPattern = schemaPattern;
-      this.tableNamePattern = tableNamePattern;
-      this.typeList = typeList;
-    }
-
-    @Override Response accept(Service service) {
-      return service.apply(this);
-    }
-
-    @Override Request deserialize(Message genericMsg) {
-      final Requests.TablesRequest msg = ProtobufService.castProtobufMessage(genericMsg,
-          Requests.TablesRequest.class);
-
-      String connectionId = null;
-      if (msg.hasField(CONNECTION_ID_DESCRIPTOR)) {
-        connectionId = msg.getConnectionId();
-      }
-
-      String catalog = null;
-      if (msg.hasField(CATALOG_DESCRIPTOR)) {
-        catalog = msg.getCatalog();
-      }
-
-      String schemaPattern = null;
-      if (msg.hasField(SCHEMA_PATTERN_DESCRIPTOR)) {
-        schemaPattern = msg.getSchemaPattern();
-      }
-
-      String tableNamePattern = null;
-      if (msg.hasField(TABLE_NAME_PATTERN_DESCRIPTOR)) {
-        tableNamePattern = msg.getTableNamePattern();
-      }
-
-      // Cannot determine if a value was set for a repeated field. Must use an extra boolean
-      // parameter to distinguish an empty and null typeList.
-      List<String> typeList = null;
-      if (msg.getHasTypeList()) {
-        typeList = msg.getTypeListList();
-      }
-
-      return new TablesRequest(connectionId, catalog, schemaPattern, tableNamePattern, typeList);
-    }
-
-    @Override Requests.TablesRequest serialize() {
-      Requests.TablesRequest.Builder builder = Requests.TablesRequest.newBuilder();
-
-      if (null != connectionId) {
-        builder.setConnectionId(connectionId);
-      }
-      if (null != catalog) {
-        builder.setCatalog(catalog);
-      }
-      if (null != schemaPattern) {
-        builder.setSchemaPattern(schemaPattern);
-      }
-      if (null != tableNamePattern) {
-        builder.setTableNamePattern(tableNamePattern);
-      }
-      if (null != typeList) {
-        builder.setHasTypeList(true);
-        builder.addAllTypeList(typeList);
-      } else {
-        builder.setHasTypeList(false);
-      }
-
-      return builder.build();
-    }
-
-    @Override public int hashCode() {
-      int result = 1;
-      result = p(result, connectionId);
-      result = p(result, catalog);
-      result = p(result, schemaPattern);
-      result = p(result, tableNamePattern);
-      result = p(result, typeList);
-      return result;
-    }
-
-    @Override public boolean equals(Object o) {
-      return o == this
-          || o instanceof TablesRequest
-          && Objects.equals(connectionId, ((TablesRequest) o).connectionId)
-          && Objects.equals(catalog, ((TablesRequest) o).catalog)
-          && Objects.equals(schemaPattern, ((TablesRequest) o).schemaPattern)
-          && Objects.equals(tableNamePattern, ((TablesRequest) o).tableNamePattern)
-          && Objects.equals(typeList, ((TablesRequest) o).typeList);
-    }
-  }
-
-  /**
-   * Request for {@link Meta#getTableTypes(Meta.ConnectionHandle)}.
-   */
-  class TableTypesRequest extends Request {
-    private static final FieldDescriptor CONNECTION_ID_DESCRIPTOR = Requests.TableTypesRequest.
-        getDescriptor().findFieldByNumber(Requests.TableTypesRequest.CONNECTION_ID_FIELD_NUMBER);
-    public final String connectionId;
-
-    public TableTypesRequest() {
-      this.connectionId = null;
-    }
-
-    @JsonCreator
-    public TableTypesRequest(@JsonProperty("connectionId") String connectionId) {
-      this.connectionId = connectionId;
-    }
-
-    @Override ResultSetResponse accept(Service service) {
-      return service.apply(this);
-    }
-
-    @Override TableTypesRequest deserialize(Message genericMsg) {
-      final Requests.TableTypesRequest msg = ProtobufService.castProtobufMessage(genericMsg,
-          Requests.TableTypesRequest.class);
-
-      String connectionId = null;
-      if (msg.hasField(CONNECTION_ID_DESCRIPTOR)) {
-        connectionId = msg.getConnectionId();
-      }
-
-      return new TableTypesRequest(connectionId);
-    }
-
-    @Override Requests.TableTypesRequest serialize() {
-      Requests.TableTypesRequest.Builder builder = Requests.TableTypesRequest.newBuilder();
-      if (null != connectionId) {
-        builder.setConnectionId(connectionId);
-      }
-
-      return builder.build();
-    }
-
-    @Override public int hashCode() {
-      int result = 1;
-      result = p(result, connectionId);
-      return result;
-    }
-
-    @Override public boolean equals(Object o) {
-      return o == this
-          || o instanceof TableTypesRequest
-          && Objects.equals(connectionId, ((TableTypesRequest) o).connectionId);
-    }
-  }
-
-  /** Request for
-   * {@link Meta#getColumns(Meta.ConnectionHandle, String, org.apache.calcite.avatica.Meta.Pat, org.apache.calcite.avatica.Meta.Pat, org.apache.calcite.avatica.Meta.Pat)}.
-   */
-  class ColumnsRequest extends Request {
-    private static final FieldDescriptor CONNECTION_ID_DESCRIPTOR = Requests.ColumnsRequest.
-        getDescriptor().findFieldByNumber(Requests.ColumnsRequest.CONNECTION_ID_FIELD_NUMBER);
-    private static final FieldDescriptor CATALOG_DESCRIPTOR = Requests.ColumnsRequest.
-        getDescriptor().findFieldByNumber(Requests.ColumnsRequest.CATALOG_FIELD_NUMBER);
-    private static final FieldDescriptor SCHEMA_PATTERN_DESCRIPTOR = Requests.ColumnsRequest.
-        getDescriptor().findFieldByNumber(Requests.ColumnsRequest.SCHEMA_PATTERN_FIELD_NUMBER);
-    private static final FieldDescriptor TABLE_NAME_PATTERN_DESCRIPTOR = Requests.ColumnsRequest.
-        getDescriptor().findFieldByNumber(Requests.ColumnsRequest.TABLE_NAME_PATTERN_FIELD_NUMBER);
-    private static final FieldDescriptor COLUMN_NAME_PATTERN_DESCRIPTOR = Requests.ColumnsRequest.
-        getDescriptor().findFieldByNumber(Requests.ColumnsRequest.COLUMN_NAME_PATTERN_FIELD_NUMBER);
-
-    public final String connectionId;
-    public final String catalog;
-    public final String schemaPattern;
-    public final String tableNamePattern;
-    public final String columnNamePattern;
-
-    ColumnsRequest() {
-      connectionId = null;
-      catalog = null;
-      schemaPattern = null;
-      tableNamePattern = null;
-      columnNamePattern = null;
-    }
-
-    @JsonCreator
-    public ColumnsRequest(@JsonProperty("connectionId") String connectionId,
-        @JsonProperty("catalog") String catalog,
-        @JsonProperty("schemaPattern") String schemaPattern,
-        @JsonProperty("tableNamePattern") String tableNamePattern,
-        @JsonProperty("columnNamePattern") String columnNamePattern) {
-      this.connectionId = connectionId;
-      this.catalog = catalog;
-      this.schemaPattern = schemaPattern;
-      this.tableNamePattern = tableNamePattern;
-      this.columnNamePattern = columnNamePattern;
-    }
-
-    ResultSetResponse accept(Service service) {
-      return service.apply(this);
-    }
-
-    @Override ColumnsRequest deserialize(Message genericMsg) {
-      final Requests.ColumnsRequest msg = ProtobufService.castProtobufMessage(genericMsg,
-          Requests.ColumnsRequest.class);
-
-      String connectionId = null;
-      if (msg.hasField(CONNECTION_ID_DESCRIPTOR)) {
-        connectionId = msg.getConnectionId();
-      }
-
-      String catalog = null;
-      if (msg.hasField(CATALOG_DESCRIPTOR)) {
-        catalog = msg.getCatalog();
-      }
-
-      String schemaPattern = null;
-      if (msg.hasField(SCHEMA_PATTERN_DESCRIPTOR)) {
-        schemaPattern = msg.getSchemaPattern();
-      }
-
-      String tableNamePattern = null;
-      if (msg.hasField(TABLE_NAME_PATTERN_DESCRIPTOR)) {
-        tableNamePattern = msg.getTableNamePattern();
-      }
-
-      String columnNamePattern = null;
-      if (msg.hasField(COLUMN_NAME_PATTERN_DESCRIPTOR)) {
-        columnNamePattern = msg.getColumnNamePattern();
-      }
-
-      return new ColumnsRequest(connectionId, catalog, schemaPattern, tableNamePattern,
-          columnNamePattern);
-    }
-
-    @Override Requests.ColumnsRequest serialize() {
-      Requests.ColumnsRequest.Builder builder = Requests.ColumnsRequest.newBuilder();
-
-      if (null != connectionId) {
-        builder.setConnectionId(connectionId);
-      }
-      if (null != catalog) {
-        builder.setCatalog(catalog);
-      }
-      if (null != schemaPattern) {
-        builder.setSchemaPattern(schemaPattern);
-      }
-      if (null != tableNamePattern) {
-        builder.setTableNamePattern(tableNamePattern);
-      }
-      if (null != columnNamePattern) {
-        builder.setColumnNamePattern(columnNamePattern);
-      }
-
-      return builder.build();
-    }
-
-    @Override public int hashCode() {
-      int result = 1;
-      result = p(result, connectionId);
-      result = p(result, catalog);
-      result = p(result, columnNamePattern);
-      result = p(result, schemaPattern);
-      result = p(result, tableNamePattern);
-      return result;
-    }
-
-    @Override public boolean equals(Object o) {
-      return o == this
-          || o instanceof ColumnsRequest
-          && Objects.equals(connectionId, ((ColumnsRequest) o).connectionId)
-          && Objects.equals(catalog, ((ColumnsRequest) o).catalog)
-          && Objects.equals(schemaPattern, ((ColumnsRequest) o).schemaPattern)
-          && Objects.equals(tableNamePattern, ((ColumnsRequest) o).tableNamePattern)
-          && Objects.equals(columnNamePattern, ((ColumnsRequest) o).columnNamePattern);
-    }
-  }
-
-  /** Request for
-   * {@link Meta#getTypeInfo(Meta.ConnectionHandle)}. */
-  class TypeInfoRequest extends Request {
-    private static final FieldDescriptor CONNECTION_ID_DESCRIPTOR = Requests.TypeInfoRequest.
-        getDescriptor().findFieldByNumber(Requests.TypeInfoRequest.CONNECTION_ID_FIELD_NUMBER);
-    public final String connectionId;
-
-    public TypeInfoRequest() {
-      connectionId = null;
-    }
-
-    @JsonCreator
-    public TypeInfoRequest(@JsonProperty("connectionId") String connectionId) {
-      this.connectionId = connectionId;
-    }
-
-    @Override ResultSetResponse accept(Service service) {
-      return service.apply(this);
-    }
-
-    @Override TypeInfoRequest deserialize(Message genericMsg) {
-      final Requests.TypeInfoRequest msg = ProtobufService.castProtobufMessage(genericMsg,
-          Requests.TypeInfoRequest.class);
-
-      String connectionId = null;
-      if (msg.hasField(CONNECTION_ID_DESCRIPTOR)) {
-        connectionId = msg.getConnectionId();
-      }
-
-      return new TypeInfoRequest(connectionId);
-    }
-
-    @Override Requests.TypeInfoRequest serialize() {
-      Requests.TypeInfoRequest.Builder builder = Requests.TypeInfoRequest.newBuilder();
-      if (null != connectionId) {
-        builder.setConnectionId(connectionId);
-      }
-
-      return builder.build();
-    }
-
-    @Override public int hashCode() {
-      int result = 1;
-      result = p(result, connectionId);
-      return result;
-    }
-
-    @Override public boolean equals(Object o) {
-      return o == this
-          || o instanceof TypeInfoRequest
-          && Objects.equals(connectionId, ((TypeInfoRequest) o).connectionId);
-    }
-  }
-
-  /** Response that contains a result set.
-   *
-   * <p>Regular result sets have {@code updateCount} -1;
-   * any other value means a dummy result set that is just a count, and has
-   * no signature and no other data.
-   *
-   * <p>Several types of request, including
-   * {@link org.apache.calcite.avatica.Meta#getCatalogs(Meta.ConnectionHandle)} and
-   * {@link org.apache.calcite.avatica.Meta#getSchemas(Meta.ConnectionHandle, String, org.apache.calcite.avatica.Meta.Pat)}
-   * {@link Meta#getTables(Meta.ConnectionHandle, String, Meta.Pat, Meta.Pat, List)}
-   * {@link Meta#getTableTypes(Meta.ConnectionHandle)}
-   * return this response. */
-  class ResultSetResponse extends Response {
-    private static final FieldDescriptor CONNECTION_ID_DESCRIPTOR = Responses.ResultSetResponse.
-        getDescriptor().findFieldByNumber(Responses.ResultSetResponse.CONNECTION_ID_FIELD_NUMBER);
-    private static final FieldDescriptor SIGNATURE_DESCRIPTOR = Responses.ResultSetResponse.
-        getDescriptor().findFieldByNumber(Responses.ResultSetResponse.SIGNATURE_FIELD_NUMBER);
-    private static final FieldDescriptor FIRST_FRAME_DESCRIPTOR = Responses.ResultSetResponse.
-        getDescriptor().findFieldByNumber(Responses.ResultSetResponse.FIRST_FRAME_FIELD_NUMBER);
-    private static final FieldDescriptor METADATA_DESCRIPTOR = Responses.ResultSetResponse.
-        getDescriptor().findFieldByNumber(Responses.ResultSetResponse.METADATA_FIELD_NUMBER);
-
-    public final String connectionId;
-    public final int statementId;
-    public final boolean ownStatement;
-    public final Meta.Signature signature;
-    public final Meta.Frame firstFrame;
-    public final long updateCount;
-    public final RpcMetadataResponse rpcMetadata;
-
-    ResultSetResponse() {
-      connectionId = null;
-      statementId = 0;
-      ownStatement = false;
-      signature = null;
-      firstFrame = null;
-      updateCount = 0;
-      rpcMetadata = null;
-    }
-
-    @JsonCreator
-    public ResultSetResponse(
-        @JsonProperty("connectionId") String connectionId,
-        @JsonProperty("statementId") int statementId,
-        @JsonProperty("ownStatement") boolean ownStatement,
-        @JsonProperty("signature") Meta.Signature signature,
-        @JsonProperty("firstFrame") Meta.Frame firstFrame,
-        @JsonProperty("updateCount") long updateCount,
-        @JsonProperty("rpcMetadata") RpcMetadataResponse rpcMetadata) {
-      this.connectionId = connectionId;
-      this.statementId = statementId;
-      this.ownStatement = ownStatement;
-      this.signature = signature;
-      this.firstFrame = firstFrame;
-      this.updateCount = updateCount;
-      this.rpcMetadata = rpcMetadata;
-    }
-
-    @Override ResultSetResponse deserialize(Message genericMsg) {
-      final Responses.ResultSetResponse msg = ProtobufService.castProtobufMessage(genericMsg,
-          Responses.ResultSetResponse.class);
-
-      return fromProto(msg);
-    }
-
-    static ResultSetResponse fromProto(Responses.ResultSetResponse msg) {
-      String connectionId = null;
-      if (msg.hasField(CONNECTION_ID_DESCRIPTOR)) {
-        connectionId = msg.getConnectionId();
-      }
-
-      Meta.Signature signature = null;
-      if (msg.hasField(SIGNATURE_DESCRIPTOR)) {
-        signature = Meta.Signature.fromProto(msg.getSignature());
-      }
-
-      Meta.Frame frame = null;
-      if (msg.hasField(FIRST_FRAME_DESCRIPTOR)) {
-        frame = Meta.Frame.fromProto(msg.getFirstFrame());
-      }
-
-      RpcMetadataResponse metadata = null;
-      if (msg.hasField(METADATA_DESCRIPTOR)) {
-        metadata = RpcMetadataResponse.fromProto(msg.getMetadata());
-      }
-
-      return new ResultSetResponse(connectionId, msg.getStatementId(), msg.getOwnStatement(),
-          signature, frame, msg.getUpdateCount(), metadata);
-    }
-
-    @Override Responses.ResultSetResponse serialize() {
-      Responses.ResultSetResponse.Builder builder = Responses.ResultSetResponse.newBuilder();
-
-      builder.setStatementId(statementId).setOwnStatement(ownStatement).setUpdateCount(updateCount);
-
-      if (null != connectionId) {
-        builder.setConnectionId(connectionId);
-      }
-
-      if (null != signature) {
-        builder.setSignature(signature.toProto());
-      }
-
-      if (null != firstFrame) {
-        builder.setFirstFrame(firstFrame.toProto());
-      }
-
-      if (null != rpcMetadata) {
-        builder.setMetadata(rpcMetadata.serialize());
-      }
-
-      return builder.build();
-    }
-
-    @Override public int hashCode() {
-      int result = 1;
-      result = p(result, connectionId);
-      result = p(result, firstFrame);
-      result = p(result, ownStatement);
-      result = p(result, signature);
-      result = p(result, statementId);
-      result = p(result, updateCount);
-      result = p(result, rpcMetadata);
-      return result;
-    }
-
-    @Override public boolean equals(Object o) {
-      return o == this
-          || o instanceof ResultSetResponse
-          && statementId == ((ResultSetResponse) o).statementId
-          && ownStatement == ((ResultSetResponse) o).ownStatement
-          && updateCount == ((ResultSetResponse) o).updateCount
-          && Objects.equals(connectionId, ((ResultSetResponse) o).connectionId)
-          && Objects.equals(firstFrame, ((ResultSetResponse) o).firstFrame)
-          && Objects.equals(signature, ((ResultSetResponse) o).signature)
-          && Objects.equals(rpcMetadata, ((ResultSetResponse) o).rpcMetadata);
-    }
-  }
-
-  /** Request for
-   * {@link Meta#prepareAndExecute(Meta.StatementHandle, String, long, int, Meta.PrepareCallback)}.
-   */
-  class PrepareAndExecuteRequest extends Request {
-    private static final FieldDescriptor CONNECTION_ID_DESCRIPTOR = Requests.
-        PrepareAndExecuteRequest.getDescriptor().findFieldByNumber(
-            Requests.PrepareAndExecuteRequest.CONNECTION_ID_FIELD_NUMBER);
-    private static final FieldDescriptor SQL_DESCRIPTOR = Requests.
-        PrepareAndExecuteRequest.getDescriptor().findFieldByNumber(
-            Requests.PrepareAndExecuteRequest.SQL_FIELD_NUMBER);
-    private static final FieldDescriptor MAX_ROWS_TOTAL_DESCRIPTOR = Requests.
-        PrepareAndExecuteRequest.getDescriptor().findFieldByNumber(
-            Requests.PrepareAndExecuteRequest.MAX_ROWS_TOTAL_FIELD_NUMBER);
-    private static final FieldDescriptor FIRST_FRAME_MAX_SIZE_DESCRIPTOR = Requests.
-        PrepareAndExecuteRequest.getDescriptor().findFieldByNumber(
-            Requests.PrepareAndExecuteRequest.FIRST_FRAME_MAX_SIZE_FIELD_NUMBER);
-
-    public final String connectionId;
-    public final String sql;
-    public final long maxRowCount;
-    public final int maxRowsInFirstFrame;
-    public final int statementId;
-
-    PrepareAndExecuteRequest() {
-      connectionId = null;
-      sql = null;
-      maxRowCount = 0;
-      maxRowsInFirstFrame = 0;
-      statementId = 0;
-    }
-
-    public PrepareAndExecuteRequest(String connectionId, int statementId, String sql,
-        long maxRowCount) {
-      this(connectionId, statementId, sql, maxRowCount, AvaticaUtils.toSaturatedInt(maxRowCount));
-    }
-
-    @JsonCreator
-    public PrepareAndExecuteRequest(
-        @JsonProperty("connectionId") String connectionId,
-        @JsonProperty("statementId") int statementId,
-        @JsonProperty("sql") String sql,
-        @JsonProperty("maxRowsTotal") long maxRowCount,
-        @JsonProperty("maxRowsInFirstFrame") int maxRowsInFirstFrame) {
-      this.connectionId = connectionId;
-      this.statementId = statementId;
-      this.sql = sql;
-      this.maxRowCount = maxRowCount;
-      this.maxRowsInFirstFrame = maxRowsInFirstFrame;
-    }
-
-    @Override ExecuteResponse accept(Service service) {
-      return service.apply(this);
-    }
-
-    @Override PrepareAndExecuteRequest deserialize(Message genericMsg) {
-      final Requests.PrepareAndExecuteRequest msg = ProtobufService.castProtobufMessage(genericMsg,
-          Requests.PrepareAndExecuteRequest.class);
-
-      String connectionId = null;
-      if (msg.hasField(CONNECTION_ID_DESCRIPTOR)) {
-        connectionId = msg.getConnectionId();
-      }
-
-      String sql = null;
-      if (msg.hasField(SQL_DESCRIPTOR)) {
-        sql = msg.getSql();
-      }
-
-      // Use the old attribute, unless the new is set
-      long maxRowsTotal = msg.getMaxRowCount();
-      if (msg.hasField(MAX_ROWS_TOTAL_DESCRIPTOR)) {
-        maxRowsTotal = msg.getMaxRowsTotal();
-      }
-
-      // Use maxRowCount (cast to an integer) if firstFrameMaxSize isn't set
-      int maxRowsInFirstFrame = (int) maxRowsTotal;
-      if (msg.hasField(FIRST_FRAME_MAX_SIZE_DESCRIPTOR)) {
-        maxRowsInFirstFrame = msg.getFirstFrameMaxSize();
-      }
-
-      return new PrepareAndExecuteRequest(connectionId, msg.getStatementId(), sql,
-          maxRowsTotal, maxRowsInFirstFrame);
-    }
-
-    @Override Requests.PrepareAndExecuteRequest serialize() {
-      Requests.PrepareAndExecuteRequest.Builder builder = Requests.PrepareAndExecuteRequest
-          .newBuilder();
-
-      if (null != connectionId) {
-        builder.setConnectionId(connectionId);
-      }
-      if (null != sql) {
-        builder.setSql(sql);
-      }
-      builder.setStatementId(statementId);
-      // Set both attributes for backwards compat
-      builder.setMaxRowCount(maxRowCount).setMaxRowsTotal(maxRowCount);
-      builder.setFirstFrameMaxSize(maxRowsInFirstFrame);
-
-      return builder.build();
-    }
-
-    @Override public int hashCode() {
-      int result = 1;
-      result = p(result, connectionId);
-      result = p(result, maxRowCount);
-      result = p(result, maxRowsInFirstFrame);
-      result = p(result, sql);
-      result = p(result, statementId);
-      return result;
-    }
-
-    @Override public boolean equals(Object o) {
-      return o == this
-          || o instanceof PrepareAndExecuteRequest
-          && statementId == ((PrepareAndExecuteRequest) o).statementId
-          && maxRowCount == ((PrepareAndExecuteRequest) o).maxRowCount
-          && maxRowsInFirstFrame == ((PrepareAndExecuteRequest) o).maxRowsInFirstFrame
-          && Objects.equals(connectionId, ((PrepareAndExecuteRequest) o).connectionId)
-          && Objects.equals(sql, ((PrepareAndExecuteRequest) o).sql);
-    }
-  }
-
-  /** Request for
-   * {@link org.apache.calcite.avatica.Meta#execute}. */
-  class ExecuteRequest extends Request {
-    private static final FieldDescriptor STATEMENT_HANDLE_DESCRIPTOR = Requests.ExecuteRequest.
-        getDescriptor().findFieldByNumber(Requests.ExecuteRequest.STATEMENTHANDLE_FIELD_NUMBER);
-    public final Meta.StatementHandle statementHandle;
-    public final List<TypedValue> parameterValues;
-    public final long maxRowCount;
-
-    ExecuteRequest() {
-      statementHandle = null;
-      parameterValues = null;
-      maxRowCount = 0;
-    }
-
-    @JsonCreator
-    public ExecuteRequest(
-        @JsonProperty("statementHandle") Meta.StatementHandle statementHandle,
-        @JsonProperty("parameterValues") List<TypedValue> parameterValues,
-        @JsonProperty("maxRowCount") long maxRowCount) {
-      this.statementHandle = statementHandle;
-      this.parameterValues = parameterValues;
-      this.maxRowCount = maxRowCount;
-    }
-
-    @Override ExecuteResponse accept(Service service) {
-      return service.apply(this);
-    }
-
-    @Override ExecuteRequest deserialize(Message genericMsg) {
-      final Requests.ExecuteRequest msg = ProtobufService.castProtobufMessage(genericMsg,
-          Requests.ExecuteRequest.class);
-
-      Meta.StatementHandle statementHandle = null;
-      if (msg.hasField(STATEMENT_HANDLE_DESCRIPTOR)) {
-        statementHandle = Meta.StatementHandle.fromProto(msg.getStatementHandle());
-      }
-
-      List<TypedValue> values = null;
-      if (msg.getHasParameterValues()) {
-        values = new ArrayList<>(msg.getParameterValuesCount());
-        for (Common.TypedValue valueProto : msg.getParameterValuesList()) {
-          values.add(TypedValue.fromProto(valueProto));
-        }
-      }
-
-      return new ExecuteRequest(statementHandle, values, msg.getFirstFrameMaxSize());
-    }
-
-    @Override Requests.ExecuteRequest serialize() {
-      Requests.ExecuteRequest.Builder builder = Requests.ExecuteRequest.newBuilder();
-
-      if (null != statementHandle) {
-        builder.setStatementHandle(statementHandle.toProto());
-      }
-
-      if (null != parameterValues) {
-        builder.setHasParameterValues(true);
-        for (TypedValue paramValue : parameterValues) {
-          if (paramValue == null) {
-            builder.addParameterValues(TypedValue.NULL.toProto());
-          } else {
-            builder.addParameterValues(paramValue.toProto());
-          }
-        }
-      } else {
-        builder.setHasParameterValues(false);
-      }
-
-      builder.setFirstFrameMaxSize(maxRowCount);
-
-      return builder.build();
-    }
-
-    @Override public int hashCode() {
-      int result = 1;
-      result = p(result, statementHandle);
-      result = p(result, parameterValues);
-      result = p(result, maxRowCount);
-      return result;
-    }
-
-    @Override public boolean equals(Object o) {
-      return o == this
-          || o instanceof ExecuteRequest
-          && maxRowCount == ((ExecuteRequest) o).maxRowCount
-          && Objects.equals(statementHandle, ((ExecuteRequest) o).statementHandle)
-          && Objects.equals(parameterValues, ((ExecuteRequest) o).parameterValues);
-    }
-  }
-
-  /** Response to a
-   * {@link org.apache.calcite.avatica.remote.Service.PrepareAndExecuteRequest}. */
-  class ExecuteResponse extends Response {
-    private static final FieldDescriptor METADATA_DESCRIPTOR = Responses.ExecuteResponse.
-        getDescriptor().findFieldByNumber(Responses.ExecuteResponse.METADATA_FIELD_NUMBER);
-    public final List<ResultSetResponse> results;
-    public boolean missingStatement = false;
-    public final RpcMetadataResponse rpcMetadata;
-
-    ExecuteResponse() {
-      results = null;
-      rpcMetadata = null;
-    }
-
-    @JsonCreator
-    public ExecuteResponse(@JsonProperty("resultSets") List<ResultSetResponse> results,
-        @JsonProperty("missingStatement") boolean missingStatement,
-        @JsonProperty("rpcMetadata") RpcMetadataResponse rpcMetadata) {
-      this.results = results;
-      this.missingStatement = missingStatement;
-      this.rpcMetadata = rpcMetadata;
-    }
-
-    @Override ExecuteResponse deserialize(Message genericMsg) {
-      final Responses.ExecuteResponse msg = ProtobufService.castProtobufMessage(genericMsg,
-          Responses.ExecuteResponse.class);
-
-      List<Responses.ResultSetResponse> msgResults = msg.getResultsList();
-      List<ResultSetResponse> copiedResults = new ArrayList<>(msgResults.size());
-
-      for (Responses.ResultSetResponse msgResult : msgResults) {
-        copiedResults.add(ResultSetResponse.fromProto(msgResult));
-      }
-
-      RpcMetadataResponse metadata = null;
-      if (msg.hasField(METADATA_DESCRIPTOR)) {
-        metadata = RpcMetadataResponse.fromProto(msg.getMetadata());
-      }
-
-      return new ExecuteResponse(copiedResults, msg.getMissingStatement(), metadata);
-    }
-
-    @Override Responses.ExecuteResponse serialize() {
-      Responses.ExecuteResponse.Builder builder = Responses.ExecuteResponse.newBuilder();
-
-      if (null != results) {
-        for (ResultSetResponse result : results) {
-          builder.addResults(result.serialize());
-        }
-      }
-
-      if (null != rpcMetadata) {
-        builder.setMetadata(rpcMetadata.serialize());
-      }
-
-      return builder.setMissingStatement(missingStatement).build();
-    }
-
-    @Override public int hashCode() {
-      int result = 1;
-      result = p(result, results);
-      result = p(result, rpcMetadata);
-      return result;
-    }
-
-    @Override public boolean equals(Object o) {
-      return o == this
-          || o instanceof ExecuteResponse
-          && Objects.equals(results, ((ExecuteResponse) o).results)
-          && Objects.equals(rpcMetadata, ((ExecuteResponse) o).rpcMetadata);
-    }
-  }
-
-  /** Request for
-   * {@link Meta#prepare(Meta.ConnectionHandle, String, long)}. */
-  class PrepareRequest extends Request {
-    private static final FieldDescriptor CONNECTION_ID_DESCRIPTOR = Requests.PrepareRequest.
-        getDescriptor().findFieldByNumber(Requests.PrepareRequest.CONNECTION_ID_FIELD_NUMBER);
-    private static final FieldDescriptor SQL_DESCRIPTOR = Requests.PrepareRequest.
-        getDescriptor().findFieldByNumber(Requests.PrepareRequest.SQL_FIELD_NUMBER);
-    private static final FieldDescriptor MAX_ROWS_TOTAL_DESCRIPTOR = Requests.PrepareRequest.
-        getDescriptor().findFieldByNumber(Requests.PrepareRequest.MAX_ROWS_TOTAL_FIELD_NUMBER);
-
-    public final String connectionId;
-    public final String sql;
-    public final long maxRowCount;
-
-    PrepareRequest() {
-      connectionId = null;
-      sql = null;
-      maxRowCount = 0;
-    }
-
-    @JsonCreator
-    public PrepareRequest(
-        @JsonProperty("connectionId") String connectionId,
-        @JsonProperty("sql") String sql,
-        @JsonProperty("maxRowCount") long maxRowCount) {
-      this.connectionId = connectionId;
-      this.sql = sql;
-      this.maxRowCount = maxRowCount;
-    }
-
-    @Override PrepareResponse accept(Service service) {
-      return service.apply(this);
-    }
-
-    @Override PrepareRequest deserialize(Message genericMsg) {
-      final Requests.PrepareRequest msg = ProtobufService.castProtobufMessage(genericMsg,
-          Requests.PrepareRequest.class);
-
-      String connectionId = null;
-      if (msg.hasField(CONNECTION_ID_DESCRIPTOR)) {
-        connectionId = msg.getConnectionId();
-      }
-
-      String sql = null;
-      if (msg.hasField(SQL_DESCRIPTOR)) {
-        sql = msg.getSql();
-      }
-
-      // Use the old field unless the new field is provided
-      long totalRowsForStatement = msg.getMaxRowCount();
-      if (msg.hasField(MAX_ROWS_TOTAL_DESCRIPTOR)) {
-        totalRowsForStatement = msg.getMaxRowsTotal();
-      }
-
-      return new PrepareRequest(connectionId, sql, totalRowsForStatement);
-    }
-
-    @Override Requests.PrepareRequest serialize() {
-      Requests.PrepareRequest.Builder builder = Requests.PrepareRequest.newBuilder();
-
-      if (null != connectionId) {
-        builder.setConnectionId(connectionId);
-      }
-
-      if (null != sql) {
-        builder.setSql(sql);
-      }
-
-      // Set both field for backwards compatibility
-      return builder.setMaxRowCount(maxRowCount).setMaxRowsTotal(maxRowCount).build();
-    }
-
-    @Override public int hashCode() {
-      int result = 1;
-      result = p(result, connectionId);
-      result = p(result, maxRowCount);
-      result = p(result, sql);
-      return result;
-    }
-
-    @Override public boolean equals(Object o) {
-      return o == this
-          || o instanceof PrepareRequest
-          && maxRowCount == ((PrepareRequest) o).maxRowCount
-          && Objects.equals(connectionId, ((PrepareRequest) o).connectionId)
-          && Objects.equals(sql, ((PrepareRequest) o).sql);
-    }
-  }
-
-  /** Response from
-   * {@link org.apache.calcite.avatica.remote.Service.PrepareRequest}. */
-  class PrepareResponse extends Response {
-    private static final FieldDescriptor METADATA_DESCRIPTOR = Responses.PrepareResponse.
-        getDescriptor().findFieldByNumber(Responses.PrepareResponse.METADATA_FIELD_NUMBER);
-    public final Meta.StatementHandle statement;
-    public final RpcMetadataResponse rpcMetadata;
-
-    PrepareResponse() {
-      statement = null;
-      rpcMetadata = null;
-    }
-
-    @JsonCreator
-    public PrepareResponse(
-        @JsonProperty("statement") Meta.StatementHandle statement,
-        @JsonProperty("rpcMetadata") RpcMetadataResponse rpcMetadata) {
-      this.statement = statement;
-      this.rpcMetadata = rpcMetadata;
-    }
-
-    @Override PrepareResponse deserialize(Message genericMsg) {
-      final Responses.PrepareResponse msg = ProtobufService.castProtobufMessage(genericMsg,
-          Responses.PrepareResponse.class);
-
-      RpcMetadataResponse metadata = null;
-      if (msg.hasField(METADATA_DESCRIPTOR)) {
-        metadata = RpcMetadataResponse.fromProto(msg.getMetadata());
-      }
-
-      return new PrepareResponse(Meta.StatementHandle.fromProto(msg.getStatement()), metadata);
-    }
-
-    @Override Responses.PrepareResponse serialize() {
-      Responses.PrepareResponse.Builder builder = Responses.PrepareResponse.newBuilder();
-
-      if (null != statement) {
-        builder.setStatement(statement.toProto());
-      }
-
-      if (null != rpcMetadata) {
-        builder.setMetadata(rpcMetadata.serialize());
-      }
-
-      return builder.build();
-    }
-
-    @Override public int hashCode() {
-      int result = 1;
-      result = p(result, statement);
-      result = p(result, rpcMetadata);
-      return result;
-    }
-
-    @Override public boolean equals(Object o) {
-      return o == this
-          || o instanceof PrepareResponse
-          && Objects.equals(statement, ((PrepareResponse) o).statement)
-          && Objects.equals(rpcMetadata, ((PrepareResponse) o).rpcMetadata);
-    }
-  }
-
-  /** Request for
-   * {@link Meta#fetch}. */
-  class FetchRequest extends Request {
-    private static final FieldDescriptor CONNECTION_ID_DESCRIPTOR = Requests.FetchRequest.
-        getDescriptor().findFieldByNumber(Requests.FetchRequest.CONNECTION_ID_FIELD_NUMBER);
-    private static final FieldDescriptor FRAME_MAX_SIZE_DESCRIPTOR = Requests.FetchRequest.
-        getDescriptor().findFieldByNumber(Requests.FetchRequest.FRAME_MAX_SIZE_FIELD_NUMBER);
-
-    public final String connectionId;
-    public final int statementId;
-    public final long offset;
-    /** Maximum number of rows to be returned in the frame. Negative means no
-     * limit. */
-    public final int fetchMaxRowCount;
-
-    FetchRequest() {
-      connectionId = null;
-      statementId = 0;
-      offset = 0;
-      fetchMaxRowCount = 0;
-    }
-
-    @JsonCreator
-    public FetchRequest(
-        @JsonProperty("connectionId") String connectionId,
-        @JsonProperty("statementId") int statementId,
-        @JsonProperty("offset") long offset,
-        @JsonProperty("fetchMaxRowCount") int fetchMaxRowCount) {
-      this.connectionId = connectionId;
-      this.statementId = statementId;
-      this.offset = offset;
-      this.fetchMaxRowCount = fetchMaxRowCount;
-    }
-
-    @Override FetchResponse accept(Service service) {
-      return service.apply(this);
-    }
-
-    @Override FetchRequest deserialize(Message genericMsg) {
-      final Requests.FetchRequest msg = ProtobufService.castProtobufMessage(genericMsg,
-          Requests.FetchRequest.class);
-
-      String connectionId = null;
-      if (msg.hasField(CONNECTION_ID_DESCRIPTOR)) {
-        connectionId = msg.getConnectionId();
-      }
-
-      int fetchMaxRowCount = msg.getFetchMaxRowCount();
-      if (msg.hasField(FRAME_MAX_SIZE_DESCRIPTOR)) {
-        fetchMaxRowCount = msg.getFrameMaxSize();
-      }
-
-      return new FetchRequest(connectionId, msg.getStatementId(), msg.getOffset(),
-          fetchMaxRowCount);
-    }
-
-    @Override Requests.FetchRequest serialize() {
-      Requests.FetchRequest.Builder builder = Requests.FetchRequest.newBuilder();
-
-      if (null != connectionId) {
-        builder.setConnectionId(connectionId);
-      }
-
-      builder.setStatementId(statementId);
-      builder.setOffset(offset);
-      // Both fields for backwards compat
-      builder.setFetchMaxRowCount(fetchMaxRowCount).setFrameMaxSize(fetchMaxRowCount);
-
-      return builder.build();
-    }
-
-    @Override public int hashCode() {
-      int result = 1;
-      result = p(result, connectionId);
-      result = p(result, fetchMaxRowCount);
-      result = p(result, offset);
-      result = p(result, statementId);
-      return result;
-    }
-
-    @Override public boolean equals(Object o) {
-      return o == this
-          || o instanceof FetchRequest
-          && statementId == ((FetchRequest) o).statementId
-          && offset == ((FetchRequest) o).offset
-          && fetchMaxRowCount == ((FetchRequest) o).fetchMaxRowCount
-          && Objects.equals(connectionId, ((FetchRequest) o).connectionId);
-    }
-  }
-
-  /** Response from
-   * {@link org.apache.calcite.avatica.remote.Service.FetchRequest}. */
-  class FetchResponse extends Response {
-    private static final FieldDescriptor METADATA_DESCRIPTOR = Responses.FetchResponse.
-        getDescriptor().findFieldByNumber(Responses.FetchResponse.METADATA_FIELD_NUMBER);
-    public final Meta.Frame frame;
-    public boolean missingStatement = false;
-    public boolean missingResults = false;
-    public final RpcMetadataResponse rpcMetadata;
-
-    FetchResponse() {
-      frame = null;
-      rpcMetadata = null;
-    }
-
-    @JsonCreator
-    public FetchResponse(@JsonProperty("frame") Meta.Frame frame,
-        @JsonProperty("missingStatement") boolean missingStatement,
-        @JsonProperty("missingResults") boolean missingResults,
-        @JsonProperty("rpcMetadata") RpcMetadataResponse rpcMetadata) {
-      this.frame = frame;
-      this.missingStatement = missingStatement;
-      this.missingResults = missingResults;
-      this.rpcMetadata = rpcMetadata;
-    }
-
-    @Override FetchResponse deserialize(Message genericMsg) {
-      final Responses.FetchResponse msg = ProtobufService.castProtobufMessage(genericMsg,
-          Responses.FetchResponse.class);
-
-      RpcMetadataResponse metadata = null;
-      if (msg.hasField(METADATA_DESCRIPTOR)) {
-        metadata = RpcMetadataResponse.fromProto(msg.getMetadata());
-      }
-
-      return new FetchResponse(Meta.Frame.fromProto(msg.getFrame()), msg.getMissingStatement(),
-          msg.getMissingResults(), metadata);
-    }
-
-    @Override Responses.FetchResponse serialize() {
-      Responses.FetchResponse.Builder builder = Responses.FetchResponse.newBuilder();
-
-      if (null != frame) {
-        builder.setFrame(frame.toProto());
-      }
-
-      if (null != rpcMetadata) {
-        builder.setMetadata(rpcMetadata.serialize());
-      }
-
-      return builder.setMissingStatement(missingStatement)
-          .setMissingResults(missingResults).build();
-    }
-
-    @Override public int hashCode() {
-      int result = 1;
-      result = p(result, frame);
-      result = p(result, rpcMetadata);
-      return result;
-    }
-
-    @Override public boolean equals(Object o) {
-      return o == this
-          || o instanceof FetchResponse
-          && Objects.equals(frame, ((FetchResponse) o).frame)
-          && Objects.equals(rpcMetadata, ((FetchResponse) o).rpcMetadata)
-          && missingStatement == ((FetchResponse) o).missingStatement;
-    }
-  }
-
-  /** Request for
-   * {@link org.apache.calcite.avatica.Meta#createStatement(org.apache.calcite.avatica.Meta.ConnectionHandle)}. */
-  class CreateStatementRequest extends Request {
-    private static final FieldDescriptor CONNECTION_ID_DESCRIPTOR = Requests.CreateStatementRequest.
-        getDescriptor().findFieldByNumber(
-            Requests.CreateStatementRequest.CONNECTION_ID_FIELD_NUMBER);
-    public final String connectionId;
-
-    CreateStatementRequest() {
-      connectionId = null;
-    }
-
-    @JsonCreator
-    public CreateStatementRequest(
-        @JsonProperty("signature") String connectionId) {
-      this.connectionId = connectionId;
-    }
-
-    @Override CreateStatementResponse accept(Service service) {
-      return service.apply(this);
-    }
-
-    @Override CreateStatementRequest deserialize(Message genericMsg) {
-      final Requests.CreateStatementRequest msg = ProtobufService.castProtobufMessage(genericMsg,
-          Requests.CreateStatementRequest.class);
-
-      String connectionId = null;
-      if (msg.hasField(CONNECTION_ID_DESCRIPTOR)) {
-        connectionId = msg.getConnectionId();
-      }
-
-      return new CreateStatementRequest(connectionId);
-    }
-
-    @Override Requests.CreateStatementRequest serialize() {
-      Requests.CreateStatementRequest.Builder builder = Requests.CreateStatementRequest
-          .newBuilder();
-
-      if (null != connectionId) {
-        builder.setConnectionId(connectionId);
-      }
-
-      return builder.build();
-    }
-
-    @Override public int hashCode() {
-      int result = 1;
-      result = p(result, connectionId);
-      return result;
-    }
-
-    @Override public boolean equals(Object o) {
-      return o == this
-          || o instanceof CreateStatementRequest
-          && Objects.equals(connectionId, ((CreateStatementRequest) o).connectionId);
-    }
-  }
-
-  /** Response from
-   * {@link org.apache.calcite.avatica.remote.Service.CreateStatementRequest}. */
-  class CreateStatementResponse extends Response {
-    private static final FieldDescriptor CONNECTION_ID_DESCRIPTOR = Responses.
-        CreateStatementResponse.getDescriptor().findFieldByNumber(
-            Responses.CreateStatementResponse.CONNECTION_ID_FIELD_NUMBER);
-    private static final FieldDescriptor METADATA_DESCRIPTOR = Responses.
-        CreateStatementResponse.getDescriptor().findFieldByNumber(
-            Responses.CreateStatementResponse.METADATA_FIELD_NUMBER);
-    public final String connectionId;
-    public final int statementId;
-    public final RpcMetadataResponse rpcMetadata;
-
-    CreateStatementResponse() {
-      connectionId = null;
-      statementId = 0;
-      rpcMetadata = null;
-    }
-
-    @JsonCreator
-    public CreateStatementResponse(
-        @JsonProperty("connectionId") String connectionId,
-        @JsonProperty("statementId") int statementId,
-        @JsonProperty("rpcMetadata") RpcMetadataResponse rpcMetadata) {
-      this.connectionId = connectionId;
-      this.statementId = statementId;
-      this.rpcMetadata = rpcMetadata;
-    }
-
-    @Override CreateStatementResponse deserialize(Message genericMsg) {
-      final Responses.CreateStatementResponse msg = ProtobufService.castProtobufMessage(genericMsg,
-          Responses.CreateStatementResponse.class);
-      String connectionId = null;
-      if (msg.hasField(CONNECTION_ID_DESCRIPTOR)) {
-        connectionId = msg.getConnectionId();
-      }
-
-      RpcMetadataResponse metadata = null;
-      if (msg.hasField(METADATA_DESCRIPTOR)) {
-        metadata = RpcMetadataResponse.fromProto(msg.getMetadata());
-      }
-
-      return new CreateStatementResponse(connectionId, msg.getStatementId(), metadata);
-    }
-
-    @Override Responses.CreateStatementResponse serialize() {
-      Responses.CreateStatementResponse.Builder builder = Responses.CreateStatementResponse
-          .newBuilder();
-
-      if (null != connectionId) {
-        builder.setConnectionId(connectionId);
-      }
-
-      if (null != rpcMetadata) {
-        builder.setMetadata(rpcMetadata.serialize());
-      }
-
-      builder.setStatementId(statementId);
-
-      return builder.build();
-    }
-
-    @Override public int hashCode() {
-      int result = 1;
-      result = p(result, connectionId);
-      result = p(result, statementId);
-      result = p(result, rpcMetadata);
-      return result;
-    }
-
-    @Override public boolean equals(Object o) {
-      return o == this
-          || o instanceof CreateStatementResponse
-          && statementId == ((CreateStatementResponse) o).statementId
-          && Objects.equals(connectionId, ((CreateStatementResponse) o).connectionId)
-          && Objects.equals(rpcMetadata, ((CreateStatementResponse) o).rpcMetadata);
-    }
-  }
-
-  /** Request for
-   * {@link org.apache.calcite.avatica.Meta#closeStatement(org.apache.calcite.avatica.Meta.StatementHandle)}. */
-  class CloseStatementRequest extends Request {
-    private static final FieldDescriptor CONNECTION_ID_DESCRIPTOR = Requests.CloseStatementRequest.
-        getDescriptor().findFieldByNumber(
-            Requests.CloseStatementRequest.CONNECTION_ID_FIELD_NUMBER);
-    public final String connectionId;
-    public final int statementId;
-
-    CloseStatementRequest() {
-      connectionId = null;
-      statementId = 0;
-    }
-
-    @JsonCreator
-    public CloseStatementRequest(
-        @JsonProperty("connectionId") String connectionId,
-        @JsonProperty("statementId") int statementId) {
-      this.connectionId = connectionId;
-      this.statementId = statementId;
-    }
-
-    @Override CloseStatementResponse accept(Service service) {
-      return service.apply(this);
-    }
-
-    @Override CloseStatementRequest deserialize(Message genericMsg) {
-      final Requests.CloseStatementRequest msg = ProtobufService.castProtobufMessage(genericMsg,
-          Requests.CloseStatementRequest.class);
-
-      String connectionId = null;
-      if (msg.hasField(CONNECTION_ID_DESCRIPTOR)) {
-        connectionId = msg.getConnectionId();
-      }
-
-      return new CloseStatementRequest(connectionId, msg.getStatementId());
-    }
-
-    @Override Requests.CloseStatementRequest serialize() {
-      Requests.CloseStatementRequest.Builder builder = Requests.CloseStatementRequest.newBuilder();
-
-      if (null != connectionId) {
-        builder.setConnectionId(connectionId);
-      }
-
-      return builder.setStatementId(statementId).build();
-    }
-
-    @Override public int hashCode() {
-      int result = 1;
-      result = p(result, connectionId);
-      result = p(result, statementId);
-      return result;
-    }
-
-    @Override public boolean equals(Object o) {
-      return o == this
-          || o instanceof CloseStatementRequest
-          && statementId == ((CloseStatementRequest) o).statementId
-          && Objects.equals(connectionId, ((CloseStatementRequest) o).connectionId);
-    }
-  }
-
-  /** Response from
-   * {@link org.apache.calcite.avatica.remote.Service.CloseStatementRequest}. */
-  class CloseStatementResponse extends Response {
-    private static final FieldDescriptor CONNECTION_ID_DESCRIPTOR = Responses.
-        CloseStatementResponse.getDescriptor().findFieldByNumber(
-            Responses.CloseStatementResponse.METADATA_FIELD_NUMBER);
-
-    public final RpcMetadataResponse rpcMetadata;
-
-    public CloseStatementResponse() {
-      rpcMetadata = null;
-    }
-
-    @JsonCreator
-    public CloseStatementResponse(@JsonProperty("rpcMetadata") RpcMetadataResponse rpcMetadata) {
-      this.rpcMetadata = rpcMetadata;
-    }
-
-    @Override CloseStatementResponse deserialize(Message genericMsg) {
-      final Responses.CloseStatementResponse msg = ProtobufService.castProtobufMessage(genericMsg,
-          Responses.CloseStatementResponse.class);
-      RpcMetadataResponse metadata = null;
-      if (msg.hasField(CONNECTION_ID_DESCRIPTOR)) {
-        metadata = RpcMetadataResponse.fromProto(msg.getMetadata());
-      }
-
-      return new CloseStatementResponse(metadata);
-    }
-
-    @Override Responses.CloseStatementResponse serialize() {
-      Responses.CloseStatementResponse.Builder builder =
-          Responses.CloseStatementResponse.newBuilder();
-
-      if (null != rpcMetadata) {
-        builder.setMetadata(rpcMetadata.serialize());
-      }
-
-      return builder.build();
-    }
-
-    @Override public int hashCode() {
-      int result = 1;
-      result = p(result, rpcMetadata);
-      return result;
-    }
-
-    @Override public boolean equals(Object o) {
-      return o == this
-          || o instanceof CloseStatementResponse
-          && Objects.equals(rpcMetadata, ((CloseStatementResponse) o).rpcMetadata);
-    }
-  }
-
-  /** Request for
-   * {@link Meta#openConnection}. */
-  class OpenConnectionRequest extends Request {
-    private static final FieldDescriptor CONNECTION_ID_DESCRIPTOR = Requests.OpenConnectionRequest
-        .getDescriptor().findFieldByNumber(
-            Requests.OpenConnectionRequest.CONNECTION_ID_FIELD_NUMBER);
-    public final String connectionId;
-    public final Map<String, String> info;
-
-    public OpenConnectionRequest() {
-      connectionId = null;
-      info = null;
-    }
-
-    @JsonCreator
-    public OpenConnectionRequest(@JsonProperty("connectionId") String connectionId,
-        @JsonProperty("info") Map<String, String> info) {
-      this.connectionId = connectionId;
-      this.info = info;
-    }
-
-    @Override OpenConnectionResponse accept(Service service) {
-      return service.apply(this);
-    }
-
-    /**
-     * Serializes the necessary properties into a Map.
-     *
-     * @param props The properties to serialize.
-     * @return A representation of the Properties as a Map.
-     */
-    public static Map<String, String> serializeProperties(Properties props) {
-      Map<String, String> infoAsString = new HashMap<>();
-      for (Map.Entry<Object, Object> entry : props.entrySet()) {
-        // Determine if this is a property we want to forward to the server
-        if (!BuiltInConnectionProperty.isLocalProperty(entry.getKey())) {
-          infoAsString.put(entry.getKey().toString(), entry.getValue().toString());
-        }
-      }
-      return infoAsString;
-    }
-
-    @Override Request deserialize(Message genericMsg) {
-      final Requests.OpenConnectionRequest msg = ProtobufService.castProtobufMessage(genericMsg,
-          Requests.OpenConnectionRequest.class);
-
-      String connectionId = null;
-      if (msg.hasField(CONNECTION_ID_DESCRIPTOR)) {
-        connectionId = msg.getConnectionId();
-      }
-
-      Map<String, String> info = msg.getInfoMap();
-      if (info.isEmpty()) {
-        info = null;
-      }
-
-      return new OpenConnectionRequest(connectionId, info);
-    }
-
-    @Override Message serialize() {
-      Requests.OpenConnectionRequest.Builder builder = Requests.OpenConnectionRequest.newBuilder();
-      if (null != connectionId) {
-        builder.setConnectionId(connectionId);
-      }
-      if (null != info) {
-        builder.putAllInfo(info);
-      }
-
-      return builder.build();
-    }
-
-    @Override public int hashCode() {
-      int result = 1;
-      result = p(result, connectionId);
-      result = p(result, info);
-      return result;
-    }
-
-    @Override public boolean equals(Object o) {
-      return o == this
-          || o instanceof OpenConnectionRequest
-          && Objects.equals(connectionId, ((OpenConnectionRequest) o).connectionId)
-          && Objects.equals(info, ((OpenConnectionRequest) o).info);
-    }
-  }
-
-  /** Response from
-   * {@link org.apache.calcite.avatica.remote.Service.OpenConnectionRequest}. */
-  class OpenConnectionResponse extends Response {
-    private static final FieldDescriptor METADATA_DESCRIPTOR = Responses.OpenConnectionResponse
-        .getDescriptor().findFieldByNumber(
-            Responses.OpenConnectionResponse.METADATA_FIELD_NUMBER);
-    public final RpcMetadataResponse rpcMetadata;
-
-    public OpenConnectionResponse() {
-      rpcMetadata = null;
-    }
-
-    @JsonCreator
-    public OpenConnectionResponse(@JsonProperty("rpcMetadata") RpcMetadataResponse rpcMetadata) {
-      this.rpcMetadata = rpcMetadata;
-    }
-
-    @Override OpenConnectionResponse deserialize(Message genericMsg) {
-      final Responses.OpenConnectionResponse msg = ProtobufService.castProtobufMessage(genericMsg,
-          Responses.OpenConnectionResponse.class);
-
-      RpcMetadataResponse metadata = null;
-      if (msg.hasField(METADATA_DESCRIPTOR)) {
-        metadata = RpcMetadataResponse.fromProto(msg.getMetadata());
-      }
-
-      return new OpenConnectionResponse(metadata);
-    }
-
-    @Override Responses.OpenConnectionResponse serialize() {
-      Responses.OpenConnectionResponse.Builder builder =
-          Responses.OpenConnectionResponse.newBuilder();
-
-      if (null != rpcMetadata) {
-        builder.setMetadata(rpcMetadata.serialize());
-      }
-
-      return builder.build();
-    }
-
-    @Override public int hashCode() {
-      int result = 1;
-      result = p(result, rpcMetadata);
-      return result;
-    }
-
-    @Override public boolean equals(Object o) {
-      return o == this
-          || o instanceof OpenConnectionResponse
-          && Objects.equals(rpcMetadata, ((OpenConnectionResponse) o).rpcMetadata);
-    }
-  }
-
-  /** Request for
-   * {@link Meta#closeConnection(org.apache.calcite.avatica.Meta.ConnectionHandle)}. */
-  class CloseConnectionRequest extends Request {
-    private static final FieldDescriptor CONNECTION_ID_DESCRIPTOR = Requests.CloseConnectionRequest
-        .getDescriptor().findFieldByNumber(
-            Requests.CloseConnectionRequest.CONNECTION_ID_FIELD_NUMBER);
-    public final String connectionId;
-
-    CloseConnectionRequest() {
-      connectionId = null;
-    }
-
-    @JsonCreator
-    public CloseConnectionRequest(
-        @JsonProperty("connectionId") String connectionId) {
-      this.connectionId = connectionId;
-    }
-
-    @Override CloseConnectionResponse accept(Service service) {
-      return service.apply(this);
-    }
-
-    @Override CloseConnectionRequest deserialize(Message genericMsg) {
-      final Requests.CloseConnectionRequest msg = ProtobufService.castProtobufMessage(genericMsg,
-          Requests.CloseConnectionRequest.class);
-      String connectionId = null;
-      if (msg.hasField(CONNECTION_ID_DESCRIPTOR)) {
-        connectionId = msg.getConnectionId();
-      }
-
-      return new CloseConnectionRequest(connectionId);
-    }
-
-    @Override Requests.CloseConnectionRequest serialize() {
-      Requests.CloseConnectionRequest.Builder builder = Requests.CloseConnectionRequest
-          .newBuilder();
-
-      if (null != connectionId) {
-        builder.setConnectionId(connectionId);
-      }
-
-      return builder.build();
-    }
-
-    @Override public int hashCode() {
-      int result = 1;
-      result = p(result, connectionId);
-      return result;
-    }
-
-    @Override public boolean equals(Object o) {
-      return o == this
-          || o instanceof CloseConnectionRequest
-          && Objects.equals(connectionId, ((CloseConnectionRequest) o).connectionId);
-    }
-  }
-
-  /** Response from
-   * {@link org.apache.calcite.avatica.remote.Service.CloseConnectionRequest}. */
-  class CloseConnectionResponse extends Response {
-    private static final FieldDescriptor METADATA_DESCRIPTOR = Responses.CloseConnectionResponse
-        .getDescriptor().findFieldByNumber(
-            Responses.CloseConnectionResponse.METADATA_FIELD_NUMBER);
-
-    public final RpcMetadataResponse rpcMetadata;
-
-    public CloseConnectionResponse() {
-      rpcMetadata = null;
-    }
-
-    @JsonCreator
-    public CloseConnectionResponse(@JsonProperty("rpcMetadata") RpcMetadataResponse rpcMetadata) {
-      this.rpcMetadata = rpcMetadata;
-    }
-
-    @Override CloseConnectionResponse deserialize(Message genericMsg) {
-      final Responses.CloseConnectionResponse msg = ProtobufService.castProtobufMessage(genericMsg,
-          Responses.CloseConnectionResponse.class);
-
-      RpcMetadataResponse metadata = null;
-      if (msg.hasField(METADATA_DESCRIPTOR)) {
-        metadata = RpcMetadataResponse.fromProto(msg.getMetadata());
-      }
-
-      return new CloseConnectionResponse(metadata);
-    }
-
-    @Override Responses.CloseConnectionResponse serialize() {
-      Responses.CloseConnectionResponse.Builder builder =
-          Responses.CloseConnectionResponse.newBuilder();
-
-      if (null != rpcMetadata) {
-        builder.setMetadata(rpcMetadata.serialize());
-      }
-
-      return builder.build();
-    }
-
-    @Override public int hashCode() {
-      int result = 1;
-      result = p(result, rpcMetadata);
-      return result;
-    }
-
-    @Override public boolean equals(Object o) {
-      return o == this
-          || o instanceof CloseConnectionResponse
-          && Objects.equals(rpcMetadata, ((CloseConnectionResponse) o).rpcMetadata);
-    }
-  }
-
-  /** Request for {@link Meta#connectionSync(Meta.ConnectionHandle, Meta.ConnectionProperties)}. */
-  class ConnectionSyncRequest extends Request {
-    private static final FieldDescriptor CONNECTION_ID_DESCRIPTOR = Requests.ConnectionSyncRequest
-        .getDescriptor().findFieldByNumber(
-            Requests.ConnectionSyncRequest.CONNECTION_ID_FIELD_NUMBER);
-    private static final FieldDescriptor CONN_PROPS_DESCRIPTOR = Requests.ConnectionSyncRequest
-        .getDescriptor().findFieldByNumber(Requests.ConnectionSyncRequest.CONN_PROPS_FIELD_NUMBER);
-
-    public final String connectionId;
-    public final Meta.ConnectionProperties connProps;
-
-    ConnectionSyncRequest() {
-      connectionId = null;
-      connProps = null;
-    }
-
-    @JsonCreator
-    public ConnectionSyncRequest(
-        @JsonProperty("connectionId") String connectionId,
-        @JsonProperty("connProps") Meta.ConnectionProperties connProps) {
-      this.connectionId = connectionId;
-      this.connProps = connProps;
-    }
-
-    @Override ConnectionSyncResponse accept(Service service) {
-      return service.apply(this);
-    }
-
-    @Override ConnectionSyncRequest deserialize(Message genericMsg) {
-      final Requests.ConnectionSyncRequest msg = ProtobufService.castProtobufMessage(genericMsg,
-          Requests.ConnectionSyncRequest.class);
-
-      String connectionId = null;
-      if (msg.hasField(CONNECTION_ID_DESCRIPTOR)) {
-        connectionId = msg.getConnectionId();
-      }
-
-      Meta.ConnectionProperties connProps = null;
-      if (msg.hasField(CONN_PROPS_DESCRIPTOR)) {
-        connProps = ConnectionPropertiesImpl.fromProto(msg.getConnProps());
-      }
-
-      return new ConnectionSyncRequest(connectionId, connProps);
-    }
-
-    @Override Requests.ConnectionSyncRequest serialize() {
-      Requests.ConnectionSyncRequest.Builder builder = Requests.ConnectionSyncRequest.newBuilder();
-
-      if (null != connectionId) {
-        builder.setConnectionId(connectionId);
-      }
-
-      if (null != connProps) {
-        builder.setConnProps(connProps.toProto());
-      }
-
-      return builder.build();
-    }
-
-    @Override public int hashCode() {
-      int result = 1;
-      result = p(result, connProps);
-      result = p(result, connectionId);
-      return result;
-    }
-
-    @Override public boolean equals(Object o) {
-      return o == this
-          || o instanceof ConnectionSyncRequest
-          && Objects.equals(connectionId, ((ConnectionSyncRequest) o).connectionId)
-          && Objects.equals(connProps, ((ConnectionSyncRequest) o).connProps);
-    }
-  }
-
-  /** Response for
-   * {@link Meta#connectionSync(Meta.ConnectionHandle, Meta.ConnectionProperties)}. */
-  class ConnectionSyncResponse extends Response {
-    private static final FieldDescriptor METADATA_DESCRIPTOR = Responses.ConnectionSyncResponse
-        .getDescriptor().findFieldByNumber(Responses.ConnectionSyncResponse.METADATA_FIELD_NUMBER);
-    public final Meta.ConnectionProperties connProps;
-    public final RpcMetadataResponse rpcMetadata;
-
-    ConnectionSyncResponse() {
-      connProps = null;
-      rpcMetadata = null;
-    }
-
-    @JsonCreator
-    public ConnectionSyncResponse(@JsonProperty("connProps") Meta.ConnectionProperties connProps,
-        @JsonProperty("rpcMetadata") RpcMetadataResponse rpcMetadata) {
-      this.connProps = connProps;
-      this.rpcMetadata = rpcMetadata;
-    }
-
-    @Override ConnectionSyncResponse deserialize(Message genericMsg) {
-      final Responses.ConnectionSyncResponse msg = ProtobufService.castProtobufMessage(genericMsg,
-          Responses.ConnectionSyncResponse.class);
-      RpcMetadataResponse metadata = null;
-      if (msg.hasField(METADATA_DESCRIPTOR)) {
-        metadata = RpcMetadataResponse.fromProto(msg.getMetadata());
-      }
-
-      return new ConnectionSyncResponse(ConnectionPropertiesImpl.fromProto(msg.getConnProps()),
-          metadata);
-    }
-
-    @Override Responses.ConnectionSyncResponse serialize() {
-      Responses.ConnectionSyncResponse.Builder builder = Responses.ConnectionSyncResponse
-          .newBuilder();
-
-      if (null != connProps) {
-        builder.setConnProps(connProps.toProto());
-      }
-
-      if (null != rpcMetadata) {
-        builder.setMetadata(rpcMetadata.serialize());
-      }
-
-      return builder.build();
-    }
-
-    @Override public int hashCode() {
-      int result = 1;
-      result = p(result, connProps);
-      result = p(result, rpcMetadata);
-      return result;
-    }
-
-    @Override public boolean equals(Object o) {
-      return o == this
-          || o instanceof ConnectionSyncResponse
-          && Objects.equals(connProps, ((ConnectionSyncResponse) o).connProps)
-          && Objects.equals(rpcMetadata, ((ConnectionSyncResponse) o).rpcMetadata);
-    }
-  }
-
-  /** Response for
-   * {@link Meta#getDatabaseProperties(Meta.ConnectionHandle)}. */
-  class DatabasePropertyResponse extends Response {
-    private static final FieldDescriptor METADATA_DESCRIPTOR = Responses.DatabasePropertyResponse
-        .getDescriptor().findFieldByNumber(
-            Responses.DatabasePropertyResponse.METADATA_FIELD_NUMBER);
-    public final Map<Meta.DatabaseProperty, Object> map;
-    public final RpcMetadataResponse rpcMetadata;
-
-    DatabasePropertyResponse() {
-      map = null;
-      rpcMetadata = null;
-    }
-
-    @JsonCreator
-    public DatabasePropertyResponse(@JsonProperty("map") Map<Meta.DatabaseProperty, Object> map,
-        @JsonProperty("rpcMetadata") RpcMetadataResponse rpcMetadata) {
-      this.map = map;
-      this.rpcMetadata = rpcMetadata;
-    }
-
-    @Override DatabasePropertyResponse deserialize(Message genericMsg) {
-      final Responses.DatabasePropertyResponse msg = ProtobufService.castProtobufMessage(genericMsg,
-          Responses.DatabasePropertyResponse.class);
-      HashMap<Meta.DatabaseProperty, Object> properties = new HashMap<>();
-      for (Responses.DatabasePropertyElement property : msg.getPropsList()) {
-        final Meta.DatabaseProperty dbProp = Meta.DatabaseProperty.fromProto(property.getKey());
-        final Common.TypedValue value = property.getValue();
-
-        Object obj;
-        switch (dbProp) {
-        // Just need to keep parity with the exposed values on DatabaseProperty
-        case GET_NUMERIC_FUNCTIONS:
-        case GET_STRING_FUNCTIONS:
-        case GET_SYSTEM_FUNCTIONS:
-        case GET_TIME_DATE_FUNCTIONS:
-        case GET_S_Q_L_KEYWORDS:
-          // String
-          if (Common.Rep.STRING != value.getType()) {
-            throw new IllegalArgumentException("Expected STRING, but got " + value.getType());
-          }
-
-          obj = value.getStringValue();
-          break;
-        case GET_DEFAULT_TRANSACTION_ISOLATION:
-          // int
-          if (Common.Rep.INTEGER != value.getType()) {
-            throw new IllegalArgumentException("Expected INTEGER, but got " + value.getType());
-          }
-
-          obj = (int) value.getNumberValue();
-          break;
-        default:
-          switch (value.getType()) {
-          case INTEGER:
-            obj = Long.valueOf(value.getNumberValue()).intValue();
-            break;
-          case STRING:
-            obj = value.getStringValue();
-            break;
-          default:
-            throw new IllegalArgumentException("Unhandled value type, " + value.getType());
-          }
-
-          break;
-        }
-
-        properties.put(dbProp, obj);
-      }
-
-      RpcMetadataResponse metadata = null;
-      if (msg.hasField(METADATA_DESCRIPTOR)) {
-        metadata = RpcMetadataResponse.fromProto(msg.getMetadata());
-      }
-
-      return new DatabasePropertyResponse(properties, metadata);
-    }
-
-    @Override Responses.DatabasePropertyResponse serialize() {
-      Responses.DatabasePropertyResponse.Builder builder = Responses.DatabasePropertyResponse
-          .newBuilder();
-
-      if (null != map) {
-        for (Entry<Meta.DatabaseProperty, Object> entry : map.entrySet()) {
-          Object obj = entry.getValue();
-
-          Common.TypedValue.Builder valueBuilder = Common.TypedValue.newBuilder();
-          switch (entry.getKey()) {
-          // Just need to keep parity with the exposed values on DatabaseProperty
-          case GET_NUMERIC_FUNCTIONS:
-          case GET_STRING_FUNCTIONS:
-          case GET_SYSTEM_FUNCTIONS:
-          case GET_TIME_DATE_FUNCTIONS:
-          case GET_S_Q_L_KEYWORDS:
-            // String
-            if (!(obj instanceof String)) {
-              throw new RuntimeException("Expected a String, but got " + obj.getClass());
-            }
-
-            valueBuilder.setType(Common.Rep.STRING).setStringValue((String) obj);
-            break;
-          case GET_DEFAULT_TRANSACTION_ISOLATION:
-            // int
-            if (!(obj instanceof Integer)) {
-              throw new RuntimeException("Expected an Integer, but got " + obj.getClass());
-            }
-
-            valueBuilder.setType(Common.Rep.INTEGER).setNumberValue(((Integer) obj).longValue());
-            break;
-          default:
-            if (obj instanceof Integer) {
-              valueBuilder.setType(Common.Rep.INTEGER).setNumberValue((Integer) obj);
-            } else {
-              String value;
-              if (obj instanceof String) {
-                value = (String) obj;
-              } else {
-                value = obj.toString();
-              }
-              valueBuilder.setType(Common.Rep.STRING).setStringValue(value);
-            }
-
-            break;
-          }
-
-          builder.addProps(Responses.DatabasePropertyElement.newBuilder()
-              .setKey(entry.getKey().toProto()).setValue(valueBuilder.build()));
-        }
-      }
-
-      if (null != rpcMetadata) {
-        builder.setMetadata(rpcMetadata.serialize());
-      }
-
-      return builder.build();
-    }
-
-    @Override public int hashCode() {
-      int result = 1;
-      result = p(result, map);
-      result = p(result, rpcMetadata);
-      return result;
-    }
-
-    @Override public boolean equals(Object o) {
-      return o == this
-          || o instanceof DatabasePropertyResponse
-          && Objects.equals(map, ((DatabasePropertyResponse) o).map)
-          && Objects.equals(rpcMetadata, ((DatabasePropertyResponse) o).rpcMetadata);
-    }
-  }
-
-  /**
-   * Response for any request that the server failed to successfully perform.
-   * It is used internally by the transport layers to format errors for
-   * transport over the wire. Thus, {@link Service#apply} will never return
-   * an ErrorResponse.
-   */
-  public class ErrorResponse extends Response {
-    private static final FieldDescriptor ERROR_MESSAGE_DESCRIPTOR = Responses.ErrorResponse
-        .getDescriptor().findFieldByNumber(
-            Responses.ErrorResponse.ERROR_MESSAGE_FIELD_NUMBER);
-    private static final FieldDescriptor SQL_DESCRIPTOR = Responses.ErrorResponse
-        .getDescriptor().findFieldByNumber(
-            Responses.ErrorResponse.SQL_STATE_FIELD_NUMBER);
-    private static final FieldDescriptor SEVERITY_DESCRIPTOR = Responses.ErrorResponse
-        .getDescriptor().findFieldByNumber(
-            Responses.ErrorResponse.SEVERITY_FIELD_NUMBER);
-    private static final FieldDescriptor METADATA_DESCRIPTOR = Responses.ErrorResponse
-        .getDescriptor().findFieldByNumber(
-            Responses.ErrorResponse.METADATA_FIELD_NUMBER);
-
-    public static final int UNKNOWN_ERROR_CODE = -1;
-    public static final int MISSING_CONNECTION_ERROR_CODE = 1;
-    public static final int UNAUTHORIZED_ERROR_CODE = 2;
-
-    public static final String UNKNOWN_SQL_STATE = "00000";
-    public static final String UNAUTHORIZED_SQL_STATE = "00002";
-
-    public final List<String> exceptions;
-    public final String errorMessage;
-    public final int errorCode;
-    public final String sqlState;
-    public final AvaticaSeverity severity;
-    public final RpcMetadataResponse rpcMetadata;
-
-    ErrorResponse() {
-      exceptions = Collections.singletonList("Unhandled exception");
-      errorMessage = "Unknown message";
-      errorCode = -1;
-      sqlState = UNKNOWN_SQL_STATE;
-      severity = AvaticaSeverity.UNKNOWN;
-      rpcMetadata = null;
-    }
-
-    @JsonCreator
-    public ErrorResponse(@JsonProperty("exceptions") List<String> exceptions,
-        @JsonProperty("errorMessage") String errorMessage,
-        @JsonProperty("errorCode") int errorCode,
-        @JsonProperty("sqlState") String sqlState,
-        @JsonProperty("severity") AvaticaSeverity severity,
-        @JsonProperty("rpcMetadata") RpcMetadataResponse rpcMetadata) {
-      this.exceptions = exceptions;
-      this.errorMessage = errorMessage;
-      this.errorCode = errorCode;
-      this.sqlState = sqlState;
-      this.severity = severity;
-      this.rpcMetadata = rpcMetadata;
-    }
-
-    protected ErrorResponse(Exception e, String errorMessage, int code, String sqlState,
-        AvaticaSeverity severity, RpcMetadataResponse rpcMetadata) {
-      this(errorMessage, code, sqlState, severity, toStackTraces(e), rpcMetadata);
-    }
-
-    protected ErrorResponse(String errorMessage, int code, String sqlState,
-        AvaticaSeverity severity, List<String> exceptions, RpcMetadataResponse rpcMetadata) {
-      this.exceptions = exceptions;
-      this.errorMessage = errorMessage;
-      this.errorCode = code;
-      this.sqlState = sqlState;
-      this.severity = severity;
-      this.rpcMetadata = rpcMetadata;
-    }
-
-    static List<String> toStackTraces(Exception e) {
-      List<String> stackTraces = new ArrayList<>();
-      stackTraces.add(toString(e));
-      if (e instanceof SQLException) {
-        SQLException next = ((SQLException) e).getNextException();
-        while (null != next) {
-          stackTraces.add(toString(next));
-          next = next.getNextException();
-        }
-      }
-      return stackTraces;
-    }
-
-    static String toString(Exception e) {
-      //noinspection ThrowableResultOfMethodCallIgnored
-      Objects.requireNonNull(e);
-      StringWriter sw = new StringWriter();
-      e.printStackTrace(new PrintWriter(sw));
-      return sw.toString();
-    }
-
-    @Override ErrorResponse deserialize(Message genericMsg) {
-      final Responses.ErrorResponse msg = ProtobufService.castProtobufMessage(genericMsg,
-          Responses.ErrorResponse.class);
-      List<String> exceptions = null;
-      if (msg.getHasExceptions()) {
-        exceptions = msg.getExceptionsList();
-      }
-
-      String errorMessage = null;
-      if (msg.hasField(ERROR_MESSAGE_DESCRIPTOR)) {
-        errorMessage = msg.getErrorMessage();
-      }
-
-      String sqlState = null;
-      if (msg.hasField(SQL_DESCRIPTOR)) {
-        sqlState = msg.getSqlState();
-      }
-
-      AvaticaSeverity severity = null;
-      if (msg.hasField(SEVERITY_DESCRIPTOR)) {
-        severity = AvaticaSeverity.fromProto(msg.getSeverity());
-      }
-
-      RpcMetadataResponse metadata = null;
-      if (msg.hasField(METADATA_DESCRIPTOR)) {
-        metadata = RpcMetadataResponse.fromProto(msg.getMetadata());
-      }
-
-      return new ErrorResponse(exceptions, errorMessage, msg.getErrorCode(), sqlState, severity,
-          metadata);
-    }
-
-    // Public so the Jetty handler implementations can use it
-    @Override public Responses.ErrorResponse serialize() {
-      Responses.ErrorResponse.Builder builder = Responses.ErrorResponse.newBuilder();
-
-      if (null != rpcMetadata) {
-        builder.setMetadata(rpcMetadata.serialize());
-      }
-
-      if (null != exceptions) {
-        builder.setHasExceptions(true);
-        builder.addAllExceptions(exceptions);
-      } else {
-        builder.setHasExceptions(false);
-      }
-
-      if (null != errorMessage) {
-        builder.setErrorMessage(errorMessage);
-      }
-
-      if (null != sqlState) {
-        builder.setSqlState(sqlState);
-      }
-
-      if (null != severity) {
-        builder.setSeverity(severity.toProto());
-      }
-
-      return builder.setErrorCode(errorCode).build();
-    }
-
-    @Override public String toString() {
-      StringBuilder sb = new StringBuilder(32);
-      sb.append("ErrorResponse[errorCode=").append(errorCode)
-          .append(", sqlState=").append(sqlState)
-          .append(", severity=").append(severity)
-          .append(", errorMessage=").append(errorMessage)
-          .append(", exceptions=").append(exceptions);
-      return sb.toString();
-    }
-
-    @

<TRUNCATED>

[02/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcTable.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcTable.java b/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcTable.java
deleted file mode 100644
index d432e4a..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcTable.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.jdbc;
-
-import org.apache.calcite.DataContext;
-import org.apache.calcite.adapter.java.AbstractQueryableTable;
-import org.apache.calcite.adapter.java.JavaTypeFactory;
-import org.apache.calcite.avatica.ColumnMetaData;
-import org.apache.calcite.jdbc.CalciteConnection;
-import org.apache.calcite.linq4j.Enumerable;
-import org.apache.calcite.linq4j.Enumerator;
-import org.apache.calcite.linq4j.QueryProvider;
-import org.apache.calcite.linq4j.Queryable;
-import org.apache.calcite.plan.Convention;
-import org.apache.calcite.plan.RelOptCluster;
-import org.apache.calcite.plan.RelOptTable;
-import org.apache.calcite.prepare.Prepare.CatalogReader;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.core.TableModify;
-import org.apache.calcite.rel.core.TableModify.Operation;
-import org.apache.calcite.rel.logical.LogicalTableModify;
-import org.apache.calcite.rel.type.RelDataType;
-import org.apache.calcite.rel.type.RelDataTypeFactory;
-import org.apache.calcite.rel.type.RelDataTypeField;
-import org.apache.calcite.rel.type.RelProtoDataType;
-import org.apache.calcite.rex.RexNode;
-import org.apache.calcite.runtime.ResultSetEnumerable;
-import org.apache.calcite.schema.ModifiableTable;
-import org.apache.calcite.schema.ScannableTable;
-import org.apache.calcite.schema.Schema;
-import org.apache.calcite.schema.SchemaPlus;
-import org.apache.calcite.schema.TranslatableTable;
-import org.apache.calcite.schema.impl.AbstractTableQueryable;
-import org.apache.calcite.sql.SqlIdentifier;
-import org.apache.calcite.sql.SqlNodeList;
-import org.apache.calcite.sql.SqlSelect;
-import org.apache.calcite.sql.parser.SqlParserPos;
-import org.apache.calcite.sql.pretty.SqlPrettyWriter;
-import org.apache.calcite.sql.util.SqlString;
-import org.apache.calcite.util.Pair;
-import org.apache.calcite.util.Util;
-
-import com.google.common.base.Function;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
-
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * Queryable that gets its data from a table within a JDBC connection.
- *
- * <p>The idea is not to read the whole table, however. The idea is to use
- * this as a building block for a query, by applying Queryable operators
- * such as
- * {@link org.apache.calcite.linq4j.Queryable#where(org.apache.calcite.linq4j.function.Predicate2)}.
- * The resulting queryable can then be converted to a SQL query, which can be
- * executed efficiently on the JDBC server.</p>
- */
-class JdbcTable extends AbstractQueryableTable
-    implements TranslatableTable, ScannableTable, ModifiableTable {
-  private RelProtoDataType protoRowType;
-  private final JdbcSchema jdbcSchema;
-  private final String jdbcCatalogName;
-  private final String jdbcSchemaName;
-  private final String jdbcTableName;
-  private final Schema.TableType jdbcTableType;
-
-  public JdbcTable(JdbcSchema jdbcSchema, String jdbcCatalogName,
-      String jdbcSchemaName, String tableName, Schema.TableType jdbcTableType) {
-    super(Object[].class);
-    this.jdbcSchema = jdbcSchema;
-    this.jdbcCatalogName = jdbcCatalogName;
-    this.jdbcSchemaName = jdbcSchemaName;
-    this.jdbcTableName = tableName;
-    this.jdbcTableType = Preconditions.checkNotNull(jdbcTableType);
-  }
-
-  public String toString() {
-    return "JdbcTable {" + jdbcTableName + "}";
-  }
-
-  @Override public Schema.TableType getJdbcTableType() {
-    return jdbcTableType;
-  }
-
-  public RelDataType getRowType(RelDataTypeFactory typeFactory) {
-    if (protoRowType == null) {
-      try {
-        protoRowType =
-            jdbcSchema.getRelDataType(
-                jdbcCatalogName,
-                jdbcSchemaName,
-                jdbcTableName);
-      } catch (SQLException e) {
-        throw new RuntimeException(
-            "Exception while reading definition of table '" + jdbcTableName
-                + "'", e);
-      }
-    }
-    return protoRowType.apply(typeFactory);
-  }
-
-  private List<Pair<ColumnMetaData.Rep, Integer>> fieldClasses(
-      final JavaTypeFactory typeFactory) {
-    final RelDataType rowType = protoRowType.apply(typeFactory);
-    return Lists.transform(rowType.getFieldList(),
-        new Function<RelDataTypeField, Pair<ColumnMetaData.Rep, Integer>>() {
-          public Pair<ColumnMetaData.Rep, Integer>
-          apply(RelDataTypeField field) {
-            final RelDataType type = field.getType();
-            final Class clazz = (Class) typeFactory.getJavaClass(type);
-            final ColumnMetaData.Rep rep =
-                Util.first(ColumnMetaData.Rep.of(clazz),
-                    ColumnMetaData.Rep.OBJECT);
-            return Pair.of(rep, type.getSqlTypeName().getJdbcOrdinal());
-          }
-        });
-  }
-
-  SqlString generateSql() {
-    final SqlNodeList selectList =
-        new SqlNodeList(
-            Collections.singletonList(SqlIdentifier.star(SqlParserPos.ZERO)),
-            SqlParserPos.ZERO);
-    SqlSelect node =
-        new SqlSelect(SqlParserPos.ZERO, SqlNodeList.EMPTY, selectList,
-            tableName(), null, null, null, null, null, null, null);
-    final SqlPrettyWriter writer = new SqlPrettyWriter(jdbcSchema.dialect);
-    node.unparse(writer, 0, 0);
-    return writer.toSqlString();
-  }
-
-  SqlIdentifier tableName() {
-    final List<String> strings = new ArrayList<>();
-    if (jdbcSchema.catalog != null) {
-      strings.add(jdbcSchema.catalog);
-    }
-    if (jdbcSchema.schema != null) {
-      strings.add(jdbcSchema.schema);
-    }
-    strings.add(jdbcTableName);
-    return new SqlIdentifier(strings, SqlParserPos.ZERO);
-  }
-
-  public RelNode toRel(RelOptTable.ToRelContext context,
-      RelOptTable relOptTable) {
-    return new JdbcTableScan(context.getCluster(), relOptTable, this,
-        jdbcSchema.convention);
-  }
-
-  public <T> Queryable<T> asQueryable(QueryProvider queryProvider,
-      SchemaPlus schema, String tableName) {
-    return new JdbcTableQueryable<>(queryProvider, schema, tableName);
-  }
-
-  public Enumerable<Object[]> scan(DataContext root) {
-    final JavaTypeFactory typeFactory = root.getTypeFactory();
-    final SqlString sql = generateSql();
-    return ResultSetEnumerable.of(jdbcSchema.getDataSource(), sql.getSql(),
-        JdbcUtils.ObjectArrayRowBuilder.factory(fieldClasses(typeFactory)));
-  }
-
-  @Override public Collection getModifiableCollection() {
-    return null;
-  }
-
-  @Override public TableModify toModificationRel(RelOptCluster cluster,
-      RelOptTable table, CatalogReader catalogReader, RelNode input,
-      Operation operation, List<String> updateColumnList,
-      List<RexNode> sourceExpressionList, boolean flattened) {
-    jdbcSchema.convention.register(cluster.getPlanner());
-
-    return new LogicalTableModify(cluster, cluster.traitSetOf(Convention.NONE),
-        table, catalogReader, input, operation, updateColumnList,
-        sourceExpressionList, flattened);
-  }
-
-  /** Enumerable that returns the contents of a {@link JdbcTable} by connecting
-   * to the JDBC data source. */
-  private class JdbcTableQueryable<T> extends AbstractTableQueryable<T> {
-    public JdbcTableQueryable(QueryProvider queryProvider, SchemaPlus schema,
-        String tableName) {
-      super(queryProvider, schema, JdbcTable.this, tableName);
-    }
-
-    @Override public String toString() {
-      return "JdbcTableQueryable {table: " + tableName + "}";
-    }
-
-    public Enumerator<T> enumerator() {
-      final JavaTypeFactory typeFactory =
-          ((CalciteConnection) queryProvider).getTypeFactory();
-      final SqlString sql = generateSql();
-      //noinspection unchecked
-      final Enumerable<T> enumerable = (Enumerable<T>) ResultSetEnumerable.of(
-          jdbcSchema.getDataSource(),
-          sql.getSql(),
-          JdbcUtils.ObjectArrayRowBuilder.factory(fieldClasses(typeFactory)));
-      return enumerable.enumerator();
-    }
-  }
-}
-
-// End JdbcTable.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcTableScan.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcTableScan.java b/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcTableScan.java
deleted file mode 100644
index 7ef8938..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcTableScan.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.jdbc;
-
-import org.apache.calcite.plan.RelOptCluster;
-import org.apache.calcite.plan.RelOptTable;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.core.TableScan;
-
-import com.google.common.collect.ImmutableList;
-
-import java.util.List;
-
-/**
- * Relational expression representing a scan of a table in a JDBC data source.
- */
-public class JdbcTableScan extends TableScan implements JdbcRel {
-  final JdbcTable jdbcTable;
-
-  protected JdbcTableScan(
-      RelOptCluster cluster,
-      RelOptTable table,
-      JdbcTable jdbcTable,
-      JdbcConvention jdbcConvention) {
-    super(cluster, cluster.traitSetOf(jdbcConvention), table);
-    this.jdbcTable = jdbcTable;
-    assert jdbcTable != null;
-  }
-
-  @Override public RelNode copy(RelTraitSet traitSet, List<RelNode> inputs) {
-    assert inputs.isEmpty();
-    return new JdbcTableScan(
-        getCluster(), table, jdbcTable, (JdbcConvention) getConvention());
-  }
-
-  public JdbcImplementor.Result implement(JdbcImplementor implementor) {
-    return implementor.result(jdbcTable.tableName(),
-        ImmutableList.of(JdbcImplementor.Clause.FROM), this, null);
-  }
-}
-
-// End JdbcTableScan.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcToEnumerableConverter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcToEnumerableConverter.java b/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcToEnumerableConverter.java
deleted file mode 100644
index c74e741..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcToEnumerableConverter.java
+++ /dev/null
@@ -1,325 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.jdbc;
-
-import org.apache.calcite.adapter.enumerable.EnumerableRel;
-import org.apache.calcite.adapter.enumerable.EnumerableRelImplementor;
-import org.apache.calcite.adapter.enumerable.JavaRowFormat;
-import org.apache.calcite.adapter.enumerable.PhysType;
-import org.apache.calcite.adapter.enumerable.PhysTypeImpl;
-import org.apache.calcite.adapter.java.JavaTypeFactory;
-import org.apache.calcite.linq4j.tree.BlockBuilder;
-import org.apache.calcite.linq4j.tree.Expression;
-import org.apache.calcite.linq4j.tree.Expressions;
-import org.apache.calcite.linq4j.tree.ParameterExpression;
-import org.apache.calcite.linq4j.tree.Primitive;
-import org.apache.calcite.linq4j.tree.UnaryExpression;
-import org.apache.calcite.plan.ConventionTraitDef;
-import org.apache.calcite.plan.RelOptCluster;
-import org.apache.calcite.plan.RelOptCost;
-import org.apache.calcite.plan.RelOptPlanner;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.prepare.CalcitePrepareImpl;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.convert.ConverterImpl;
-import org.apache.calcite.rel.metadata.RelMetadataQuery;
-import org.apache.calcite.rel.type.RelDataType;
-import org.apache.calcite.runtime.Hook;
-import org.apache.calcite.runtime.SqlFunctions;
-import org.apache.calcite.schema.Schemas;
-import org.apache.calcite.sql.SqlDialect;
-import org.apache.calcite.sql.type.SqlTypeName;
-import org.apache.calcite.util.BuiltInMethod;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.List;
-import java.util.TimeZone;
-
-/**
- * Relational expression representing a scan of a table in a JDBC data source.
- */
-public class JdbcToEnumerableConverter
-    extends ConverterImpl
-    implements EnumerableRel {
-  protected JdbcToEnumerableConverter(
-      RelOptCluster cluster,
-      RelTraitSet traits,
-      RelNode input) {
-    super(cluster, ConventionTraitDef.INSTANCE, traits, input);
-  }
-
-  @Override public RelNode copy(RelTraitSet traitSet, List<RelNode> inputs) {
-    return new JdbcToEnumerableConverter(
-        getCluster(), traitSet, sole(inputs));
-  }
-
-  @Override public RelOptCost computeSelfCost(RelOptPlanner planner,
-      RelMetadataQuery mq) {
-    return super.computeSelfCost(planner, mq).multiplyBy(.1);
-  }
-
-  public Result implement(EnumerableRelImplementor implementor, Prefer pref) {
-    // Generate:
-    //   ResultSetEnumerable.of(schema.getDataSource(), "select ...")
-    final BlockBuilder builder0 = new BlockBuilder(false);
-    final JdbcRel child = (JdbcRel) getInput();
-    final PhysType physType =
-        PhysTypeImpl.of(
-            implementor.getTypeFactory(), getRowType(),
-            pref.prefer(JavaRowFormat.CUSTOM));
-    final JdbcConvention jdbcConvention =
-        (JdbcConvention) child.getConvention();
-    String sql = generateSql(jdbcConvention.dialect);
-    if (CalcitePrepareImpl.DEBUG) {
-      System.out.println("[" + sql + "]");
-    }
-    Hook.QUERY_PLAN.run(sql);
-    final Expression sql_ =
-        builder0.append("sql", Expressions.constant(sql));
-    final int fieldCount = getRowType().getFieldCount();
-    BlockBuilder builder = new BlockBuilder();
-    final ParameterExpression resultSet_ =
-        Expressions.parameter(Modifier.FINAL, ResultSet.class,
-            builder.newName("resultSet"));
-    CalendarPolicy calendarPolicy = CalendarPolicy.of(jdbcConvention.dialect);
-    final Expression calendar_;
-    switch (calendarPolicy) {
-    case LOCAL:
-      calendar_ =
-          builder0.append("calendar",
-              Expressions.call(Calendar.class, "getInstance",
-                  getTimeZoneExpression(implementor)));
-      break;
-    default:
-      calendar_ = null;
-    }
-    if (fieldCount == 1) {
-      final ParameterExpression value_ =
-          Expressions.parameter(Object.class, builder.newName("value"));
-      builder.add(Expressions.declare(Modifier.FINAL, value_, null));
-      generateGet(implementor, physType, builder, resultSet_, 0, value_,
-          calendar_, calendarPolicy);
-      builder.add(Expressions.return_(null, value_));
-    } else {
-      final Expression values_ =
-          builder.append("values",
-              Expressions.newArrayBounds(Object.class, 1,
-                  Expressions.constant(fieldCount)));
-      for (int i = 0; i < fieldCount; i++) {
-        generateGet(implementor, physType, builder, resultSet_, i,
-            Expressions.arrayIndex(values_, Expressions.constant(i)),
-            calendar_, calendarPolicy);
-      }
-      builder.add(
-          Expressions.return_(null, values_));
-    }
-    final ParameterExpression e_ =
-        Expressions.parameter(SQLException.class, builder.newName("e"));
-    final Expression rowBuilderFactory_ =
-        builder0.append("rowBuilderFactory",
-            Expressions.lambda(
-                Expressions.block(
-                    Expressions.return_(null,
-                        Expressions.lambda(
-                            Expressions.block(
-                                Expressions.tryCatch(
-                                    builder.toBlock(),
-                                    Expressions.catch_(
-                                        e_,
-                                        Expressions.throw_(
-                                            Expressions.new_(
-                                                RuntimeException.class,
-                                                e_)))))))),
-                resultSet_));
-    final Expression enumerable =
-        builder0.append(
-            "enumerable",
-            Expressions.call(
-                BuiltInMethod.RESULT_SET_ENUMERABLE_OF.method,
-                Expressions.call(
-                    Schemas.unwrap(jdbcConvention.expression,
-                        JdbcSchema.class),
-                    BuiltInMethod.JDBC_SCHEMA_DATA_SOURCE.method),
-                sql_,
-                rowBuilderFactory_));
-    builder0.add(
-        Expressions.return_(null, enumerable));
-    return implementor.result(physType, builder0.toBlock());
-  }
-
-  private UnaryExpression getTimeZoneExpression(
-      EnumerableRelImplementor implementor) {
-    return Expressions.convert_(
-        Expressions.call(
-            implementor.getRootExpression(),
-            "get",
-            Expressions.constant("timeZone")),
-        TimeZone.class);
-  }
-
-  private void generateGet(EnumerableRelImplementor implementor,
-      PhysType physType, BlockBuilder builder, ParameterExpression resultSet_,
-      int i, Expression target, Expression calendar_,
-      CalendarPolicy calendarPolicy) {
-    final Primitive primitive = Primitive.ofBoxOr(physType.fieldClass(i));
-    final RelDataType fieldType =
-        physType.getRowType().getFieldList().get(i).getType();
-    final List<Expression> dateTimeArgs = new ArrayList<Expression>();
-    dateTimeArgs.add(Expressions.constant(i + 1));
-    SqlTypeName sqlTypeName = fieldType.getSqlTypeName();
-    boolean offset = false;
-    switch (calendarPolicy) {
-    case LOCAL:
-      dateTimeArgs.add(calendar_);
-      break;
-    case NULL:
-      // We don't specify a calendar at all, so we don't add an argument and
-      // instead use the version of the getXXX that doesn't take a Calendar
-      break;
-    case DIRECT:
-      sqlTypeName = SqlTypeName.ANY;
-      break;
-    case SHIFT:
-      switch (sqlTypeName) {
-      case TIMESTAMP:
-      case DATE:
-        offset = true;
-      }
-      break;
-    }
-    final Expression source;
-    switch (sqlTypeName) {
-    case DATE:
-    case TIME:
-    case TIMESTAMP:
-      source = Expressions.call(
-          getMethod(sqlTypeName, fieldType.isNullable(), offset),
-          Expressions.<Expression>list()
-              .append(
-                  Expressions.call(resultSet_,
-                      getMethod2(sqlTypeName), dateTimeArgs))
-          .appendIf(offset, getTimeZoneExpression(implementor)));
-      break;
-    case ARRAY:
-      final Expression x = Expressions.convert_(
-          Expressions.call(resultSet_, jdbcGetMethod(primitive),
-              Expressions.constant(i + 1)),
-          java.sql.Array.class);
-      source = Expressions.call(BuiltInMethod.JDBC_ARRAY_TO_LIST.method, x);
-      break;
-    default:
-      source = Expressions.call(
-          resultSet_, jdbcGetMethod(primitive), Expressions.constant(i + 1));
-    }
-    builder.add(
-        Expressions.statement(
-            Expressions.assign(
-                target, source)));
-
-    // [CALCITE-596] If primitive type columns contain null value, returns null
-    // object
-    if (primitive != null) {
-      builder.add(
-          Expressions.ifThen(
-              Expressions.call(resultSet_, "wasNull"),
-              Expressions.statement(
-                  Expressions.assign(target,
-                      Expressions.constant(null)))));
-    }
-  }
-
-  private Method getMethod(SqlTypeName sqlTypeName, boolean nullable,
-      boolean offset) {
-    switch (sqlTypeName) {
-    case DATE:
-      return (nullable
-          ? BuiltInMethod.DATE_TO_INT_OPTIONAL
-          : BuiltInMethod.DATE_TO_INT).method;
-    case TIME:
-      return (nullable
-          ? BuiltInMethod.TIME_TO_INT_OPTIONAL
-          : BuiltInMethod.TIME_TO_INT).method;
-    case TIMESTAMP:
-      return (nullable
-          ? (offset
-          ? BuiltInMethod.TIMESTAMP_TO_LONG_OPTIONAL_OFFSET
-          : BuiltInMethod.TIMESTAMP_TO_LONG_OPTIONAL)
-          : (offset
-              ? BuiltInMethod.TIMESTAMP_TO_LONG_OFFSET
-              : BuiltInMethod.TIMESTAMP_TO_LONG)).method;
-    default:
-      throw new AssertionError(sqlTypeName + ":" + nullable);
-    }
-  }
-
-  private Method getMethod2(SqlTypeName sqlTypeName) {
-    switch (sqlTypeName) {
-    case DATE:
-      return BuiltInMethod.RESULT_SET_GET_DATE2.method;
-    case TIME:
-      return BuiltInMethod.RESULT_SET_GET_TIME2.method;
-    case TIMESTAMP:
-      return BuiltInMethod.RESULT_SET_GET_TIMESTAMP2.method;
-    default:
-      throw new AssertionError(sqlTypeName);
-    }
-  }
-
-  /** E,g, {@code jdbcGetMethod(int)} returns "getInt". */
-  private String jdbcGetMethod(Primitive primitive) {
-    return primitive == null
-        ? "getObject"
-        : "get" + SqlFunctions.initcap(primitive.primitiveName);
-  }
-
-  private String generateSql(SqlDialect dialect) {
-    final JdbcImplementor jdbcImplementor =
-        new JdbcImplementor(dialect,
-            (JavaTypeFactory) getCluster().getTypeFactory());
-    final JdbcImplementor.Result result =
-        jdbcImplementor.visitChild(0, getInput());
-    return result.asStatement().toSqlString(dialect).getSql();
-  }
-
-  /** Whether this JDBC driver needs you to pass a Calendar object to methods
-   * such as {@link ResultSet#getTimestamp(int, java.util.Calendar)}. */
-  private enum CalendarPolicy {
-    NONE,
-    NULL,
-    LOCAL,
-    DIRECT,
-    SHIFT;
-
-    static CalendarPolicy of(SqlDialect dialect) {
-      switch (dialect.getDatabaseProduct()) {
-      case MYSQL:
-        return SHIFT;
-      case HSQLDB:
-      default:
-        // NULL works for hsqldb-2.3; nothing worked for hsqldb-1.8.
-        return NULL;
-      }
-    }
-  }
-}
-
-// End JdbcToEnumerableConverter.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcToEnumerableConverterRule.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcToEnumerableConverterRule.java b/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcToEnumerableConverterRule.java
deleted file mode 100644
index a212c3b..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcToEnumerableConverterRule.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.jdbc;
-
-import org.apache.calcite.adapter.enumerable.EnumerableConvention;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.convert.ConverterRule;
-
-/**
- * Rule to convert a relational expression from
- * {@link JdbcConvention} to
- * {@link EnumerableConvention}.
- */
-public class JdbcToEnumerableConverterRule extends ConverterRule {
-  JdbcToEnumerableConverterRule(JdbcConvention out) {
-    super(RelNode.class, out, EnumerableConvention.INSTANCE,
-        "JdbcToEnumerableConverterRule:" + out);
-  }
-
-  @Override public RelNode convert(RelNode rel) {
-    RelTraitSet newTraitSet = rel.getTraitSet().replace(getOutTrait());
-    return new JdbcToEnumerableConverter(rel.getCluster(), newTraitSet, rel);
-  }
-}
-
-// End JdbcToEnumerableConverterRule.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcUtils.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcUtils.java b/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcUtils.java
deleted file mode 100644
index bb8e558..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/jdbc/JdbcUtils.java
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.jdbc;
-
-import org.apache.calcite.avatica.ColumnMetaData;
-import org.apache.calcite.avatica.util.DateTimeUtils;
-import org.apache.calcite.linq4j.function.Function0;
-import org.apache.calcite.linq4j.function.Function1;
-import org.apache.calcite.sql.SqlDialect;
-import org.apache.calcite.util.ImmutableNullableList;
-import org.apache.calcite.util.Pair;
-
-import org.apache.commons.dbcp.BasicDataSource;
-
-import com.google.common.cache.CacheBuilder;
-import com.google.common.cache.CacheLoader;
-import com.google.common.cache.LoadingCache;
-import com.google.common.collect.ImmutableList;
-import com.google.common.primitives.Ints;
-
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.Date;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.sql.Types;
-import java.util.HashMap;
-import java.util.IdentityHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.TimeZone;
-import javax.annotation.Nonnull;
-import javax.sql.DataSource;
-
-/**
- * Utilities for the JDBC provider.
- */
-final class JdbcUtils {
-  private JdbcUtils() {
-    throw new AssertionError("no instances!");
-  }
-
-  /** Pool of dialects. */
-  static class DialectPool {
-    final Map<DataSource, SqlDialect> map0 = new IdentityHashMap<>();
-    final Map<List, SqlDialect> map = new HashMap<>();
-
-    public static final DialectPool INSTANCE = new DialectPool();
-
-    SqlDialect get(DataSource dataSource) {
-      final SqlDialect sqlDialect = map0.get(dataSource);
-      if (sqlDialect != null) {
-        return sqlDialect;
-      }
-      Connection connection = null;
-      try {
-        connection = dataSource.getConnection();
-        DatabaseMetaData metaData = connection.getMetaData();
-        String productName = metaData.getDatabaseProductName();
-        String productVersion = metaData.getDatabaseProductVersion();
-        List key = ImmutableList.of(productName, productVersion);
-        SqlDialect dialect = map.get(key);
-        if (dialect == null) {
-          dialect = SqlDialect.create(metaData);
-          map.put(key, dialect);
-          map0.put(dataSource, dialect);
-        }
-        connection.close();
-        connection = null;
-        return dialect;
-      } catch (SQLException e) {
-        throw new RuntimeException(e);
-      } finally {
-        if (connection != null) {
-          try {
-            connection.close();
-          } catch (SQLException e) {
-            // ignore
-          }
-        }
-      }
-    }
-  }
-
-  /** Builder that calls {@link ResultSet#getObject(int)} for every column,
-   * or {@code getXxx} if the result type is a primitive {@code xxx},
-   * and returns an array of objects for each row. */
-  static class ObjectArrayRowBuilder implements Function0<Object[]> {
-    private final ResultSet resultSet;
-    private final int columnCount;
-    private final ColumnMetaData.Rep[] reps;
-    private final int[] types;
-
-    ObjectArrayRowBuilder(ResultSet resultSet, ColumnMetaData.Rep[] reps,
-        int[] types)
-        throws SQLException {
-      this.resultSet = resultSet;
-      this.reps = reps;
-      this.types = types;
-      this.columnCount = resultSet.getMetaData().getColumnCount();
-    }
-
-    public static Function1<ResultSet, Function0<Object[]>> factory(
-        final List<Pair<ColumnMetaData.Rep, Integer>> list) {
-      return new Function1<ResultSet, Function0<Object[]>>() {
-        public Function0<Object[]> apply(ResultSet resultSet) {
-          try {
-            return new ObjectArrayRowBuilder(
-                resultSet,
-                Pair.left(list).toArray(new ColumnMetaData.Rep[list.size()]),
-                Ints.toArray(Pair.right(list)));
-          } catch (SQLException e) {
-            throw new RuntimeException(e);
-          }
-        }
-      };
-    }
-
-    public Object[] apply() {
-      try {
-        final Object[] values = new Object[columnCount];
-        for (int i = 0; i < columnCount; i++) {
-          values[i] = value(i);
-        }
-        return values;
-      } catch (SQLException e) {
-        throw new RuntimeException(e);
-      }
-    }
-
-    /**
-     * Gets a value from a given column in a JDBC result set.
-     *
-     * @param i Ordinal of column (1-based, per JDBC)
-     */
-    private Object value(int i) throws SQLException {
-      // MySQL returns timestamps shifted into local time. Using
-      // getTimestamp(int, Calendar) with a UTC calendar should prevent this,
-      // but does not. So we shift explicitly.
-      switch (types[i]) {
-      case Types.TIMESTAMP:
-        return shift(resultSet.getTimestamp(i + 1));
-      case Types.TIME:
-        return shift(resultSet.getTime(i + 1));
-      case Types.DATE:
-        return shift(resultSet.getDate(i + 1));
-      }
-      return reps[i].jdbcGet(resultSet, i + 1);
-    }
-
-    private static Timestamp shift(Timestamp v) {
-      if (v == null) {
-        return null;
-      }
-      long time = v.getTime();
-      int offset = TimeZone.getDefault().getOffset(time);
-      return new Timestamp(time + offset);
-    }
-
-    private static Time shift(Time v) {
-      if (v == null) {
-        return null;
-      }
-      long time = v.getTime();
-      int offset = TimeZone.getDefault().getOffset(time);
-      return new Time((time + offset) % DateTimeUtils.MILLIS_PER_DAY);
-    }
-
-    private static Date shift(Date v) {
-      if (v == null) {
-        return null;
-      }
-      long time = v.getTime();
-      int offset = TimeZone.getDefault().getOffset(time);
-      return new Date(time + offset);
-    }
-  }
-
-  /** Ensures that if two data sources have the same definition, they will use
-   * the same object.
-   *
-   * <p>This in turn makes it easier to cache
-   * {@link org.apache.calcite.sql.SqlDialect} objects. Otherwise, each time we
-   * see a new data source, we have to open a connection to find out what
-   * database product and version it is. */
-  static class DataSourcePool {
-    public static final DataSourcePool INSTANCE = new DataSourcePool();
-
-    private final LoadingCache<List<String>, BasicDataSource> cache =
-        CacheBuilder.newBuilder().softValues().build(
-            new CacheLoader<List<String>, BasicDataSource>() {
-              @Override public BasicDataSource load(@Nonnull List<String> key) {
-                BasicDataSource dataSource = new BasicDataSource();
-                dataSource.setUrl(key.get(0));
-                dataSource.setUsername(key.get(1));
-                dataSource.setPassword(key.get(2));
-                dataSource.setDriverClassName(key.get(3));
-                return dataSource;
-              }
-            });
-
-    public DataSource get(String url, String driverClassName,
-        String username, String password) {
-      // Get data source objects from a cache, so that we don't have to sniff
-      // out what kind of database they are quite as often.
-      final List<String> key =
-          ImmutableNullableList.of(url, username, password, driverClassName);
-      return cache.getUnchecked(key);
-    }
-  }
-}
-
-// End JdbcUtils.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/jdbc/package-info.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/jdbc/package-info.java b/core/src/main/java/org/apache/calcite/adapter/jdbc/package-info.java
deleted file mode 100644
index ba2bdd8..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/jdbc/package-info.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * Query provider based on a JDBC data source.
- */
-@PackageMarker
-package org.apache.calcite.adapter.jdbc;
-
-import org.apache.calcite.avatica.util.PackageMarker;
-
-// End package-info.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/package-info.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/package-info.java b/core/src/main/java/org/apache/calcite/adapter/package-info.java
deleted file mode 100644
index 29084db..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/package-info.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * Calcite adapters.
- *
- * <p>An adapter allows Calcite to access data in a particular data source as
- * if it were a collection of tables in a schema. Each adapter typically
- * contains an implementation of {@link org.apache.calcite.schema.SchemaFactory}
- * and some classes that implement other schema SPIs.
- *
- * <p>To use an adapter, include a custom schema in a JSON model file:
- *
- * <blockquote><pre>
- *    schemas: [
- *      {
- *        type: 'custom',
- *        name: 'My Custom Schema',
- *        factory: 'com.acme.MySchemaFactory',
- *        operand: {a: 'foo', b: [1, 3.5] }
- *      }
- *   ]
- * </pre>
- * </blockquote>
- */
-@PackageMarker
-package org.apache.calcite.adapter;
-
-import org.apache.calcite.avatica.util.PackageMarker;
-
-// End package-info.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/avatica/AvaticaClientRuntimeException.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/avatica/AvaticaClientRuntimeException.java b/core/src/main/java/org/apache/calcite/avatica/AvaticaClientRuntimeException.java
new file mode 100644
index 0000000..df03b03
--- /dev/null
+++ b/core/src/main/java/org/apache/calcite/avatica/AvaticaClientRuntimeException.java
@@ -0,0 +1,94 @@
+/*
+ * 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.
+ */
+package org.apache.calcite.avatica;
+
+import org.apache.calcite.avatica.remote.AvaticaRuntimeException;
+import org.apache.calcite.avatica.remote.Service.ErrorResponse;
+import org.apache.calcite.avatica.remote.Service.RpcMetadataResponse;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * The client-side representation of {@link AvaticaRuntimeException}. This exception is not intended
+ * for consumption by clients, {@link AvaticaSqlException} serves that purpose. This exception only
+ * exists to pass the original error attributes to a higher level of execution without modifying
+ * existing exception-handling logic.
+ */
+public class AvaticaClientRuntimeException extends RuntimeException {
+
+  private static final long serialVersionUID = 1L;
+
+  private final int errorCode;
+  private final String sqlState;
+  private final AvaticaSeverity severity;
+  private final List<String> serverExceptions;
+  private final RpcMetadataResponse metadata;
+
+  public AvaticaClientRuntimeException(String errorMessage, int errorCode, String sqlState,
+      AvaticaSeverity severity, List<String> serverExceptions, RpcMetadataResponse metadata) {
+    super(errorMessage);
+    this.errorCode = errorCode;
+    this.sqlState = sqlState;
+    this.severity = severity;
+    this.serverExceptions = serverExceptions;
+    this.metadata = metadata;
+  }
+
+  public AvaticaClientRuntimeException(String message, Throwable cause) {
+    super(message, cause);
+    errorCode = ErrorResponse.UNKNOWN_ERROR_CODE;
+    sqlState = ErrorResponse.UNKNOWN_SQL_STATE;
+    severity = AvaticaSeverity.UNKNOWN;
+    serverExceptions = Collections.singletonList("");
+    metadata = null;
+  }
+
+  public int getErrorCode() {
+    return errorCode;
+  }
+
+  public String getSqlState() {
+    return sqlState;
+  }
+
+  public AvaticaSeverity getSeverity() {
+    return severity;
+  }
+
+  public List<String> getServerExceptions() {
+    return serverExceptions;
+  }
+
+  public RpcMetadataResponse getRpcMetadata() {
+    return metadata;
+  }
+
+  @Override public String toString() {
+    StringBuilder sb = new StringBuilder(64);
+    sb.append(getClass().getSimpleName()).append(": ")
+    .append(getMessage()).append(". Error ").append(getErrorCode())
+    .append(" (").append(sqlState).append(") ").append(getSeverity()).append("\n\n");
+    for (String serverException : getServerExceptions()) {
+      sb.append(serverException).append("\n");
+    }
+    return sb.toString();
+  }
+
+}
+
+// End AvaticaClientRuntimeException.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/avatica/AvaticaConnection.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/avatica/AvaticaConnection.java b/core/src/main/java/org/apache/calcite/avatica/AvaticaConnection.java
new file mode 100644
index 0000000..51649c1
--- /dev/null
+++ b/core/src/main/java/org/apache/calcite/avatica/AvaticaConnection.java
@@ -0,0 +1,769 @@
+/*
+ * 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.
+ */
+package org.apache.calcite.avatica;
+
+import org.apache.calcite.avatica.Meta.ExecuteBatchResult;
+import org.apache.calcite.avatica.Meta.MetaResultSet;
+import org.apache.calcite.avatica.remote.KerberosConnection;
+import org.apache.calcite.avatica.remote.Service;
+import org.apache.calcite.avatica.remote.Service.ErrorResponse;
+import org.apache.calcite.avatica.remote.Service.OpenConnectionRequest;
+import org.apache.calcite.avatica.remote.TypedValue;
+
+import java.sql.Array;
+import java.sql.Blob;
+import java.sql.CallableStatement;
+import java.sql.Clob;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.NClob;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLClientInfoException;
+import java.sql.SQLException;
+import java.sql.SQLWarning;
+import java.sql.SQLXML;
+import java.sql.Savepoint;
+import java.sql.Statement;
+import java.sql.Struct;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Properties;
+import java.util.TimeZone;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.Executor;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+/**
+ * Implementation of JDBC connection
+ * for the Avatica framework.
+ *
+ * <p>Abstract to allow newer versions of JDBC to add methods.
+ */
+public abstract class AvaticaConnection implements Connection {
+
+  /** The name of the sole column returned by DML statements, containing
+   * the number of rows modified. */
+  public static final String ROWCOUNT_COLUMN_NAME = "ROWCOUNT";
+
+  public static final String NUM_EXECUTE_RETRIES_KEY = "avatica.statement.retries";
+  public static final String NUM_EXECUTE_RETRIES_DEFAULT = "5";
+
+  /** The name of the sole column returned by an EXPLAIN statement.
+   *
+   * <p>Actually Avatica does not care what this column is called, but here is
+   * a useful place to define a suggested value. */
+  public static final String PLAN_COLUMN_NAME = "PLAN";
+
+  protected int statementCount;
+  private boolean closed;
+  private int holdability;
+  private int networkTimeout;
+  private KerberosConnection kerberosConnection;
+  private Service service;
+
+  public final String id;
+  public final Meta.ConnectionHandle handle;
+  protected final UnregisteredDriver driver;
+  protected final AvaticaFactory factory;
+  final String url;
+  protected final Properties info;
+  protected final Meta meta;
+  protected final AvaticaSpecificDatabaseMetaData metaData;
+  public final Helper helper = Helper.INSTANCE;
+  public final Map<InternalProperty, Object> properties = new HashMap<>();
+  public final Map<Integer, AvaticaStatement> statementMap =
+      new ConcurrentHashMap<>();
+  final Map<Integer, AtomicBoolean> flagMap = new ConcurrentHashMap<>();
+  protected final long maxRetriesPerExecute;
+
+  /**
+   * Creates an AvaticaConnection.
+   *
+   * <p>Not public; method is called only from the driver or a derived
+   * class.</p>
+   *
+   * @param driver Driver
+   * @param factory Factory for JDBC objects
+   * @param url Server URL
+   * @param info Other connection properties
+   */
+  protected AvaticaConnection(UnregisteredDriver driver,
+      AvaticaFactory factory,
+      String url,
+      Properties info) {
+    this.id = UUID.randomUUID().toString();
+    this.handle = new Meta.ConnectionHandle(this.id);
+    this.driver = driver;
+    this.factory = factory;
+    this.url = url;
+    this.info = info;
+    this.meta = driver.createMeta(this);
+    this.metaData = factory.newDatabaseMetaData(this);
+    try {
+      this.holdability = metaData.getResultSetHoldability();
+    } catch (SQLException e) {
+      // We know the impl doesn't throw this.
+      throw new RuntimeException(e);
+    }
+    this.maxRetriesPerExecute = getNumStatementRetries(info);
+  }
+
+  /** Computes the number of retries
+   * {@link AvaticaStatement#executeInternal(Meta.Signature, boolean)}
+   * should retry before failing. */
+  long getNumStatementRetries(Properties props) {
+    return Long.valueOf(Objects.requireNonNull(props)
+        .getProperty(NUM_EXECUTE_RETRIES_KEY, NUM_EXECUTE_RETRIES_DEFAULT));
+  }
+
+  /** Returns a view onto this connection's configuration properties. Code
+   * in Avatica and derived projects should use this view rather than calling
+   * {@link java.util.Properties#getProperty(String)}. Derived projects will
+   * almost certainly subclass {@link ConnectionConfig} with their own
+   * properties. */
+  public ConnectionConfig config() {
+    return new ConnectionConfigImpl(info);
+  }
+
+  /**
+   * Opens the connection on the server.
+   */
+  public void openConnection() {
+    // Open the connection on the server
+    this.meta.openConnection(handle, OpenConnectionRequest.serializeProperties(info));
+  }
+
+  // Connection methods
+
+  public AvaticaStatement createStatement() throws SQLException {
+    //noinspection MagicConstant
+    return createStatement(ResultSet.TYPE_FORWARD_ONLY,
+        ResultSet.CONCUR_READ_ONLY,
+        holdability);
+  }
+
+  public PreparedStatement prepareStatement(String sql) throws SQLException {
+    //noinspection MagicConstant
+    return prepareStatement(
+        sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY,
+        holdability);
+  }
+
+  public CallableStatement prepareCall(String sql) throws SQLException {
+    throw helper.unsupported();
+  }
+
+  public String nativeSQL(String sql) throws SQLException {
+    throw helper.unsupported();
+  }
+
+  public void setAutoCommit(boolean autoCommit) throws SQLException {
+    meta.connectionSync(handle, new ConnectionPropertiesImpl().setAutoCommit(autoCommit));
+  }
+
+  public boolean getAutoCommit() throws SQLException {
+    return unbox(sync().isAutoCommit(), true);
+  }
+
+  public void commit() throws SQLException {
+    meta.commit(handle);
+  }
+
+  public void rollback() throws SQLException {
+    meta.rollback(handle);
+  }
+
+  public void close() throws SQLException {
+    if (!closed) {
+      closed = true;
+
+      // Per specification, if onConnectionClose throws, this method will throw
+      // a SQLException, but statement will still be closed.
+      try {
+        meta.closeConnection(handle);
+        driver.handler.onConnectionClose(this);
+        if (null != kerberosConnection) {
+          kerberosConnection.stopRenewalThread();
+        }
+      } catch (RuntimeException e) {
+        throw helper.createException("While closing connection", e);
+      }
+    }
+  }
+
+  public boolean isClosed() throws SQLException {
+    return closed;
+  }
+
+  public DatabaseMetaData getMetaData() throws SQLException {
+    return metaData;
+  }
+
+  public void setReadOnly(boolean readOnly) throws SQLException {
+    meta.connectionSync(handle, new ConnectionPropertiesImpl().setReadOnly(readOnly));
+  }
+
+  public boolean isReadOnly() throws SQLException {
+    return unbox(sync().isReadOnly(), true);
+  }
+
+  public void setCatalog(String catalog) throws SQLException {
+    meta.connectionSync(handle, new ConnectionPropertiesImpl().setCatalog(catalog));
+  }
+
+  public String getCatalog() {
+    return sync().getCatalog();
+  }
+
+  public void setTransactionIsolation(int level) throws SQLException {
+    meta.connectionSync(handle, new ConnectionPropertiesImpl().setTransactionIsolation(level));
+  }
+
+  public int getTransactionIsolation() throws SQLException {
+    //noinspection MagicConstant
+    return unbox(sync().getTransactionIsolation(), TRANSACTION_NONE);
+  }
+
+  public SQLWarning getWarnings() throws SQLException {
+    return null;
+  }
+
+  public void clearWarnings() throws SQLException {
+    // no-op since connection pooling often calls this.
+  }
+
+  public Statement createStatement(
+      int resultSetType, int resultSetConcurrency) throws SQLException {
+    //noinspection MagicConstant
+    return createStatement(resultSetType, resultSetConcurrency, holdability);
+  }
+
+  public PreparedStatement prepareStatement(
+      String sql,
+      int resultSetType,
+      int resultSetConcurrency) throws SQLException {
+    //noinspection MagicConstant
+    return prepareStatement(
+        sql, resultSetType, resultSetConcurrency, holdability);
+  }
+
+  public CallableStatement prepareCall(
+      String sql,
+      int resultSetType,
+      int resultSetConcurrency) throws SQLException {
+    throw helper.unsupported();
+  }
+
+  public Map<String, Class<?>> getTypeMap() throws SQLException {
+    throw helper.unsupported();
+  }
+
+  public void setTypeMap(Map<String, Class<?>> map) throws SQLException {
+    throw helper.unsupported();
+  }
+
+  public void setHoldability(int holdability) throws SQLException {
+    if (!(holdability == ResultSet.CLOSE_CURSORS_AT_COMMIT
+        || holdability == ResultSet.HOLD_CURSORS_OVER_COMMIT)) {
+      throw new SQLException("invalid value");
+    }
+    this.holdability = holdability;
+  }
+
+  public int getHoldability() throws SQLException {
+    return holdability;
+  }
+
+  public Savepoint setSavepoint() throws SQLException {
+    throw helper.unsupported();
+  }
+
+  public Savepoint setSavepoint(String name) throws SQLException {
+    throw helper.unsupported();
+  }
+
+  public void rollback(Savepoint savepoint) throws SQLException {
+    throw helper.unsupported();
+  }
+
+  public void releaseSavepoint(Savepoint savepoint) throws SQLException {
+    throw helper.unsupported();
+  }
+
+  public AvaticaStatement createStatement(
+      int resultSetType,
+      int resultSetConcurrency,
+      int resultSetHoldability) throws SQLException {
+    return factory.newStatement(this, null, resultSetType, resultSetConcurrency,
+        resultSetHoldability);
+  }
+
+  public PreparedStatement prepareStatement(
+      String sql,
+      int resultSetType,
+      int resultSetConcurrency,
+      int resultSetHoldability) throws SQLException {
+    try {
+      final Meta.StatementHandle h = meta.prepare(handle, sql, -1);
+      return factory.newPreparedStatement(this, h, h.signature, resultSetType,
+          resultSetConcurrency, resultSetHoldability);
+    } catch (RuntimeException e) {
+      throw helper.createException("while preparing SQL: " + sql, e);
+    }
+  }
+
+  public CallableStatement prepareCall(
+      String sql,
+      int resultSetType,
+      int resultSetConcurrency,
+      int resultSetHoldability) throws SQLException {
+    throw helper.unsupported();
+  }
+
+  public PreparedStatement prepareStatement(
+      String sql, int autoGeneratedKeys) throws SQLException {
+    throw helper.unsupported();
+  }
+
+  public PreparedStatement prepareStatement(
+      String sql, int[] columnIndexes) throws SQLException {
+    throw helper.unsupported();
+  }
+
+  public PreparedStatement prepareStatement(
+      String sql, String[] columnNames) throws SQLException {
+    throw helper.unsupported();
+  }
+
+  public Clob createClob() throws SQLException {
+    throw helper.unsupported();
+  }
+
+  public Blob createBlob() throws SQLException {
+    throw helper.unsupported();
+  }
+
+  public NClob createNClob() throws SQLException {
+    throw helper.unsupported();
+  }
+
+  public SQLXML createSQLXML() throws SQLException {
+    throw helper.unsupported();
+  }
+
+  public boolean isValid(int timeout) throws SQLException {
+    throw helper.unsupported();
+  }
+
+  public void setClientInfo(String name, String value)
+      throws SQLClientInfoException {
+    throw helper.clientInfo();
+  }
+
+  public void setClientInfo(Properties properties)
+      throws SQLClientInfoException {
+    throw helper.clientInfo();
+  }
+
+  public String getClientInfo(String name) throws SQLException {
+    throw helper.unsupported();
+  }
+
+  public Properties getClientInfo() throws SQLException {
+    throw helper.unsupported();
+  }
+
+  public Array createArrayOf(String typeName, Object[] elements)
+      throws SQLException {
+    throw helper.unsupported();
+  }
+
+  public Struct createStruct(String typeName, Object[] attributes)
+      throws SQLException {
+    throw helper.unsupported();
+  }
+
+  public void setSchema(String schema) throws SQLException {
+    meta.connectionSync(handle, new ConnectionPropertiesImpl().setSchema(schema));
+  }
+
+  public String getSchema() {
+    return sync().getSchema();
+  }
+
+  public void abort(Executor executor) throws SQLException {
+    throw helper.unsupported();
+  }
+
+  public void setNetworkTimeout(
+      Executor executor, int milliseconds) throws SQLException {
+    this.networkTimeout = milliseconds;
+  }
+
+  public int getNetworkTimeout() throws SQLException {
+    return networkTimeout;
+  }
+
+  public <T> T unwrap(Class<T> iface) throws SQLException {
+    if (iface.isInstance(this)) {
+      return iface.cast(this);
+    }
+    throw helper.createException(
+        "does not implement '" + iface + "'");
+  }
+
+  public boolean isWrapperFor(Class<?> iface) throws SQLException {
+    return iface.isInstance(this);
+  }
+
+  /** Returns the time zone of this connection. Determines the offset applied
+   * when converting datetime values from the database into
+   * {@link java.sql.Timestamp} values. */
+  public TimeZone getTimeZone() {
+    final String timeZoneName = config().timeZone();
+    return timeZoneName == null
+        ? TimeZone.getDefault()
+        : TimeZone.getTimeZone(timeZoneName);
+  }
+
+  /**
+   * Executes a prepared query, closing any previously open result set.
+   *
+   * @param statement     Statement
+   * @param signature     Prepared query
+   * @param firstFrame    First frame of rows, or null if we need to execute
+   * @param state         The state used to create the given result
+   * @param isUpdate      Was the caller context via {@link PreparedStatement#executeUpdate()}.
+   * @return Result set
+   * @throws java.sql.SQLException if a database error occurs
+   */
+  protected ResultSet executeQueryInternal(AvaticaStatement statement,
+      Meta.Signature signature, Meta.Frame firstFrame, QueryState state, boolean isUpdate)
+      throws SQLException {
+    // Close the previous open result set, if there is one.
+    Meta.Frame frame = firstFrame;
+    Meta.Signature signature2 = signature;
+
+    synchronized (statement) {
+      if (statement.openResultSet != null) {
+        final AvaticaResultSet rs = statement.openResultSet;
+        statement.openResultSet = null;
+        try {
+          rs.close();
+        } catch (Exception e) {
+          throw helper.createException(
+              "Error while closing previous result set", e);
+        }
+      }
+
+      try {
+        if (statement.isWrapperFor(AvaticaPreparedStatement.class)) {
+          final AvaticaPreparedStatement pstmt = (AvaticaPreparedStatement) statement;
+          Meta.StatementHandle handle = pstmt.handle;
+          if (isUpdate) {
+            // Make a copy of the StatementHandle, nulling out the Signature.
+            // CALCITE-1086 we don't need to send the Signature to the server
+            // when we're only performing an update. Saves on serialization.
+            handle = new Meta.StatementHandle(handle.connectionId, handle.id, null);
+          }
+          final Meta.ExecuteResult executeResult =
+              meta.execute(handle, pstmt.getParameterValues(),
+                  statement.getFetchSize());
+          final MetaResultSet metaResultSet = executeResult.resultSets.get(0);
+          frame = metaResultSet.firstFrame;
+          statement.updateCount = metaResultSet.updateCount;
+          signature2 = executeResult.resultSets.get(0).signature;
+        }
+      } catch (Exception e) {
+        e.printStackTrace();
+        throw helper.createException(e.getMessage(), e);
+      }
+
+      final TimeZone timeZone = getTimeZone();
+      if (frame == null && signature2 == null && statement.updateCount != -1) {
+        statement.openResultSet = null;
+      } else {
+        // Duplicative SQL, for support non-prepared statements
+        statement.openResultSet =
+            factory.newResultSet(statement, state, signature2, timeZone, frame);
+      }
+    }
+    // Release the monitor before executing, to give another thread the
+    // opportunity to call cancel.
+    try {
+      if (statement.openResultSet != null) {
+        statement.openResultSet.execute();
+        isUpdateCapable(statement);
+      }
+    } catch (Exception e) {
+      throw helper.createException(
+          "exception while executing query: " + e.getMessage(), e);
+    }
+    return statement.openResultSet;
+  }
+
+  /** Executes a batch update using an {@link AvaticaPreparedStatement}.
+   *
+   * @param pstmt The prepared statement.
+   * @return An array of update counts containing one element for each command in the batch.
+   */
+  protected long[] executeBatchUpdateInternal(AvaticaPreparedStatement pstmt) throws SQLException {
+    try {
+      // Get the handle from the statement
+      Meta.StatementHandle handle = pstmt.handle;
+      // Execute it against meta
+      return meta.executeBatch(handle, pstmt.getParameterValueBatch()).updateCounts;
+    } catch (Exception e) {
+      throw helper.createException(e.getMessage(), e);
+    }
+  }
+
+  /** Returns whether a a statement is capable of updates and if so,
+   * and the statement's {@code updateCount} is still -1, proceeds to
+   * get updateCount value from statement's resultSet.
+   *
+   * <p>Handles "ROWCOUNT" object as Number or List
+   *
+   * @param statement Statement
+   * @throws SQLException on error
+   */
+  private void isUpdateCapable(final AvaticaStatement statement)
+      throws SQLException {
+    Meta.Signature signature = statement.getSignature();
+    if (signature == null || signature.statementType == null) {
+      return;
+    }
+    if (signature.statementType.canUpdate() && statement.updateCount == -1) {
+      statement.openResultSet.next();
+      Object obj = statement.openResultSet.getObject(ROWCOUNT_COLUMN_NAME);
+      if (obj instanceof Number) {
+        statement.updateCount = ((Number) obj).intValue();
+      } else if (obj instanceof List) {
+        @SuppressWarnings("unchecked")
+        final List<Number> numbers = (List<Number>) obj;
+        statement.updateCount = numbers.get(0).intValue();
+      } else {
+        throw helper.createException("Not a valid return result.");
+      }
+      statement.openResultSet = null;
+    }
+  }
+
+  protected Meta.ExecuteResult prepareAndExecuteInternal(
+      final AvaticaStatement statement, final String sql, long maxRowCount)
+      throws SQLException, NoSuchStatementException {
+    final Meta.PrepareCallback callback =
+        new Meta.PrepareCallback() {
+          public Object getMonitor() {
+            return statement;
+          }
+
+          public void clear() throws SQLException {
+            if (statement.openResultSet != null) {
+              final AvaticaResultSet rs = statement.openResultSet;
+              statement.openResultSet = null;
+              try {
+                rs.close();
+              } catch (Exception e) {
+                throw helper.createException(
+                    "Error while closing previous result set", e);
+              }
+            }
+          }
+
+          public void assign(Meta.Signature signature, Meta.Frame firstFrame,
+              long updateCount) throws SQLException {
+            statement.setSignature(signature);
+
+            if (updateCount != -1) {
+              statement.updateCount = updateCount;
+            } else {
+              final TimeZone timeZone = getTimeZone();
+              statement.openResultSet = factory.newResultSet(statement, new QueryState(sql),
+                  signature, timeZone, firstFrame);
+            }
+          }
+
+          public void execute() throws SQLException {
+            if (statement.openResultSet != null) {
+              statement.openResultSet.execute();
+              isUpdateCapable(statement);
+            }
+          }
+        };
+    // The old semantics were that maxRowCount was also treated as the maximum number of
+    // elements in the first Frame of results. A value of -1 would also preserve this, but an
+    // explicit (positive) number is easier to follow, IMO.
+    return meta.prepareAndExecute(statement.handle, sql, maxRowCount,
+        AvaticaUtils.toSaturatedInt(maxRowCount), callback);
+  }
+
+  protected ExecuteBatchResult prepareAndUpdateBatch(final AvaticaStatement statement,
+      final List<String> queries) throws NoSuchStatementException, SQLException {
+    return meta.prepareAndExecuteBatch(statement.handle, queries);
+  }
+
+  protected ResultSet createResultSet(Meta.MetaResultSet metaResultSet, QueryState state)
+      throws SQLException {
+    final Meta.StatementHandle h = new Meta.StatementHandle(
+        metaResultSet.connectionId, metaResultSet.statementId, null);
+    final AvaticaStatement statement = lookupStatement(h);
+    // These are all the metadata operations, no updates
+    ResultSet resultSet = executeQueryInternal(statement, metaResultSet.signature.sanitize(),
+        metaResultSet.firstFrame, state, false);
+    if (metaResultSet.ownStatement) {
+      resultSet.getStatement().closeOnCompletion();
+    }
+    return resultSet;
+  }
+
+  /** Creates a statement wrapper around an existing handle. */
+  protected AvaticaStatement lookupStatement(Meta.StatementHandle h)
+      throws SQLException {
+    final AvaticaStatement statement = statementMap.get(h.id);
+    if (statement != null) {
+      return statement;
+    }
+    //noinspection MagicConstant
+    return factory.newStatement(this, Objects.requireNonNull(h),
+        ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, holdability);
+  }
+
+  // do not make public
+  protected static Trojan createTrojan() {
+    return new Trojan();
+  }
+
+  /** Converts a {@link Boolean} to a {@code boolean}, with a default value. */
+  private boolean unbox(Boolean b, boolean defaultValue) {
+    return b == null ? defaultValue : b;
+  }
+
+  /** Converts an {@link Integer} to an {@code int}, with a default value. */
+  private int unbox(Integer i, int defaultValue) {
+    return i == null ? defaultValue : i;
+  }
+
+  private Meta.ConnectionProperties sync() {
+    return meta.connectionSync(handle, new ConnectionPropertiesImpl());
+  }
+
+  /** Returns or creates a slot whose state can be changed to cancel a
+   * statement. Statements will receive the same slot if and only if their id
+   * is the same. */
+  public AtomicBoolean getCancelFlag(Meta.StatementHandle h)
+      throws NoSuchStatementException {
+    AvaticaUtils.upgrade("after dropping JDK 1.7, use Map.computeIfAbsent");
+    synchronized (flagMap) {
+      AtomicBoolean b = flagMap.get(h.id);
+      if (b == null) {
+        b = new AtomicBoolean();
+        flagMap.put(h.id, b);
+      }
+      return b;
+    }
+  }
+
+  /** A way to call package-protected methods. But only a sub-class of
+   * connection can create one. */
+  public static class Trojan {
+    // must be private
+    private Trojan() {
+    }
+
+    /** A means for anyone who has a trojan to call the protected method
+     * {@link org.apache.calcite.avatica.AvaticaResultSet#execute()}.
+     * @throws SQLException if execute fails for some reason. */
+    public ResultSet execute(AvaticaResultSet resultSet) throws SQLException {
+      return resultSet.execute();
+    }
+
+    /** A means for anyone who has a trojan to call the protected method
+     * {@link org.apache.calcite.avatica.AvaticaStatement#getParameterValues()}.
+     */
+    public List<TypedValue> getParameterValues(AvaticaStatement statement) {
+      return statement.getParameterValues();
+    }
+
+    /** A means for anyone who has a trojan to get the protected field
+     * {@link org.apache.calcite.avatica.AvaticaConnection#meta}. */
+    public Meta getMeta(AvaticaConnection connection) {
+      return connection.meta;
+    }
+  }
+
+  /**
+   * A Callable-like interface but without a "throws Exception".
+   *
+   * @param <T> The return type from {@code call}.
+   */
+  public interface CallableWithoutException<T> {
+    T call();
+  }
+
+  /**
+   * Invokes the given "callable", retrying the call when the server responds with an error
+   * denoting that the connection is missing on the server.
+   *
+   * @param callable The function to invoke.
+   * @return The value from the result of the callable.
+   */
+  public <T> T invokeWithRetries(CallableWithoutException<T> callable) {
+    RuntimeException lastException = null;
+    for (int i = 0; i < maxRetriesPerExecute; i++) {
+      try {
+        return callable.call();
+      } catch (AvaticaClientRuntimeException e) {
+        lastException = e;
+        if (ErrorResponse.MISSING_CONNECTION_ERROR_CODE == e.getErrorCode()) {
+          this.openConnection();
+          continue;
+        }
+        throw e;
+      }
+    }
+    if (null != lastException) {
+      throw lastException;
+    } else {
+      // Shouldn't ever happen.
+      throw new IllegalStateException();
+    }
+  }
+
+  public void setKerberosConnection(KerberosConnection kerberosConnection) {
+    this.kerberosConnection = Objects.requireNonNull(kerberosConnection);
+  }
+
+  public KerberosConnection getKerberosConnection() {
+    return this.kerberosConnection;
+  }
+
+  public Service getService() {
+    assert null != service;
+    return service;
+  }
+
+  public void setService(Service service) {
+    this.service = Objects.requireNonNull(service);
+  }
+}
+
+// End AvaticaConnection.java


[29/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/test/java/org/apache/calcite/avatica/test/JsonHandlerTest.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/test/java/org/apache/calcite/avatica/test/JsonHandlerTest.java b/avatica/core/src/test/java/org/apache/calcite/avatica/test/JsonHandlerTest.java
deleted file mode 100644
index 7afa000..0000000
--- a/avatica/core/src/test/java/org/apache/calcite/avatica/test/JsonHandlerTest.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.test;
-
-import org.apache.calcite.avatica.AvaticaParameter;
-import org.apache.calcite.avatica.ColumnMetaData;
-import org.apache.calcite.avatica.Meta;
-import org.apache.calcite.avatica.Meta.CursorFactory;
-import org.apache.calcite.avatica.metrics.noop.NoopMetricsSystem;
-import org.apache.calcite.avatica.remote.JsonHandler;
-import org.apache.calcite.avatica.remote.JsonService;
-import org.apache.calcite.avatica.remote.LocalJsonService;
-import org.apache.calcite.avatica.remote.Service;
-import org.apache.calcite.avatica.remote.TypedValue;
-
-import org.junit.Test;
-
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Random;
-import java.util.UUID;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-/**
- * Tests JSON encoding/decoding in the remote service.
- */
-public class JsonHandlerTest {
-
-  private static final Random RANDOM = new Random();
-
-  /**
-   * Implementation of {@link org.apache.calcite.avatica.remote.Service}
-   * that does nothing.
-   */
-  public static class NoopService implements Service {
-    @Override public ResultSetResponse apply(CatalogsRequest request) {
-      return null;
-    }
-
-    @Override public ResultSetResponse apply(SchemasRequest request) {
-      return null;
-    }
-
-    @Override public ResultSetResponse apply(TablesRequest request) {
-      return null;
-    }
-
-    @Override public ResultSetResponse apply(TableTypesRequest request) {
-      return null;
-    }
-
-    @Override public ResultSetResponse apply(TypeInfoRequest request) {
-      return null;
-    }
-
-    @Override public ResultSetResponse apply(ColumnsRequest request) {
-      return null;
-    }
-
-    @Override public PrepareResponse apply(PrepareRequest request) {
-      return null;
-    }
-
-    @Override public ExecuteResponse apply(PrepareAndExecuteRequest request) {
-      return null;
-    }
-
-    @Override public FetchResponse apply(FetchRequest request) {
-      return null;
-    }
-
-    @Override public CreateStatementResponse apply(CreateStatementRequest request) {
-      return null;
-    }
-
-    @Override public CloseStatementResponse apply(CloseStatementRequest request) {
-      return null;
-    }
-
-    @Override public OpenConnectionResponse apply(OpenConnectionRequest request) {
-      return null;
-    }
-
-    @Override public CloseConnectionResponse apply(CloseConnectionRequest request) {
-      return null;
-    }
-
-    @Override public ConnectionSyncResponse apply(ConnectionSyncRequest request) {
-      return null;
-    }
-
-    @Override public DatabasePropertyResponse apply(DatabasePropertyRequest request) {
-      return null;
-    }
-
-    @Override public SyncResultsResponse apply(SyncResultsRequest request) {
-      return null;
-    }
-
-    @Override public ExecuteResponse apply(ExecuteRequest request) {
-      return null;
-    }
-
-    @Override public void setRpcMetadata(RpcMetadataResponse metadata) {}
-
-    @Override public CommitResponse apply(CommitRequest request) {
-      return null;
-    }
-
-    @Override public RollbackResponse apply(RollbackRequest request) {
-      return null;
-    }
-
-    @Override public ExecuteBatchResponse apply(ExecuteBatchRequest request) {
-      return null;
-    }
-
-    @Override public ExecuteBatchResponse apply(PrepareAndExecuteBatchRequest request) {
-      return null;
-    }
-  }
-
-  /**
-   * Instrumented subclass of {@link org.apache.calcite.avatica.test.JsonHandlerTest.NoopService}
-   * that checks the parameter values passed to the "execute" request.
-   *
-   * <p>Note: parameter values for "fetch" request deprecated.
-   */
-  public static class ParameterValuesCheckingService extends NoopService {
-
-    final List<TypedValue> expectedParameterValues;
-
-    public ParameterValuesCheckingService(List<TypedValue> epv) {
-      expectedParameterValues = epv;
-    }
-
-    @Override public ExecuteResponse apply(ExecuteRequest request) {
-      expectedParameterValues.addAll(request.parameterValues);
-
-      final Meta.Signature signature =
-          new Meta.Signature(Collections.<ColumnMetaData>emptyList(),
-              "SELECT 1 FROM VALUE()",
-              Collections.<AvaticaParameter>emptyList(),
-              Collections.<String, Object>emptyMap(),
-              CursorFactory.LIST, Meta.StatementType.SELECT);
-
-      final Service.ResultSetResponse resultSetResponse =
-          new Service.ResultSetResponse(UUID.randomUUID().toString(),
-              RANDOM.nextInt(), false, signature, Meta.Frame.EMPTY, -1L, null);
-
-      return new Service.ExecuteResponse(
-          Collections.singletonList(resultSetResponse), false, null);
-    }
-  }
-
-  @Test public void testExecuteRequestWithNumberParameter() {
-    final List<TypedValue> expectedParameterValues = new ArrayList<>();
-    final Service service = new ParameterValuesCheckingService(expectedParameterValues);
-    final JsonService jsonService = new LocalJsonService(service);
-    final JsonHandler jsonHandler = new JsonHandler(jsonService, NoopMetricsSystem.getInstance());
-
-    final List<TypedValue> parameterValues = Arrays.asList(
-        TypedValue.create("NUMBER", new BigDecimal("123")),
-        TypedValue.create("STRING", "calcite"));
-
-    jsonHandler.apply(
-        "{'request':'execute',"
-        + "'parameterValues':[{'type':'NUMBER','value':123},"
-        + "{'type':'STRING','value':'calcite'}]}");
-    assertThat(expectedParameterValues.size(), is(2));
-    assertThat(expectedParameterValues.get(0), is(parameterValues.get(0)));
-    assertThat(expectedParameterValues.get(1), is(parameterValues.get(1)));
-  }
-}
-
-// End JsonHandlerTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/test/java/org/apache/calcite/avatica/test/package-info.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/test/java/org/apache/calcite/avatica/test/package-info.java b/avatica/core/src/test/java/org/apache/calcite/avatica/test/package-info.java
deleted file mode 100644
index 501bb9f..0000000
--- a/avatica/core/src/test/java/org/apache/calcite/avatica/test/package-info.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * Avatica tests.
- */
-@PackageMarker
-package org.apache.calcite.avatica.test;
-
-import org.apache.calcite.avatica.util.PackageMarker;
-
-// End package-info.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/test/java/org/apache/calcite/avatica/util/DateTimeUtilsTest.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/test/java/org/apache/calcite/avatica/util/DateTimeUtilsTest.java b/avatica/core/src/test/java/org/apache/calcite/avatica/util/DateTimeUtilsTest.java
deleted file mode 100644
index 1ac1a90..0000000
--- a/avatica/core/src/test/java/org/apache/calcite/avatica/util/DateTimeUtilsTest.java
+++ /dev/null
@@ -1,526 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.util;
-
-import org.junit.Test;
-
-import static org.apache.calcite.avatica.util.DateTimeUtils.EPOCH_JULIAN;
-import static org.apache.calcite.avatica.util.DateTimeUtils.addMonths;
-import static org.apache.calcite.avatica.util.DateTimeUtils.dateStringToUnixDate;
-
-
-import static org.apache.calcite.avatica.util.DateTimeUtils.digitCount;
-import static org.apache.calcite.avatica.util.DateTimeUtils.floorDiv;
-import static org.apache.calcite.avatica.util.DateTimeUtils.floorMod;
-import static org.apache.calcite.avatica.util.DateTimeUtils.intervalDayTimeToString;
-import static org.apache.calcite.avatica.util.DateTimeUtils.intervalYearMonthToString;
-import static org.apache.calcite.avatica.util.DateTimeUtils.subtractMonths;
-import static org.apache.calcite.avatica.util.DateTimeUtils.timeStringToUnixDate;
-import static org.apache.calcite.avatica.util.DateTimeUtils.timestampStringToUnixDate;
-import static org.apache.calcite.avatica.util.DateTimeUtils.unixDateExtract;
-import static org.apache.calcite.avatica.util.DateTimeUtils.unixDateToString;
-import static org.apache.calcite.avatica.util.DateTimeUtils.unixTimeExtract;
-import static org.apache.calcite.avatica.util.DateTimeUtils.unixTimeToString;
-import static org.apache.calcite.avatica.util.DateTimeUtils.unixTimestamp;
-import static org.apache.calcite.avatica.util.DateTimeUtils.unixTimestampExtract;
-import static org.apache.calcite.avatica.util.DateTimeUtils.unixTimestampToString;
-import static org.apache.calcite.avatica.util.DateTimeUtils.ymdToJulian;
-import static org.apache.calcite.avatica.util.DateTimeUtils.ymdToUnixDate;
-
-import static org.hamcrest.CoreMatchers.anyOf;
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-
-/**
- * Tests for {@link DateTimeUtils}.
- */
-public class DateTimeUtilsTest {
-  @Test public void testEasyLog10() {
-    assertEquals(1, digitCount(0));
-    assertEquals(1, digitCount(1));
-    assertEquals(1, digitCount(9));
-    assertEquals(2, digitCount(10));
-    assertEquals(2, digitCount(11));
-    assertEquals(2, digitCount(99));
-    assertEquals(3, digitCount(100));
-  }
-
-  @Test public void testFloorDiv() {
-    assertThat(floorDiv(13, 3), equalTo(4L));
-    assertThat(floorDiv(12, 3), equalTo(4L));
-    assertThat(floorDiv(11, 3), equalTo(3L));
-    assertThat(floorDiv(-13, 3), equalTo(-5L));
-    assertThat(floorDiv(-12, 3), equalTo(-4L));
-    assertThat(floorDiv(-11, 3), equalTo(-4L));
-    assertThat(floorDiv(0, 3), equalTo(0L));
-    assertThat(floorDiv(1, 3), equalTo(0L));
-    assertThat(floorDiv(-1, 3), is(-1L));
-  }
-
-  @Test public void testFloorMod() {
-    assertThat(floorMod(13, 3), is(1L));
-    assertThat(floorMod(12, 3), is(0L));
-    assertThat(floorMod(11, 3), is(2L));
-    assertThat(floorMod(-13, 3), is(2L));
-    assertThat(floorMod(-12, 3), is(0L));
-    assertThat(floorMod(-11, 3), is(1L));
-    assertThat(floorMod(0, 3), is(0L));
-    assertThat(floorMod(1, 3), is(1L));
-    assertThat(floorMod(-1, 3), is(2L));
-  }
-
-  @Test public void testUnixDateToString() {
-    // Verify these using the "date" command. E.g.
-    // $ date -u --date="@$(expr 10957 \* 86400)"
-    // Sat Jan  1 00:00:00 UTC 2000
-    assertEquals("2000-01-01", unixDateToString(10957));
-
-    assertEquals("1970-01-01", unixDateToString(0));
-    assertEquals("1970-01-02", unixDateToString(1));
-    assertEquals("1971-01-01", unixDateToString(365));
-    assertEquals("1972-01-01", unixDateToString(730));
-    assertEquals("1972-02-28", unixDateToString(788));
-    assertEquals("1972-02-29", unixDateToString(789));
-    assertEquals("1972-03-01", unixDateToString(790));
-
-    assertEquals("1969-01-01", unixDateToString(-365));
-    assertEquals("2000-01-01", unixDateToString(10957));
-    assertEquals("2000-02-28", unixDateToString(11015));
-    assertEquals("2000-02-29", unixDateToString(11016));
-    assertEquals("2000-03-01", unixDateToString(11017));
-    assertEquals("1900-01-01", unixDateToString(-25567));
-    assertEquals("1900-02-28", unixDateToString(-25509));
-    assertEquals("1900-03-01", unixDateToString(-25508));
-    assertEquals("1945-02-24", unixDateToString(-9077));
-  }
-
-  @Test public void testYmdToUnixDate() {
-    assertEquals(0, ymdToUnixDate(1970, 1, 1));
-    assertEquals(365, ymdToUnixDate(1971, 1, 1));
-    assertEquals(-365, ymdToUnixDate(1969, 1, 1));
-    assertEquals(11015, ymdToUnixDate(2000, 2, 28));
-    assertEquals(11016, ymdToUnixDate(2000, 2, 29));
-    assertEquals(11017, ymdToUnixDate(2000, 3, 1));
-    assertEquals(-9077, ymdToUnixDate(1945, 2, 24));
-    assertEquals(-25509, ymdToUnixDate(1900, 2, 28));
-    assertEquals(-25508, ymdToUnixDate(1900, 3, 1));
-  }
-
-  @Test public void testDateToString() {
-    checkDateString("1970-01-01", 0);
-    //noinspection PointlessArithmeticExpression
-    checkDateString("1971-02-03", 0 + 365 + 31 + (3 - 1));
-    //noinspection PointlessArithmeticExpression
-    checkDateString("1971-02-28", 0 + 365 + 31 + (28 - 1));
-    //noinspection PointlessArithmeticExpression
-    checkDateString("1971-03-01", 0 + 365 + 31 + 28 + (1 - 1));
-    //noinspection PointlessArithmeticExpression
-    checkDateString("1972-02-28", 0 + 365 * 2 + 31 + (28 - 1));
-    //noinspection PointlessArithmeticExpression
-    checkDateString("1972-02-29", 0 + 365 * 2 + 31 + (29 - 1));
-    //noinspection PointlessArithmeticExpression
-    checkDateString("1972-03-01", 0 + 365 * 2 + 31 + 29 + (1 - 1));
-  }
-
-  private void checkDateString(String s, int d) {
-    assertThat(unixDateToString(d), is(s));
-    assertThat(dateStringToUnixDate(s), is(d));
-  }
-
-  @Test public void testTimeToString() {
-    checkTimeString("00:00:00", 0, 0);
-    checkTimeString("23:59:59", 0, 86400000 - 1000);
-    checkTimeString("23:59:59.1", 1, 86400000 - 1000 + 100);
-    checkTimeString("23:59:59.01", 2, 86400000 - 1000 + 10);
-    checkTimeString("23:59:59.1234", 3, 86400000 - 1000 + 123);
-    checkTimeString("23:59:59.1236", 3, 86400000 - 1000 + 124);
-    checkTimeString("23:59:59.123456789012345678901234567890", 3,
-        86400000 - 1000 + 123);
-  }
-
-  @Test public void testTimestampExtract() {
-    // 1970-01-01 00:00:00.000
-    assertThat(unixTimestampExtract(TimeUnitRange.HOUR, 0L), is(0));
-    assertThat(unixTimestampExtract(TimeUnitRange.MINUTE, 0L), is(0));
-    assertThat(unixTimestampExtract(TimeUnitRange.SECOND, 0L), is(0));
-    // 1970-01-02 00:00:00.000
-    assertThat(unixTimestampExtract(TimeUnitRange.HOUR, 86400000L), is(0));
-    assertThat(unixTimestampExtract(TimeUnitRange.MINUTE, 86400000L), is(0));
-    assertThat(unixTimestampExtract(TimeUnitRange.SECOND, 86400000L), is(0));
-  }
-
-  @Test public void testTimeExtract() {
-    // 00:00:00.000
-    assertThat(unixTimeExtract(TimeUnitRange.HOUR, 0), is(0));
-    assertThat(unixTimeExtract(TimeUnitRange.MINUTE, 0), is(0));
-    assertThat(unixTimeExtract(TimeUnitRange.SECOND, 0), is(0));
-    // 00:59:59.999
-    assertThat(unixTimeExtract(TimeUnitRange.HOUR, 3599999), is(0));
-    assertThat(unixTimeExtract(TimeUnitRange.MINUTE, 3599999), is(59));
-    assertThat(unixTimeExtract(TimeUnitRange.SECOND, 3599999), is(59));
-    // 01:59:59.999
-    assertThat(unixTimeExtract(TimeUnitRange.HOUR, 7199999), is(1));
-    assertThat(unixTimeExtract(TimeUnitRange.MINUTE, 7199999), is(59));
-    assertThat(unixTimeExtract(TimeUnitRange.SECOND, 7199999), is(59));
-    // 01:58:59.999
-    assertThat(unixTimeExtract(TimeUnitRange.HOUR, 7139999), is(1));
-    assertThat(unixTimeExtract(TimeUnitRange.MINUTE, 7139999), is(58));
-    assertThat(unixTimeExtract(TimeUnitRange.SECOND, 7139999), is(59));
-    // 23:59:59.999
-    assertThat(unixTimeExtract(TimeUnitRange.HOUR, 86399999), is(23));
-    assertThat(unixTimeExtract(TimeUnitRange.MINUTE, 86399999), is(59));
-    assertThat(unixTimeExtract(TimeUnitRange.SECOND, 86399999), is(59));
-  }
-
-  private void checkTimeString(String s, int p, int d) {
-    int digitsAfterPoint = s.indexOf('.') >= 0
-        ? s.length() - s.indexOf('.') - 1
-        : 0;
-    if (digitsAfterPoint == p) {
-      assertThat(unixTimeToString(d, p), is(s));
-    }
-    assertThat(timeStringToUnixDate(s), is(d));
-  }
-
-  @Test public void testTimestampToString() {
-    // ISO format would be "1970-01-01T00:00:00" but SQL format is different
-    checkTimestampString("1970-01-01 00:00:00", 0, 0L);
-    checkTimestampString("1970-02-01 23:59:59", 0, 86400000L * 32L - 1000L);
-    checkTimestampString("1970-02-01 23:59:59.123", 3,
-        86400000L * 32L - 1000L + 123);
-    checkTimestampString("1970-02-01 23:59:59.04", 2,
-        86400000L * 32L - 1000L + 40);
-  }
-
-  private void checkTimestampString(String s, int p, long d) {
-    assertThat(unixTimestampToString(d, p), is(s));
-    assertThat(timestampStringToUnixDate(s), is(d));
-  }
-
-  @Test public void testIntervalYearMonthToString() {
-    TimeUnitRange range = TimeUnitRange.YEAR_TO_MONTH;
-    assertEquals("+0-00", intervalYearMonthToString(0, range));
-    assertEquals("+1-00", intervalYearMonthToString(12, range));
-    assertEquals("+1-01", intervalYearMonthToString(13, range));
-    assertEquals("-1-01", intervalYearMonthToString(-13, range));
-  }
-
-  @Test public void testIntervalDayTimeToString() {
-    assertEquals("+0", intervalYearMonthToString(0, TimeUnitRange.YEAR));
-    assertEquals("+0-00",
-        intervalYearMonthToString(0, TimeUnitRange.YEAR_TO_MONTH));
-    assertEquals("+0", intervalYearMonthToString(0, TimeUnitRange.MONTH));
-    assertEquals("+0", intervalDayTimeToString(0, TimeUnitRange.DAY, 0));
-    assertEquals("+0 00",
-        intervalDayTimeToString(0, TimeUnitRange.DAY_TO_HOUR, 0));
-    assertEquals("+0 00:00",
-        intervalDayTimeToString(0, TimeUnitRange.DAY_TO_MINUTE, 0));
-    assertEquals("+0 00:00:00",
-        intervalDayTimeToString(0, TimeUnitRange.DAY_TO_SECOND, 0));
-    assertEquals("+0", intervalDayTimeToString(0, TimeUnitRange.HOUR, 0));
-    assertEquals("+0:00",
-        intervalDayTimeToString(0, TimeUnitRange.HOUR_TO_MINUTE, 0));
-    assertEquals("+0:00:00",
-        intervalDayTimeToString(0, TimeUnitRange.HOUR_TO_SECOND, 0));
-    assertEquals("+0",
-        intervalDayTimeToString(0, TimeUnitRange.MINUTE, 0));
-    assertEquals("+0:00",
-        intervalDayTimeToString(0, TimeUnitRange.MINUTE_TO_SECOND, 0));
-    assertEquals("+0",
-        intervalDayTimeToString(0, TimeUnitRange.SECOND, 0));
-  }
-
-  @Test public void testYmdToJulian() {
-    // All checked using http://aa.usno.navy.mil/data/docs/JulianDate.php.
-    // We round up - if JulianDate.php gives 2451544.5, we use 2451545.
-    assertThat(ymdToJulian(2014, 4, 3), is(2456751));
-
-    // 2000 is a leap year
-    assertThat(ymdToJulian(2000, 1, 1), is(2451545));
-    assertThat(ymdToJulian(2000, 2, 28), is(2451603));
-    assertThat(ymdToJulian(2000, 2, 29), is(2451604));
-    assertThat(ymdToJulian(2000, 3, 1), is(2451605));
-
-    assertThat(ymdToJulian(1970, 1, 1), is(2440588));
-    assertThat(ymdToJulian(1970, 1, 1), is(EPOCH_JULIAN));
-    assertThat(ymdToJulian(1901, 1, 1), is(2415386));
-
-    // 1900 is not a leap year
-    assertThat(ymdToJulian(1900, 10, 17), is(2415310));
-    assertThat(ymdToJulian(1900, 3, 1), is(2415080));
-    assertThat(ymdToJulian(1900, 2, 28), is(2415079));
-    assertThat(ymdToJulian(1900, 2, 1), is(2415052));
-    assertThat(ymdToJulian(1900, 1, 1), is(2415021));
-
-    assertThat(ymdToJulian(1777, 7, 4), is(2370281));
-
-    // 2016 is a leap year
-    assertThat(ymdToJulian(2016, 2, 28), is(2457447));
-    assertThat(ymdToJulian(2016, 2, 29), is(2457448));
-    assertThat(ymdToJulian(2016, 3, 1), is(2457449));
-  }
-
-  @Test public void testExtract() {
-    assertThat(unixDateExtract(TimeUnitRange.YEAR, 0), is(1970L));
-    assertThat(unixDateExtract(TimeUnitRange.YEAR, -1), is(1969L));
-    assertThat(unixDateExtract(TimeUnitRange.YEAR, 364), is(1970L));
-    assertThat(unixDateExtract(TimeUnitRange.YEAR, 365), is(1971L));
-
-    assertThat(unixDateExtract(TimeUnitRange.MONTH, 0), is(1L));
-    assertThat(unixDateExtract(TimeUnitRange.MONTH, -1), is(12L));
-    assertThat(unixDateExtract(TimeUnitRange.MONTH, 364), is(12L));
-    assertThat(unixDateExtract(TimeUnitRange.MONTH, 365), is(1L));
-
-    // 1969/12/31 was a Wed (4)
-    assertThat(unixDateExtract(TimeUnitRange.DOW, -1), is(4L)); // wed
-    assertThat(unixDateExtract(TimeUnitRange.DOW, 0), is(5L)); // thu
-    assertThat(unixDateExtract(TimeUnitRange.DOW, 1), is(6L)); // fri
-    assertThat(unixDateExtract(TimeUnitRange.DOW, 2), is(7L)); // sat
-    assertThat(unixDateExtract(TimeUnitRange.DOW, 3), is(1L)); // sun
-    assertThat(unixDateExtract(TimeUnitRange.DOW, 365), is(6L));
-    assertThat(unixDateExtract(TimeUnitRange.DOW, 366), is(7L));
-
-    assertThat(unixDateExtract(TimeUnitRange.DOY, -1), is(365L));
-    assertThat(unixDateExtract(TimeUnitRange.DOY, 0), is(1L));
-    assertThat(unixDateExtract(TimeUnitRange.DOY, 1), is(2L));
-    assertThat(unixDateExtract(TimeUnitRange.DOY, 2), is(3L));
-    assertThat(unixDateExtract(TimeUnitRange.DOY, 3), is(4L));
-    assertThat(unixDateExtract(TimeUnitRange.DOY, 364), is(365L));
-    assertThat(unixDateExtract(TimeUnitRange.DOY, 365), is(1L));
-    assertThat(unixDateExtract(TimeUnitRange.DOY, 366), is(2L));
-    assertThat(unixDateExtract(TimeUnitRange.DOY, 365 + 365 + 366 - 1),
-        is(366L)); // 1972/12/31
-    assertThat(unixDateExtract(TimeUnitRange.DOY, 365 + 365 + 366),
-        is(1L)); // 1973/1/1
-
-    // The number of the week of the year that the day is in. By definition
-    // (ISO 8601), the first week of a year contains January 4 of that year.
-    // (The ISO-8601 week starts on Monday.) In other words, the first Thursday
-    // of a year is in week 1 of that year.
-    //
-    // Because of this, it is possible for early January dates to be part of
-    // the 52nd or 53rd week of the previous year. For example, 2005-01-01 is
-    // part of the 53rd week of year 2004, and 2006-01-01 is part of the 52nd
-    // week of year 2005.
-    assertThat(ymdToUnixDate(1970, 1, 1), is(0));
-    assertThat(unixDateExtract(TimeUnitRange.WEEK, ymdToUnixDate(2003, 1, 1)),
-        is(1L)); // wed
-    assertThat(unixDateExtract(TimeUnitRange.WEEK, ymdToUnixDate(2004, 1, 1)),
-        is(1L)); // thu
-    assertThat(unixDateExtract(TimeUnitRange.WEEK, ymdToUnixDate(2005, 1, 1)),
-        is(53L)); // sat
-    assertThat(unixDateExtract(TimeUnitRange.WEEK, ymdToUnixDate(2006, 1, 1)),
-        is(52L)); // sun
-    assertThat(unixDateExtract(TimeUnitRange.WEEK, ymdToUnixDate(1970, 1, 1)),
-        is(1L)); // thu
-
-    assertThat(unixDateExtract(TimeUnitRange.WEEK, -1), is(53L)); // wed
-    assertThat(unixDateExtract(TimeUnitRange.WEEK, 0), is(1L)); // thu
-    assertThat(unixDateExtract(TimeUnitRange.WEEK, 1), is(1L)); // fru
-    assertThat(unixDateExtract(TimeUnitRange.WEEK, 2), is(1L)); // sat
-    assertThat(unixDateExtract(TimeUnitRange.WEEK, 3), is(1L)); // sun
-    assertThat(unixDateExtract(TimeUnitRange.WEEK, 4), is(2L)); // mon
-    assertThat(unixDateExtract(TimeUnitRange.WEEK, 7), is(2L)); // thu
-    assertThat(unixDateExtract(TimeUnitRange.WEEK, 10), is(2L)); // sun
-    assertThat(unixDateExtract(TimeUnitRange.WEEK, 11), is(3L)); // mon
-    assertThat(unixDateExtract(TimeUnitRange.WEEK, 359), is(52L)); // sat
-    assertThat(unixDateExtract(TimeUnitRange.WEEK, 360), is(52L)); // sun
-    assertThat(unixDateExtract(TimeUnitRange.WEEK, 361), is(53L)); // mon
-    assertThat(unixDateExtract(TimeUnitRange.WEEK, 364), is(53L)); // thu
-    assertThat(unixDateExtract(TimeUnitRange.WEEK, 365), is(53L)); // fri
-    assertThat(unixDateExtract(TimeUnitRange.WEEK, 368), is(1L)); // mon
-
-    assertThat(unixDateExtract(TimeUnitRange.QUARTER, -1), is(4L));
-    assertThat(unixDateExtract(TimeUnitRange.QUARTER, 0), is(1L));
-    assertThat(unixDateExtract(TimeUnitRange.QUARTER, 365), is(1L));
-    assertThat(unixDateExtract(TimeUnitRange.QUARTER, 366), is(1L));
-
-    thereAndBack(1900, 1, 1);
-    thereAndBack(1900, 2, 28); // no leap day
-    thereAndBack(1900, 3, 1);
-    thereAndBack(1901, 1, 1);
-    thereAndBack(1901, 2, 28); // no leap day
-    thereAndBack(1901, 3, 1);
-    thereAndBack(2000, 1, 1);
-    thereAndBack(2000, 2, 28);
-    thereAndBack(2000, 2, 29); // leap day
-    thereAndBack(2000, 3, 1);
-    thereAndBack(1964, 1, 1);
-    thereAndBack(1964, 2, 28);
-    thereAndBack(1964, 2, 29); // leap day
-    thereAndBack(1964, 3, 1);
-    thereAndBack(1864, 1, 1);
-    thereAndBack(1864, 2, 28);
-    thereAndBack(1864, 2, 29); // leap day
-    thereAndBack(1864, 3, 1);
-    thereAndBack(1900, 1, 1);
-    thereAndBack(1900, 2, 28);
-    thereAndBack(1900, 3, 1);
-    thereAndBack(2004, 2, 28);
-    thereAndBack(2004, 2, 29); // leap day
-    thereAndBack(2004, 3, 1);
-    thereAndBack(2005, 2, 28); // no leap day
-    thereAndBack(2005, 3, 1);
-    thereAndBack(1601, 1, 1);
-    // Doesn't work much earlier than 1600 because of leap year differences.
-    // Before 1600, does the user expect Gregorian calendar?
-    if (false) {
-      thereAndBack(1581, 1, 1);
-      thereAndBack(1, 1, 1);
-    }
-
-    // Per PostgreSQL: The first century starts at 0001-01-01 00:00:00 AD,
-    // although they did not know it at the time. This definition applies to
-    // all Gregorian calendar countries. There is no century number 0, you go
-    // from -1 century to 1 century. If you disagree with this, please write
-    // your complaint to: Pope, Cathedral Saint-Peter of Roma, Vatican.
-
-    // The 21st century started on 2001/01/01
-    assertThat(
-        unixDateExtract(TimeUnitRange.CENTURY, ymdToUnixDate(2001, 1, 1)),
-        is(21L));
-    assertThat(
-        unixDateExtract(TimeUnitRange.CENTURY, ymdToUnixDate(2000, 12, 31)),
-        is(20L));
-    assertThat(
-        unixDateExtract(TimeUnitRange.CENTURY, ymdToUnixDate(1852, 6, 7)),
-        is(19L));
-    assertThat(
-        unixDateExtract(TimeUnitRange.CENTURY, ymdToUnixDate(1, 2, 1)),
-        is(1L));
-    // TODO: For a small time range around year 1, due to the Gregorian shift,
-    // we end up in the wrong century. Should be 1.
-    assertThat(
-        unixDateExtract(TimeUnitRange.CENTURY, ymdToUnixDate(1, 1, 1)),
-        is(0L));
-    assertThat(
-        unixDateExtract(TimeUnitRange.CENTURY, ymdToUnixDate(-2, 1, 1)),
-        is(-1L));
-
-    // The 3rd millennium started on 2001/01/01
-    assertThat(
-        unixDateExtract(TimeUnitRange.MILLENNIUM, ymdToUnixDate(2001, 1, 1)),
-        is(3L));
-    assertThat(
-        unixDateExtract(TimeUnitRange.MILLENNIUM, ymdToUnixDate(2000, 12, 31)),
-        is(2L));
-    assertThat(
-        unixDateExtract(TimeUnitRange.MILLENNIUM, ymdToUnixDate(1852, 6, 7)),
-        is(2L));
-    // TODO: For a small time range around year 1, due to the Gregorian shift,
-    // we end up in the wrong millennium. Should be 1.
-    assertThat(
-        unixDateExtract(TimeUnitRange.MILLENNIUM, ymdToUnixDate(1, 1, 1)),
-        is(0L));
-    assertThat(
-        unixDateExtract(TimeUnitRange.MILLENNIUM, ymdToUnixDate(1, 2, 1)),
-        is(1L));
-    assertThat(
-        unixDateExtract(TimeUnitRange.MILLENNIUM, ymdToUnixDate(-2, 1, 1)),
-        is(-1L));
-  }
-
-  private void thereAndBack(int year, int month, int day) {
-    final int unixDate = ymdToUnixDate(year, month, day);
-    assertThat(unixDateExtract(TimeUnitRange.YEAR, unixDate),
-        is((long) year));
-    assertThat(unixDateExtract(TimeUnitRange.MONTH, unixDate),
-        is((long) month));
-    assertThat(unixDateExtract(TimeUnitRange.DAY, unixDate),
-        is((long) day));
-    final long w = unixDateExtract(TimeUnitRange.WEEK, unixDate);
-    assertTrue(w >= 1 && w <= 53);
-    final long dow = unixDateExtract(TimeUnitRange.DOW, unixDate);
-    assertTrue(dow >= 1 && dow <= 7);
-    final long doy = unixDateExtract(TimeUnitRange.DOY, unixDate);
-    assertTrue(doy >= 1 && dow <= 366);
-    final long q = unixDateExtract(TimeUnitRange.QUARTER, unixDate);
-    assertTrue(q >= 1 && q <= 4);
-    final long c = unixDateExtract(TimeUnitRange.CENTURY, unixDate);
-    assertTrue(c == (year > 0 ? (year + 99) / 100 : (year - 99) / 100));
-    final long m = unixDateExtract(TimeUnitRange.MILLENNIUM, unixDate);
-    assertTrue(m == (year > 0 ? (year + 999) / 1000 : (year - 999) / 1000));
-  }
-
-  @Test public void testAddMonths() {
-    checkAddMonths(2016, 1, 1, 2016, 2, 1, 1);
-    checkAddMonths(2016, 1, 1, 2017, 1, 1, 12);
-    checkAddMonths(2016, 1, 1, 2017, 2, 1, 13);
-    checkAddMonths(2016, 1, 1, 2015, 1, 1, -12);
-    checkAddMonths(2016, 1, 1, 2018, 10, 1, 33);
-    checkAddMonths(2016, 1, 31, 2016, 5, 1, 3); // roll up
-    checkAddMonths(2016, 4, 30, 2016, 7, 30, 3); // roll up
-    checkAddMonths(2016, 1, 31, 2016, 3, 1, 1);
-    checkAddMonths(2016, 3, 31, 2016, 3, 1, -1);
-    checkAddMonths(2016, 3, 31, 2116, 3, 31, 1200);
-    checkAddMonths(2016, 2, 28, 2116, 2, 28, 1200);
-  }
-
-  private void checkAddMonths(int y0, int m0, int d0, int y1, int m1, int d1,
-      int months) {
-    final int date0 = ymdToUnixDate(y0, m0, d0);
-    final long date = addMonths(date0, months);
-    final int date1 = ymdToUnixDate(y1, m1, d1);
-    assertThat((int) date, is(date1));
-
-    assertThat(subtractMonths(date1, date0),
-        anyOf(is(months), is(months + 1)));
-    assertThat(subtractMonths(date1 + 1, date0),
-        anyOf(is(months), is(months + 1)));
-    assertThat(subtractMonths(date1, date0 + 1),
-        anyOf(is(months), is(months - 1)));
-    assertThat(subtractMonths(d2ts(date1, 1), d2ts(date0, 0)),
-        anyOf(is(months), is(months + 1)));
-    assertThat(subtractMonths(d2ts(date1, 0), d2ts(date0, 1)),
-        anyOf(is(months - 1), is(months), is(months + 1)));
-  }
-
-  /** Converts a date (days since epoch) and milliseconds (since midnight)
-   * into a timestamp (milliseconds since epoch). */
-  private long d2ts(int date, int millis) {
-    return date * DateTimeUtils.MILLIS_PER_DAY + millis;
-  }
-
-  @Test public void testUnixTimestamp() {
-    assertThat(unixTimestamp(1970, 1, 1, 0, 0, 0), is(0L));
-    final long day = 86400000L;
-    assertThat(unixTimestamp(1970, 1, 2, 0, 0, 0), is(day));
-    assertThat(unixTimestamp(1970, 1, 1, 23, 59, 59), is(86399000L));
-
-    // 1900 is not a leap year
-    final long y1900 = -2203977600000L;
-    assertThat(unixTimestamp(1900, 2, 28, 0, 0, 0), is(y1900));
-    assertThat(unixTimestamp(1900, 3, 1, 0, 0, 0), is(y1900 + day));
-
-    // 2000 is a leap year
-    final long y2k = 951696000000L;
-    assertThat(unixTimestamp(2000, 2, 28, 0, 0, 0), is(y2k));
-    assertThat(unixTimestamp(2000, 2, 29, 0, 0, 0), is(y2k + day));
-    assertThat(unixTimestamp(2000, 3, 1, 0, 0, 0), is(y2k + day + day));
-
-    // 2016 is a leap year
-    final long y2016 = 1456617600000L;
-    assertThat(unixTimestamp(2016, 2, 28, 0, 0, 0), is(y2016));
-    assertThat(unixTimestamp(2016, 2, 29, 0, 0, 0), is(y2016 + day));
-    assertThat(unixTimestamp(2016, 3, 1, 0, 0, 0), is(y2016 + day + day));
-  }
-}
-
-// End DateTimeUtilsTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/test/java/org/apache/calcite/avatica/util/NumberAccessorTest.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/test/java/org/apache/calcite/avatica/util/NumberAccessorTest.java b/avatica/core/src/test/java/org/apache/calcite/avatica/util/NumberAccessorTest.java
deleted file mode 100644
index f1b2ef1..0000000
--- a/avatica/core/src/test/java/org/apache/calcite/avatica/util/NumberAccessorTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.util;
-
-import org.apache.calcite.avatica.util.AbstractCursor.Getter;
-import org.apache.calcite.avatica.util.AbstractCursor.NumberAccessor;
-
-import org.junit.Test;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.sql.SQLException;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * Test logic for the NumberAccessor.
- */
-public class NumberAccessorTest {
-
-  @Test
-  public void testBigDecimalZeroScale() throws SQLException {
-    final BigDecimal orig = new BigDecimal(BigInteger.valueOf(137L), 1);
-    NumberAccessor accessor = new AbstractCursor.NumberAccessor(
-        new Getter() {
-          @Override public Object getObject() {
-            return orig;
-          }
-
-          @Override public boolean wasNull() {
-            return false;
-          }
-        },
-        0);
-
-    assertEquals(orig, accessor.getBigDecimal(0));
-  }
-
-}
-
-// End NumberAccessorTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/test/java/org/apache/calcite/avatica/util/UnsynchronizedBufferTest.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/test/java/org/apache/calcite/avatica/util/UnsynchronizedBufferTest.java b/avatica/core/src/test/java/org/apache/calcite/avatica/util/UnsynchronizedBufferTest.java
deleted file mode 100644
index a448d3e..0000000
--- a/avatica/core/src/test/java/org/apache/calcite/avatica/util/UnsynchronizedBufferTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.util;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * Tests for the UnsynchronizedBuffer.
- */
-public class UnsynchronizedBufferTest {
-
-  @Test public void testArrayResizing() {
-    int size = 64;
-    int expected = 128;
-    for (int i = 0; i < 10; i++) {
-      // We keep being one byte short to contain this message
-      int next = UnsynchronizedBuffer.nextArraySize(size + 1);
-      assertEquals(expected, next);
-      size = next;
-      expected *= 2;
-    }
-  }
-}
-
-// End UnsynchronizedBufferTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/metrics-dropwizardmetrics3/pom.xml
----------------------------------------------------------------------
diff --git a/avatica/metrics-dropwizardmetrics3/pom.xml b/avatica/metrics-dropwizardmetrics3/pom.xml
deleted file mode 100644
index bd60ffe..0000000
--- a/avatica/metrics-dropwizardmetrics3/pom.xml
+++ /dev/null
@@ -1,117 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <parent>
-    <groupId>org.apache.calcite.avatica</groupId>
-    <artifactId>avatica-parent</artifactId>
-    <version>1.10.0-SNAPSHOT</version>
-  </parent>
-
-  <artifactId>avatica-metrics-dropwizardmetrics3</artifactId>
-  <packaging>jar</packaging>
-  <name>Apache Calcite Avatica Dropwizard Metrics 3</name>
-  <description>An implementation of Avatica Metrics using Dropwizard Metrics.</description>
-
-  <properties>
-    <top.dir>${project.basedir}/..</top.dir>
-  </properties>
-
-  <dependencies>
-    <dependency>
-      <groupId>org.apache.calcite.avatica</groupId>
-      <artifactId>avatica-metrics</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>io.dropwizard.metrics</groupId>
-      <artifactId>metrics-core</artifactId>
-      <!-- Avoid specifying version in dependencyManagement in support of other avatica-metrics impls -->
-      <version>${dropwizard-metrics3.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.mockito</groupId>
-      <artifactId>mockito-core</artifactId>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
-
-  <build>
-    <pluginManagement>
-      <plugins>
-        <plugin>
-          <groupId>org.eclipse.m2e</groupId>
-          <artifactId>lifecycle-mapping</artifactId>
-          <version>1.0.0</version>
-          <configuration>
-            <lifecycleMappingMetadata>
-              <pluginExecutions>
-                <pluginExecution>
-                  <pluginExecutionFilter>
-                    <groupId>org.apache.maven.plugins</groupId>
-                    <artifactId>maven-checkstyle-plugin</artifactId>
-                    <versionRange>[2.12.1,)</versionRange>
-                    <goals>
-                      <goal>check</goal>
-                    </goals>
-                  </pluginExecutionFilter>
-                  <action>
-                    <ignore />
-                  </action>
-                </pluginExecution>
-              </pluginExecutions>
-            </lifecycleMappingMetadata>
-          </configuration>
-        </plugin>
-      </plugins>
-    </pluginManagement>
-    <plugins>
-      <!-- Parent module has the same plugin and does the work of
-           generating -sources.jar for each project. But without the
-           plugin declared here, IDEs don't know the sources are
-           available. -->
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-source-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>attach-sources</id>
-            <phase>verify</phase>
-            <goals>
-              <goal>jar-no-fork</goal>
-              <goal>test-jar-no-fork</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.rat</groupId>
-        <artifactId>apache-rat-plugin</artifactId>
-        <configuration>
-          <excludes>
-            <exclude>src/main/resources/META-INF/services/org.apache.calcite.avatica.metrics.MetricsSystemFactory</exclude>
-          </excludes>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-</project>

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardCounter.java
----------------------------------------------------------------------
diff --git a/avatica/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardCounter.java b/avatica/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardCounter.java
deleted file mode 100644
index 4204ebf..0000000
--- a/avatica/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardCounter.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.metrics.dropwizard3;
-
-import com.codahale.metrics.Counter;
-
-import java.util.Objects;
-
-/**
- * Dropwizard Metrics implementation of {@link org.apache.calcite.avatica.metrics.Counter}.
- */
-public class DropwizardCounter implements org.apache.calcite.avatica.metrics.Counter {
-
-  private final Counter counter;
-
-  public DropwizardCounter(Counter counter) {
-    this.counter = Objects.requireNonNull(counter);
-  }
-
-  @Override public void increment() {
-    this.counter.inc();
-  }
-
-  @Override public void increment(long n) {
-    this.counter.inc(n);
-  }
-
-  @Override public void decrement() {
-    this.counter.dec();
-  }
-
-  @Override public void decrement(long n) {
-    this.counter.dec(n);
-  }
-}
-
-// End DropwizardCounter.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardGauge.java
----------------------------------------------------------------------
diff --git a/avatica/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardGauge.java b/avatica/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardGauge.java
deleted file mode 100644
index 5f4b776..0000000
--- a/avatica/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardGauge.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.metrics.dropwizard3;
-
-import com.codahale.metrics.Gauge;
-
-/**
- * Dropwizard Metrics implementation of {@link org.apache.calcite.avatica.metrics.Gauge}.
- *
- * @param <T> The value the gauge returns.
- */
-public class DropwizardGauge<T> implements Gauge<T> {
-
-  private final org.apache.calcite.avatica.metrics.Gauge<T> gauge;
-
-  public DropwizardGauge(org.apache.calcite.avatica.metrics.Gauge<T> gauge) {
-    this.gauge = gauge;
-  }
-
-  @Override public T getValue() {
-    return gauge.getValue();
-  }
-}
-
-// End DropwizardGauge.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardHistogram.java
----------------------------------------------------------------------
diff --git a/avatica/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardHistogram.java b/avatica/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardHistogram.java
deleted file mode 100644
index 266f130..0000000
--- a/avatica/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardHistogram.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.metrics.dropwizard3;
-
-import com.codahale.metrics.Histogram;
-
-import java.util.Objects;
-
-/**
- * Dropwizard metrics implementation of {@link org.apache.calcite.avatica.metrics.Histogram}.
- */
-public class DropwizardHistogram implements org.apache.calcite.avatica.metrics.Histogram {
-
-  private final Histogram histogram;
-
-  public DropwizardHistogram(Histogram histogram) {
-    this.histogram = Objects.requireNonNull(histogram);
-  }
-
-  @Override public void update(int value) {
-    histogram.update(value);
-  }
-
-  @Override public void update(long value) {
-    histogram.update(value);
-  }
-}
-
-// End DropwizardHistogram.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMeter.java
----------------------------------------------------------------------
diff --git a/avatica/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMeter.java b/avatica/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMeter.java
deleted file mode 100644
index ab8fafc..0000000
--- a/avatica/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMeter.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.metrics.dropwizard3;
-
-import com.codahale.metrics.Meter;
-
-import java.util.Objects;
-
-/**
- * Dropwizard metrics implementation of {@link org.apache.calcite.avatica.metrics.Meter}.
- */
-public class DropwizardMeter implements org.apache.calcite.avatica.metrics.Meter {
-
-  private final Meter meter;
-
-  public DropwizardMeter(Meter meter) {
-    this.meter = Objects.requireNonNull(meter);
-  }
-
-  @Override public void mark() {
-    this.meter.mark();
-  }
-
-  @Override public void mark(long count) {
-    this.meter.mark(count);
-  }
-}
-
-// End DropwizardMeter.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMetricsSystem.java
----------------------------------------------------------------------
diff --git a/avatica/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMetricsSystem.java b/avatica/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMetricsSystem.java
deleted file mode 100644
index 6aa71b9..0000000
--- a/avatica/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMetricsSystem.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.metrics.dropwizard3;
-
-import org.apache.calcite.avatica.metrics.Counter;
-import org.apache.calcite.avatica.metrics.Gauge;
-import org.apache.calcite.avatica.metrics.Histogram;
-import org.apache.calcite.avatica.metrics.Meter;
-import org.apache.calcite.avatica.metrics.MetricsSystem;
-import org.apache.calcite.avatica.metrics.Timer;
-
-import com.codahale.metrics.MetricRegistry;
-
-import java.util.Objects;
-
-/**
- * Dropwizard Metrics implementation of {@link MetricsSystem}.
- */
-public class DropwizardMetricsSystem implements MetricsSystem {
-
-  private final MetricRegistry registry;
-
-  public DropwizardMetricsSystem(MetricRegistry registry) {
-    this.registry = Objects.requireNonNull(registry);
-  }
-
-  @Override public Timer getTimer(String name) {
-    return new DropwizardTimer(registry.timer(name));
-  }
-
-  @Override public Histogram getHistogram(String name) {
-    return new DropwizardHistogram(registry.histogram(name));
-  }
-
-  @Override public Meter getMeter(String name) {
-    return new DropwizardMeter(registry.meter(name));
-  }
-
-  @Override public Counter getCounter(String name) {
-    return new DropwizardCounter(registry.counter(name));
-  }
-
-  @Override public <T> void register(String name, Gauge<T> gauge) {
-    registry.register(name, new DropwizardGauge<T>(gauge));
-  }
-}
-
-// End DropwizardMetricsSystem.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMetricsSystemConfiguration.java
----------------------------------------------------------------------
diff --git a/avatica/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMetricsSystemConfiguration.java b/avatica/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMetricsSystemConfiguration.java
deleted file mode 100644
index f4c9234..0000000
--- a/avatica/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMetricsSystemConfiguration.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.metrics.dropwizard3;
-
-import org.apache.calcite.avatica.metrics.MetricsSystemConfiguration;
-
-import com.codahale.metrics.MetricRegistry;
-
-import java.util.Objects;
-
-/**
- * A container which provides a {@link MetricRegistry} to a {@link DropwizardMetricsSystem}.
- */
-public class DropwizardMetricsSystemConfiguration implements
-    MetricsSystemConfiguration<MetricRegistry> {
-
-  private final MetricRegistry registry;
-
-  public DropwizardMetricsSystemConfiguration(MetricRegistry registry) {
-    this.registry = Objects.requireNonNull(registry);
-  }
-
-  @Override public MetricRegistry get() {
-    return registry;
-  }
-}
-
-// End DropwizardMetricsSystemConfiguration.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMetricsSystemFactory.java
----------------------------------------------------------------------
diff --git a/avatica/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMetricsSystemFactory.java b/avatica/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMetricsSystemFactory.java
deleted file mode 100644
index 1480db6..0000000
--- a/avatica/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMetricsSystemFactory.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.metrics.dropwizard3;
-
-import org.apache.calcite.avatica.metrics.MetricsSystemConfiguration;
-import org.apache.calcite.avatica.metrics.MetricsSystemFactory;
-
-/**
- * A {@link MetricsSystemFactory} for {@link DropwizardMetricsSystem}.
- */
-public class DropwizardMetricsSystemFactory implements MetricsSystemFactory {
-
-  @Override public DropwizardMetricsSystem create(MetricsSystemConfiguration<?> config) {
-    // Verify we got configuration this factory can use
-    if (config instanceof DropwizardMetricsSystemConfiguration) {
-      DropwizardMetricsSystemConfiguration typedConfig =
-          (DropwizardMetricsSystemConfiguration) config;
-
-      return new DropwizardMetricsSystem(typedConfig.get());
-    }
-
-    throw new IllegalStateException("Expected instance of "
-        + DropwizardMetricsSystemConfiguration.class.getName() + " but got "
-        + (null == config ? "null" : config.getClass().getName()));
-  }
-}
-
-// End DropwizardMetricsSystemFactory.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardTimer.java
----------------------------------------------------------------------
diff --git a/avatica/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardTimer.java b/avatica/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardTimer.java
deleted file mode 100644
index 850f9a6..0000000
--- a/avatica/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardTimer.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.metrics.dropwizard3;
-
-import com.codahale.metrics.Timer;
-
-import java.util.Objects;
-
-/**
- * Dropwizard Metrics implementation of {@link org.apache.calcite.avatica.metrics.Timer}.
- */
-public class DropwizardTimer implements org.apache.calcite.avatica.metrics.Timer {
-
-  private final Timer timer;
-
-  public DropwizardTimer(Timer timer) {
-    this.timer = Objects.requireNonNull(timer);
-  }
-
-  @Override public DropwizardContext start() {
-    return new DropwizardContext(timer.time());
-  }
-
-  /**
-   * Dropwizard Metrics implementation of {@link org.apache.calcite.avatica.metrics.Timer.Context}
-   */
-  public class DropwizardContext implements org.apache.calcite.avatica.metrics.Timer.Context {
-    private final com.codahale.metrics.Timer.Context context;
-
-    public DropwizardContext(com.codahale.metrics.Timer.Context context) {
-      this.context = Objects.requireNonNull(context);
-    }
-
-    @Override public void close() {
-      this.context.stop();
-    }
-  }
-}
-
-// End DropwizardTimer.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/package-info.java
----------------------------------------------------------------------
diff --git a/avatica/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/package-info.java b/avatica/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/package-info.java
deleted file mode 100644
index f88df93..0000000
--- a/avatica/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/package-info.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * Dropwizard-Metrics (v3) implementation of the Avatica Metrics framework.
- */
-@PackageMarker
-package org.apache.calcite.avatica.metrics.dropwizard3;
-
-import org.apache.calcite.avatica.metrics.PackageMarker;
-
-// End package-info.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/metrics-dropwizardmetrics3/src/main/resources/META-INF/services/org.apache.calcite.avatica.metrics.MetricsSystemFactory
----------------------------------------------------------------------
diff --git a/avatica/metrics-dropwizardmetrics3/src/main/resources/META-INF/services/org.apache.calcite.avatica.metrics.MetricsSystemFactory b/avatica/metrics-dropwizardmetrics3/src/main/resources/META-INF/services/org.apache.calcite.avatica.metrics.MetricsSystemFactory
deleted file mode 100644
index 25b64a8..0000000
--- a/avatica/metrics-dropwizardmetrics3/src/main/resources/META-INF/services/org.apache.calcite.avatica.metrics.MetricsSystemFactory
+++ /dev/null
@@ -1,2 +0,0 @@
-org.apache.calcite.avatica.metrics.dropwizard3.DropwizardMetricsSystemFactory
-

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardCounterTest.java
----------------------------------------------------------------------
diff --git a/avatica/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardCounterTest.java b/avatica/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardCounterTest.java
deleted file mode 100644
index b037196..0000000
--- a/avatica/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardCounterTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.metrics.dropwizard3;
-
-import com.codahale.metrics.Counter;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * Test class for {@link DropwizardCounter}.
- */
-public class DropwizardCounterTest {
-
-  private Counter counter;
-
-  @Before public void setup() {
-    this.counter = new Counter();
-  }
-
-  @Test public void testCounting() {
-    DropwizardCounter dwCounter = new DropwizardCounter(counter);
-
-    dwCounter.increment();
-    assertEquals(1L, counter.getCount());
-    dwCounter.increment();
-    assertEquals(2L, counter.getCount());
-    dwCounter.increment(2L);
-    assertEquals(4L, counter.getCount());
-    dwCounter.increment(-1L);
-    assertEquals(3L, counter.getCount());
-
-    dwCounter.decrement();
-    assertEquals(2L, counter.getCount());
-    dwCounter.decrement();
-    assertEquals(1L, counter.getCount());
-    dwCounter.decrement(4L);
-    assertEquals(-3L, counter.getCount());
-    dwCounter.decrement(-3L);
-    assertEquals(0L, counter.getCount());
-  }
-
-}
-
-// End DropwizardCounterTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardGaugeTest.java
----------------------------------------------------------------------
diff --git a/avatica/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardGaugeTest.java b/avatica/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardGaugeTest.java
deleted file mode 100644
index ed78a58..0000000
--- a/avatica/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardGaugeTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.metrics.dropwizard3;
-
-import org.apache.calcite.avatica.metrics.Gauge;
-
-import org.junit.Test;
-
-import java.util.concurrent.atomic.AtomicLong;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * Test class for {@link DropwizardGauge}.
- */
-public class DropwizardGaugeTest {
-
-  @Test public void test() {
-    SimpleGauge gauge = new SimpleGauge();
-    DropwizardGauge<Long> dwGauge = new DropwizardGauge<>(gauge);
-
-    assertEquals(gauge.getValue(), dwGauge.getValue());
-
-    gauge.setValue(1000L);
-
-    assertEquals(gauge.getValue(), dwGauge.getValue());
-  }
-
-  /**
-   * Gauge implementation with a setter.
-   */
-  private static class SimpleGauge implements Gauge<Long> {
-
-    private final AtomicLong value = new AtomicLong(0L);
-
-    @Override public Long getValue() {
-      return this.value.get();
-    }
-
-    public void setValue(long value) {
-      this.value.set(value);
-    }
-  }
-}
-
-// End DropwizardGaugeTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardHistogramTest.java
----------------------------------------------------------------------
diff --git a/avatica/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardHistogramTest.java b/avatica/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardHistogramTest.java
deleted file mode 100644
index 25ec5c0..0000000
--- a/avatica/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardHistogramTest.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.metrics.dropwizard3;
-
-import com.codahale.metrics.Histogram;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-/**
- * Test class for {@link DropwizardHistogram}.
- */
-public class DropwizardHistogramTest {
-
-  private Histogram histogram;
-
-  @Before public void setup() {
-    this.histogram = Mockito.mock(Histogram.class);
-  }
-
-  @Test public void test() {
-    DropwizardHistogram dwHistogram = new DropwizardHistogram(histogram);
-
-    dwHistogram.update(10);
-
-    dwHistogram.update(100L);
-
-    Mockito.verify(histogram).update(10);
-    Mockito.verify(histogram).update(100L);
-  }
-
-}
-
-// End DropwizardHistogramTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMeterTest.java
----------------------------------------------------------------------
diff --git a/avatica/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMeterTest.java b/avatica/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMeterTest.java
deleted file mode 100644
index c76c7e0..0000000
--- a/avatica/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMeterTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.metrics.dropwizard3;
-
-import com.codahale.metrics.Meter;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-/**
- * Test class for {@link DropwizardMeter}.
- */
-public class DropwizardMeterTest {
-
-  private Meter meter;
-
-  @Before public void setup() {
-    this.meter = Mockito.mock(Meter.class);
-  }
-
-  @Test public void test() {
-    DropwizardMeter dwMeter = new DropwizardMeter(this.meter);
-
-    dwMeter.mark();
-    dwMeter.mark(10L);
-    dwMeter.mark();
-    dwMeter.mark();
-
-    Mockito.verify(meter, Mockito.times(3)).mark();
-    Mockito.verify(meter).mark(10L);
-  }
-
-}
-
-// End DropwizardMeterTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMetricsSystemFactoryTest.java
----------------------------------------------------------------------
diff --git a/avatica/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMetricsSystemFactoryTest.java b/avatica/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMetricsSystemFactoryTest.java
deleted file mode 100644
index 332c6e0..0000000
--- a/avatica/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMetricsSystemFactoryTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.metrics.dropwizard3;
-
-import org.apache.calcite.avatica.metrics.noop.NoopMetricsSystemConfiguration;
-
-import com.codahale.metrics.MetricRegistry;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.assertNotNull;
-
-/**
- * Test class for {@link DropwizardMetricsSystemFactory}.
- */
-public class DropwizardMetricsSystemFactoryTest {
-
-  private DropwizardMetricsSystemFactory factory;
-
-  @Before public void setup() {
-    factory = new DropwizardMetricsSystemFactory();
-  }
-
-  @Test(expected = IllegalStateException.class) public void testNullConfigurationFails() {
-    factory.create(null);
-  }
-
-  @Test(expected = IllegalStateException.class) public void testUnhandledConfigurationType() {
-    factory.create(NoopMetricsSystemConfiguration.getInstance());
-  }
-
-  @Test public void testHandledConfigurationType() {
-    DropwizardMetricsSystem metrics =
-        factory.create(new DropwizardMetricsSystemConfiguration(new MetricRegistry()));
-    assertNotNull("Expected DropwizardMetricsSystem to be non-null", metrics);
-  }
-}
-
-// End DropwizardMetricsSystemFactoryTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMetricsSystemTest.java
----------------------------------------------------------------------
diff --git a/avatica/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMetricsSystemTest.java b/avatica/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMetricsSystemTest.java
deleted file mode 100644
index 7eeec3b..0000000
--- a/avatica/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMetricsSystemTest.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.metrics.dropwizard3;
-
-import org.apache.calcite.avatica.metrics.Counter;
-import org.apache.calcite.avatica.metrics.Gauge;
-import org.apache.calcite.avatica.metrics.Histogram;
-import org.apache.calcite.avatica.metrics.Meter;
-import org.apache.calcite.avatica.metrics.Timer;
-import org.apache.calcite.avatica.metrics.Timer.Context;
-
-import com.codahale.metrics.MetricRegistry;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.mockito.Mockito.any;
-import static org.mockito.Mockito.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-/**
- * Tests for {@link DropwizardMetricsSystem}.
- */
-public class DropwizardMetricsSystemTest {
-
-  private MetricRegistry mockRegistry;
-  private DropwizardMetricsSystem metrics;
-
-  @Before public void setup() {
-    mockRegistry = mock(MetricRegistry.class);
-    metrics = new DropwizardMetricsSystem(mockRegistry);
-  }
-
-  @Test public void testGauge() {
-    final long gaugeValue = 42L;
-    final String name = "gauge";
-    metrics.register(name, new Gauge<Long>() {
-      @Override public Long getValue() {
-        return gaugeValue;
-      }
-    });
-
-    verify(mockRegistry, times(1)).register(eq(name), any(com.codahale.metrics.Gauge.class));
-  }
-
-  @Test public void testMeter() {
-    final String name = "meter";
-    final com.codahale.metrics.Meter mockMeter = mock(com.codahale.metrics.Meter.class);
-
-    when(mockRegistry.meter(name)).thenReturn(mockMeter);
-
-    Meter meter = metrics.getMeter(name);
-
-    final long count = 5;
-    meter.mark(count);
-
-    verify(mockMeter, times(1)).mark(count);
-
-    meter.mark();
-
-    verify(mockMeter, times(1)).mark();
-  }
-
-  @Test public void testHistogram() {
-    final String name = "histogram";
-    final com.codahale.metrics.Histogram mockHistogram = mock(com.codahale.metrics.Histogram.class);
-
-    when(mockRegistry.histogram(name)).thenReturn(mockHistogram);
-
-    Histogram histogram = metrics.getHistogram(name);
-
-    long[] long_values = new long[] {1L, 5L, 15L, 30L, 60L};
-    for (long value : long_values) {
-      histogram.update(value);
-    }
-
-    for (long value : long_values) {
-      verify(mockHistogram).update(value);
-    }
-
-    int[] int_values = new int[] {2, 6, 16, 31, 61};
-    for (int value : int_values) {
-      histogram.update(value);
-    }
-
-    for (int value : int_values) {
-      verify(mockHistogram).update(value);
-    }
-  }
-
-  @Test public void testCounter() {
-    final String name = "counter";
-    final com.codahale.metrics.Counter mockCounter = mock(com.codahale.metrics.Counter.class);
-
-    when(mockRegistry.counter(name)).thenReturn(mockCounter);
-
-    Counter counter = metrics.getCounter(name);
-
-    long[] updates = new long[] {1L, 5L, -2L, 4L, -8L, 0};
-    for (long update : updates) {
-      if (update < 0) {
-        counter.decrement(Math.abs(update));
-      } else {
-        counter.increment(update);
-      }
-    }
-
-    for (long update : updates) {
-      if (update < 0) {
-        verify(mockCounter).dec(Math.abs(update));
-      } else {
-        verify(mockCounter).inc(update);
-      }
-    }
-
-    int numSingleUpdates = 3;
-    for (int i = 0; i < numSingleUpdates; i++) {
-      counter.increment();
-      counter.decrement();
-    }
-
-    verify(mockCounter, times(numSingleUpdates)).inc();
-    verify(mockCounter, times(numSingleUpdates)).dec();
-  }
-
-  @Test public void testTimer() {
-    final String name = "timer";
-    final com.codahale.metrics.Timer mockTimer = mock(com.codahale.metrics.Timer.class);
-    final com.codahale.metrics.Timer.Context mockContext =
-        mock(com.codahale.metrics.Timer.Context.class);
-
-    when(mockRegistry.timer(name)).thenReturn(mockTimer);
-    when(mockTimer.time()).thenReturn(mockContext);
-
-    Timer timer = metrics.getTimer(name);
-    Context context = timer.start();
-    context.close();
-
-    verify(mockTimer).time();
-    verify(mockContext).stop();
-  }
-}
-
-// End DropwizardMetricsSystemTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardTimerTest.java
----------------------------------------------------------------------
diff --git a/avatica/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardTimerTest.java b/avatica/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardTimerTest.java
deleted file mode 100644
index 536d935..0000000
--- a/avatica/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardTimerTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.metrics.dropwizard3;
-
-import org.apache.calcite.avatica.metrics.dropwizard3.DropwizardTimer.DropwizardContext;
-
-import com.codahale.metrics.Timer;
-import com.codahale.metrics.Timer.Context;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-/**
- * Test class for {@link DropwizardTimer}
- */
-public class DropwizardTimerTest {
-
-  private Timer timer;
-  private Context context;
-
-  @Before public void setup() {
-    this.timer = Mockito.mock(Timer.class);
-    this.context = Mockito.mock(Context.class);
-  }
-
-  @Test public void test() {
-    DropwizardTimer dwTimer = new DropwizardTimer(timer);
-
-    Mockito.when(timer.time()).thenReturn(context);
-
-    DropwizardContext dwContext = dwTimer.start();
-
-    dwContext.close();
-
-    Mockito.verify(timer).time();
-    Mockito.verify(context).stop();
-  }
-
-}
-
-// End DropwizardTimerTest.java


[13/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/pom.xml
----------------------------------------------------------------------
diff --git a/core/pom.xml b/core/pom.xml
index c5d6c36..7ed2816 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -18,46 +18,26 @@ limitations under the License.
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <parent>
-    <groupId>org.apache.calcite</groupId>
-    <artifactId>calcite</artifactId>
-    <version>1.13.0-SNAPSHOT</version>
+    <groupId>org.apache.calcite.avatica</groupId>
+    <artifactId>avatica-parent</artifactId>
+    <version>1.10.0-SNAPSHOT</version>
   </parent>
 
-  <artifactId>calcite-core</artifactId>
+  <artifactId>avatica-core</artifactId>
   <packaging>jar</packaging>
-  <version>1.13.0-SNAPSHOT</version>
-  <name>Calcite Core</name>
-  <description>Core Calcite APIs and engine.</description>
+  <name>Apache Calcite Avatica</name>
+  <description>JDBC driver framework.</description>
 
   <properties>
     <top.dir>${project.basedir}/..</top.dir>
-    <build.timestamp>${maven.build.timestamp}</build.timestamp>
   </properties>
 
   <dependencies>
-    <!-- Sorted by groupId, artifactId; calcite dependencies first. Put versions
-         in dependencyManagement in the root POM, not here. -->
+    <!-- Make sure that there are no dependencies on other calcite modules,
+         or on libraries other than Jackson. -->
     <dependency>
       <groupId>org.apache.calcite.avatica</groupId>
-      <artifactId>avatica-core</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.calcite</groupId>
-      <artifactId>calcite-linq4j</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.calcite.avatica</groupId>
-      <artifactId>avatica-server</artifactId>
-      <scope>test</scope>
-    </dependency>
-
-    <dependency>
-      <groupId>commons-dbcp</groupId>
-      <artifactId>commons-dbcp</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.commons</groupId>
-      <artifactId>commons-lang3</artifactId>
+      <artifactId>avatica-metrics</artifactId>
     </dependency>
     <dependency>
       <groupId>com.fasterxml.jackson.core</groupId>
@@ -72,68 +52,24 @@ limitations under the License.
       <artifactId>jackson-databind</artifactId>
     </dependency>
     <dependency>
-      <groupId>com.google.code.findbugs</groupId>
-      <artifactId>jsr305</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>com.google.guava</groupId>
-      <artifactId>guava</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>com.h2database</groupId>
-      <artifactId>h2</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>mysql</groupId>
-      <artifactId>mysql-connector-java</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>net.hydromatic</groupId>
-      <artifactId>aggdesigner-algorithm</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>net.hydromatic</groupId>
-      <artifactId>foodmart-data-hsqldb</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>net.hydromatic</groupId>
-      <artifactId>foodmart-queries</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>net.hydromatic</groupId>
-      <artifactId>quidem</artifactId>
-      <scope>test</scope>
+      <groupId>com.google.protobuf</groupId>
+      <artifactId>protobuf-java</artifactId>
     </dependency>
     <dependency>
-      <groupId>net.hydromatic</groupId>
-      <artifactId>scott-data-hsqldb</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.codehaus.janino</groupId>
-      <artifactId>janino</artifactId>
+      <groupId>org.apache.httpcomponents</groupId>
+      <artifactId>httpclient</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.codehaus.janino</groupId>
-      <artifactId>commons-compiler</artifactId>
+      <groupId>org.apache.httpcomponents</groupId>
+      <artifactId>httpcore</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.hsqldb</groupId>
-      <artifactId>hsqldb</artifactId>
-      <scope>test</scope>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.incava</groupId>
-      <artifactId>java-diff</artifactId>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>
@@ -142,99 +78,105 @@ limitations under the License.
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>org.postgresql</groupId>
-      <artifactId>postgresql</artifactId>
+      <groupId>org.mockito</groupId>
+      <artifactId>mockito-core</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-api</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
       <artifactId>slf4j-log4j12</artifactId>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>sqlline</groupId>
-      <artifactId>sqlline</artifactId>
-      <scope>test</scope>
-    </dependency>
   </dependencies>
 
   <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.eclipse.m2e</groupId>
+          <artifactId>lifecycle-mapping</artifactId>
+          <version>1.0.0</version>
+          <configuration>
+            <lifecycleMappingMetadata>
+              <pluginExecutions>
+                <pluginExecution>
+                  <pluginExecutionFilter>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-checkstyle-plugin</artifactId>
+                    <versionRange>[2.12.1,)</versionRange>
+                    <goals>
+                      <goal>check</goal>
+                    </goals>
+                  </pluginExecutionFilter>
+                  <action>
+                    <ignore />
+                  </action>
+                </pluginExecution>
+              </pluginExecutions>
+            </lifecycleMappingMetadata>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
     <plugins>
       <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-compiler-plugin</artifactId>
-        <configuration>
-          <source>1.7</source>
-          <target>1.7</target>
-          <excludes>
-            <exclude>org/apache/calcite/sql/parser/parserextensiontesting/*.java</exclude>
-          </excludes>
-          <generatedTestSourcesDirectory>${project.build.directory}/generated-test-sources/javacc</generatedTestSourcesDirectory>
-        </configuration>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-surefire-plugin</artifactId>
-        <configuration>
-          <includes>
-            <include>org/apache/calcite/test/CalciteSuite.java</include>
-          </includes>
-        </configuration>
-      </plugin>
-      <plugin>
         <groupId>org.codehaus.mojo</groupId>
-        <artifactId>javacc-maven-plugin</artifactId>
+        <artifactId>build-helper-maven-plugin</artifactId>
         <executions>
           <execution>
-            <id>javacc</id>
+            <id>add-filtered-java-source</id>
             <goals>
-              <goal>javacc</goal>
+              <goal>add-source</goal>
             </goals>
+            <phase>generate-sources</phase>
             <configuration>
-              <sourceDirectory>${project.build.directory}/generated-sources/fmpp</sourceDirectory>
-              <includes>
-                <include>**/Parser.jj</include>
-              </includes>
-              <lookAhead>2</lookAhead>
-              <isStatic>false</isStatic>
+              <sources>
+                <source>${project.build.directory}/filtered-java-src</source>
+              </sources>
             </configuration>
           </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <artifactId>maven-dependency-plugin</artifactId>
+        <version>${maven-dependency-plugin.version}</version>
+        <executions>
           <execution>
-            <id>javacc-test</id>
-            <phase>generate-test-sources</phase>
+            <id>analyze</id>
             <goals>
-              <goal>javacc</goal>
+              <goal>analyze-only</goal>
             </goals>
             <configuration>
-              <sourceDirectory>${project.build.directory}/generated-test-sources/fmpp</sourceDirectory>
-              <outputDirectory>${project.build.directory}/generated-test-sources/javacc</outputDirectory>
-              <includes>
-                <include>**/Parser.jj</include>
-              </includes>
-              <lookAhead>2</lookAhead>
-              <isStatic>false</isStatic>
+              <failOnWarning>true</failOnWarning>
+              <!-- ignore "unused but declared" warnings -->
+              <ignoredUnusedDeclaredDependencies>
+                <ignoredUnusedDeclaredDependency>org.slf4j:slf4j-log4j12</ignoredUnusedDeclaredDependency>
+              </ignoredUnusedDeclaredDependencies>
             </configuration>
           </execution>
         </executions>
       </plugin>
+      <!-- Parent module has the same plugin and does the work of
+           generating -sources.jar for each project. But without the
+           plugin declared here, IDEs don't know the sources are
+           available. -->
       <plugin>
-        <groupId>net.hydromatic</groupId>
-        <artifactId>hydromatic-resource-maven-plugin</artifactId>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-source-plugin</artifactId>
         <executions>
           <execution>
+            <id>attach-sources</id>
+            <phase>verify</phase>
             <goals>
-              <goal>generate-sources</goal>
+              <goal>jar-no-fork</goal>
+              <goal>test-jar-no-fork</goal>
             </goals>
-            <configuration>
-              <packageName>org.apache.calcite.runtime</packageName>
-            </configuration>
           </execution>
         </executions>
       </plugin>
+
+      <!-- Produce a tests jar so that avatica-server/pom.xml can reference for suite.
+           TODO: remove after moving over to annotation-based TestSuite definitions. -->
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-jar-plugin</artifactId>
@@ -246,257 +188,50 @@ limitations under the License.
           </execution>
         </executions>
       </plugin>
-
-      <!-- Parent module has the same plugin and does the work of
-           generating -sources.jar for each project. But without the
-           plugin declared here, IDEs don't know the sources are
-           available. -->
       <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-source-plugin</artifactId>
+        <artifactId>maven-resources-plugin</artifactId>
         <executions>
           <execution>
-            <id>attach-sources</id>
-            <phase>verify</phase>
+            <id>prepare-filtered-java-source</id>
             <goals>
-              <goal>jar-no-fork</goal>
-              <goal>test-jar-no-fork</goal>
+              <goal>copy-resources</goal>
             </goals>
+            <phase>generate-sources</phase>
+            <configuration>
+              <outputDirectory>${project.build.directory}/filtered-java-src</outputDirectory>
+              <resources>
+                <resource>
+                  <directory>src/main/java-filtered</directory>
+                  <filtering>true</filtering>
+                </resource>
+              </resources>
+            </configuration>
           </execution>
         </executions>
       </plugin>
       <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-dependency-plugin</artifactId>
-        <version>${maven-dependency-plugin.version}</version>
-        <!-- configurations do not cascade, so all of the definition from
-             ../pom.xml:build:plugin-management:plugins:plugin must be repeated in child poms -->
+        <groupId>org.xolstice.maven.plugins</groupId>
+        <artifactId>protobuf-maven-plugin</artifactId>
         <executions>
           <execution>
-            <id>analyze</id>
+            <id>compile-protoc</id>
+            <phase>generate-sources</phase>
             <goals>
-              <goal>analyze-only</goal>
+              <goal>compile</goal>
             </goals>
-            <configuration>
-              <failOnWarning>true</failOnWarning>
-              <!-- ignore "unused but declared" warnings -->
-              <ignoredUnusedDeclaredDependencies>
-                <ignoredUnusedDeclaredDependency>com.h2database:h2</ignoredUnusedDeclaredDependency>
-                <ignoredUnusedDeclaredDependency>com.oracle:ojdbc6</ignoredUnusedDeclaredDependency>
-                <ignoredUnusedDeclaredDependency>mysql:mysql-connector-java</ignoredUnusedDeclaredDependency>
-                <ignoredUnusedDeclaredDependency>net.hydromatic:scott-data-hsqldb</ignoredUnusedDeclaredDependency>
-                <ignoredUnusedDeclaredDependency>net.hydromatic:foodmart-data-hsqldb</ignoredUnusedDeclaredDependency>
-                <ignoredUnusedDeclaredDependency>org.postgresql:postgresql</ignoredUnusedDeclaredDependency>
-                <ignoredUnusedDeclaredDependency>org.slf4j:slf4j-api</ignoredUnusedDeclaredDependency>
-                <ignoredUnusedDeclaredDependency>org.slf4j:slf4j-log4j12</ignoredUnusedDeclaredDependency>
-              </ignoredUnusedDeclaredDependencies>
-              <ignoredUsedUndeclaredDependencies>
-                <ignoredUsedUndeclaredDependency>org.eclipse.jetty:jetty-server</ignoredUsedUndeclaredDependency>
-              </ignoredUsedUndeclaredDependencies>
-            </configuration>
           </execution>
         </executions>
       </plugin>
+      <plugin>
+        <groupId>org.apache.rat</groupId>
+        <artifactId>apache-rat-plugin</artifactId>
+        <configuration>
+          <excludes>
+            <exclude>src/main/java/org/apache/calcite/avatica/proto/*.java</exclude>
+            <exclude>src/main/resources/META-INF/services/java.sql.Driver</exclude>
+          </excludes>
+        </configuration>
+      </plugin>
     </plugins>
-
-    <resources>
-      <resource>
-        <directory>src/main/resources</directory>
-        <excludes>
-          <exclude>version/*.properties</exclude>
-        </excludes>
-      </resource>
-      <resource>
-        <!-- Copy freemarker template and fmpp configuration files of
-             Calcite's SQL parser to allow clients to extend parser. -->
-        <directory>${basedir}/src/main/codegen</directory>
-        <targetPath>codegen</targetPath>
-      </resource>
-    </resources>
   </build>
-
-  <profiles>
-    <profile>
-      <id>it</id>
-      <build>
-        <plugins>
-          <plugin>
-            <groupId>org.apache.maven.plugins</groupId>
-            <artifactId>maven-failsafe-plugin</artifactId>
-            <executions>
-              <execution>
-                <id>failsafe-integration-test</id>
-                <!-- Disable the integration test inherited from the parent pom
-                     so that we can run multiple tests, one per database. -->
-                <phase>none</phase>
-              </execution>
-              <execution>
-                <id>failsafe-test-mysql</id>
-                <goals>
-                  <goal>integration-test</goal>
-                </goals>
-                <phase>integration-test</phase>
-                <configuration>
-                  <includes>
-                    <include>org/apache/calcite/test/JdbcAdapterTest.java</include>
-                    <include>org/apache/calcite/test/JdbcTest.java</include>
-                  </includes>
-                  <systemPropertyVariables>
-                    <calcite.test.db>mysql</calcite.test.db>
-                  </systemPropertyVariables>
-                </configuration>
-              </execution>
-              <execution>
-                <id>failsafe-test-postgresql</id>
-                <goals>
-                  <goal>integration-test</goal>
-                </goals>
-                <phase>integration-test</phase>
-                <configuration>
-                  <includes>
-                    <include>org/apache/calcite/test/JdbcAdapterTest.java</include>
-                    <include>org/apache/calcite/test/JdbcTest.java</include>
-                  </includes>
-                  <systemPropertyVariables>
-                    <calcite.test.db>postgresql</calcite.test.db>
-                  </systemPropertyVariables>
-                </configuration>
-              </execution>
-              <execution>
-                <id>failsafe-test-h2</id>
-                <goals>
-                  <goal>integration-test</goal>
-                </goals>
-                <phase>integration-test</phase>
-                <configuration>
-                  <includes>
-                    <include>org/apache/calcite/test/JdbcAdapterTest.java</include>
-                    <include>org/apache/calcite/test/JdbcTest.java</include>
-                  </includes>
-                  <systemPropertyVariables>
-                    <calcite.test.db>h2</calcite.test.db>
-                  </systemPropertyVariables>
-                </configuration>
-              </execution>
-            </executions>
-          </plugin>
-        </plugins>
-      </build>
-    </profile>
-    <profile>
-      <id>it-oracle</id>
-      <build>
-        <plugins>
-          <plugin>
-            <groupId>org.apache.maven.plugins</groupId>
-            <artifactId>maven-failsafe-plugin</artifactId>
-            <executions>
-              <execution>
-                <id>failsafe-integration-test</id>
-                <!-- Disable the integration test inherited from the parent pom
-                     so that we can run multiple tests, one per database. -->
-                <phase>none</phase>
-              </execution>
-              <execution>
-                <id>failsafe-test-oracle</id>
-                <goals>
-                  <goal>integration-test</goal>
-                </goals>
-                <phase>integration-test</phase>
-                <configuration>
-                  <includes>
-                    <include>org/apache/calcite/test/JdbcAdapterTest.java</include>
-                    <include>org/apache/calcite/test/JdbcTest.java</include>
-                  </includes>
-                  <systemPropertyVariables>
-                    <calcite.test.db>oracle</calcite.test.db>
-                  </systemPropertyVariables>
-                </configuration>
-              </execution>
-            </executions>
-          </plugin>
-        </plugins>
-      </build>
-      <dependencies>
-        <dependency>
-          <!-- Oracle's driver is not open source. If you wish to test against
-               Oracle, install the jar in your local maven repository as follows:
-
-               $ cd $ORACLE_HOME/jdbc/lib
-               $ mvn install:install-file -DgroupId=com.oracle
-                 -DartifactId=ojdbc6 -Dversion=${oracle-jdbc6-driver.version}
-                 -Dpackaging=jar -Dfile=ojdbc6.jar -DgeneratePom=true
-          -->
-          <groupId>com.oracle</groupId>
-          <artifactId>ojdbc6</artifactId>
-          <scope>test</scope>
-        </dependency>
-      </dependencies>
-    </profile>
-    <profile>
-      <!-- CALCITE-539: workaround for MSHARED-394: Avoid rewrite of
-      destination in DefaultMavenFileFilter#filterFile when producing
-      the same contents -->
-      <id>generate-version-properties</id>
-      <activation>
-        <property>
-          <name>!skipGenerate</name>
-        </property>
-      </activation>
-      <build>
-        <resources>
-          <resource>
-            <directory>src/main/resources/version</directory>
-            <filtering>true</filtering>
-          </resource>
-        </resources>
-      </build>
-    </profile>
-    <profile>
-      <!-- CALCITE-538: workaround for https://github.com/freemarker/fmpp/issues/11
-        FMPP always overwrites destination file, however we do not want
-        recompile the whole module every time.
-      -->
-      <id>generate-parser</id>
-      <activation>
-        <property>
-          <name>!skipGenerate</name>
-        </property>
-      </activation>
-      <build>
-        <plugins>
-          <plugin>
-            <groupId>com.googlecode.fmpp-maven-plugin</groupId>
-            <artifactId>fmpp-maven-plugin</artifactId>
-            <executions>
-              <execution>
-                <configuration>
-                  <cfgFile>src/main/codegen/config.fmpp</cfgFile>
-                  <templateDirectory>src/main/codegen/templates</templateDirectory>
-                </configuration>
-                <id>generate-fmpp-sources</id>
-                <phase>validate</phase>
-                <goals>
-                  <goal>generate</goal>
-                </goals>
-              </execution>
-              <execution>
-                <configuration>
-                  <cfgFile>src/test/codegen/config.fmpp</cfgFile>
-                  <templateDirectory>src/main/codegen/templates</templateDirectory>
-                  <outputDirectory>${project.build.directory}/generated-test-sources/fmpp</outputDirectory>
-                </configuration>
-                <id>generate-fmpp-test-sources</id>
-                <phase>validate</phase>
-                <goals>
-                  <goal>generate</goal>
-                </goals>
-              </execution>
-            </executions>
-          </plugin>
-        </plugins>
-      </build>
-    </profile>
-  </profiles>
-
 </project>

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/codegen/config.fmpp
----------------------------------------------------------------------
diff --git a/core/src/main/codegen/config.fmpp b/core/src/main/codegen/config.fmpp
deleted file mode 100644
index 41cfeee..0000000
--- a/core/src/main/codegen/config.fmpp
+++ /dev/null
@@ -1,105 +0,0 @@
-# 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.
-
-# This file is an FMPP (http://fmpp.sourceforge.net/) configuration file to
-# allow clients to extend Calcite's SQL parser to support application specific
-# SQL statements, literals or data types.
-#
-# Calcite's parser grammar file (Parser.jj) is written in javacc
-# (http://javacc.java.net/) with Freemarker (http://freemarker.org/) variables
-# to allow clients to:
-#   1. have custom parser implementation class and package name.
-#   2. insert new parser method implementations written in javacc to parse
-#      custom:
-#      a) SQL statements.
-#      b) literals.
-#      c) data types.
-#   3. add new keywords to support custom SQL constructs added as part of (2).
-#   4. add import statements needed by inserted custom parser implementations.
-#
-# Parser template file (Parser.jj) along with this file are packaged as
-# part of the calcite-core-<version>.jar under "codegen" directory.
-
-data: {
-  parser: {
-    # Generated parser implementation package and class name.
-    package: "org.apache.calcite.sql.parser.impl",
-    class: "SqlParserImpl",
-
-    # List of additional classes and packages to import.
-    # Example. "org.apache.calcite.sql.*", "java.util.List".
-    imports: [
-    ]
-
-    # List of new keywords. Example: "DATABASES", "TABLES". If the keyword is not a reserved
-    # keyword add it to 'nonReservedKeywords' section.
-    keywords: [
-    ]
-
-    # List of keywords from "keywords" section that are not reserved.
-    nonReservedKeywords: [
-    ]
-
-    # List of methods for parsing custom SQL statements.
-    # Return type of method implementation should be 'SqlNode'.
-    # Example: SqlShowDatabases(), SqlShowTables().
-    statementParserMethods: [
-    ]
-
-    # List of methods for parsing custom literals.
-    # Return type of method implementation should be "SqlNode".
-    # Example: ParseJsonLiteral().
-    literalParserMethods: [
-    ]
-
-    # List of methods for parsing custom data types.
-    # Return type of method implementation should be "SqlIdentifier".
-    # Example: SqlParseTimeStampZ().
-    dataTypeParserMethods: [
-    ]
-
-    # List of methods for parsing extensions to "ALTER <scope>" calls.
-    # Each must accept arguments "(SqlParserPos pos, String scope)".
-    # Example: "SqlUploadJarNode"
-    alterStatementParserMethods: [
-    ]
-
-    # List of methods for parsing extensions to "CREATE [OR REPLACE]" calls.
-    # Each must accept arguments "(SqlParserPos pos, boolean replace)".
-    createStatementParserMethods: [
-    ]
-
-    # List of methods for parsing extensions to "DROP" calls.
-    # Each must accept arguments "(SqlParserPos pos)".
-    dropStatementParserMethods: [
-    ]
-
-    # List of files in @includes directory that have parser method
-    # implementations for parsing custom SQL statements, literals or types
-    # given as part of "statementParserMethods", "literalParserMethods" or
-    # "dataTypeParserMethods".
-    implementationFiles: [
-      "parserImpls.ftl"
-    ]
-
-    includeCompoundIdentifier: true
-    includeBraces: true
-    includeAdditionalDeclarations: false
-  }
-}
-
-freemarkerLinks: {
-  includes: includes/
-}

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/codegen/includes/compoundIdentifier.ftl
----------------------------------------------------------------------
diff --git a/core/src/main/codegen/includes/compoundIdentifier.ftl b/core/src/main/codegen/includes/compoundIdentifier.ftl
deleted file mode 100644
index 70db3c2..0000000
--- a/core/src/main/codegen/includes/compoundIdentifier.ftl
+++ /dev/null
@@ -1,34 +0,0 @@
-<#--
-// 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.
--->
-
-<#--
-  Add implementations of additional parser statements, literals or
-  data types.
-
-  Example of SqlShowTables() implementation:
-  SqlNode SqlShowTables()
-  {
-    ...local variables...
-  }
-  {
-    <SHOW> <TABLES>
-    ...
-    {
-      return SqlShowTables(...)
-    }
-  }
--->

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/codegen/includes/parserImpls.ftl
----------------------------------------------------------------------
diff --git a/core/src/main/codegen/includes/parserImpls.ftl b/core/src/main/codegen/includes/parserImpls.ftl
deleted file mode 100644
index 70db3c2..0000000
--- a/core/src/main/codegen/includes/parserImpls.ftl
+++ /dev/null
@@ -1,34 +0,0 @@
-<#--
-// 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.
--->
-
-<#--
-  Add implementations of additional parser statements, literals or
-  data types.
-
-  Example of SqlShowTables() implementation:
-  SqlNode SqlShowTables()
-  {
-    ...local variables...
-  }
-  {
-    <SHOW> <TABLES>
-    ...
-    {
-      return SqlShowTables(...)
-    }
-  }
--->


[05/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/RexImpTable.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/RexImpTable.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/RexImpTable.java
deleted file mode 100644
index 2182c7c..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/RexImpTable.java
+++ /dev/null
@@ -1,2181 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.avatica.util.DateTimeUtils;
-import org.apache.calcite.avatica.util.TimeUnit;
-import org.apache.calcite.avatica.util.TimeUnitRange;
-import org.apache.calcite.linq4j.Ord;
-import org.apache.calcite.linq4j.tree.BlockBuilder;
-import org.apache.calcite.linq4j.tree.BlockStatement;
-import org.apache.calcite.linq4j.tree.ConstantExpression;
-import org.apache.calcite.linq4j.tree.Expression;
-import org.apache.calcite.linq4j.tree.ExpressionType;
-import org.apache.calcite.linq4j.tree.Expressions;
-import org.apache.calcite.linq4j.tree.MemberExpression;
-import org.apache.calcite.linq4j.tree.OptimizeShuttle;
-import org.apache.calcite.linq4j.tree.ParameterExpression;
-import org.apache.calcite.linq4j.tree.Primitive;
-import org.apache.calcite.linq4j.tree.Types;
-import org.apache.calcite.plan.RelOptTable;
-import org.apache.calcite.prepare.Prepare;
-import org.apache.calcite.rel.type.RelDataType;
-import org.apache.calcite.rel.type.RelDataTypeFactory;
-import org.apache.calcite.rel.type.RelDataTypeFactoryImpl;
-import org.apache.calcite.rex.RexCall;
-import org.apache.calcite.rex.RexLiteral;
-import org.apache.calcite.rex.RexNode;
-import org.apache.calcite.runtime.SqlFunctions;
-import org.apache.calcite.schema.ImplementableAggFunction;
-import org.apache.calcite.schema.ImplementableFunction;
-import org.apache.calcite.schema.impl.AggregateFunctionImpl;
-import org.apache.calcite.sql.SqlAggFunction;
-import org.apache.calcite.sql.SqlBinaryOperator;
-import org.apache.calcite.sql.SqlOperator;
-import org.apache.calcite.sql.fun.SqlStdOperatorTable;
-import org.apache.calcite.sql.fun.SqlTrimFunction;
-import org.apache.calcite.sql.type.SqlTypeName;
-import org.apache.calcite.sql.type.SqlTypeUtil;
-import org.apache.calcite.sql.validate.SqlUserDefinedAggFunction;
-import org.apache.calcite.sql.validate.SqlUserDefinedFunction;
-import org.apache.calcite.util.BuiltInMethod;
-import org.apache.calcite.util.Util;
-
-import com.google.common.base.Supplier;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Maps;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.lang.reflect.Type;
-import java.math.BigDecimal;
-import java.math.RoundingMode;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import static org.apache.calcite.linq4j.tree.ExpressionType.Add;
-import static org.apache.calcite.linq4j.tree.ExpressionType.AndAlso;
-import static org.apache.calcite.linq4j.tree.ExpressionType.Divide;
-import static org.apache.calcite.linq4j.tree.ExpressionType.Equal;
-import static org.apache.calcite.linq4j.tree.ExpressionType.GreaterThan;
-import static org.apache.calcite.linq4j.tree.ExpressionType.GreaterThanOrEqual;
-import static org.apache.calcite.linq4j.tree.ExpressionType.LessThan;
-import static org.apache.calcite.linq4j.tree.ExpressionType.LessThanOrEqual;
-import static org.apache.calcite.linq4j.tree.ExpressionType.Multiply;
-import static org.apache.calcite.linq4j.tree.ExpressionType.Negate;
-import static org.apache.calcite.linq4j.tree.ExpressionType.Not;
-import static org.apache.calcite.linq4j.tree.ExpressionType.NotEqual;
-import static org.apache.calcite.linq4j.tree.ExpressionType.OrElse;
-import static org.apache.calcite.linq4j.tree.ExpressionType.Subtract;
-import static org.apache.calcite.linq4j.tree.ExpressionType.UnaryPlus;
-import static org.apache.calcite.sql.fun.OracleSqlOperatorTable.TRANSLATE3;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.ABS;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.ACOS;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.AND;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.ARRAY_VALUE_CONSTRUCTOR;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.ASIN;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.ATAN;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.ATAN2;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.CARDINALITY;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.CASE;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.CAST;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.CEIL;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.CHARACTER_LENGTH;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.CHAR_LENGTH;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.COLLECT;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.CONCAT;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.COS;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.COT;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.COUNT;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.CURRENT_CATALOG;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.CURRENT_DATE;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.CURRENT_PATH;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.CURRENT_ROLE;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.CURRENT_TIME;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.CURRENT_TIMESTAMP;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.CURRENT_USER;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.CURRENT_VALUE;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.DATETIME_PLUS;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.DEFAULT;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.DEGREES;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.DENSE_RANK;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.DIVIDE;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.DIVIDE_INTEGER;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.ELEMENT;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.EQUALS;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.EXP;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.EXTRACT_DATE;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.FIRST_VALUE;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.FLOOR;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.GREATER_THAN;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.GREATER_THAN_OR_EQUAL;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.INITCAP;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.IS_FALSE;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.IS_NOT_FALSE;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.IS_NOT_NULL;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.IS_NOT_TRUE;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.IS_NULL;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.IS_TRUE;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.ITEM;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.LAG;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.LAST_VALUE;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.LEAD;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.LESS_THAN;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.LESS_THAN_OR_EQUAL;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.LIKE;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.LN;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.LOCALTIME;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.LOCALTIMESTAMP;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.LOG10;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.LOWER;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.MAP_VALUE_CONSTRUCTOR;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.MAX;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.MIN;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.MINUS;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.MINUS_DATE;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.MOD;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.MULTIPLY;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.NEXT_VALUE;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.NOT;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.NOT_EQUALS;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.NOT_LIKE;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.NOT_SIMILAR_TO;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.NTILE;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.OR;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.OVERLAY;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.PI;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.PLUS;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.POSITION;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.POWER;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.RADIANS;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.RAND;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.RAND_INTEGER;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.RANK;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.REINTERPRET;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.REPLACE;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.ROUND;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.ROW;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.ROW_NUMBER;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.SESSION_USER;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.SIGN;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.SIMILAR_TO;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.SIN;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.SINGLE_VALUE;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.SLICE;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.SUBSTRING;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.SUM;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.SUM0;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.SYSTEM_USER;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.TAN;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.TRIM;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.TRUNCATE;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.UNARY_MINUS;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.UNARY_PLUS;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.UPPER;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.USER;
-
-/**
- * Contains implementations of Rex operators as Java code.
- */
-public class RexImpTable {
-  public static final ConstantExpression NULL_EXPR =
-      Expressions.constant(null);
-  public static final ConstantExpression FALSE_EXPR =
-      Expressions.constant(false);
-  public static final ConstantExpression TRUE_EXPR =
-      Expressions.constant(true);
-  public static final MemberExpression BOXED_FALSE_EXPR =
-      Expressions.field(null, Boolean.class, "FALSE");
-  public static final MemberExpression BOXED_TRUE_EXPR =
-      Expressions.field(null, Boolean.class, "TRUE");
-
-  private final Map<SqlOperator, CallImplementor> map = new HashMap<>();
-  private final Map<SqlAggFunction, Supplier<? extends AggImplementor>> aggMap =
-      Maps.newHashMap();
-  private final Map<SqlAggFunction, Supplier<? extends WinAggImplementor>>
-  winAggMap = Maps.newHashMap();
-
-  RexImpTable() {
-    defineMethod(ROW, BuiltInMethod.ARRAY.method, NullPolicy.ANY);
-    defineMethod(UPPER, BuiltInMethod.UPPER.method, NullPolicy.STRICT);
-    defineMethod(LOWER, BuiltInMethod.LOWER.method, NullPolicy.STRICT);
-    defineMethod(INITCAP,  BuiltInMethod.INITCAP.method, NullPolicy.STRICT);
-    defineMethod(SUBSTRING, BuiltInMethod.SUBSTRING.method, NullPolicy.STRICT);
-    defineMethod(REPLACE, BuiltInMethod.REPLACE.method, NullPolicy.STRICT);
-    defineMethod(TRANSLATE3, BuiltInMethod.TRANSLATE3.method, NullPolicy.STRICT);
-    defineMethod(CHARACTER_LENGTH, BuiltInMethod.CHAR_LENGTH.method,
-        NullPolicy.STRICT);
-    defineMethod(CHAR_LENGTH, BuiltInMethod.CHAR_LENGTH.method,
-        NullPolicy.STRICT);
-    defineMethod(CONCAT, BuiltInMethod.STRING_CONCAT.method,
-        NullPolicy.STRICT);
-    defineMethod(OVERLAY, BuiltInMethod.OVERLAY.method, NullPolicy.STRICT);
-    defineMethod(POSITION, BuiltInMethod.POSITION.method, NullPolicy.STRICT);
-
-    final TrimImplementor trimImplementor = new TrimImplementor();
-    defineImplementor(TRIM, NullPolicy.STRICT, trimImplementor, false);
-
-    // logical
-    defineBinary(AND, AndAlso, NullPolicy.AND, null);
-    defineBinary(OR, OrElse, NullPolicy.OR, null);
-    defineUnary(NOT, Not, NullPolicy.NOT);
-
-    // comparisons
-    defineBinary(LESS_THAN, LessThan, NullPolicy.STRICT, "lt");
-    defineBinary(LESS_THAN_OR_EQUAL, LessThanOrEqual, NullPolicy.STRICT, "le");
-    defineBinary(GREATER_THAN, GreaterThan, NullPolicy.STRICT, "gt");
-    defineBinary(GREATER_THAN_OR_EQUAL, GreaterThanOrEqual, NullPolicy.STRICT,
-        "ge");
-    defineBinary(EQUALS, Equal, NullPolicy.STRICT, "eq");
-    defineBinary(NOT_EQUALS, NotEqual, NullPolicy.STRICT, "ne");
-
-    // arithmetic
-    defineBinary(PLUS, Add, NullPolicy.STRICT, "plus");
-    defineBinary(MINUS, Subtract, NullPolicy.STRICT, "minus");
-    defineBinary(MULTIPLY, Multiply, NullPolicy.STRICT, "multiply");
-    defineBinary(DIVIDE, Divide, NullPolicy.STRICT, "divide");
-    defineBinary(DIVIDE_INTEGER, Divide, NullPolicy.STRICT, "divide");
-    defineUnary(UNARY_MINUS, Negate, NullPolicy.STRICT);
-    defineUnary(UNARY_PLUS, UnaryPlus, NullPolicy.STRICT);
-
-    defineMethod(MOD, "mod", NullPolicy.STRICT);
-    defineMethod(EXP, "exp", NullPolicy.STRICT);
-    defineMethod(POWER, "power", NullPolicy.STRICT);
-    defineMethod(LN, "ln", NullPolicy.STRICT);
-    defineMethod(LOG10, "log10", NullPolicy.STRICT);
-    defineMethod(ABS, "abs", NullPolicy.STRICT);
-
-    defineImplementor(RAND, NullPolicy.STRICT,
-        new NotNullImplementor() {
-          final NotNullImplementor[] implementors = {
-            new ReflectiveCallNotNullImplementor(BuiltInMethod.RAND.method),
-            new ReflectiveCallNotNullImplementor(BuiltInMethod.RAND_SEED.method)
-          };
-          public Expression implement(RexToLixTranslator translator,
-              RexCall call, List<Expression> translatedOperands) {
-            return implementors[call.getOperands().size()]
-                .implement(translator, call, translatedOperands);
-          }
-        }, false);
-    defineImplementor(RAND_INTEGER, NullPolicy.STRICT,
-        new NotNullImplementor() {
-          final NotNullImplementor[] implementors = {
-            null,
-            new ReflectiveCallNotNullImplementor(
-                BuiltInMethod.RAND_INTEGER.method),
-            new ReflectiveCallNotNullImplementor(
-                BuiltInMethod.RAND_INTEGER_SEED.method)
-          };
-          public Expression implement(RexToLixTranslator translator,
-              RexCall call, List<Expression> translatedOperands) {
-            return implementors[call.getOperands().size()]
-                .implement(translator, call, translatedOperands);
-          }
-        }, false);
-
-    defineMethod(ACOS, "acos", NullPolicy.STRICT);
-    defineMethod(ASIN, "asin", NullPolicy.STRICT);
-    defineMethod(ATAN, "atan", NullPolicy.STRICT);
-    defineMethod(ATAN2, "atan2", NullPolicy.STRICT);
-    defineMethod(COS, "cos", NullPolicy.STRICT);
-    defineMethod(COT, "cot", NullPolicy.STRICT);
-    defineMethod(DEGREES, "degrees", NullPolicy.STRICT);
-    defineMethod(RADIANS, "radians", NullPolicy.STRICT);
-    defineMethod(ROUND, "sround", NullPolicy.STRICT);
-    defineMethod(SIGN, "sign", NullPolicy.STRICT);
-    defineMethod(SIN, "sin", NullPolicy.STRICT);
-    defineMethod(TAN, "tan", NullPolicy.STRICT);
-    defineMethod(TRUNCATE, "struncate", NullPolicy.STRICT);
-
-    map.put(PI, new CallImplementor() {
-      @Override public Expression implement(RexToLixTranslator translator,
-          RexCall call, NullAs nullAs) {
-        return Expressions.constant(Math.PI);
-      }
-    });
-
-    // datetime
-    defineImplementor(DATETIME_PLUS, NullPolicy.STRICT,
-        new DatetimeArithmeticImplementor(), false);
-    defineImplementor(MINUS_DATE, NullPolicy.STRICT,
-        new DatetimeArithmeticImplementor(), false);
-    defineMethod(EXTRACT_DATE, BuiltInMethod.UNIX_DATE_EXTRACT.method,
-        NullPolicy.STRICT);
-    defineImplementor(FLOOR, NullPolicy.STRICT,
-        new FloorImplementor(BuiltInMethod.FLOOR.method.getName(),
-            BuiltInMethod.UNIX_TIMESTAMP_FLOOR.method,
-            BuiltInMethod.UNIX_DATE_FLOOR.method), false);
-    defineImplementor(CEIL, NullPolicy.STRICT,
-        new FloorImplementor(BuiltInMethod.CEIL.method.getName(),
-            BuiltInMethod.UNIX_TIMESTAMP_CEIL.method,
-            BuiltInMethod.UNIX_DATE_CEIL.method), false);
-
-    map.put(IS_NULL, new IsXxxImplementor(null, false));
-    map.put(IS_NOT_NULL, new IsXxxImplementor(null, true));
-    map.put(IS_TRUE, new IsXxxImplementor(true, false));
-    map.put(IS_NOT_TRUE, new IsXxxImplementor(true, true));
-    map.put(IS_FALSE, new IsXxxImplementor(false, false));
-    map.put(IS_NOT_FALSE, new IsXxxImplementor(false, true));
-
-    // LIKE and SIMILAR
-    final MethodImplementor likeImplementor =
-        new MethodImplementor(BuiltInMethod.LIKE.method);
-    defineImplementor(LIKE, NullPolicy.STRICT, likeImplementor, false);
-    defineImplementor(NOT_LIKE, NullPolicy.STRICT,
-        NotImplementor.of(likeImplementor), false);
-    final MethodImplementor similarImplementor =
-        new MethodImplementor(BuiltInMethod.SIMILAR.method);
-    defineImplementor(SIMILAR_TO, NullPolicy.STRICT, similarImplementor, false);
-    defineImplementor(NOT_SIMILAR_TO, NullPolicy.STRICT,
-        NotImplementor.of(similarImplementor), false);
-
-    // Multisets & arrays
-    defineMethod(CARDINALITY, BuiltInMethod.COLLECTION_SIZE.method,
-        NullPolicy.STRICT);
-    defineMethod(SLICE, BuiltInMethod.SLICE.method, NullPolicy.NONE);
-    defineMethod(ELEMENT, BuiltInMethod.ELEMENT.method, NullPolicy.STRICT);
-
-    map.put(CASE, new CaseImplementor());
-
-    map.put(CAST, new CastOptimizedImplementor());
-
-    defineImplementor(REINTERPRET, NullPolicy.STRICT,
-        new ReinterpretImplementor(), false);
-
-    final CallImplementor value = new ValueConstructorImplementor();
-    map.put(MAP_VALUE_CONSTRUCTOR, value);
-    map.put(ARRAY_VALUE_CONSTRUCTOR, value);
-    map.put(ITEM, new ItemImplementor());
-
-    map.put(DEFAULT,
-        new CallImplementor() {
-          public Expression implement(RexToLixTranslator translator,
-              RexCall call, NullAs nullAs) {
-            return Expressions.constant(null);
-          }
-        });
-
-    // Sequences
-    defineImplementor(CURRENT_VALUE, NullPolicy.STRICT,
-        new SequenceImplementor(BuiltInMethod.SEQUENCE_CURRENT_VALUE.method),
-        false);
-    defineImplementor(NEXT_VALUE, NullPolicy.STRICT,
-        new SequenceImplementor(BuiltInMethod.SEQUENCE_NEXT_VALUE.method),
-        false);
-
-    // System functions
-    final SystemFunctionImplementor systemFunctionImplementor =
-        new SystemFunctionImplementor();
-    map.put(USER, systemFunctionImplementor);
-    map.put(CURRENT_USER, systemFunctionImplementor);
-    map.put(SESSION_USER, systemFunctionImplementor);
-    map.put(SYSTEM_USER, systemFunctionImplementor);
-    map.put(CURRENT_PATH, systemFunctionImplementor);
-    map.put(CURRENT_ROLE, systemFunctionImplementor);
-    map.put(CURRENT_CATALOG, systemFunctionImplementor);
-
-    // Current time functions
-    map.put(CURRENT_TIME, systemFunctionImplementor);
-    map.put(CURRENT_TIMESTAMP, systemFunctionImplementor);
-    map.put(CURRENT_DATE, systemFunctionImplementor);
-    map.put(LOCALTIME, systemFunctionImplementor);
-    map.put(LOCALTIMESTAMP, systemFunctionImplementor);
-
-    aggMap.put(COUNT, constructorSupplier(CountImplementor.class));
-    aggMap.put(SUM0, constructorSupplier(SumImplementor.class));
-    aggMap.put(SUM, constructorSupplier(SumImplementor.class));
-    Supplier<MinMaxImplementor> minMax =
-        constructorSupplier(MinMaxImplementor.class);
-    aggMap.put(MIN, minMax);
-    aggMap.put(MAX, minMax);
-    aggMap.put(SINGLE_VALUE, constructorSupplier(SingleValueImplementor.class));
-    aggMap.put(COLLECT, constructorSupplier(CollectImplementor.class));
-    winAggMap.put(RANK, constructorSupplier(RankImplementor.class));
-    winAggMap.put(DENSE_RANK, constructorSupplier(DenseRankImplementor.class));
-    winAggMap.put(ROW_NUMBER, constructorSupplier(RowNumberImplementor.class));
-    winAggMap.put(FIRST_VALUE,
-        constructorSupplier(FirstValueImplementor.class));
-    winAggMap.put(LAST_VALUE, constructorSupplier(LastValueImplementor.class));
-    winAggMap.put(LEAD, constructorSupplier(LeadImplementor.class));
-    winAggMap.put(LAG, constructorSupplier(LagImplementor.class));
-    winAggMap.put(NTILE, constructorSupplier(NtileImplementor.class));
-    winAggMap.put(COUNT, constructorSupplier(CountWinImplementor.class));
-  }
-
-  private <T> Supplier<T> constructorSupplier(Class<T> klass) {
-    final Constructor<T> constructor;
-    try {
-      constructor = klass.getDeclaredConstructor();
-    } catch (NoSuchMethodException e) {
-      throw new IllegalArgumentException(
-          klass + " should implement zero arguments constructor");
-    }
-    return new Supplier<T>() {
-      public T get() {
-        try {
-          return constructor.newInstance();
-        } catch (InstantiationException | IllegalAccessException
-            | InvocationTargetException e) {
-          throw new IllegalStateException(
-              "Error while creating aggregate implementor " + constructor, e);
-        }
-      }
-    };
-  }
-
-  private void defineImplementor(
-      SqlOperator operator,
-      NullPolicy nullPolicy,
-      NotNullImplementor implementor,
-      boolean harmonize) {
-    CallImplementor callImplementor =
-        createImplementor(implementor, nullPolicy, harmonize);
-    map.put(operator, callImplementor);
-  }
-
-  private static RexCall call2(
-      boolean harmonize,
-      RexToLixTranslator translator,
-      RexCall call) {
-    if (!harmonize) {
-      return call;
-    }
-    final List<RexNode> operands2 =
-        harmonize(translator, call.getOperands());
-    if (operands2.equals(call.getOperands())) {
-      return call;
-    }
-    return call.clone(call.getType(), operands2);
-  }
-
-  public static CallImplementor createImplementor(
-      final NotNullImplementor implementor,
-      final NullPolicy nullPolicy,
-      final boolean harmonize) {
-    switch (nullPolicy) {
-    case ANY:
-    case STRICT:
-      return new CallImplementor() {
-        public Expression implement(
-            RexToLixTranslator translator, RexCall call, NullAs nullAs) {
-          return implementNullSemantics0(
-              translator, call, nullAs, nullPolicy, harmonize,
-              implementor);
-        }
-      };
-    case AND:
-/* TODO:
-            if (nullAs == NullAs.FALSE) {
-                nullPolicy2 = NullPolicy.ANY;
-            }
-*/
-      // If any of the arguments are false, result is false;
-      // else if any arguments are null, result is null;
-      // else true.
-      //
-      // b0 == null ? (b1 == null || b1 ? null : Boolean.FALSE)
-      //   : b0 ? b1
-      //   : Boolean.FALSE;
-      return new CallImplementor() {
-        public Expression implement(
-            RexToLixTranslator translator, RexCall call, NullAs nullAs) {
-          assert call.getOperator() == AND
-              : "AND null semantics is supported only for AND operator. Actual operator is "
-              + String.valueOf(call.getOperator());
-          final RexCall call2 = call2(false, translator, call);
-          switch (nullAs) {
-          case NOT_POSSIBLE: // Just foldAnd
-          case TRUE:
-            // AND call should return false iff has FALSEs,
-            // thus if we convert nulls to true then no harm is made
-          case FALSE:
-            // AND call should return false iff has FALSEs or has NULLs,
-            // thus if we convert nulls to false, no harm is made
-            final List<Expression> expressions =
-                translator.translateList(call2.getOperands(), nullAs);
-            return Expressions.foldAnd(expressions);
-          case NULL:
-          case IS_NULL:
-          case IS_NOT_NULL:
-            final List<Expression> nullAsTrue =
-                translator.translateList(call2.getOperands(), NullAs.TRUE);
-            final List<Expression> nullAsIsNull =
-                translator.translateList(call2.getOperands(), NullAs.IS_NULL);
-            Expression hasFalse = Expressions.not(Expressions.foldAnd(nullAsTrue));
-            Expression hasNull = Expressions.foldOr(nullAsIsNull);
-            Expression result = nullAs.handle(
-                Expressions.condition(hasFalse, BOXED_FALSE_EXPR,
-                    Expressions.condition(hasNull, NULL_EXPR, BOXED_TRUE_EXPR)));
-            return result;
-          default:
-            throw new IllegalArgumentException(
-                "Unknown nullAs when implementing AND: " + nullAs);
-          }
-        }
-      };
-    case OR:
-      // If any of the arguments are true, result is true;
-      // else if any arguments are null, result is null;
-      // else false.
-      //
-      // b0 == null ? (b1 == null || !b1 ? null : Boolean.TRUE)
-      //   : !b0 ? b1
-      //   : Boolean.TRUE;
-      return new CallImplementor() {
-        public Expression implement(
-            RexToLixTranslator translator, RexCall call, final NullAs nullAs) {
-          assert call.getOperator() == OR
-              : "OR null semantics is supported only for OR operator. Actual operator is "
-              + String.valueOf(call.getOperator());
-          final RexCall call2 = call2(harmonize, translator, call);
-          switch (nullAs) {
-          case NOT_POSSIBLE: // Just foldOr
-          case TRUE:
-            // This should return false iff all arguments are FALSE,
-            // thus we convert nulls to TRUE and foldOr
-          case FALSE:
-            // This should return true iff has TRUE arguments,
-            // thus we convert nulls to FALSE and foldOr
-            final List<Expression> expressions =
-                translator.translateList(call2.getOperands(), nullAs);
-            return Expressions.foldOr(expressions);
-          case NULL:
-          case IS_NULL:
-          case IS_NOT_NULL:
-            final List<Expression> nullAsFalse =
-                translator.translateList(call2.getOperands(), NullAs.FALSE);
-            final List<Expression> nullAsIsNull =
-                translator.translateList(call2.getOperands(), NullAs.IS_NULL);
-            Expression hasTrue = Expressions.foldOr(nullAsFalse);
-            Expression hasNull = Expressions.foldOr(nullAsIsNull);
-            Expression result = nullAs.handle(
-                Expressions.condition(hasTrue, BOXED_TRUE_EXPR,
-                    Expressions.condition(hasNull, NULL_EXPR, BOXED_FALSE_EXPR)));
-            return result;
-          default:
-            throw new IllegalArgumentException(
-                "Unknown nullAs when implementing OR: " + nullAs);
-          }
-        }
-      };
-    case NOT:
-      // If any of the arguments are false, result is true;
-      // else if any arguments are null, result is null;
-      // else false.
-      return new CallImplementor() {
-        public Expression implement(RexToLixTranslator translator, RexCall call,
-            NullAs nullAs) {
-          switch (nullAs) {
-          case NULL:
-            return Expressions.call(BuiltInMethod.NOT.method,
-                translator.translateList(call.getOperands(), nullAs));
-          default:
-            return Expressions.not(
-                translator.translate(call.getOperands().get(0),
-                    negate(nullAs)));
-          }
-        }
-
-        private NullAs negate(NullAs nullAs) {
-          switch (nullAs) {
-          case FALSE:
-            return NullAs.TRUE;
-          case TRUE:
-            return NullAs.FALSE;
-          default:
-            return nullAs;
-          }
-        }
-      };
-    case NONE:
-      return new CallImplementor() {
-        public Expression implement(
-            RexToLixTranslator translator, RexCall call, NullAs nullAs) {
-          final RexCall call2 = call2(false, translator, call);
-          return implementCall(
-              translator, call2, implementor, nullAs);
-        }
-      };
-    default:
-      throw new AssertionError(nullPolicy);
-    }
-  }
-
-  private void defineMethod(
-      SqlOperator operator, String functionName, NullPolicy nullPolicy) {
-    defineImplementor(
-        operator,
-        nullPolicy,
-        new MethodNameImplementor(functionName),
-        false);
-  }
-
-  private void defineMethod(
-      SqlOperator operator, Method method, NullPolicy nullPolicy) {
-    defineImplementor(
-        operator, nullPolicy, new MethodImplementor(method), false);
-  }
-
-  private void defineMethodReflective(
-      SqlOperator operator, Method method, NullPolicy nullPolicy) {
-    defineImplementor(
-        operator, nullPolicy, new ReflectiveCallNotNullImplementor(method),
-        false);
-  }
-
-  private void defineUnary(
-      SqlOperator operator, ExpressionType expressionType,
-      NullPolicy nullPolicy) {
-    defineImplementor(
-        operator,
-        nullPolicy,
-        new UnaryImplementor(expressionType), false);
-  }
-
-  private void defineBinary(
-      SqlOperator operator,
-      ExpressionType expressionType,
-      NullPolicy nullPolicy,
-      String backupMethodName) {
-    defineImplementor(
-        operator,
-        nullPolicy,
-        new BinaryImplementor(expressionType, backupMethodName),
-        true);
-  }
-
-  public static final RexImpTable INSTANCE = new RexImpTable();
-
-  public CallImplementor get(final SqlOperator operator) {
-    if (operator instanceof SqlUserDefinedFunction) {
-      org.apache.calcite.schema.Function udf =
-        ((SqlUserDefinedFunction) operator).getFunction();
-      if (!(udf instanceof ImplementableFunction)) {
-        throw new IllegalStateException("User defined function " + operator
-            + " must implement ImplementableFunction");
-      }
-      return ((ImplementableFunction) udf).getImplementor();
-    }
-    return map.get(operator);
-  }
-
-  public AggImplementor get(final SqlAggFunction aggregation,
-      boolean forWindowAggregate) {
-    if (aggregation instanceof SqlUserDefinedAggFunction) {
-      final SqlUserDefinedAggFunction udaf =
-          (SqlUserDefinedAggFunction) aggregation;
-      if (!(udaf.function instanceof ImplementableAggFunction)) {
-        throw new IllegalStateException("User defined aggregation "
-            + aggregation + " must implement ImplementableAggFunction");
-      }
-      return ((ImplementableAggFunction) udaf.function)
-          .getImplementor(forWindowAggregate);
-    }
-    if (forWindowAggregate) {
-      Supplier<? extends WinAggImplementor> winAgg =
-          winAggMap.get(aggregation);
-      if (winAgg != null) {
-        return winAgg.get();
-      }
-      // Regular aggregates can be used in window context as well
-    }
-
-    Supplier<? extends AggImplementor> aggSupplier = aggMap.get(aggregation);
-    if (aggSupplier == null) {
-      return null;
-    }
-
-    return aggSupplier.get();
-  }
-
-  static Expression maybeNegate(boolean negate, Expression expression) {
-    if (!negate) {
-      return expression;
-    } else {
-      return Expressions.not(expression);
-    }
-  }
-
-  static Expression optimize(Expression expression) {
-    return expression.accept(new OptimizeShuttle());
-  }
-
-  static Expression optimize2(Expression operand, Expression expression) {
-    if (Primitive.is(operand.getType())) {
-      // Primitive values cannot be null
-      return optimize(expression);
-    } else {
-      return optimize(
-          Expressions.condition(
-              Expressions.equal(
-                  operand,
-                  NULL_EXPR),
-              NULL_EXPR,
-              expression));
-    }
-  }
-
-  private static boolean nullable(RexCall call, int i) {
-    return call.getOperands().get(i).getType().isNullable();
-  }
-
-  /** Ensures that operands have identical type. */
-  private static List<RexNode> harmonize(
-      final RexToLixTranslator translator, final List<RexNode> operands) {
-    int nullCount = 0;
-    final List<RelDataType> types = new ArrayList<>();
-    final RelDataTypeFactory typeFactory =
-        translator.builder.getTypeFactory();
-    for (RexNode operand : operands) {
-      RelDataType type = operand.getType();
-      type = toSql(typeFactory, type);
-      if (translator.isNullable(operand)) {
-        ++nullCount;
-      } else {
-        type = typeFactory.createTypeWithNullability(type, false);
-      }
-      types.add(type);
-    }
-    if (allSame(types)) {
-      // Operands have the same nullability and type. Return them
-      // unchanged.
-      return operands;
-    }
-    final RelDataType type = typeFactory.leastRestrictive(types);
-    if (type == null) {
-      // There is no common type. Presumably this is a binary operator with
-      // asymmetric arguments (e.g. interval / integer) which is not intended
-      // to be harmonized.
-      return operands;
-    }
-    assert (nullCount > 0) == type.isNullable();
-    final List<RexNode> list = new ArrayList<>();
-    for (RexNode operand : operands) {
-      list.add(
-          translator.builder.ensureType(type, operand, false));
-    }
-    return list;
-  }
-
-  private static RelDataType toSql(RelDataTypeFactory typeFactory,
-      RelDataType type) {
-    if (type instanceof RelDataTypeFactoryImpl.JavaType) {
-      final SqlTypeName typeName = type.getSqlTypeName();
-      if (typeName != null && typeName != SqlTypeName.OTHER) {
-        return typeFactory.createTypeWithNullability(
-            typeFactory.createSqlType(typeName),
-            type.isNullable());
-      }
-    }
-    return type;
-  }
-
-  private static <E> boolean allSame(List<E> list) {
-    E prev = null;
-    for (E e : list) {
-      if (prev != null && !prev.equals(e)) {
-        return false;
-      }
-      prev = e;
-    }
-    return true;
-  }
-
-  private static Expression implementNullSemantics0(
-      RexToLixTranslator translator,
-      RexCall call,
-      NullAs nullAs,
-      NullPolicy nullPolicy,
-      boolean harmonize,
-      NotNullImplementor implementor) {
-    switch (nullAs) {
-    case IS_NOT_NULL:
-      // If "f" is strict, then "f(a0, a1) IS NOT NULL" is
-      // equivalent to "a0 IS NOT NULL AND a1 IS NOT NULL".
-      if (nullPolicy == NullPolicy.STRICT) {
-        return Expressions.foldAnd(
-            translator.translateList(
-                call.getOperands(), nullAs));
-      }
-      break;
-    case IS_NULL:
-      // If "f" is strict, then "f(a0, a1) IS NULL" is
-      // equivalent to "a0 IS NULL OR a1 IS NULL".
-      if (nullPolicy == NullPolicy.STRICT) {
-        return Expressions.foldOr(
-            translator.translateList(
-                call.getOperands(), nullAs));
-      }
-      break;
-    }
-    final RexCall call2 = call2(harmonize, translator, call);
-    try {
-      return implementNullSemantics(
-          translator, call2, nullAs, nullPolicy, implementor);
-    } catch (RexToLixTranslator.AlwaysNull e) {
-      switch (nullAs) {
-      case NOT_POSSIBLE:
-        throw e;
-      case FALSE:
-        return FALSE_EXPR;
-      case TRUE:
-        return TRUE_EXPR;
-      default:
-        return NULL_EXPR;
-      }
-    }
-  }
-
-  private static Expression implementNullSemantics(
-      RexToLixTranslator translator,
-      RexCall call,
-      NullAs nullAs,
-      NullPolicy nullPolicy,
-      NotNullImplementor implementor) {
-    final List<Expression> list = new ArrayList<>();
-    switch (nullAs) {
-    case NULL:
-      // v0 == null || v1 == null ? null : f(v0, v1)
-      for (Ord<RexNode> operand : Ord.zip(call.getOperands())) {
-        if (translator.isNullable(operand.e)) {
-          list.add(
-              translator.translate(
-                  operand.e, NullAs.IS_NULL));
-          translator = translator.setNullable(operand.e, false);
-        }
-      }
-      final Expression box =
-          Expressions.box(
-              implementCall(translator, call, implementor, nullAs));
-      return optimize(
-          Expressions.condition(
-              Expressions.foldOr(list),
-              Types.castIfNecessary(box.getType(), NULL_EXPR),
-              box));
-    case FALSE:
-      // v0 != null && v1 != null && f(v0, v1)
-      for (Ord<RexNode> operand : Ord.zip(call.getOperands())) {
-        if (translator.isNullable(operand.e)) {
-          list.add(
-              translator.translate(
-                  operand.e, NullAs.IS_NOT_NULL));
-          translator = translator.setNullable(operand.e, false);
-        }
-      }
-      list.add(implementCall(translator, call, implementor, nullAs));
-      return Expressions.foldAnd(list);
-    case TRUE:
-      // v0 == null || v1 == null || f(v0, v1)
-      for (Ord<RexNode> operand : Ord.zip(call.getOperands())) {
-        if (translator.isNullable(operand.e)) {
-          list.add(
-              translator.translate(
-                  operand.e, NullAs.IS_NULL));
-          translator = translator.setNullable(operand.e, false);
-        }
-      }
-      list.add(implementCall(translator, call, implementor, nullAs));
-      return Expressions.foldOr(list);
-    case NOT_POSSIBLE:
-      // Need to transmit to the implementor the fact that call cannot
-      // return null. In particular, it should return a primitive (e.g.
-      // int) rather than a box type (Integer).
-      // The cases with setNullable above might not help since the same
-      // RexNode can be referred via multiple ways: RexNode itself, RexLocalRef,
-      // and may be others.
-      final Map<RexNode, Boolean> nullable = new HashMap<>();
-      if (nullPolicy == NullPolicy.STRICT) {
-        // The arguments should be not nullable if STRICT operator is computed
-        // in nulls NOT_POSSIBLE mode
-        for (RexNode arg : call.getOperands()) {
-          if (translator.isNullable(arg) && !nullable.containsKey(arg)) {
-            nullable.put(arg, false);
-          }
-        }
-      }
-      nullable.put(call, false);
-      translator = translator.setNullable(nullable);
-      // fall through
-    default:
-      return implementCall(translator, call, implementor, nullAs);
-    }
-  }
-
-  private static Expression implementCall(
-      RexToLixTranslator translator,
-      RexCall call,
-      NotNullImplementor implementor,
-      NullAs nullAs) {
-    final List<Expression> translatedOperands =
-        translator.translateList(call.getOperands());
-    Expression result =
-        implementor.implement(translator, call, translatedOperands);
-    return nullAs.handle(result);
-  }
-
-  /** Strategy what an operator should return if one of its
-   * arguments is null. */
-  public enum NullAs {
-    /** The most common policy among the SQL built-in operators. If
-     * one of the arguments is null, returns null. */
-    NULL,
-
-    /** If one of the arguments is null, the function returns
-     * false. Example: {@code IS NOT NULL}. */
-    FALSE,
-
-    /** If one of the arguments is null, the function returns
-     * true. Example: {@code IS NULL}. */
-    TRUE,
-
-    /** It is not possible for any of the arguments to be null.  If
-     * the argument type is nullable, the enclosing code will already
-     * have performed a not-null check. This may allow the operator
-     * implementor to generate a more efficient implementation, for
-     * example, by avoiding boxing or unboxing. */
-    NOT_POSSIBLE,
-
-    /** Return false if result is not null, true if result is null. */
-    IS_NULL,
-
-    /** Return true if result is not null, false if result is null. */
-    IS_NOT_NULL;
-
-    public static NullAs of(boolean nullable) {
-      return nullable ? NULL : NOT_POSSIBLE;
-    }
-
-    /** Adapts an expression with "normal" result to one that adheres to
-     * this particular policy. */
-    public Expression handle(Expression x) {
-      switch (Primitive.flavor(x.getType())) {
-      case PRIMITIVE:
-        // Expression cannot be null. We can skip any runtime checks.
-        switch (this) {
-        case NULL:
-        case NOT_POSSIBLE:
-        case FALSE:
-        case TRUE:
-          return x;
-        case IS_NULL:
-          return FALSE_EXPR;
-        case IS_NOT_NULL:
-          return TRUE_EXPR;
-        default:
-          throw new AssertionError();
-        }
-      case BOX:
-        switch (this) {
-        case NOT_POSSIBLE:
-          return RexToLixTranslator.convert(
-              x,
-              Primitive.ofBox(x.getType()).primitiveClass);
-        }
-        // fall through
-      }
-      switch (this) {
-      case NULL:
-      case NOT_POSSIBLE:
-        return x;
-      case FALSE:
-        return Expressions.call(
-            BuiltInMethod.IS_TRUE.method,
-            x);
-      case TRUE:
-        return Expressions.call(
-            BuiltInMethod.IS_NOT_FALSE.method,
-            x);
-      case IS_NULL:
-        return Expressions.equal(x, NULL_EXPR);
-      case IS_NOT_NULL:
-        return Expressions.notEqual(x, NULL_EXPR);
-      default:
-        throw new AssertionError();
-      }
-    }
-  }
-
-  static Expression getDefaultValue(Type type) {
-    if (Primitive.is(type)) {
-      Primitive p = Primitive.of(type);
-      return Expressions.constant(p.defaultValue, type);
-    }
-    return Expressions.constant(null, type);
-  }
-
-  /** Multiplies an expression by a constant and divides by another constant,
-   * optimizing appropriately.
-   *
-   * <p>For example, {@code multiplyDivide(e, 10, 1000)} returns
-   * {@code e / 100}. */
-  public static Expression multiplyDivide(Expression e, BigDecimal multiplier,
-      BigDecimal divider) {
-    if (multiplier.equals(BigDecimal.ONE)) {
-      if (divider.equals(BigDecimal.ONE)) {
-        return e;
-      }
-      return Expressions.divide(e,
-          Expressions.constant(divider.intValueExact()));
-    }
-    final BigDecimal x =
-        multiplier.divide(divider, RoundingMode.UNNECESSARY);
-    switch (x.compareTo(BigDecimal.ONE)) {
-    case 0:
-      return e;
-    case 1:
-      return Expressions.multiply(e, Expressions.constant(x.intValueExact()));
-    case -1:
-      return multiplyDivide(e, BigDecimal.ONE, x);
-    default:
-      throw new AssertionError();
-    }
-  }
-
-  /** Implementor for the {@code COUNT} aggregate function. */
-  static class CountImplementor extends StrictAggImplementor {
-    @Override public void implementNotNullAdd(AggContext info,
-        AggAddContext add) {
-      add.currentBlock().add(
-          Expressions.statement(
-              Expressions.postIncrementAssign(add.accumulator().get(0))));
-    }
-  }
-
-  /** Implementor for the {@code COUNT} windowed aggregate function. */
-  static class CountWinImplementor extends StrictWinAggImplementor {
-    boolean justFrameRowCount;
-
-    @Override public List<Type> getNotNullState(WinAggContext info) {
-      boolean hasNullable = false;
-      for (RelDataType type : info.parameterRelTypes()) {
-        if (type.isNullable()) {
-          hasNullable = true;
-          break;
-        }
-      }
-      if (!hasNullable) {
-        justFrameRowCount = true;
-        return Collections.emptyList();
-      }
-      return super.getNotNullState(info);
-    }
-
-    @Override public void implementNotNullAdd(WinAggContext info,
-        WinAggAddContext add) {
-      if (justFrameRowCount) {
-        return;
-      }
-      add.currentBlock().add(
-          Expressions.statement(
-              Expressions.postIncrementAssign(add.accumulator().get(0))));
-    }
-
-    @Override protected Expression implementNotNullResult(WinAggContext info,
-        WinAggResultContext result) {
-      if (justFrameRowCount) {
-        return result.getFrameRowCount();
-      }
-      return super.implementNotNullResult(info, result);
-    }
-  }
-
-  /** Implementor for the {@code SUM} windowed aggregate function. */
-  static class SumImplementor extends StrictAggImplementor {
-    @Override protected void implementNotNullReset(AggContext info,
-        AggResetContext reset) {
-      Expression start = info.returnType() == BigDecimal.class
-          ? Expressions.constant(BigDecimal.ZERO)
-          : Expressions.constant(0);
-
-      reset.currentBlock().add(
-          Expressions.statement(
-              Expressions.assign(reset.accumulator().get(0), start)));
-    }
-
-    @Override public void implementNotNullAdd(AggContext info,
-        AggAddContext add) {
-      Expression acc = add.accumulator().get(0);
-      Expression next;
-      if (info.returnType() == BigDecimal.class) {
-        next = Expressions.call(acc, "add", add.arguments().get(0));
-      } else {
-        next = Expressions.add(acc,
-            Types.castIfNecessary(acc.type, add.arguments().get(0)));
-      }
-      accAdvance(add, acc, next);
-    }
-
-    @Override public Expression implementNotNullResult(AggContext info,
-        AggResultContext result) {
-      return super.implementNotNullResult(info, result);
-    }
-  }
-
-  /** Implementor for the {@code MIN} and {@code MAX} aggregate functions. */
-  static class MinMaxImplementor extends StrictAggImplementor {
-    @Override protected void implementNotNullReset(AggContext info,
-        AggResetContext reset) {
-      Expression acc = reset.accumulator().get(0);
-      Primitive p = Primitive.of(acc.getType());
-      boolean isMin = MIN == info.aggregation();
-      Object inf = p == null ? null : (isMin ? p.max : p.min);
-      reset.currentBlock().add(
-          Expressions.statement(
-              Expressions.assign(acc,
-                  Expressions.constant(inf, acc.getType()))));
-    }
-
-    @Override public void implementNotNullAdd(AggContext info,
-        AggAddContext add) {
-      Expression acc = add.accumulator().get(0);
-      Expression arg = add.arguments().get(0);
-      SqlAggFunction aggregation = info.aggregation();
-      final Method method = (aggregation == MIN
-          ? BuiltInMethod.LESSER
-          : BuiltInMethod.GREATER).method;
-      Expression next = Expressions.call(
-          method.getDeclaringClass(),
-          method.getName(),
-          acc,
-          Expressions.unbox(arg));
-      accAdvance(add, acc, next);
-    }
-  }
-
-  /** Implementor for the {@code SINGLE_VALUE} aggregate function. */
-  static class SingleValueImplementor implements AggImplementor {
-    public List<Type> getStateType(AggContext info) {
-      return Arrays.asList(boolean.class, info.returnType());
-    }
-
-    public void implementReset(AggContext info, AggResetContext reset) {
-      List<Expression> acc = reset.accumulator();
-      reset.currentBlock().add(
-          Expressions.statement(
-              Expressions.assign(acc.get(0), Expressions.constant(false))));
-      reset.currentBlock().add(
-          Expressions.statement(
-              Expressions.assign(acc.get(1),
-                  getDefaultValue(acc.get(1).getType()))));
-    }
-
-    public void implementAdd(AggContext info, AggAddContext add) {
-      List<Expression> acc = add.accumulator();
-      Expression flag = acc.get(0);
-      add.currentBlock().add(
-          Expressions.ifThen(flag,
-              Expressions.throw_(
-                  Expressions.new_(IllegalStateException.class,
-                      Expressions.constant("more than one value in agg "
-                          + info.aggregation())))));
-      add.currentBlock().add(
-          Expressions.statement(
-              Expressions.assign(flag, Expressions.constant(true))));
-      add.currentBlock().add(
-          Expressions.statement(
-              Expressions.assign(acc.get(1), add.arguments().get(0))));
-    }
-
-    public Expression implementResult(AggContext info,
-        AggResultContext result) {
-      return RexToLixTranslator.convert(result.accumulator().get(1),
-          info.returnType());
-    }
-  }
-
-  /** Implementor for the {@code COLLECT} aggregate function. */
-  static class CollectImplementor extends StrictAggImplementor {
-    @Override protected void implementNotNullReset(AggContext info,
-        AggResetContext reset) {
-      // acc[0] = new ArrayList();
-      reset.currentBlock().add(
-          Expressions.statement(
-              Expressions.assign(reset.accumulator().get(0),
-                  Expressions.new_(ArrayList.class))));
-    }
-
-    @Override public void implementNotNullAdd(AggContext info,
-        AggAddContext add) {
-      // acc[0].add(arg);
-      add.currentBlock().add(
-          Expressions.statement(
-              Expressions.call(add.accumulator().get(0),
-                  BuiltInMethod.COLLECTION_ADD.method,
-                  add.arguments().get(0))));
-    }
-  }
-
-  /** Implementor for user-defined aggregate functions. */
-  public static class UserDefinedAggReflectiveImplementor
-      extends StrictAggImplementor {
-    private final AggregateFunctionImpl afi;
-
-    public UserDefinedAggReflectiveImplementor(AggregateFunctionImpl afi) {
-      this.afi = afi;
-    }
-
-    @Override public List<Type> getNotNullState(AggContext info) {
-      if (afi.isStatic) {
-        return Collections.<Type>singletonList(afi.accumulatorType);
-      }
-      return Arrays.<Type>asList(afi.accumulatorType, afi.declaringClass);
-    }
-
-    @Override protected void implementNotNullReset(AggContext info,
-        AggResetContext reset) {
-      List<Expression> acc = reset.accumulator();
-      if (!afi.isStatic) {
-        reset.currentBlock().add(
-            Expressions.statement(
-                Expressions.assign(acc.get(1),
-                    Expressions.new_(afi.declaringClass))));
-      }
-      reset.currentBlock().add(
-          Expressions.statement(
-              Expressions.assign(acc.get(0),
-                  Expressions.call(afi.isStatic
-                      ? null
-                      : acc.get(1), afi.initMethod))));
-    }
-
-    @Override protected void implementNotNullAdd(AggContext info,
-        AggAddContext add) {
-      List<Expression> acc = add.accumulator();
-      List<Expression> aggArgs = add.arguments();
-      List<Expression> args = new ArrayList<>(aggArgs.size() + 1);
-      args.add(acc.get(0));
-      args.addAll(aggArgs);
-      add.currentBlock().add(
-          Expressions.statement(
-              Expressions.assign(acc.get(0),
-              Expressions.call(afi.isStatic ? null : acc.get(1), afi.addMethod,
-                  args))));
-    }
-
-    @Override protected Expression implementNotNullResult(AggContext info,
-        AggResultContext result) {
-      List<Expression> acc = result.accumulator();
-      return Expressions.call(
-          afi.isStatic ? null : acc.get(1), afi.resultMethod, acc.get(0));
-    }
-  }
-
-  /** Implementor for the {@code RANK} windowed aggregate function. */
-  static class RankImplementor extends StrictWinAggImplementor {
-    @Override protected void implementNotNullAdd(WinAggContext info,
-        WinAggAddContext add) {
-      Expression acc = add.accumulator().get(0);
-      // This is an example of the generated code
-      if (false) {
-        new Object() {
-          int curentPosition; // position in for-win-agg-loop
-          int startIndex;     // index of start of window
-          Comparable[] rows;  // accessed via WinAggAddContext.compareRows
-          {
-            if (curentPosition > startIndex) {
-              if (rows[curentPosition - 1].compareTo(rows[curentPosition]) > 0)
-              {
-                // update rank
-              }
-            }
-          }
-        };
-      }
-      BlockBuilder builder = add.nestBlock();
-      add.currentBlock().add(
-          Expressions.ifThen(
-              Expressions.lessThan(
-                  add.compareRows(
-                      Expressions.subtract(add.currentPosition(),
-                          Expressions.constant(1)),
-                      add.currentPosition()),
-              Expressions.constant(0)),
-          Expressions.statement(
-              Expressions.assign(acc, computeNewRank(acc, add)))));
-      add.exitBlock();
-      add.currentBlock().add(
-          Expressions.ifThen(
-              Expressions.greaterThan(add.currentPosition(),
-                  add.startIndex()),
-              builder.toBlock()));
-    }
-
-    protected Expression computeNewRank(Expression acc, WinAggAddContext add) {
-      Expression pos = add.currentPosition();
-      if (!add.startIndex().equals(Expressions.constant(0))) {
-        // In general, currentPosition-startIndex should be used
-        // However, rank/dense_rank does not allow preceding/following clause
-        // so we always result in startIndex==0.
-        pos = Expressions.subtract(pos, add.startIndex());
-      }
-      return pos;
-    }
-
-    @Override protected Expression implementNotNullResult(
-        WinAggContext info, WinAggResultContext result) {
-      // Rank is 1-based
-      return Expressions.add(super.implementNotNullResult(info, result),
-          Expressions.constant(1));
-    }
-  }
-
-  /** Implementor for the {@code DENSE_RANK} windowed aggregate function. */
-  static class DenseRankImplementor extends RankImplementor {
-    @Override protected Expression computeNewRank(Expression acc,
-        WinAggAddContext add) {
-      return Expressions.add(acc, Expressions.constant(1));
-    }
-  }
-
-  /** Implementor for the {@code FIRST_VALUE} and {@code LAST_VALUE}
-   * windowed aggregate functions. */
-  static class FirstLastValueImplementor implements WinAggImplementor {
-    private final SeekType seekType;
-
-    protected FirstLastValueImplementor(SeekType seekType) {
-      this.seekType = seekType;
-    }
-
-    public List<Type> getStateType(AggContext info) {
-      return Collections.emptyList();
-    }
-
-    public void implementReset(AggContext info, AggResetContext reset) {
-      // no op
-    }
-
-    public void implementAdd(AggContext info, AggAddContext add) {
-      // no op
-    }
-
-    public boolean needCacheWhenFrameIntact() {
-      return true;
-    }
-
-    public Expression implementResult(AggContext info,
-        AggResultContext result) {
-      WinAggResultContext winResult = (WinAggResultContext) result;
-
-      return Expressions.condition(winResult.hasRows(),
-          winResult.rowTranslator(
-              winResult.computeIndex(Expressions.constant(0), seekType))
-              .translate(winResult.rexArguments().get(0), info.returnType()),
-          getDefaultValue(info.returnType()));
-    }
-  }
-
-  /** Implementor for the {@code FIRST_VALUE} windowed aggregate function. */
-  static class FirstValueImplementor extends FirstLastValueImplementor {
-    protected FirstValueImplementor() {
-      super(SeekType.START);
-    }
-  }
-
-  /** Implementor for the {@code LAST_VALUE} windowed aggregate function. */
-  static class LastValueImplementor extends FirstLastValueImplementor {
-    protected LastValueImplementor() {
-      super(SeekType.END);
-    }
-  }
-
-  /** Implementor for the {@code LEAD} and {@code LAG} windowed
-   * aggregate functions. */
-  static class LeadLagImplementor implements WinAggImplementor {
-    private final boolean isLead;
-
-    protected LeadLagImplementor(boolean isLead) {
-      this.isLead = isLead;
-    }
-
-    public List<Type> getStateType(AggContext info) {
-      return Collections.emptyList();
-    }
-
-    public void implementReset(AggContext info, AggResetContext reset) {
-      // no op
-    }
-
-    public void implementAdd(AggContext info, AggAddContext add) {
-      // no op
-    }
-
-    public boolean needCacheWhenFrameIntact() {
-      return false;
-    }
-
-    public Expression implementResult(AggContext info,
-        AggResultContext result) {
-      WinAggResultContext winResult = (WinAggResultContext) result;
-
-      List<RexNode> rexArgs = winResult.rexArguments();
-
-      ParameterExpression res = Expressions.parameter(0, info.returnType(),
-          result.currentBlock().newName(isLead ? "lead" : "lag"));
-
-      Expression offset;
-      RexToLixTranslator currentRowTranslator =
-          winResult.rowTranslator(
-              winResult.computeIndex(Expressions.constant(0), SeekType.SET));
-      if (rexArgs.size() >= 2) {
-        // lead(x, offset) or lead(x, offset, default)
-        offset = currentRowTranslator.translate(
-            rexArgs.get(1), int.class);
-      } else {
-        offset = Expressions.constant(1);
-      }
-      if (!isLead) {
-        offset = Expressions.negate(offset);
-      }
-      Expression dstIndex = winResult.computeIndex(offset, SeekType.SET);
-
-      Expression rowInRange = winResult.rowInPartition(dstIndex);
-
-      BlockBuilder thenBlock = result.nestBlock();
-      Expression lagResult = winResult.rowTranslator(dstIndex).translate(
-          rexArgs.get(0), res.type);
-      thenBlock.add(Expressions.statement(Expressions.assign(res, lagResult)));
-      result.exitBlock();
-      BlockStatement thenBranch = thenBlock.toBlock();
-
-      Expression defaultValue = rexArgs.size() == 3
-          ? currentRowTranslator.translate(rexArgs.get(2), res.type)
-          : getDefaultValue(res.type);
-
-      result.currentBlock().add(Expressions.declare(0, res, null));
-      result.currentBlock().add(
-          Expressions.ifThenElse(rowInRange, thenBranch,
-              Expressions.statement(Expressions.assign(res, defaultValue))));
-      return res;
-    }
-  }
-
-  /** Implementor for the {@code LEAD} windowed aggregate function. */
-  public static class LeadImplementor extends LeadLagImplementor {
-    protected LeadImplementor() {
-      super(true);
-    }
-  }
-
-  /** Implementor for the {@code LAG} windowed aggregate function. */
-  public static class LagImplementor extends LeadLagImplementor {
-    protected LagImplementor() {
-      super(false);
-    }
-  }
-
-  /** Implementor for the {@code NTILE} windowed aggregate function. */
-  static class NtileImplementor implements WinAggImplementor {
-    public List<Type> getStateType(AggContext info) {
-      return Collections.emptyList();
-    }
-
-    public void implementReset(AggContext info, AggResetContext reset) {
-      // no op
-    }
-
-    public void implementAdd(AggContext info, AggAddContext add) {
-      // no op
-    }
-
-    public boolean needCacheWhenFrameIntact() {
-      return false;
-    }
-
-    public Expression implementResult(AggContext info,
-        AggResultContext result) {
-      WinAggResultContext winResult = (WinAggResultContext) result;
-
-      List<RexNode> rexArgs = winResult.rexArguments();
-
-      Expression tiles =
-          winResult.rowTranslator(winResult.index()).translate(
-              rexArgs.get(0), int.class);
-
-      Expression ntile =
-          Expressions.add(Expressions.constant(1),
-              Expressions.divide(
-                  Expressions.multiply(
-                      tiles,
-                      Expressions.subtract(
-                          winResult.index(), winResult.startIndex())),
-                  winResult.getPartitionRowCount()));
-
-      return ntile;
-    }
-  }
-
-  /** Implementor for the {@code ROW_NUMBER} windowed aggregate function. */
-  static class RowNumberImplementor extends StrictWinAggImplementor {
-    @Override public List<Type> getNotNullState(WinAggContext info) {
-      return Collections.emptyList();
-    }
-
-    @Override protected void implementNotNullAdd(WinAggContext info,
-        WinAggAddContext add) {
-      // no op
-    }
-
-    @Override protected Expression implementNotNullResult(
-        WinAggContext info, WinAggResultContext result) {
-      // Window cannot be empty since ROWS/RANGE is not possible for ROW_NUMBER
-      return Expressions.add(
-          Expressions.subtract(result.index(), result.startIndex()),
-          Expressions.constant(1));
-    }
-  }
-
-  /** Implementor for the {@code TRIM} function. */
-  private static class TrimImplementor implements NotNullImplementor {
-    public Expression implement(RexToLixTranslator translator, RexCall call,
-        List<Expression> translatedOperands) {
-      final Object value =
-          ((ConstantExpression) translatedOperands.get(0)).value;
-      SqlTrimFunction.Flag flag = (SqlTrimFunction.Flag) value;
-      return Expressions.call(
-          BuiltInMethod.TRIM.method,
-          Expressions.constant(
-              flag == SqlTrimFunction.Flag.BOTH
-              || flag == SqlTrimFunction.Flag.LEADING),
-          Expressions.constant(
-              flag == SqlTrimFunction.Flag.BOTH
-              || flag == SqlTrimFunction.Flag.TRAILING),
-          translatedOperands.get(1),
-          translatedOperands.get(2));
-    }
-  }
-
-  /** Implementor for the {@code FLOOR} and {@code CEIL} functions. */
-  private static class FloorImplementor extends MethodNameImplementor {
-    final Method timestampMethod;
-    final Method dateMethod;
-
-    FloorImplementor(String methodName, Method timestampMethod,
-        Method dateMethod) {
-      super(methodName);
-      this.timestampMethod = timestampMethod;
-      this.dateMethod = dateMethod;
-    }
-
-    public Expression implement(RexToLixTranslator translator, RexCall call,
-        List<Expression> translatedOperands) {
-      switch (call.getOperands().size()) {
-      case 1:
-        switch (call.getType().getSqlTypeName()) {
-        case BIGINT:
-        case INTEGER:
-        case SMALLINT:
-        case TINYINT:
-          return translatedOperands.get(0);
-        }
-        return super.implement(translator, call, translatedOperands);
-      case 2:
-        final Type type;
-        final Method floorMethod;
-        switch (call.getType().getSqlTypeName()) {
-        case TIMESTAMP:
-          type = long.class;
-          floorMethod = timestampMethod;
-          break;
-        default:
-          type = int.class;
-          floorMethod = dateMethod;
-        }
-        final ConstantExpression tur =
-            (ConstantExpression) translatedOperands.get(1);
-        final TimeUnitRange timeUnitRange = (TimeUnitRange) tur.value;
-        switch (timeUnitRange) {
-        case YEAR:
-        case MONTH:
-          return Expressions.call(floorMethod, tur,
-              call(translatedOperands, type, TimeUnit.DAY));
-        default:
-          return call(translatedOperands, type, timeUnitRange.startUnit);
-        }
-      default:
-        throw new AssertionError();
-      }
-    }
-
-    private Expression call(List<Expression> translatedOperands, Type type,
-        TimeUnit timeUnit) {
-      return Expressions.call(SqlFunctions.class, methodName,
-          Types.castIfNecessary(type, translatedOperands.get(0)),
-          Types.castIfNecessary(type,
-              Expressions.constant(timeUnit.multiplier)));
-    }
-  }
-
-  /** Implementor for a function that generates calls to a given method. */
-  private static class MethodImplementor implements NotNullImplementor {
-    protected final Method method;
-
-    MethodImplementor(Method method) {
-      this.method = method;
-    }
-
-    public Expression implement(
-        RexToLixTranslator translator,
-        RexCall call,
-        List<Expression> translatedOperands) {
-      final Expression expression;
-      if (Modifier.isStatic(method.getModifiers())) {
-        expression = Expressions.call(method, translatedOperands);
-      } else {
-        expression = Expressions.call(translatedOperands.get(0), method,
-            Util.skip(translatedOperands, 1));
-      }
-
-      final Type returnType =
-          translator.typeFactory.getJavaClass(call.getType());
-      return Types.castIfNecessary(returnType, expression);
-    }
-  }
-
-  /** Implementor for a function that generates calls to a given method. */
-  private static class SequenceImplementor extends MethodImplementor {
-    SequenceImplementor(Method method) {
-      super(method);
-    }
-
-    public Expression implement(
-        RexToLixTranslator translator,
-        RexCall call,
-        List<Expression> translatedOperands) {
-      assert translatedOperands.size() == 1;
-      ConstantExpression x = (ConstantExpression) translatedOperands.get(0);
-      List<String> names = Util.stringToList((String) x.value);
-      final Prepare.CatalogReader catalogReader =
-          Prepare.CatalogReader.THREAD_LOCAL.get();
-      RelOptTable table = catalogReader.getTable(names);
-      System.out.println("Now, do something with table " + table);
-      return super.implement(translator, call, translatedOperands);
-    }
-  }
-
-  /** Implementor for SQL functions that generates calls to a given method name.
-   *
-   * <p>Use this, as opposed to {@link MethodImplementor}, if the SQL function
-   * is overloaded; then you can use one implementor for several overloads. */
-  private static class MethodNameImplementor implements NotNullImplementor {
-    protected final String methodName;
-
-    MethodNameImplementor(String methodName) {
-      this.methodName = methodName;
-    }
-
-    public Expression implement(
-        RexToLixTranslator translator,
-        RexCall call,
-        List<Expression> translatedOperands) {
-      return Expressions.call(
-          SqlFunctions.class,
-          methodName,
-          translatedOperands);
-    }
-  }
-
-  /** Implementor for binary operators. */
-  private static class BinaryImplementor implements NotNullImplementor {
-    /** Types that can be arguments to comparison operators such as
-     * {@code <}. */
-    private static final List<Primitive> COMP_OP_TYPES =
-        ImmutableList.of(
-            Primitive.BYTE,
-            Primitive.CHAR,
-            Primitive.SHORT,
-            Primitive.INT,
-            Primitive.LONG,
-            Primitive.FLOAT,
-            Primitive.DOUBLE);
-
-    private static final List<SqlBinaryOperator> COMPARISON_OPERATORS =
-        ImmutableList.of(
-            SqlStdOperatorTable.LESS_THAN,
-            SqlStdOperatorTable.LESS_THAN_OR_EQUAL,
-            SqlStdOperatorTable.GREATER_THAN,
-            SqlStdOperatorTable.GREATER_THAN_OR_EQUAL);
-    public static final String METHOD_POSTFIX_FOR_ANY_TYPE = "Any";
-
-    private final ExpressionType expressionType;
-    private final String backupMethodName;
-
-    BinaryImplementor(
-        ExpressionType expressionType,
-        String backupMethodName) {
-      this.expressionType = expressionType;
-      this.backupMethodName = backupMethodName;
-    }
-
-    public Expression implement(
-        RexToLixTranslator translator,
-        RexCall call,
-        List<Expression> expressions) {
-      // neither nullable:
-      //   return x OP y
-      // x nullable
-      //   null_returns_null
-      //     return x == null ? null : x OP y
-      //   ignore_null
-      //     return x == null ? null : y
-      // x, y both nullable
-      //   null_returns_null
-      //     return x == null || y == null ? null : x OP y
-      //   ignore_null
-      //     return x == null ? y : y == null ? x : x OP y
-      if (backupMethodName != null) {
-        // If one or both operands have ANY type, use the late-binding backup
-        // method.
-        if (anyAnyOperands(call)) {
-          return callBackupMethodAnyType(translator, call, expressions);
-        }
-
-        final Type type0 = expressions.get(0).getType();
-        final Type type1 = expressions.get(1).getType();
-        final SqlBinaryOperator op = (SqlBinaryOperator) call.getOperator();
-        final Primitive primitive = Primitive.ofBoxOr(type0);
-        if (primitive == null
-            || type1 == BigDecimal.class
-            || COMPARISON_OPERATORS.contains(op)
-            && !COMP_OP_TYPES.contains(primitive)) {
-          return Expressions.call(SqlFunctions.class, backupMethodName,
-              expressions);
-        }
-      }
-
-      final Type returnType =
-          translator.typeFactory.getJavaClass(call.getType());
-      return Types.castIfNecessary(returnType,
-          Expressions.makeBinary(expressionType, expressions.get(0),
-              expressions.get(1)));
-    }
-
-    /** Returns whether any of a call's operands have ANY type. */
-    private boolean anyAnyOperands(RexCall call) {
-      for (RexNode operand : call.operands) {
-        if (operand.getType().getSqlTypeName() == SqlTypeName.ANY) {
-          return true;
-        }
-      }
-      return false;
-    }
-
-    private Expression callBackupMethodAnyType(RexToLixTranslator translator,
-        RexCall call, List<Expression> expressions) {
-      final String backupMethodNameForAnyType =
-          backupMethodName + METHOD_POSTFIX_FOR_ANY_TYPE;
-
-      // one or both of parameter(s) is(are) ANY type
-      final Expression expression0 = maybeBox(expressions.get(0));
-      final Expression expression1 = maybeBox(expressions.get(1));
-      return Expressions.call(SqlFunctions.class, backupMethodNameForAnyType,
-          expression0, expression1);
-    }
-
-    private Expression maybeBox(Expression expression) {
-      final Primitive primitive = Primitive.of(expression.getType());
-      if (primitive != null) {
-        expression = Expressions.box(expression, primitive);
-      }
-      return expression;
-    }
-  }
-
-  /** Implementor for unary operators. */
-  private static class UnaryImplementor implements NotNullImplementor {
-    private final ExpressionType expressionType;
-
-    UnaryImplementor(ExpressionType expressionType) {
-      this.expressionType = expressionType;
-    }
-
-    public Expression implement(
-        RexToLixTranslator translator,
-        RexCall call,
-        List<Expression> translatedOperands) {
-      return Expressions.makeUnary(
-          expressionType,
-          translatedOperands.get(0));
-    }
-  }
-
-  /** Implementor for the SQL {@code CASE} operator. */
-  private static class CaseImplementor implements CallImplementor {
-    public Expression implement(RexToLixTranslator translator, RexCall call,
-        NullAs nullAs) {
-      return implementRecurse(translator, call, nullAs, 0);
-    }
-
-    private Expression implementRecurse(RexToLixTranslator translator,
-        RexCall call, NullAs nullAs, int i) {
-      List<RexNode> operands = call.getOperands();
-      if (i == operands.size() - 1) {
-        // the "else" clause
-        return translator.translate(
-            translator.builder.ensureType(
-                call.getType(), operands.get(i), false), nullAs);
-      } else {
-        Expression ifTrue;
-        try {
-          ifTrue = translator.translate(
-              translator.builder.ensureType(call.getType(),
-                  operands.get(i + 1),
-                  false), nullAs);
-        } catch (RexToLixTranslator.AlwaysNull e) {
-          ifTrue = null;
-        }
-
-        Expression ifFalse;
-        try {
-          ifFalse = implementRecurse(translator, call, nullAs, i + 2);
-        } catch (RexToLixTranslator.AlwaysNull e) {
-          if (ifTrue == null) {
-            throw RexToLixTranslator.AlwaysNull.INSTANCE;
-          }
-          ifFalse = null;
-        }
-
-        Expression test = translator.translate(operands.get(i), NullAs.FALSE);
-
-        return ifTrue == null || ifFalse == null
-            ? Util.first(ifTrue, ifFalse)
-            : Expressions.condition(test, ifTrue, ifFalse);
-      }
-    }
-  }
-
-  /** Implementor for the SQL {@code CAST} function that optimizes if, say, the
-   * argument is already of the desired type. */
-  private static class CastOptimizedImplementor implements CallImplementor {
-    private final CallImplementor accurate;
-
-    private CastOptimizedImplementor() {
-      accurate = createImplementor(new CastImplementor(),
-          NullPolicy.STRICT, false);
-    }
-
-    public Expression implement(RexToLixTranslator translator, RexCall call,
-        NullAs nullAs) {
-      // Short-circuit if no cast is required
-      RexNode arg = call.getOperands().get(0);
-      if (call.getType().equals(arg.getType())) {
-        // No cast required, omit cast
-        return translator.translate(arg, nullAs);
-      }
-      if (SqlTypeUtil.equalSansNullability(translator.typeFactory,
-              call.getType(), arg.getType())
-          && nullAs == NullAs.NULL
-          && translator.deref(arg) instanceof RexLiteral) {
-        return RexToLixTranslator.translateLiteral(
-            (RexLiteral) translator.deref(arg), call.getType(),
-            translator.typeFactory, nullAs);
-      }
-      return accurate.implement(translator, call, nullAs);
-    }
-  }
-
-  /** Implementor for the SQL {@code CAST} operator. */
-  private static class CastImplementor implements NotNullImplementor {
-    public Expression implement(
-        RexToLixTranslator translator,
-        RexCall call,
-        List<Expression> translatedOperands) {
-      assert call.getOperands().size() == 1;
-      final RelDataType sourceType = call.getOperands().get(0).getType();
-      // It's only possible for the result to be null if both expression
-      // and target type are nullable. We assume that the caller did not
-      // make a mistake. If expression looks nullable, caller WILL have
-      // checked that expression is not null before calling us.
-      final boolean nullable =
-          translator.isNullable(call)
-              && sourceType.isNullable()
-              && !Primitive.is(translatedOperands.get(0).getType());
-      final RelDataType targetType =
-          translator.nullifyType(call.getType(), nullable);
-      return translator.translateCast(sourceType,
-          targetType,
-          translatedOperands.get(0));
-    }
-  }
-
-  /** Implementor for the {@code REINTERPRET} internal SQL operator. */
-  private static class ReinterpretImplementor implements NotNullImplementor {
-    public Expression implement(
-        RexToLixTranslator translator,
-        RexCall call,
-        List<Expression> translatedOperands) {
-      assert call.getOperands().size() == 1;
-      return translatedOperands.get(0);
-    }
-  }
-
-  /** Implementor for a value-constructor. */
-  private static class ValueConstructorImplementor
-      implements CallImplementor {
-    public Expression implement(
-        RexToLixTranslator translator,
-        RexCall call,
-        NullAs nullAs) {
-      return translator.translateConstructor(call.getOperands(),
-          call.getOperator().getKind());
-    }
-  }
-
-  /** Implementor for the {@code ITEM} SQL operator. */
-  private static class ItemImplementor
-      implements CallImplementor {
-    public Expression implement(
-        RexToLixTranslator translator,
-        RexCall call,
-        NullAs nullAs) {
-      final MethodImplementor implementor =
-          getImplementor(
-              call.getOperands().get(0).getType().getSqlTypeName());
-      // Since we follow PostgreSQL's semantics that an out-of-bound reference
-      // returns NULL, x[y] can return null even if x and y are both NOT NULL.
-      // (In SQL standard semantics, an out-of-bound reference to an array
-      // throws an exception.)
-      final NullPolicy nullPolicy = NullPolicy.ANY;
-      return implementNullSemantics0(translator, call, nullAs, nullPolicy,
-          false, implementor);
-    }
-
-    private MethodImplementor getImplementor(SqlTypeName sqlTypeName) {
-      switch (sqlTypeName) {
-      case ARRAY:
-        return new MethodImplementor(BuiltInMethod.ARRAY_ITEM.method);
-      case MAP:
-        return new MethodImplementor(BuiltInMethod.MAP_ITEM.method);
-      default:
-        return new MethodImplementor(BuiltInMethod.ANY_ITEM.method);
-      }
-    }
-  }
-
-    /** Implementor for SQL system functions.
-     *
-     * <p>Several of these are represented internally as constant values, set
-     * per execution. */
-  private static class SystemFunctionImplementor
-      implements CallImplementor {
-    public Expression implement(
-        RexToLixTranslator translator,
-        RexCall call,
-        NullAs nullAs) {
-      switch (nullAs) {
-      case IS_NULL:
-        return Expressions.constant(false);
-      case IS_NOT_NULL:
-        return Expressions.constant(true);
-      }
-      final SqlOperator op = call.getOperator();
-      final Expression root = translator.getRoot();
-      if (op == CURRENT_USER
-          || op == SESSION_USER
-          || op == USER) {
-        return Expressions.constant("sa");
-      } else if (op == SYSTEM_USER) {
-        return Expressions.constant(System.getProperty("user.name"));
-      } else if (op == CURRENT_PATH
-          || op == CURRENT_ROLE
-          || op == CURRENT_CATALOG) {
-        // By default, the CURRENT_ROLE and CURRENT_CATALOG functions return the
-        // empty string because a role or a catalog has to be set explicitly.
-        return Expressions.constant("");
-      } else if (op == CURRENT_TIMESTAMP) {
-        return Expressions.call(BuiltInMethod.CURRENT_TIMESTAMP.method, root);
-      } else if (op == CURRENT_TIME) {
-        return Expressions.call(BuiltInMethod.CURRENT_TIME.method, root);
-      } else if (op == CURRENT_DATE) {
-        return Expressions.call(BuiltInMethod.CURRENT_DATE.method, root);
-      } else if (op == LOCALTIMESTAMP) {
-        return Expressions.call(BuiltInMethod.LOCAL_TIMESTAMP.method, root);
-      } else if (op == LOCALTIME) {
-        return Expressions.call(BuiltInMethod.LOCAL_TIME.method, root);
-      } else {
-        throw new AssertionError("unknown function " + op);
-      }
-    }
-  }
-
-  /** Implements "IS XXX" operations such as "IS NULL"
-   * or "IS NOT TRUE".
-   *
-   * <p>What these operators have in common:</p>
-   * 1. They return TRUE or FALSE, never NULL.
-   * 2. Of the 3 input values (TRUE, FALSE, NULL) they return TRUE for 1 or 2,
-   *    FALSE for the other 2 or 1.
-   */
-  private static class IsXxxImplementor
-      implements CallImplementor {
-    private final Boolean seek;
-    private final boolean negate;
-
-    public IsXxxImplementor(Boolean seek, boolean negate) {
-      this.seek = seek;
-      this.negate = negate;
-    }
-
-    public Expression implement(
-        RexToLixTranslator translator, RexCall call, NullAs nullAs) {
-      List<RexNode> operands = call.getOperands();
-      assert operands.size() == 1;
-      if (seek == null) {
-        return translator.translate(operands.get(0),
-            negate ? NullAs.IS_NOT_NULL : NullAs.IS_NULL);
-      } else {
-        return maybeNegate(negate == seek,
-            translator.translate(operands.get(0),
-                seek ? NullAs.FALSE : NullAs.TRUE));
-      }
-    }
-  }
-
-  /** Implementor for the {@code NOT} operator. */
-  private static class NotImplementor implements NotNullImplementor {
-    private final NotNullImplementor implementor;
-
-    public NotImplementor(NotNullImplementor implementor) {
-      this.implementor = implementor;
-    }
-
-    private static NotNullImplementor of(NotNullImplementor implementor) {
-      return new NotImplementor(implementor);
-    }
-
-    public Expression implement(
-        RexToLixTranslator translator,
-        RexCall call,
-        List<Expression> translatedOperands) {
-      final Expression expression =
-          implementor.implement(translator, call, translatedOperands);
-      return Expressions.not(expression);
-    }
-  }
-
-  /** Implementor for various datetime arithmetic. */
-  private static class DatetimeArithmeticImplementor
-      implements NotNullImplementor {
-    public Expression implement(RexToLixTranslator translator, RexCall call,
-        List<Expression> translatedOperands) {
-      final RexNode operand0 = call.getOperands().get(0);
-      Expression trop0 = translatedOperands.get(0);
-      final SqlTypeName typeName1 =
-          call.getOperands().get(1).getType().getSqlTypeName();
-      Expression trop1 = translatedOperands.get(1);
-      final SqlTypeName typeName = call.getType().getSqlTypeName();
-      switch (operand0.getType().getSqlTypeName()) {
-      case DATE:
-        switch (typeName) {
-        case TIMESTAMP:
-          trop0 = Expressions.convert_(
-              Expressions.multiply(trop0,
-                  Expressions.constant(DateTimeUtils.MILLIS_PER_DAY)),
-              long.class);
-          break;
-        default:
-          switch (typeName1) {
-          case INTERVAL_DAY:
-          case INTERVAL_DAY_HOUR:
-          case INTERVAL_DAY_MINUTE:
-          case INTERVAL_DAY_SECOND:
-          case INTERVAL_HOUR:
-          case INTERVAL_HOUR_MINUTE:
-          case INTERVAL_HOUR_SECOND:
-          case INTERVAL_MINUTE:
-          case INTERVAL_MINUTE_SECOND:
-          case INTERVAL_SECOND:
-            trop1 = Expressions.convert_(
-                Expressions.divide(trop1,
-                    Expressions.constant(DateTimeUtils.MILLIS_PER_DAY)),
-                int.class);
-          }
-        }
-        break;
-      case TIME:
-        trop1 = Expressions.convert_(trop1, int.class);
-        break;
-      }
-      switch (typeName1) {
-      case INTERVAL_YEAR:
-      case INTERVAL_YEAR_MONTH:
-      case INTERVAL_MONTH:
-        switch (call.getKind()) {
-        case MINUS:
-          trop1 = Expressions.negate(trop1);
-        }
-        return Expressions.call(BuiltInMethod.ADD_MONTHS.method, trop0, trop1);
-
-      case INTERVAL_DAY:
-      case INTERVAL_DAY_HOUR:
-      case INTERVAL_DAY_MINUTE:
-      case INTERVAL_DAY_SECOND:
-      case INTERVAL_HOUR:
-      case INTERVAL_HOUR_MINUTE:
-      case INTERVAL_HOUR_SECOND:
-      case INTERVAL_MINUTE:
-      case INTERVAL_MINUTE_SECOND:
-      case INTERVAL_SECOND:
-        switch (call.getKind()) {
-        case MINUS:
-          return normalize(typeName, Expressions.subtract(trop0, trop1));
-        default:
-          return normalize(typeName, Expressions.add(trop0, trop1));
-        }
-
-      default:
-        switch (call.getKind()) {
-        case MINUS:
-          switch (typeName) {
-          case INTERVAL_YEAR:
-          case INTERVAL_YEAR_MONTH:
-          case INTERVAL_MONTH:
-            return Expressions.call(BuiltInMethod.SUBTRACT_MONTHS.method,
-                trop0, trop1);
-          }
-          TimeUnit fromUnit =
-              typeName1 == SqlTypeName.DATE ? TimeUnit.DAY : TimeUnit.MILLISECOND;
-          TimeUnit toUnit = TimeUnit.MILLISECOND;
-          return multiplyDivide(
-              Expressions.convert_(Expressions.subtract(trop0, trop1),
-                  (Class) long.class),
-              fromUnit.multiplier, toUnit.multiplier);
-        default:
-          throw new AssertionError(call);
-        }
-      }
-    }
-
-    /** Normalizes a TIME value into 00:00:00..23:59:39. */
-    private Expression normalize(SqlTypeName typeName, Expression e) {
-      switch (typeName) {
-      case TIME:
-        return Expressions.call(BuiltInMethod.FLOOR_MOD.method, e,
-            Expressions.constant(DateTimeUtils.MILLIS_PER_DAY));
-      default:
-        return e;
-      }
-    }
-  }
-}
-
-// End RexImpTable.java


[06/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/PhysTypeImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/PhysTypeImpl.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/PhysTypeImpl.java
deleted file mode 100644
index a1977f5..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/PhysTypeImpl.java
+++ /dev/null
@@ -1,659 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.adapter.java.JavaTypeFactory;
-import org.apache.calcite.linq4j.Ord;
-import org.apache.calcite.linq4j.function.Function1;
-import org.apache.calcite.linq4j.tree.BlockBuilder;
-import org.apache.calcite.linq4j.tree.Expression;
-import org.apache.calcite.linq4j.tree.Expressions;
-import org.apache.calcite.linq4j.tree.MemberDeclaration;
-import org.apache.calcite.linq4j.tree.ParameterExpression;
-import org.apache.calcite.linq4j.tree.Primitive;
-import org.apache.calcite.linq4j.tree.Types;
-import org.apache.calcite.rel.RelCollation;
-import org.apache.calcite.rel.RelFieldCollation;
-import org.apache.calcite.rel.type.RelDataType;
-import org.apache.calcite.rel.type.RelDataTypeFactory;
-import org.apache.calcite.rel.type.RelDataTypeField;
-import org.apache.calcite.runtime.Utilities;
-import org.apache.calcite.sql.SqlUtil;
-import org.apache.calcite.sql.type.SqlTypeName;
-import org.apache.calcite.util.BuiltInMethod;
-import org.apache.calcite.util.Pair;
-import org.apache.calcite.util.Util;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.lang.reflect.Type;
-import java.util.AbstractList;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-import static org.apache.calcite.adapter.enumerable.EnumUtils.javaRowClass;
-import static org.apache.calcite.adapter.enumerable.EnumUtils.overridingMethodDecl;
-
-/** Implementation of {@link PhysType}. */
-public class PhysTypeImpl implements PhysType {
-  private final JavaTypeFactory typeFactory;
-  private final RelDataType rowType;
-  private final Type javaRowClass;
-  private final List<Class> fieldClasses = new ArrayList<>();
-  final JavaRowFormat format;
-
-  /** Creates a PhysTypeImpl. */
-  PhysTypeImpl(
-      JavaTypeFactory typeFactory,
-      RelDataType rowType,
-      Type javaRowClass,
-      JavaRowFormat format) {
-    this.typeFactory = typeFactory;
-    this.rowType = rowType;
-    this.javaRowClass = javaRowClass;
-    this.format = format;
-    for (RelDataTypeField field : rowType.getFieldList()) {
-      fieldClasses.add(javaRowClass(typeFactory, field.getType()));
-    }
-  }
-
-  public static PhysType of(
-      JavaTypeFactory typeFactory,
-      RelDataType rowType,
-      JavaRowFormat format) {
-    return of(typeFactory, rowType, format, true);
-  }
-
-  public static PhysType of(
-      JavaTypeFactory typeFactory,
-      RelDataType rowType,
-      JavaRowFormat format,
-      boolean optimize) {
-    if (optimize) {
-      format = format.optimize(rowType);
-    }
-    final Type javaRowClass = format.javaRowClass(typeFactory, rowType);
-    return new PhysTypeImpl(typeFactory, rowType, javaRowClass, format);
-  }
-
-  static PhysType of(
-      final JavaTypeFactory typeFactory,
-      Type javaRowClass) {
-    final RelDataTypeFactory.FieldInfoBuilder builder = typeFactory.builder();
-    if (javaRowClass instanceof Types.RecordType) {
-      final Types.RecordType recordType = (Types.RecordType) javaRowClass;
-      for (Types.RecordField field : recordType.getRecordFields()) {
-        builder.add(field.getName(), typeFactory.createType(field.getType()));
-      }
-    }
-    RelDataType rowType = builder.build();
-    // Do not optimize if there are 0 or 1 fields.
-    return new PhysTypeImpl(typeFactory, rowType, javaRowClass,
-        JavaRowFormat.CUSTOM);
-  }
-
-  public JavaRowFormat getFormat() {
-    return format;
-  }
-
-  public PhysType project(List<Integer> integers, JavaRowFormat format) {
-    return project(integers, false, format);
-  }
-
-  public PhysType project(List<Integer> integers, boolean indicator,
-      JavaRowFormat format) {
-    final RelDataTypeFactory.FieldInfoBuilder builder = typeFactory.builder();
-    for (int index : integers) {
-      builder.add(rowType.getFieldList().get(index));
-    }
-    if (indicator) {
-      final RelDataType booleanType =
-          typeFactory.createTypeWithNullability(
-              typeFactory.createSqlType(SqlTypeName.BOOLEAN), false);
-      for (int index : integers) {
-        builder.add("i$" + rowType.getFieldList().get(index).getName(),
-            booleanType);
-      }
-    }
-    RelDataType projectedRowType = builder.build();
-    return of(typeFactory, projectedRowType, format.optimize(projectedRowType));
-  }
-
-  public Expression generateSelector(
-      ParameterExpression parameter,
-      List<Integer> fields) {
-    return generateSelector(parameter, fields, format);
-  }
-
-  public Expression generateSelector(
-      ParameterExpression parameter,
-      List<Integer> fields,
-      JavaRowFormat targetFormat) {
-    // Optimize target format
-    switch (fields.size()) {
-    case 0:
-      targetFormat = JavaRowFormat.LIST;
-      break;
-    case 1:
-      targetFormat = JavaRowFormat.SCALAR;
-      break;
-    }
-    final PhysType targetPhysType =
-        project(fields, targetFormat);
-    switch (format) {
-    case SCALAR:
-      return Expressions.call(BuiltInMethod.IDENTITY_SELECTOR.method);
-    default:
-      return Expressions.lambda(Function1.class,
-          targetPhysType.record(fieldReferences(parameter, fields)), parameter);
-    }
-  }
-
-  public Expression generateSelector(final ParameterExpression parameter,
-      final List<Integer> fields, List<Integer> usedFields,
-      JavaRowFormat targetFormat) {
-    final PhysType targetPhysType =
-        project(fields, true, targetFormat);
-    final List<Expression> expressions = Lists.newArrayList();
-    for (Ord<Integer> ord : Ord.zip(fields)) {
-      final Integer field = ord.e;
-      if (usedFields.contains(field)) {
-        expressions.add(fieldReference(parameter, field));
-      } else {
-        final Primitive primitive =
-            Primitive.of(targetPhysType.fieldClass(ord.i));
-        expressions.add(
-            Expressions.constant(
-                primitive != null ? primitive.defaultValue : null));
-      }
-    }
-    for (Integer field : fields) {
-      expressions.add(Expressions.constant(!usedFields.contains(field)));
-    }
-    return Expressions.lambda(Function1.class,
-        targetPhysType.record(expressions), parameter);
-  }
-
-  public Pair<Type, List<Expression>> selector(
-      ParameterExpression parameter,
-      List<Integer> fields,
-      JavaRowFormat targetFormat) {
-    // Optimize target format
-    switch (fields.size()) {
-    case 0:
-      targetFormat = JavaRowFormat.LIST;
-      break;
-    case 1:
-      targetFormat = JavaRowFormat.SCALAR;
-      break;
-    }
-    final PhysType targetPhysType =
-        project(fields, targetFormat);
-    switch (format) {
-    case SCALAR:
-      return Pair.of(parameter.getType(),
-          Collections.<Expression>singletonList(parameter));
-    default:
-      return Pair.of(targetPhysType.getJavaRowType(),
-          fieldReferences(parameter, fields));
-    }
-  }
-
-  public List<Expression> accessors(Expression v1, List<Integer> argList) {
-    final List<Expression> expressions = new ArrayList<>();
-    for (int field : argList) {
-      expressions.add(
-          Types.castIfNecessary(
-              fieldClass(field),
-              fieldReference(v1, field)));
-    }
-    return expressions;
-  }
-
-  public PhysType makeNullable(boolean nullable) {
-    if (!nullable) {
-      return this;
-    }
-    return new PhysTypeImpl(typeFactory,
-        typeFactory.createTypeWithNullability(rowType, true),
-        Primitive.box(javaRowClass), format);
-  }
-
-  public Expression convertTo(Expression exp, PhysType targetPhysType) {
-    final JavaRowFormat targetFormat = targetPhysType.getFormat();
-    if (format == targetFormat) {
-      return exp;
-    }
-    final ParameterExpression o_ =
-        Expressions.parameter(javaRowClass, "o");
-    final int fieldCount = rowType.getFieldCount();
-    return Expressions.call(exp, BuiltInMethod.SELECT.method,
-        generateSelector(o_, Util.range(fieldCount), targetFormat));
-  }
-
-  public Pair<Expression, Expression> generateCollationKey(
-      final List<RelFieldCollation> collations) {
-    final Expression selector;
-    if (collations.size() == 1) {
-      RelFieldCollation collation = collations.get(0);
-      ParameterExpression parameter =
-          Expressions.parameter(javaRowClass, "v");
-      selector =
-          Expressions.lambda(
-              Function1.class,
-              fieldReference(parameter, collation.getFieldIndex()),
-              parameter);
-      return Pair.<Expression, Expression>of(
-          selector,
-          Expressions.call(
-              BuiltInMethod.NULLS_COMPARATOR.method,
-              Expressions.constant(
-                  collation.nullDirection
-                      == RelFieldCollation.NullDirection.FIRST),
-              Expressions.constant(
-                  collation.getDirection()
-                      == RelFieldCollation.Direction.DESCENDING)));
-    }
-    selector =
-        Expressions.call(BuiltInMethod.IDENTITY_SELECTOR.method);
-
-    // int c;
-    // c = Utilities.compare(v0, v1);
-    // if (c != 0) return c; // or -c if descending
-    // ...
-    // return 0;
-    BlockBuilder body = new BlockBuilder();
-    final ParameterExpression parameterV0 =
-        Expressions.parameter(javaRowClass, "v0");
-    final ParameterExpression parameterV1 =
-        Expressions.parameter(javaRowClass, "v1");
-    final ParameterExpression parameterC =
-        Expressions.parameter(int.class, "c");
-    final int mod = collations.size() == 1 ? Modifier.FINAL : 0;
-    body.add(Expressions.declare(mod, parameterC, null));
-    for (RelFieldCollation collation : collations) {
-      final int index = collation.getFieldIndex();
-      Expression arg0 = fieldReference(parameterV0, index);
-      Expression arg1 = fieldReference(parameterV1, index);
-      switch (Primitive.flavor(fieldClass(index))) {
-      case OBJECT:
-        arg0 = Types.castIfNecessary(Comparable.class, arg0);
-        arg1 = Types.castIfNecessary(Comparable.class, arg1);
-      }
-      final boolean nullsFirst =
-          collation.nullDirection
-              == RelFieldCollation.NullDirection.FIRST;
-      final boolean descending =
-          collation.getDirection()
-              == RelFieldCollation.Direction.DESCENDING;
-      final Method method = (fieldNullable(index)
-          ? (nullsFirst ^ descending
-              ? BuiltInMethod.COMPARE_NULLS_FIRST
-              : BuiltInMethod.COMPARE_NULLS_LAST)
-          : BuiltInMethod.COMPARE).method;
-      body.add(
-          Expressions.statement(
-              Expressions.assign(
-                  parameterC,
-                  Expressions.call(method.getDeclaringClass(),
-                      method.getName(),
-                      arg0,
-                      arg1))));
-      body.add(
-          Expressions.ifThen(
-              Expressions.notEqual(
-                  parameterC, Expressions.constant(0)),
-              Expressions.return_(
-                  null,
-                  descending
-                      ? Expressions.negate(parameterC)
-                      : parameterC)));
-    }
-    body.add(
-        Expressions.return_(null, Expressions.constant(0)));
-
-    final List<MemberDeclaration> memberDeclarations =
-        Expressions.<MemberDeclaration>list(
-            Expressions.methodDecl(
-                Modifier.PUBLIC,
-                int.class,
-                "compare",
-                ImmutableList.of(
-                    parameterV0, parameterV1),
-                body.toBlock()));
-
-    if (EnumerableRules.BRIDGE_METHODS) {
-      final ParameterExpression parameterO0 =
-          Expressions.parameter(Object.class, "o0");
-      final ParameterExpression parameterO1 =
-          Expressions.parameter(Object.class, "o1");
-      BlockBuilder bridgeBody = new BlockBuilder();
-      bridgeBody.add(
-          Expressions.return_(
-              null,
-              Expressions.call(
-                  Expressions.parameter(
-                      Comparable.class, "this"),
-                  BuiltInMethod.COMPARATOR_COMPARE.method,
-                  Expressions.convert_(
-                      parameterO0,
-                      javaRowClass),
-                  Expressions.convert_(
-                      parameterO1,
-                      javaRowClass))));
-      memberDeclarations.add(
-          overridingMethodDecl(
-              BuiltInMethod.COMPARATOR_COMPARE.method,
-              ImmutableList.of(parameterO0, parameterO1),
-              bridgeBody.toBlock()));
-    }
-    return Pair.<Expression, Expression>of(
-        selector,
-        Expressions.new_(
-            Comparator.class,
-            Collections.<Expression>emptyList(),
-            memberDeclarations));
-  }
-
-  public Expression generateComparator(RelCollation collation) {
-    // int c;
-    // c = Utilities.compare(v0, v1);
-    // if (c != 0) return c; // or -c if descending
-    // ...
-    // return 0;
-    BlockBuilder body = new BlockBuilder();
-    final Type javaRowClass = Primitive.box(this.javaRowClass);
-    final ParameterExpression parameterV0 =
-        Expressions.parameter(javaRowClass, "v0");
-    final ParameterExpression parameterV1 =
-        Expressions.parameter(javaRowClass, "v1");
-    final ParameterExpression parameterC =
-        Expressions.parameter(int.class, "c");
-    final int mod =
-        collation.getFieldCollations().size() == 1 ? Modifier.FINAL : 0;
-    body.add(Expressions.declare(mod, parameterC, null));
-    for (RelFieldCollation fieldCollation : collation.getFieldCollations()) {
-      final int index = fieldCollation.getFieldIndex();
-      Expression arg0 = fieldReference(parameterV0, index);
-      Expression arg1 = fieldReference(parameterV1, index);
-      switch (Primitive.flavor(fieldClass(index))) {
-      case OBJECT:
-        arg0 = Types.castIfNecessary(Comparable.class, arg0);
-        arg1 = Types.castIfNecessary(Comparable.class, arg1);
-      }
-      final boolean nullsFirst =
-          fieldCollation.nullDirection
-              == RelFieldCollation.NullDirection.FIRST;
-      final boolean descending =
-          fieldCollation.getDirection()
-              == RelFieldCollation.Direction.DESCENDING;
-      body.add(
-          Expressions.statement(
-              Expressions.assign(
-                  parameterC,
-                  Expressions.call(
-                      Utilities.class,
-                      fieldNullable(index)
-                          ? (nullsFirst != descending
-                          ? "compareNullsFirst"
-                          : "compareNullsLast")
-                          : "compare",
-                      arg0,
-                      arg1))));
-      body.add(
-          Expressions.ifThen(
-              Expressions.notEqual(
-                  parameterC, Expressions.constant(0)),
-              Expressions.return_(
-                  null,
-                  descending
-                      ? Expressions.negate(parameterC)
-                      : parameterC)));
-    }
-    body.add(
-        Expressions.return_(null, Expressions.constant(0)));
-
-    final List<MemberDeclaration> memberDeclarations =
-        Expressions.<MemberDeclaration>list(
-            Expressions.methodDecl(
-                Modifier.PUBLIC,
-                int.class,
-                "compare",
-                ImmutableList.of(parameterV0, parameterV1),
-                body.toBlock()));
-
-    if (EnumerableRules.BRIDGE_METHODS) {
-      final ParameterExpression parameterO0 =
-          Expressions.parameter(Object.class, "o0");
-      final ParameterExpression parameterO1 =
-          Expressions.parameter(Object.class, "o1");
-      BlockBuilder bridgeBody = new BlockBuilder();
-      bridgeBody.add(
-          Expressions.return_(
-              null,
-              Expressions.call(
-                  Expressions.parameter(
-                      Comparable.class, "this"),
-                  BuiltInMethod.COMPARATOR_COMPARE.method,
-                  Expressions.convert_(
-                      parameterO0,
-                      javaRowClass),
-                  Expressions.convert_(
-                      parameterO1,
-                      javaRowClass))));
-      memberDeclarations.add(
-          overridingMethodDecl(
-              BuiltInMethod.COMPARATOR_COMPARE.method,
-              ImmutableList.of(parameterO0, parameterO1),
-              bridgeBody.toBlock()));
-    }
-    return Expressions.new_(
-        Comparator.class,
-        Collections.<Expression>emptyList(),
-        memberDeclarations);
-  }
-
-  public RelDataType getRowType() {
-    return rowType;
-  }
-
-  public Expression record(List<Expression> expressions) {
-    return format.record(javaRowClass, expressions);
-  }
-
-  public Type getJavaRowType() {
-    return javaRowClass;
-  }
-
-  public Type getJavaFieldType(int index) {
-    return format.javaFieldClass(typeFactory, rowType, index);
-  }
-
-  public PhysType component(int fieldOrdinal) {
-    final RelDataTypeField field = rowType.getFieldList().get(fieldOrdinal);
-    return PhysTypeImpl.of(typeFactory,
-        toStruct(field.getType().getComponentType()), format, false);
-  }
-
-  public PhysType field(int ordinal) {
-    final RelDataTypeField field = rowType.getFieldList().get(ordinal);
-    final RelDataType type = field.getType();
-    return PhysTypeImpl.of(typeFactory, toStruct(type), format, false);
-  }
-
-  private RelDataType toStruct(RelDataType type) {
-    if (type.isStruct()) {
-      return type;
-    }
-    return typeFactory.builder()
-        .add(SqlUtil.deriveAliasFromOrdinal(0), type)
-        .build();
-  }
-
-  public Expression comparer() {
-    return format.comparer();
-  }
-
-  private List<Expression> fieldReferences(
-      final Expression parameter, final List<Integer> fields) {
-    return new AbstractList<Expression>() {
-      public Expression get(int index) {
-        return fieldReference(parameter, fields.get(index));
-      }
-
-      public int size() {
-        return fields.size();
-      }
-    };
-  }
-
-  public Class fieldClass(int field) {
-    return fieldClasses.get(field);
-  }
-
-  public boolean fieldNullable(int field) {
-    return rowType.getFieldList().get(field).getType().isNullable();
-  }
-
-  public Expression generateAccessor(
-      List<Integer> fields) {
-    ParameterExpression v1 =
-        Expressions.parameter(javaRowClass, "v1");
-    switch (fields.size()) {
-    case 0:
-      return Expressions.lambda(
-          Function1.class,
-          Expressions.field(
-              null,
-              BuiltInMethod.COMPARABLE_EMPTY_LIST.field),
-          v1);
-    case 1:
-      int field0 = fields.get(0);
-
-      // new Function1<Employee, Res> {
-      //    public Res apply(Employee v1) {
-      //        return v1.<fieldN>;
-      //    }
-      // }
-      Class returnType = fieldClasses.get(field0);
-      Expression fieldReference =
-          Types.castIfNecessary(
-              returnType,
-              fieldReference(v1, field0));
-      return Expressions.lambda(
-          Function1.class,
-          fieldReference,
-          v1);
-    default:
-      // new Function1<Employee, List> {
-      //    public List apply(Employee v1) {
-      //        return Arrays.asList(
-      //            new Object[] {v1.<fieldN>, v1.<fieldM>});
-      //    }
-      // }
-      Expressions.FluentList<Expression> list = Expressions.list();
-      for (int field : fields) {
-        list.add(fieldReference(v1, field));
-      }
-      switch (list.size()) {
-      case 2:
-        return Expressions.lambda(
-            Function1.class,
-            Expressions.call(
-                List.class,
-                null,
-                BuiltInMethod.LIST2.method,
-                list),
-            v1);
-      case 3:
-        return Expressions.lambda(
-            Function1.class,
-            Expressions.call(
-                List.class,
-                null,
-                BuiltInMethod.LIST3.method,
-                list),
-            v1);
-      case 4:
-        return Expressions.lambda(
-            Function1.class,
-            Expressions.call(
-                List.class,
-                null,
-                BuiltInMethod.LIST4.method,
-                list),
-            v1);
-      case 5:
-        return Expressions.lambda(
-            Function1.class,
-            Expressions.call(
-                List.class,
-                null,
-                BuiltInMethod.LIST5.method,
-                list),
-            v1);
-      case 6:
-        return Expressions.lambda(
-            Function1.class,
-            Expressions.call(
-                List.class,
-                null,
-                BuiltInMethod.LIST6.method,
-                list),
-            v1);
-      default:
-        return Expressions.lambda(
-            Function1.class,
-            Expressions.call(
-                List.class,
-                null,
-                BuiltInMethod.LIST_N.method,
-                Expressions.newArrayInit(
-                    Comparable.class,
-                    list)),
-            v1);
-      }
-    }
-  }
-
-  public Expression fieldReference(
-      Expression expression, int field) {
-    return fieldReference(expression, field, null);
-  }
-
-  public Expression fieldReference(
-      Expression expression, int field, Type storageType) {
-    Type fieldType;
-    if (storageType == null) {
-      storageType = fieldClass(field);
-      fieldType = null;
-    } else {
-      fieldType = fieldClass(field);
-      if (fieldType != java.sql.Date.class) {
-        fieldType = null;
-      }
-    }
-    return format.field(expression, field, fieldType, storageType);
-  }
-}
-
-// End PhysTypeImpl.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/ReflectiveCallNotNullImplementor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/ReflectiveCallNotNullImplementor.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/ReflectiveCallNotNullImplementor.java
deleted file mode 100644
index 4cb57cd..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/ReflectiveCallNotNullImplementor.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.linq4j.tree.Expression;
-import org.apache.calcite.linq4j.tree.Expressions;
-import org.apache.calcite.rex.RexCall;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.List;
-
-/**
- * Implementation of
- * {@link org.apache.calcite.adapter.enumerable.NotNullImplementor}
- * that calls a given {@link java.lang.reflect.Method}.
- *
- * <p>When method is not static, a new instance of the required class is
- * created.
- */
-public class ReflectiveCallNotNullImplementor implements NotNullImplementor {
-  protected final Method method;
-
-  /**
-   * Constructor of {@link ReflectiveCallNotNullImplementor}
-   * @param method method that is used to implement the call
-   */
-  public ReflectiveCallNotNullImplementor(Method method) {
-    this.method = method;
-  }
-
-  public Expression implement(RexToLixTranslator translator,
-      RexCall call, List<Expression> translatedOperands) {
-    translatedOperands =
-        EnumUtils.fromInternal(method.getParameterTypes(), translatedOperands);
-    if ((method.getModifiers() & Modifier.STATIC) != 0) {
-      return Expressions.call(method, translatedOperands);
-    } else {
-      // The UDF class must have a public zero-args constructor.
-      // Assume that the validator checked already.
-      final Expression target =
-          Expressions.new_(method.getDeclaringClass());
-      return Expressions.call(target, method, translatedOperands);
-    }
-  }
-
-}
-
-// End ReflectiveCallNotNullImplementor.java


[40/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/proto/Responses.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/proto/Responses.java b/avatica/core/src/main/java/org/apache/calcite/avatica/proto/Responses.java
deleted file mode 100644
index 87d567d..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/proto/Responses.java
+++ /dev/null
@@ -1,13962 +0,0 @@
-// Generated by the protocol buffer compiler.  DO NOT EDIT!
-// source: responses.proto
-
-package org.apache.calcite.avatica.proto;
-
-public final class Responses {
-  private Responses() {}
-  public static void registerAllExtensions(
-      com.google.protobuf.ExtensionRegistryLite registry) {
-  }
-
-  public static void registerAllExtensions(
-      com.google.protobuf.ExtensionRegistry registry) {
-    registerAllExtensions(
-        (com.google.protobuf.ExtensionRegistryLite) registry);
-  }
-  public interface ResultSetResponseOrBuilder extends
-      // @@protoc_insertion_point(interface_extends:ResultSetResponse)
-      com.google.protobuf.MessageOrBuilder {
-
-    /**
-     * <code>optional string connection_id = 1;</code>
-     */
-    java.lang.String getConnectionId();
-    /**
-     * <code>optional string connection_id = 1;</code>
-     */
-    com.google.protobuf.ByteString
-        getConnectionIdBytes();
-
-    /**
-     * <code>optional uint32 statement_id = 2;</code>
-     */
-    int getStatementId();
-
-    /**
-     * <code>optional bool own_statement = 3;</code>
-     */
-    boolean getOwnStatement();
-
-    /**
-     * <code>optional .Signature signature = 4;</code>
-     */
-    boolean hasSignature();
-    /**
-     * <code>optional .Signature signature = 4;</code>
-     */
-    org.apache.calcite.avatica.proto.Common.Signature getSignature();
-    /**
-     * <code>optional .Signature signature = 4;</code>
-     */
-    org.apache.calcite.avatica.proto.Common.SignatureOrBuilder getSignatureOrBuilder();
-
-    /**
-     * <code>optional .Frame first_frame = 5;</code>
-     */
-    boolean hasFirstFrame();
-    /**
-     * <code>optional .Frame first_frame = 5;</code>
-     */
-    org.apache.calcite.avatica.proto.Common.Frame getFirstFrame();
-    /**
-     * <code>optional .Frame first_frame = 5;</code>
-     */
-    org.apache.calcite.avatica.proto.Common.FrameOrBuilder getFirstFrameOrBuilder();
-
-    /**
-     * <pre>
-     * -1 for normal result sets, else this response contains a dummy result set
-     * </pre>
-     *
-     * <code>optional uint64 update_count = 6;</code>
-     */
-    long getUpdateCount();
-
-    /**
-     * <pre>
-     * with no signature nor other data.
-     * </pre>
-     *
-     * <code>optional .RpcMetadata metadata = 7;</code>
-     */
-    boolean hasMetadata();
-    /**
-     * <pre>
-     * with no signature nor other data.
-     * </pre>
-     *
-     * <code>optional .RpcMetadata metadata = 7;</code>
-     */
-    org.apache.calcite.avatica.proto.Responses.RpcMetadata getMetadata();
-    /**
-     * <pre>
-     * with no signature nor other data.
-     * </pre>
-     *
-     * <code>optional .RpcMetadata metadata = 7;</code>
-     */
-    org.apache.calcite.avatica.proto.Responses.RpcMetadataOrBuilder getMetadataOrBuilder();
-  }
-  /**
-   * <pre>
-   * Response that contains a result set.
-   * </pre>
-   *
-   * Protobuf type {@code ResultSetResponse}
-   */
-  public  static final class ResultSetResponse extends
-      com.google.protobuf.GeneratedMessageV3 implements
-      // @@protoc_insertion_point(message_implements:ResultSetResponse)
-      ResultSetResponseOrBuilder {
-    // Use ResultSetResponse.newBuilder() to construct.
-    private ResultSetResponse(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
-      super(builder);
-    }
-    private ResultSetResponse() {
-      connectionId_ = "";
-      statementId_ = 0;
-      ownStatement_ = false;
-      updateCount_ = 0L;
-    }
-
-    @java.lang.Override
-    public final com.google.protobuf.UnknownFieldSet
-    getUnknownFields() {
-      return com.google.protobuf.UnknownFieldSet.getDefaultInstance();
-    }
-    private ResultSetResponse(
-        com.google.protobuf.CodedInputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      this();
-      int mutable_bitField0_ = 0;
-      try {
-        boolean done = false;
-        while (!done) {
-          int tag = input.readTag();
-          switch (tag) {
-            case 0:
-              done = true;
-              break;
-            default: {
-              if (!input.skipField(tag)) {
-                done = true;
-              }
-              break;
-            }
-            case 10: {
-              java.lang.String s = input.readStringRequireUtf8();
-
-              connectionId_ = s;
-              break;
-            }
-            case 16: {
-
-              statementId_ = input.readUInt32();
-              break;
-            }
-            case 24: {
-
-              ownStatement_ = input.readBool();
-              break;
-            }
-            case 34: {
-              org.apache.calcite.avatica.proto.Common.Signature.Builder subBuilder = null;
-              if (signature_ != null) {
-                subBuilder = signature_.toBuilder();
-              }
-              signature_ = input.readMessage(org.apache.calcite.avatica.proto.Common.Signature.parser(), extensionRegistry);
-              if (subBuilder != null) {
-                subBuilder.mergeFrom(signature_);
-                signature_ = subBuilder.buildPartial();
-              }
-
-              break;
-            }
-            case 42: {
-              org.apache.calcite.avatica.proto.Common.Frame.Builder subBuilder = null;
-              if (firstFrame_ != null) {
-                subBuilder = firstFrame_.toBuilder();
-              }
-              firstFrame_ = input.readMessage(org.apache.calcite.avatica.proto.Common.Frame.parser(), extensionRegistry);
-              if (subBuilder != null) {
-                subBuilder.mergeFrom(firstFrame_);
-                firstFrame_ = subBuilder.buildPartial();
-              }
-
-              break;
-            }
-            case 48: {
-
-              updateCount_ = input.readUInt64();
-              break;
-            }
-            case 58: {
-              org.apache.calcite.avatica.proto.Responses.RpcMetadata.Builder subBuilder = null;
-              if (metadata_ != null) {
-                subBuilder = metadata_.toBuilder();
-              }
-              metadata_ = input.readMessage(org.apache.calcite.avatica.proto.Responses.RpcMetadata.parser(), extensionRegistry);
-              if (subBuilder != null) {
-                subBuilder.mergeFrom(metadata_);
-                metadata_ = subBuilder.buildPartial();
-              }
-
-              break;
-            }
-          }
-        }
-      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-        throw e.setUnfinishedMessage(this);
-      } catch (java.io.IOException e) {
-        throw new com.google.protobuf.InvalidProtocolBufferException(
-            e).setUnfinishedMessage(this);
-      } finally {
-        makeExtensionsImmutable();
-      }
-    }
-    public static final com.google.protobuf.Descriptors.Descriptor
-        getDescriptor() {
-      return org.apache.calcite.avatica.proto.Responses.internal_static_ResultSetResponse_descriptor;
-    }
-
-    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
-        internalGetFieldAccessorTable() {
-      return org.apache.calcite.avatica.proto.Responses.internal_static_ResultSetResponse_fieldAccessorTable
-          .ensureFieldAccessorsInitialized(
-              org.apache.calcite.avatica.proto.Responses.ResultSetResponse.class, org.apache.calcite.avatica.proto.Responses.ResultSetResponse.Builder.class);
-    }
-
-    public static final int CONNECTION_ID_FIELD_NUMBER = 1;
-    private volatile java.lang.Object connectionId_;
-    /**
-     * <code>optional string connection_id = 1;</code>
-     */
-    public java.lang.String getConnectionId() {
-      java.lang.Object ref = connectionId_;
-      if (ref instanceof java.lang.String) {
-        return (java.lang.String) ref;
-      } else {
-        com.google.protobuf.ByteString bs = 
-            (com.google.protobuf.ByteString) ref;
-        java.lang.String s = bs.toStringUtf8();
-        connectionId_ = s;
-        return s;
-      }
-    }
-    /**
-     * <code>optional string connection_id = 1;</code>
-     */
-    public com.google.protobuf.ByteString
-        getConnectionIdBytes() {
-      java.lang.Object ref = connectionId_;
-      if (ref instanceof java.lang.String) {
-        com.google.protobuf.ByteString b = 
-            com.google.protobuf.ByteString.copyFromUtf8(
-                (java.lang.String) ref);
-        connectionId_ = b;
-        return b;
-      } else {
-        return (com.google.protobuf.ByteString) ref;
-      }
-    }
-
-    public static final int STATEMENT_ID_FIELD_NUMBER = 2;
-    private int statementId_;
-    /**
-     * <code>optional uint32 statement_id = 2;</code>
-     */
-    public int getStatementId() {
-      return statementId_;
-    }
-
-    public static final int OWN_STATEMENT_FIELD_NUMBER = 3;
-    private boolean ownStatement_;
-    /**
-     * <code>optional bool own_statement = 3;</code>
-     */
-    public boolean getOwnStatement() {
-      return ownStatement_;
-    }
-
-    public static final int SIGNATURE_FIELD_NUMBER = 4;
-    private org.apache.calcite.avatica.proto.Common.Signature signature_;
-    /**
-     * <code>optional .Signature signature = 4;</code>
-     */
-    public boolean hasSignature() {
-      return signature_ != null;
-    }
-    /**
-     * <code>optional .Signature signature = 4;</code>
-     */
-    public org.apache.calcite.avatica.proto.Common.Signature getSignature() {
-      return signature_ == null ? org.apache.calcite.avatica.proto.Common.Signature.getDefaultInstance() : signature_;
-    }
-    /**
-     * <code>optional .Signature signature = 4;</code>
-     */
-    public org.apache.calcite.avatica.proto.Common.SignatureOrBuilder getSignatureOrBuilder() {
-      return getSignature();
-    }
-
-    public static final int FIRST_FRAME_FIELD_NUMBER = 5;
-    private org.apache.calcite.avatica.proto.Common.Frame firstFrame_;
-    /**
-     * <code>optional .Frame first_frame = 5;</code>
-     */
-    public boolean hasFirstFrame() {
-      return firstFrame_ != null;
-    }
-    /**
-     * <code>optional .Frame first_frame = 5;</code>
-     */
-    public org.apache.calcite.avatica.proto.Common.Frame getFirstFrame() {
-      return firstFrame_ == null ? org.apache.calcite.avatica.proto.Common.Frame.getDefaultInstance() : firstFrame_;
-    }
-    /**
-     * <code>optional .Frame first_frame = 5;</code>
-     */
-    public org.apache.calcite.avatica.proto.Common.FrameOrBuilder getFirstFrameOrBuilder() {
-      return getFirstFrame();
-    }
-
-    public static final int UPDATE_COUNT_FIELD_NUMBER = 6;
-    private long updateCount_;
-    /**
-     * <pre>
-     * -1 for normal result sets, else this response contains a dummy result set
-     * </pre>
-     *
-     * <code>optional uint64 update_count = 6;</code>
-     */
-    public long getUpdateCount() {
-      return updateCount_;
-    }
-
-    public static final int METADATA_FIELD_NUMBER = 7;
-    private org.apache.calcite.avatica.proto.Responses.RpcMetadata metadata_;
-    /**
-     * <pre>
-     * with no signature nor other data.
-     * </pre>
-     *
-     * <code>optional .RpcMetadata metadata = 7;</code>
-     */
-    public boolean hasMetadata() {
-      return metadata_ != null;
-    }
-    /**
-     * <pre>
-     * with no signature nor other data.
-     * </pre>
-     *
-     * <code>optional .RpcMetadata metadata = 7;</code>
-     */
-    public org.apache.calcite.avatica.proto.Responses.RpcMetadata getMetadata() {
-      return metadata_ == null ? org.apache.calcite.avatica.proto.Responses.RpcMetadata.getDefaultInstance() : metadata_;
-    }
-    /**
-     * <pre>
-     * with no signature nor other data.
-     * </pre>
-     *
-     * <code>optional .RpcMetadata metadata = 7;</code>
-     */
-    public org.apache.calcite.avatica.proto.Responses.RpcMetadataOrBuilder getMetadataOrBuilder() {
-      return getMetadata();
-    }
-
-    private byte memoizedIsInitialized = -1;
-    public final boolean isInitialized() {
-      byte isInitialized = memoizedIsInitialized;
-      if (isInitialized == 1) return true;
-      if (isInitialized == 0) return false;
-
-      memoizedIsInitialized = 1;
-      return true;
-    }
-
-    public void writeTo(com.google.protobuf.CodedOutputStream output)
-                        throws java.io.IOException {
-      if (!getConnectionIdBytes().isEmpty()) {
-        com.google.protobuf.GeneratedMessageV3.writeString(output, 1, connectionId_);
-      }
-      if (statementId_ != 0) {
-        output.writeUInt32(2, statementId_);
-      }
-      if (ownStatement_ != false) {
-        output.writeBool(3, ownStatement_);
-      }
-      if (signature_ != null) {
-        output.writeMessage(4, getSignature());
-      }
-      if (firstFrame_ != null) {
-        output.writeMessage(5, getFirstFrame());
-      }
-      if (updateCount_ != 0L) {
-        output.writeUInt64(6, updateCount_);
-      }
-      if (metadata_ != null) {
-        output.writeMessage(7, getMetadata());
-      }
-    }
-
-    public int getSerializedSize() {
-      int size = memoizedSize;
-      if (size != -1) return size;
-
-      size = 0;
-      if (!getConnectionIdBytes().isEmpty()) {
-        size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, connectionId_);
-      }
-      if (statementId_ != 0) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeUInt32Size(2, statementId_);
-      }
-      if (ownStatement_ != false) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeBoolSize(3, ownStatement_);
-      }
-      if (signature_ != null) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeMessageSize(4, getSignature());
-      }
-      if (firstFrame_ != null) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeMessageSize(5, getFirstFrame());
-      }
-      if (updateCount_ != 0L) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeUInt64Size(6, updateCount_);
-      }
-      if (metadata_ != null) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeMessageSize(7, getMetadata());
-      }
-      memoizedSize = size;
-      return size;
-    }
-
-    private static final long serialVersionUID = 0L;
-    @java.lang.Override
-    public boolean equals(final java.lang.Object obj) {
-      if (obj == this) {
-       return true;
-      }
-      if (!(obj instanceof org.apache.calcite.avatica.proto.Responses.ResultSetResponse)) {
-        return super.equals(obj);
-      }
-      org.apache.calcite.avatica.proto.Responses.ResultSetResponse other = (org.apache.calcite.avatica.proto.Responses.ResultSetResponse) obj;
-
-      boolean result = true;
-      result = result && getConnectionId()
-          .equals(other.getConnectionId());
-      result = result && (getStatementId()
-          == other.getStatementId());
-      result = result && (getOwnStatement()
-          == other.getOwnStatement());
-      result = result && (hasSignature() == other.hasSignature());
-      if (hasSignature()) {
-        result = result && getSignature()
-            .equals(other.getSignature());
-      }
-      result = result && (hasFirstFrame() == other.hasFirstFrame());
-      if (hasFirstFrame()) {
-        result = result && getFirstFrame()
-            .equals(other.getFirstFrame());
-      }
-      result = result && (getUpdateCount()
-          == other.getUpdateCount());
-      result = result && (hasMetadata() == other.hasMetadata());
-      if (hasMetadata()) {
-        result = result && getMetadata()
-            .equals(other.getMetadata());
-      }
-      return result;
-    }
-
-    @java.lang.Override
-    public int hashCode() {
-      if (memoizedHashCode != 0) {
-        return memoizedHashCode;
-      }
-      int hash = 41;
-      hash = (19 * hash) + getDescriptorForType().hashCode();
-      hash = (37 * hash) + CONNECTION_ID_FIELD_NUMBER;
-      hash = (53 * hash) + getConnectionId().hashCode();
-      hash = (37 * hash) + STATEMENT_ID_FIELD_NUMBER;
-      hash = (53 * hash) + getStatementId();
-      hash = (37 * hash) + OWN_STATEMENT_FIELD_NUMBER;
-      hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(
-          getOwnStatement());
-      if (hasSignature()) {
-        hash = (37 * hash) + SIGNATURE_FIELD_NUMBER;
-        hash = (53 * hash) + getSignature().hashCode();
-      }
-      if (hasFirstFrame()) {
-        hash = (37 * hash) + FIRST_FRAME_FIELD_NUMBER;
-        hash = (53 * hash) + getFirstFrame().hashCode();
-      }
-      hash = (37 * hash) + UPDATE_COUNT_FIELD_NUMBER;
-      hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
-          getUpdateCount());
-      if (hasMetadata()) {
-        hash = (37 * hash) + METADATA_FIELD_NUMBER;
-        hash = (53 * hash) + getMetadata().hashCode();
-      }
-      hash = (29 * hash) + unknownFields.hashCode();
-      memoizedHashCode = hash;
-      return hash;
-    }
-
-    public static org.apache.calcite.avatica.proto.Responses.ResultSetResponse parseFrom(
-        com.google.protobuf.ByteString data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.apache.calcite.avatica.proto.Responses.ResultSetResponse parseFrom(
-        com.google.protobuf.ByteString data,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data, extensionRegistry);
-    }
-    public static org.apache.calcite.avatica.proto.Responses.ResultSetResponse parseFrom(byte[] data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.apache.calcite.avatica.proto.Responses.ResultSetResponse parseFrom(
-        byte[] data,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data, extensionRegistry);
-    }
-    public static org.apache.calcite.avatica.proto.Responses.ResultSetResponse parseFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseWithIOException(PARSER, input);
-    }
-    public static org.apache.calcite.avatica.proto.Responses.ResultSetResponse parseFrom(
-        java.io.InputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseWithIOException(PARSER, input, extensionRegistry);
-    }
-    public static org.apache.calcite.avatica.proto.Responses.ResultSetResponse parseDelimitedFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseDelimitedWithIOException(PARSER, input);
-    }
-    public static org.apache.calcite.avatica.proto.Responses.ResultSetResponse parseDelimitedFrom(
-        java.io.InputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
-    }
-    public static org.apache.calcite.avatica.proto.Responses.ResultSetResponse parseFrom(
-        com.google.protobuf.CodedInputStream input)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseWithIOException(PARSER, input);
-    }
-    public static org.apache.calcite.avatica.proto.Responses.ResultSetResponse parseFrom(
-        com.google.protobuf.CodedInputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseWithIOException(PARSER, input, extensionRegistry);
-    }
-
-    public Builder newBuilderForType() { return newBuilder(); }
-    public static Builder newBuilder() {
-      return DEFAULT_INSTANCE.toBuilder();
-    }
-    public static Builder newBuilder(org.apache.calcite.avatica.proto.Responses.ResultSetResponse prototype) {
-      return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
-    }
-    public Builder toBuilder() {
-      return this == DEFAULT_INSTANCE
-          ? new Builder() : new Builder().mergeFrom(this);
-    }
-
-    @java.lang.Override
-    protected Builder newBuilderForType(
-        com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
-      Builder builder = new Builder(parent);
-      return builder;
-    }
-    /**
-     * <pre>
-     * Response that contains a result set.
-     * </pre>
-     *
-     * Protobuf type {@code ResultSetResponse}
-     */
-    public static final class Builder extends
-        com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
-        // @@protoc_insertion_point(builder_implements:ResultSetResponse)
-        org.apache.calcite.avatica.proto.Responses.ResultSetResponseOrBuilder {
-      public static final com.google.protobuf.Descriptors.Descriptor
-          getDescriptor() {
-        return org.apache.calcite.avatica.proto.Responses.internal_static_ResultSetResponse_descriptor;
-      }
-
-      protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
-          internalGetFieldAccessorTable() {
-        return org.apache.calcite.avatica.proto.Responses.internal_static_ResultSetResponse_fieldAccessorTable
-            .ensureFieldAccessorsInitialized(
-                org.apache.calcite.avatica.proto.Responses.ResultSetResponse.class, org.apache.calcite.avatica.proto.Responses.ResultSetResponse.Builder.class);
-      }
-
-      // Construct using org.apache.calcite.avatica.proto.Responses.ResultSetResponse.newBuilder()
-      private Builder() {
-        maybeForceBuilderInitialization();
-      }
-
-      private Builder(
-          com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
-        super(parent);
-        maybeForceBuilderInitialization();
-      }
-      private void maybeForceBuilderInitialization() {
-        if (com.google.protobuf.GeneratedMessageV3
-                .alwaysUseFieldBuilders) {
-        }
-      }
-      public Builder clear() {
-        super.clear();
-        connectionId_ = "";
-
-        statementId_ = 0;
-
-        ownStatement_ = false;
-
-        if (signatureBuilder_ == null) {
-          signature_ = null;
-        } else {
-          signature_ = null;
-          signatureBuilder_ = null;
-        }
-        if (firstFrameBuilder_ == null) {
-          firstFrame_ = null;
-        } else {
-          firstFrame_ = null;
-          firstFrameBuilder_ = null;
-        }
-        updateCount_ = 0L;
-
-        if (metadataBuilder_ == null) {
-          metadata_ = null;
-        } else {
-          metadata_ = null;
-          metadataBuilder_ = null;
-        }
-        return this;
-      }
-
-      public com.google.protobuf.Descriptors.Descriptor
-          getDescriptorForType() {
-        return org.apache.calcite.avatica.proto.Responses.internal_static_ResultSetResponse_descriptor;
-      }
-
-      public org.apache.calcite.avatica.proto.Responses.ResultSetResponse getDefaultInstanceForType() {
-        return org.apache.calcite.avatica.proto.Responses.ResultSetResponse.getDefaultInstance();
-      }
-
-      public org.apache.calcite.avatica.proto.Responses.ResultSetResponse build() {
-        org.apache.calcite.avatica.proto.Responses.ResultSetResponse result = buildPartial();
-        if (!result.isInitialized()) {
-          throw newUninitializedMessageException(result);
-        }
-        return result;
-      }
-
-      public org.apache.calcite.avatica.proto.Responses.ResultSetResponse buildPartial() {
-        org.apache.calcite.avatica.proto.Responses.ResultSetResponse result = new org.apache.calcite.avatica.proto.Responses.ResultSetResponse(this);
-        result.connectionId_ = connectionId_;
-        result.statementId_ = statementId_;
-        result.ownStatement_ = ownStatement_;
-        if (signatureBuilder_ == null) {
-          result.signature_ = signature_;
-        } else {
-          result.signature_ = signatureBuilder_.build();
-        }
-        if (firstFrameBuilder_ == null) {
-          result.firstFrame_ = firstFrame_;
-        } else {
-          result.firstFrame_ = firstFrameBuilder_.build();
-        }
-        result.updateCount_ = updateCount_;
-        if (metadataBuilder_ == null) {
-          result.metadata_ = metadata_;
-        } else {
-          result.metadata_ = metadataBuilder_.build();
-        }
-        onBuilt();
-        return result;
-      }
-
-      public Builder clone() {
-        return (Builder) super.clone();
-      }
-      public Builder setField(
-          com.google.protobuf.Descriptors.FieldDescriptor field,
-          Object value) {
-        return (Builder) super.setField(field, value);
-      }
-      public Builder clearField(
-          com.google.protobuf.Descriptors.FieldDescriptor field) {
-        return (Builder) super.clearField(field);
-      }
-      public Builder clearOneof(
-          com.google.protobuf.Descriptors.OneofDescriptor oneof) {
-        return (Builder) super.clearOneof(oneof);
-      }
-      public Builder setRepeatedField(
-          com.google.protobuf.Descriptors.FieldDescriptor field,
-          int index, Object value) {
-        return (Builder) super.setRepeatedField(field, index, value);
-      }
-      public Builder addRepeatedField(
-          com.google.protobuf.Descriptors.FieldDescriptor field,
-          Object value) {
-        return (Builder) super.addRepeatedField(field, value);
-      }
-      public Builder mergeFrom(com.google.protobuf.Message other) {
-        if (other instanceof org.apache.calcite.avatica.proto.Responses.ResultSetResponse) {
-          return mergeFrom((org.apache.calcite.avatica.proto.Responses.ResultSetResponse)other);
-        } else {
-          super.mergeFrom(other);
-          return this;
-        }
-      }
-
-      public Builder mergeFrom(org.apache.calcite.avatica.proto.Responses.ResultSetResponse other) {
-        if (other == org.apache.calcite.avatica.proto.Responses.ResultSetResponse.getDefaultInstance()) return this;
-        if (!other.getConnectionId().isEmpty()) {
-          connectionId_ = other.connectionId_;
-          onChanged();
-        }
-        if (other.getStatementId() != 0) {
-          setStatementId(other.getStatementId());
-        }
-        if (other.getOwnStatement() != false) {
-          setOwnStatement(other.getOwnStatement());
-        }
-        if (other.hasSignature()) {
-          mergeSignature(other.getSignature());
-        }
-        if (other.hasFirstFrame()) {
-          mergeFirstFrame(other.getFirstFrame());
-        }
-        if (other.getUpdateCount() != 0L) {
-          setUpdateCount(other.getUpdateCount());
-        }
-        if (other.hasMetadata()) {
-          mergeMetadata(other.getMetadata());
-        }
-        onChanged();
-        return this;
-      }
-
-      public final boolean isInitialized() {
-        return true;
-      }
-
-      public Builder mergeFrom(
-          com.google.protobuf.CodedInputStream input,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws java.io.IOException {
-        org.apache.calcite.avatica.proto.Responses.ResultSetResponse parsedMessage = null;
-        try {
-          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
-        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-          parsedMessage = (org.apache.calcite.avatica.proto.Responses.ResultSetResponse) e.getUnfinishedMessage();
-          throw e.unwrapIOException();
-        } finally {
-          if (parsedMessage != null) {
-            mergeFrom(parsedMessage);
-          }
-        }
-        return this;
-      }
-
-      private java.lang.Object connectionId_ = "";
-      /**
-       * <code>optional string connection_id = 1;</code>
-       */
-      public java.lang.String getConnectionId() {
-        java.lang.Object ref = connectionId_;
-        if (!(ref instanceof java.lang.String)) {
-          com.google.protobuf.ByteString bs =
-              (com.google.protobuf.ByteString) ref;
-          java.lang.String s = bs.toStringUtf8();
-          connectionId_ = s;
-          return s;
-        } else {
-          return (java.lang.String) ref;
-        }
-      }
-      /**
-       * <code>optional string connection_id = 1;</code>
-       */
-      public com.google.protobuf.ByteString
-          getConnectionIdBytes() {
-        java.lang.Object ref = connectionId_;
-        if (ref instanceof String) {
-          com.google.protobuf.ByteString b = 
-              com.google.protobuf.ByteString.copyFromUtf8(
-                  (java.lang.String) ref);
-          connectionId_ = b;
-          return b;
-        } else {
-          return (com.google.protobuf.ByteString) ref;
-        }
-      }
-      /**
-       * <code>optional string connection_id = 1;</code>
-       */
-      public Builder setConnectionId(
-          java.lang.String value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  
-        connectionId_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>optional string connection_id = 1;</code>
-       */
-      public Builder clearConnectionId() {
-        
-        connectionId_ = getDefaultInstance().getConnectionId();
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>optional string connection_id = 1;</code>
-       */
-      public Builder setConnectionIdBytes(
-          com.google.protobuf.ByteString value) {
-        if (value == null) {
-    throw new NullPointerException();
-  }
-  checkByteStringIsUtf8(value);
-        
-        connectionId_ = value;
-        onChanged();
-        return this;
-      }
-
-      private int statementId_ ;
-      /**
-       * <code>optional uint32 statement_id = 2;</code>
-       */
-      public int getStatementId() {
-        return statementId_;
-      }
-      /**
-       * <code>optional uint32 statement_id = 2;</code>
-       */
-      public Builder setStatementId(int value) {
-        
-        statementId_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>optional uint32 statement_id = 2;</code>
-       */
-      public Builder clearStatementId() {
-        
-        statementId_ = 0;
-        onChanged();
-        return this;
-      }
-
-      private boolean ownStatement_ ;
-      /**
-       * <code>optional bool own_statement = 3;</code>
-       */
-      public boolean getOwnStatement() {
-        return ownStatement_;
-      }
-      /**
-       * <code>optional bool own_statement = 3;</code>
-       */
-      public Builder setOwnStatement(boolean value) {
-        
-        ownStatement_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <code>optional bool own_statement = 3;</code>
-       */
-      public Builder clearOwnStatement() {
-        
-        ownStatement_ = false;
-        onChanged();
-        return this;
-      }
-
-      private org.apache.calcite.avatica.proto.Common.Signature signature_ = null;
-      private com.google.protobuf.SingleFieldBuilderV3<
-          org.apache.calcite.avatica.proto.Common.Signature, org.apache.calcite.avatica.proto.Common.Signature.Builder, org.apache.calcite.avatica.proto.Common.SignatureOrBuilder> signatureBuilder_;
-      /**
-       * <code>optional .Signature signature = 4;</code>
-       */
-      public boolean hasSignature() {
-        return signatureBuilder_ != null || signature_ != null;
-      }
-      /**
-       * <code>optional .Signature signature = 4;</code>
-       */
-      public org.apache.calcite.avatica.proto.Common.Signature getSignature() {
-        if (signatureBuilder_ == null) {
-          return signature_ == null ? org.apache.calcite.avatica.proto.Common.Signature.getDefaultInstance() : signature_;
-        } else {
-          return signatureBuilder_.getMessage();
-        }
-      }
-      /**
-       * <code>optional .Signature signature = 4;</code>
-       */
-      public Builder setSignature(org.apache.calcite.avatica.proto.Common.Signature value) {
-        if (signatureBuilder_ == null) {
-          if (value == null) {
-            throw new NullPointerException();
-          }
-          signature_ = value;
-          onChanged();
-        } else {
-          signatureBuilder_.setMessage(value);
-        }
-
-        return this;
-      }
-      /**
-       * <code>optional .Signature signature = 4;</code>
-       */
-      public Builder setSignature(
-          org.apache.calcite.avatica.proto.Common.Signature.Builder builderForValue) {
-        if (signatureBuilder_ == null) {
-          signature_ = builderForValue.build();
-          onChanged();
-        } else {
-          signatureBuilder_.setMessage(builderForValue.build());
-        }
-
-        return this;
-      }
-      /**
-       * <code>optional .Signature signature = 4;</code>
-       */
-      public Builder mergeSignature(org.apache.calcite.avatica.proto.Common.Signature value) {
-        if (signatureBuilder_ == null) {
-          if (signature_ != null) {
-            signature_ =
-              org.apache.calcite.avatica.proto.Common.Signature.newBuilder(signature_).mergeFrom(value).buildPartial();
-          } else {
-            signature_ = value;
-          }
-          onChanged();
-        } else {
-          signatureBuilder_.mergeFrom(value);
-        }
-
-        return this;
-      }
-      /**
-       * <code>optional .Signature signature = 4;</code>
-       */
-      public Builder clearSignature() {
-        if (signatureBuilder_ == null) {
-          signature_ = null;
-          onChanged();
-        } else {
-          signature_ = null;
-          signatureBuilder_ = null;
-        }
-
-        return this;
-      }
-      /**
-       * <code>optional .Signature signature = 4;</code>
-       */
-      public org.apache.calcite.avatica.proto.Common.Signature.Builder getSignatureBuilder() {
-        
-        onChanged();
-        return getSignatureFieldBuilder().getBuilder();
-      }
-      /**
-       * <code>optional .Signature signature = 4;</code>
-       */
-      public org.apache.calcite.avatica.proto.Common.SignatureOrBuilder getSignatureOrBuilder() {
-        if (signatureBuilder_ != null) {
-          return signatureBuilder_.getMessageOrBuilder();
-        } else {
-          return signature_ == null ?
-              org.apache.calcite.avatica.proto.Common.Signature.getDefaultInstance() : signature_;
-        }
-      }
-      /**
-       * <code>optional .Signature signature = 4;</code>
-       */
-      private com.google.protobuf.SingleFieldBuilderV3<
-          org.apache.calcite.avatica.proto.Common.Signature, org.apache.calcite.avatica.proto.Common.Signature.Builder, org.apache.calcite.avatica.proto.Common.SignatureOrBuilder> 
-          getSignatureFieldBuilder() {
-        if (signatureBuilder_ == null) {
-          signatureBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
-              org.apache.calcite.avatica.proto.Common.Signature, org.apache.calcite.avatica.proto.Common.Signature.Builder, org.apache.calcite.avatica.proto.Common.SignatureOrBuilder>(
-                  getSignature(),
-                  getParentForChildren(),
-                  isClean());
-          signature_ = null;
-        }
-        return signatureBuilder_;
-      }
-
-      private org.apache.calcite.avatica.proto.Common.Frame firstFrame_ = null;
-      private com.google.protobuf.SingleFieldBuilderV3<
-          org.apache.calcite.avatica.proto.Common.Frame, org.apache.calcite.avatica.proto.Common.Frame.Builder, org.apache.calcite.avatica.proto.Common.FrameOrBuilder> firstFrameBuilder_;
-      /**
-       * <code>optional .Frame first_frame = 5;</code>
-       */
-      public boolean hasFirstFrame() {
-        return firstFrameBuilder_ != null || firstFrame_ != null;
-      }
-      /**
-       * <code>optional .Frame first_frame = 5;</code>
-       */
-      public org.apache.calcite.avatica.proto.Common.Frame getFirstFrame() {
-        if (firstFrameBuilder_ == null) {
-          return firstFrame_ == null ? org.apache.calcite.avatica.proto.Common.Frame.getDefaultInstance() : firstFrame_;
-        } else {
-          return firstFrameBuilder_.getMessage();
-        }
-      }
-      /**
-       * <code>optional .Frame first_frame = 5;</code>
-       */
-      public Builder setFirstFrame(org.apache.calcite.avatica.proto.Common.Frame value) {
-        if (firstFrameBuilder_ == null) {
-          if (value == null) {
-            throw new NullPointerException();
-          }
-          firstFrame_ = value;
-          onChanged();
-        } else {
-          firstFrameBuilder_.setMessage(value);
-        }
-
-        return this;
-      }
-      /**
-       * <code>optional .Frame first_frame = 5;</code>
-       */
-      public Builder setFirstFrame(
-          org.apache.calcite.avatica.proto.Common.Frame.Builder builderForValue) {
-        if (firstFrameBuilder_ == null) {
-          firstFrame_ = builderForValue.build();
-          onChanged();
-        } else {
-          firstFrameBuilder_.setMessage(builderForValue.build());
-        }
-
-        return this;
-      }
-      /**
-       * <code>optional .Frame first_frame = 5;</code>
-       */
-      public Builder mergeFirstFrame(org.apache.calcite.avatica.proto.Common.Frame value) {
-        if (firstFrameBuilder_ == null) {
-          if (firstFrame_ != null) {
-            firstFrame_ =
-              org.apache.calcite.avatica.proto.Common.Frame.newBuilder(firstFrame_).mergeFrom(value).buildPartial();
-          } else {
-            firstFrame_ = value;
-          }
-          onChanged();
-        } else {
-          firstFrameBuilder_.mergeFrom(value);
-        }
-
-        return this;
-      }
-      /**
-       * <code>optional .Frame first_frame = 5;</code>
-       */
-      public Builder clearFirstFrame() {
-        if (firstFrameBuilder_ == null) {
-          firstFrame_ = null;
-          onChanged();
-        } else {
-          firstFrame_ = null;
-          firstFrameBuilder_ = null;
-        }
-
-        return this;
-      }
-      /**
-       * <code>optional .Frame first_frame = 5;</code>
-       */
-      public org.apache.calcite.avatica.proto.Common.Frame.Builder getFirstFrameBuilder() {
-        
-        onChanged();
-        return getFirstFrameFieldBuilder().getBuilder();
-      }
-      /**
-       * <code>optional .Frame first_frame = 5;</code>
-       */
-      public org.apache.calcite.avatica.proto.Common.FrameOrBuilder getFirstFrameOrBuilder() {
-        if (firstFrameBuilder_ != null) {
-          return firstFrameBuilder_.getMessageOrBuilder();
-        } else {
-          return firstFrame_ == null ?
-              org.apache.calcite.avatica.proto.Common.Frame.getDefaultInstance() : firstFrame_;
-        }
-      }
-      /**
-       * <code>optional .Frame first_frame = 5;</code>
-       */
-      private com.google.protobuf.SingleFieldBuilderV3<
-          org.apache.calcite.avatica.proto.Common.Frame, org.apache.calcite.avatica.proto.Common.Frame.Builder, org.apache.calcite.avatica.proto.Common.FrameOrBuilder> 
-          getFirstFrameFieldBuilder() {
-        if (firstFrameBuilder_ == null) {
-          firstFrameBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
-              org.apache.calcite.avatica.proto.Common.Frame, org.apache.calcite.avatica.proto.Common.Frame.Builder, org.apache.calcite.avatica.proto.Common.FrameOrBuilder>(
-                  getFirstFrame(),
-                  getParentForChildren(),
-                  isClean());
-          firstFrame_ = null;
-        }
-        return firstFrameBuilder_;
-      }
-
-      private long updateCount_ ;
-      /**
-       * <pre>
-       * -1 for normal result sets, else this response contains a dummy result set
-       * </pre>
-       *
-       * <code>optional uint64 update_count = 6;</code>
-       */
-      public long getUpdateCount() {
-        return updateCount_;
-      }
-      /**
-       * <pre>
-       * -1 for normal result sets, else this response contains a dummy result set
-       * </pre>
-       *
-       * <code>optional uint64 update_count = 6;</code>
-       */
-      public Builder setUpdateCount(long value) {
-        
-        updateCount_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <pre>
-       * -1 for normal result sets, else this response contains a dummy result set
-       * </pre>
-       *
-       * <code>optional uint64 update_count = 6;</code>
-       */
-      public Builder clearUpdateCount() {
-        
-        updateCount_ = 0L;
-        onChanged();
-        return this;
-      }
-
-      private org.apache.calcite.avatica.proto.Responses.RpcMetadata metadata_ = null;
-      private com.google.protobuf.SingleFieldBuilderV3<
-          org.apache.calcite.avatica.proto.Responses.RpcMetadata, org.apache.calcite.avatica.proto.Responses.RpcMetadata.Builder, org.apache.calcite.avatica.proto.Responses.RpcMetadataOrBuilder> metadataBuilder_;
-      /**
-       * <pre>
-       * with no signature nor other data.
-       * </pre>
-       *
-       * <code>optional .RpcMetadata metadata = 7;</code>
-       */
-      public boolean hasMetadata() {
-        return metadataBuilder_ != null || metadata_ != null;
-      }
-      /**
-       * <pre>
-       * with no signature nor other data.
-       * </pre>
-       *
-       * <code>optional .RpcMetadata metadata = 7;</code>
-       */
-      public org.apache.calcite.avatica.proto.Responses.RpcMetadata getMetadata() {
-        if (metadataBuilder_ == null) {
-          return metadata_ == null ? org.apache.calcite.avatica.proto.Responses.RpcMetadata.getDefaultInstance() : metadata_;
-        } else {
-          return metadataBuilder_.getMessage();
-        }
-      }
-      /**
-       * <pre>
-       * with no signature nor other data.
-       * </pre>
-       *
-       * <code>optional .RpcMetadata metadata = 7;</code>
-       */
-      public Builder setMetadata(org.apache.calcite.avatica.proto.Responses.RpcMetadata value) {
-        if (metadataBuilder_ == null) {
-          if (value == null) {
-            throw new NullPointerException();
-          }
-          metadata_ = value;
-          onChanged();
-        } else {
-          metadataBuilder_.setMessage(value);
-        }
-
-        return this;
-      }
-      /**
-       * <pre>
-       * with no signature nor other data.
-       * </pre>
-       *
-       * <code>optional .RpcMetadata metadata = 7;</code>
-       */
-      public Builder setMetadata(
-          org.apache.calcite.avatica.proto.Responses.RpcMetadata.Builder builderForValue) {
-        if (metadataBuilder_ == null) {
-          metadata_ = builderForValue.build();
-          onChanged();
-        } else {
-          metadataBuilder_.setMessage(builderForValue.build());
-        }
-
-        return this;
-      }
-      /**
-       * <pre>
-       * with no signature nor other data.
-       * </pre>
-       *
-       * <code>optional .RpcMetadata metadata = 7;</code>
-       */
-      public Builder mergeMetadata(org.apache.calcite.avatica.proto.Responses.RpcMetadata value) {
-        if (metadataBuilder_ == null) {
-          if (metadata_ != null) {
-            metadata_ =
-              org.apache.calcite.avatica.proto.Responses.RpcMetadata.newBuilder(metadata_).mergeFrom(value).buildPartial();
-          } else {
-            metadata_ = value;
-          }
-          onChanged();
-        } else {
-          metadataBuilder_.mergeFrom(value);
-        }
-
-        return this;
-      }
-      /**
-       * <pre>
-       * with no signature nor other data.
-       * </pre>
-       *
-       * <code>optional .RpcMetadata metadata = 7;</code>
-       */
-      public Builder clearMetadata() {
-        if (metadataBuilder_ == null) {
-          metadata_ = null;
-          onChanged();
-        } else {
-          metadata_ = null;
-          metadataBuilder_ = null;
-        }
-
-        return this;
-      }
-      /**
-       * <pre>
-       * with no signature nor other data.
-       * </pre>
-       *
-       * <code>optional .RpcMetadata metadata = 7;</code>
-       */
-      public org.apache.calcite.avatica.proto.Responses.RpcMetadata.Builder getMetadataBuilder() {
-        
-        onChanged();
-        return getMetadataFieldBuilder().getBuilder();
-      }
-      /**
-       * <pre>
-       * with no signature nor other data.
-       * </pre>
-       *
-       * <code>optional .RpcMetadata metadata = 7;</code>
-       */
-      public org.apache.calcite.avatica.proto.Responses.RpcMetadataOrBuilder getMetadataOrBuilder() {
-        if (metadataBuilder_ != null) {
-          return metadataBuilder_.getMessageOrBuilder();
-        } else {
-          return metadata_ == null ?
-              org.apache.calcite.avatica.proto.Responses.RpcMetadata.getDefaultInstance() : metadata_;
-        }
-      }
-      /**
-       * <pre>
-       * with no signature nor other data.
-       * </pre>
-       *
-       * <code>optional .RpcMetadata metadata = 7;</code>
-       */
-      private com.google.protobuf.SingleFieldBuilderV3<
-          org.apache.calcite.avatica.proto.Responses.RpcMetadata, org.apache.calcite.avatica.proto.Responses.RpcMetadata.Builder, org.apache.calcite.avatica.proto.Responses.RpcMetadataOrBuilder> 
-          getMetadataFieldBuilder() {
-        if (metadataBuilder_ == null) {
-          metadataBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
-              org.apache.calcite.avatica.proto.Responses.RpcMetadata, org.apache.calcite.avatica.proto.Responses.RpcMetadata.Builder, org.apache.calcite.avatica.proto.Responses.RpcMetadataOrBuilder>(
-                  getMetadata(),
-                  getParentForChildren(),
-                  isClean());
-          metadata_ = null;
-        }
-        return metadataBuilder_;
-      }
-      public final Builder setUnknownFields(
-          final com.google.protobuf.UnknownFieldSet unknownFields) {
-        return this;
-      }
-
-      public final Builder mergeUnknownFields(
-          final com.google.protobuf.UnknownFieldSet unknownFields) {
-        return this;
-      }
-
-
-      // @@protoc_insertion_point(builder_scope:ResultSetResponse)
-    }
-
-    // @@protoc_insertion_point(class_scope:ResultSetResponse)
-    private static final org.apache.calcite.avatica.proto.Responses.ResultSetResponse DEFAULT_INSTANCE;
-    static {
-      DEFAULT_INSTANCE = new org.apache.calcite.avatica.proto.Responses.ResultSetResponse();
-    }
-
-    public static org.apache.calcite.avatica.proto.Responses.ResultSetResponse getDefaultInstance() {
-      return DEFAULT_INSTANCE;
-    }
-
-    private static final com.google.protobuf.Parser<ResultSetResponse>
-        PARSER = new com.google.protobuf.AbstractParser<ResultSetResponse>() {
-      public ResultSetResponse parsePartialFrom(
-          com.google.protobuf.CodedInputStream input,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws com.google.protobuf.InvalidProtocolBufferException {
-          return new ResultSetResponse(input, extensionRegistry);
-      }
-    };
-
-    public static com.google.protobuf.Parser<ResultSetResponse> parser() {
-      return PARSER;
-    }
-
-    @java.lang.Override
-    public com.google.protobuf.Parser<ResultSetResponse> getParserForType() {
-      return PARSER;
-    }
-
-    public org.apache.calcite.avatica.proto.Responses.ResultSetResponse getDefaultInstanceForType() {
-      return DEFAULT_INSTANCE;
-    }
-
-  }
-
-  public interface ExecuteResponseOrBuilder extends
-      // @@protoc_insertion_point(interface_extends:ExecuteResponse)
-      com.google.protobuf.MessageOrBuilder {
-
-    /**
-     * <code>repeated .ResultSetResponse results = 1;</code>
-     */
-    java.util.List<org.apache.calcite.avatica.proto.Responses.ResultSetResponse> 
-        getResultsList();
-    /**
-     * <code>repeated .ResultSetResponse results = 1;</code>
-     */
-    org.apache.calcite.avatica.proto.Responses.ResultSetResponse getResults(int index);
-    /**
-     * <code>repeated .ResultSetResponse results = 1;</code>
-     */
-    int getResultsCount();
-    /**
-     * <code>repeated .ResultSetResponse results = 1;</code>
-     */
-    java.util.List<? extends org.apache.calcite.avatica.proto.Responses.ResultSetResponseOrBuilder> 
-        getResultsOrBuilderList();
-    /**
-     * <code>repeated .ResultSetResponse results = 1;</code>
-     */
-    org.apache.calcite.avatica.proto.Responses.ResultSetResponseOrBuilder getResultsOrBuilder(
-        int index);
-
-    /**
-     * <pre>
-     * Did the request fail because of no-cached statement
-     * </pre>
-     *
-     * <code>optional bool missing_statement = 2;</code>
-     */
-    boolean getMissingStatement();
-
-    /**
-     * <code>optional .RpcMetadata metadata = 3;</code>
-     */
-    boolean hasMetadata();
-    /**
-     * <code>optional .RpcMetadata metadata = 3;</code>
-     */
-    org.apache.calcite.avatica.proto.Responses.RpcMetadata getMetadata();
-    /**
-     * <code>optional .RpcMetadata metadata = 3;</code>
-     */
-    org.apache.calcite.avatica.proto.Responses.RpcMetadataOrBuilder getMetadataOrBuilder();
-  }
-  /**
-   * <pre>
-   * Response to PrepareAndExecuteRequest
-   * </pre>
-   *
-   * Protobuf type {@code ExecuteResponse}
-   */
-  public  static final class ExecuteResponse extends
-      com.google.protobuf.GeneratedMessageV3 implements
-      // @@protoc_insertion_point(message_implements:ExecuteResponse)
-      ExecuteResponseOrBuilder {
-    // Use ExecuteResponse.newBuilder() to construct.
-    private ExecuteResponse(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
-      super(builder);
-    }
-    private ExecuteResponse() {
-      results_ = java.util.Collections.emptyList();
-      missingStatement_ = false;
-    }
-
-    @java.lang.Override
-    public final com.google.protobuf.UnknownFieldSet
-    getUnknownFields() {
-      return com.google.protobuf.UnknownFieldSet.getDefaultInstance();
-    }
-    private ExecuteResponse(
-        com.google.protobuf.CodedInputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      this();
-      int mutable_bitField0_ = 0;
-      try {
-        boolean done = false;
-        while (!done) {
-          int tag = input.readTag();
-          switch (tag) {
-            case 0:
-              done = true;
-              break;
-            default: {
-              if (!input.skipField(tag)) {
-                done = true;
-              }
-              break;
-            }
-            case 10: {
-              if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
-                results_ = new java.util.ArrayList<org.apache.calcite.avatica.proto.Responses.ResultSetResponse>();
-                mutable_bitField0_ |= 0x00000001;
-              }
-              results_.add(
-                  input.readMessage(org.apache.calcite.avatica.proto.Responses.ResultSetResponse.parser(), extensionRegistry));
-              break;
-            }
-            case 16: {
-
-              missingStatement_ = input.readBool();
-              break;
-            }
-            case 26: {
-              org.apache.calcite.avatica.proto.Responses.RpcMetadata.Builder subBuilder = null;
-              if (metadata_ != null) {
-                subBuilder = metadata_.toBuilder();
-              }
-              metadata_ = input.readMessage(org.apache.calcite.avatica.proto.Responses.RpcMetadata.parser(), extensionRegistry);
-              if (subBuilder != null) {
-                subBuilder.mergeFrom(metadata_);
-                metadata_ = subBuilder.buildPartial();
-              }
-
-              break;
-            }
-          }
-        }
-      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-        throw e.setUnfinishedMessage(this);
-      } catch (java.io.IOException e) {
-        throw new com.google.protobuf.InvalidProtocolBufferException(
-            e).setUnfinishedMessage(this);
-      } finally {
-        if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
-          results_ = java.util.Collections.unmodifiableList(results_);
-        }
-        makeExtensionsImmutable();
-      }
-    }
-    public static final com.google.protobuf.Descriptors.Descriptor
-        getDescriptor() {
-      return org.apache.calcite.avatica.proto.Responses.internal_static_ExecuteResponse_descriptor;
-    }
-
-    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
-        internalGetFieldAccessorTable() {
-      return org.apache.calcite.avatica.proto.Responses.internal_static_ExecuteResponse_fieldAccessorTable
-          .ensureFieldAccessorsInitialized(
-              org.apache.calcite.avatica.proto.Responses.ExecuteResponse.class, org.apache.calcite.avatica.proto.Responses.ExecuteResponse.Builder.class);
-    }
-
-    private int bitField0_;
-    public static final int RESULTS_FIELD_NUMBER = 1;
-    private java.util.List<org.apache.calcite.avatica.proto.Responses.ResultSetResponse> results_;
-    /**
-     * <code>repeated .ResultSetResponse results = 1;</code>
-     */
-    public java.util.List<org.apache.calcite.avatica.proto.Responses.ResultSetResponse> getResultsList() {
-      return results_;
-    }
-    /**
-     * <code>repeated .ResultSetResponse results = 1;</code>
-     */
-    public java.util.List<? extends org.apache.calcite.avatica.proto.Responses.ResultSetResponseOrBuilder> 
-        getResultsOrBuilderList() {
-      return results_;
-    }
-    /**
-     * <code>repeated .ResultSetResponse results = 1;</code>
-     */
-    public int getResultsCount() {
-      return results_.size();
-    }
-    /**
-     * <code>repeated .ResultSetResponse results = 1;</code>
-     */
-    public org.apache.calcite.avatica.proto.Responses.ResultSetResponse getResults(int index) {
-      return results_.get(index);
-    }
-    /**
-     * <code>repeated .ResultSetResponse results = 1;</code>
-     */
-    public org.apache.calcite.avatica.proto.Responses.ResultSetResponseOrBuilder getResultsOrBuilder(
-        int index) {
-      return results_.get(index);
-    }
-
-    public static final int MISSING_STATEMENT_FIELD_NUMBER = 2;
-    private boolean missingStatement_;
-    /**
-     * <pre>
-     * Did the request fail because of no-cached statement
-     * </pre>
-     *
-     * <code>optional bool missing_statement = 2;</code>
-     */
-    public boolean getMissingStatement() {
-      return missingStatement_;
-    }
-
-    public static final int METADATA_FIELD_NUMBER = 3;
-    private org.apache.calcite.avatica.proto.Responses.RpcMetadata metadata_;
-    /**
-     * <code>optional .RpcMetadata metadata = 3;</code>
-     */
-    public boolean hasMetadata() {
-      return metadata_ != null;
-    }
-    /**
-     * <code>optional .RpcMetadata metadata = 3;</code>
-     */
-    public org.apache.calcite.avatica.proto.Responses.RpcMetadata getMetadata() {
-      return metadata_ == null ? org.apache.calcite.avatica.proto.Responses.RpcMetadata.getDefaultInstance() : metadata_;
-    }
-    /**
-     * <code>optional .RpcMetadata metadata = 3;</code>
-     */
-    public org.apache.calcite.avatica.proto.Responses.RpcMetadataOrBuilder getMetadataOrBuilder() {
-      return getMetadata();
-    }
-
-    private byte memoizedIsInitialized = -1;
-    public final boolean isInitialized() {
-      byte isInitialized = memoizedIsInitialized;
-      if (isInitialized == 1) return true;
-      if (isInitialized == 0) return false;
-
-      memoizedIsInitialized = 1;
-      return true;
-    }
-
-    public void writeTo(com.google.protobuf.CodedOutputStream output)
-                        throws java.io.IOException {
-      for (int i = 0; i < results_.size(); i++) {
-        output.writeMessage(1, results_.get(i));
-      }
-      if (missingStatement_ != false) {
-        output.writeBool(2, missingStatement_);
-      }
-      if (metadata_ != null) {
-        output.writeMessage(3, getMetadata());
-      }
-    }
-
-    public int getSerializedSize() {
-      int size = memoizedSize;
-      if (size != -1) return size;
-
-      size = 0;
-      for (int i = 0; i < results_.size(); i++) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeMessageSize(1, results_.get(i));
-      }
-      if (missingStatement_ != false) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeBoolSize(2, missingStatement_);
-      }
-      if (metadata_ != null) {
-        size += com.google.protobuf.CodedOutputStream
-          .computeMessageSize(3, getMetadata());
-      }
-      memoizedSize = size;
-      return size;
-    }
-
-    private static final long serialVersionUID = 0L;
-    @java.lang.Override
-    public boolean equals(final java.lang.Object obj) {
-      if (obj == this) {
-       return true;
-      }
-      if (!(obj instanceof org.apache.calcite.avatica.proto.Responses.ExecuteResponse)) {
-        return super.equals(obj);
-      }
-      org.apache.calcite.avatica.proto.Responses.ExecuteResponse other = (org.apache.calcite.avatica.proto.Responses.ExecuteResponse) obj;
-
-      boolean result = true;
-      result = result && getResultsList()
-          .equals(other.getResultsList());
-      result = result && (getMissingStatement()
-          == other.getMissingStatement());
-      result = result && (hasMetadata() == other.hasMetadata());
-      if (hasMetadata()) {
-        result = result && getMetadata()
-            .equals(other.getMetadata());
-      }
-      return result;
-    }
-
-    @java.lang.Override
-    public int hashCode() {
-      if (memoizedHashCode != 0) {
-        return memoizedHashCode;
-      }
-      int hash = 41;
-      hash = (19 * hash) + getDescriptorForType().hashCode();
-      if (getResultsCount() > 0) {
-        hash = (37 * hash) + RESULTS_FIELD_NUMBER;
-        hash = (53 * hash) + getResultsList().hashCode();
-      }
-      hash = (37 * hash) + MISSING_STATEMENT_FIELD_NUMBER;
-      hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(
-          getMissingStatement());
-      if (hasMetadata()) {
-        hash = (37 * hash) + METADATA_FIELD_NUMBER;
-        hash = (53 * hash) + getMetadata().hashCode();
-      }
-      hash = (29 * hash) + unknownFields.hashCode();
-      memoizedHashCode = hash;
-      return hash;
-    }
-
-    public static org.apache.calcite.avatica.proto.Responses.ExecuteResponse parseFrom(
-        com.google.protobuf.ByteString data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.apache.calcite.avatica.proto.Responses.ExecuteResponse parseFrom(
-        com.google.protobuf.ByteString data,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data, extensionRegistry);
-    }
-    public static org.apache.calcite.avatica.proto.Responses.ExecuteResponse parseFrom(byte[] data)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data);
-    }
-    public static org.apache.calcite.avatica.proto.Responses.ExecuteResponse parseFrom(
-        byte[] data,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws com.google.protobuf.InvalidProtocolBufferException {
-      return PARSER.parseFrom(data, extensionRegistry);
-    }
-    public static org.apache.calcite.avatica.proto.Responses.ExecuteResponse parseFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseWithIOException(PARSER, input);
-    }
-    public static org.apache.calcite.avatica.proto.Responses.ExecuteResponse parseFrom(
-        java.io.InputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseWithIOException(PARSER, input, extensionRegistry);
-    }
-    public static org.apache.calcite.avatica.proto.Responses.ExecuteResponse parseDelimitedFrom(java.io.InputStream input)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseDelimitedWithIOException(PARSER, input);
-    }
-    public static org.apache.calcite.avatica.proto.Responses.ExecuteResponse parseDelimitedFrom(
-        java.io.InputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
-    }
-    public static org.apache.calcite.avatica.proto.Responses.ExecuteResponse parseFrom(
-        com.google.protobuf.CodedInputStream input)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseWithIOException(PARSER, input);
-    }
-    public static org.apache.calcite.avatica.proto.Responses.ExecuteResponse parseFrom(
-        com.google.protobuf.CodedInputStream input,
-        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-        throws java.io.IOException {
-      return com.google.protobuf.GeneratedMessageV3
-          .parseWithIOException(PARSER, input, extensionRegistry);
-    }
-
-    public Builder newBuilderForType() { return newBuilder(); }
-    public static Builder newBuilder() {
-      return DEFAULT_INSTANCE.toBuilder();
-    }
-    public static Builder newBuilder(org.apache.calcite.avatica.proto.Responses.ExecuteResponse prototype) {
-      return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
-    }
-    public Builder toBuilder() {
-      return this == DEFAULT_INSTANCE
-          ? new Builder() : new Builder().mergeFrom(this);
-    }
-
-    @java.lang.Override
-    protected Builder newBuilderForType(
-        com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
-      Builder builder = new Builder(parent);
-      return builder;
-    }
-    /**
-     * <pre>
-     * Response to PrepareAndExecuteRequest
-     * </pre>
-     *
-     * Protobuf type {@code ExecuteResponse}
-     */
-    public static final class Builder extends
-        com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
-        // @@protoc_insertion_point(builder_implements:ExecuteResponse)
-        org.apache.calcite.avatica.proto.Responses.ExecuteResponseOrBuilder {
-      public static final com.google.protobuf.Descriptors.Descriptor
-          getDescriptor() {
-        return org.apache.calcite.avatica.proto.Responses.internal_static_ExecuteResponse_descriptor;
-      }
-
-      protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
-          internalGetFieldAccessorTable() {
-        return org.apache.calcite.avatica.proto.Responses.internal_static_ExecuteResponse_fieldAccessorTable
-            .ensureFieldAccessorsInitialized(
-                org.apache.calcite.avatica.proto.Responses.ExecuteResponse.class, org.apache.calcite.avatica.proto.Responses.ExecuteResponse.Builder.class);
-      }
-
-      // Construct using org.apache.calcite.avatica.proto.Responses.ExecuteResponse.newBuilder()
-      private Builder() {
-        maybeForceBuilderInitialization();
-      }
-
-      private Builder(
-          com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
-        super(parent);
-        maybeForceBuilderInitialization();
-      }
-      private void maybeForceBuilderInitialization() {
-        if (com.google.protobuf.GeneratedMessageV3
-                .alwaysUseFieldBuilders) {
-          getResultsFieldBuilder();
-        }
-      }
-      public Builder clear() {
-        super.clear();
-        if (resultsBuilder_ == null) {
-          results_ = java.util.Collections.emptyList();
-          bitField0_ = (bitField0_ & ~0x00000001);
-        } else {
-          resultsBuilder_.clear();
-        }
-        missingStatement_ = false;
-
-        if (metadataBuilder_ == null) {
-          metadata_ = null;
-        } else {
-          metadata_ = null;
-          metadataBuilder_ = null;
-        }
-        return this;
-      }
-
-      public com.google.protobuf.Descriptors.Descriptor
-          getDescriptorForType() {
-        return org.apache.calcite.avatica.proto.Responses.internal_static_ExecuteResponse_descriptor;
-      }
-
-      public org.apache.calcite.avatica.proto.Responses.ExecuteResponse getDefaultInstanceForType() {
-        return org.apache.calcite.avatica.proto.Responses.ExecuteResponse.getDefaultInstance();
-      }
-
-      public org.apache.calcite.avatica.proto.Responses.ExecuteResponse build() {
-        org.apache.calcite.avatica.proto.Responses.ExecuteResponse result = buildPartial();
-        if (!result.isInitialized()) {
-          throw newUninitializedMessageException(result);
-        }
-        return result;
-      }
-
-      public org.apache.calcite.avatica.proto.Responses.ExecuteResponse buildPartial() {
-        org.apache.calcite.avatica.proto.Responses.ExecuteResponse result = new org.apache.calcite.avatica.proto.Responses.ExecuteResponse(this);
-        int from_bitField0_ = bitField0_;
-        int to_bitField0_ = 0;
-        if (resultsBuilder_ == null) {
-          if (((bitField0_ & 0x00000001) == 0x00000001)) {
-            results_ = java.util.Collections.unmodifiableList(results_);
-            bitField0_ = (bitField0_ & ~0x00000001);
-          }
-          result.results_ = results_;
-        } else {
-          result.results_ = resultsBuilder_.build();
-        }
-        result.missingStatement_ = missingStatement_;
-        if (metadataBuilder_ == null) {
-          result.metadata_ = metadata_;
-        } else {
-          result.metadata_ = metadataBuilder_.build();
-        }
-        result.bitField0_ = to_bitField0_;
-        onBuilt();
-        return result;
-      }
-
-      public Builder clone() {
-        return (Builder) super.clone();
-      }
-      public Builder setField(
-          com.google.protobuf.Descriptors.FieldDescriptor field,
-          Object value) {
-        return (Builder) super.setField(field, value);
-      }
-      public Builder clearField(
-          com.google.protobuf.Descriptors.FieldDescriptor field) {
-        return (Builder) super.clearField(field);
-      }
-      public Builder clearOneof(
-          com.google.protobuf.Descriptors.OneofDescriptor oneof) {
-        return (Builder) super.clearOneof(oneof);
-      }
-      public Builder setRepeatedField(
-          com.google.protobuf.Descriptors.FieldDescriptor field,
-          int index, Object value) {
-        return (Builder) super.setRepeatedField(field, index, value);
-      }
-      public Builder addRepeatedField(
-          com.google.protobuf.Descriptors.FieldDescriptor field,
-          Object value) {
-        return (Builder) super.addRepeatedField(field, value);
-      }
-      public Builder mergeFrom(com.google.protobuf.Message other) {
-        if (other instanceof org.apache.calcite.avatica.proto.Responses.ExecuteResponse) {
-          return mergeFrom((org.apache.calcite.avatica.proto.Responses.ExecuteResponse)other);
-        } else {
-          super.mergeFrom(other);
-          return this;
-        }
-      }
-
-      public Builder mergeFrom(org.apache.calcite.avatica.proto.Responses.ExecuteResponse other) {
-        if (other == org.apache.calcite.avatica.proto.Responses.ExecuteResponse.getDefaultInstance()) return this;
-        if (resultsBuilder_ == null) {
-          if (!other.results_.isEmpty()) {
-            if (results_.isEmpty()) {
-              results_ = other.results_;
-              bitField0_ = (bitField0_ & ~0x00000001);
-            } else {
-              ensureResultsIsMutable();
-              results_.addAll(other.results_);
-            }
-            onChanged();
-          }
-        } else {
-          if (!other.results_.isEmpty()) {
-            if (resultsBuilder_.isEmpty()) {
-              resultsBuilder_.dispose();
-              resultsBuilder_ = null;
-              results_ = other.results_;
-              bitField0_ = (bitField0_ & ~0x00000001);
-              resultsBuilder_ = 
-                com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ?
-                   getResultsFieldBuilder() : null;
-            } else {
-              resultsBuilder_.addAllMessages(other.results_);
-            }
-          }
-        }
-        if (other.getMissingStatement() != false) {
-          setMissingStatement(other.getMissingStatement());
-        }
-        if (other.hasMetadata()) {
-          mergeMetadata(other.getMetadata());
-        }
-        onChanged();
-        return this;
-      }
-
-      public final boolean isInitialized() {
-        return true;
-      }
-
-      public Builder mergeFrom(
-          com.google.protobuf.CodedInputStream input,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws java.io.IOException {
-        org.apache.calcite.avatica.proto.Responses.ExecuteResponse parsedMessage = null;
-        try {
-          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
-        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
-          parsedMessage = (org.apache.calcite.avatica.proto.Responses.ExecuteResponse) e.getUnfinishedMessage();
-          throw e.unwrapIOException();
-        } finally {
-          if (parsedMessage != null) {
-            mergeFrom(parsedMessage);
-          }
-        }
-        return this;
-      }
-      private int bitField0_;
-
-      private java.util.List<org.apache.calcite.avatica.proto.Responses.ResultSetResponse> results_ =
-        java.util.Collections.emptyList();
-      private void ensureResultsIsMutable() {
-        if (!((bitField0_ & 0x00000001) == 0x00000001)) {
-          results_ = new java.util.ArrayList<org.apache.calcite.avatica.proto.Responses.ResultSetResponse>(results_);
-          bitField0_ |= 0x00000001;
-         }
-      }
-
-      private com.google.protobuf.RepeatedFieldBuilderV3<
-          org.apache.calcite.avatica.proto.Responses.ResultSetResponse, org.apache.calcite.avatica.proto.Responses.ResultSetResponse.Builder, org.apache.calcite.avatica.proto.Responses.ResultSetResponseOrBuilder> resultsBuilder_;
-
-      /**
-       * <code>repeated .ResultSetResponse results = 1;</code>
-       */
-      public java.util.List<org.apache.calcite.avatica.proto.Responses.ResultSetResponse> getResultsList() {
-        if (resultsBuilder_ == null) {
-          return java.util.Collections.unmodifiableList(results_);
-        } else {
-          return resultsBuilder_.getMessageList();
-        }
-      }
-      /**
-       * <code>repeated .ResultSetResponse results = 1;</code>
-       */
-      public int getResultsCount() {
-        if (resultsBuilder_ == null) {
-          return results_.size();
-        } else {
-          return resultsBuilder_.getCount();
-        }
-      }
-      /**
-       * <code>repeated .ResultSetResponse results = 1;</code>
-       */
-      public org.apache.calcite.avatica.proto.Responses.ResultSetResponse getResults(int index) {
-        if (resultsBuilder_ == null) {
-          return results_.get(index);
-        } else {
-          return resultsBuilder_.getMessage(index);
-        }
-      }
-      /**
-       * <code>repeated .ResultSetResponse results = 1;</code>
-       */
-      public Builder setResults(
-          int index, org.apache.calcite.avatica.proto.Responses.ResultSetResponse value) {
-        if (resultsBuilder_ == null) {
-          if (value == null) {
-            throw new NullPointerException();
-          }
-          ensureResultsIsMutable();
-          results_.set(index, value);
-          onChanged();
-        } else {
-          resultsBuilder_.setMessage(index, value);
-        }
-        return this;
-      }
-      /**
-       * <code>repeated .ResultSetResponse results = 1;</code>
-       */
-      public Builder setResults(
-          int index, org.apache.calcite.avatica.proto.Responses.ResultSetResponse.Builder builderForValue) {
-        if (resultsBuilder_ == null) {
-          ensureResultsIsMutable();
-          results_.set(index, builderForValue.build());
-          onChanged();
-        } else {
-          resultsBuilder_.setMessage(index, builderForValue.build());
-        }
-        return this;
-      }
-      /**
-       * <code>repeated .ResultSetResponse results = 1;</code>
-       */
-      public Builder addResults(org.apache.calcite.avatica.proto.Responses.ResultSetResponse value) {
-        if (resultsBuilder_ == null) {
-          if (value == null) {
-            throw new NullPointerException();
-          }
-          ensureResultsIsMutable();
-          results_.add(value);
-          onChanged();
-        } else {
-          resultsBuilder_.addMessage(value);
-        }
-        return this;
-      }
-      /**
-       * <code>repeated .ResultSetResponse results = 1;</code>
-       */
-      public Builder addResults(
-          int index, org.apache.calcite.avatica.proto.Responses.ResultSetResponse value) {
-        if (resultsBuilder_ == null) {
-          if (value == null) {
-            throw new NullPointerException();
-          }
-          ensureResultsIsMutable();
-          results_.add(index, value);
-          onChanged();
-        } else {
-          resultsBuilder_.addMessage(index, value);
-        }
-        return this;
-      }
-      /**
-       * <code>repeated .ResultSetResponse results = 1;</code>
-       */
-      public Builder addResults(
-          org.apache.calcite.avatica.proto.Responses.ResultSetResponse.Builder builderForValue) {
-        if (resultsBuilder_ == null) {
-          ensureResultsIsMutable();
-          results_.add(builderForValue.build());
-          onChanged();
-        } else {
-          resultsBuilder_.addMessage(builderForValue.build());
-        }
-        return this;
-      }
-      /**
-       * <code>repeated .ResultSetResponse results = 1;</code>
-       */
-      public Builder addResults(
-          int index, org.apache.calcite.avatica.proto.Responses.ResultSetResponse.Builder builderForValue) {
-        if (resultsBuilder_ == null) {
-          ensureResultsIsMutable();
-          results_.add(index, builderForValue.build());
-          onChanged();
-        } else {
-          resultsBuilder_.addMessage(index, builderForValue.build());
-        }
-        return this;
-      }
-      /**
-       * <code>repeated .ResultSetResponse results = 1;</code>
-       */
-      public Builder addAllResults(
-          java.lang.Iterable<? extends org.apache.calcite.avatica.proto.Responses.ResultSetResponse> values) {
-        if (resultsBuilder_ == null) {
-          ensureResultsIsMutable();
-          com.google.protobuf.AbstractMessageLite.Builder.addAll(
-              values, results_);
-          onChanged();
-        } else {
-          resultsBuilder_.addAllMessages(values);
-        }
-        return this;
-      }
-      /**
-       * <code>repeated .ResultSetResponse results = 1;</code>
-       */
-      public Builder clearResults() {
-        if (resultsBuilder_ == null) {
-          results_ = java.util.Collections.emptyList();
-          bitField0_ = (bitField0_ & ~0x00000001);
-          onChanged();
-        } else {
-          resultsBuilder_.clear();
-        }
-        return this;
-      }
-      /**
-       * <code>repeated .ResultSetResponse results = 1;</code>
-       */
-      public Builder removeResults(int index) {
-        if (resultsBuilder_ == null) {
-          ensureResultsIsMutable();
-          results_.remove(index);
-          onChanged();
-        } else {
-          resultsBuilder_.remove(index);
-        }
-        return this;
-      }
-      /**
-       * <code>repeated .ResultSetResponse results = 1;</code>
-       */
-      public org.apache.calcite.avatica.proto.Responses.ResultSetResponse.Builder getResultsBuilder(
-          int index) {
-        return getResultsFieldBuilder().getBuilder(index);
-      }
-      /**
-       * <code>repeated .ResultSetResponse results = 1;</code>
-       */
-      public org.apache.calcite.avatica.proto.Responses.ResultSetResponseOrBuilder getResultsOrBuilder(
-          int index) {
-        if (resultsBuilder_ == null) {
-          return results_.get(index);  } else {
-          return resultsBuilder_.getMessageOrBuilder(index);
-        }
-      }
-      /**
-       * <code>repeated .ResultSetResponse results = 1;</code>
-       */
-      public java.util.List<? extends org.apache.calcite.avatica.proto.Responses.ResultSetResponseOrBuilder> 
-           getResultsOrBuilderList() {
-        if (resultsBuilder_ != null) {
-          return resultsBuilder_.getMessageOrBuilderList();
-        } else {
-          return java.util.Collections.unmodifiableList(results_);
-        }
-      }
-      /**
-       * <code>repeated .ResultSetResponse results = 1;</code>
-       */
-      public org.apache.calcite.avatica.proto.Responses.ResultSetResponse.Builder addResultsBuilder() {
-        return getResultsFieldBuilder().addBuilder(
-            org.apache.calcite.avatica.proto.Responses.ResultSetResponse.getDefaultInstance());
-      }
-      /**
-       * <code>repeated .ResultSetResponse results = 1;</code>
-       */
-      public org.apache.calcite.avatica.proto.Responses.ResultSetResponse.Builder addResultsBuilder(
-          int index) {
-        return getResultsFieldBuilder().addBuilder(
-            index, org.apache.calcite.avatica.proto.Responses.ResultSetResponse.getDefaultInstance());
-      }
-      /**
-       * <code>repeated .ResultSetResponse results = 1;</code>
-       */
-      public java.util.List<org.apache.calcite.avatica.proto.Responses.ResultSetResponse.Builder> 
-           getResultsBuilderList() {
-        return getResultsFieldBuilder().getBuilderList();
-      }
-      private com.google.protobuf.RepeatedFieldBuilderV3<
-          org.apache.calcite.avatica.proto.Responses.ResultSetResponse, org.apache.calcite.avatica.proto.Responses.ResultSetResponse.Builder, org.apache.calcite.avatica.proto.Responses.ResultSetResponseOrBuilder> 
-          getResultsFieldBuilder() {
-        if (resultsBuilder_ == null) {
-          resultsBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3<
-              org.apache.calcite.avatica.proto.Responses.ResultSetResponse, org.apache.calcite.avatica.proto.Responses.ResultSetResponse.Builder, org.apache.calcite.avatica.proto.Responses.ResultSetResponseOrBuilder>(
-                  results_,
-                  ((bitField0_ & 0x00000001) == 0x00000001),
-                  getParentForChildren(),
-                  isClean());
-          results_ = null;
-        }
-        return resultsBuilder_;
-      }
-
-      private boolean missingStatement_ ;
-      /**
-       * <pre>
-       * Did the request fail because of no-cached statement
-       * </pre>
-       *
-       * <code>optional bool missing_statement = 2;</code>
-       */
-      public boolean getMissingStatement() {
-        return missingStatement_;
-      }
-      /**
-       * <pre>
-       * Did the request fail because of no-cached statement
-       * </pre>
-       *
-       * <code>optional bool missing_statement = 2;</code>
-       */
-      public Builder setMissingStatement(boolean value) {
-        
-        missingStatement_ = value;
-        onChanged();
-        return this;
-      }
-      /**
-       * <pre>
-       * Did the request fail because of no-cached statement
-       * </pre>
-       *
-       * <code>optional bool missing_statement = 2;</code>
-       */
-      public Builder clearMissingStatement() {
-        
-        missingStatement_ = false;
-        onChanged();
-        return this;
-      }
-
-      private org.apache.calcite.avatica.proto.Responses.RpcMetadata metadata_ = null;
-      private com.google.protobuf.SingleFieldBuilderV3<
-          org.apache.calcite.avatica.proto.Responses.RpcMetadata, org.apache.calcite.avatica.proto.Responses.RpcMetadata.Builder, org.apache.calcite.avatica.proto.Responses.RpcMetadataOrBuilder> metadataBuilder_;
-      /**
-       * <code>optional .RpcMetadata metadata = 3;</code>
-       */
-      public boolean hasMetadata() {
-        return metadataBuilder_ != null || metadata_ != null;
-      }
-      /**
-       * <code>optional .RpcMetadata metadata = 3;</code>
-       */
-      public org.apache.calcite.avatica.proto.Responses.RpcMetadata getMetadata() {
-        if (metadataBuilder_ == null) {
-          return metadata_ == null ? org.apache.calcite.avatica.proto.Responses.RpcMetadata.getDefaultInstance() : metadata_;
-        } else {
-          return metadataBuilder_.getMessage();
-        }
-      }
-      /**
-       * <code>optional .RpcMetadata metadata = 3;</code>
-       */
-      public Builder setMetadata(org.apache.calcite.avatica.proto.Responses.RpcMetadata value) {
-        if (metadataBuilder_ == null) {
-          if (value == null) {
-            throw new NullPointerException();
-          }
-          metadata_ = value;
-          onChanged();
-        } else {
-          metadataBuilder_.setMessage(value);
-        }
-
-        return this;
-      }
-      /**
-       * <code>optional .RpcMetadata metadata = 3;</code>
-       */
-      public Builder setMetadata(
-          org.apache.calcite.avatica.proto.Responses.RpcMetadata.Builder builderForValue) {
-        if (metadataBuilder_ == null) {
-          metadata_ = builderForValue.build();
-          onChanged();
-        } else {
-          metadataBuilder_.setMessage(builderForValue.build());
-        }
-
-        return this;
-      }
-      /**
-       * <code>optional .RpcMetadata metadata = 3;</code>
-       */
-      public Builder mergeMetadata(org.apache.calcite.avatica.proto.Responses.RpcMetadata value) {
-        if (metadataBuilder_ == null) {
-          if (metadata_ != null) {
-            metadata_ =
-              org.apache.calcite.avatica.proto.Responses.RpcMetadata.newBuilder(metadata_).mergeFrom(value).buildPartial();
-          } else {
-            metadata_ = value;
-          }
-          onChanged();
-        } else {
-          metadataBuilder_.mergeFrom(value);
-        }
-
-        return this;
-      }
-      /**
-       * <code>optional .RpcMetadata metadata = 3;</code>
-       */
-      public Builder clearMetadata() {
-        if (metadataBuilder_ == null) {
-          metadata_ = null;
-          onChanged();
-        } else {
-          metadata_ = null;
-          metadataBuilder_ = null;
-        }
-
-        return this;
-      }
-      /**
-       * <code>optional .RpcMetadata metadata = 3;</code>
-       */
-      public org.apache.calcite.avatica.proto.Responses.RpcMetadata.Builder getMetadataBuilder() {
-        
-        onChanged();
-        return getMetadataFieldBuilder().getBuilder();
-      }
-      /**
-       * <code>optional .RpcMetadata metadata = 3;</code>
-       */
-      public org.apache.calcite.avatica.proto.Responses.RpcMetadataOrBuilder getMetadataOrBuilder() {
-        if (metadataBuilder_ != null) {
-          return metadataBuilder_.getMessageOrBuilder();
-        } else {
-          return metadata_ == null ?
-              org.apache.calcite.avatica.proto.Responses.RpcMetadata.getDefaultInstance() : metadata_;
-        }
-      }
-      /**
-       * <code>optional .RpcMetadata metadata = 3;</code>
-       */
-      private com.google.protobuf.SingleFieldBuilderV3<
-          org.apache.calcite.avatica.proto.Responses.RpcMetadata, org.apache.calcite.avatica.proto.Responses.RpcMetadata.Builder, org.apache.calcite.avatica.proto.Responses.RpcMetadataOrBuilder> 
-          getMetadataFieldBuilder() {
-        if (metadataBuilder_ == null) {
-          metadataBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
-              org.apache.calcite.avatica.proto.Responses.RpcMetadata, org.apache.calcite.avatica.proto.Responses.RpcMetadata.Builder, org.apache.calcite.avatica.proto.Responses.RpcMetadataOrBuilder>(
-                  getMetadata(),
-                  getParentForChildren(),
-                  isClean());
-          metadata_ = null;
-        }
-        return metadataBuilder_;
-      }
-      public final Builder setUnknownFields(
-          final com.google.protobuf.UnknownFieldSet unknownFields) {
-        return this;
-      }
-
-      public final Builder mergeUnknownFields(
-          final com.google.protobuf.UnknownFieldSet unknownFields) {
-        return this;
-      }
-
-
-      // @@protoc_insertion_point(builder_scope:ExecuteResponse)
-    }
-
-    // @@protoc_insertion_point(class_scope:ExecuteResponse)
-    private static final org.apache.calcite.avatica.proto.Responses.ExecuteResponse DEFAULT_INSTANCE;
-    static {
-      DEFAULT_INSTANCE = new org.apache.calcite.avatica.proto.Responses.ExecuteResponse();
-    }
-
-    public static org.apache.calcite.avatica.proto.Responses.ExecuteResponse getDefaultInstance() {
-      return DEFAULT_INSTANCE;
-    }
-
-    private static final com.google.protobuf.Parser<ExecuteResponse>
-        PARSER = new com.google.protobuf.AbstractParser<ExecuteResponse>() {
-      public ExecuteResponse parsePartialFrom(
-          com.google.protobuf.CodedInputStream input,
-          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
-          throws com.google.protobuf.InvalidProtocolBufferException {
-          return new ExecuteResponse(input, extensionRegistry);
-      }
-    };
-
-    public static com.google.protobuf.Parser<ExecuteResponse> parser() {
-      return PARSER;
-    }
-
-    @java.lang.Override
-    public com.google.protobuf.Parser<ExecuteResponse> getParserForType() {
-      return PARSER;
-    }
-
-    public org.apache.calcite.avatica.proto.Responses.ExecuteResponse getDefaultInstanceForType() {
-      return DEFAULT_INSTANCE;
-    }
-
-  }
-
-  public interface PrepareResponseOrBuilder extends
-      // @@protoc_insertion_point(interface_extends:PrepareResponse)
-      com.google.protobuf.MessageOrBuilder {
-
-    /**
-     * <code>optional .StatementHandle statement = 1;</code>
-     */
-    boolean hasStatement();
-    /**
-     * <code>optional .StatementHandle statement = 1;</code>
-     */
-    org.apache.calcite.avatica.proto.Common.StatementHandle getStatement();
-    /**
-     * <code>optional .StatementHandle statement = 1;</code>
-     */
-    org.apache.calcite.avatica.proto.Common.StatementHandleOrBuilder getStatementOrBuilder();
-
-    /**
-     * <code>optional .RpcMetadata metadata = 2;</code>
-     */
-    boolean hasMetadata();
-    /**
-     * <code>optional .RpcMetadata metadata = 2;</code>
-     */
-    org.apache.calcite.avatica.proto.Responses.RpcMetadata getMetadata();
-    /**
-     * <code>optional .RpcMetadata metadata = 2;</code>
-     */
-    org.apache.calcite.avatica.proto.Responses.RpcMetadataOrBuilder getMetadataOrBuilder();
-  }
-  /**
-   * <pre>
-   * Response to PrepareRequest
-   * </pre>
-   *
-   * Protobuf type {@code PrepareResponse}
-   */
-  public  static final class PrepareResponse extends
-      com.google.protobuf.GeneratedMessageV3 implements
-      // @@protoc_insertion_point(message_implements:PrepareResponse)
-      PrepareResponseOrBuilder {
-    // Use PrepareResponse.newBuilder() to construct.
-    private PrepareResponse(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
-      super(builder);
-    }
-    private PrepareResponse() {
-    }
-
-    @java.lang.Override
-    public final com.google.protobuf.UnknownFieldSet
-    getUnknownFields() {
-      return com.google.protobuf.UnknownFieldSet.getDefaultInstance();
-    }
-    private PrepareResponse(
-        com.google.protobuf.CodedInputStream input,
-        com.google.prot

<TRUNCATED>

[15/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/tck/src/main/java/org/apache/calcite/avatica/tck/TestRunner.java
----------------------------------------------------------------------
diff --git a/avatica/tck/src/main/java/org/apache/calcite/avatica/tck/TestRunner.java b/avatica/tck/src/main/java/org/apache/calcite/avatica/tck/TestRunner.java
deleted file mode 100644
index 6807354..0000000
--- a/avatica/tck/src/main/java/org/apache/calcite/avatica/tck/TestRunner.java
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.tck;
-
-import com.beust.jcommander.JCommander;
-import com.beust.jcommander.Parameter;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.reflect.ClassPath;
-import com.google.common.reflect.ClassPath.ClassInfo;
-
-import org.junit.runner.Description;
-import org.junit.runner.JUnitCore;
-import org.junit.runner.Result;
-import org.junit.runner.notification.Failure;
-import org.junit.runner.notification.RunListener;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.lang.reflect.Modifier;
-import java.sql.Connection;
-import java.sql.Driver;
-import java.sql.DriverManager;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-import java.util.Properties;
-import java.util.concurrent.TimeUnit;
-
-/**
- * Entry point for running an Avatica cross-version compatibility test.
- */
-public class TestRunner implements Runnable {
-  private static final Logger LOG = LoggerFactory.getLogger(TestRunner.class);
-  private static final String ANSI_RESET = "\u001B[0m";
-  private static final String ANSI_RED = "\u001B[31m";
-  private static final String ANSI_GREEN = "\u001B[32m";
-
-  private static Driver driver;
-  private static String driverUrl;
-
-  @Parameter(names = { "-u", "--jdbcUrl" }, description = "JDBC URL for Avatica Driver")
-  private String jdbcUrl;
-
-  private JUnitCore junitCore;
-
-  /**
-   * Returns the {@link Connection} for tests to use.
-   *
-   * @return A JDBC Connection.
-   */
-  public static Connection getConnection() throws SQLException {
-    if (null == driver) {
-      throw new IllegalStateException("JDBC Driver is not initialized");
-    }
-
-    return driver.connect(driverUrl, new Properties());
-  }
-
-  @Override public void run() {
-    // Construct the Connection
-    initializeDriver();
-
-    if (null == driver) {
-      LOG.error("Failed to find driver for {}", jdbcUrl);
-      Unsafe.systemExit(TestRunnerExitCodes.NO_SUCH_DRIVER.ordinal());
-      return;
-    }
-
-    // Initialize JUnit
-    initializeJUnit();
-
-    // Enumerate available test cases
-    final List<Class<?>> testClasses = getAllTestClasses();
-
-    final TestResults globalResults = new TestResults();
-
-    // Run each test case
-    for (Class<?> testClass : testClasses) {
-      runSingleTest(globalResults, testClass);
-    }
-
-    System.out.println(globalResults.summarize());
-
-    if (globalResults.numFailed > 0) {
-      // Tests failed, don't exit normally
-      Unsafe.systemExit(TestRunnerExitCodes.FAILED_TESTS.ordinal());
-    } else {
-      // Exited normally
-      Unsafe.systemExit(TestRunnerExitCodes.NORMAL.ordinal());
-    }
-  }
-
-  /**
-   * Finds all tests to run for the TCK.
-   *
-   * @return A list of test classes to run.
-   */
-  List<Class<?>> getAllTestClasses() {
-    try {
-      ClassPath cp = ClassPath.from(getClass().getClassLoader());
-      ImmutableSet<ClassInfo> classes =
-          cp.getTopLevelClasses("org.apache.calcite.avatica.tck.tests");
-
-      List<Class<?>> testClasses = new ArrayList<>(classes.size());
-      for (ClassInfo classInfo : classes) {
-        if (classInfo.getSimpleName().equals("package-info")) {
-          continue;
-        }
-        Class<?> clz = Class.forName(classInfo.getName());
-        if (Modifier.isAbstract(clz.getModifiers())) {
-          // Ignore abstract classes
-          continue;
-        }
-        testClasses.add(clz);
-      }
-
-      return testClasses;
-    } catch (Exception e) {
-      LOG.error("Failed to instantiate test classes", e);
-      Unsafe.systemExit(TestRunnerExitCodes.TEST_CASE_INSTANTIATION.ordinal());
-      // Unreachable..
-      return null;
-    }
-  }
-
-  void initializeDriver() {
-    try {
-      // Make sure the Avatica Driver gets loaded
-      Class.forName("org.apache.calcite.avatica.remote.Driver");
-      driverUrl = jdbcUrl;
-      driver = DriverManager.getDriver(driverUrl);
-    } catch (SQLException e) {
-      LOG.error("Could not instantiate JDBC Driver with URL: '{}'", jdbcUrl, e);
-      Unsafe.systemExit(TestRunnerExitCodes.BAD_JDBC_URL.ordinal());
-    } catch (ClassNotFoundException e) {
-      LOG.error("Could not load Avatica Driver class", e);
-      Unsafe.systemExit(TestRunnerExitCodes.MISSING_DRIVER_CLASS.ordinal());
-    }
-  }
-
-  /**
-   * Sets up JUnit to run the tests for us.
-   */
-  void initializeJUnit() {
-    junitCore = new JUnitCore();
-
-    junitCore.addListener(new RunListener() {
-      @Override public void testStarted(Description description) throws Exception {
-        LOG.debug("Starting {}", description);
-      }
-
-      @Override public void testFinished(Description description) throws Exception {
-        LOG.debug("{}Finished {}{}", ANSI_GREEN, description, ANSI_RESET);
-      }
-
-      @Override public void testFailure(Failure failure) throws Exception {
-        LOG.info("{}Failed {}{}", ANSI_RED, failure.getDescription(), ANSI_RESET,
-            failure.getException());
-      }
-    });
-  }
-
-  /**
-   * Runs a single test class, adding its results to <code>globalResults</code>.
-   *
-   * @param globalResults A global record of test results.
-   * @param testClass The test class to run.
-   */
-  void runSingleTest(final TestResults globalResults, final Class<?> testClass) {
-    final String className = Objects.requireNonNull(testClass).getName();
-    LOG.info("{}Running {}{}", ANSI_GREEN, className, ANSI_RESET);
-
-    try {
-      Result result = junitCore.run(testClass);
-      globalResults.merge(testClass, result);
-    } catch (Exception e) {
-      // most likely JUnit issues, like no tests to run
-      LOG.error("{}Test failed: {}{}", ANSI_RED, className, ANSI_RESET, e);
-    }
-  }
-
-  public static void main(String[] args) {
-    TestRunner runner = new TestRunner();
-
-    // Parse the args, sets it on runner.
-    new JCommander(runner, args);
-
-    // Run the tests.
-    runner.run();
-  }
-
-  /**
-   * A container to track results from all tests executed.
-   */
-  private static class TestResults {
-    private int numRun = 0;
-    private int numFailed = 0;
-    private int numIgnored = 0;
-    private List<Failure> failures = new ArrayList<>();
-
-    /**
-     * Updates the current state of <code>this</code> with the <code>result</code>.
-     *
-     * @param testClass The test class executed.
-     * @param result The results of the test class execution.
-     * @return <code>this</code>
-     */
-    public TestResults merge(Class<?> testClass, Result result) {
-      LOG.info("Tests run: {}, Failures: {}, Skipped: {}, Time elapsed: {} - in {}",
-          result.getRunCount(), result.getFailureCount(), result.getIgnoreCount(),
-          TimeUnit.SECONDS.convert(result.getRunTime(), TimeUnit.MILLISECONDS),
-          testClass.getName());
-
-      numRun += result.getRunCount();
-      numFailed += result.getFailureCount();
-      numIgnored += result.getIgnoreCount();
-
-      // Collect the failures
-      if (!result.wasSuccessful()) {
-        failures.addAll(result.getFailures());
-      }
-
-      return this;
-    }
-
-    /**
-     * Constructs a human-readable summary of the success/failure of the tests executed.
-     *
-     * @return A summary in the form of a String.
-     */
-    public String summarize() {
-      StringBuilder sb = new StringBuilder(64);
-      sb.append("\nTest Summary: Run: ").append(numRun).append(", Failed: ").append(numFailed);
-      sb.append(", Skipped: ").append(numIgnored);
-      if (numFailed > 0) {
-        sb.append(ANSI_RED).append("\n\nFailures:").append(ANSI_RESET).append("\n\n");
-        for (Failure failure : failures) {
-          sb.append(failure.getTestHeader()).append(" ").append(failure.getMessage()).append("\n");
-        }
-      }
-      return sb.toString();
-    }
-  }
-
-  /**
-   * ExitCodes set by {@link TestRunner}.
-   */
-  private enum TestRunnerExitCodes {
-    // Position is important, ordinal() is used!
-    NORMAL,                  // 0, all tests passed
-    BAD_JDBC_URL,            // 1
-    TEST_CASE_INSTANTIATION, // 2
-    NO_SUCH_DRIVER,          // 3
-    FAILED_TESTS,            // 4
-    MISSING_DRIVER_CLASS;    // 5
-  }
-}
-
-// End TestRunner.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/tck/src/main/java/org/apache/calcite/avatica/tck/Unsafe.java
----------------------------------------------------------------------
diff --git a/avatica/tck/src/main/java/org/apache/calcite/avatica/tck/Unsafe.java b/avatica/tck/src/main/java/org/apache/calcite/avatica/tck/Unsafe.java
deleted file mode 100644
index e88b6b7..0000000
--- a/avatica/tck/src/main/java/org/apache/calcite/avatica/tck/Unsafe.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.tck;
-
-import java.util.Calendar;
-import java.util.Locale;
-
-/**
- * Contains methods that call JDK methods that the
- * <a href="https://github.com/policeman-tools/forbidden-apis">forbidden
- * APIs checker</a> does not approve of.
- *
- * <p>This class is excluded from the check, so methods called via this class
- * will not fail the build.
- */
-class Unsafe {
-  private Unsafe() {}
-
-  /** Calls {@link System#exit}. */
-  static void systemExit(int status) {
-    System.exit(status);
-  }
-
-  /** Calls {@link Object#notifyAll()}. */
-  public static void notifyAll(Object o) {
-    o.notifyAll();
-  }
-
-  /** Calls {@link Object#wait()}. */
-  public static void wait(Object o) throws InterruptedException {
-    o.wait();
-  }
-
-  /** Returns a {@link Calendar} with the local time zone and root
-   * locale. */
-  public static Calendar localCalendar() {
-    return Calendar.getInstance(Locale.ROOT);
-  }
-}
-
-// End Unsafe.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/tck/src/main/java/org/apache/calcite/avatica/tck/package-info.java
----------------------------------------------------------------------
diff --git a/avatica/tck/src/main/java/org/apache/calcite/avatica/tck/package-info.java b/avatica/tck/src/main/java/org/apache/calcite/avatica/tck/package-info.java
deleted file mode 100644
index 77c2d16..0000000
--- a/avatica/tck/src/main/java/org/apache/calcite/avatica/tck/package-info.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * Avatica compatibility framework.
- */
-@PackageMarker
-package org.apache.calcite.avatica.tck;
-
-// End package-info.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/tck/src/main/java/org/apache/calcite/avatica/tck/tests/BaseTckTest.java
----------------------------------------------------------------------
diff --git a/avatica/tck/src/main/java/org/apache/calcite/avatica/tck/tests/BaseTckTest.java b/avatica/tck/src/main/java/org/apache/calcite/avatica/tck/tests/BaseTckTest.java
deleted file mode 100644
index 8799cf1..0000000
--- a/avatica/tck/src/main/java/org/apache/calcite/avatica/tck/tests/BaseTckTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.tck.tests;
-
-import org.apache.calcite.avatica.tck.TestRunner;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.rules.TestName;
-
-import java.sql.Connection;
-
-/**
- * Base class for TCK tests.
- */
-public abstract class BaseTckTest {
-
-  @Rule public TestName name = new TestName();
-
-  protected Connection connection;
-
-  @Before public void initializeConnection() throws Exception {
-    connection = TestRunner.getConnection();
-  }
-
-  @After public void closeConnection() throws Exception {
-    if (null != connection) {
-      connection.close();
-    }
-  }
-
-  protected Connection getConnection() {
-    return connection;
-  }
-
-  protected String getTableName() {
-    return getClass().getSimpleName() + "_" + name.getMethodName();
-  }
-}
-
-// End BaseTckTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/tck/src/main/java/org/apache/calcite/avatica/tck/tests/BinaryTest.java
----------------------------------------------------------------------
diff --git a/avatica/tck/src/main/java/org/apache/calcite/avatica/tck/tests/BinaryTest.java b/avatica/tck/src/main/java/org/apache/calcite/avatica/tck/tests/BinaryTest.java
deleted file mode 100644
index 50c7082..0000000
--- a/avatica/tck/src/main/java/org/apache/calcite/avatica/tck/tests/BinaryTest.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.tck.tests;
-
-import org.junit.Test;
-
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.Statement;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import static java.nio.charset.StandardCharsets.UTF_8;
-
-/**
- * TCK test case to verify binary data can be written and read correctly.
- */
-public class BinaryTest extends BaseTckTest {
-
-  @Test public void readWriteBinaryData() throws Exception {
-    final String tableName = getTableName();
-    try (Statement stmt = connection.createStatement()) {
-      assertFalse(stmt.execute("DROP TABLE IF EXISTS " + tableName));
-      String sql = "CREATE TABLE " + tableName
-          + " (pk integer not null primary key, col1 binary(10))";
-      assertFalse(stmt.execute(sql));
-
-      try (PreparedStatement pstmt = connection.prepareStatement("INSERT INTO " + tableName
-          + " values (?,?)")) {
-        for (int i = 0; i < 10; i++) {
-          pstmt.setInt(1, i);
-          pstmt.setBytes(2, ("bytes" + i).getBytes(UTF_8));
-          assertEquals(1, pstmt.executeUpdate());
-        }
-      }
-
-      ResultSet results = stmt.executeQuery("SELECT * FROM " + tableName);
-      assertNotNull(results);
-      for (int i = 0; i < 10; i++) {
-        assertTrue(results.next());
-        assertEquals(i, results.getInt(1));
-        byte[] expectedContent = ("bytes" + i).getBytes(UTF_8);
-        byte[] expected = new byte[10];
-        System.arraycopy(expectedContent, 0, expected, 0, expectedContent.length);
-        assertArrayEquals(expected, results.getBytes(2));
-      }
-      assertFalse(results.next());
-      results.close();
-    }
-  }
-
-  @Test public void selectivelyReadBinaryData() throws Exception {
-    final String tableName = getTableName();
-    try (Statement stmt = connection.createStatement()) {
-      assertFalse(stmt.execute("DROP TABLE IF EXISTS " + tableName));
-      String sql = "CREATE TABLE " + tableName
-          + " (pk integer not null primary key, col1 binary(10))";
-      assertFalse(stmt.execute(sql));
-
-      try (PreparedStatement pstmt = connection.prepareStatement("INSERT INTO " + tableName
-          + " values (?,?)")) {
-        for (int i = 0; i < 10; i++) {
-          pstmt.setInt(1, i);
-          pstmt.setBytes(2, ("bytes" + i).getBytes(UTF_8));
-          assertEquals(1, pstmt.executeUpdate());
-        }
-      }
-
-      try (PreparedStatement pstmt = connection.prepareStatement("SELECT * FROM " + tableName
-          + " WHERE col1 = ?")) {
-        byte[] expectedContent = ("bytes" + 4).getBytes(UTF_8);
-        byte[] expected = new byte[10];
-        System.arraycopy(expectedContent, 0, expected, 0, expectedContent.length);
-        pstmt.setBytes(1, expected);
-        ResultSet results = pstmt.executeQuery();
-        assertNotNull(results);
-        assertTrue(results.next());
-        assertEquals(4, results.getInt(1));
-        assertArrayEquals(expected, results.getBytes(2));
-        assertFalse(results.next());
-        results.close();
-      }
-    }
-  }
-}
-
-// End BinaryTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/tck/src/main/java/org/apache/calcite/avatica/tck/tests/InsertTest.java
----------------------------------------------------------------------
diff --git a/avatica/tck/src/main/java/org/apache/calcite/avatica/tck/tests/InsertTest.java b/avatica/tck/src/main/java/org/apache/calcite/avatica/tck/tests/InsertTest.java
deleted file mode 100644
index 11c44d7..0000000
--- a/avatica/tck/src/main/java/org/apache/calcite/avatica/tck/tests/InsertTest.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.tck.tests;
-
-import org.junit.Assume;
-import org.junit.Test;
-
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLFeatureNotSupportedException;
-import java.sql.Statement;
-import java.util.Arrays;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-/**
- * Tests for <code>INSERT</code>.
- */
-public class InsertTest extends BaseTckTest {
-
-  @Test public void simpleInsert() throws Exception {
-    final String tableName = getTableName();
-    try (Statement stmt = connection.createStatement()) {
-      assertFalse(stmt.execute("DROP TABLE IF EXISTS " + tableName));
-      String sql = "CREATE TABLE " + tableName
-          + " (pk integer not null primary key, col1 varchar(10))";
-      assertFalse(stmt.execute(sql));
-
-      for (int i = 0; i < 10; i++) {
-        sql = "INSERT INTO " + tableName + " values (" + i + ", '" + i + "')";
-        assertEquals(1, stmt.executeUpdate(sql));
-      }
-
-      ResultSet results = stmt.executeQuery("SELECT * FROM " + tableName);
-      assertNotNull(results);
-      for (int i = 0; i < 10; i++) {
-        assertTrue(results.next());
-        assertEquals(i, results.getInt(1));
-        assertEquals(Integer.toString(i), results.getString(1));
-      }
-      assertFalse(results.next());
-      results.close();
-    }
-  }
-
-  @Test public void preparedStatementInsert() throws Exception {
-    final String tableName = getTableName();
-    final String insertSql = "INSERT INTO " + tableName + " values(?, ?)";
-    try (Statement stmt = connection.createStatement()) {
-      assertFalse(stmt.execute("DROP TABLE IF EXISTS " + tableName));
-      String sql = "CREATE TABLE " + tableName
-          + " (pk integer not null primary key, col1 varchar(10))";
-      assertFalse(stmt.execute(sql));
-
-      try (PreparedStatement pstmt = connection.prepareStatement(insertSql)) {
-        for (int i = 0; i < 10; i++) {
-          pstmt.setInt(1, i);
-          pstmt.setString(2, "a_" + Integer.toString(i));
-          assertEquals(1, pstmt.executeUpdate());
-        }
-      }
-
-      ResultSet results = stmt.executeQuery("SELECT COUNT(pk) from " + tableName);
-      assertNotNull(results);
-      assertTrue(results.next());
-      assertEquals(10, results.getInt(1));
-
-      results = stmt.executeQuery("SELECT * from " + tableName);
-      assertNotNull(results);
-      for (int i = 0; i < 10; i++) {
-        assertTrue(results.next());
-        assertEquals(i, results.getInt(1));
-        assertEquals("a_" + i, results.getString(2));
-      }
-      assertFalse(results.next());
-      results.close();
-    }
-  }
-
-  @Test public void batchInsert() throws Exception {
-    final String tableName = getTableName();
-    try (Statement stmt = connection.createStatement()) {
-      assertFalse(stmt.execute("DROP TABLE IF EXISTS " + tableName));
-      String sql = "CREATE TABLE " + tableName
-          + " (pk integer not null primary key, col1 varchar(10))";
-      assertFalse(stmt.execute(sql));
-
-      for (int i = 0; i < 10; i++) {
-        sql = "INSERT INTO " + tableName + " values (" + i + ", '" + i + "')";
-        try {
-          stmt.addBatch(sql);
-        } catch (SQLFeatureNotSupportedException e) {
-          // batch isn't supported in this version, gracefully ignore,
-          Assume.assumeTrue("Batch update is not support by the client", false);
-        }
-      }
-
-      int[] updateCounts = stmt.executeBatch();
-      int[] expectedUpdateCounts = new int[10];
-      Arrays.fill(expectedUpdateCounts, 1);
-      assertArrayEquals(expectedUpdateCounts, updateCounts);
-
-      ResultSet results = stmt.executeQuery("SELECT * FROM " + tableName);
-      assertNotNull(results);
-      for (int i = 0; i < 10; i++) {
-        assertTrue(results.next());
-        assertEquals(i, results.getInt(1));
-        assertEquals(Integer.toString(i), results.getString(1));
-      }
-      assertFalse(results.next());
-      results.close();
-    }
-  }
-
-  @Test public void preparedBatchInsert() throws Exception {
-    final String tableName = getTableName();
-    final String insertSql = "INSERT INTO " + tableName + " values(?, ?)";
-    try (Statement stmt = connection.createStatement()) {
-      assertFalse(stmt.execute("DROP TABLE IF EXISTS " + tableName));
-      String sql = "CREATE TABLE " + tableName
-          + " (pk integer not null primary key, col1 varchar(10))";
-      assertFalse(stmt.execute(sql));
-
-      try (PreparedStatement pstmt = connection.prepareStatement(insertSql)) {
-        for (int i = 0; i < 10; i++) {
-          pstmt.setInt(1, i);
-          pstmt.setString(2, "a_" + Integer.toString(i));
-          try {
-            pstmt.addBatch();
-          } catch (SQLFeatureNotSupportedException e) {
-            // batch isn't supported in this version, gracefully ignore,
-            Assume.assumeTrue("Batch update is not support by the client", false);
-          }
-        }
-
-        int[] updateCounts = pstmt.executeBatch();
-        int[] expectedUpdateCounts = new int[10];
-        Arrays.fill(expectedUpdateCounts, 1);
-        assertArrayEquals(expectedUpdateCounts, updateCounts);
-      }
-
-      ResultSet results = stmt.executeQuery("SELECT COUNT(pk) from " + tableName);
-      assertNotNull(results);
-      assertTrue(results.next());
-      assertEquals(10, results.getInt(1));
-
-      results = stmt.executeQuery("SELECT * from " + tableName);
-      assertNotNull(results);
-      for (int i = 0; i < 10; i++) {
-        assertTrue(results.next());
-        assertEquals(i, results.getInt(1));
-        assertEquals("a_" + i, results.getString(2));
-      }
-      assertFalse(results.next());
-      results.close();
-    }
-  }
-
-  @Test public void commitAndRollback() throws Exception {
-    final String tableName = getTableName();
-
-    // Disable autoCommit
-    connection.setAutoCommit(false);
-    assertFalse(connection.getAutoCommit());
-
-    try (Statement stmt = connection.createStatement()) {
-      assertFalse(stmt.execute("DROP TABLE IF EXISTS " + tableName));
-      String sql = "CREATE TABLE " + tableName
-          + " (pk integer not null primary key, col1 varchar(10))";
-      assertFalse(stmt.execute(sql));
-
-      for (int i = 0; i < 10; i++) {
-        sql = "INSERT INTO " + tableName + " values (" + i + ", '" + i + "')";
-        assertEquals(1, stmt.executeUpdate(sql));
-        if (i == 4) {
-          // Rollback after the first 5 updates
-          connection.rollback();
-        }
-      }
-      connection.commit();
-
-      ResultSet results = stmt.executeQuery("SELECT * FROM " + tableName);
-      assertNotNull(results);
-      for (int i = 5; i < 10; i++) {
-        assertTrue(results.next());
-        assertEquals(i, results.getInt(1));
-        assertEquals(Integer.toString(i), results.getString(1));
-      }
-      assertFalse(results.next());
-      results.close();
-    }
-  }
-}
-
-// End InsertTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/tck/src/main/java/org/apache/calcite/avatica/tck/tests/MetadataTest.java
----------------------------------------------------------------------
diff --git a/avatica/tck/src/main/java/org/apache/calcite/avatica/tck/tests/MetadataTest.java b/avatica/tck/src/main/java/org/apache/calcite/avatica/tck/tests/MetadataTest.java
deleted file mode 100644
index 9c92ec0..0000000
--- a/avatica/tck/src/main/java/org/apache/calcite/avatica/tck/tests/MetadataTest.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.tck.tests;
-
-import org.junit.Test;
-
-import java.math.BigDecimal;
-import java.sql.ParameterMetaData;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
-import java.sql.Statement;
-import java.sql.Types;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-/**
- * Test class for metadata operations (parameter, resultset).
- */
-public class MetadataTest extends BaseTckTest {
-
-  @Test public void parameterMetadata() throws Exception {
-    final String tableName = getTableName();
-    try (Statement stmt = getConnection().createStatement()) {
-      assertFalse(stmt.execute("DROP TABLE IF EXISTS " + tableName));
-      String sql = "CREATE TABLE " + tableName + " (pk integer not null primary key, "
-          + "col1 DECIMAL(10, 5), col2 boolean not null)";
-      assertFalse(stmt.execute(sql));
-
-      String insertSql = "INSERT INTO " + tableName + " values(?, ?, ?)";
-      try (PreparedStatement pstmt = getConnection().prepareStatement(insertSql)) {
-        ParameterMetaData params = pstmt.getParameterMetaData();
-        assertEquals(3, params.getParameterCount());
-
-        assertEquals(Types.INTEGER, params.getParameterType(1));
-        assertTrue(params.isSigned(1));
-        assertTrue(ParameterMetaData.parameterNoNulls == params.isNullable(1)
-            || ParameterMetaData.parameterNullableUnknown == params.isNullable(1));
-
-        assertEquals(Types.DECIMAL, params.getParameterType(2));
-        assertTrue(params.isSigned(2));
-        assertTrue(ParameterMetaData.parameterNullable == params.isNullable(2)
-            || ParameterMetaData.parameterNullableUnknown == params.isNullable(2));
-        assertEquals(10, params.getPrecision(2));
-        assertEquals(5, params.getScale(2));
-
-        assertEquals(Types.BOOLEAN, params.getParameterType(3));
-        assertFalse(params.isSigned(3));
-        assertTrue(ParameterMetaData.parameterNoNulls == params.isNullable(3)
-            || ParameterMetaData.parameterNullableUnknown == params.isNullable(3));
-
-        // CALCITE-1103 <1.8.0 server mishandled the protobuf translation from BIG_DECIMAL to NUMBER
-        pstmt.setInt(1, Integer.MAX_VALUE);
-        pstmt.setBigDecimal(2, new BigDecimal("12345.12345"));
-        pstmt.setBoolean(3, true);
-        assertEquals(1, pstmt.executeUpdate());
-
-        pstmt.setInt(1, Integer.MIN_VALUE);
-        pstmt.setBigDecimal(2, new BigDecimal("54321.54321"));
-        pstmt.setBoolean(3, false);
-        assertEquals(1, pstmt.executeUpdate());
-      }
-
-      ResultSet results = stmt.executeQuery("SELECT * FROM " + tableName + " ORDER BY pk");
-      assertNotNull(results);
-      ResultSetMetaData resultMetadata = results.getMetaData();
-      // Verify result metadata
-      assertEquals(3, resultMetadata.getColumnCount());
-
-      assertTrue(ParameterMetaData.parameterNoNulls == resultMetadata.isNullable(1)
-          || ParameterMetaData.parameterNullableUnknown == resultMetadata.isNullable(1));
-      assertEquals(Types.INTEGER, resultMetadata.getColumnType(1));
-      assertTrue(resultMetadata.isSigned(1));
-
-      assertTrue(ParameterMetaData.parameterNullable == resultMetadata.isNullable(2)
-          || ParameterMetaData.parameterNullableUnknown == resultMetadata.isNullable(2));
-      assertEquals(Types.DECIMAL, resultMetadata.getColumnType(2));
-      assertTrue(resultMetadata.isSigned(2));
-      assertEquals(10, resultMetadata.getPrecision(2));
-      assertEquals(5, resultMetadata.getScale(2));
-
-      assertTrue(ParameterMetaData.parameterNoNulls == resultMetadata.isNullable(3)
-          || ParameterMetaData.parameterNullableUnknown == resultMetadata.isNullable(3));
-      assertEquals(Types.BOOLEAN, resultMetadata.getColumnType(3));
-      assertFalse(resultMetadata.isSigned(3));
-
-      // Verify the results
-      assertTrue(results.next());
-      assertEquals(Integer.MIN_VALUE, results.getInt(1));
-      // CALCITE-1103 protobuf truncated decimal value
-      BigDecimal buggyDecimalValue = new BigDecimal("54321.00000");
-      BigDecimal expectedDecimalValue = new BigDecimal("54321.54321");
-      BigDecimal actualDecimalValue = results.getBigDecimal(2);
-      assertTrue("Unexpected decimal value of " + actualDecimalValue,
-          expectedDecimalValue.equals(actualDecimalValue)
-          || buggyDecimalValue.equals(actualDecimalValue));
-      assertEquals(false, results.getBoolean(3));
-
-      assertTrue(results.next());
-      assertEquals(Integer.MAX_VALUE, results.getInt(1));
-      // CALCITE-1103 protobuf truncated decimal value
-      buggyDecimalValue = new BigDecimal("12345.00000");
-      expectedDecimalValue = new BigDecimal("12345.12345");
-      actualDecimalValue = results.getBigDecimal(2);
-      assertTrue("Unexpected decimal value of " + actualDecimalValue,
-          expectedDecimalValue.equals(actualDecimalValue)
-          || buggyDecimalValue.equals(actualDecimalValue));
-      assertEquals(true, results.getBoolean(3));
-
-      assertFalse(results.next());
-    }
-  }
-}
-
-// End MetadataTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/tck/src/main/java/org/apache/calcite/avatica/tck/tests/package-info.java
----------------------------------------------------------------------
diff --git a/avatica/tck/src/main/java/org/apache/calcite/avatica/tck/tests/package-info.java b/avatica/tck/src/main/java/org/apache/calcite/avatica/tck/tests/package-info.java
deleted file mode 100644
index 940a1bd..0000000
--- a/avatica/tck/src/main/java/org/apache/calcite/avatica/tck/tests/package-info.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * Tests for the Avatica compatibility framework.
- */
-@PackageMarker
-package org.apache.calcite.avatica.tck.tests;
-
-import org.apache.calcite.avatica.tck.PackageMarker;
-
-// End package-info.java

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

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/tck/src/main/resources/example_config.yml
----------------------------------------------------------------------
diff --git a/avatica/tck/src/main/resources/example_config.yml b/avatica/tck/src/main/resources/example_config.yml
deleted file mode 100644
index a6a352b..0000000
--- a/avatica/tck/src/main/resources/example_config.yml
+++ /dev/null
@@ -1,38 +0,0 @@
-# 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.
----
-# https://repository.apache.org/content/repositories/snapshots/org/apache/calcite/avatica/avatica-tck/1.8.0-SNAPSHOT
-tck_jar: /home/user/avatica-tck-1.8.0-SNAPSHOT-shaded.jar
-
-# Global template, can be overriden in each version. <url> is automatically replaced by the framework
-client_url_template: jdbc:avatica:remote:url=<url>;serialization=PROTOBUF
-
-# Specifies all versions to be tested against one another
-versions:
-  # The user _must_ fill in the port number for the Avatica server for each version
-  v1.6.0:
-    # https://repository.apache.org/content/repositories/releases/org/apache/calcite/calcite-avatica/1.6.0/calcite-avatica-1.6.0.jar
-    client_jar: /home/user/calcite-avatica-1.6.0.jar
-    server_url: http://localhost:XXXXX
-
-  v1.7.1:
-    # https://repository.apache.org/content/repositories/releases/org/apache/calcite/avatica/avatica/1.7.1/avatica-1.7.1.jar
-    client_jar: /home/user/avatica-1.7.1.jar
-    server_url: http://localhost:XXXXX
-
-  v1.8.0-SNAPSHOT:
-    # https://repository.apache.org/content/repositories/snapshots/org/apache/calcite/avatica/avatica/1.8.0-SNAPSHOT/
-    client_jar: /home/user/avatica-1.8.0-SNAPSHOT.jar
-    server_url: http://localhost:XXXXX

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/tck/src/main/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/avatica/tck/src/main/resources/log4j.properties b/avatica/tck/src/main/resources/log4j.properties
deleted file mode 100644
index 68a9cc2..0000000
--- a/avatica/tck/src/main/resources/log4j.properties
+++ /dev/null
@@ -1,24 +0,0 @@
-# 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.
-
-# Root logger is configured at INFO and is sent to A1
-log4j.rootLogger=INFO, A1
-
-# A1 goes to the console
-log4j.appender.A1=org.apache.calcite.avatica.tck.shaded.org.apache.log4j.ConsoleAppender
-
-# Set the pattern for each log message
-log4j.appender.A1.layout=org.apache.calcite.avatica.tck.shaded.org.apache.log4j.PatternLayout
-log4j.appender.A1.layout.ConversionPattern=%d{ISO8601} [%t] %-5p %c{2} - %m%n
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/tck/src/main/ruby/test_runner.rb
----------------------------------------------------------------------
diff --git a/avatica/tck/src/main/ruby/test_runner.rb b/avatica/tck/src/main/ruby/test_runner.rb
deleted file mode 100755
index e0b9d73..0000000
--- a/avatica/tck/src/main/ruby/test_runner.rb
+++ /dev/null
@@ -1,125 +0,0 @@
-#!/usr/bin/env ruby
-
-# 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 'logger'
-require 'yaml'
-
-PASSED = "\033[32mPassed\033[0m"
-FAILED = "\033[31mFailed\033[0m"
-
-VERSIONS_KEY = 'versions'
-CLIENT_JAR_KEY = 'client_jar'
-SERVER_URL_KEY = 'server_url'
-CLIENT_URL_TEMPLATE_KEY = 'client_url_template'
-
-TCK_JAR_KEY = 'tck_jar'
-
-# Special key for the client URL template to substitute the server's url
-URL_REPLACEMENT_HOLDER = '<url>'
-
-LOG = Logger.new(STDOUT)
-LOG.level = Logger::WARN
-
-
-def usage()
-  puts "usage: test_runner.rb configuration.yml"
-end
-
-def run_test(tck_jar, client, server)
-  client_jar = client[:config][CLIENT_JAR_KEY]
-  client_url = client[:config][CLIENT_URL_TEMPLATE_KEY]
-  server_url = server[:config][SERVER_URL_KEY]
-
-  puts "\nRunning #{client[:name]} against #{server[:name]}"
-
-  if server_url.end_with? 'X'
-    LOG.error("Fill in the port for server version '#{server_url}' in the YAML configuration file")
-    return false
-  end
-
-  # Make a copy here to be sure to not affect other tests
-  LOG.debug("Updating server url #{server_url} in #{client_url}")
-  client_url = client_url.gsub(URL_REPLACEMENT_HOLDER, server_url)
-
-  cmd = "java -cp '#{tck_jar}:#{client_jar}' org.apache.calcite.avatica.tck.TestRunner -u '#{client_url}'"
-  puts "Java command: '#{cmd}'"
-  success = system(cmd)
-
-  puts "Test of #{client[:name]} against #{server[:name]} " + (success ? PASSED : FAILED)
-  return success
-end
-
-unless ARGV.size == 1
-  usage()
-  raise ArgumentError.new('YAML configuration file is required as the only argument')
-end
-
-# Parse the configuration file
-config_file = ARGV[0]
-config = YAML.load_file(config_file)
-
-# The Avatica TCK jar
-tck_jar = config[TCK_JAR_KEY]
-if tck_jar.nil?
-  raise "Configuration file does not contain '#{TCK_JAR_KEY}' key"
-end
-
-# A client url template specified globally, can be overriden in the version
-global_url_template = config[CLIENT_URL_TEMPLATE_KEY]
-
-# Map of version name to jar/configuration
-all_versions = config[VERSIONS_KEY]
-if all_versions.nil?
-  raise "Configuration file does not contain '#{VERSIONS_KEY}' key"
-end
-
-# Push down the global client url template to each version when applicable
-all_versions.each do |version|
-  if version.length != 2
-    LOG.warn("Unexpected number of arguments for version: #{version.to_s}")
-  end
-  version_config = version[1]
-  if version_config[CLIENT_URL_TEMPLATE_KEY].nil? and not global_url_template.nil?
-    version_config[CLIENT_URL_TEMPLATE_KEY] = global_url_template
-  end
-end
-
-# Convert from a hash to an array of pairs
-all_versions = all_versions.collect{ |k,v| {:name=>k, :config=>v} }
-
-# Compute the "identity" mapping as a sanity check
-identity_versions = all_versions.collect {|x| [x, x]}
-
-# Create a cartesian product of the pairs, dropping entries where the pairs are equal
-all_pairs = all_versions.product(all_versions).select {|x| x[0][:name] != x[1][:name]}
-
-puts "Running identity test as a sanity check (client and server at the same version)"
-
-identity_outcomes = identity_versions.collect{|pair| {:client => pair[0][:name], :server=>pair[1][:name], :result=>run_test(tck_jar, pair[0], pair[1])}}
-
-puts "\nRunning cross-version tests"
-
-# Run the TCK against each pair
-outcomes = all_pairs.collect{|pair| {:client=>pair[0][:name], :server=>pair[1][:name], :result=>run_test(tck_jar, pair[0], pair[1])}}
-
-puts "\n-------------------------------------\nSummary:\n\n"
-
-puts "Identity test scenarios (ran #{identity_outcomes.size})\n\n"
-identity_outcomes.each{|outcome| puts "Testing identity for version #{outcome[:client]}: #{(outcome[:result] ? PASSED : FAILED)}"}
-
-puts "\nAll test scenarios (ran #{all_pairs.size})\n\n"
-outcomes.each{|outcome| puts "Testing client #{outcome[:client]} against server #{outcome[:server]}: #{(outcome[:result] ? PASSED : FAILED)}"}

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/cassandra/pom.xml
----------------------------------------------------------------------
diff --git a/cassandra/pom.xml b/cassandra/pom.xml
deleted file mode 100644
index 81294e0..0000000
--- a/cassandra/pom.xml
+++ /dev/null
@@ -1,143 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <parent>
-    <groupId>org.apache.calcite</groupId>
-    <artifactId>calcite</artifactId>
-    <version>1.13.0-SNAPSHOT</version>
-  </parent>
-
-  <artifactId>calcite-cassandra</artifactId>
-  <packaging>jar</packaging>
-  <version>1.13.0-SNAPSHOT</version>
-  <name>Calcite Cassandra</name>
-  <description>Cassandra adapter for Calcite</description>
-
-  <properties>
-    <top.dir>${project.basedir}/..</top.dir>
-  </properties>
-
-  <dependencies>
-    <!-- Sorted by groupId, artifactId; calcite dependencies first. Put versions
-         in dependencyManagement in the root POM, not here. -->
-    <dependency>
-      <groupId>org.apache.calcite.avatica</groupId>
-      <artifactId>avatica-core</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.calcite</groupId>
-      <artifactId>calcite-core</artifactId>
-      <type>jar</type>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.calcite</groupId>
-      <artifactId>calcite-core</artifactId>
-      <type>test-jar</type>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.calcite</groupId>
-      <artifactId>calcite-linq4j</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>com.google.guava</groupId>
-      <artifactId>guava</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>com.datastax.cassandra</groupId>
-      <artifactId>cassandra-driver-core</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-api</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-log4j12</artifactId>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
-
-  <build>
-    <plugins>
-      <!-- Sorted by groupId, artifactId. Put versions in
-           pluginManagement in the root POM, not here. -->
-      <plugin>
-        <artifactId>maven-dependency-plugin</artifactId>
-        <version>${maven-dependency-plugin.version}</version>
-        <executions>
-          <execution>
-            <id>analyze</id>
-            <goals>
-              <goal>analyze-only</goal>
-            </goals>
-            <configuration>
-              <failOnWarning>true</failOnWarning>
-              <!-- ignore "unused but declared" warnings -->
-              <ignoredUnusedDeclaredDependencies>
-                <ignoredUnusedDeclaredDependency>org.slf4j:slf4j-api</ignoredUnusedDeclaredDependency>
-                <ignoredUnusedDeclaredDependency>org.slf4j:slf4j-log4j12</ignoredUnusedDeclaredDependency>
-              </ignoredUnusedDeclaredDependencies>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-jar-plugin</artifactId>
-        <executions>
-          <execution>
-            <goals>
-              <goal>test-jar</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-release-plugin</artifactId>
-      </plugin>
-      <!-- Parent module has the same plugin and does the work of
-           generating -sources.jar for each project. But without the
-           plugin declared here, IDEs don't know the sources are
-           available. -->
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-source-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>attach-sources</id>
-            <phase>verify</phase>
-            <goals>
-              <goal>jar-no-fork</goal>
-              <goal>test-jar-no-fork</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-
-</project>

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraEnumerator.java
----------------------------------------------------------------------
diff --git a/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraEnumerator.java b/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraEnumerator.java
deleted file mode 100644
index 0c06800..0000000
--- a/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraEnumerator.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.cassandra;
-
-import org.apache.calcite.linq4j.Enumerator;
-import org.apache.calcite.rel.type.RelDataTypeFactory;
-import org.apache.calcite.rel.type.RelDataTypeField;
-import org.apache.calcite.rel.type.RelDataTypeSystem;
-import org.apache.calcite.rel.type.RelProtoDataType;
-import org.apache.calcite.sql.type.SqlTypeFactoryImpl;
-import org.apache.calcite.sql.type.SqlTypeName;
-
-import com.datastax.driver.core.DataType;
-import com.datastax.driver.core.ResultSet;
-import com.datastax.driver.core.Row;
-
-import java.util.Iterator;
-import java.util.List;
-
-/** Enumerator that reads from a Cassandra column family. */
-class CassandraEnumerator implements Enumerator<Object> {
-  private Iterator<Row> iterator;
-  private Row current;
-  private List<RelDataTypeField> fieldTypes;
-
-  /** Creates a CassandraEnumerator.
-   *
-   * @param results Cassandra result set ({@link com.datastax.driver.core.ResultSet})
-   * @param protoRowType The type of resulting rows
-   */
-  public CassandraEnumerator(ResultSet results, RelProtoDataType protoRowType) {
-    this.iterator = results.iterator();
-    this.current = null;
-
-    final RelDataTypeFactory typeFactory =
-        new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT);
-    this.fieldTypes = protoRowType.apply(typeFactory).getFieldList();
-  }
-
-  /** Produce the next row from the results
-   *
-   * @return A new row from the results
-   */
-  public Object current() {
-    if (fieldTypes.size() == 1) {
-      // If we just have one field, produce it directly
-      return currentRowField(0, fieldTypes.get(0).getType().getSqlTypeName());
-    } else {
-      // Build an array with all fields in this row
-      Object[] row = new Object[fieldTypes.size()];
-      for (int i = 0; i < fieldTypes.size(); i++) {
-        row[i] = currentRowField(i, fieldTypes.get(i).getType().getSqlTypeName());
-      }
-
-      return row;
-    }
-  }
-
-  /** Get a field for the current row from the underlying object.
-   *
-   * @param index Index of the field within the Row object
-   * @param typeName Type of the field in this row
-   */
-  private Object currentRowField(int index, SqlTypeName typeName) {
-    DataType type = current.getColumnDefinitions().getType(index);
-    if (type == DataType.ascii() || type == DataType.text() || type == DataType.varchar()) {
-      return current.getString(index);
-    } else if (type == DataType.cint() || type == DataType.varint()) {
-      return current.getInt(index);
-    } else if (type == DataType.bigint()) {
-      return current.getLong(index);
-    } else if (type == DataType.cdouble() || type == DataType.cfloat()) {
-      return current.getDouble(index);
-    } else if (type == DataType.uuid() || type == DataType.timeuuid()) {
-      return current.getUUID(index).toString();
-    } else {
-      return null;
-    }
-  }
-
-  public boolean moveNext() {
-    if (iterator.hasNext()) {
-      current = iterator.next();
-      return true;
-    } else {
-      return false;
-    }
-  }
-
-  public void reset() {
-    throw new UnsupportedOperationException();
-  }
-
-  public void close() {
-    // Nothing to do here
-  }
-}
-
-// End CassandraEnumerator.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraFilter.java
----------------------------------------------------------------------
diff --git a/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraFilter.java b/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraFilter.java
deleted file mode 100644
index ba8aa9c..0000000
--- a/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraFilter.java
+++ /dev/null
@@ -1,284 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.cassandra;
-
-import org.apache.calcite.plan.RelOptCluster;
-import org.apache.calcite.plan.RelOptCost;
-import org.apache.calcite.plan.RelOptPlanner;
-import org.apache.calcite.plan.RelOptUtil;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.RelCollation;
-import org.apache.calcite.rel.RelCollations;
-import org.apache.calcite.rel.RelFieldCollation;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.core.Filter;
-import org.apache.calcite.rel.metadata.RelMetadataQuery;
-import org.apache.calcite.rel.type.RelDataType;
-import org.apache.calcite.rex.RexCall;
-import org.apache.calcite.rex.RexInputRef;
-import org.apache.calcite.rex.RexLiteral;
-import org.apache.calcite.rex.RexNode;
-import org.apache.calcite.sql.type.SqlTypeName;
-import org.apache.calcite.util.Util;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-/**
- * Implementation of a {@link org.apache.calcite.rel.core.Filter}
- * relational expression in Cassandra.
- */
-public class CassandraFilter extends Filter implements CassandraRel {
-  private final List<String> partitionKeys;
-  private Boolean singlePartition;
-  private final List<String> clusteringKeys;
-  private List<RelFieldCollation> implicitFieldCollations;
-  private RelCollation implicitCollation;
-  private String match;
-
-  public CassandraFilter(
-      RelOptCluster cluster,
-      RelTraitSet traitSet,
-      RelNode child,
-      RexNode condition,
-      List<String> partitionKeys,
-      List<String> clusteringKeys,
-      List<RelFieldCollation> implicitFieldCollations) {
-    super(cluster, traitSet, child, condition);
-
-    this.partitionKeys = partitionKeys;
-    this.singlePartition = false;
-    this.clusteringKeys = new ArrayList<String>(clusteringKeys);
-    this.implicitFieldCollations = implicitFieldCollations;
-
-    Translator translator =
-        new Translator(getRowType(), partitionKeys, clusteringKeys,
-            implicitFieldCollations);
-    this.match = translator.translateMatch(condition);
-    this.singlePartition = translator.isSinglePartition();
-    this.implicitCollation = translator.getImplicitCollation();
-
-    assert getConvention() == CassandraRel.CONVENTION;
-    assert getConvention() == child.getConvention();
-  }
-
-  @Override public RelOptCost computeSelfCost(RelOptPlanner planner,
-      RelMetadataQuery mq) {
-    return super.computeSelfCost(planner, mq).multiplyBy(0.1);
-  }
-
-  public CassandraFilter copy(RelTraitSet traitSet, RelNode input,
-      RexNode condition) {
-    return new CassandraFilter(getCluster(), traitSet, input, condition,
-        partitionKeys, clusteringKeys, implicitFieldCollations);
-  }
-
-  public void implement(Implementor implementor) {
-    implementor.visitChild(0, getInput());
-    implementor.add(null, Collections.singletonList(match));
-  }
-
-  /** Check if the filter restricts to a single partition.
-   *
-   * @return True if the filter will restrict the underlying to a single partition
-   */
-  public boolean isSinglePartition() {
-    return singlePartition;
-  }
-
-  /** Get the resulting collation by the clustering keys after filtering.
-   *
-   * @return The implicit collation based on the natural sorting by clustering keys
-   */
-  public RelCollation getImplicitCollation() {
-    return implicitCollation;
-  }
-
-  /** Translates {@link RexNode} expressions into Cassandra expression strings. */
-  static class Translator {
-    private final RelDataType rowType;
-    private final List<String> fieldNames;
-    private final Set<String> partitionKeys;
-    private final List<String> clusteringKeys;
-    private int restrictedClusteringKeys;
-    private final List<RelFieldCollation> implicitFieldCollations;
-
-    Translator(RelDataType rowType, List<String> partitionKeys, List<String> clusteringKeys,
-        List<RelFieldCollation> implicitFieldCollations) {
-      this.rowType = rowType;
-      this.fieldNames = CassandraRules.cassandraFieldNames(rowType);
-      this.partitionKeys = new HashSet<String>(partitionKeys);
-      this.clusteringKeys = clusteringKeys;
-      this.restrictedClusteringKeys = 0;
-      this.implicitFieldCollations = implicitFieldCollations;
-    }
-
-    /** Check if the query spans only one partition.
-     *
-     * @return True if the matches translated so far have resulted in a single partition
-     */
-    public boolean isSinglePartition() {
-      return partitionKeys.isEmpty();
-    }
-
-    /** Infer the implicit correlation from the unrestricted clustering keys.
-     *
-     * @return The collation of the filtered results
-     */
-    public RelCollation getImplicitCollation() {
-      // No collation applies if we aren't restricted to a single partition
-      if (!isSinglePartition()) {
-        return RelCollations.EMPTY;
-      }
-
-      // Pull out the correct fields along with their original collations
-      List<RelFieldCollation> fieldCollations = new ArrayList<RelFieldCollation>();
-      for (int i = restrictedClusteringKeys; i < clusteringKeys.size(); i++) {
-        int fieldIndex = fieldNames.indexOf(clusteringKeys.get(i));
-        RelFieldCollation.Direction direction = implicitFieldCollations.get(i).getDirection();
-        fieldCollations.add(new RelFieldCollation(fieldIndex, direction));
-      }
-
-      return RelCollations.of(fieldCollations);
-    }
-
-    /** Produce the CQL predicate string for the given condition.
-     *
-     * @param condition Condition to translate
-     * @return CQL predicate string
-     */
-    private String translateMatch(RexNode condition) {
-      // CQL does not support disjunctions
-      List<RexNode> disjunctions = RelOptUtil.disjunctions(condition);
-      if (disjunctions.size() == 1) {
-        return translateAnd(disjunctions.get(0));
-      } else {
-        throw new AssertionError("cannot translate " + condition);
-      }
-    }
-
-    /** Conver the value of a literal to a string.
-     *
-     * @param literal Literal to translate
-     * @return String representation of the literal
-     */
-    private static String literalValue(RexLiteral literal) {
-      Object value = literal.getValue2();
-      StringBuilder buf = new StringBuilder();
-      buf.append(value);
-      return buf.toString();
-    }
-
-    /** Translate a conjunctive predicate to a CQL string.
-     *
-     * @param condition A conjunctive predicate
-     * @return CQL string for the predicate
-     */
-    private String translateAnd(RexNode condition) {
-      List<String> predicates = new ArrayList<String>();
-      for (RexNode node : RelOptUtil.conjunctions(condition)) {
-        predicates.add(translateMatch2(node));
-      }
-
-      return Util.toString(predicates, "", " AND ", "");
-    }
-
-    /** Translate a binary relation. */
-    private String translateMatch2(RexNode node) {
-      // We currently only use equality, but inequalities on clustering keys
-      // should be possible in the future
-      switch (node.getKind()) {
-      case EQUALS:
-        return translateBinary("=", "=", (RexCall) node);
-      case LESS_THAN:
-        return translateBinary("<", ">", (RexCall) node);
-      case LESS_THAN_OR_EQUAL:
-        return translateBinary("<=", ">=", (RexCall) node);
-      case GREATER_THAN:
-        return translateBinary(">", "<", (RexCall) node);
-      case GREATER_THAN_OR_EQUAL:
-        return translateBinary(">=", "<=", (RexCall) node);
-      default:
-        throw new AssertionError("cannot translate " + node);
-      }
-    }
-
-    /** Translates a call to a binary operator, reversing arguments if
-     * necessary. */
-    private String translateBinary(String op, String rop, RexCall call) {
-      final RexNode left = call.operands.get(0);
-      final RexNode right = call.operands.get(1);
-      String expression = translateBinary2(op, left, right);
-      if (expression != null) {
-        return expression;
-      }
-      expression = translateBinary2(rop, right, left);
-      if (expression != null) {
-        return expression;
-      }
-      throw new AssertionError("cannot translate op " + op + " call " + call);
-    }
-
-    /** Translates a call to a binary operator. Returns null on failure. */
-    private String translateBinary2(String op, RexNode left, RexNode right) {
-      switch (right.getKind()) {
-      case LITERAL:
-        break;
-      default:
-        return null;
-      }
-      final RexLiteral rightLiteral = (RexLiteral) right;
-      switch (left.getKind()) {
-      case INPUT_REF:
-        final RexInputRef left1 = (RexInputRef) left;
-        String name = fieldNames.get(left1.getIndex());
-        return translateOp2(op, name, rightLiteral);
-      case CAST:
-        // FIXME This will not work in all cases (for example, we ignore string encoding)
-        return translateBinary2(op, ((RexCall) left).operands.get(0), right);
-      default:
-        return null;
-      }
-    }
-
-    /** Combines a field name, operator, and literal to produce a predicate string. */
-    private String translateOp2(String op, String name, RexLiteral right) {
-      // In case this is a key, record that it is now restricted
-      if (op.equals("=")) {
-        partitionKeys.remove(name);
-        if (clusteringKeys.contains(name)) {
-          restrictedClusteringKeys++;
-        }
-      }
-
-      Object value = literalValue(right);
-      String valueString = value.toString();
-      if (value instanceof String) {
-        SqlTypeName typeName = rowType.getField(name, true, false).getType().getSqlTypeName();
-        if (typeName != SqlTypeName.CHAR) {
-          valueString = "'" + valueString + "'";
-        }
-      }
-      return name + " " + op + " " + valueString;
-    }
-  }
-}
-
-// End CassandraFilter.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraLimit.java
----------------------------------------------------------------------
diff --git a/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraLimit.java b/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraLimit.java
deleted file mode 100644
index cca7e19..0000000
--- a/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraLimit.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.cassandra;
-
-import org.apache.calcite.plan.RelOptCluster;
-import org.apache.calcite.plan.RelOptCost;
-import org.apache.calcite.plan.RelOptPlanner;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.RelWriter;
-import org.apache.calcite.rel.SingleRel;
-import org.apache.calcite.rel.metadata.RelMetadataQuery;
-import org.apache.calcite.rex.RexLiteral;
-import org.apache.calcite.rex.RexNode;
-
-import java.util.List;
-
-/**
- * Implementation of limits in Cassandra.
- */
-public class CassandraLimit extends SingleRel implements CassandraRel {
-  public final RexNode offset;
-  public final RexNode fetch;
-
-  public CassandraLimit(RelOptCluster cluster, RelTraitSet traitSet,
-      RelNode input, RexNode offset, RexNode fetch) {
-    super(cluster, traitSet, input);
-    this.offset = offset;
-    this.fetch = fetch;
-    assert getConvention() == input.getConvention();
-  }
-
-  @Override public RelOptCost computeSelfCost(RelOptPlanner planner,
-      RelMetadataQuery mq) {
-    // We do this so we get the limit for free
-    return planner.getCostFactory().makeZeroCost();
-  }
-
-  @Override public CassandraLimit copy(RelTraitSet traitSet, List<RelNode> newInputs) {
-    return new CassandraLimit(getCluster(), traitSet, sole(newInputs), offset, fetch);
-  }
-
-  public void implement(Implementor implementor) {
-    implementor.visitChild(0, getInput());
-    if (offset != null) { implementor.offset = RexLiteral.intValue(offset); }
-    if (fetch != null) { implementor.fetch = RexLiteral.intValue(fetch); }
-  }
-
-  public RelWriter explainTerms(RelWriter pw) {
-    super.explainTerms(pw);
-    pw.itemIf("offset", offset, offset != null);
-    pw.itemIf("fetch", fetch, fetch != null);
-    return pw;
-  }
-}
-
-// End CassandraLimit.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraMethod.java
----------------------------------------------------------------------
diff --git a/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraMethod.java b/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraMethod.java
deleted file mode 100644
index b2035e5..0000000
--- a/cassandra/src/main/java/org/apache/calcite/adapter/cassandra/CassandraMethod.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.cassandra;
-
-import org.apache.calcite.linq4j.tree.Types;
-
-import com.google.common.collect.ImmutableMap;
-
-import java.lang.reflect.Method;
-import java.util.List;
-
-/**
- * Builtin methods in the Cassandra adapter.
- */
-public enum CassandraMethod {
-  CASSANDRA_QUERYABLE_QUERY(CassandraTable.CassandraQueryable.class, "query",
-      List.class, List.class, List.class, List.class, Integer.class, Integer.class);
-
-  public final Method method;
-
-  public static final ImmutableMap<Method, CassandraMethod> MAP;
-
-  static {
-    final ImmutableMap.Builder<Method, CassandraMethod> builder =
-        ImmutableMap.builder();
-    for (CassandraMethod value : CassandraMethod.values()) {
-      builder.put(value.method, value);
-    }
-    MAP = builder.build();
-  }
-
-  CassandraMethod(Class clazz, String methodName, Class... argumentTypes) {
-    this.method = Types.lookupMethod(clazz, methodName, argumentTypes);
-  }
-}
-
-// End CassandraMethod.java


[04/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/RexToLixTranslator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/RexToLixTranslator.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/RexToLixTranslator.java
deleted file mode 100644
index 7d5ef75..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/RexToLixTranslator.java
+++ /dev/null
@@ -1,1146 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.DataContext;
-import org.apache.calcite.adapter.java.JavaTypeFactory;
-import org.apache.calcite.avatica.util.ByteString;
-import org.apache.calcite.avatica.util.DateTimeUtils;
-import org.apache.calcite.linq4j.function.Function1;
-import org.apache.calcite.linq4j.tree.BlockBuilder;
-import org.apache.calcite.linq4j.tree.ConstantExpression;
-import org.apache.calcite.linq4j.tree.Expression;
-import org.apache.calcite.linq4j.tree.ExpressionType;
-import org.apache.calcite.linq4j.tree.Expressions;
-import org.apache.calcite.linq4j.tree.ParameterExpression;
-import org.apache.calcite.linq4j.tree.Primitive;
-import org.apache.calcite.linq4j.tree.UnaryExpression;
-import org.apache.calcite.rel.type.RelDataType;
-import org.apache.calcite.rel.type.RelDataTypeFactoryImpl;
-import org.apache.calcite.rex.RexBuilder;
-import org.apache.calcite.rex.RexCall;
-import org.apache.calcite.rex.RexCorrelVariable;
-import org.apache.calcite.rex.RexDynamicParam;
-import org.apache.calcite.rex.RexFieldAccess;
-import org.apache.calcite.rex.RexInputRef;
-import org.apache.calcite.rex.RexLiteral;
-import org.apache.calcite.rex.RexLocalRef;
-import org.apache.calcite.rex.RexNode;
-import org.apache.calcite.rex.RexProgram;
-import org.apache.calcite.runtime.SqlFunctions;
-import org.apache.calcite.sql.SqlIntervalQualifier;
-import org.apache.calcite.sql.SqlKind;
-import org.apache.calcite.sql.SqlOperator;
-import org.apache.calcite.sql.type.SqlTypeUtil;
-import org.apache.calcite.util.BuiltInMethod;
-import org.apache.calcite.util.ControlFlowException;
-import org.apache.calcite.util.NlsString;
-import org.apache.calcite.util.Pair;
-import org.apache.calcite.util.Util;
-
-import com.google.common.collect.ImmutableMap;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.lang.reflect.Type;
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import static org.apache.calcite.sql.fun.OracleSqlOperatorTable.TRANSLATE3;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.CHARACTER_LENGTH;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.CHAR_LENGTH;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.SUBSTRING;
-import static org.apache.calcite.sql.fun.SqlStdOperatorTable.UPPER;
-
-/**
- * Translates {@link org.apache.calcite.rex.RexNode REX expressions} to
- * {@link Expression linq4j expressions}.
- */
-public class RexToLixTranslator {
-  public static final Map<Method, SqlOperator> JAVA_TO_SQL_METHOD_MAP =
-      Util.<Method, SqlOperator>mapOf(
-          findMethod(String.class, "toUpperCase"), UPPER,
-          findMethod(
-              SqlFunctions.class, "substring", String.class, Integer.TYPE,
-              Integer.TYPE), SUBSTRING,
-          findMethod(SqlFunctions.class, "charLength", String.class),
-          CHARACTER_LENGTH,
-          findMethod(SqlFunctions.class, "charLength", String.class),
-          CHAR_LENGTH,
-          findMethod(SqlFunctions.class, "translate3", String.class, String.class,
-              String.class), TRANSLATE3);
-
-  final JavaTypeFactory typeFactory;
-  final RexBuilder builder;
-  private final RexProgram program;
-  private final Expression root;
-  private final RexToLixTranslator.InputGetter inputGetter;
-  private final BlockBuilder list;
-  private final Map<? extends RexNode, Boolean> exprNullableMap;
-  private final RexToLixTranslator parent;
-  private final Function1<String, InputGetter> correlates;
-
-  private static Method findMethod(
-      Class<?> clazz, String name, Class... parameterTypes) {
-    try {
-      return clazz.getMethod(name, parameterTypes);
-    } catch (NoSuchMethodException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  private RexToLixTranslator(RexProgram program, JavaTypeFactory typeFactory,
-      Expression root, InputGetter inputGetter, BlockBuilder list) {
-    this(program, typeFactory, root, inputGetter, list,
-        Collections.<RexNode, Boolean>emptyMap(),
-        new RexBuilder(typeFactory));
-  }
-
-  private RexToLixTranslator(
-      RexProgram program,
-      JavaTypeFactory typeFactory,
-      Expression root,
-      InputGetter inputGetter,
-      BlockBuilder list,
-      Map<RexNode, Boolean> exprNullableMap,
-      RexBuilder builder) {
-    this(program, typeFactory, root, inputGetter, list, exprNullableMap,
-        builder, null);
-  }
-
-  private RexToLixTranslator(
-      RexProgram program,
-      JavaTypeFactory typeFactory,
-      Expression root,
-      InputGetter inputGetter,
-      BlockBuilder list,
-      Map<? extends RexNode, Boolean> exprNullableMap,
-      RexBuilder builder,
-      RexToLixTranslator parent) {
-    this(program, typeFactory, root, inputGetter, list, exprNullableMap,
-        builder, parent, null);
-  }
-
-  private RexToLixTranslator(
-      RexProgram program,
-      JavaTypeFactory typeFactory,
-      Expression root,
-      InputGetter inputGetter,
-      BlockBuilder list,
-      Map<? extends RexNode, Boolean> exprNullableMap,
-      RexBuilder builder,
-      RexToLixTranslator parent,
-      Function1<String, InputGetter> correlates) {
-    this.program = program;
-    this.typeFactory = typeFactory;
-    this.root = root;
-    this.inputGetter = inputGetter;
-    this.list = list;
-    this.exprNullableMap = exprNullableMap;
-    this.builder = builder;
-    this.parent = parent;
-    this.correlates = correlates;
-  }
-
-  /**
-   * Translates a {@link RexProgram} to a sequence of expressions and
-   * declarations.
-   *
-   * @param program Program to be translated
-   * @param typeFactory Type factory
-   * @param list List of statements, populated with declarations
-   * @param outputPhysType Output type, or null
-   * @param root Root expression
-   * @param inputGetter Generates expressions for inputs
-   * @param correlates Provider of references to the values of correlated
-   *                   variables
-   * @return Sequence of expressions, optional condition
-   */
-  public static List<Expression> translateProjects(RexProgram program,
-      JavaTypeFactory typeFactory,
-      BlockBuilder list,
-      PhysType outputPhysType,
-      Expression root,
-      InputGetter inputGetter,
-      Function1<String, InputGetter> correlates) {
-    List<Type> storageTypes = null;
-    if (outputPhysType != null) {
-      final RelDataType rowType = outputPhysType.getRowType();
-      storageTypes = new ArrayList<>(rowType.getFieldCount());
-      for (int i = 0; i < rowType.getFieldCount(); i++) {
-        storageTypes.add(outputPhysType.getJavaFieldType(i));
-      }
-    }
-    return new RexToLixTranslator(program, typeFactory, root, inputGetter, list)
-        .setCorrelates(correlates)
-        .translateList(program.getProjectList(), storageTypes);
-  }
-
-  /** Creates a translator for translating aggregate functions. */
-  public static RexToLixTranslator forAggregation(JavaTypeFactory typeFactory,
-      BlockBuilder list, InputGetter inputGetter) {
-    final ParameterExpression root = DataContext.ROOT;
-    return new RexToLixTranslator(null, typeFactory, root, inputGetter, list);
-  }
-
-  Expression translate(RexNode expr) {
-    final RexImpTable.NullAs nullAs =
-        RexImpTable.NullAs.of(isNullable(expr));
-    return translate(expr, nullAs);
-  }
-
-  Expression translate(RexNode expr, RexImpTable.NullAs nullAs) {
-    return translate(expr, nullAs, null);
-  }
-
-  Expression translate(RexNode expr, Type storageType) {
-    final RexImpTable.NullAs nullAs =
-        RexImpTable.NullAs.of(isNullable(expr));
-    return translate(expr, nullAs, storageType);
-  }
-
-  Expression translate(RexNode expr, RexImpTable.NullAs nullAs,
-      Type storageType) {
-    Expression expression = translate0(expr, nullAs, storageType);
-    expression = EnumUtils.enforce(storageType, expression);
-    assert expression != null;
-    return list.append("v", expression);
-  }
-
-  Expression translateCast(
-      RelDataType sourceType,
-      RelDataType targetType,
-      Expression operand) {
-    Expression convert = null;
-    switch (targetType.getSqlTypeName()) {
-    case ANY:
-      convert = operand;
-      break;
-    case DATE:
-      switch (sourceType.getSqlTypeName()) {
-      case CHAR:
-      case VARCHAR:
-        convert =
-            Expressions.call(BuiltInMethod.STRING_TO_DATE.method, operand);
-        break;
-      case TIMESTAMP:
-        convert = Expressions.convert_(
-            Expressions.call(BuiltInMethod.FLOOR_DIV.method,
-                operand, Expressions.constant(DateTimeUtils.MILLIS_PER_DAY)),
-            int.class);
-      }
-      break;
-    case TIME:
-      switch (sourceType.getSqlTypeName()) {
-      case CHAR:
-      case VARCHAR:
-        convert =
-            Expressions.call(BuiltInMethod.STRING_TO_TIME.method, operand);
-        break;
-      case TIMESTAMP:
-        convert = Expressions.convert_(
-            Expressions.call(
-                BuiltInMethod.FLOOR_MOD.method,
-                operand,
-                Expressions.constant(DateTimeUtils.MILLIS_PER_DAY)),
-            int.class);
-      }
-      break;
-    case TIMESTAMP:
-      switch (sourceType.getSqlTypeName()) {
-      case CHAR:
-      case VARCHAR:
-        convert =
-            Expressions.call(BuiltInMethod.STRING_TO_TIMESTAMP.method, operand);
-        break;
-      case DATE:
-        convert = Expressions.multiply(
-            Expressions.convert_(operand, long.class),
-            Expressions.constant(DateTimeUtils.MILLIS_PER_DAY));
-        break;
-      case TIME:
-        convert =
-            Expressions.add(
-                Expressions.multiply(
-                    Expressions.convert_(
-                        Expressions.call(BuiltInMethod.CURRENT_DATE.method, root),
-                        long.class),
-                    Expressions.constant(DateTimeUtils.MILLIS_PER_DAY)),
-                Expressions.convert_(operand, long.class));
-        break;
-      }
-      break;
-    case BOOLEAN:
-      switch (sourceType.getSqlTypeName()) {
-      case CHAR:
-      case VARCHAR:
-        convert = Expressions.call(
-            BuiltInMethod.STRING_TO_BOOLEAN.method,
-            operand);
-      }
-      break;
-    case CHAR:
-    case VARCHAR:
-      final SqlIntervalQualifier interval =
-          sourceType.getIntervalQualifier();
-      switch (sourceType.getSqlTypeName()) {
-      case DATE:
-        convert = RexImpTable.optimize2(
-            operand,
-            Expressions.call(
-                BuiltInMethod.UNIX_DATE_TO_STRING.method,
-                operand));
-        break;
-      case TIME:
-        convert = RexImpTable.optimize2(
-            operand,
-            Expressions.call(
-                BuiltInMethod.UNIX_TIME_TO_STRING.method,
-                operand));
-        break;
-      case TIMESTAMP:
-        convert = RexImpTable.optimize2(
-            operand,
-            Expressions.call(
-                BuiltInMethod.UNIX_TIMESTAMP_TO_STRING.method,
-                operand));
-        break;
-      case INTERVAL_YEAR:
-      case INTERVAL_YEAR_MONTH:
-      case INTERVAL_MONTH:
-        convert = RexImpTable.optimize2(
-            operand,
-            Expressions.call(
-                BuiltInMethod.INTERVAL_YEAR_MONTH_TO_STRING.method,
-                operand,
-                Expressions.constant(interval.timeUnitRange)));
-        break;
-      case INTERVAL_DAY:
-      case INTERVAL_DAY_HOUR:
-      case INTERVAL_DAY_MINUTE:
-      case INTERVAL_DAY_SECOND:
-      case INTERVAL_HOUR:
-      case INTERVAL_HOUR_MINUTE:
-      case INTERVAL_HOUR_SECOND:
-      case INTERVAL_MINUTE:
-      case INTERVAL_MINUTE_SECOND:
-      case INTERVAL_SECOND:
-        convert = RexImpTable.optimize2(
-            operand,
-            Expressions.call(
-                BuiltInMethod.INTERVAL_DAY_TIME_TO_STRING.method,
-                operand,
-                Expressions.constant(interval.timeUnitRange),
-                Expressions.constant(
-                    interval.getFractionalSecondPrecision(
-                        typeFactory.getTypeSystem()))));
-        break;
-      case BOOLEAN:
-        convert = RexImpTable.optimize2(
-            operand,
-            Expressions.call(
-                BuiltInMethod.BOOLEAN_TO_STRING.method,
-                operand));
-        break;
-      }
-    }
-    if (convert == null) {
-      convert = convert(operand, typeFactory.getJavaClass(targetType));
-    }
-    // Going from anything to CHAR(n) or VARCHAR(n), make sure value is no
-    // longer than n.
-    boolean pad = false;
-    boolean truncate = true;
-    switch (targetType.getSqlTypeName()) {
-    case CHAR:
-    case BINARY:
-      pad = true;
-      // fall through
-    case VARCHAR:
-    case VARBINARY:
-      final int targetPrecision = targetType.getPrecision();
-      if (targetPrecision >= 0) {
-        switch (sourceType.getSqlTypeName()) {
-        case CHAR:
-        case VARCHAR:
-        case BINARY:
-        case VARBINARY:
-          // If this is a widening cast, no need to truncate.
-          final int sourcePrecision = sourceType.getPrecision();
-          if (SqlTypeUtil.comparePrecision(sourcePrecision, targetPrecision)
-              <= 0) {
-            truncate = false;
-          }
-          // If this is a widening cast, no need to pad.
-          if (SqlTypeUtil.comparePrecision(sourcePrecision, targetPrecision)
-              >= 0
-              && targetPrecision != RelDataType.PRECISION_NOT_SPECIFIED) {
-            pad = false;
-          }
-          // fall through
-        default:
-          if (truncate || pad) {
-            convert =
-                Expressions.call(
-                    pad
-                        ? BuiltInMethod.TRUNCATE_OR_PAD.method
-                        : BuiltInMethod.TRUNCATE.method,
-                    convert,
-                    Expressions.constant(targetPrecision));
-          }
-        }
-      }
-      break;
-    case TIMESTAMP:
-      int targetScale = targetType.getScale();
-      if (targetScale == RelDataType.SCALE_NOT_SPECIFIED) {
-        targetScale = 0;
-      }
-      if (targetScale < sourceType.getScale()) {
-        convert =
-            Expressions.call(
-                BuiltInMethod.ROUND_LONG.method,
-                convert,
-                Expressions.constant(
-                    (long) Math.pow(10, 3 - targetScale)));
-      }
-      break;
-    case INTERVAL_YEAR:
-    case INTERVAL_YEAR_MONTH:
-    case INTERVAL_MONTH:
-    case INTERVAL_DAY:
-    case INTERVAL_DAY_HOUR:
-    case INTERVAL_DAY_MINUTE:
-    case INTERVAL_DAY_SECOND:
-    case INTERVAL_HOUR:
-    case INTERVAL_HOUR_MINUTE:
-    case INTERVAL_HOUR_SECOND:
-    case INTERVAL_MINUTE:
-    case INTERVAL_MINUTE_SECOND:
-    case INTERVAL_SECOND:
-      switch (sourceType.getSqlTypeName().getFamily()) {
-      case NUMERIC:
-        final BigDecimal multiplier = targetType.getSqlTypeName().getEndUnit().multiplier;
-        final BigDecimal divider = BigDecimal.ONE;
-        convert = RexImpTable.multiplyDivide(convert, multiplier, divider);
-      }
-    }
-    return convert;
-  }
-
-  /** Translates an expression that is not in the cache.
-   *
-   * @param expr Expression
-   * @param nullAs If false, if expression is definitely not null at
-   *   runtime. Therefore we can optimize. For example, we can cast to int
-   *   using x.intValue().
-   * @return Translated expression
-   */
-  private Expression translate0(RexNode expr, RexImpTable.NullAs nullAs,
-      Type storageType) {
-    if (nullAs == RexImpTable.NullAs.NULL && !expr.getType().isNullable()) {
-      nullAs = RexImpTable.NullAs.NOT_POSSIBLE;
-    }
-    switch (expr.getKind()) {
-    case INPUT_REF:
-      final int index = ((RexInputRef) expr).getIndex();
-      Expression x = inputGetter.field(list, index, storageType);
-
-      Expression input = list.append("inp" + index + "_", x); // safe to share
-      if (nullAs == RexImpTable.NullAs.NOT_POSSIBLE
-          && input.type.equals(storageType)) {
-        // When we asked for not null input that would be stored as box, avoid
-        // unboxing via nullAs.handle below.
-        return input;
-      }
-      Expression nullHandled = nullAs.handle(input);
-
-      // If we get ConstantExpression, just return it (i.e. primitive false)
-      if (nullHandled instanceof ConstantExpression) {
-        return nullHandled;
-      }
-
-      // if nullHandled expression is the same as "input",
-      // then we can just reuse it
-      if (nullHandled == input) {
-        return input;
-      }
-
-      // If nullHandled is different, then it might be unsafe to compute
-      // early (i.e. unbox of null value should not happen _before_ ternary).
-      // Thus we wrap it into brand-new ParameterExpression,
-      // and we are guaranteed that ParameterExpression will not be shared
-      String unboxVarName = "v_unboxed";
-      if (input instanceof ParameterExpression) {
-        unboxVarName = ((ParameterExpression) input).name + "_unboxed";
-      }
-      ParameterExpression unboxed = Expressions.parameter(nullHandled.getType(),
-          list.newName(unboxVarName));
-      list.add(Expressions.declare(Modifier.FINAL, unboxed, nullHandled));
-
-      return unboxed;
-    case LOCAL_REF:
-      return translate(
-          deref(expr),
-          nullAs,
-          storageType);
-    case LITERAL:
-      return translateLiteral(
-          (RexLiteral) expr,
-          nullifyType(
-              expr.getType(),
-              isNullable(expr)
-                  && nullAs != RexImpTable.NullAs.NOT_POSSIBLE),
-          typeFactory,
-          nullAs);
-    case DYNAMIC_PARAM:
-      return translateParameter((RexDynamicParam) expr, nullAs, storageType);
-    case CORREL_VARIABLE:
-      throw new RuntimeException("Cannot translate " + expr + ". Correlated"
-          + " variables should always be referenced by field access");
-    case FIELD_ACCESS:
-      RexFieldAccess fieldAccess = (RexFieldAccess) expr;
-      RexNode target = deref(fieldAccess.getReferenceExpr());
-      // only $cor.field access is supported
-      if (!(target instanceof RexCorrelVariable)) {
-        throw new RuntimeException(
-            "cannot translate expression " + expr);
-      }
-      if (correlates == null) {
-        throw new RuntimeException("Cannot translate " + expr + " since "
-            + "correlate variables resolver is not defined");
-      }
-      InputGetter getter =
-          correlates.apply(((RexCorrelVariable) target).getName());
-      return getter.field(list, fieldAccess.getField().getIndex(), storageType);
-    default:
-      if (expr instanceof RexCall) {
-        return translateCall((RexCall) expr, nullAs);
-      }
-      throw new RuntimeException(
-          "cannot translate expression " + expr);
-    }
-  }
-
-  /** Dereferences an expression if it is a
-   * {@link org.apache.calcite.rex.RexLocalRef}. */
-  public RexNode deref(RexNode expr) {
-    if (expr instanceof RexLocalRef) {
-      RexLocalRef ref = (RexLocalRef) expr;
-      final RexNode e2 = program.getExprList().get(ref.getIndex());
-      assert ref.getType().equals(e2.getType());
-      return e2;
-    } else {
-      return expr;
-    }
-  }
-
-  /** Translates a call to an operator or function. */
-  private Expression translateCall(RexCall call, RexImpTable.NullAs nullAs) {
-    final SqlOperator operator = call.getOperator();
-    CallImplementor implementor =
-        RexImpTable.INSTANCE.get(operator);
-    if (implementor == null) {
-      throw new RuntimeException("cannot translate call " + call);
-    }
-    return implementor.implement(this, call, nullAs);
-  }
-
-  /** Translates a parameter. */
-  private Expression translateParameter(RexDynamicParam expr,
-      RexImpTable.NullAs nullAs, Type storageType) {
-    if (storageType == null) {
-      storageType = typeFactory.getJavaClass(expr.getType());
-    }
-    return nullAs.handle(
-        convert(
-            Expressions.call(root, BuiltInMethod.DATA_CONTEXT_GET.method,
-                Expressions.constant("?" + expr.getIndex())),
-            storageType));
-  }
-
-  /** Translates a literal.
-   *
-   * @throws AlwaysNull if literal is null but {@code nullAs} is
-   * {@link org.apache.calcite.adapter.enumerable.RexImpTable.NullAs#NOT_POSSIBLE}.
-   */
-  public static Expression translateLiteral(
-      RexLiteral literal,
-      RelDataType type,
-      JavaTypeFactory typeFactory,
-      RexImpTable.NullAs nullAs) {
-    final Comparable value = literal.getValue();
-    if (value == null) {
-      switch (nullAs) {
-      case TRUE:
-      case IS_NULL:
-        return RexImpTable.TRUE_EXPR;
-      case FALSE:
-      case IS_NOT_NULL:
-        return RexImpTable.FALSE_EXPR;
-      case NOT_POSSIBLE:
-        throw AlwaysNull.INSTANCE;
-      case NULL:
-      default:
-        return RexImpTable.NULL_EXPR;
-      }
-    } else {
-      switch (nullAs) {
-      case IS_NOT_NULL:
-        return RexImpTable.TRUE_EXPR;
-      case IS_NULL:
-        return RexImpTable.FALSE_EXPR;
-      }
-    }
-    Type javaClass = typeFactory.getJavaClass(type);
-    final Object value2;
-    switch (literal.getType().getSqlTypeName()) {
-    case DECIMAL:
-      if (javaClass == float.class) {
-        return Expressions.constant(value, javaClass);
-      }
-      assert javaClass == BigDecimal.class;
-      return Expressions.new_(BigDecimal.class,
-          Expressions.constant(value.toString()));
-    case DATE:
-      value2 = (int)
-          (((Calendar) value).getTimeInMillis() / DateTimeUtils.MILLIS_PER_DAY);
-      javaClass = int.class;
-      break;
-    case TIME:
-      value2 = (int)
-          (((Calendar) value).getTimeInMillis() % DateTimeUtils.MILLIS_PER_DAY);
-      javaClass = int.class;
-      break;
-    case TIMESTAMP:
-      value2 = ((Calendar) value).getTimeInMillis();
-      javaClass = long.class;
-      break;
-    case INTERVAL_DAY:
-    case INTERVAL_DAY_HOUR:
-    case INTERVAL_DAY_MINUTE:
-    case INTERVAL_DAY_SECOND:
-    case INTERVAL_HOUR:
-    case INTERVAL_HOUR_MINUTE:
-    case INTERVAL_HOUR_SECOND:
-    case INTERVAL_MINUTE:
-    case INTERVAL_MINUTE_SECOND:
-    case INTERVAL_SECOND:
-      value2 = ((BigDecimal) value).longValue();
-      javaClass = long.class;
-      break;
-    case INTERVAL_YEAR:
-    case INTERVAL_YEAR_MONTH:
-    case INTERVAL_MONTH:
-      value2 = ((BigDecimal) value).intValue();
-      javaClass = int.class;
-      break;
-    case CHAR:
-    case VARCHAR:
-      value2 = ((NlsString) value).getValue();
-      break;
-    case BINARY:
-    case VARBINARY:
-      return Expressions.new_(
-          ByteString.class,
-          Expressions.constant(
-              ((ByteString) value).getBytes(),
-              byte[].class));
-    case SYMBOL:
-      value2 = value;
-      javaClass = value.getClass();
-      break;
-    default:
-      final Primitive primitive = Primitive.ofBoxOr(javaClass);
-      if (primitive != null && value instanceof Number) {
-        value2 = primitive.number((Number) value);
-      } else {
-        value2 = value;
-      }
-    }
-    return Expressions.constant(value2, javaClass);
-  }
-
-  public List<Expression> translateList(
-      List<RexNode> operandList,
-      RexImpTable.NullAs nullAs) {
-    return translateList(operandList, nullAs,
-        EnumUtils.internalTypes(operandList));
-  }
-
-  public List<Expression> translateList(
-      List<RexNode> operandList,
-      RexImpTable.NullAs nullAs,
-      List<? extends Type> storageTypes) {
-    final List<Expression> list = new ArrayList<>();
-    for (Pair<RexNode, ? extends Type> e : Pair.zip(operandList, storageTypes)) {
-      list.add(translate(e.left, nullAs, e.right));
-    }
-    return list;
-  }
-
-  /**
-   * Translates the list of {@code RexNode}, using the default output types.
-   * This might be suboptimal in terms of additional box-unbox when you use
-   * the translation later.
-   * If you know the java class that will be used to store the results, use
-   * {@link org.apache.calcite.adapter.enumerable.RexToLixTranslator#translateList(java.util.List, java.util.List)}
-   * version.
-   *
-   * @param operandList list of RexNodes to translate
-   *
-   * @return translated expressions
-   */
-  public List<Expression> translateList(List<? extends RexNode> operandList) {
-    return translateList(operandList, EnumUtils.internalTypes(operandList));
-  }
-
-  /**
-   * Translates the list of {@code RexNode}, while optimizing for output
-   * storage.
-   * For instance, if the result of translation is going to be stored in
-   * {@code Object[]}, and the input is {@code Object[]} as well,
-   * then translator will avoid casting, boxing, etc.
-   *
-   * @param operandList list of RexNodes to translate
-   * @param storageTypes hints of the java classes that will be used
-   *                     to store translation results. Use null to use
-   *                     default storage type
-   *
-   * @return translated expressions
-   */
-  public List<Expression> translateList(List<? extends RexNode> operandList,
-      List<? extends Type> storageTypes) {
-    final List<Expression> list = new ArrayList<>(operandList.size());
-
-    for (int i = 0; i < operandList.size(); i++) {
-      RexNode rex = operandList.get(i);
-      Type desiredType = null;
-      if (storageTypes != null) {
-        desiredType = storageTypes.get(i);
-      }
-      final Expression translate = translate(rex, desiredType);
-      list.add(translate);
-      // desiredType is still a hint, thus we might get any kind of output
-      // (boxed or not) when hint was provided.
-      // It is favourable to get the type matching desired type
-      if (desiredType == null && !isNullable(rex)) {
-        assert !Primitive.isBox(translate.getType())
-            : "Not-null boxed primitive should come back as primitive: "
-            + rex + ", " + translate.getType();
-      }
-    }
-    return list;
-  }
-
-  public static Expression translateCondition(
-      RexProgram program,
-      JavaTypeFactory typeFactory,
-      BlockBuilder list,
-      InputGetter inputGetter,
-      Function1<String, InputGetter> correlates) {
-    if (program.getCondition() == null) {
-      return RexImpTable.TRUE_EXPR;
-    }
-    final ParameterExpression root = DataContext.ROOT;
-    RexToLixTranslator translator =
-        new RexToLixTranslator(program, typeFactory, root, inputGetter, list);
-    translator = translator.setCorrelates(correlates);
-    return translator.translate(
-        program.getCondition(),
-        RexImpTable.NullAs.FALSE);
-  }
-  public static Expression convert(Expression operand, Type toType) {
-    final Type fromType = operand.getType();
-    return convert(operand, fromType, toType);
-  }
-
-  public static Expression convert(Expression operand, Type fromType,
-      Type toType) {
-    if (fromType.equals(toType)) {
-      return operand;
-    }
-    // E.g. from "Short" to "int".
-    // Generate "x.intValue()".
-    final Primitive toPrimitive = Primitive.of(toType);
-    final Primitive toBox = Primitive.ofBox(toType);
-    final Primitive fromBox = Primitive.ofBox(fromType);
-    final Primitive fromPrimitive = Primitive.of(fromType);
-    final boolean fromNumber = fromType instanceof Class
-        && Number.class.isAssignableFrom((Class) fromType);
-    if (fromType == String.class) {
-      if (toPrimitive != null) {
-        switch (toPrimitive) {
-        case CHAR:
-        case SHORT:
-        case INT:
-        case LONG:
-        case FLOAT:
-        case DOUBLE:
-          // Generate "SqlFunctions.toShort(x)".
-          return Expressions.call(
-              SqlFunctions.class,
-              "to" + SqlFunctions.initcap(toPrimitive.primitiveName),
-              operand);
-        default:
-          // Generate "Short.parseShort(x)".
-          return Expressions.call(
-              toPrimitive.boxClass,
-              "parse" + SqlFunctions.initcap(toPrimitive.primitiveName),
-              operand);
-        }
-      }
-      if (toBox != null) {
-        switch (toBox) {
-        case CHAR:
-          // Generate "SqlFunctions.toCharBoxed(x)".
-          return Expressions.call(
-              SqlFunctions.class,
-              "to" + SqlFunctions.initcap(toBox.primitiveName) + "Boxed",
-              operand);
-        default:
-          // Generate "Short.valueOf(x)".
-          return Expressions.call(
-              toBox.boxClass,
-              "valueOf",
-              operand);
-        }
-      }
-    }
-    if (toPrimitive != null) {
-      if (fromPrimitive != null) {
-        // E.g. from "float" to "double"
-        return Expressions.convert_(
-            operand, toPrimitive.primitiveClass);
-      }
-      if (fromNumber || fromBox == Primitive.CHAR) {
-        // Generate "x.shortValue()".
-        return Expressions.unbox(operand, toPrimitive);
-      } else {
-        // E.g. from "Object" to "short".
-        // Generate "SqlFunctions.toShort(x)"
-        return Expressions.call(
-            SqlFunctions.class,
-            "to" + SqlFunctions.initcap(toPrimitive.primitiveName),
-            operand);
-      }
-    } else if (fromNumber && toBox != null) {
-      // E.g. from "Short" to "Integer"
-      // Generate "x == null ? null : Integer.valueOf(x.intValue())"
-      return Expressions.condition(
-          Expressions.equal(operand, RexImpTable.NULL_EXPR),
-          RexImpTable.NULL_EXPR,
-          Expressions.box(
-              Expressions.unbox(operand, toBox),
-              toBox));
-    } else if (fromPrimitive != null && toBox != null) {
-      // E.g. from "int" to "Long".
-      // Generate Long.valueOf(x)
-      // Eliminate primitive casts like Long.valueOf((long) x)
-      if (operand instanceof UnaryExpression) {
-        UnaryExpression una = (UnaryExpression) operand;
-        if (una.nodeType == ExpressionType.Convert
-            || Primitive.of(una.getType()) == toBox) {
-          return Expressions.box(una.expression, toBox);
-        }
-      }
-      return Expressions.box(operand, toBox);
-    } else if (fromType == java.sql.Date.class) {
-      if (toBox == Primitive.INT) {
-        return Expressions.call(BuiltInMethod.DATE_TO_INT.method, operand);
-      } else {
-        return Expressions.convert_(operand, toType);
-      }
-    } else if (toType == java.sql.Date.class) {
-      // E.g. from "int" or "Integer" to "java.sql.Date",
-      // generate "SqlFunctions.internalToDate".
-      if (isA(fromType, Primitive.INT)) {
-        return Expressions.call(BuiltInMethod.INTERNAL_TO_DATE.method, operand);
-      } else {
-        return Expressions.convert_(operand, java.sql.Date.class);
-      }
-    } else if (toType == java.sql.Time.class) {
-      // E.g. from "int" or "Integer" to "java.sql.Time",
-      // generate "SqlFunctions.internalToTime".
-      if (isA(fromType, Primitive.INT)) {
-        return Expressions.call(BuiltInMethod.INTERNAL_TO_TIME.method, operand);
-      } else {
-        return Expressions.convert_(operand, java.sql.Time.class);
-      }
-    } else if (toType == java.sql.Timestamp.class) {
-      // E.g. from "long" or "Long" to "java.sql.Timestamp",
-      // generate "SqlFunctions.internalToTimestamp".
-      if (isA(fromType, Primitive.LONG)) {
-        return Expressions.call(BuiltInMethod.INTERNAL_TO_TIMESTAMP.method,
-            operand);
-      } else {
-        return Expressions.convert_(operand, java.sql.Timestamp.class);
-      }
-    } else if (toType == BigDecimal.class) {
-      if (fromBox != null) {
-        // E.g. from "Integer" to "BigDecimal".
-        // Generate "x == null ? null : new BigDecimal(x.intValue())"
-        return Expressions.condition(
-            Expressions.equal(operand, RexImpTable.NULL_EXPR),
-            RexImpTable.NULL_EXPR,
-            Expressions.new_(
-                BigDecimal.class,
-                Expressions.unbox(operand, fromBox)));
-      }
-      if (fromPrimitive != null) {
-        // E.g. from "int" to "BigDecimal".
-        // Generate "new BigDecimal(x)"
-        return Expressions.new_(
-            BigDecimal.class, operand);
-      }
-      // E.g. from "Object" to "BigDecimal".
-      // Generate "x == null ? null : SqlFunctions.toBigDecimal(x)"
-      return Expressions.condition(
-          Expressions.equal(operand, RexImpTable.NULL_EXPR),
-          RexImpTable.NULL_EXPR,
-          Expressions.call(
-              SqlFunctions.class,
-              "toBigDecimal",
-              operand));
-    } else if (toType == String.class) {
-      if (fromPrimitive != null) {
-        switch (fromPrimitive) {
-        case DOUBLE:
-        case FLOAT:
-          // E.g. from "double" to "String"
-          // Generate "SqlFunctions.toString(x)"
-          return Expressions.call(
-              SqlFunctions.class,
-              "toString",
-              operand);
-        default:
-          // E.g. from "int" to "String"
-          // Generate "Integer.toString(x)"
-          return Expressions.call(
-              fromPrimitive.boxClass,
-              "toString",
-              operand);
-        }
-      } else if (fromType == BigDecimal.class) {
-        // E.g. from "BigDecimal" to "String"
-        // Generate "x.toString()"
-        return Expressions.condition(
-            Expressions.equal(operand, RexImpTable.NULL_EXPR),
-            RexImpTable.NULL_EXPR,
-            Expressions.call(
-                SqlFunctions.class,
-                "toString",
-                operand));
-      } else {
-        // E.g. from "BigDecimal" to "String"
-        // Generate "x == null ? null : x.toString()"
-        return Expressions.condition(
-            Expressions.equal(operand, RexImpTable.NULL_EXPR),
-            RexImpTable.NULL_EXPR,
-            Expressions.call(
-                operand,
-                "toString"));
-      }
-    }
-    return Expressions.convert_(operand, toType);
-  }
-
-  static boolean isA(Type fromType, Primitive primitive) {
-    return Primitive.of(fromType) == primitive
-        || Primitive.ofBox(fromType) == primitive;
-  }
-
-  public Expression translateConstructor(
-      List<RexNode> operandList, SqlKind kind) {
-    switch (kind) {
-    case MAP_VALUE_CONSTRUCTOR:
-      Expression map =
-          list.append(
-              "map",
-              Expressions.new_(LinkedHashMap.class),
-              false);
-      for (int i = 0; i < operandList.size(); i++) {
-        RexNode key = operandList.get(i++);
-        RexNode value = operandList.get(i);
-        list.add(
-            Expressions.statement(
-                Expressions.call(
-                    map,
-                    BuiltInMethod.MAP_PUT.method,
-                    Expressions.box(translate(key)),
-                    Expressions.box(translate(value)))));
-      }
-      return map;
-    case ARRAY_VALUE_CONSTRUCTOR:
-      Expression lyst =
-          list.append(
-              "list",
-              Expressions.new_(ArrayList.class),
-              false);
-      for (RexNode value : operandList) {
-        list.add(
-            Expressions.statement(
-                Expressions.call(
-                    lyst,
-                    BuiltInMethod.COLLECTION_ADD.method,
-                    Expressions.box(translate(value)))));
-      }
-      return lyst;
-    default:
-      throw new AssertionError("unexpected: " + kind);
-    }
-  }
-
-  /** Returns whether an expression is nullable. Even if its type says it is
-   * nullable, if we have previously generated a check to make sure that it is
-   * not null, we will say so.
-   *
-   * <p>For example, {@code WHERE a == b} translates to
-   * {@code a != null && b != null && a.equals(b)}. When translating the
-   * 3rd part of the disjunction, we already know a and b are not null.</p>
-   *
-   * @param e Expression
-   * @return Whether expression is nullable in the current translation context
-   */
-  public boolean isNullable(RexNode e) {
-    if (!e.getType().isNullable()) {
-      return false;
-    }
-    final Boolean b = isKnownNullable(e);
-    return b == null || b;
-  }
-
-  /**
-   * Walks parent translator chain and verifies if the expression is nullable.
-   *
-   * @param node RexNode to check if it is nullable or not
-   * @return null when nullability is not known, true or false otherwise
-   */
-  protected Boolean isKnownNullable(RexNode node) {
-    if (!exprNullableMap.isEmpty()) {
-      Boolean nullable = exprNullableMap.get(node);
-      if (nullable != null) {
-        return nullable;
-      }
-    }
-    return parent == null ? null : parent.isKnownNullable(node);
-  }
-
-  /** Creates a read-only copy of this translator that records that a given
-   * expression is nullable. */
-  public RexToLixTranslator setNullable(RexNode e, boolean nullable) {
-    return setNullable(Collections.singletonMap(e, nullable));
-  }
-
-  /** Creates a read-only copy of this translator that records that a given
-   * expression is nullable. */
-  public RexToLixTranslator setNullable(
-      Map<? extends RexNode, Boolean> nullable) {
-    if (nullable == null || nullable.isEmpty()) {
-      return this;
-    }
-    return new RexToLixTranslator(program, typeFactory, root, inputGetter, list,
-        nullable, builder, this, correlates);
-  }
-
-  public RexToLixTranslator setBlock(BlockBuilder block) {
-    if (block == list) {
-      return this;
-    }
-    return new RexToLixTranslator(program, typeFactory, root, inputGetter,
-        block, ImmutableMap.<RexNode, Boolean>of(), builder, this, correlates);
-  }
-
-  public RexToLixTranslator setCorrelates(
-      Function1<String, InputGetter> correlates) {
-    if (this.correlates == correlates) {
-      return this;
-    }
-    return new RexToLixTranslator(program, typeFactory, root, inputGetter, list,
-        Collections.<RexNode, Boolean>emptyMap(), builder, this, correlates);
-  }
-
-  public RelDataType nullifyType(RelDataType type, boolean nullable) {
-    if (!nullable) {
-      final Primitive primitive = javaPrimitive(type);
-      if (primitive != null) {
-        return typeFactory.createJavaType(primitive.primitiveClass);
-      }
-    }
-    return typeFactory.createTypeWithNullability(type, nullable);
-  }
-
-  private Primitive javaPrimitive(RelDataType type) {
-    if (type instanceof RelDataTypeFactoryImpl.JavaType) {
-      return Primitive.ofBox(
-          ((RelDataTypeFactoryImpl.JavaType) type).getJavaClass());
-    }
-    return null;
-  }
-
-  public Expression getRoot() {
-    return root;
-  }
-
-  /** Translates a field of an input to an expression. */
-  public interface InputGetter {
-    Expression field(BlockBuilder list, int index, Type storageType);
-  }
-
-  /** Implementation of {@link InputGetter} that calls
-   * {@link PhysType#fieldReference}. */
-  public static class InputGetterImpl implements InputGetter {
-    private List<Pair<Expression, PhysType>> inputs;
-
-    public InputGetterImpl(List<Pair<Expression, PhysType>> inputs) {
-      this.inputs = inputs;
-    }
-
-    public Expression field(BlockBuilder list, int index, Type storageType) {
-      int offset = 0;
-      for (Pair<Expression, PhysType> input : inputs) {
-        final PhysType physType = input.right;
-        int fieldCount = physType.getRowType().getFieldCount();
-        if (index >= offset + fieldCount) {
-          offset += fieldCount;
-          continue;
-        }
-        final Expression left = list.append("current", input.left);
-        return physType.fieldReference(left, index - offset, storageType);
-      }
-      throw new IllegalArgumentException("Unable to find field #" + index);
-    }
-  }
-
-  /** Thrown in the unusual (but not erroneous) situation where the expression
-   * we are translating is the null literal but we have already checked that
-   * it is not null. It is easier to throw (and caller will always handle)
-   * than to check exhaustively beforehand. */
-  static class AlwaysNull extends ControlFlowException {
-    @SuppressWarnings("ThrowableInstanceNeverThrown")
-    public static final AlwaysNull INSTANCE = new AlwaysNull();
-
-    private AlwaysNull() {}
-  }
-}
-
-// End RexToLixTranslator.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/StrictAggImplementor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/StrictAggImplementor.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/StrictAggImplementor.java
deleted file mode 100644
index a34813c..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/StrictAggImplementor.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.linq4j.tree.BlockBuilder;
-import org.apache.calcite.linq4j.tree.BlockStatement;
-import org.apache.calcite.linq4j.tree.Expression;
-import org.apache.calcite.linq4j.tree.Expressions;
-import org.apache.calcite.linq4j.tree.ParameterExpression;
-import org.apache.calcite.linq4j.tree.Primitive;
-import org.apache.calcite.linq4j.tree.Types;
-import org.apache.calcite.rel.type.RelDataType;
-import org.apache.calcite.rex.RexNode;
-
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * The base implementation of strict aggregate function.
- * @see org.apache.calcite.adapter.enumerable.RexImpTable.CountImplementor
- * @see org.apache.calcite.adapter.enumerable.RexImpTable.SumImplementor
- */
-public abstract class StrictAggImplementor implements AggImplementor {
-  private boolean needTrackEmptySet;
-  private boolean trackNullsPerRow;
-  private int stateSize;
-
-  protected boolean nonDefaultOnEmptySet(AggContext info) {
-    return info.returnRelType().isNullable();
-  }
-
-  protected final int getStateSize() {
-    return stateSize;
-  }
-
-  protected final void accAdvance(AggAddContext add, Expression acc,
-      Expression next) {
-    add.currentBlock().add(
-        Expressions.statement(
-            Expressions.assign(acc, Types.castIfNecessary(acc.type, next))));
-  }
-
-  public final List<Type> getStateType(AggContext info) {
-    List<Type> subState = getNotNullState(info);
-    stateSize = subState.size();
-    needTrackEmptySet = nonDefaultOnEmptySet(info);
-    if (!needTrackEmptySet) {
-      return subState;
-    }
-    final boolean hasNullableArgs = anyNullable(info.parameterRelTypes());
-    trackNullsPerRow = !(info instanceof WinAggContext) || hasNullableArgs;
-
-    List<Type> res = new ArrayList<>(subState.size() + 1);
-    res.addAll(subState);
-    res.add(boolean.class); // has not nulls
-    return res;
-  }
-
-  private boolean anyNullable(List<? extends RelDataType> types) {
-    for (RelDataType type : types) {
-      if (type.isNullable()) {
-        return true;
-      }
-    }
-    return false;
-  }
-
-  public List<Type> getNotNullState(AggContext info) {
-    Type type = info.returnType();
-    type = EnumUtils.fromInternal(type);
-    type = Primitive.unbox(type);
-    return Collections.singletonList(type);
-  }
-
-  public final void implementReset(AggContext info, AggResetContext reset) {
-    if (trackNullsPerRow) {
-      List<Expression> acc = reset.accumulator();
-      Expression flag = acc.get(acc.size() - 1);
-      BlockBuilder block = reset.currentBlock();
-      block.add(
-          Expressions.statement(
-              Expressions.assign(flag,
-                  RexImpTable.getDefaultValue(flag.getType()))));
-    }
-    implementNotNullReset(info, reset);
-  }
-
-  protected void implementNotNullReset(AggContext info,
-      AggResetContext reset) {
-    BlockBuilder block = reset.currentBlock();
-    List<Expression> accumulator = reset.accumulator();
-    for (int i = 0; i < getStateSize(); i++) {
-      Expression exp = accumulator.get(i);
-      block.add(
-          Expressions.statement(
-              Expressions.assign(exp,
-                  RexImpTable.getDefaultValue(exp.getType()))));
-    }
-  }
-
-  public final void implementAdd(AggContext info, final AggAddContext add) {
-    final List<RexNode> args = add.rexArguments();
-    final RexToLixTranslator translator = add.rowTranslator();
-    final List<Expression> conditions = new ArrayList<>();
-    conditions.addAll(
-        translator.translateList(args, RexImpTable.NullAs.IS_NOT_NULL));
-    if (add.rexFilterArgument() != null) {
-      conditions.add(
-          translator.translate(add.rexFilterArgument(),
-              RexImpTable.NullAs.FALSE));
-    }
-    Expression condition = Expressions.foldAnd(conditions);
-    if (Expressions.constant(false).equals(condition)) {
-      return;
-    }
-
-    boolean argsNotNull = Expressions.constant(true).equals(condition);
-    final BlockBuilder thenBlock =
-        argsNotNull
-        ? add.currentBlock()
-        : new BlockBuilder(true, add.currentBlock());
-    if (trackNullsPerRow) {
-      List<Expression> acc = add.accumulator();
-      thenBlock.add(
-          Expressions.statement(
-              Expressions.assign(acc.get(acc.size() - 1),
-                  Expressions.constant(true))));
-    }
-    if (argsNotNull) {
-      implementNotNullAdd(info, add);
-      return;
-    }
-
-    final Map<RexNode, Boolean> nullables = new HashMap<>();
-    for (RexNode arg : args) {
-      if (translator.isNullable(arg)) {
-        nullables.put(arg, false);
-      }
-    }
-    add.nestBlock(thenBlock, nullables);
-    implementNotNullAdd(info, add);
-    add.exitBlock();
-    add.currentBlock().add(Expressions.ifThen(condition, thenBlock.toBlock()));
-  }
-
-  protected abstract void implementNotNullAdd(AggContext info,
-      AggAddContext add);
-
-  public final Expression implementResult(AggContext info,
-      final AggResultContext result) {
-    if (!needTrackEmptySet) {
-      return RexToLixTranslator.convert(
-          implementNotNullResult(info, result), info.returnType());
-    }
-    String tmpName = result.accumulator().isEmpty()
-        ? "ar"
-        : (result.accumulator().get(0) + "$Res");
-    ParameterExpression res = Expressions.parameter(0, info.returnType(),
-        result.currentBlock().newName(tmpName));
-
-    List<Expression> acc = result.accumulator();
-    final BlockBuilder thenBlock = result.nestBlock();
-    Expression nonNull = RexToLixTranslator.convert(
-        implementNotNullResult(info, result), info.returnType());
-    result.exitBlock();
-    thenBlock.add(Expressions.statement(Expressions.assign(res, nonNull)));
-    BlockStatement thenBranch = thenBlock.toBlock();
-    Expression seenNotNullRows =
-        trackNullsPerRow
-        ? acc.get(acc.size() - 1)
-        : ((WinAggResultContext) result).hasRows();
-
-    if (thenBranch.statements.size() == 1) {
-      return Expressions.condition(seenNotNullRows,
-          nonNull, RexImpTable.getDefaultValue(res.getType()));
-    }
-    result.currentBlock().add(Expressions.declare(0, res, null));
-    result.currentBlock().add(
-        Expressions.ifThenElse(seenNotNullRows,
-            thenBranch,
-            Expressions.statement(
-                Expressions.assign(res,
-                    RexImpTable.getDefaultValue(res.getType())))));
-    return res;
-  }
-
-  protected Expression implementNotNullResult(AggContext info,
-      AggResultContext result) {
-    return result.accumulator().get(0);
-  }
-}
-
-// End StrictAggImplementor.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/StrictWinAggImplementor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/StrictWinAggImplementor.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/StrictWinAggImplementor.java
deleted file mode 100644
index f2b0790..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/StrictWinAggImplementor.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.linq4j.tree.Expression;
-
-import java.lang.reflect.Type;
-import java.util.List;
-
-/**
- * The base implementation of strict window aggregate function.
- * @see org.apache.calcite.adapter.enumerable.RexImpTable.FirstLastValueImplementor
- * @see org.apache.calcite.adapter.enumerable.RexImpTable.RankImplementor
- * @see org.apache.calcite.adapter.enumerable.RexImpTable.RowNumberImplementor
- */
-public abstract class StrictWinAggImplementor extends StrictAggImplementor
-    implements WinAggImplementor {
-  protected abstract void implementNotNullAdd(WinAggContext info,
-      WinAggAddContext add);
-
-  protected boolean nonDefaultOnEmptySet(WinAggContext info) {
-    return super.nonDefaultOnEmptySet(info);
-  }
-
-  public List<Type> getNotNullState(WinAggContext info) {
-    return super.getNotNullState(info);
-  }
-
-  protected void implementNotNullReset(WinAggContext info,
-      WinAggResetContext reset) {
-    super.implementNotNullReset(info, reset);
-  }
-
-  protected Expression implementNotNullResult(WinAggContext info,
-      WinAggResultContext result) {
-    return super.implementNotNullResult(info, result);
-  }
-
-  @Override protected final void implementNotNullAdd(AggContext info,
-      AggAddContext add) {
-    implementNotNullAdd((WinAggContext) info, (WinAggAddContext) add);
-  }
-
-  @Override protected boolean nonDefaultOnEmptySet(AggContext info) {
-    return nonDefaultOnEmptySet((WinAggContext) info);
-  }
-
-  @Override public final List<Type> getNotNullState(AggContext info) {
-    return getNotNullState((WinAggContext) info);
-  }
-
-  @Override protected final void implementNotNullReset(AggContext info,
-      AggResetContext reset) {
-    implementNotNullReset((WinAggContext) info, (WinAggResetContext) reset);
-  }
-
-  @Override protected final Expression implementNotNullResult(AggContext info,
-      AggResultContext result) {
-    return implementNotNullResult((WinAggContext) info,
-        (WinAggResultContext) result);
-  }
-
-  public boolean needCacheWhenFrameIntact() {
-    return true;
-  }
-}
-
-// End StrictWinAggImplementor.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/WinAggAddContext.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/WinAggAddContext.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/WinAggAddContext.java
deleted file mode 100644
index 13717e5..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/WinAggAddContext.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.linq4j.tree.Expression;
-
-/**
- * Information for a call to
- * {@link AggImplementor#implementAdd(AggContext, AggAddContext)}.
- *
- * <p>{@link WinAggAddContext} is used when implementing windowed aggregate.
- * Typically, the aggregation implementation will use {@link #arguments()}
- * or {@link #rexArguments()} to update aggregate value.
- * @see AggAddContext
- */
-public interface WinAggAddContext extends AggAddContext, WinAggResultContext {
-  /**
-   * Returns current position inside for-loop of window aggregate.
-   * Note, the position is relative to {@link WinAggFrameContext#startIndex()}.
-   * This is NOT current row as in "rows between current row".
-   * If you need to know the relative index of the current row in the partition,
-   * use {@link WinAggFrameContext#index()}.
-   * @return current position inside for-loop of window aggregate.
-   * @see WinAggFrameContext#index()
-   * @see WinAggFrameContext#startIndex()
-   */
-  Expression currentPosition();
-}
-
-// End WinAggAddContext.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/WinAggContext.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/WinAggContext.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/WinAggContext.java
deleted file mode 100644
index db0a6cd..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/WinAggContext.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-/**
- * Marker interface to allow
- * {@link org.apache.calcite.adapter.enumerable.AggImplementor}
- * to tell if it is used in regular or windowed context.
- */
-public interface WinAggContext extends AggContext {
-}
-
-// End WinAggContext.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/WinAggFrameContext.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/WinAggFrameContext.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/WinAggFrameContext.java
deleted file mode 100644
index 73782a3..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/WinAggFrameContext.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.linq4j.tree.Expression;
-
-/**
- * Provides information on the current window.
- *
- * <p>All the indexes are ready to be used in
- * {@link WinAggResultContext#arguments(org.apache.calcite.linq4j.tree.Expression)},
- * {@link WinAggFrameResultContext#rowTranslator(org.apache.calcite.linq4j.tree.Expression)}
- * and similar methods.
- */
-public interface WinAggFrameContext {
-  /**
-   * Returns the index of the current row in the partition.
-   * In other words, it is close to ~ROWS BETWEEN CURRENT ROW.
-   * Note to use {@link #startIndex()} when you need zero-based row position.
-   * @return the index of the very first row in partition
-   */
-  Expression index();
-
-  /**
-   * Returns the index of the very first row in partition.
-   * @return index of the very first row in partition
-   */
-  Expression startIndex();
-
-  /**
-   * Returns the index of the very last row in partition.
-   * @return index of the very last row in partition
-   */
-  Expression endIndex();
-
-  /**
-   * Returns the boolean expression that tells if the partition has rows.
-   * The partition might lack rows in cases like ROWS BETWEEN 1000 PRECEDING
-   * AND 900 PRECEDING.
-   * @return boolean expression that tells if the partition has rows
-   */
-  Expression hasRows();
-
-  /**
-   * Returns the number of rows in the current frame (subject to framing
-   * clause).
-   * @return number of rows in the current partition or 0 if the partition
-   *   is empty
-   */
-  Expression getFrameRowCount();
-
-  /**
-   * Returns the number of rows in the current partition (as determined by
-   * PARTITION BY clause).
-   * @return number of rows in the current partition or 0 if the partition
-   *   is empty
-   */
-  Expression getPartitionRowCount();
-}
-
-// End WinAggFrameContext.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/WinAggFrameResultContext.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/WinAggFrameResultContext.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/WinAggFrameResultContext.java
deleted file mode 100644
index f0b4d87..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/WinAggFrameResultContext.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.linq4j.tree.Expression;
-
-/**
- * Provides information on the current window when computing the result of
- * the aggregation.
- */
-public interface WinAggFrameResultContext extends WinAggFrameContext {
-  /**
-   * Converts absolute index position of the given relative position.
-   * @param offset offset of the requested row
-   * @param seekType the type of offset (start of window, end of window, etc)
-   * @return absolute position of the requested row
-   */
-  Expression computeIndex(Expression offset,
-      WinAggImplementor.SeekType seekType);
-
-  /**
-   * Returns boolean the expression that checks if the given index is in
-   * the frame bounds.
-   * @param rowIndex index if the row to check
-   * @return expression that validates frame bounds for the given index
-   */
-  Expression rowInFrame(Expression rowIndex);
-
-  /**
-   * Returns boolean the expression that checks if the given index is in
-   * the partition bounds.
-   * @param rowIndex index if the row to check
-   * @return expression that validates partition bounds for the given index
-   */
-  Expression rowInPartition(Expression rowIndex);
-
-  /**
-   * Returns row translator for given absolute row position.
-   * @param rowIndex absolute index of the row.
-   * @return translator for the requested row
-   */
-  RexToLixTranslator rowTranslator(Expression rowIndex);
-
-  /**
-   * Compares two rows given by absolute positions according to the order
-   * collation of the current window.
-   * @param a absolute index of the first row
-   * @param b absolute index of the second row
-   * @return result of comparison as as in {@link Comparable#compareTo}
-   */
-  Expression compareRows(Expression a, Expression b);
-}
-
-// End WinAggFrameResultContext.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/WinAggImplementor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/WinAggImplementor.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/WinAggImplementor.java
deleted file mode 100644
index 7d2489f..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/WinAggImplementor.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-/**
- * Implements a windowed aggregate function by generating expressions to
- * initialize, add to, and get a result from, an accumulator.
- * Windowed aggregate is more powerful than regular aggregate since it can
- * access rows in the current partition by row indices.
- * Regular aggregate can be used to implement windowed aggregate.
- * <p>This interface does not define new methods: window-specific
- * sub-interfaces are passed when implementing window aggregate.
- *
- * @see org.apache.calcite.adapter.enumerable.StrictWinAggImplementor
- * @see org.apache.calcite.adapter.enumerable.RexImpTable.FirstLastValueImplementor
- * @see org.apache.calcite.adapter.enumerable.RexImpTable.RankImplementor
- * @see org.apache.calcite.adapter.enumerable.RexImpTable.RowNumberImplementor
- */
-public interface WinAggImplementor extends AggImplementor {
-  /**
-   * Allows to access rows in window partition relative to first/last and
-   * current row.
-   */
-  public enum SeekType {
-    /**
-     * Start of window.
-     * @see WinAggFrameContext#startIndex()
-     */
-    START,
-    /**
-     * Row position in the frame.
-     * @see WinAggFrameContext#index()
-     */
-    SET,
-    /**
-     * The index of row that is aggregated.
-     * Valid only in {@link WinAggAddContext}.
-     * @see WinAggAddContext#currentPosition()
-     */
-    AGG_INDEX,
-    /**
-     * End of window.
-     * @see WinAggFrameContext#endIndex()
-     */
-    END
-  }
-
-  boolean needCacheWhenFrameIntact();
-}
-
-// End WinAggImplementor.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/WinAggResetContext.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/WinAggResetContext.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/WinAggResetContext.java
deleted file mode 100644
index 9dee01e..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/WinAggResetContext.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-/**
- * Information for a call to
- * {@link AggImplementor#implementReset(AggContext, AggResetContext)}.
- *
- * <p>The {@link AggResetContext} provides access to the accumulator variables
- * that should be reset.
- *
- * <p>Note: the very first reset of windowed aggregates is performed with null
- * knowledge of indices and row count in the partition.
- * In other words, the implementation should treat indices and partition row
- * count as a hint to pre-size the collections.
- */
-public interface WinAggResetContext
-    extends AggResetContext, WinAggFrameContext {
-}
-
-// End WinAggResetContext.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/WinAggResultContext.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/WinAggResultContext.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/WinAggResultContext.java
deleted file mode 100644
index 3b83b19..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/WinAggResultContext.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.linq4j.tree.Expression;
-import org.apache.calcite.rex.RexNode;
-
-import java.util.List;
-
-/**
- * Information for a call to
- * {@link AggImplementor#implementResult(AggContext, AggResultContext)}.
- *
- * <p>Typically, the aggregation implementation will convert
- * {@link #accumulator()} to the resulting value of the aggregation.  The
- * implementation MUST NOT destroy the contents of {@link #accumulator()}.
- */
-public interface WinAggResultContext extends AggResultContext,
-    WinAggFrameResultContext {
-  /**
-   * Returns {@link org.apache.calcite.rex.RexNode} representation of arguments.
-   * This can be useful for manual translation of required arguments with
-   * different {@link NullPolicy}.
-   * @return {@link org.apache.calcite.rex.RexNode} representation of arguments
-   */
-  List<RexNode> rexArguments();
-
-  /**
-   * Returns Linq4j form of arguments.
-   * The resulting value is equivalent to
-   * {@code rowTranslator().translateList(rexArguments())}.
-   * This is handy if you need just operate on argument.
-   * @param rowIndex index of the requested row. The index must be in range
-   *                 of partition's startIndex and endIndex.
-   * @return Linq4j form of arguments of the particular row
-   */
-  List<Expression> arguments(Expression rowIndex);
-}
-
-// End WinAggResultContext.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/impl/AggAddContextImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/impl/AggAddContextImpl.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/impl/AggAddContextImpl.java
deleted file mode 100644
index 18ba8cc..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/impl/AggAddContextImpl.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable.impl;
-
-import org.apache.calcite.adapter.enumerable.AggAddContext;
-import org.apache.calcite.linq4j.tree.BlockBuilder;
-import org.apache.calcite.linq4j.tree.Expression;
-
-import java.util.List;
-
-/**
- * Implementation of
- * {@link org.apache.calcite.adapter.enumerable.AggAddContext}.
- */
-public abstract class AggAddContextImpl extends AggResultContextImpl
-    implements AggAddContext {
-  public AggAddContextImpl(BlockBuilder block, List<Expression> accumulator) {
-    super(block, accumulator);
-  }
-
-  public final List<Expression> arguments() {
-    return rowTranslator().translateList(rexArguments());
-  }
-}
-
-// End AggAddContextImpl.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/impl/AggResetContextImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/impl/AggResetContextImpl.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/impl/AggResetContextImpl.java
deleted file mode 100644
index 3e66705..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/impl/AggResetContextImpl.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable.impl;
-
-import org.apache.calcite.adapter.enumerable.AggResetContext;
-import org.apache.calcite.adapter.enumerable.NestedBlockBuilderImpl;
-import org.apache.calcite.linq4j.tree.BlockBuilder;
-import org.apache.calcite.linq4j.tree.Expression;
-
-import java.util.List;
-
-/**
- * Implementation of
- * {@link org.apache.calcite.adapter.enumerable.AggResetContext}
- */
-public class AggResetContextImpl extends NestedBlockBuilderImpl
-    implements AggResetContext {
-  private final List<Expression> accumulator;
-
-  /**
-   * Creates aggregate reset context
-   * @param block code block that will contain the added initialization
-   * @param accumulator accumulator variables that store the intermediate
-   *                    aggregate state
-   */
-  public AggResetContextImpl(BlockBuilder block, List<Expression> accumulator) {
-    super(block);
-    this.accumulator = accumulator;
-  }
-
-  public List<Expression> accumulator() {
-    return accumulator;
-  }
-}
-
-// End AggResetContextImpl.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/impl/AggResultContextImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/impl/AggResultContextImpl.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/impl/AggResultContextImpl.java
deleted file mode 100644
index 1da28c6..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/impl/AggResultContextImpl.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable.impl;
-
-import org.apache.calcite.adapter.enumerable.AggResultContext;
-import org.apache.calcite.linq4j.tree.BlockBuilder;
-import org.apache.calcite.linq4j.tree.Expression;
-
-import java.util.List;
-
-/**
- * Implementation of
- * {@link org.apache.calcite.adapter.enumerable.AggResultContext}
- */
-public class AggResultContextImpl extends AggResetContextImpl
-    implements AggResultContext {
-  /**
-   * Creates aggregate result context
-   * @param block code block that will contain the result calculation statements
-   * @param accumulator accumulator variables that store the intermediate
-   *                    aggregate state
-   */
-  public AggResultContextImpl(BlockBuilder block,
-      List<Expression> accumulator) {
-    super(block, accumulator);
-  }
-}
-
-// End AggResultContextImpl.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/impl/WinAggAddContextImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/impl/WinAggAddContextImpl.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/impl/WinAggAddContextImpl.java
deleted file mode 100644
index 9932cab..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/impl/WinAggAddContextImpl.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable.impl;
-
-import org.apache.calcite.adapter.enumerable.RexToLixTranslator;
-import org.apache.calcite.adapter.enumerable.WinAggAddContext;
-import org.apache.calcite.adapter.enumerable.WinAggFrameResultContext;
-import org.apache.calcite.adapter.enumerable.WinAggImplementor;
-import org.apache.calcite.linq4j.tree.BlockBuilder;
-import org.apache.calcite.linq4j.tree.Expression;
-import org.apache.calcite.linq4j.tree.Expressions;
-
-import com.google.common.base.Function;
-
-import java.util.List;
-
-/**
- * Implementation of
- * {@link org.apache.calcite.adapter.enumerable.WinAggAddContext}.
- */
-public abstract class WinAggAddContextImpl extends WinAggResultContextImpl
-    implements WinAggAddContext {
-  public WinAggAddContextImpl(BlockBuilder block, List<Expression> accumulator,
-      Function<BlockBuilder, WinAggFrameResultContext> frame) {
-    super(block, accumulator, frame);
-  }
-
-  public final RexToLixTranslator rowTranslator() {
-    return rowTranslator(
-        computeIndex(Expressions.constant(0),
-            WinAggImplementor.SeekType.AGG_INDEX));
-  }
-
-  public final List<Expression> arguments() {
-    return rowTranslator().translateList(rexArguments());
-  }
-}
-
-// End WinAggAddContextImpl.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/impl/WinAggResetContextImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/impl/WinAggResetContextImpl.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/impl/WinAggResetContextImpl.java
deleted file mode 100644
index 0145f80..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/impl/WinAggResetContextImpl.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable.impl;
-
-import org.apache.calcite.adapter.enumerable.WinAggResetContext;
-import org.apache.calcite.linq4j.tree.BlockBuilder;
-import org.apache.calcite.linq4j.tree.Expression;
-
-import java.util.List;
-
-/**
- * Implementation of
- * {@link org.apache.calcite.adapter.enumerable.WinAggResetContext}.
- */
-public class WinAggResetContextImpl extends AggResetContextImpl
-    implements WinAggResetContext {
-  private final Expression index;
-  private final Expression startIndex;
-  private final Expression endIndex;
-  private final Expression frameRowCount;
-  private final Expression partitionRowCount;
-  private final Expression hasRows;
-
-  /**
-   * Creates window aggregate reset context.
-   * @param block code block that will contain the added initialization
-   * @param accumulator accumulator variables that store the intermediate
-   *                    aggregate state
-   * @param index index of the current row in the partition
-   * @param startIndex index of the very first row in partition
-   * @param endIndex index of the very last row in partition
-   * @param hasRows boolean expression that tells if the partition has rows
-   * @param frameRowCount number of rows in the current frame
-   * @param partitionRowCount number of rows in the current partition
-   */
-  public WinAggResetContextImpl(BlockBuilder block,
-      List<Expression> accumulator, Expression index,
-      Expression startIndex, Expression endIndex,
-      Expression hasRows,
-      Expression frameRowCount, Expression partitionRowCount) {
-    super(block, accumulator);
-    this.index = index;
-    this.startIndex = startIndex;
-    this.endIndex = endIndex;
-    this.frameRowCount = frameRowCount;
-    this.partitionRowCount = partitionRowCount;
-    this.hasRows = hasRows;
-  }
-
-  public Expression index() {
-    return index;
-  }
-
-  public Expression startIndex() {
-    return startIndex;
-  }
-
-  public Expression endIndex() {
-    return endIndex;
-  }
-
-  public Expression hasRows() {
-    return hasRows;
-  }
-
-  public Expression getFrameRowCount() {
-    return frameRowCount;
-  }
-
-  public Expression getPartitionRowCount() {
-    return partitionRowCount;
-  }
-}
-
-// End WinAggResetContextImpl.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/impl/WinAggResultContextImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/impl/WinAggResultContextImpl.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/impl/WinAggResultContextImpl.java
deleted file mode 100644
index d4a5c6f..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/impl/WinAggResultContextImpl.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable.impl;
-
-import org.apache.calcite.adapter.enumerable.RexToLixTranslator;
-import org.apache.calcite.adapter.enumerable.WinAggFrameResultContext;
-import org.apache.calcite.adapter.enumerable.WinAggImplementor;
-import org.apache.calcite.adapter.enumerable.WinAggResultContext;
-import org.apache.calcite.linq4j.tree.BlockBuilder;
-import org.apache.calcite.linq4j.tree.Expression;
-
-import com.google.common.base.Function;
-
-import java.util.List;
-
-/**
- * Implementation of
- * {@link org.apache.calcite.adapter.enumerable.WinAggResultContext}.
- */
-public abstract class WinAggResultContextImpl extends AggResultContextImpl
-    implements WinAggResultContext {
-
-  private final Function<BlockBuilder, WinAggFrameResultContext> frame;
-
-  /**
-   * Creates window aggregate result context.
-   * @param block code block that will contain the added initialization
-   * @param accumulator accumulator variables that store the intermediate
-   *                    aggregate state
-   */
-  public WinAggResultContextImpl(BlockBuilder block,
-      List<Expression> accumulator,
-      Function<BlockBuilder, WinAggFrameResultContext> frameContextBuilder) {
-    super(block, accumulator);
-    this.frame = frameContextBuilder;
-  }
-
-  private WinAggFrameResultContext getFrame() {
-    return frame.apply(currentBlock());
-  }
-
-  public final List<Expression> arguments(Expression rowIndex) {
-    return rowTranslator(rowIndex).translateList(rexArguments());
-  }
-
-  public Expression computeIndex(Expression offset,
-      WinAggImplementor.SeekType seekType) {
-    return getFrame().computeIndex(offset, seekType);
-  }
-
-  public Expression rowInFrame(Expression rowIndex) {
-    return getFrame().rowInFrame(rowIndex);
-  }
-
-  public Expression rowInPartition(Expression rowIndex) {
-    return getFrame().rowInPartition(rowIndex);
-  }
-
-  public RexToLixTranslator rowTranslator(Expression rowIndex) {
-    return getFrame().rowTranslator(rowIndex)
-        .setNullable(currentNullables());
-  }
-
-  public Expression compareRows(Expression a, Expression b) {
-    return getFrame().compareRows(a, b);
-  }
-
-  public Expression index() {
-    return getFrame().index();
-  }
-
-  public Expression startIndex() {
-    return getFrame().startIndex();
-  }
-
-  public Expression endIndex() {
-    return getFrame().endIndex();
-  }
-
-  public Expression hasRows() {
-    return getFrame().hasRows();
-  }
-
-  public Expression getFrameRowCount() {
-    return getFrame().getFrameRowCount();
-  }
-
-  public Expression getPartitionRowCount() {
-    return getFrame().getPartitionRowCount();
-  }
-}
-
-// End WinAggResultContextImpl.java


[33/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/util/ByteString.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/util/ByteString.java b/avatica/core/src/main/java/org/apache/calcite/avatica/util/ByteString.java
deleted file mode 100644
index 24db7da..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/util/ByteString.java
+++ /dev/null
@@ -1,353 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.util;
-
-import com.fasterxml.jackson.annotation.JsonValue;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.Arrays;
-
-/**
- * Collection of bytes.
- *
- * <p>ByteString is to bytes what {@link String} is to chars: It is immutable,
- * implements equality ({@link #hashCode} and {@link #equals}),
- * comparison ({@link #compareTo}) and
- * {@link Serializable serialization} correctly.</p>
- */
-public class ByteString implements Comparable<ByteString>, Serializable {
-  private final byte[] bytes;
-
-  /** An empty byte string. */
-  public static final ByteString EMPTY = new ByteString(new byte[0], false);
-
-  private static final char[] DIGITS = {
-    '0', '1', '2', '3', '4', '5', '6', '7',
-    '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
-  };
-
-  /**
-   * Creates a ByteString.
-   *
-   * @param bytes Bytes
-   */
-  public ByteString(byte[] bytes) {
-    this(bytes.clone(), false);
-  }
-
-  // private constructor that does not copy
-  private ByteString(byte[] bytes, boolean dummy) {
-    this.bytes = bytes;
-  }
-
-  @Override public int hashCode() {
-    return Arrays.hashCode(bytes);
-  }
-
-  @Override public boolean equals(Object obj) {
-    return this == obj
-        || obj instanceof ByteString
-        && Arrays.equals(bytes, ((ByteString) obj).bytes);
-  }
-
-  public int compareTo(ByteString that) {
-    final byte[] v1 = bytes;
-    final byte[] v2 = that.bytes;
-    final int n = Math.min(v1.length, v2.length);
-    for (int i = 0; i < n; i++) {
-      int c1 = v1[i] & 0xff;
-      int c2 = v2[i] & 0xff;
-      if (c1 != c2) {
-        return c1 - c2;
-      }
-    }
-    return v1.length - v2.length;
-  }
-
-  /**
-   * Returns this byte string in hexadecimal format.
-   *
-   * @return Hexadecimal string
-   */
-  @Override public String toString() {
-    return toString(16);
-  }
-
-  /**
-   * Returns this byte string in a given base.
-   *
-   * @return String in given base
-   */
-  public String toString(int base) {
-    return toString(bytes, base);
-  }
-
-  /**
-   * Returns the given byte array in hexadecimal format.
-   *
-   * <p>For example, <tt>toString(new byte[] {0xDE, 0xAD})</tt>
-   * returns {@code "DEAD"}.</p>
-   *
-   * @param bytes Array of bytes
-   * @param base Base (2 or 16)
-   * @return String
-   */
-  public static String toString(byte[] bytes, int base) {
-    char[] chars;
-    int j = 0;
-    switch (base) {
-    case 2:
-      chars = new char[bytes.length * 8];
-      for (byte b : bytes) {
-        chars[j++] = DIGITS[(b & 0x80) >> 7];
-        chars[j++] = DIGITS[(b & 0x40) >> 6];
-        chars[j++] = DIGITS[(b & 0x20) >> 5];
-        chars[j++] = DIGITS[(b & 0x10) >> 4];
-        chars[j++] = DIGITS[(b & 0x08) >> 3];
-        chars[j++] = DIGITS[(b & 0x04) >> 2];
-        chars[j++] = DIGITS[(b & 0x02) >> 1];
-        chars[j++] = DIGITS[b & 0x01];
-      }
-      break;
-    case 16:
-      chars = new char[bytes.length * 2];
-      for (byte b : bytes) {
-        chars[j++] = DIGITS[(b & 0xF0) >> 4];
-        chars[j++] = DIGITS[b & 0x0F];
-      }
-      break;
-    default:
-      throw new IllegalArgumentException("bad base " + base);
-    }
-    return new String(chars, 0, j);
-  }
-
-  /**
-   * Returns this byte string in Base64 format.
-   *
-   * @return Base64 string
-   */
-  public String toBase64String() {
-    return Base64.encodeBytes(bytes);
-  }
-
-  /**
-   * Creates a byte string from a hexadecimal or binary string.
-   *
-   * <p>For example, <tt>of("DEAD", 16)</tt>
-   * returns the same as {@code ByteString(new byte[] {0xDE, 0xAD})}.
-   *
-   * @param string Array of bytes
-   * @param base Base (2 or 16)
-   * @return String
-   */
-  public static ByteString of(String string, int base) {
-    final byte[] bytes = parse(string, base);
-    return new ByteString(bytes, false);
-  }
-
-  /**
-   * Parses a hexadecimal or binary string to a byte array.
-   *
-   * @param string Hexadecimal or binary string
-   * @param base Base (2 or 16)
-   * @return Byte array
-   */
-  public static byte[] parse(String string, int base) {
-    char[] chars = string.toCharArray();
-    byte[] bytes;
-    int j = 0;
-    byte b = 0;
-    switch (base) {
-    case 2:
-      bytes = new byte[chars.length / 8];
-      for (char c : chars) {
-        b <<= 1;
-        if (c == '1') {
-          b |= 0x1;
-        }
-        if (j % 8 == 7) {
-          bytes[j / 8] = b;
-          b = 0;
-        }
-        ++j;
-      }
-      break;
-    case 16:
-      if (chars.length % 2 != 0) {
-        throw new IllegalArgumentException("hex string has odd length");
-      }
-      bytes = new byte[chars.length / 2];
-      for (char c : chars) {
-        b <<= 4;
-        byte i = decodeHex(c);
-        b |= i & 0x0F;
-        if (j % 2 == 1) {
-          bytes[j / 2] = b;
-          b = 0;
-        }
-        ++j;
-      }
-      break;
-    default:
-      throw new IllegalArgumentException("bad base " + base);
-    }
-    return bytes;
-  }
-
-  private static byte decodeHex(char c) {
-    if (c >= '0' && c <= '9') {
-      return (byte) (c - '0');
-    }
-    if (c >= 'a' && c <= 'f') {
-      return (byte) (c - 'a' + 10);
-    }
-    if (c >= 'A' && c <= 'F') {
-      return (byte) (c - 'A' + 10);
-    }
-    throw new IllegalArgumentException("invalid hex character: " + c);
-  }
-
-  /**
-   * Creates a byte string from a Base64 string.
-   *
-   * @param string Base64 string
-   * @return Byte string
-   */
-  public static ByteString ofBase64(String string) {
-    final byte[] bytes = parseBase64(string);
-    return new ByteString(bytes, false);
-  }
-
-  /**
-   * Parses a Base64 to a byte array.
-   *
-   * @param string Base64 string
-   * @return Byte array
-   */
-  public static byte[] parseBase64(String string) {
-    try {
-      return Base64.decode(string);
-    } catch (IOException e) {
-      throw new IllegalArgumentException("bad base64 string", e);
-    }
-  }
-
-  @SuppressWarnings({
-      "CloneDoesntCallSuperClone",
-      "CloneDoesntDeclareCloneNotSupportedException"
-  })
-  @Override public Object clone() {
-    return this;
-  }
-
-  /**
-   * Returns the number of bytes in this byte string.
-   *
-   * @return Length of this byte string
-   */
-  public int length() {
-    return bytes.length;
-  }
-
-  /**
-   * Returns the byte at a given position in the byte string.
-   *
-   * @param i Index
-   * @throws  IndexOutOfBoundsException
-   *          if the <tt>index</tt> argument is negative or not less than
-   *          <tt>length()</tt>
-   * @return Byte at given position
-   */
-  public byte byteAt(int i) {
-    return bytes[i];
-  }
-
-  /**
-   * Returns a ByteString that consists of a given range.
-   *
-   * @param start Start of range
-   * @param end Position after end of range
-   * @return Substring
-   */
-  public ByteString substring(int start, int end) {
-    byte[] bytes = Arrays.copyOfRange(this.bytes, start, end);
-    return new ByteString(bytes, false);
-  }
-
-  /**
-   * Returns a ByteString that starts at a given position.
-   *
-   * @param start Start of range
-   * @return Substring
-   */
-  public ByteString substring(int start) {
-    return substring(start, length());
-  }
-
-  /**
-   * Returns a copy of the byte array.
-   */
-  @JsonValue
-  public byte[] getBytes() {
-    return bytes.clone();
-  }
-
-  /**
-   * Returns a ByteString consisting of the concatenation of this and another
-   * string.
-   *
-   * @param other Byte string to concatenate
-   * @return Combined byte string
-   */
-  public ByteString concat(ByteString other) {
-    int otherLen = other.length();
-    if (otherLen == 0) {
-      return this;
-    }
-    int len = bytes.length;
-    byte[] buf = Arrays.copyOf(bytes, len + otherLen);
-    System.arraycopy(other.bytes, 0, buf, len, other.bytes.length);
-    return new ByteString(buf, false);
-  }
-
-  /** Returns the position at which {@code seek} first occurs in this byte
-   * string, or -1 if it does not occur. */
-  public int indexOf(ByteString seek) {
-    return indexOf(seek, 0);
-  }
-
-  /** Returns the position at which {@code seek} first occurs in this byte
-   * string, starting at the specified index, or -1 if it does not occur. */
-  public int indexOf(ByteString seek, int start) {
-  iLoop:
-    for (int i = start; i < bytes.length - seek.bytes.length + 1; i++) {
-      for (int j = 0;; j++) {
-        if (j == seek.bytes.length) {
-          return i;
-        }
-        if (bytes[i + j] != seek.bytes[j]) {
-          continue iLoop;
-        }
-      }
-    }
-    return -1;
-  }
-}
-
-// End ByteString.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/util/Casing.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/util/Casing.java b/avatica/core/src/main/java/org/apache/calcite/avatica/util/Casing.java
deleted file mode 100644
index 5f13214..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/util/Casing.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.util;
-
-/** Policy for converting case of identifiers before storing them.
- *
- * <p>A database often has policies for quoted versus unquoted identifiers.
- * For example, Oracle converts unquoted identifiers to upper-case, but
- * quoted identifiers are unchanged.</p> */
-public enum Casing {
-  /** The case of identifiers is not changed. */
-  UNCHANGED,
-
-  /** Identifiers are converted to upper-case. */
-  TO_UPPER,
-
-  /** Identifiers are converted to lower-case. */
-  TO_LOWER
-}
-
-// End Casing.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/util/Cursor.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/util/Cursor.java b/avatica/core/src/main/java/org/apache/calcite/avatica/util/Cursor.java
deleted file mode 100644
index 8eab72f..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/util/Cursor.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.util;
-
-import org.apache.calcite.avatica.ColumnMetaData;
-
-import java.io.InputStream;
-import java.io.Reader;
-import java.math.BigDecimal;
-import java.net.URL;
-import java.sql.Array;
-import java.sql.Blob;
-import java.sql.Clob;
-import java.sql.Date;
-import java.sql.NClob;
-import java.sql.Ref;
-import java.sql.SQLException;
-import java.sql.SQLXML;
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.util.Calendar;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Interface to an iteration that is similar to, and can easily support,
- * a JDBC {@link java.sql.ResultSet}, but is simpler to implement.
- */
-public interface Cursor extends AutoCloseable {
-  /**
-   * Creates a list of accessors, one per column.
-   *
-   *
-   * @param types List of column types, per {@link java.sql.Types}.
-   * @param localCalendar Calendar in local time zone
-   * @param factory Factory that creates sub-ResultSets when needed
-   * @return List of column accessors
-   */
-  List<Accessor> createAccessors(List<ColumnMetaData> types,
-      Calendar localCalendar, ArrayImpl.Factory factory);
-
-  /**
-   * Moves to the next row.
-   *
-   * @return Whether moved
-   *
-   * @throws SQLException on database error
-   */
-  boolean next() throws SQLException;
-
-  /**
-   * Closes this cursor and releases resources.
-   */
-  void close();
-
-  /**
-   * Returns whether the last value returned was null.
-   *
-   * @throws SQLException on database error
-   */
-  boolean wasNull() throws SQLException;
-
-  /**
-   * Accessor of a column value.
-   */
-  public interface Accessor {
-    boolean wasNull() throws SQLException;
-
-    String getString() throws SQLException;
-
-    boolean getBoolean() throws SQLException;
-
-    byte getByte() throws SQLException;
-
-    short getShort() throws SQLException;
-
-    int getInt() throws SQLException;
-
-    long getLong() throws SQLException;
-
-    float getFloat() throws SQLException;
-
-    double getDouble() throws SQLException;
-
-    BigDecimal getBigDecimal() throws SQLException;
-
-    BigDecimal getBigDecimal(int scale) throws SQLException;
-
-    byte[] getBytes() throws SQLException;
-
-    InputStream getAsciiStream() throws SQLException;
-
-    InputStream getUnicodeStream() throws SQLException;
-
-    InputStream getBinaryStream() throws SQLException;
-
-    Object getObject() throws SQLException;
-
-    Reader getCharacterStream() throws SQLException;
-
-    Object getObject(Map<String, Class<?>> map) throws SQLException;
-
-    Ref getRef() throws SQLException;
-
-    Blob getBlob() throws SQLException;
-
-    Clob getClob() throws SQLException;
-
-    Array getArray() throws SQLException;
-
-    Date getDate(Calendar calendar) throws SQLException;
-
-    Time getTime(Calendar calendar) throws SQLException;
-
-    Timestamp getTimestamp(Calendar calendar) throws SQLException;
-
-    URL getURL() throws SQLException;
-
-    NClob getNClob() throws SQLException;
-
-    SQLXML getSQLXML() throws SQLException;
-
-    String getNString() throws SQLException;
-
-    Reader getNCharacterStream() throws SQLException;
-
-    <T> T getObject(Class<T> type) throws SQLException;
-  }
-}
-
-// End Cursor.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/util/DateTimeUtils.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/util/DateTimeUtils.java b/avatica/core/src/main/java/org/apache/calcite/avatica/util/DateTimeUtils.java
deleted file mode 100644
index 406dcfd..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/util/DateTimeUtils.java
+++ /dev/null
@@ -1,1034 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.util;
-
-import java.text.NumberFormat;
-import java.text.ParsePosition;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Locale;
-import java.util.TimeZone;
-
-/**
- * Utility functions for datetime types: date, time, timestamp.
- *
- * <p>Used by the JDBC driver.
- *
- * <p>TODO: review methods for performance. Due to allocations required, it may
- * be preferable to introduce a "formatter" with the required state.
- */
-public class DateTimeUtils {
-  /** The julian date of the epoch, 1970-01-01. */
-  public static final int EPOCH_JULIAN = 2440588;
-
-  private DateTimeUtils() {}
-
-  //~ Static fields/initializers ---------------------------------------------
-
-  /** The SimpleDateFormat string for ISO dates, "yyyy-MM-dd". */
-  public static final String DATE_FORMAT_STRING = "yyyy-MM-dd";
-
-  /** The SimpleDateFormat string for ISO times, "HH:mm:ss". */
-  public static final String TIME_FORMAT_STRING = "HH:mm:ss";
-
-  /** The SimpleDateFormat string for ISO timestamps, "yyyy-MM-dd HH:mm:ss". */
-  public static final String TIMESTAMP_FORMAT_STRING =
-      DATE_FORMAT_STRING + " " + TIME_FORMAT_STRING;
-
-  /** The GMT time zone.
-   *
-   * @deprecated Use {@link #UTC_ZONE} */
-  @Deprecated // to be removed before 2.0
-  public static final TimeZone GMT_ZONE = TimeZone.getTimeZone("GMT");
-
-  /** The UTC time zone. */
-  public static final TimeZone UTC_ZONE = TimeZone.getTimeZone("UTC");
-
-  /** The Java default time zone. */
-  public static final TimeZone DEFAULT_ZONE = TimeZone.getDefault();
-
-  /**
-   * The number of milliseconds in a second.
-   */
-  public static final long MILLIS_PER_SECOND = 1000L;
-
-  /**
-   * The number of milliseconds in a minute.
-   */
-  public static final long MILLIS_PER_MINUTE = 60000L;
-
-  /**
-   * The number of milliseconds in an hour.
-   */
-  public static final long MILLIS_PER_HOUR = 3600000L; // = 60 * 60 * 1000
-
-  /**
-   * The number of milliseconds in a day.
-   *
-   * <p>This is the modulo 'mask' used when converting
-   * TIMESTAMP values to DATE and TIME values.
-   */
-  public static final long MILLIS_PER_DAY = 86400000; // = 24 * 60 * 60 * 1000
-
-  /**
-   * Calendar set to the epoch (1970-01-01 00:00:00 UTC). Useful for
-   * initializing other values. Calendars are not immutable, so be careful not
-   * to screw up this object for everyone else.
-   */
-  public static final Calendar ZERO_CALENDAR;
-
-  static {
-    ZERO_CALENDAR = Calendar.getInstance(DateTimeUtils.GMT_ZONE, Locale.ROOT);
-    ZERO_CALENDAR.setTimeInMillis(0);
-  }
-
-  //~ Methods ----------------------------------------------------------------
-
-  /**
-   * Parses a string using {@link SimpleDateFormat} and a given pattern. This
-   * method parses a string at the specified parse position and if successful,
-   * updates the parse position to the index after the last character used.
-   * The parsing is strict and requires months to be less than 12, days to be
-   * less than 31, etc.
-   *
-   * @param s       string to be parsed
-   * @param pattern {@link SimpleDateFormat} pattern (not null)
-   * @param tz      time zone in which to interpret string. Defaults to the Java
-   *                default time zone
-   * @param pp      position to start parsing from
-   * @return a Calendar initialized with the parsed value, or null if parsing
-   * failed. If returned, the Calendar is configured to the GMT time zone.
-   */
-  private static Calendar parseDateFormat(
-      String s,
-      String pattern,
-      TimeZone tz,
-      ParsePosition pp) {
-    assert pattern != null;
-    SimpleDateFormat df = new SimpleDateFormat(pattern, Locale.ROOT);
-    if (tz == null) {
-      tz = DEFAULT_ZONE;
-    }
-    Calendar ret = Calendar.getInstance(tz, Locale.ROOT);
-    df.setCalendar(ret);
-    df.setLenient(false);
-
-    java.util.Date d = df.parse(s, pp);
-    if (null == d) {
-      return null;
-    }
-    ret.setTime(d);
-    ret.setTimeZone(GMT_ZONE);
-    return ret;
-  }
-
-  /**
-   * Parses a string using {@link SimpleDateFormat} and a given pattern. The
-   * entire string must match the pattern specified.
-   *
-   * @param s       string to be parsed
-   * @param pattern {@link SimpleDateFormat}  pattern
-   * @param tz      time zone in which to interpret string. Defaults to the Java
-   *                default time zone
-   * @return a Calendar initialized with the parsed value, or null if parsing
-   * failed. If returned, the Calendar is configured to the GMT time zone.
-   */
-  public static Calendar parseDateFormat(
-      String s,
-      String pattern,
-      TimeZone tz) {
-    assert pattern != null;
-    ParsePosition pp = new ParsePosition(0);
-    Calendar ret = parseDateFormat(s, pattern, tz, pp);
-    if (pp.getIndex() != s.length()) {
-      // Didn't consume entire string - not good
-      return null;
-    }
-    return ret;
-  }
-
-  /**
-   * Parses a string using {@link SimpleDateFormat} and a given pattern, and
-   * if present, parses a fractional seconds component. The fractional seconds
-   * component must begin with a decimal point ('.') followed by numeric
-   * digits. The precision is rounded to a maximum of 3 digits of fractional
-   * seconds precision (to obtain milliseconds).
-   *
-   * @param s       string to be parsed
-   * @param pattern {@link SimpleDateFormat}  pattern
-   * @param tz      time zone in which to interpret string. Defaults to the
-   *                local time zone
-   * @return a {@link DateTimeUtils.PrecisionTime PrecisionTime} initialized
-   * with the parsed value, or null if parsing failed. The PrecisionTime
-   * contains a GMT Calendar and a precision.
-   */
-  public static PrecisionTime parsePrecisionDateTimeLiteral(
-      String s,
-      String pattern,
-      TimeZone tz) {
-    assert pattern != null;
-    ParsePosition pp = new ParsePosition(0);
-    Calendar cal = parseDateFormat(s, pattern, tz, pp);
-    if (cal == null) {
-      return null; // Invalid date/time format
-    }
-
-    // Note: the Java SimpleDateFormat 'S' treats any number after
-    // the decimal as milliseconds. That means 12:00:00.9 has 9
-    // milliseconds and 12:00:00.9999 has 9999 milliseconds.
-    int p = 0;
-    if (pp.getIndex() < s.length()) {
-      // Check to see if rest is decimal portion
-      if (s.charAt(pp.getIndex()) != '.') {
-        return null;
-      }
-
-      // Skip decimal sign
-      pp.setIndex(pp.getIndex() + 1);
-
-      // Parse decimal portion
-      if (pp.getIndex() < s.length()) {
-        String secFraction = s.substring(pp.getIndex());
-        if (!secFraction.matches("\\d+")) {
-          return null;
-        }
-        NumberFormat nf = NumberFormat.getIntegerInstance(Locale.ROOT);
-        Number num = nf.parse(s, pp);
-        if ((num == null) || (pp.getIndex() != s.length())) {
-          // Invalid decimal portion
-          return null;
-        }
-
-        // Determine precision - only support prec 3 or lower
-        // (milliseconds) Higher precisions are quietly rounded away
-        p = Math.min(
-            3,
-            secFraction.length());
-
-        // Calculate milliseconds
-        int ms =
-            (int) Math.round(
-                num.longValue()
-                * Math.pow(10, 3 - secFraction.length()));
-        cal.add(Calendar.MILLISECOND, ms);
-      }
-    }
-
-    assert pp.getIndex() == s.length();
-    PrecisionTime ret = new PrecisionTime(cal, p);
-    return ret;
-  }
-
-  /**
-   * Gets the active time zone based on a Calendar argument
-   */
-  public static TimeZone getTimeZone(Calendar cal) {
-    if (cal == null) {
-      return DEFAULT_ZONE;
-    }
-    return cal.getTimeZone();
-  }
-
-  /**
-   * Checks if the date/time format is valid
-   *
-   * @param pattern {@link SimpleDateFormat}  pattern
-   * @throws IllegalArgumentException if the given pattern is invalid
-   */
-  public static void checkDateFormat(String pattern) {
-    new SimpleDateFormat(pattern, Locale.ROOT);
-  }
-
-  /**
-   * Creates a new date formatter with Farrago specific options. Farrago
-   * parsing is strict and does not allow values such as day 0, month 13, etc.
-   *
-   * @param format {@link SimpleDateFormat}  pattern
-   */
-  public static SimpleDateFormat newDateFormat(String format) {
-    SimpleDateFormat sdf = new SimpleDateFormat(format, Locale.ROOT);
-    sdf.setLenient(false);
-    return sdf;
-  }
-
-  /** Helper for CAST({timestamp} AS VARCHAR(n)). */
-  public static String unixTimestampToString(long timestamp) {
-    return unixTimestampToString(timestamp, 0);
-  }
-
-  public static String unixTimestampToString(long timestamp, int precision) {
-    final StringBuilder buf = new StringBuilder(17);
-    int date = (int) (timestamp / MILLIS_PER_DAY);
-    int time = (int) (timestamp % MILLIS_PER_DAY);
-    if (time < 0) {
-      --date;
-      time += MILLIS_PER_DAY;
-    }
-    unixDateToString(buf, date);
-    buf.append(' ');
-    unixTimeToString(buf, time, precision);
-    return buf.toString();
-  }
-
-  /** Helper for CAST({timestamp} AS VARCHAR(n)). */
-  public static String unixTimeToString(int time) {
-    return unixTimeToString(time, 0);
-  }
-
-  public static String unixTimeToString(int time, int precision) {
-    final StringBuilder buf = new StringBuilder(8);
-    unixTimeToString(buf, time, precision);
-    return buf.toString();
-  }
-
-  private static void unixTimeToString(StringBuilder buf, int time,
-      int precision) {
-    int h = time / 3600000;
-    int time2 = time % 3600000;
-    int m = time2 / 60000;
-    int time3 = time2 % 60000;
-    int s = time3 / 1000;
-    int ms = time3 % 1000;
-    int2(buf, h);
-    buf.append(':');
-    int2(buf, m);
-    buf.append(':');
-    int2(buf, s);
-    if (precision > 0) {
-      buf.append('.');
-      while (precision > 0) {
-        buf.append((char) ('0' + (ms / 100)));
-        ms = ms % 100;
-        ms = ms * 10;
-        --precision;
-      }
-    }
-  }
-
-  private static void int2(StringBuilder buf, int i) {
-    buf.append((char) ('0' + (i / 10) % 10));
-    buf.append((char) ('0' + i % 10));
-  }
-
-  private static void int4(StringBuilder buf, int i) {
-    buf.append((char) ('0' + (i / 1000) % 10));
-    buf.append((char) ('0' + (i / 100) % 10));
-    buf.append((char) ('0' + (i / 10) % 10));
-    buf.append((char) ('0' + i % 10));
-  }
-
-  /** Helper for CAST({date} AS VARCHAR(n)). */
-  public static String unixDateToString(int date) {
-    final StringBuilder buf = new StringBuilder(10);
-    unixDateToString(buf, date);
-    return buf.toString();
-  }
-
-  private static void unixDateToString(StringBuilder buf, int date) {
-    julianToString(buf, date + EPOCH_JULIAN);
-  }
-
-  private static void julianToString(StringBuilder buf, int julian) {
-    // this shifts the epoch back to astronomical year -4800 instead of the
-    // start of the Christian era in year AD 1 of the proleptic Gregorian
-    // calendar.
-    int j = julian + 32044;
-    int g = j / 146097;
-    int dg = j % 146097;
-    int c = (dg / 36524 + 1) * 3 / 4;
-    int dc = dg - c * 36524;
-    int b = dc / 1461;
-    int db = dc % 1461;
-    int a = (db / 365 + 1) * 3 / 4;
-    int da = db - a * 365;
-
-    // integer number of full years elapsed since March 1, 4801 BC
-    int y = g * 400 + c * 100 + b * 4 + a;
-    // integer number of full months elapsed since the last March 1
-    int m = (da * 5 + 308) / 153 - 2;
-    // number of days elapsed since day 1 of the month
-    int d = da - (m + 4) * 153 / 5 + 122;
-    int year = y - 4800 + (m + 2) / 12;
-    int month = (m + 2) % 12 + 1;
-    int day = d + 1;
-    int4(buf, year);
-    buf.append('-');
-    int2(buf, month);
-    buf.append('-');
-    int2(buf, day);
-  }
-
-  public static String intervalYearMonthToString(int v, TimeUnitRange range) {
-    final StringBuilder buf = new StringBuilder();
-    if (v >= 0) {
-      buf.append('+');
-    } else {
-      buf.append('-');
-      v = -v;
-    }
-    final int y;
-    final int m;
-    switch (range) {
-    case YEAR:
-      v = roundUp(v, 12);
-      y = v / 12;
-      buf.append(y);
-      break;
-    case YEAR_TO_MONTH:
-      y = v / 12;
-      buf.append(y);
-      buf.append('-');
-      m = v % 12;
-      number(buf, m, 2);
-      break;
-    case MONTH:
-      m = v;
-      buf.append(m);
-      break;
-    default:
-      throw new AssertionError(range);
-    }
-    return buf.toString();
-  }
-
-  public static StringBuilder number(StringBuilder buf, int v, int n) {
-    for (int k = digitCount(v); k < n; k++) {
-      buf.append('0');
-    }
-    return buf.append(v);
-  }
-
-  public static int digitCount(int v) {
-    for (int n = 1;; n++) {
-      v /= 10;
-      if (v == 0) {
-        return n;
-      }
-    }
-  }
-
-  private static int roundUp(int dividend, int divisor) {
-    int remainder = dividend % divisor;
-    dividend -= remainder;
-    if (remainder * 2 > divisor) {
-      dividend += divisor;
-    }
-    return dividend;
-  }
-
-  /** Cheap, unsafe, long power. power(2, 3) returns 8. */
-  public static long powerX(long a, long b) {
-    long x = 1;
-    while (b > 0) {
-      x *= a;
-      --b;
-    }
-    return x;
-  }
-
-  public static String intervalDayTimeToString(long v, TimeUnitRange range,
-      int scale) {
-    final StringBuilder buf = new StringBuilder();
-    if (v >= 0) {
-      buf.append('+');
-    } else {
-      buf.append('-');
-      v = -v;
-    }
-    final long ms;
-    final long s;
-    final long m;
-    final long h;
-    final long d;
-    switch (range) {
-    case DAY_TO_SECOND:
-      v = roundUp(v, powerX(10, 3 - scale));
-      ms = v % 1000;
-      v /= 1000;
-      s = v % 60;
-      v /= 60;
-      m = v % 60;
-      v /= 60;
-      h = v % 24;
-      v /= 24;
-      d = v;
-      buf.append((int) d);
-      buf.append(' ');
-      number(buf, (int) h, 2);
-      buf.append(':');
-      number(buf, (int) m, 2);
-      buf.append(':');
-      number(buf, (int) s, 2);
-      fraction(buf, scale, ms);
-      break;
-    case DAY_TO_MINUTE:
-      v = roundUp(v, 1000 * 60);
-      v /= 1000;
-      v /= 60;
-      m = v % 60;
-      v /= 60;
-      h = v % 24;
-      v /= 24;
-      d = v;
-      buf.append((int) d);
-      buf.append(' ');
-      number(buf, (int) h, 2);
-      buf.append(':');
-      number(buf, (int) m, 2);
-      break;
-    case DAY_TO_HOUR:
-      v = roundUp(v, 1000 * 60 * 60);
-      v /= 1000;
-      v /= 60;
-      v /= 60;
-      h = v % 24;
-      v /= 24;
-      d = v;
-      buf.append((int) d);
-      buf.append(' ');
-      number(buf, (int) h, 2);
-      break;
-    case DAY:
-      v = roundUp(v, 1000 * 60 * 60 * 24);
-      d = v / (1000 * 60 * 60 * 24);
-      buf.append((int) d);
-      break;
-    case HOUR:
-      v = roundUp(v, 1000 * 60 * 60);
-      v /= 1000;
-      v /= 60;
-      v /= 60;
-      h = v;
-      buf.append((int) h);
-      break;
-    case HOUR_TO_MINUTE:
-      v = roundUp(v, 1000 * 60);
-      v /= 1000;
-      v /= 60;
-      m = v % 60;
-      v /= 60;
-      h = v;
-      buf.append((int) h);
-      buf.append(':');
-      number(buf, (int) m, 2);
-      break;
-    case HOUR_TO_SECOND:
-      v = roundUp(v, powerX(10, 3 - scale));
-      ms = v % 1000;
-      v /= 1000;
-      s = v % 60;
-      v /= 60;
-      m = v % 60;
-      v /= 60;
-      h = v;
-      buf.append((int) h);
-      buf.append(':');
-      number(buf, (int) m, 2);
-      buf.append(':');
-      number(buf, (int) s, 2);
-      fraction(buf, scale, ms);
-      break;
-    case MINUTE_TO_SECOND:
-      v = roundUp(v, powerX(10, 3 - scale));
-      ms = v % 1000;
-      v /= 1000;
-      s = v % 60;
-      v /= 60;
-      m = v;
-      buf.append((int) m);
-      buf.append(':');
-      number(buf, (int) s, 2);
-      fraction(buf, scale, ms);
-      break;
-    case MINUTE:
-      v = roundUp(v, 1000 * 60);
-      v /= 1000;
-      v /= 60;
-      m = v;
-      buf.append((int) m);
-      break;
-    case SECOND:
-      v = roundUp(v, powerX(10, 3 - scale));
-      ms = v % 1000;
-      v /= 1000;
-      s = v;
-      buf.append((int) s);
-      fraction(buf, scale, ms);
-      break;
-    default:
-      throw new AssertionError(range);
-    }
-    return buf.toString();
-  }
-
-  /**
-   * Rounds a dividend to the nearest divisor.
-   * For example roundUp(31, 10) yields 30; roundUp(37, 10) yields 40.
-   * @param dividend Number to be divided
-   * @param divisor Number to divide by
-   * @return Rounded dividend
-   */
-  private static long roundUp(long dividend, long divisor) {
-    long remainder = dividend % divisor;
-    dividend -= remainder;
-    if (remainder * 2 > divisor) {
-      dividend += divisor;
-    }
-    return dividend;
-  }
-
-  private static void fraction(StringBuilder buf, int scale, long ms) {
-    if (scale > 0) {
-      buf.append('.');
-      long v1 = scale == 3 ? ms
-          : scale == 2 ? ms / 10
-          : scale == 1 ? ms / 100
-            : 0;
-      number(buf, (int) v1, scale);
-    }
-  }
-
-  public static int dateStringToUnixDate(String s) {
-    int hyphen1 = s.indexOf('-');
-    int y;
-    int m;
-    int d;
-    if (hyphen1 < 0) {
-      y = Integer.parseInt(s.trim());
-      m = 1;
-      d = 1;
-    } else {
-      y = Integer.parseInt(s.substring(0, hyphen1).trim());
-      final int hyphen2 = s.indexOf('-', hyphen1 + 1);
-      if (hyphen2 < 0) {
-        m = Integer.parseInt(s.substring(hyphen1 + 1).trim());
-        d = 1;
-      } else {
-        m = Integer.parseInt(s.substring(hyphen1 + 1, hyphen2).trim());
-        d = Integer.parseInt(s.substring(hyphen2 + 1).trim());
-      }
-    }
-    return ymdToUnixDate(y, m, d);
-  }
-
-  public static int timeStringToUnixDate(String v) {
-    return timeStringToUnixDate(v, 0);
-  }
-
-  public static int timeStringToUnixDate(String v, int start) {
-    final int colon1 = v.indexOf(':', start);
-    int hour;
-    int minute;
-    int second;
-    int milli;
-    if (colon1 < 0) {
-      hour = Integer.parseInt(v.trim());
-      minute = 1;
-      second = 1;
-      milli = 0;
-    } else {
-      hour = Integer.parseInt(v.substring(start, colon1).trim());
-      final int colon2 = v.indexOf(':', colon1 + 1);
-      if (colon2 < 0) {
-        minute = Integer.parseInt(v.substring(colon1 + 1).trim());
-        second = 1;
-        milli = 0;
-      } else {
-        minute = Integer.parseInt(v.substring(colon1 + 1, colon2).trim());
-        int dot = v.indexOf('.', colon2);
-        if (dot < 0) {
-          second = Integer.parseInt(v.substring(colon2 + 1).trim());
-          milli = 0;
-        } else {
-          second = Integer.parseInt(v.substring(colon2 + 1, dot).trim());
-          milli = parseFraction(v.substring(dot + 1).trim(), 100);
-        }
-      }
-    }
-    return hour * (int) MILLIS_PER_HOUR
-        + minute * (int) MILLIS_PER_MINUTE
-        + second * (int) MILLIS_PER_SECOND
-        + milli;
-  }
-
-  /** Parses a fraction, multiplying the first character by {@code multiplier},
-   * the second character by {@code multiplier / 10},
-   * the third character by {@code multiplier / 100}, and so forth.
-   *
-   * <p>For example, {@code parseFraction("1234", 100)} yields {@code 123}. */
-  private static int parseFraction(String v, int multiplier) {
-    int r = 0;
-    for (int i = 0; i < v.length(); i++) {
-      char c = v.charAt(i);
-      int x = c < '0' || c > '9' ? 0 : (c - '0');
-      r += multiplier * x;
-      if (multiplier < 10) {
-        // We're at the last digit. Check for rounding.
-        if (i + 1 < v.length()
-            && v.charAt(i + 1) >= '5') {
-          ++r;
-        }
-        break;
-      }
-      multiplier /= 10;
-    }
-    return r;
-  }
-
-  public static long timestampStringToUnixDate(String s) {
-    final long d;
-    final long t;
-    s = s.trim();
-    int space = s.indexOf(' ');
-    if (space >= 0) {
-      d = dateStringToUnixDate(s.substring(0, space));
-      t = timeStringToUnixDate(s, space + 1);
-    } else {
-      d = dateStringToUnixDate(s);
-      t = 0;
-    }
-    return d * MILLIS_PER_DAY + t;
-  }
-
-  public static long unixDateExtract(TimeUnitRange range, long date) {
-    return julianExtract(range, (int) date + EPOCH_JULIAN);
-  }
-
-  private static int julianExtract(TimeUnitRange range, int julian) {
-    // this shifts the epoch back to astronomical year -4800 instead of the
-    // start of the Christian era in year AD 1 of the proleptic Gregorian
-    // calendar.
-    int j = julian + 32044;
-    int g = j / 146097;
-    int dg = j % 146097;
-    int c = (dg / 36524 + 1) * 3 / 4;
-    int dc = dg - c * 36524;
-    int b = dc / 1461;
-    int db = dc % 1461;
-    int a = (db / 365 + 1) * 3 / 4;
-    int da = db - a * 365;
-
-    // integer number of full years elapsed since March 1, 4801 BC
-    int y = g * 400 + c * 100 + b * 4 + a;
-    // integer number of full months elapsed since the last March 1
-    int m = (da * 5 + 308) / 153 - 2;
-    // number of days elapsed since day 1 of the month
-    int d = da - (m + 4) * 153 / 5 + 122;
-    int year = y - 4800 + (m + 2) / 12;
-    int month = (m + 2) % 12 + 1;
-    int day = d + 1;
-    switch (range) {
-    case YEAR:
-      return year;
-    case QUARTER:
-      return (month + 2) / 3;
-    case MONTH:
-      return month;
-    case DAY:
-      return day;
-    case DOW:
-      return (int) floorMod(julian + 1, 7) + 1; // sun=1, sat=7
-    case WEEK:
-      long fmofw = firstMondayOfFirstWeek(year);
-      if (julian < fmofw) {
-        fmofw = firstMondayOfFirstWeek(year - 1);
-      }
-      return (int) (julian - fmofw) / 7 + 1;
-    case DOY:
-      final long janFirst = ymdToJulian(year, 1, 1);
-      return (int) (julian - janFirst) + 1;
-    case CENTURY:
-      return year > 0
-          ? (year + 99) / 100
-          : (year - 99) / 100;
-    case MILLENNIUM:
-      return year > 0
-          ? (year + 999) / 1000
-          : (year - 999) / 1000;
-    default:
-      throw new AssertionError(range);
-    }
-  }
-
-  /** Returns the first day of the first week of a year.
-   * Per ISO-8601 it is the Monday of the week that contains Jan 4,
-   * or equivalently, it is a Monday between Dec 29 and Jan 4.
-   * Sometimes it is in the year before the given year. */
-  private static long firstMondayOfFirstWeek(int year) {
-    final long janFirst = ymdToJulian(year, 1, 1);
-    final long janFirstDow = floorMod(janFirst + 1, 7); // sun=0, sat=6
-    return janFirst + (11 - janFirstDow) % 7 - 3;
-  }
-
-  /** Extracts a time unit from a UNIX date (milliseconds since epoch). */
-  public static int unixTimestampExtract(TimeUnitRange range,
-      long timestamp) {
-    return unixTimeExtract(range, (int) floorMod(timestamp, MILLIS_PER_DAY));
-  }
-
-  /** Extracts a time unit from a time value (milliseconds since midnight). */
-  public static int unixTimeExtract(TimeUnitRange range, int time) {
-    assert time >= 0;
-    assert time < MILLIS_PER_DAY;
-    switch (range) {
-    case HOUR:
-      return time / (int) MILLIS_PER_HOUR;
-    case MINUTE:
-      final int minutes = time / (int) MILLIS_PER_MINUTE;
-      return minutes % 60;
-    case SECOND:
-      final int seconds = time / (int) MILLIS_PER_SECOND;
-      return seconds % 60;
-    default:
-      throw new AssertionError(range);
-    }
-  }
-
-  /** Resets to zero the "time" part of a timestamp. */
-  public static long resetTime(long timestamp) {
-    int date = (int) (timestamp / MILLIS_PER_DAY);
-    return (long) date * MILLIS_PER_DAY;
-  }
-
-  /** Resets to epoch (1970-01-01) the "date" part of a timestamp. */
-  public static long resetDate(long timestamp) {
-    return floorMod(timestamp, MILLIS_PER_DAY);
-  }
-
-  public static long unixTimestampFloor(TimeUnitRange range, long timestamp) {
-    int date = (int) (timestamp / MILLIS_PER_DAY);
-    final int f = julianDateFloor(range, date + EPOCH_JULIAN, true);
-    return (long) f * MILLIS_PER_DAY;
-  }
-
-  public static long unixDateFloor(TimeUnitRange range, long date) {
-    return julianDateFloor(range, (int) date + EPOCH_JULIAN, true);
-  }
-
-  public static long unixTimestampCeil(TimeUnitRange range, long timestamp) {
-    int date = (int) (timestamp / MILLIS_PER_DAY);
-    final int f = julianDateFloor(range, date + EPOCH_JULIAN, false);
-    return (long) f * MILLIS_PER_DAY;
-  }
-
-  public static long unixDateCeil(TimeUnitRange range, long date) {
-    return julianDateFloor(range, (int) date + EPOCH_JULIAN, true);
-  }
-
-  private static int julianDateFloor(TimeUnitRange range, int julian,
-      boolean floor) {
-    // this shifts the epoch back to astronomical year -4800 instead of the
-    // start of the Christian era in year AD 1 of the proleptic Gregorian
-    // calendar.
-    int j = julian + 32044;
-    int g = j / 146097;
-    int dg = j % 146097;
-    int c = (dg / 36524 + 1) * 3 / 4;
-    int dc = dg - c * 36524;
-    int b = dc / 1461;
-    int db = dc % 1461;
-    int a = (db / 365 + 1) * 3 / 4;
-    int da = db - a * 365;
-
-    // integer number of full years elapsed since March 1, 4801 BC
-    int y = g * 400 + c * 100 + b * 4 + a;
-    // integer number of full months elapsed since the last March 1
-    int m = (da * 5 + 308) / 153 - 2;
-    // number of days elapsed since day 1 of the month
-    int d = da - (m + 4) * 153 / 5 + 122;
-    int year = y - 4800 + (m + 2) / 12;
-    int month = (m + 2) % 12 + 1;
-    int day = d + 1;
-    switch (range) {
-    case YEAR:
-      if (!floor && (month > 1 || day > 1)) {
-        ++year;
-      }
-      return ymdToUnixDate(year, 1, 1);
-    case MONTH:
-      if (!floor && day > 1) {
-        ++month;
-      }
-      return ymdToUnixDate(year, month, 1);
-    default:
-      throw new AssertionError(range);
-    }
-  }
-
-  public static int ymdToUnixDate(int year, int month, int day) {
-    final int julian = ymdToJulian(year, month, day);
-    return julian - EPOCH_JULIAN;
-  }
-
-  public static int ymdToJulian(int year, int month, int day) {
-    int a = (14 - month) / 12;
-    int y = year + 4800 - a;
-    int m = month + 12 * a - 3;
-    int j = day + (153 * m + 2) / 5
-        + 365 * y
-        + y / 4
-        - y / 100
-        + y / 400
-        - 32045;
-    if (j < 2299161) {
-      j = day + (153 * m + 2) / 5 + 365 * y + y / 4 - 32083;
-    }
-    return j;
-  }
-
-  public static long unixTimestamp(int year, int month, int day, int hour,
-      int minute, int second) {
-    final int date = ymdToUnixDate(year, month, day);
-    return (long) date * MILLIS_PER_DAY
-        + (long) hour * MILLIS_PER_HOUR
-        + (long) minute * MILLIS_PER_MINUTE
-        + (long) second * MILLIS_PER_SECOND;
-  }
-
-  /** Adds a given number of months to a timestamp, represented as the number
-   * of milliseconds since the epoch. */
-  public static long addMonths(long timestamp, int m) {
-    final long millis =
-        DateTimeUtils.floorMod(timestamp, DateTimeUtils.MILLIS_PER_DAY);
-    timestamp -= millis;
-    final long x =
-        addMonths((int) (timestamp / DateTimeUtils.MILLIS_PER_DAY), m);
-    return x * DateTimeUtils.MILLIS_PER_DAY + millis;
-  }
-
-  /** Adds a given number of months to a date, represented as the number of
-   * days since the epoch. */
-  public static int addMonths(int date, int m) {
-    int y0 = (int) DateTimeUtils.unixDateExtract(TimeUnitRange.YEAR, date);
-    int m0 = (int) DateTimeUtils.unixDateExtract(TimeUnitRange.MONTH, date);
-    int d0 = (int) DateTimeUtils.unixDateExtract(TimeUnitRange.DAY, date);
-    int y = m / 12;
-    y0 += y;
-    m0 += m - y * 12;
-    int last = lastDay(y0, m0);
-    if (d0 > last) {
-      d0 = 1;
-      if (++m0 > 12) {
-        m0 = 1;
-        ++y0;
-      }
-    }
-    return DateTimeUtils.ymdToUnixDate(y0, m0, d0);
-  }
-
-  private static int lastDay(int y, int m) {
-    switch (m) {
-    case 2:
-      return y % 4 == 0
-          && (y % 100 != 0
-          || y % 400 == 0)
-          ? 29 : 28;
-    case 4:
-    case 6:
-    case 9:
-    case 11:
-      return 30;
-    default:
-      return 31;
-    }
-  }
-
-  /** Finds the number of months between two dates, each represented as the
-   * number of days since the epoch. */
-  public static int subtractMonths(int date0, int date1) {
-    if (date0 < date1) {
-      return -subtractMonths(date1, date0);
-    }
-    // Start with an estimate.
-    // Since no month has more than 31 days, the estimate is <= the true value.
-    int m = (date0 - date1) / 31;
-    for (;;) {
-      int date2 = addMonths(date1, m);
-      if (date2 >= date0) {
-        return m;
-      }
-      int date3 = addMonths(date1, m + 1);
-      if (date3 > date0) {
-        return m;
-      }
-      ++m;
-    }
-  }
-
-  public static int subtractMonths(long t0, long t1) {
-    final long millis0 =
-        DateTimeUtils.floorMod(t0, DateTimeUtils.MILLIS_PER_DAY);
-    final int d0 = (int) DateTimeUtils.floorDiv(t0 - millis0,
-        DateTimeUtils.MILLIS_PER_DAY);
-    final long millis1 =
-        DateTimeUtils.floorMod(t1, DateTimeUtils.MILLIS_PER_DAY);
-    final int d1 = (int) DateTimeUtils.floorDiv(t1 - millis1,
-        DateTimeUtils.MILLIS_PER_DAY);
-    int x = subtractMonths(d0, d1);
-    final long d2 = addMonths(d1, x);
-    if (d2 == d0 && millis0 < millis1) {
-      --x;
-    }
-    return x;
-  }
-
-  /** Divide, rounding towards negative infinity. */
-  public static long floorDiv(long x, long y) {
-    long r = x / y;
-    // if the signs are different and modulo not zero, round down
-    if ((x ^ y) < 0 && (r * y != x)) {
-      r--;
-    }
-    return r;
-  }
-
-  /** Modulo, always returning a non-negative result. */
-  public static long floorMod(long x, long y) {
-    return x - floorDiv(x, y) * y;
-  }
-
-  /** Creates an instance of {@link Calendar} in the root locale and UTC time
-   * zone. */
-  public static Calendar calendar() {
-    return Calendar.getInstance(UTC_ZONE, Locale.ROOT);
-  }
-
-  //~ Inner Classes ----------------------------------------------------------
-
-  /**
-   * Helper class for {@link DateTimeUtils#parsePrecisionDateTimeLiteral}
-   */
-  public static class PrecisionTime {
-    private final Calendar cal;
-    private final int precision;
-
-    public PrecisionTime(Calendar cal, int precision) {
-      this.cal = cal;
-      this.precision = precision;
-    }
-
-    public Calendar getCalendar() {
-      return cal;
-    }
-
-    public int getPrecision() {
-      return precision;
-    }
-  }
-}
-
-// End DateTimeUtils.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/util/IteratorCursor.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/util/IteratorCursor.java b/avatica/core/src/main/java/org/apache/calcite/avatica/util/IteratorCursor.java
deleted file mode 100644
index c09373b..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/util/IteratorCursor.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.util;
-
-import java.util.Iterator;
-import java.util.NoSuchElementException;
-
-/**
- * Implementation of {@link org.apache.calcite.avatica.util.Cursor}
- * on top of an {@link Iterator} that
- * returns a record for each row. The returned record is cached to avoid
- * multiple computations of current row.
- *
- * @param <E> Element type
- */
-public abstract class IteratorCursor<E> extends PositionedCursor<E> {
-  private Position position = Position.BEFORE_START;
-  private final Iterator<E> iterator;
-  private E current = null;
-
-  /**
-   * Creates an {@code IteratorCursor}.
-   *
-   * @param iterator input iterator
-   */
-  protected IteratorCursor(Iterator<E> iterator) {
-    this.iterator = iterator;
-  }
-
-  public boolean next() {
-    if (iterator.hasNext()) {
-      current = iterator.next();
-      position = Position.OK;
-      return true;
-    }
-    current = null;
-    position = Position.AFTER_END;
-    return false;
-  }
-
-  public void close() {
-    current = null;
-    position = Position.CLOSED;
-    if (iterator instanceof AutoCloseable) {
-      try {
-        ((AutoCloseable) iterator).close();
-      } catch (RuntimeException e) {
-        throw e;
-      } catch (Exception e) {
-        throw new RuntimeException(e);
-      }
-    }
-  }
-
-  protected E current() {
-    if (position != Position.OK) {
-      throw new NoSuchElementException();
-    }
-    return current;
-  }
-
-  /** Are we positioned on a valid row? */
-  private enum Position {
-    CLOSED,
-    BEFORE_START,
-    OK,
-    AFTER_END
-  }
-}
-
-// End IteratorCursor.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/util/ListIteratorCursor.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/util/ListIteratorCursor.java b/avatica/core/src/main/java/org/apache/calcite/avatica/util/ListIteratorCursor.java
deleted file mode 100644
index e2801ec..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/util/ListIteratorCursor.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.util;
-
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * Implementation of {@link Cursor} on top of an
- * {@link java.util.Iterator} that
- * returns a {@link List} for each row.
- */
-public class ListIteratorCursor extends IteratorCursor<List<Object>> {
-
-  /**
-   * Creates a RecordEnumeratorCursor.
-   *
-   * @param iterator Iterator
-   */
-  public ListIteratorCursor(Iterator<List<Object>> iterator) {
-    super(iterator);
-  }
-
-  protected Getter createGetter(int ordinal) {
-    return new ListGetter(ordinal);
-  }
-}
-
-// End ListIteratorCursor.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/util/MapIteratorCursor.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/util/MapIteratorCursor.java b/avatica/core/src/main/java/org/apache/calcite/avatica/util/MapIteratorCursor.java
deleted file mode 100644
index 9ab6c9c..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/util/MapIteratorCursor.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.util;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Implementation of {@link Cursor} on top of an
- * {@link java.util.Iterator} that
- * returns a {@link Map} for each row.
- *
- * <p>The Map contains (field, value) pairs.
- */
-public class MapIteratorCursor extends IteratorCursor<Map<String, Object>> {
-  private final List<String> fieldNames;
-
-  /**
-   * Creates a MapIteratorCursor.
-   *
-   * @param iterator Iterator
-   * @param fieldNames Field names to project
-   */
-  public MapIteratorCursor(Iterator<Map<String, Object>> iterator,
-      List<String> fieldNames) {
-    super(iterator);
-    assert fieldNames != null;
-    this.fieldNames = fieldNames;
-  }
-
-  protected Getter createGetter(int ordinal) {
-    return new MapGetter<String>(fieldNames.get(ordinal));
-  }
-}
-
-// End MapIteratorCursor.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/util/PackageMarker.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/util/PackageMarker.java b/avatica/core/src/main/java/org/apache/calcite/avatica/util/PackageMarker.java
deleted file mode 100644
index 3a6a9c6..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/util/PackageMarker.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.util;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * This is a dummy annotation that forces javac to produce output for
- * otherwise empty package-info.java.
- *
- * <p>The result is maven-compiler-plugin can properly identify the scope of
- * changed files
- *
- * <p>See more details in
- * <a href="https://jira.codehaus.org/browse/MCOMPILER-205">
- *   maven-compiler-plugin: incremental compilation broken</a>
- */
-@Retention(RetentionPolicy.SOURCE)
-public @interface PackageMarker {
-}
-
-// End PackageMarker.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/util/PositionedCursor.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/util/PositionedCursor.java b/avatica/core/src/main/java/org/apache/calcite/avatica/util/PositionedCursor.java
deleted file mode 100644
index f60f47d..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/util/PositionedCursor.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.util;
-
-import java.lang.reflect.Field;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Abstract implementation of {@link org.apache.calcite.avatica.util.Cursor}
- * that caches its current row.
- *
- * @param <T> Element type
- */
-public abstract class PositionedCursor<T> extends AbstractCursor {
-  /**
-   * Returns the current row.
-   *
-   * @return current row
-   *
-   * @throws java.util.NoSuchElementException if the iteration has no more
-   * elements
-   */
-  protected abstract T current();
-
-  /** Implementation of
-   * {@link org.apache.calcite.avatica.util.AbstractCursor.Getter}
-   * that reads from records that are arrays. */
-  protected class ArrayGetter extends AbstractGetter {
-    protected final int field;
-
-    public ArrayGetter(int field) {
-      this.field = field;
-    }
-
-    public Object getObject() {
-      Object o = ((Object[]) current())[field];
-      wasNull[0] = o == null;
-      return o;
-    }
-  }
-
-  /** Implementation of
-   * {@link org.apache.calcite.avatica.util.AbstractCursor.Getter}
-   * that reads items from a list. */
-  protected class ListGetter extends AbstractGetter {
-    protected final int index;
-
-    public ListGetter(int index) {
-      this.index = index;
-    }
-
-    public Object getObject() {
-      Object o = ((List) current()).get(index);
-      wasNull[0] = o == null;
-      return o;
-    }
-  }
-
-  /** Implementation of
-   * {@link org.apache.calcite.avatica.util.AbstractCursor.Getter}
-   * for records that consist of a single field.
-   *
-   * <p>Each record is represented as an object, and the value of the sole
-   * field is that object. */
-  protected class ObjectGetter extends AbstractGetter {
-    public ObjectGetter(int field) {
-      assert field == 0;
-    }
-
-    public Object getObject() {
-      Object o = current();
-      wasNull[0] = o == null;
-      return o;
-    }
-  }
-
-  /** Implementation of
-   * {@link org.apache.calcite.avatica.util.AbstractCursor.Getter}
-   * that reads fields via reflection. */
-  protected class FieldGetter extends AbstractGetter {
-    protected final Field field;
-
-    public FieldGetter(Field field) {
-      this.field = field;
-    }
-
-    public Object getObject() {
-      Object o;
-      try {
-        o = field.get(current());
-      } catch (IllegalAccessException e) {
-        throw new RuntimeException(e);
-      }
-      wasNull[0] = o == null;
-      return o;
-    }
-  }
-
-  /** Implementation of
-   * {@link org.apache.calcite.avatica.util.AbstractCursor.Getter}
-   * that reads entries from a {@link java.util.Map}. */
-  protected class MapGetter<K> extends AbstractGetter {
-    protected final K key;
-
-    public MapGetter(K key) {
-      this.key = key;
-    }
-
-    public Object getObject() {
-      @SuppressWarnings("unchecked") final Map<K, Object> map =
-          (Map<K, Object>) current();
-      Object o = map.get(key);
-      wasNull[0] = o == null;
-      return o;
-    }
-  }
-}
-
-// End PositionedCursor.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/util/Quoting.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/util/Quoting.java b/avatica/core/src/main/java/org/apache/calcite/avatica/util/Quoting.java
deleted file mode 100644
index 855e4a6..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/util/Quoting.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.util;
-
-/** Syntax for quoting identifiers in SQL statements. */
-public enum Quoting {
-  /** Quote identifiers in double-quotes. For example, {@code "my id"}. */
-  DOUBLE_QUOTE("\""),
-
-  /** Quote identifiers in back-quotes. For example, {@code `my id`}. */
-  BACK_TICK("`"),
-
-  /** Quote identifiers in brackets. For example, {@code [my id]}. */
-  BRACKET("[");
-
-  public String string;
-
-  Quoting(String string) {
-    this.string = string;
-  }
-}
-
-// End Quoting.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/util/RecordIteratorCursor.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/util/RecordIteratorCursor.java b/avatica/core/src/main/java/org/apache/calcite/avatica/util/RecordIteratorCursor.java
deleted file mode 100644
index 717247d..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/util/RecordIteratorCursor.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.util;
-
-import java.lang.reflect.Field;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * Implementation of {@link org.apache.calcite.avatica.util.Cursor} on top of an
- * {@link java.util.Iterator} that
- * returns a record for each row. The record is a synthetic class whose fields
- * are all public.
- *
- * @param <E> Element type
- */
-public class RecordIteratorCursor<E> extends IteratorCursor<E> {
-  private final List<Field> fields;
-
-  /**
-   * Creates a RecordIteratorCursor.
-   *
-   * @param iterator Iterator
-   * @param clazz Element type
-   */
-  public RecordIteratorCursor(Iterator<E> iterator, Class<E> clazz) {
-    this(iterator, clazz, Arrays.asList(clazz.getFields()));
-  }
-
-  /**
-   * Creates a RecordIteratorCursor that projects particular fields.
-   *
-   * @param iterator Iterator
-   * @param clazz Element type
-   * @param fields Fields to project
-   */
-  public RecordIteratorCursor(Iterator<E> iterator, Class<E> clazz,
-      List<Field> fields) {
-    super(iterator);
-    this.fields = fields;
-  }
-
-  protected Getter createGetter(int ordinal) {
-    return new FieldGetter(fields.get(ordinal));
-  }
-}
-
-// End RecordIteratorCursor.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/util/Spacer.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/util/Spacer.java b/avatica/core/src/main/java/org/apache/calcite/avatica/util/Spacer.java
deleted file mode 100644
index cc0a097..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/util/Spacer.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.util;
-
-/**
- * Efficiently writes strings of spaces.
- */
-public class Spacer {
-  private int n;
-
-  /** Creates a Spacer with zero spaces. */
-  public Spacer() {
-    this(0);
-  }
-
-  /** Creates a Spacer with a given number of spaces. */
-  public Spacer(int n) {
-    set(n);
-  }
-
-  /** Sets the current number of spaces. */
-  public Spacer set(int n) {
-    this.n = n;
-    return this;
-  }
-
-  /** Returns the current number of spaces. */
-  public int get() {
-    return n;
-  }
-
-  /** Increases the current number of spaces by {@code n}. */
-  public Spacer add(int n) {
-    return set(this.n + n);
-  }
-
-  /** Reduces the current number of spaces by {@code n}. */
-  public Spacer subtract(int n) {
-    return set(this.n - n);
-  }
-
-  /** Returns a string of the current number of spaces. */
-  public String toString() {
-    return Spaces.of(n);
-  }
-
-  /** Appends current number of spaces to a {@link StringBuilder}. */
-  public StringBuilder spaces(StringBuilder buf) {
-    return Spaces.append(buf, n);
-  }
-
-  /** Returns a string that is padded on the right with spaces to the current
-   * length. */
-  public String padRight(String string) {
-    Spaces.padRight(string, n);
-    final int x = n - string.length();
-    if (x <= 0) {
-      return string;
-    }
-    // Replacing StringBuffer with String would hurt performance.
-    //noinspection StringBufferReplaceableByString
-    return Spaces.append(new StringBuilder(string), x).toString();
-  }
-}
-
-// End Spacer.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/util/Spaces.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/util/Spaces.java b/avatica/core/src/main/java/org/apache/calcite/avatica/util/Spaces.java
deleted file mode 100644
index 6469400..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/util/Spaces.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.util;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.AbstractList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-/** Utilities for creating strings of spaces. */
-public class Spaces {
-  /** It doesn't look like this list is ever updated. But it is - when a call to
-   * to {@link SpaceList#get} causes an {@link IndexOutOfBoundsException}. */
-  @SuppressWarnings("MismatchedQueryAndUpdateOfCollection")
-  private static final List<String> SPACE_LIST = new SpaceList();
-
-  /** The longest possible string of spaces. Fine as long as you don't try
-   * to print it.
-   *
-   * <p>Use with {@link StringBuilder#append(CharSequence, int, int)} to
-   * append spaces without doing memory allocation.</p>
-   */
-  public static final CharSequence MAX = sequence(Integer.MAX_VALUE);
-
-  // Utility class. Do not instantiate.
-  private Spaces() {}
-
-  /** Creates a sequence of {@code n} spaces. */
-  public static CharSequence sequence(int n) {
-    return new SpaceString(n);
-  }
-
-  /** Returns a string of {@code n} spaces. */
-  public static String of(int n) {
-    return SPACE_LIST.get(n);
-  }
-
-  /** Appends {@code n} spaces to an {@link Appendable}. */
-  public static Appendable append(Appendable buf, int n) throws IOException {
-    buf.append(MAX, 0, n);
-    return buf;
-  }
-
-  /** Appends {@code n} spaces to a {@link PrintWriter}. */
-  public static PrintWriter append(PrintWriter pw, int n) {
-    pw.append(MAX, 0, n);
-    return pw;
-  }
-
-  /** Appends {@code n} spaces to a {@link StringWriter}. */
-  public static StringWriter append(StringWriter pw, int n) {
-    pw.append(MAX, 0, n);
-    return pw;
-  }
-
-  /** Appends {@code n} spaces to a {@link StringBuilder}. */
-  public static StringBuilder append(StringBuilder buf, int n) {
-    buf.append(MAX, 0, n);
-    return buf;
-  }
-
-  /** Appends {@code n} spaces to a {@link StringBuffer}. */
-  public static StringBuffer append(StringBuffer buf, int n) {
-    buf.append(MAX, 0, n);
-    return buf;
-  }
-
-  /** Returns a string that is padded on the right with spaces to the given
-   * length. */
-  public static String padRight(String string, int n) {
-    final int x = n - string.length();
-    if (x <= 0) {
-      return string;
-    }
-    // Replacing StringBuffer with String would hurt performance.
-    //noinspection StringBufferReplaceableByString
-    return append(new StringBuilder(string), x).toString();
-  }
-
-  /** Returns a string that is padded on the left with spaces to the given
-   * length. */
-  public static String padLeft(String string, int n) {
-    final int x = n - string.length();
-    if (x <= 0) {
-      return string;
-    }
-    // Replacing StringBuffer with String would hurt performance.
-    //noinspection StringBufferReplaceableByString
-    return append(new StringBuilder(), x).append(string).toString();
-  }
-
-  /** A string of spaces. */
-  private static class SpaceString implements CharSequence {
-    private final int length;
-
-    private SpaceString(int length) {
-      this.length = length;
-    }
-
-    // Do not override equals and hashCode to be like String. CharSequence does
-    // not require it.
-
-    @SuppressWarnings("NullableProblems")
-    @Override public String toString() {
-      return of(length);
-    }
-
-    public int length() {
-      return length;
-    }
-
-    public char charAt(int index) {
-      return ' ';
-    }
-
-    public CharSequence subSequence(int start, int end) {
-      return new SpaceString(end - start);
-    }
-  }
-
-  /** List whose {@code i}th entry is a string consisting of {@code i} spaces.
-   * It populates itself the first time you ask for a particular string, and
-   * caches the result. */
-  private static class SpaceList extends CopyOnWriteArrayList<String> {
-    @Override public String get(int index) {
-      for (;;) {
-        try {
-          return super.get(index);
-        } catch (IndexOutOfBoundsException e) {
-          if (index < 0) {
-            throw e;
-          }
-          populate(Math.max(16, index + 1));
-        }
-      }
-    }
-
-    /**
-     * Populates this list with all prefix strings of a given string. All
-     * of the prefix strings share the same backing array of chars.
-     */
-    private synchronized void populate(int newSize) {
-      final int size = size();
-      if (newSize <= size) {
-        return;
-      }
-      final char[] chars = new char[newSize];
-      Arrays.fill(chars, ' ');
-      final int length = newSize - size;
-      final int offset = size;
-
-      // addAll is much more efficient than repeated add for
-      // CopyOnWriteArrayList
-      addAll(
-          new AbstractList<String>() {
-            public String get(int index) {
-              return new String(chars, 0, offset + index);
-            }
-
-            public int size() {
-              return length;
-            }
-          });
-    }
-  }
-}
-
-// End Spaces.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/util/StructImpl.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/util/StructImpl.java b/avatica/core/src/main/java/org/apache/calcite/avatica/util/StructImpl.java
deleted file mode 100644
index b25fce6..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/util/StructImpl.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.util;
-
-import org.apache.calcite.avatica.ColumnMetaData;
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Struct;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-/** Implementation of JDBC {@link Struct}. */
-public class StructImpl implements Struct {
-  private final List list;
-
-  public StructImpl(List list) {
-    this.list = list;
-  }
-
-  @Override public String toString() {
-    final Iterator iterator = list.iterator();
-    if (!iterator.hasNext()) {
-      return "{}";
-    }
-    final StringBuilder buf = new StringBuilder("{");
-    for (;;) {
-      append(buf, iterator.next());
-      if (!iterator.hasNext()) {
-        return buf.append("}").toString();
-      }
-      buf.append(", ");
-    }
-  }
-
-  @Override public String getSQLTypeName() throws SQLException {
-    return "ROW";
-  }
-
-  @Override public Object[] getAttributes() throws SQLException {
-    return list.toArray();
-  }
-
-  @Override public Object[] getAttributes(Map<String, Class<?>> map)
-      throws SQLException {
-    throw new UnsupportedOperationException(); // TODO
-  }
-
-  private void append(StringBuilder buf, Object o) {
-    if (o == null) {
-      buf.append("null");
-    } else {
-      buf.append(o);
-    }
-  }
-
-  /** Factory that can create a result set based on a list of values. */
-  public interface Factory {
-    ResultSet create(ColumnMetaData.AvaticaType elementType,
-        Iterable<Object> iterable);
-  }
-}
-
-// End StructImpl.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/util/TimeUnit.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/util/TimeUnit.java b/avatica/core/src/main/java/org/apache/calcite/avatica/util/TimeUnit.java
deleted file mode 100644
index 251c4cf..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/util/TimeUnit.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.util;
-
-import java.math.BigDecimal;
-
-/**
- * Enumeration of time units used to construct an interval.
- *
- * <p>Only {@link #YEAR}, {@link #YEAR}, {@link #MONTH}, {@link #DAY},
- * {@link #HOUR}, {@link #MINUTE}, {@link #SECOND} can be the unit of a SQL
- * interval.
- *
- * <p>The others ({@link #QUARTER}, {@link #WEEK}, {@link #MILLISECOND},
- * {@link #DOW}, {@link #DOY}, {@link #EPOCH}, {@link #DECADE}, {@link #CENTURY},
- * {@link #MILLENNIUM} and {@link #MICROSECOND}) are convenient to use internally,
- * when converting to and from UNIX timestamps. And also may be arguments to the
- * {@code EXTRACT}, {@code TIMESTAMPADD} and {@code TIMESTAMPDIFF} functions.
- */
-public enum TimeUnit {
-  YEAR(true, ' ', BigDecimal.valueOf(12) /* months */, null),
-  MONTH(true, '-', BigDecimal.ONE /* months */, BigDecimal.valueOf(12)),
-  DAY(false, '-', BigDecimal.valueOf(DateTimeUtils.MILLIS_PER_DAY), null),
-  HOUR(false, ' ', BigDecimal.valueOf(DateTimeUtils.MILLIS_PER_HOUR),
-      BigDecimal.valueOf(24)),
-  MINUTE(false, ':', BigDecimal.valueOf(DateTimeUtils.MILLIS_PER_MINUTE),
-      BigDecimal.valueOf(60)),
-  SECOND(false, ':', BigDecimal.valueOf(DateTimeUtils.MILLIS_PER_SECOND),
-      BigDecimal.valueOf(60)),
-
-  QUARTER(true, '*', BigDecimal.valueOf(3) /* months */, BigDecimal.valueOf(4)),
-  WEEK(false, '*', BigDecimal.valueOf(DateTimeUtils.MILLIS_PER_DAY * 7),
-      BigDecimal.valueOf(53)),
-  MILLISECOND(false, '.', BigDecimal.ONE, BigDecimal.valueOf(1000)),
-  MICROSECOND(false, '.', BigDecimal.ONE.scaleByPowerOfTen(-3),
-      BigDecimal.valueOf(1000000)),
-  DOW(false, '-', null, null),
-  DOY(false, '-', null, null),
-  EPOCH(false, '*', null, null),
-  DECADE(true, '*', BigDecimal.valueOf(120) /* months */, null),
-  CENTURY(true, '*', BigDecimal.valueOf(1200) /* months */, null),
-  MILLENNIUM(true, '*', BigDecimal.valueOf(12000) /* months */, null);
-
-  public final boolean yearMonth;
-  public final char separator;
-  public final BigDecimal multiplier;
-  private final BigDecimal limit;
-
-  private static final TimeUnit[] CACHED_VALUES = values();
-
-  TimeUnit(boolean yearMonth, char separator, BigDecimal multiplier,
-      BigDecimal limit) {
-    this.yearMonth = yearMonth;
-    this.separator = separator;
-    this.multiplier = multiplier;
-    this.limit = limit;
-  }
-
-  /**
-   * Returns the TimeUnit associated with an ordinal. The value returned
-   * is null if the ordinal is not a member of the TimeUnit enumeration.
-   */
-  public static TimeUnit getValue(int ordinal) {
-    return ordinal < 0 || ordinal >= CACHED_VALUES.length
-        ? null
-        : CACHED_VALUES[ordinal];
-  }
-
-  /**
-   * Returns whether a given value is valid for a field of this time unit.
-   *
-   * @param field Field value
-   * @return Whether value
-   */
-  public boolean isValidValue(BigDecimal field) {
-    return field.compareTo(BigDecimal.ZERO) >= 0
-        && (limit == null
-        || field.compareTo(limit) < 0);
-  }
-}
-
-// End TimeUnit.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/util/TimeUnitRange.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/util/TimeUnitRange.java b/avatica/core/src/main/java/org/apache/calcite/avatica/util/TimeUnitRange.java
deleted file mode 100644
index 42d44dc..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/util/TimeUnitRange.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.util;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Objects;
-
-/** A range of time units. The first is more significant than the
- * other (e.g. year-to-day) or the same as the other (e.g. month). */
-public enum TimeUnitRange {
-  YEAR(TimeUnit.YEAR, null),
-  YEAR_TO_MONTH(TimeUnit.YEAR, TimeUnit.MONTH),
-  MONTH(TimeUnit.MONTH, null),
-  DAY(TimeUnit.DAY, null),
-  DAY_TO_HOUR(TimeUnit.DAY, TimeUnit.HOUR),
-  DAY_TO_MINUTE(TimeUnit.DAY, TimeUnit.MINUTE),
-  DAY_TO_SECOND(TimeUnit.DAY, TimeUnit.SECOND),
-  HOUR(TimeUnit.HOUR, null),
-  HOUR_TO_MINUTE(TimeUnit.HOUR, TimeUnit.MINUTE),
-  HOUR_TO_SECOND(TimeUnit.HOUR, TimeUnit.SECOND),
-  MINUTE(TimeUnit.MINUTE, null),
-  MINUTE_TO_SECOND(TimeUnit.MINUTE, TimeUnit.SECOND),
-  SECOND(TimeUnit.SECOND, null),
-
-  // non-standard time units cannot participate in ranges
-  QUARTER(TimeUnit.QUARTER, null),
-  WEEK(TimeUnit.WEEK, null),
-  MILLISECOND(TimeUnit.MILLISECOND, null),
-  MICROSECOND(TimeUnit.MICROSECOND, null),
-  DOW(TimeUnit.DOW, null),
-  DOY(TimeUnit.DOY, null),
-  EPOCH(TimeUnit.EPOCH, null),
-  DECADE(TimeUnit.DECADE, null),
-  CENTURY(TimeUnit.CENTURY, null),
-  MILLENNIUM(TimeUnit.MILLENNIUM, null);
-
-  public final TimeUnit startUnit;
-  public final TimeUnit endUnit;
-
-  private static final Map<Pair<TimeUnit>, TimeUnitRange> MAP = createMap();
-
-  /**
-   * Creates a TimeUnitRange.
-   *
-   * @param startUnit Start time unit
-   * @param endUnit   End time unit
-   */
-  TimeUnitRange(TimeUnit startUnit, TimeUnit endUnit) {
-    assert startUnit != null;
-    this.startUnit = startUnit;
-    this.endUnit = endUnit;
-  }
-
-  /**
-   * Returns a {@code TimeUnitRange} with a given start and end unit.
-   *
-   * @param startUnit Start unit
-   * @param endUnit   End unit
-   * @return Time unit range, or null if not valid
-   */
-  public static TimeUnitRange of(TimeUnit startUnit, TimeUnit endUnit) {
-    return MAP.get(new Pair<>(startUnit, endUnit));
-  }
-
-  private static Map<Pair<TimeUnit>, TimeUnitRange> createMap() {
-    Map<Pair<TimeUnit>, TimeUnitRange> map = new HashMap<>();
-    for (TimeUnitRange value : values()) {
-      map.put(new Pair<>(value.startUnit, value.endUnit), value);
-    }
-    return Collections.unmodifiableMap(map);
-  }
-
-  /** Whether this is in the YEAR-TO-MONTH family of intervals. */
-  public boolean monthly() {
-    return ordinal() <= MONTH.ordinal();
-  }
-
-  /** Immutable pair of values of the same type. */
-  private static class Pair<E> {
-    final E left;
-    final E right;
-
-    private Pair(E left, E right) {
-      this.left = left;
-      this.right = right;
-    }
-
-    @Override public int hashCode() {
-      int k = (left == null) ? 0 : left.hashCode();
-      int k1 = (right == null) ? 0 : right.hashCode();
-      return ((k << 4) | k) ^ k1;
-    }
-
-    @Override public boolean equals(Object obj) {
-      return obj == this
-          || obj instanceof Pair
-          && Objects.equals(left, ((Pair) obj).left)
-          && Objects.equals(right, ((Pair) obj).right);
-    }
-  }
-}
-
-// End TimeUnitRange.java


[35/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/remote/TrustStoreConfigurable.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/TrustStoreConfigurable.java b/avatica/core/src/main/java/org/apache/calcite/avatica/remote/TrustStoreConfigurable.java
deleted file mode 100644
index 676f35b..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/TrustStoreConfigurable.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import java.io.File;
-
-/**
- * Allows a truststore (and password) to be provided to enable TLS authentication.
- */
-public interface TrustStoreConfigurable {
-
-  /**
-   * Sets a truststore containing the collection of trust SSL/TLS server certificates
-   * to use for HTTPS calls and the password for that truststore.
-   *
-   * @param truststore The truststore on the local filesystem
-   * @param password The truststore's password
-   */
-  void setTrustStore(File truststore, String password);
-}
-
-// End TrustStoreConfigurable.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/remote/TypedValue.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/TypedValue.java b/avatica/core/src/main/java/org/apache/calcite/avatica/remote/TypedValue.java
deleted file mode 100644
index 7f1c752..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/TypedValue.java
+++ /dev/null
@@ -1,656 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import org.apache.calcite.avatica.ColumnMetaData;
-import org.apache.calcite.avatica.ColumnMetaData.Rep;
-import org.apache.calcite.avatica.proto.Common;
-import org.apache.calcite.avatica.util.Base64;
-import org.apache.calcite.avatica.util.ByteString;
-import org.apache.calcite.avatica.util.DateTimeUtils;
-
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.google.protobuf.Descriptors.FieldDescriptor;
-import com.google.protobuf.UnsafeByteOperations;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
-import java.util.Objects;
-
-import static java.nio.charset.StandardCharsets.UTF_8;
-
-/** Value and type.
- *
- * <p>There are 3 representations:
- * <ul>
- *   <li>JDBC - the representation used by JDBC get and set methods
- *   <li>Serial - suitable for serializing using JSON
- *   <li>Local - used by Calcite for efficient computation
- * </ul>
- *
- * <p>The following table shows the Java type(s) that may represent each SQL
- * type in each representation.
- *
- * <table>
- *   <caption>SQL types and their representations</caption>
- *   <tr>
- *     <th>Type</th> <th>JDBC</th> <th>Serial</th> <th>Local</th>
- *   </tr>
- *   <tr>
- *     <td>BOOLEAN</td> <td>boolean</td> <td>boolean</td> <td>boolean</td>
- *   </tr>
- *   <tr>
- *     <td>BINARY, VARBINARY</td> <td>byte[]</td>
- *                    <td>String (base64)</td> <td>{@link ByteString}</td>
- *   </tr>
- *   <tr>
- *     <td>DATE</td> <td>{@link java.sql.Date}</td>
- *                                   <td>int</td> <td>int</td>
- *   </tr>
- *   <tr>
- *     <td>TIME</td> <td>{@link java.sql.Time}</td>
- *                                   <td>int</td> <td>int</td>
- *   </tr>
- *   <tr>
- *     <td>DATE</td> <td>{@link java.sql.Timestamp}</td>
- *                                   <td>long</td> <td>long</td>
- *   </tr>
- *   <tr>
- *     <td>CHAR, VARCHAR</td>
- *                   <td>String</td> <td>String</td> <td>String</td>
- *   </tr>
- *   <tr>
- *     <td>TINYINT</td> <td>byte</td> <td>Number</td> <td>byte</td>
- *   </tr>
- *   <tr>
- *     <td>SMALLINT</td> <td>short</td> <td>Number</td> <td>short</td>
- *   </tr>
- *   <tr>
- *     <td>INTEGER</td> <td>int</td> <td>Number</td> <td>int</td>
- *   </tr>
- *   <tr>
- *     <td>BIGINT</td> <td>long</td> <td>Number</td> <td>long</td>
- *   </tr>
- *   <tr>
- *     <td>REAL</td> <td>float</td> <td>Number</td> <td>float</td>
- *   </tr>
- *   <tr>
- *     <td>FLOAT, DOUBLE</td>
- *                   <td>double</td> <td>Number</td> <td>double</td>
- *   </tr>
- *   <tr>
- *     <td>DECIMAL</td>
- *                   <td>BigDecimal</td> <td>Number</td> <td>BigDecimal</td>
- *   </tr>
- * </table>
- *
- * Note:
- * <ul>
- *   <li>The various numeric types (TINYINT, SMALLINT, INTEGER, BIGINT, REAL,
- *   FLOAT, DOUBLE) are represented by {@link Number} in serial format because
- *   JSON numbers are not strongly typed. A {@code float} value {@code 3.0} is
- *   transmitted as {@code 3}, and is therefore decoded as an {@code int}.
- *
- *   <li>The date-time types (DATE, TIME, TIMESTAMP) are represented in JDBC as
- *   {@link java.sql.Date}, {@link java.sql.Time}, {@link java.sql.Timestamp},
- *   all sub-classes of {@link java.util.Date}. When they are passed to and
- *   from the server, they are interpreted in terms of a time zone, by default
- *   the current connection's time zone. Their serial and local representations
- *   as {@code int} (days since 1970-01-01 for DATE, milliseconds since
- *   00:00:00.000 for TIME), and long (milliseconds since 1970-01-01
- *   00:00:00.000 for TIMESTAMP) are easier to work with, because it is clear
- *   that time zone is not involved.
- *
- *   <li>BINARY and VARBINARY values are represented as base64-encoded strings
- *   for serialization over JSON.
- * </ul>
- */
-public class TypedValue {
-  private static final FieldDescriptor NUMBER_DESCRIPTOR = Common.TypedValue.getDescriptor()
-      .findFieldByNumber(Common.TypedValue.NUMBER_VALUE_FIELD_NUMBER);
-  private static final FieldDescriptor STRING_DESCRIPTOR = Common.TypedValue.getDescriptor()
-      .findFieldByNumber(Common.TypedValue.STRING_VALUE_FIELD_NUMBER);
-  private static final FieldDescriptor BYTES_DESCRIPTOR = Common.TypedValue.getDescriptor()
-      .findFieldByNumber(Common.TypedValue.BYTES_VALUE_FIELD_NUMBER);
-
-  public static final TypedValue NULL =
-      new TypedValue(ColumnMetaData.Rep.OBJECT, null);
-
-  /** Type of the value. */
-  public final ColumnMetaData.Rep type;
-
-  /** Value.
-   *
-   * <p>Always in a form that can be serialized to JSON by Jackson.
-   * For example, byte arrays are represented as String. */
-  public final Object value;
-
-  private TypedValue(ColumnMetaData.Rep rep, Object value) {
-    this.type = rep;
-    this.value = value;
-    assert isSerial(rep, value) : "rep: " + rep + ", value: " + value;
-  }
-
-  private boolean isSerial(ColumnMetaData.Rep rep, Object value) {
-    if (value == null) {
-      return true;
-    }
-    switch (rep) {
-    case BYTE_STRING:
-      return value instanceof String;
-    case JAVA_SQL_DATE:
-    case JAVA_SQL_TIME:
-      return value instanceof Integer;
-    case JAVA_SQL_TIMESTAMP:
-    case JAVA_UTIL_DATE:
-      return value instanceof Long;
-    default:
-      return true;
-    }
-  }
-
-  @JsonCreator
-  public static TypedValue create(@JsonProperty("type") String type,
-      @JsonProperty("value") Object value) {
-    if (value == null) {
-      return NULL;
-    }
-    ColumnMetaData.Rep rep = ColumnMetaData.Rep.valueOf(type);
-    return ofLocal(rep, serialToLocal(rep, value));
-  }
-
-  /** Creates a TypedValue from a value in local representation. */
-  public static TypedValue ofLocal(ColumnMetaData.Rep rep, Object value) {
-    return new TypedValue(rep, localToSerial(rep, value));
-  }
-
-  /** Creates a TypedValue from a value in serial representation. */
-  public static TypedValue ofSerial(ColumnMetaData.Rep rep, Object value) {
-    return new TypedValue(rep, value);
-  }
-
-  /** Creates a TypedValue from a value in JDBC representation. */
-  public static TypedValue ofJdbc(ColumnMetaData.Rep rep, Object value,
-      Calendar calendar) {
-    if (value == null) {
-      return NULL;
-    }
-    return new TypedValue(rep, jdbcToSerial(rep, value, calendar));
-  }
-
-  /** Creates a TypedValue from a value in JDBC representation,
-   * deducing its type. */
-  public static TypedValue ofJdbc(Object value, Calendar calendar) {
-    if (value == null) {
-      return NULL;
-    }
-    final ColumnMetaData.Rep rep = ColumnMetaData.Rep.of(value.getClass());
-    return new TypedValue(rep, jdbcToSerial(rep, value, calendar));
-  }
-
-  /** Converts the value into the local representation.
-   *
-   * <p>For example, a byte string is represented as a {@link ByteString};
-   * a long is represented as a {@link Long} (not just some {@link Number}).
-   */
-  public Object toLocal() {
-    if (value == null) {
-      return null;
-    }
-    return serialToLocal(type, value);
-  }
-
-  /** Converts a value to the exact type required for the given
-   * representation. */
-  private static Object serialToLocal(ColumnMetaData.Rep rep, Object value) {
-    assert value != null;
-    if (value.getClass() == rep.clazz) {
-      return value;
-    }
-    switch (rep) {
-    case BYTE:
-      return ((Number) value).byteValue();
-    case SHORT:
-      return ((Number) value).shortValue();
-    case INTEGER:
-    case JAVA_SQL_DATE:
-    case JAVA_SQL_TIME:
-      return ((Number) value).intValue();
-    case LONG:
-    case JAVA_UTIL_DATE:
-    case JAVA_SQL_TIMESTAMP:
-      return ((Number) value).longValue();
-    case FLOAT:
-      return ((Number) value).floatValue();
-    case DOUBLE:
-      return ((Number) value).doubleValue();
-    case NUMBER:
-      return value instanceof BigDecimal ? value
-          : value instanceof BigInteger ? new BigDecimal((BigInteger) value)
-          : value instanceof Double ? new BigDecimal((Double) value)
-          : value instanceof Float ? new BigDecimal((Float) value)
-          : new BigDecimal(((Number) value).longValue());
-    case BYTE_STRING:
-      return ByteString.ofBase64((String) value);
-    default:
-      throw new IllegalArgumentException("cannot convert " + value + " ("
-          + value.getClass() + ") to " + rep);
-    }
-  }
-
-  /** Converts the value into the JDBC representation.
-   *
-   * <p>For example, a byte string is represented as a {@link ByteString};
-   * a long is represented as a {@link Long} (not just some {@link Number}).
-   */
-  public Object toJdbc(Calendar calendar) {
-    if (value == null) {
-      return null;
-    }
-    return serialToJdbc(type, value, calendar);
-  }
-
-  /**
-   * Converts the given value from serial form to JDBC form.
-   *
-   * @param type The type of the value
-   * @param value The value
-   * @param calendar A calendar instance
-   * @return The JDBC representation of the value.
-   */
-  private static Object serialToJdbc(ColumnMetaData.Rep type, Object value, Calendar calendar) {
-    switch (type) {
-    case BYTE_STRING:
-      return ByteString.ofBase64((String) value).getBytes();
-    case JAVA_UTIL_DATE:
-      return new java.util.Date(adjust((Number) value, calendar));
-    case JAVA_SQL_DATE:
-      return new java.sql.Date(
-          adjust(((Number) value).longValue() * DateTimeUtils.MILLIS_PER_DAY,
-              calendar));
-    case JAVA_SQL_TIME:
-      return new java.sql.Time(adjust((Number) value, calendar));
-    case JAVA_SQL_TIMESTAMP:
-      return new java.sql.Timestamp(adjust((Number) value, calendar));
-    default:
-      return serialToLocal(type, value);
-    }
-  }
-
-  private static long adjust(Number number, Calendar calendar) {
-    long t = number.longValue();
-    if (calendar != null) {
-      t -= calendar.getTimeZone().getOffset(t);
-    }
-    return t;
-  }
-
-  /** Converts a value from JDBC format to a type that can be serialized as
-   * JSON. */
-  private static Object jdbcToSerial(ColumnMetaData.Rep rep, Object value,
-      Calendar calendar) {
-    switch (rep) {
-    case BYTE_STRING:
-      return new ByteString((byte[]) value).toBase64String();
-    case JAVA_UTIL_DATE:
-    case JAVA_SQL_TIMESTAMP:
-    case JAVA_SQL_DATE:
-    case JAVA_SQL_TIME:
-      long t = ((Date) value).getTime();
-      if (calendar != null) {
-        t += calendar.getTimeZone().getOffset(t);
-      }
-      switch (rep) {
-      case JAVA_SQL_DATE:
-        return (int) DateTimeUtils.floorDiv(t, DateTimeUtils.MILLIS_PER_DAY);
-      case JAVA_SQL_TIME:
-        return (int) DateTimeUtils.floorMod(t, DateTimeUtils.MILLIS_PER_DAY);
-      default:
-        return t;
-      }
-    default:
-      return value;
-    }
-  }
-
-  /** Converts a value from internal format to a type that can be serialized
-   * as JSON. */
-  private static Object localToSerial(ColumnMetaData.Rep rep, Object value) {
-    switch (rep) {
-    case BYTE_STRING:
-      return ((ByteString) value).toBase64String();
-    default:
-      return value;
-    }
-  }
-
-  /** Converts a list of {@code TypedValue} to a list of values. */
-  public static List<Object> values(List<TypedValue> typedValues) {
-    final List<Object> list = new ArrayList<>();
-    for (TypedValue typedValue : typedValues) {
-      list.add(typedValue.toLocal());
-    }
-    return list;
-  }
-
-  /**
-   * Creates a protocol buffer equivalent object for <code>this</code>.
-   * @return A protobuf TypedValue equivalent for <code>this</code>
-   */
-  public Common.TypedValue toProto() {
-    final Common.TypedValue.Builder builder = Common.TypedValue.newBuilder();
-
-    Common.Rep protoRep = type.toProto();
-    // Protobuf has an explicit BIG_DECIMAL representation enum value.
-    if (Common.Rep.NUMBER == protoRep && value instanceof BigDecimal) {
-      protoRep = Common.Rep.BIG_DECIMAL;
-    }
-
-    // Serialize the type into the protobuf
-    writeToProtoWithType(builder, value, protoRep);
-
-    return builder.build();
-  }
-
-  private static void writeToProtoWithType(Common.TypedValue.Builder builder, Object o,
-      Common.Rep type) {
-    builder.setType(type);
-
-    switch (type) {
-    case BOOLEAN:
-    case PRIMITIVE_BOOLEAN:
-      builder.setBoolValue((boolean) o);
-      return;
-    case BYTE_STRING:
-      byte[] bytes;
-      // Serial representation is b64. We don't need to do that for protobuf
-      if (o instanceof String) {
-        // Backwards compatibility for client CALCITE-1209
-        builder.setStringValue((String) o);
-        // Assume strings are already b64 encoded
-        bytes = ByteString.parseBase64((String) o);
-      } else {
-        // Backwards compatibility for client CALCITE-1209
-        builder.setStringValue(Base64.encodeBytes((byte[]) o));
-        // Use the byte array
-        bytes = (byte[]) o;
-      }
-      builder.setBytesValue(UnsafeByteOperations.unsafeWrap(bytes));
-      return;
-    case STRING:
-      builder.setStringValueBytes(UnsafeByteOperations.unsafeWrap(((String) o).getBytes(UTF_8)));
-      return;
-    case PRIMITIVE_CHAR:
-    case CHARACTER:
-      builder.setStringValue(Character.toString((char) o));
-      return;
-    case BYTE:
-    case PRIMITIVE_BYTE:
-      builder.setNumberValue(Byte.valueOf((byte) o).longValue());
-      return;
-    case DOUBLE:
-    case PRIMITIVE_DOUBLE:
-      builder.setDoubleValue((double) o);
-      return;
-    case FLOAT:
-    case PRIMITIVE_FLOAT:
-      builder.setNumberValue(Float.floatToIntBits((float) o));
-      return;
-    case INTEGER:
-    case PRIMITIVE_INT:
-      builder.setNumberValue(Integer.valueOf((int) o).longValue());
-      return;
-    case PRIMITIVE_SHORT:
-    case SHORT:
-      builder.setNumberValue(Short.valueOf((short) o).longValue());
-      return;
-    case LONG:
-    case PRIMITIVE_LONG:
-      builder.setNumberValue((long) o);
-      return;
-    case JAVA_SQL_DATE:
-    case JAVA_SQL_TIME:
-      // Persisted as integers
-      builder.setNumberValue(Integer.valueOf((int) o).longValue());
-      return;
-    case JAVA_SQL_TIMESTAMP:
-    case JAVA_UTIL_DATE:
-      // Persisted as longs
-      builder.setNumberValue((long) o);
-      return;
-    case BIG_INTEGER:
-      byte[] byteRep = ((BigInteger) o).toByteArray();
-      builder.setBytesValue(com.google.protobuf.ByteString.copyFrom(byteRep));
-      return;
-    case BIG_DECIMAL:
-      final BigDecimal bigDecimal = (BigDecimal) o;
-      builder.setStringValue(bigDecimal.toString());
-      return;
-    case NUMBER:
-      builder.setNumberValue(((Number) o).longValue());
-      return;
-    case NULL:
-      builder.setNull(true);
-      return;
-    case OBJECT:
-      if (null == o) {
-        // We can persist a null value through easily
-        builder.setNull(true);
-        return;
-      }
-      // Intentional fall-through to RTE because we can't serialize something we have no type
-      // insight into.
-    case UNRECOGNIZED:
-      // Fail?
-      throw new RuntimeException("Unhandled value: " + type + " " + o.getClass());
-    default:
-      // Fail?
-      throw new RuntimeException("Unknown serialized type: " + type);
-    }
-  }
-
-  /**
-   * Constructs a {@link TypedValue} from the protocol buffer representation.
-   *
-   * @param proto The protobuf Typedvalue
-   * @return A {@link TypedValue} instance
-   */
-  public static TypedValue fromProto(Common.TypedValue proto) {
-    ColumnMetaData.Rep rep = ColumnMetaData.Rep.fromProto(proto.getType());
-    Object value = getSerialFromProto(proto);
-
-    return new TypedValue(rep, value);
-  }
-
-  /**
-   * Converts the serialized value into the appropriate primitive/object.
-   *
-   * @param protoValue The serialized TypedValue.
-   * @return The appropriate concrete type for the parameter value (as an Object).
-   */
-  public static Object getSerialFromProto(Common.TypedValue protoValue) {
-    // Deserialize the value again
-    switch (protoValue.getType()) {
-    case BOOLEAN:
-    case PRIMITIVE_BOOLEAN:
-      return protoValue.getBoolValue();
-    case BYTE_STRING:
-      if (protoValue.hasField(STRING_DESCRIPTOR) && !protoValue.hasField(BYTES_DESCRIPTOR)) {
-        // Prior to CALCITE-1103, clients would send b64 strings for bytes instead of using the
-        // native byte format. The value we need to provide as the local format for TypedValue
-        // is directly accessible via the Protobuf representation. Both fields are sent by the
-        // server to support older clients, so only parse the string value when it is alone.
-        return protoValue.getStringValue();
-      }
-      // TypedValue is still going to expect a b64string for BYTE_STRING even though we sent it
-      // across the wire natively as bytes. Return it as b64.
-      return (new ByteString(protoValue.getBytesValue().toByteArray())).toBase64String();
-    case STRING:
-      return protoValue.getStringValue();
-    case PRIMITIVE_CHAR:
-    case CHARACTER:
-      return protoValue.getStringValue().charAt(0);
-    case BYTE:
-    case PRIMITIVE_BYTE:
-      return Long.valueOf(protoValue.getNumberValue()).byteValue();
-    case DOUBLE:
-    case PRIMITIVE_DOUBLE:
-      return protoValue.getDoubleValue();
-    case FLOAT:
-    case PRIMITIVE_FLOAT:
-      return Float.intBitsToFloat((int) protoValue.getNumberValue());
-    case INTEGER:
-    case PRIMITIVE_INT:
-      return Long.valueOf(protoValue.getNumberValue()).intValue();
-    case PRIMITIVE_SHORT:
-    case SHORT:
-      return Long.valueOf(protoValue.getNumberValue()).shortValue();
-    case LONG:
-    case PRIMITIVE_LONG:
-      return Long.valueOf(protoValue.getNumberValue());
-    case JAVA_SQL_DATE:
-    case JAVA_SQL_TIME:
-      return Long.valueOf(protoValue.getNumberValue()).intValue();
-    case JAVA_SQL_TIMESTAMP:
-    case JAVA_UTIL_DATE:
-      return protoValue.getNumberValue();
-    case BIG_INTEGER:
-      return new BigInteger(protoValue.getBytesValue().toByteArray());
-    case BIG_DECIMAL:
-      // CALCITE-1103 shifts BigDecimals to be serialized as strings.
-      if (protoValue.hasField(NUMBER_DESCRIPTOR)) {
-        // This is the old (broken) style.
-        BigInteger bigInt = new BigInteger(protoValue.getBytesValue().toByteArray());
-        return new BigDecimal(bigInt, (int) protoValue.getNumberValue());
-      }
-      return new BigDecimal(protoValue.getStringValueBytes().toStringUtf8());
-    case NUMBER:
-      return Long.valueOf(protoValue.getNumberValue());
-    case NULL:
-      return null;
-    case OBJECT:
-      if (protoValue.getNull()) {
-        return null;
-      }
-      // Intentional fall through to RTE. If we sent an object over the wire, it could only
-      // possibly be null (at this point). Anything else has to be an error.
-    case UNRECOGNIZED:
-      // Fail?
-      throw new RuntimeException("Unhandled type: " + protoValue.getType());
-    default:
-      // Fail?
-      throw new RuntimeException("Unknown type: " + protoValue.getType());
-    }
-  }
-
-  /**
-   * Writes the given object into the Protobuf representation of a TypedValue. The object is
-   * serialized given the type of that object, mapping it to the appropriate representation.
-   *
-   * @param builder The TypedValue protobuf builder
-   * @param o The object (value)
-   */
-  public static void toProto(Common.TypedValue.Builder builder, Object o) {
-    // Numbers
-    if (o instanceof Byte) {
-      writeToProtoWithType(builder, o, Common.Rep.BYTE);
-    } else if (o instanceof Short) {
-      writeToProtoWithType(builder, o, Common.Rep.SHORT);
-    } else if (o instanceof Integer) {
-      writeToProtoWithType(builder, o, Common.Rep.INTEGER);
-    } else if (o instanceof Long) {
-      writeToProtoWithType(builder, o, Common.Rep.LONG);
-    } else if (o instanceof Double) {
-      writeToProtoWithType(builder, o, Common.Rep.DOUBLE);
-    } else if (o instanceof Float) {
-      writeToProtoWithType(builder, ((Float) o).longValue(), Common.Rep.FLOAT);
-    } else if (o instanceof BigDecimal) {
-      writeToProtoWithType(builder, o, Common.Rep.BIG_DECIMAL);
-    // Strings
-    } else if (o instanceof String) {
-      writeToProtoWithType(builder, o, Common.Rep.STRING);
-    } else if (o instanceof Character) {
-      writeToProtoWithType(builder, o.toString(), Common.Rep.CHARACTER);
-    // Bytes
-    } else if (o instanceof byte[]) {
-      writeToProtoWithType(builder, o, Common.Rep.BYTE_STRING);
-    // Boolean
-    } else if (o instanceof Boolean) {
-      writeToProtoWithType(builder, o, Common.Rep.BOOLEAN);
-    } else if (null == o) {
-      writeToProtoWithType(builder, o, Common.Rep.NULL);
-    // Unhandled
-    } else {
-      throw new RuntimeException("Unhandled type in Frame: " + o.getClass());
-    }
-  }
-
-  /**
-   * Extracts the JDBC value from protobuf-TypedValue representation.
-   *
-   * @param protoValue Protobuf TypedValue
-   * @param calendar Instance of a calendar
-   * @return The JDBC representation of this TypedValue
-   */
-  public static Object protoToJdbc(Common.TypedValue protoValue, Calendar calendar) {
-    Object o = getSerialFromProto(Objects.requireNonNull(protoValue));
-    // Shortcircuit the null
-    if (null == o) {
-      return o;
-    }
-    return serialToJdbc(Rep.fromProto(protoValue.getType()), o, calendar);
-    //return protoSerialToJdbc(protoValue.getType(), o, Objects.requireNonNull(calendar));
-  }
-
-  @Override public int hashCode() {
-    final int prime = 31;
-    int result = 1;
-    result = prime * result + ((type == null) ? 0 : type.hashCode());
-    result = prime * result + ((value == null) ? 0 : value.hashCode());
-    return result;
-  }
-
-  @Override public boolean equals(Object o) {
-    if (o == this) {
-      return true;
-    }
-    if (o instanceof TypedValue) {
-      TypedValue other = (TypedValue) o;
-
-      if (type != other.type) {
-        return false;
-      }
-
-      if (null == value) {
-        if (null != other.value) {
-          return false;
-        }
-      }
-
-      return value.equals(other.value);
-    }
-
-    return false;
-  }
-}
-
-// End TypedValue.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/remote/UsernamePasswordAuthenticateable.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/UsernamePasswordAuthenticateable.java b/avatica/core/src/main/java/org/apache/calcite/avatica/remote/UsernamePasswordAuthenticateable.java
deleted file mode 100644
index 9a6afe5..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/UsernamePasswordAuthenticateable.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-/**
- * Interface that allows configuration of a username and password with some HTTP authentication.
- */
-public interface UsernamePasswordAuthenticateable {
-
-  /**
-   * Sets the username, password and method to be used for authentication.
-   *
-   * @param authType Type of authentication
-   * @param username Username
-   * @param password Password
-   */
-  void setUsernamePassword(AuthenticationType authType, String username, String password);
-
-}
-
-// End UsernamePasswordAuthenticateable.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/remote/package-info.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/package-info.java b/avatica/core/src/main/java/org/apache/calcite/avatica/remote/package-info.java
deleted file mode 100644
index 1cf3e14..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/package-info.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * JDBC driver that uses remote procedure calls.
- */
-@PackageMarker
-package org.apache.calcite.avatica.remote;
-
-import org.apache.calcite.avatica.util.PackageMarker;
-
-// End package-info.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/util/AbstractCursor.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/util/AbstractCursor.java b/avatica/core/src/main/java/org/apache/calcite/avatica/util/AbstractCursor.java
deleted file mode 100644
index 77739ab..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/util/AbstractCursor.java
+++ /dev/null
@@ -1,1384 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.util;
-
-import org.apache.calcite.avatica.AvaticaSite;
-import org.apache.calcite.avatica.AvaticaUtils;
-import org.apache.calcite.avatica.ColumnMetaData;
-
-import java.io.InputStream;
-import java.io.Reader;
-import java.lang.reflect.Field;
-import java.math.BigDecimal;
-import java.math.RoundingMode;
-import java.net.URL;
-import java.nio.charset.StandardCharsets;
-import java.sql.Array;
-import java.sql.Blob;
-import java.sql.Clob;
-import java.sql.Date;
-import java.sql.NClob;
-import java.sql.Ref;
-import java.sql.SQLDataException;
-import java.sql.SQLException;
-import java.sql.SQLXML;
-import java.sql.Struct;
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.sql.Types;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Base class for implementing a cursor.
- *
- * <p>Derived class needs to provide {@link Getter} and can override
- * {@link org.apache.calcite.avatica.util.Cursor.Accessor} implementations if it
- * wishes.</p>
- */
-public abstract class AbstractCursor implements Cursor {
-  /**
-   * Slot into which each accessor should write whether the
-   * value returned was null.
-   */
-  protected final boolean[] wasNull = {false};
-
-  protected AbstractCursor() {
-  }
-
-  public boolean wasNull() {
-    return wasNull[0];
-  }
-
-  public List<Accessor> createAccessors(List<ColumnMetaData> types,
-      Calendar localCalendar, ArrayImpl.Factory factory) {
-    List<Accessor> accessors = new ArrayList<>();
-    for (ColumnMetaData type : types) {
-      accessors.add(
-          createAccessor(type, accessors.size(), localCalendar, factory));
-    }
-    return accessors;
-  }
-
-  protected Accessor createAccessor(ColumnMetaData columnMetaData, int ordinal,
-      Calendar localCalendar, ArrayImpl.Factory factory) {
-    // Create an accessor appropriate to the underlying type; the accessor
-    // can convert to any type in the same family.
-    Getter getter = createGetter(ordinal);
-    return createAccessor(columnMetaData, getter, localCalendar, factory);
-  }
-
-  protected Accessor createAccessor(ColumnMetaData columnMetaData,
-      Getter getter, Calendar localCalendar, ArrayImpl.Factory factory) {
-    switch (columnMetaData.type.rep) {
-    case NUMBER:
-      switch (columnMetaData.type.id) {
-      case Types.TINYINT:
-      case Types.SMALLINT:
-      case Types.INTEGER:
-      case Types.BIGINT:
-      case Types.REAL:
-      case Types.FLOAT:
-      case Types.DOUBLE:
-      case Types.NUMERIC:
-      case Types.DECIMAL:
-        return new NumberAccessor(getter, columnMetaData.scale);
-      }
-    }
-    switch (columnMetaData.type.id) {
-    case Types.TINYINT:
-      return new ByteAccessor(getter);
-    case Types.SMALLINT:
-      return new ShortAccessor(getter);
-    case Types.INTEGER:
-      return new IntAccessor(getter);
-    case Types.BIGINT:
-      return new LongAccessor(getter);
-    case Types.BOOLEAN:
-      return new BooleanAccessor(getter);
-    case Types.REAL:
-      return new FloatAccessor(getter);
-    case Types.FLOAT:
-    case Types.DOUBLE:
-      return new DoubleAccessor(getter);
-    case Types.DECIMAL:
-      return new BigDecimalAccessor(getter);
-    case Types.CHAR:
-      switch (columnMetaData.type.rep) {
-      case PRIMITIVE_CHAR:
-      case CHARACTER:
-        return new StringFromCharAccessor(getter, columnMetaData.displaySize);
-      default:
-        return new FixedStringAccessor(getter, columnMetaData.displaySize);
-      }
-    case Types.VARCHAR:
-      return new StringAccessor(getter);
-    case Types.BINARY:
-    case Types.VARBINARY:
-      switch (columnMetaData.type.rep) {
-      case STRING:
-        return new BinaryFromStringAccessor(getter);
-      default:
-        return new BinaryAccessor(getter);
-      }
-    case Types.DATE:
-      switch (columnMetaData.type.rep) {
-      case PRIMITIVE_INT:
-      case INTEGER:
-      case NUMBER:
-        return new DateFromNumberAccessor(getter, localCalendar);
-      case JAVA_SQL_DATE:
-        return new DateAccessor(getter);
-      default:
-        throw new AssertionError("bad " + columnMetaData.type.rep);
-      }
-    case Types.TIME:
-      switch (columnMetaData.type.rep) {
-      case PRIMITIVE_INT:
-      case INTEGER:
-      case NUMBER:
-        return new TimeFromNumberAccessor(getter, localCalendar);
-      case JAVA_SQL_TIME:
-        return new TimeAccessor(getter);
-      default:
-        throw new AssertionError("bad " + columnMetaData.type.rep);
-      }
-    case Types.TIMESTAMP:
-      switch (columnMetaData.type.rep) {
-      case PRIMITIVE_LONG:
-      case LONG:
-      case NUMBER:
-        return new TimestampFromNumberAccessor(getter, localCalendar);
-      case JAVA_SQL_TIMESTAMP:
-        return new TimestampAccessor(getter);
-      case JAVA_UTIL_DATE:
-        return new TimestampFromUtilDateAccessor(getter, localCalendar);
-      default:
-        throw new AssertionError("bad " + columnMetaData.type.rep);
-      }
-    case Types.ARRAY:
-      final ColumnMetaData.ArrayType arrayType =
-          (ColumnMetaData.ArrayType) columnMetaData.type;
-      final SlotGetter componentGetter = new SlotGetter();
-      final Accessor componentAccessor =
-          createAccessor(ColumnMetaData.dummy(arrayType.component, true),
-              componentGetter, localCalendar, factory);
-      return new ArrayAccessor(getter, arrayType.component, componentAccessor,
-          componentGetter, factory);
-    case Types.STRUCT:
-      switch (columnMetaData.type.rep) {
-      case OBJECT:
-        final ColumnMetaData.StructType structType =
-            (ColumnMetaData.StructType) columnMetaData.type;
-        List<Accessor> accessors = new ArrayList<>();
-        for (ColumnMetaData column : structType.columns) {
-          final Getter fieldGetter =
-              structType.columns.size() == 1
-                  ? getter
-                  : new StructGetter(getter, column);
-          accessors.add(
-              createAccessor(column, fieldGetter, localCalendar, factory));
-        }
-        return new StructAccessor(getter, accessors);
-      default:
-        throw new AssertionError("bad " + columnMetaData.type.rep);
-      }
-    case Types.JAVA_OBJECT:
-    case Types.OTHER: // e.g. map
-      if (columnMetaData.type.name.startsWith("INTERVAL_")) {
-        int end = columnMetaData.type.name.indexOf("(");
-        if (end < 0) {
-          end = columnMetaData.type.name.length();
-        }
-        TimeUnitRange range =
-            TimeUnitRange.valueOf(
-                columnMetaData.type.name.substring("INTERVAL_".length(), end));
-        if (range.monthly()) {
-          return new IntervalYearMonthAccessor(getter, range);
-        } else {
-          return new IntervalDayTimeAccessor(getter, range,
-              columnMetaData.scale);
-        }
-      }
-      return new ObjectAccessor(getter);
-    default:
-      throw new RuntimeException("unknown type " + columnMetaData.type.id);
-    }
-  }
-
-  protected abstract Getter createGetter(int ordinal);
-
-  public abstract boolean next();
-
-  /** Accesses a timestamp value as a string.
-   * The timestamp is in SQL format (e.g. "2013-09-22 22:30:32"),
-   * not Java format ("2013-09-22 22:30:32.123"). */
-  private static String timestampAsString(long v, Calendar calendar) {
-    if (calendar != null) {
-      v -= calendar.getTimeZone().getOffset(v);
-    }
-    return DateTimeUtils.unixTimestampToString(v);
-  }
-
-  /** Accesses a date value as a string, e.g. "2013-09-22". */
-  private static String dateAsString(int v, Calendar calendar) {
-    AvaticaUtils.discard(calendar); // time zone shift doesn't make sense
-    return DateTimeUtils.unixDateToString(v);
-  }
-
-  /** Accesses a time value as a string, e.g. "22:30:32". */
-  private static String timeAsString(int v, Calendar calendar) {
-    if (calendar != null) {
-      v -= calendar.getTimeZone().getOffset(v);
-    }
-    return DateTimeUtils.unixTimeToString(v);
-  }
-
-  private static Date longToDate(long v, Calendar calendar) {
-    if (calendar != null) {
-      v -= calendar.getTimeZone().getOffset(v);
-    }
-    return new Date(v);
-  }
-
-  static Time intToTime(int v, Calendar calendar) {
-    if (calendar != null) {
-      v -= calendar.getTimeZone().getOffset(v);
-    }
-    return new Time(v);
-  }
-
-  static Timestamp longToTimestamp(long v, Calendar calendar) {
-    if (calendar != null) {
-      v -= calendar.getTimeZone().getOffset(v);
-    }
-    return new Timestamp(v);
-  }
-
-  /** Implementation of {@link Cursor.Accessor}. */
-  static class AccessorImpl implements Accessor {
-    protected final Getter getter;
-
-    public AccessorImpl(Getter getter) {
-      assert getter != null;
-      this.getter = getter;
-    }
-
-    public boolean wasNull() throws SQLException {
-      return getter.wasNull();
-    }
-
-    public String getString() throws SQLException {
-      final Object o = getObject();
-      return o == null ? null : o.toString();
-    }
-
-    public boolean getBoolean() throws SQLException {
-      return getLong() != 0L;
-    }
-
-    public byte getByte() throws SQLException {
-      return (byte) getLong();
-    }
-
-    public short getShort() throws SQLException {
-      return (short) getLong();
-    }
-
-    public int getInt() throws SQLException {
-      return (int) getLong();
-    }
-
-    public long getLong() throws SQLException {
-      throw cannotConvert("long");
-    }
-
-    public float getFloat() throws SQLException {
-      return (float) getDouble();
-    }
-
-    public double getDouble() throws SQLException {
-      throw cannotConvert("double");
-    }
-
-    public BigDecimal getBigDecimal() throws SQLException {
-      throw cannotConvert("BigDecimal");
-    }
-
-    public BigDecimal getBigDecimal(int scale) throws SQLException {
-      throw cannotConvert("BigDecimal with scale");
-    }
-
-    public byte[] getBytes() throws SQLException {
-      throw cannotConvert("byte[]");
-    }
-
-    public InputStream getAsciiStream() throws SQLException {
-      throw cannotConvert("InputStream (ascii)");
-    }
-
-    public InputStream getUnicodeStream() throws SQLException {
-      throw cannotConvert("InputStream (unicode)");
-    }
-
-    public InputStream getBinaryStream() throws SQLException {
-      throw cannotConvert("InputStream (binary)");
-    }
-
-    public Object getObject() throws SQLException {
-      return getter.getObject();
-    }
-
-    public Reader getCharacterStream() throws SQLException {
-      throw cannotConvert("Reader");
-    }
-
-    private SQLException cannotConvert(String targetType) throws SQLException {
-      return new SQLDataException("cannot convert to " + targetType + " ("
-          + this + ")");
-    }
-
-    public Object getObject(Map<String, Class<?>> map) throws SQLException {
-      throw cannotConvert("Object (with map)");
-    }
-
-    public Ref getRef() throws SQLException {
-      throw cannotConvert("Ref");
-    }
-
-    public Blob getBlob() throws SQLException {
-      throw cannotConvert("Blob");
-    }
-
-    public Clob getClob() throws SQLException {
-      throw cannotConvert("Clob");
-    }
-
-    public Array getArray() throws SQLException {
-      throw cannotConvert("Array");
-    }
-
-    public Struct getStruct() throws SQLException {
-      throw cannotConvert("Struct");
-    }
-
-    public Date getDate(Calendar calendar) throws SQLException {
-      throw cannotConvert("Date");
-    }
-
-    public Time getTime(Calendar calendar) throws SQLException {
-      throw cannotConvert("Time");
-    }
-
-    public Timestamp getTimestamp(Calendar calendar) throws SQLException {
-      throw cannotConvert("Timestamp");
-    }
-
-    public URL getURL() throws SQLException {
-      throw cannotConvert("URL");
-    }
-
-    public NClob getNClob() throws SQLException {
-      throw cannotConvert("NClob");
-    }
-
-    public SQLXML getSQLXML() throws SQLException {
-      throw cannotConvert("SQLXML");
-    }
-
-    public String getNString() throws SQLException {
-      throw cannotConvert("NString");
-    }
-
-    public Reader getNCharacterStream() throws SQLException {
-      throw cannotConvert("NCharacterStream");
-    }
-
-    public <T> T getObject(Class<T> type) throws SQLException {
-      throw cannotConvert("Object (with type)");
-    }
-  }
-
-  /**
-   * Accessor of exact numeric values. The subclass must implement the
-   * {@link #getLong()} method.
-   */
-  private abstract static class ExactNumericAccessor extends AccessorImpl {
-    public ExactNumericAccessor(Getter getter) {
-      super(getter);
-    }
-
-    public BigDecimal getBigDecimal(int scale) throws SQLException {
-      final long v = getLong();
-      if (v == 0 && getter.wasNull()) {
-        return null;
-      }
-      return BigDecimal.valueOf(v).setScale(scale, RoundingMode.DOWN);
-    }
-
-    public BigDecimal getBigDecimal() throws SQLException {
-      final long val = getLong();
-      if (val == 0 && getter.wasNull()) {
-        return null;
-      }
-      return BigDecimal.valueOf(val);
-    }
-
-    public double getDouble() throws SQLException {
-      return getLong();
-    }
-
-    public float getFloat() throws SQLException {
-      return getLong();
-    }
-
-    public abstract long getLong() throws SQLException;
-  }
-
-  /**
-   * Accessor that assumes that the underlying value is a {@link Boolean};
-   * corresponds to {@link java.sql.Types#BOOLEAN}.
-   */
-  private static class BooleanAccessor extends ExactNumericAccessor {
-    public BooleanAccessor(Getter getter) {
-      super(getter);
-    }
-
-    public boolean getBoolean() throws SQLException {
-      Boolean o = (Boolean) getObject();
-      return o != null && o;
-    }
-
-    public long getLong() throws SQLException {
-      return getBoolean() ? 1 : 0;
-    }
-  }
-
-  /**
-   * Accessor that assumes that the underlying value is a {@link Byte};
-   * corresponds to {@link java.sql.Types#TINYINT}.
-   */
-  private static class ByteAccessor extends ExactNumericAccessor {
-    public ByteAccessor(Getter getter) {
-      super(getter);
-    }
-
-    public byte getByte() throws SQLException {
-      Byte o = (Byte) getObject();
-      return o == null ? 0 : o;
-    }
-
-    public long getLong() throws SQLException {
-      return getByte();
-    }
-  }
-
-  /**
-   * Accessor that assumes that the underlying value is a {@link Short};
-   * corresponds to {@link java.sql.Types#SMALLINT}.
-   */
-  private static class ShortAccessor extends ExactNumericAccessor {
-    public ShortAccessor(Getter getter) {
-      super(getter);
-    }
-
-    public short getShort() throws SQLException {
-      Short o = (Short) getObject();
-      return o == null ? 0 : o;
-    }
-
-    public long getLong() throws SQLException {
-      return getShort();
-    }
-  }
-
-  /**
-   * Accessor that assumes that the underlying value is an {@link Integer};
-   * corresponds to {@link java.sql.Types#INTEGER}.
-   */
-  private static class IntAccessor extends ExactNumericAccessor {
-    public IntAccessor(Getter getter) {
-      super(getter);
-    }
-
-    public int getInt() throws SQLException {
-      Integer o = (Integer) super.getObject();
-      return o == null ? 0 : o;
-    }
-
-    public long getLong() throws SQLException {
-      return getInt();
-    }
-  }
-
-  /**
-   * Accessor that assumes that the underlying value is a {@link Long};
-   * corresponds to {@link java.sql.Types#BIGINT}.
-   */
-  private static class LongAccessor extends ExactNumericAccessor {
-    public LongAccessor(Getter getter) {
-      super(getter);
-    }
-
-    public long getLong() throws SQLException {
-      Long o = (Long) super.getObject();
-      return o == null ? 0 : o;
-    }
-  }
-
-  /**
-   * Accessor of values that are {@link Double} or null.
-   */
-  private abstract static class ApproximateNumericAccessor
-      extends AccessorImpl {
-    public ApproximateNumericAccessor(Getter getter) {
-      super(getter);
-    }
-
-    public BigDecimal getBigDecimal(int scale) throws SQLException {
-      final double v = getDouble();
-      if (v == 0d && getter.wasNull()) {
-        return null;
-      }
-      return BigDecimal.valueOf(v).setScale(scale, RoundingMode.DOWN);
-    }
-
-    public BigDecimal getBigDecimal() throws SQLException {
-      final double v = getDouble();
-      if (v == 0 && getter.wasNull()) {
-        return null;
-      }
-      return BigDecimal.valueOf(v);
-    }
-
-    public abstract double getDouble() throws SQLException;
-
-    public long getLong() throws SQLException {
-      return (long) getDouble();
-    }
-  }
-
-  /**
-   * Accessor that assumes that the underlying value is a {@link Float};
-   * corresponds to {@link java.sql.Types#FLOAT}.
-   */
-  private static class FloatAccessor extends ApproximateNumericAccessor {
-    public FloatAccessor(Getter getter) {
-      super(getter);
-    }
-
-    public float getFloat() throws SQLException {
-      Float o = (Float) getObject();
-      return o == null ? 0f : o;
-    }
-
-    public double getDouble() throws SQLException {
-      return getFloat();
-    }
-  }
-
-  /**
-   * Accessor that assumes that the underlying value is a {@link Double};
-   * corresponds to {@link java.sql.Types#DOUBLE}.
-   */
-  private static class DoubleAccessor extends ApproximateNumericAccessor {
-    public DoubleAccessor(Getter getter) {
-      super(getter);
-    }
-
-    public double getDouble() throws SQLException {
-      Double o = (Double) getObject();
-      return o == null ? 0d : o;
-    }
-  }
-
-  /**
-   * Accessor of exact numeric values. The subclass must implement the
-   * {@link #getLong()} method.
-   */
-  private abstract static class BigNumberAccessor extends AccessorImpl {
-    public BigNumberAccessor(Getter getter) {
-      super(getter);
-    }
-
-    protected abstract Number getNumber() throws SQLException;
-
-    public double getDouble() throws SQLException {
-      Number number = getNumber();
-      return number == null ? 0d : number.doubleValue();
-    }
-
-    public float getFloat() throws SQLException {
-      Number number = getNumber();
-      return number == null ? 0f : number.floatValue();
-    }
-
-    public long getLong() throws SQLException {
-      Number number = getNumber();
-      return number == null ? 0L : number.longValue();
-    }
-
-    public int getInt() throws SQLException {
-      Number number = getNumber();
-      return number == null ? 0 : number.intValue();
-    }
-
-    public short getShort() throws SQLException {
-      Number number = getNumber();
-      return number == null ? 0 : number.shortValue();
-    }
-
-    public byte getByte() throws SQLException {
-      Number number = getNumber();
-      return number == null ? 0 : number.byteValue();
-    }
-
-    public boolean getBoolean() throws SQLException {
-      Number number = getNumber();
-      return number != null && number.doubleValue() != 0;
-    }
-  }
-
-  /**
-   * Accessor that assumes that the underlying value is a {@link BigDecimal};
-   * corresponds to {@link java.sql.Types#DECIMAL}.
-   */
-  private static class BigDecimalAccessor extends BigNumberAccessor {
-    public BigDecimalAccessor(Getter getter) {
-      super(getter);
-    }
-
-    protected Number getNumber() throws SQLException {
-      return (Number) getObject();
-    }
-
-    public BigDecimal getBigDecimal(int scale) throws SQLException {
-      return (BigDecimal) getObject();
-    }
-
-    public BigDecimal getBigDecimal() throws SQLException {
-      return (BigDecimal) getObject();
-    }
-  }
-
-  /**
-   * Accessor that assumes that the underlying value is a {@link Number};
-   * corresponds to {@link java.sql.Types#NUMERIC}.
-   *
-   * <p>This is useful when numbers have been translated over JSON. JSON
-   * converts a 0L (0 long) value to the string "0" and back to 0 (0 int).
-   * So you cannot be sure that the source and target type are the same.
-   */
-  static class NumberAccessor extends BigNumberAccessor {
-    private final int scale;
-
-    public NumberAccessor(Getter getter, int scale) {
-      super(getter);
-      this.scale = scale;
-    }
-
-    protected Number getNumber() throws SQLException {
-      return (Number) super.getObject();
-    }
-
-    public BigDecimal getBigDecimal(int scale) throws SQLException {
-      Number n = getNumber();
-      if (n == null) {
-        return null;
-      }
-      BigDecimal decimal = AvaticaSite.toBigDecimal(n);
-      if (0 != scale) {
-        return decimal.setScale(scale, RoundingMode.UNNECESSARY);
-      }
-      return decimal;
-    }
-
-    public BigDecimal getBigDecimal() throws SQLException {
-      return getBigDecimal(scale);
-    }
-  }
-
-  /**
-   * Accessor that assumes that the underlying value is a {@link String};
-   * corresponds to {@link java.sql.Types#CHAR}
-   * and {@link java.sql.Types#VARCHAR}.
-   */
-  private static class StringAccessor extends AccessorImpl {
-    public StringAccessor(Getter getter) {
-      super(getter);
-    }
-
-    public String getString() throws SQLException {
-      return (String) getObject();
-    }
-
-    @Override public byte[] getBytes() throws SQLException {
-      return super.getBytes();
-    }
-  }
-
-  /**
-   * Accessor that assumes that the underlying value is a {@link String};
-   * corresponds to {@link java.sql.Types#CHAR}.
-   */
-  private static class FixedStringAccessor extends StringAccessor {
-    protected final Spacer spacer;
-
-    public FixedStringAccessor(Getter getter, int length) {
-      super(getter);
-      this.spacer = new Spacer(length);
-    }
-
-    public String getString() throws SQLException {
-      String s = super.getString();
-      if (s == null) {
-        return null;
-      }
-      return spacer.padRight(s);
-    }
-  }
-
-  /**
-   * Accessor that assumes that the underlying value is a {@link String};
-   * corresponds to {@link java.sql.Types#CHAR}.
-   */
-  private static class StringFromCharAccessor extends FixedStringAccessor {
-    public StringFromCharAccessor(Getter getter, int length) {
-      super(getter, length);
-    }
-
-    public String getString() throws SQLException {
-      Character s = (Character) super.getObject();
-      if (s == null) {
-        return null;
-      }
-      return spacer.padRight(s.toString());
-    }
-  }
-
-  /**
-   * Accessor that assumes that the underlying value is an array of
-   * {@link org.apache.calcite.avatica.util.ByteString} values;
-   * corresponds to {@link java.sql.Types#BINARY}
-   * and {@link java.sql.Types#VARBINARY}.
-   */
-  private static class BinaryAccessor extends AccessorImpl {
-    public BinaryAccessor(Getter getter) {
-      super(getter);
-    }
-
-    //FIXME: Protobuf gets byte[]
-    @Override public byte[] getBytes() throws SQLException {
-      Object obj = getObject();
-      if (null == obj) {
-        return null;
-      }
-      if (obj instanceof ByteString) {
-        return ((ByteString) obj).getBytes();
-      } else if (obj instanceof String) {
-        return ((String) obj).getBytes(StandardCharsets.UTF_8);
-      } else if (obj instanceof byte[]) {
-        return (byte[]) obj;
-      } else {
-        throw new RuntimeException("Cannot handle " + obj.getClass() + " as bytes");
-      }
-    }
-
-    @Override public String getString() throws SQLException {
-      Object o = getObject();
-      if (null == o) {
-        return null;
-      }
-      if (o instanceof byte[]) {
-        return new String((byte[]) o, StandardCharsets.UTF_8);
-      } else if (o instanceof ByteString) {
-        return ((ByteString) o).toString();
-      }
-      throw new IllegalStateException("Unhandled value type: " + o.getClass());
-    }
-  }
-
-  /**
-   * Accessor that assumes that the underlying value is a {@link String},
-   * encoding {@link java.sql.Types#BINARY}
-   * and {@link java.sql.Types#VARBINARY} values in Base64 format.
-   */
-  private static class BinaryFromStringAccessor extends StringAccessor {
-    public BinaryFromStringAccessor(Getter getter) {
-      super(getter);
-    }
-
-    @Override public Object getObject() throws SQLException {
-      return super.getObject();
-    }
-
-    @Override public byte[] getBytes() throws SQLException {
-      // JSON sends this as a base64-enc string, protobuf can do binary.
-      Object obj = getObject();
-
-      if (obj instanceof byte[]) {
-        // If we already have bytes, just send them back.
-        return (byte[]) obj;
-      }
-
-      return getBase64Decoded();
-    }
-
-    private byte[] getBase64Decoded() throws SQLException {
-      final String string = super.getString();
-      if (null == string) {
-        return null;
-      }
-      // Need to base64 decode the string.
-      return ByteString.parseBase64(string);
-    }
-
-    @Override public String getString() throws SQLException {
-      final byte[] bytes = getBase64Decoded();
-      if (null == bytes) {
-        return null;
-      }
-      // Need to base64 decode the string.
-      return new String(bytes, StandardCharsets.UTF_8);
-    }
-  }
-
-  /**
-   * Accessor that assumes that the underlying value is a DATE,
-   * in its default representation {@code int};
-   * corresponds to {@link java.sql.Types#DATE}.
-   */
-  private static class DateFromNumberAccessor extends NumberAccessor {
-    private final Calendar localCalendar;
-
-    public DateFromNumberAccessor(Getter getter, Calendar localCalendar) {
-      super(getter, 0);
-      this.localCalendar = localCalendar;
-    }
-
-    @Override public Object getObject() throws SQLException {
-      return getDate(localCalendar);
-    }
-
-    @Override public Date getDate(Calendar calendar) throws SQLException {
-      final Number v = getNumber();
-      if (v == null) {
-        return null;
-      }
-      return longToDate(v.longValue() * DateTimeUtils.MILLIS_PER_DAY, calendar);
-    }
-
-    @Override public Timestamp getTimestamp(Calendar calendar) throws SQLException {
-      final Number v = getNumber();
-      if (v == null) {
-        return null;
-      }
-      return longToTimestamp(v.longValue() * DateTimeUtils.MILLIS_PER_DAY,
-          calendar);
-    }
-
-    @Override public String getString() throws SQLException {
-      final Number v = getNumber();
-      if (v == null) {
-        return null;
-      }
-      return dateAsString(v.intValue(), null);
-    }
-  }
-
-  /**
-   * Accessor that assumes that the underlying value is a Time,
-   * in its default representation {@code int};
-   * corresponds to {@link java.sql.Types#TIME}.
-   */
-  private static class TimeFromNumberAccessor extends NumberAccessor {
-    private final Calendar localCalendar;
-
-    public TimeFromNumberAccessor(Getter getter, Calendar localCalendar) {
-      super(getter, 0);
-      this.localCalendar = localCalendar;
-    }
-
-    @Override public Object getObject() throws SQLException {
-      return getTime(localCalendar);
-    }
-
-    @Override public Time getTime(Calendar calendar) throws SQLException {
-      final Number v = getNumber();
-      if (v == null) {
-        return null;
-      }
-      return intToTime(v.intValue(), calendar);
-    }
-
-    @Override public Timestamp getTimestamp(Calendar calendar) throws SQLException {
-      final Number v = getNumber();
-      if (v == null) {
-        return null;
-      }
-      return longToTimestamp(v.longValue(), calendar);
-    }
-
-    @Override public String getString() throws SQLException {
-      final Number v = getNumber();
-      if (v == null) {
-        return null;
-      }
-      return timeAsString(v.intValue(), null);
-    }
-  }
-
-  /**
-   * Accessor that assumes that the underlying value is a TIMESTAMP,
-   * in its default representation {@code long};
-   * corresponds to {@link java.sql.Types#TIMESTAMP}.
-   */
-  private static class TimestampFromNumberAccessor extends NumberAccessor {
-    private final Calendar localCalendar;
-
-    public TimestampFromNumberAccessor(Getter getter, Calendar localCalendar) {
-      super(getter, 0);
-      this.localCalendar = localCalendar;
-    }
-
-    @Override public Object getObject() throws SQLException {
-      return getTimestamp(localCalendar);
-    }
-
-    @Override public Timestamp getTimestamp(Calendar calendar) throws SQLException {
-      final Number v = getNumber();
-      if (v == null) {
-        return null;
-      }
-      return longToTimestamp(v.longValue(), calendar);
-    }
-
-    @Override public Date getDate(Calendar calendar) throws SQLException {
-      final Timestamp timestamp  = getTimestamp(calendar);
-      if (timestamp == null) {
-        return null;
-      }
-      return new Date(timestamp.getTime());
-    }
-
-    @Override public Time getTime(Calendar calendar) throws SQLException {
-      final Timestamp timestamp  = getTimestamp(calendar);
-      if (timestamp == null) {
-        return null;
-      }
-      return new Time(
-          DateTimeUtils.floorMod(timestamp.getTime(),
-              DateTimeUtils.MILLIS_PER_DAY));
-    }
-
-    @Override public String getString() throws SQLException {
-      final Number v = getNumber();
-      if (v == null) {
-        return null;
-      }
-      return timestampAsString(v.longValue(), null);
-    }
-  }
-
-  /**
-   * Accessor that assumes that the underlying value is a DATE,
-   * represented as a java.sql.Date;
-   * corresponds to {@link java.sql.Types#DATE}.
-   */
-  private static class DateAccessor extends ObjectAccessor {
-    public DateAccessor(Getter getter) {
-      super(getter);
-    }
-
-    @Override public Date getDate(Calendar calendar) throws SQLException {
-      java.sql.Date date = (Date) getObject();
-      if (date == null) {
-        return null;
-      }
-      if (calendar != null) {
-        long v = date.getTime();
-        v -= calendar.getTimeZone().getOffset(v);
-        date = new Date(v);
-      }
-      return date;
-    }
-
-    @Override public String getString() throws SQLException {
-      final int v = getInt();
-      if (v == 0 && wasNull()) {
-        return null;
-      }
-      return dateAsString(v, null);
-    }
-
-    @Override public long getLong() throws SQLException {
-      Date date = getDate(null);
-      return date == null
-          ? 0L
-          : (date.getTime() / DateTimeUtils.MILLIS_PER_DAY);
-    }
-  }
-
-  /**
-   * Accessor that assumes that the underlying value is a TIME,
-   * represented as a java.sql.Time;
-   * corresponds to {@link java.sql.Types#TIME}.
-   */
-  private static class TimeAccessor extends ObjectAccessor {
-    public TimeAccessor(Getter getter) {
-      super(getter);
-    }
-
-    @Override public Time getTime(Calendar calendar) throws SQLException {
-      Time date  = (Time) getObject();
-      if (date == null) {
-        return null;
-      }
-      if (calendar != null) {
-        long v = date.getTime();
-        v -= calendar.getTimeZone().getOffset(v);
-        date = new Time(v);
-      }
-      return date;
-    }
-
-    @Override public String getString() throws SQLException {
-      final int v = getInt();
-      if (v == 0 && wasNull()) {
-        return null;
-      }
-      return timeAsString(v, null);
-    }
-
-    @Override public long getLong() throws SQLException {
-      Time time = getTime(null);
-      return time == null ? 0L
-          : (time.getTime() % DateTimeUtils.MILLIS_PER_DAY);
-    }
-  }
-
-  /**
-   * Accessor that assumes that the underlying value is a TIMESTAMP,
-   * represented as a java.sql.Timestamp;
-   * corresponds to {@link java.sql.Types#TIMESTAMP}.
-   */
-  private static class TimestampAccessor extends ObjectAccessor {
-    public TimestampAccessor(Getter getter) {
-      super(getter);
-    }
-
-    @Override public Timestamp getTimestamp(Calendar calendar) throws SQLException {
-      Timestamp timestamp  = (Timestamp) getObject();
-      if (timestamp == null) {
-        return null;
-      }
-      if (calendar != null) {
-        long v = timestamp.getTime();
-        v -= calendar.getTimeZone().getOffset(v);
-        timestamp = new Timestamp(v);
-      }
-      return timestamp;
-    }
-
-    @Override public Date getDate(Calendar calendar) throws SQLException {
-      final Timestamp timestamp  = getTimestamp(calendar);
-      if (timestamp == null) {
-        return null;
-      }
-      return new Date(timestamp.getTime());
-    }
-
-    @Override public Time getTime(Calendar calendar) throws SQLException {
-      final Timestamp timestamp  = getTimestamp(calendar);
-      if (timestamp == null) {
-        return null;
-      }
-      return new Time(
-          DateTimeUtils.floorMod(timestamp.getTime(),
-              DateTimeUtils.MILLIS_PER_DAY));
-    }
-
-    @Override public String getString() throws SQLException {
-      final long v = getLong();
-      if (v == 0 && wasNull()) {
-        return null;
-      }
-      return timestampAsString(v, null);
-    }
-
-    @Override public long getLong() throws SQLException {
-      Timestamp timestamp = getTimestamp(null);
-      return timestamp == null ? 0 : timestamp.getTime();
-    }
-  }
-
-  /**
-   * Accessor that assumes that the underlying value is a TIMESTAMP,
-   * represented as a java.util.Date;
-   * corresponds to {@link java.sql.Types#TIMESTAMP}.
-   */
-  private static class TimestampFromUtilDateAccessor extends ObjectAccessor {
-    private final Calendar localCalendar;
-
-    public TimestampFromUtilDateAccessor(Getter getter,
-        Calendar localCalendar) {
-      super(getter);
-      this.localCalendar = localCalendar;
-    }
-
-    @Override public Timestamp getTimestamp(Calendar calendar) throws SQLException {
-      java.util.Date date  = (java.util.Date) getObject();
-      if (date == null) {
-        return null;
-      }
-      long v = date.getTime();
-      if (calendar != null) {
-        v -= calendar.getTimeZone().getOffset(v);
-      }
-      return new Timestamp(v);
-    }
-
-    @Override public Date getDate(Calendar calendar) throws SQLException {
-      final Timestamp timestamp  = getTimestamp(calendar);
-      if (timestamp == null) {
-        return null;
-      }
-      return new Date(timestamp.getTime());
-    }
-
-    @Override public Time getTime(Calendar calendar) throws SQLException {
-      final Timestamp timestamp  = getTimestamp(calendar);
-      if (timestamp == null) {
-        return null;
-      }
-      return new Time(
-          DateTimeUtils.floorMod(timestamp.getTime(),
-              DateTimeUtils.MILLIS_PER_DAY));
-    }
-
-    @Override public String getString() throws SQLException {
-      java.util.Date date  = (java.util.Date) getObject();
-      if (date == null) {
-        return null;
-      }
-      return timestampAsString(date.getTime(), null);
-    }
-
-    @Override public long getLong() throws SQLException {
-      Timestamp timestamp = getTimestamp(localCalendar);
-      return timestamp == null ? 0 : timestamp.getTime();
-    }
-  }
-
-  /**
-   * Accessor that assumes that the underlying value is a {@code int};
-   * corresponds to {@link java.sql.Types#OTHER}.
-   */
-  private static class IntervalYearMonthAccessor extends IntAccessor {
-    private final TimeUnitRange range;
-
-    public IntervalYearMonthAccessor(Getter getter, TimeUnitRange range) {
-      super(getter);
-      this.range = range;
-    }
-
-    @Override public String getString() throws SQLException {
-      final int v = getInt();
-      if (v == 0 && wasNull()) {
-        return null;
-      }
-      return DateTimeUtils.intervalYearMonthToString(v, range);
-    }
-  }
-
-  /**
-   * Accessor that assumes that the underlying value is a {@code long};
-   * corresponds to {@link java.sql.Types#OTHER}.
-   */
-  private static class IntervalDayTimeAccessor extends LongAccessor {
-    private final TimeUnitRange range;
-    private final int scale;
-
-    public IntervalDayTimeAccessor(Getter getter, TimeUnitRange range,
-        int scale) {
-      super(getter);
-      this.range = range;
-      this.scale = scale;
-    }
-
-    @Override public String getString() throws SQLException {
-      final long v = getLong();
-      if (v == 0 && wasNull()) {
-        return null;
-      }
-      return DateTimeUtils.intervalDayTimeToString(v, range, scale);
-    }
-  }
-
-  /**
-   * Accessor that assumes that the underlying value is an ARRAY;
-   * corresponds to {@link java.sql.Types#ARRAY}.
-   */
-  static class ArrayAccessor extends AccessorImpl {
-    final ColumnMetaData.AvaticaType componentType;
-    final Accessor componentAccessor;
-    final SlotGetter componentSlotGetter;
-    final ArrayImpl.Factory factory;
-
-    public ArrayAccessor(Getter getter,
-        ColumnMetaData.AvaticaType componentType, Accessor componentAccessor,
-        SlotGetter componentSlotGetter, ArrayImpl.Factory factory) {
-      super(getter);
-      this.componentType = componentType;
-      this.componentAccessor = componentAccessor;
-      this.componentSlotGetter = componentSlotGetter;
-      this.factory = factory;
-    }
-
-    @Override public Object getObject() throws SQLException {
-      final Object object = super.getObject();
-      if (object == null || object instanceof List) {
-        return object;
-      }
-      // The object can be java array in case of user-provided class for row
-      // storage.
-      return AvaticaUtils.primitiveList(object);
-    }
-
-    @Override public Array getArray() throws SQLException {
-      final List list = (List) getObject();
-      if (list == null) {
-        return null;
-      }
-      return new ArrayImpl(list, this);
-    }
-
-    @Override public String getString() throws SQLException {
-      final Array array = getArray();
-      return array == null ? null : array.toString();
-    }
-  }
-
-  /**
-   * Accessor that assumes that the underlying value is a STRUCT;
-   * corresponds to {@link java.sql.Types#STRUCT}.
-   */
-  private static class StructAccessor extends AccessorImpl {
-    private final List<Accessor> fieldAccessors;
-
-    public StructAccessor(Getter getter, List<Accessor> fieldAccessors) {
-      super(getter);
-      this.fieldAccessors = fieldAccessors;
-    }
-
-    @Override public Object getObject() throws SQLException {
-      return getStruct();
-    }
-
-    @Override public Struct getStruct() throws SQLException {
-      final Object o = super.getObject();
-      if (o == null) {
-        return null;
-      } else if (o instanceof List) {
-        return new StructImpl((List) o);
-      } else {
-        final List<Object> list = new ArrayList<>();
-        for (Accessor fieldAccessor : fieldAccessors) {
-          try {
-            list.add(fieldAccessor.getObject());
-          } catch (SQLException e) {
-            throw new RuntimeException(e);
-          }
-        }
-        return new StructImpl(list);
-      }
-    }
-  }
-
-  /**
-   * Accessor that assumes that the underlying value is an OBJECT;
-   * corresponds to {@link java.sql.Types#JAVA_OBJECT}.
-   */
-  private static class ObjectAccessor extends AccessorImpl {
-    public ObjectAccessor(Getter getter) {
-      super(getter);
-    }
-  }
-
-  /** Gets a value from a particular field of the current record of this
-   * cursor. */
-  protected interface Getter {
-    Object getObject();
-
-    boolean wasNull();
-  }
-
-  /** Abstract implementation of {@link Getter}. */
-  protected abstract class AbstractGetter implements Getter {
-    public boolean wasNull() {
-      return wasNull[0];
-    }
-  }
-
-  /** Implementation of {@link Getter} that returns the current contents of
-   * a mutable slot. */
-  public class SlotGetter implements Getter {
-    public Object slot;
-
-    public Object getObject() {
-      return slot;
-    }
-
-    public boolean wasNull() {
-      return slot == null;
-    }
-  }
-
-  /** Implementation of {@link Getter} that returns the value of a given field
-   * of the current contents of another getter. */
-  public class StructGetter implements Getter {
-    public final Getter getter;
-    private final ColumnMetaData columnMetaData;
-
-    public StructGetter(Getter getter, ColumnMetaData columnMetaData) {
-      this.getter = getter;
-      this.columnMetaData = columnMetaData;
-    }
-
-    public Object getObject() {
-      final Object o = getter.getObject();
-      if (o instanceof Object[]) {
-        Object[] objects = (Object[]) o;
-        return objects[columnMetaData.ordinal];
-      }
-      try {
-        final Field field = o.getClass().getField(columnMetaData.label);
-        return field.get(getter.getObject());
-      } catch (IllegalAccessException | NoSuchFieldException e) {
-        throw new RuntimeException(e);
-      }
-    }
-
-    public boolean wasNull() {
-      return getObject() == null;
-    }
-  }
-}
-
-// End AbstractCursor.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/util/ArrayImpl.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/util/ArrayImpl.java b/avatica/core/src/main/java/org/apache/calcite/avatica/util/ArrayImpl.java
deleted file mode 100644
index b2d5ae9..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/util/ArrayImpl.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.util;
-
-import org.apache.calcite.avatica.AvaticaUtils;
-import org.apache.calcite.avatica.ColumnMetaData;
-
-import java.sql.Array;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Types;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-/** Implementation of JDBC {@link Array}. */
-public class ArrayImpl implements Array {
-  private final List list;
-  private final AbstractCursor.ArrayAccessor accessor;
-
-  public ArrayImpl(List list, AbstractCursor.ArrayAccessor accessor) {
-    this.list = list;
-    this.accessor = accessor;
-  }
-
-  public String getBaseTypeName() throws SQLException {
-    return accessor.componentType.name;
-  }
-
-  public int getBaseType() throws SQLException {
-    return accessor.componentType.id;
-  }
-
-  public Object getArray() throws SQLException {
-    return getArray(list);
-  }
-
-  @Override public String toString() {
-    final Iterator iterator = list.iterator();
-    if (!iterator.hasNext()) {
-      return "[]";
-    }
-    final StringBuilder buf = new StringBuilder("[");
-    for (;;) {
-      accessor.componentSlotGetter.slot = iterator.next();
-      try {
-        append(buf, accessor.componentAccessor.getString());
-      } catch (SQLException e) {
-        throw new RuntimeException(e);
-      }
-      accessor.componentSlotGetter.slot = null;
-      if (!iterator.hasNext()) {
-        return buf.append("]").toString();
-      }
-      buf.append(", ");
-    }
-  }
-
-  private void append(StringBuilder buf, Object o) {
-    if (o == null) {
-      buf.append("null");
-    } else if (o.getClass().isArray()) {
-      append(buf, AvaticaUtils.primitiveList(o));
-    } else {
-      buf.append(o);
-    }
-  }
-
-  /**
-   * Converts a list into an array.
-   *
-   * <p>If the elements of the list are primitives, converts to an array of
-   * primitives (e.g. {@code boolean[]}.</p>
-   *
-   * @param list List of objects
-   *
-   * @return array
-   * @throws ClassCastException   if any element is not of the box type
-   * @throws NullPointerException if any element is null
-   */
-  @SuppressWarnings("unchecked")
-  protected Object getArray(List list) throws SQLException {
-    int i = 0;
-    switch (accessor.componentType.rep) {
-    case PRIMITIVE_DOUBLE:
-      final double[] doubles = new double[list.size()];
-      for (double v : (List<Double>) list) {
-        doubles[i++] = v;
-      }
-      return doubles;
-    case PRIMITIVE_FLOAT:
-      final float[] floats = new float[list.size()];
-      for (float v : (List<Float>) list) {
-        floats[i++] = v;
-      }
-      return floats;
-    case PRIMITIVE_INT:
-      final int[] ints = new int[list.size()];
-      for (int v : (List<Integer>) list) {
-        ints[i++] = v;
-      }
-      return ints;
-    case PRIMITIVE_LONG:
-      final long[] longs = new long[list.size()];
-      for (long v : (List<Long>) list) {
-        longs[i++] = v;
-      }
-      return longs;
-    case PRIMITIVE_SHORT:
-      final short[] shorts = new short[list.size()];
-      for (short v : (List<Short>) list) {
-        shorts[i++] = v;
-      }
-      return shorts;
-    case PRIMITIVE_BOOLEAN:
-      final boolean[] booleans = new boolean[list.size()];
-      for (boolean v : (List<Boolean>) list) {
-        booleans[i++] = v;
-      }
-      return booleans;
-    case PRIMITIVE_BYTE:
-      final byte[] bytes = new byte[list.size()];
-      for (byte v : (List<Byte>) list) {
-        bytes[i++] = v;
-      }
-      return bytes;
-    case PRIMITIVE_CHAR:
-      final char[] chars = new char[list.size()];
-      for (char v : (List<Character>) list) {
-        chars[i++] = v;
-      }
-      return chars;
-    default:
-      // fall through
-    }
-    final Object[] objects = list.toArray();
-    switch (accessor.componentType.id) {
-    case Types.ARRAY:
-      final AbstractCursor.ArrayAccessor componentAccessor =
-          (AbstractCursor.ArrayAccessor) accessor.componentAccessor;
-      for (i = 0; i < objects.length; i++) {
-        objects[i] = new ArrayImpl((List) objects[i], componentAccessor);
-      }
-    }
-    return objects;
-  }
-
-  public Object getArray(Map<String, Class<?>> map) throws SQLException {
-    throw new UnsupportedOperationException(); // TODO
-  }
-
-  public Object getArray(long index, int count) throws SQLException {
-    return getArray(list.subList((int) index, count));
-  }
-
-  public Object getArray(long index, int count, Map<String, Class<?>> map)
-      throws SQLException {
-    throw new UnsupportedOperationException(); // TODO
-  }
-
-  public ResultSet getResultSet() throws SQLException {
-    return accessor.factory.create(accessor.componentType, list);
-  }
-
-  public ResultSet getResultSet(Map<String, Class<?>> map)
-      throws SQLException {
-    throw new UnsupportedOperationException(); // TODO
-  }
-
-  public ResultSet getResultSet(long index, int count) throws SQLException {
-    throw new UnsupportedOperationException(); // TODO
-  }
-
-  public ResultSet getResultSet(long index, int count,
-      Map<String, Class<?>> map) throws SQLException {
-    throw new UnsupportedOperationException(); // TODO
-  }
-
-  public void free() throws SQLException {
-    // nothing to do
-  }
-
-  /** Factory that can create a result set based on a list of values. */
-  public interface Factory {
-    ResultSet create(ColumnMetaData.AvaticaType elementType,
-        Iterable<Object> iterable);
-  }
-}
-
-// End ArrayImpl.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/util/ArrayIteratorCursor.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/util/ArrayIteratorCursor.java b/avatica/core/src/main/java/org/apache/calcite/avatica/util/ArrayIteratorCursor.java
deleted file mode 100644
index 0477984..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/util/ArrayIteratorCursor.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.util;
-
-import java.util.Iterator;
-
-/**
- * Implementation of {@link Cursor} on top of an
- * {@link java.util.Iterator} that
- * returns an array of {@link Object} for each row.
- */
-public class ArrayIteratorCursor extends IteratorCursor<Object[]> {
-  /**
-   * Creates an ArrayEnumeratorCursor.
-   *
-   * @param iterator Iterator
-   */
-  public ArrayIteratorCursor(Iterator<Object[]> iterator) {
-    super(iterator);
-  }
-
-  protected Getter createGetter(int ordinal) {
-    return new ArrayGetter(ordinal);
-  }
-}
-
-// End ArrayIteratorCursor.java


[24/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/server/src/main/java/org/apache/calcite/avatica/server/MetricsAwareAvaticaHandler.java
----------------------------------------------------------------------
diff --git a/avatica/server/src/main/java/org/apache/calcite/avatica/server/MetricsAwareAvaticaHandler.java b/avatica/server/src/main/java/org/apache/calcite/avatica/server/MetricsAwareAvaticaHandler.java
deleted file mode 100644
index 0914dbd..0000000
--- a/avatica/server/src/main/java/org/apache/calcite/avatica/server/MetricsAwareAvaticaHandler.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.server;
-
-import org.apache.calcite.avatica.metrics.MetricsSystem;
-
-/**
- * An {@link AvaticaHandler} that is capable of collecting metrics.
- */
-public interface MetricsAwareAvaticaHandler extends AvaticaHandler {
-
-  /**
-   * General prefix for all metrics in a handler.
-   */
-  String HANDLER_PREFIX = "Handler.";
-
-  /**
-   * Name for timing requests from users
-   */
-  String REQUEST_TIMER_NAME = HANDLER_PREFIX + "RequestTimings";
-
-  /**
-   * @return An instance of the {@link MetricsSystem} for this AvaticaHandler.
-   */
-  MetricsSystem getMetrics();
-
-}
-
-// End MetricsAwareAvaticaHandler.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/server/src/main/java/org/apache/calcite/avatica/server/PropertyBasedSpnegoLoginService.java
----------------------------------------------------------------------
diff --git a/avatica/server/src/main/java/org/apache/calcite/avatica/server/PropertyBasedSpnegoLoginService.java b/avatica/server/src/main/java/org/apache/calcite/avatica/server/PropertyBasedSpnegoLoginService.java
deleted file mode 100644
index 9e373fb..0000000
--- a/avatica/server/src/main/java/org/apache/calcite/avatica/server/PropertyBasedSpnegoLoginService.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.server;
-
-import org.eclipse.jetty.security.SpnegoLoginService;
-
-import java.lang.reflect.Field;
-import java.util.Objects;
-
-/**
- * A customization of {@link SpnegoLoginService} which directly specifies the server's
- * principal instead of requiring a file to exist. Known to work with Jetty-9.2.x, any other
- * version would require testing/inspection to ensure the logic is still sound.
- */
-public class PropertyBasedSpnegoLoginService extends SpnegoLoginService {
-
-  private static final String TARGET_NAME_FIELD_NAME = "_targetName";
-  private final String serverPrincipal;
-
-  public PropertyBasedSpnegoLoginService(String realm, String serverPrincipal) {
-    super(realm);
-    this.serverPrincipal = Objects.requireNonNull(serverPrincipal);
-  }
-
-  @Override protected void doStart() throws Exception {
-    // Override the parent implementation, setting _targetName to be the serverPrincipal
-    // without the need for a one-line file to do the same thing.
-    //
-    // AbstractLifeCycle's doStart() method does nothing, so we aren't missing any extra logic.
-    final Field targetNameField = SpnegoLoginService.class.getDeclaredField(TARGET_NAME_FIELD_NAME);
-    targetNameField.setAccessible(true);
-    targetNameField.set(this, serverPrincipal);
-  }
-}
-
-// End PropertyBasedSpnegoLoginService.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/server/src/main/java/org/apache/calcite/avatica/server/package-info.java
----------------------------------------------------------------------
diff --git a/avatica/server/src/main/java/org/apache/calcite/avatica/server/package-info.java b/avatica/server/src/main/java/org/apache/calcite/avatica/server/package-info.java
deleted file mode 100644
index f2b8728..0000000
--- a/avatica/server/src/main/java/org/apache/calcite/avatica/server/package-info.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * Avatica server that listens for HTTP requests.
- */
-@PackageMarker
-package org.apache.calcite.avatica.server;
-
-import org.apache.calcite.avatica.util.PackageMarker;
-
-// End package-info.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/server/src/test/java/org/apache/calcite/avatica/AvaticaSpnegoTest.java
----------------------------------------------------------------------
diff --git a/avatica/server/src/test/java/org/apache/calcite/avatica/AvaticaSpnegoTest.java b/avatica/server/src/test/java/org/apache/calcite/avatica/AvaticaSpnegoTest.java
deleted file mode 100644
index 34329e2..0000000
--- a/avatica/server/src/test/java/org/apache/calcite/avatica/AvaticaSpnegoTest.java
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import org.apache.calcite.avatica.jdbc.JdbcMeta;
-import org.apache.calcite.avatica.remote.Driver;
-import org.apache.calcite.avatica.remote.LocalService;
-import org.apache.calcite.avatica.server.HttpServer;
-
-import org.apache.kerby.kerberos.kerb.KrbException;
-import org.apache.kerby.kerberos.kerb.client.JaasKrbUtil;
-import org.apache.kerby.kerberos.kerb.client.KrbConfig;
-import org.apache.kerby.kerberos.kerb.client.KrbConfigKey;
-import org.apache.kerby.kerberos.kerb.server.SimpleKdcServer;
-
-import org.junit.AfterClass;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.security.PrivilegedExceptionAction;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.ResultSet;
-import java.sql.Statement;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-
-import javax.security.auth.Subject;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-/**
- * End to end test case for SPNEGO with Avatica.
- */
-@RunWith(Parameterized.class)
-@Ignore("Disabled due to [CALCITE-1183] intermittent HTTP 404 failures")
-public class AvaticaSpnegoTest {
-  private static final Logger LOG = LoggerFactory.getLogger(AvaticaSpnegoTest.class);
-
-  private static final ConnectionSpec CONNECTION_SPEC = ConnectionSpec.HSQLDB;
-  private static final List<HttpServer> SERVERS_TO_STOP = new ArrayList<>();
-
-  private static SimpleKdcServer kdc;
-  private static KrbConfig clientConfig;
-  private static File keytabDir;
-
-  private static int kdcPort;
-  private static File clientKeytab;
-  private static File serverKeytab;
-
-  private static boolean isKdcStarted = false;
-
-  private static void setupKdc() throws Exception {
-    kdc = new SimpleKdcServer();
-    File target = new File(System.getProperty("user.dir"), "target");
-    assertTrue(target.exists());
-
-    File kdcDir = new File(target, AvaticaSpnegoTest.class.getSimpleName());
-    if (kdcDir.exists()) {
-      SpnegoTestUtil.deleteRecursively(kdcDir);
-    }
-    kdcDir.mkdirs();
-    kdc.setWorkDir(kdcDir);
-
-    kdc.setKdcHost(SpnegoTestUtil.KDC_HOST);
-    kdcPort = SpnegoTestUtil.getFreePort();
-    kdc.setAllowTcp(true);
-    kdc.setAllowUdp(false);
-    kdc.setKdcTcpPort(kdcPort);
-
-    LOG.info("Starting KDC server at {}:{}", SpnegoTestUtil.KDC_HOST, kdcPort);
-
-    kdc.init();
-    kdc.start();
-    isKdcStarted = true;
-
-    keytabDir = new File(target, AvaticaSpnegoTest.class.getSimpleName()
-        + "_keytabs");
-    if (keytabDir.exists()) {
-      SpnegoTestUtil.deleteRecursively(keytabDir);
-    }
-    keytabDir.mkdirs();
-    setupServerUser(keytabDir);
-
-    clientConfig = new KrbConfig();
-    clientConfig.setString(KrbConfigKey.KDC_HOST, SpnegoTestUtil.KDC_HOST);
-    clientConfig.setInt(KrbConfigKey.KDC_TCP_PORT, kdcPort);
-    clientConfig.setString(KrbConfigKey.DEFAULT_REALM, SpnegoTestUtil.REALM);
-
-    // Kerby sets "java.security.krb5.conf" for us!
-    System.setProperty("javax.security.auth.useSubjectCredsOnly", "false");
-    //System.setProperty("sun.security.spnego.debug", "true");
-    //System.setProperty("sun.security.krb5.debug", "true");
-  }
-
-  @AfterClass public static void stopKdc() throws Exception {
-    for (HttpServer server : SERVERS_TO_STOP) {
-      server.stop();
-    }
-
-    if (isKdcStarted) {
-      LOG.info("Stopping KDC on {}", kdcPort);
-      kdc.stop();
-    }
-  }
-
-  private static void setupServerUser(File keytabDir) throws KrbException {
-    // Create the client user
-    String clientPrincipal = SpnegoTestUtil.CLIENT_PRINCIPAL.substring(0,
-        SpnegoTestUtil.CLIENT_PRINCIPAL.indexOf('@'));
-    clientKeytab = new File(keytabDir, clientPrincipal.replace('/', '_') + ".keytab");
-    if (clientKeytab.exists()) {
-      SpnegoTestUtil.deleteRecursively(clientKeytab);
-    }
-    LOG.info("Creating {} with keytab {}", clientPrincipal, clientKeytab);
-    SpnegoTestUtil.setupUser(kdc, clientKeytab, clientPrincipal);
-
-    // Create the server user
-    String serverPrincipal = SpnegoTestUtil.SERVER_PRINCIPAL.substring(0,
-        SpnegoTestUtil.SERVER_PRINCIPAL.indexOf('@'));
-    serverKeytab = new File(keytabDir, serverPrincipal.replace('/', '_') + ".keytab");
-    if (serverKeytab.exists()) {
-      SpnegoTestUtil.deleteRecursively(serverKeytab);
-    }
-    LOG.info("Creating {} with keytab {}", SpnegoTestUtil.SERVER_PRINCIPAL, serverKeytab);
-    SpnegoTestUtil.setupUser(kdc, serverKeytab, SpnegoTestUtil.SERVER_PRINCIPAL);
-  }
-
-  @Parameters public static List<Object[]> parameters() throws Exception {
-    final ArrayList<Object[]> parameters = new ArrayList<>();
-
-    // Start the KDC
-    setupKdc();
-
-    // Create a LocalService around HSQLDB
-    final JdbcMeta jdbcMeta = new JdbcMeta(CONNECTION_SPEC.url,
-        CONNECTION_SPEC.username, CONNECTION_SPEC.password);
-    final LocalService localService = new LocalService(jdbcMeta);
-
-    for (Driver.Serialization serialization : new Driver.Serialization[] {
-      Driver.Serialization.JSON, Driver.Serialization.PROTOBUF}) {
-      // Build and start the server
-      HttpServer httpServer = new HttpServer.Builder()
-          .withPort(0)
-          .withAutomaticLogin(serverKeytab)
-          .withSpnego(SpnegoTestUtil.SERVER_PRINCIPAL, SpnegoTestUtil.REALM)
-          .withHandler(localService, serialization)
-          .build();
-      httpServer.start();
-      SERVERS_TO_STOP.add(httpServer);
-
-      final String url = "jdbc:avatica:remote:url=http://" + SpnegoTestUtil.KDC_HOST + ":"
-          + httpServer.getPort() + ";authentication=SPNEGO;serialization=" + serialization;
-      LOG.info("JDBC URL {}", url);
-
-      parameters.add(new Object[] {url});
-    }
-
-    return parameters;
-  }
-
-  private final String jdbcUrl;
-
-  public AvaticaSpnegoTest(String jdbcUrl) {
-    this.jdbcUrl = Objects.requireNonNull(jdbcUrl);
-  }
-
-  @Test public void testAuthenticatedClient() throws Exception {
-    ConnectionSpec.getDatabaseLock().lock();
-    try {
-      final String tableName = "allowed_clients";
-      // Create the subject for the client
-      final Subject clientSubject = JaasKrbUtil.loginUsingKeytab(SpnegoTestUtil.CLIENT_PRINCIPAL,
-          clientKeytab);
-
-      // The name of the principal
-
-      // Run this code, logged in as the subject (the client)
-      Subject.doAs(clientSubject, new PrivilegedExceptionAction<Void>() {
-        @Override public Void run() throws Exception {
-          try (Connection conn = DriverManager.getConnection(jdbcUrl)) {
-            try (Statement stmt = conn.createStatement()) {
-              assertFalse(stmt.execute("DROP TABLE IF EXISTS " + tableName));
-              assertFalse(stmt.execute("CREATE TABLE " + tableName + "(pk integer)"));
-              assertEquals(1, stmt.executeUpdate("INSERT INTO " + tableName + " VALUES(1)"));
-              assertEquals(1, stmt.executeUpdate("INSERT INTO " + tableName + " VALUES(2)"));
-              assertEquals(1, stmt.executeUpdate("INSERT INTO " + tableName + " VALUES(3)"));
-
-              ResultSet results = stmt.executeQuery("SELECT count(1) FROM " + tableName);
-              assertTrue(results.next());
-              assertEquals(3, results.getInt(1));
-            }
-          }
-          return null;
-        }
-      });
-    } finally {
-      ConnectionSpec.getDatabaseLock().unlock();
-    }
-  }
-
-  @Test public void testAutomaticLogin() throws Exception {
-    final String tableName = "automaticAllowedClients";
-    // Avatica should log in for us with this info
-    String url = jdbcUrl + ";principal=" + SpnegoTestUtil.CLIENT_PRINCIPAL + ";keytab="
-        + clientKeytab;
-    LOG.info("Updated JDBC url: {}", url);
-    try (Connection conn = DriverManager.getConnection(url);
-        Statement stmt = conn.createStatement()) {
-      assertFalse(stmt.execute("DROP TABLE IF EXISTS " + tableName));
-      assertFalse(stmt.execute("CREATE TABLE " + tableName + "(pk integer)"));
-      assertEquals(1, stmt.executeUpdate("INSERT INTO " + tableName + " VALUES(1)"));
-      assertEquals(1, stmt.executeUpdate("INSERT INTO " + tableName + " VALUES(2)"));
-      assertEquals(1, stmt.executeUpdate("INSERT INTO " + tableName + " VALUES(3)"));
-
-      ResultSet results = stmt.executeQuery("SELECT count(1) FROM " + tableName);
-      assertTrue(results.next());
-      assertEquals(3, results.getInt(1));
-    }
-  }
-}
-
-// End AvaticaSpnegoTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/server/src/test/java/org/apache/calcite/avatica/ConnectionSpec.java
----------------------------------------------------------------------
diff --git a/avatica/server/src/test/java/org/apache/calcite/avatica/ConnectionSpec.java b/avatica/server/src/test/java/org/apache/calcite/avatica/ConnectionSpec.java
deleted file mode 100644
index ba4c5b8..0000000
--- a/avatica/server/src/test/java/org/apache/calcite/avatica/ConnectionSpec.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import net.hydromatic.scott.data.hsqldb.ScottHsqldb;
-
-import java.util.concurrent.locks.ReentrantLock;
-
-/** Information necessary to create a JDBC connection. Specify one to run
- * tests against a different database. (hsqldb is the default.) */
-public class ConnectionSpec {
-  public final String url;
-  public final String username;
-  public final String password;
-  public final String driver;
-
-  // CALCITE-687 HSQLDB seems to fail oddly when multiple tests are run concurrently
-  private static final ReentrantLock HSQLDB_LOCK = new ReentrantLock();
-
-  public ConnectionSpec(String url, String username, String password,
-      String driver) {
-    this.url = url;
-    this.username = username;
-    this.password = password;
-    this.driver = driver;
-  }
-
-  public static final ConnectionSpec HSQLDB =
-      new ConnectionSpec(ScottHsqldb.URI, ScottHsqldb.USER,
-          ScottHsqldb.PASSWORD, "org.hsqldb.jdbcDriver");
-
-  /**
-   * Return a lock used for controlling concurrent access to the database as it has been observed
-   * that concurrent access is causing problems with HSQLDB.
-   */
-  public static ReentrantLock getDatabaseLock() {
-    return HSQLDB_LOCK;
-  }
-}
-
-// End ConnectionSpec.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/server/src/test/java/org/apache/calcite/avatica/RemoteDriverMockTest.java
----------------------------------------------------------------------
diff --git a/avatica/server/src/test/java/org/apache/calcite/avatica/RemoteDriverMockTest.java b/avatica/server/src/test/java/org/apache/calcite/avatica/RemoteDriverMockTest.java
deleted file mode 100644
index 96e524a..0000000
--- a/avatica/server/src/test/java/org/apache/calcite/avatica/RemoteDriverMockTest.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import org.apache.calcite.avatica.remote.MockJsonService;
-import org.apache.calcite.avatica.remote.MockProtobufService.MockProtobufServiceFactory;
-
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.ParameterMetaData;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.Callable;
-
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-
-/**
- * RemoteDriver tests that use a Mock implementation of a Connection.
- */
-@RunWith(Parameterized.class)
-public class RemoteDriverMockTest {
-  public static final String MJS = MockJsonService.Factory.class.getName();
-  public static final String MPBS = MockProtobufServiceFactory.class.getName();
-
-  private static Connection mjs() throws SQLException {
-    return DriverManager.getConnection("jdbc:avatica:remote:factory=" + MJS);
-  }
-
-  private static Connection mpbs() throws SQLException {
-    return DriverManager.getConnection("jdbc:avatica:remote:factory=" + MPBS);
-  }
-
-  @Parameters
-  public static List<Object[]> parameters() {
-    List<Object[]> parameters = new ArrayList<>();
-
-    parameters.add(new Object[] {new Callable<Connection>() {
-      public Connection call() throws SQLException {
-        return mjs();
-      }
-    } });
-
-    parameters.add(new Object[] {new Callable<Connection>() {
-      public Connection call() throws SQLException {
-        return mpbs();
-      }
-    } });
-
-    return parameters;
-  }
-
-  private final Callable<Connection> connectionFunctor;
-
-  public RemoteDriverMockTest(Callable<Connection> functor) {
-    this.connectionFunctor = functor;
-  }
-
-  private Connection getMockConnection() {
-    try {
-      return connectionFunctor.call();
-    } catch (Exception e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  @Test public void testRegister() throws Exception {
-    final Connection connection = getMockConnection();
-    assertThat(connection.isClosed(), is(false));
-    connection.close();
-    assertThat(connection.isClosed(), is(true));
-  }
-
-  @Test public void testSchemas() throws Exception {
-    final Connection connection = getMockConnection();
-    final ResultSet resultSet =
-        connection.getMetaData().getSchemas(null, null);
-    assertFalse(resultSet.next());
-    final ResultSetMetaData metaData = resultSet.getMetaData();
-    assertTrue(metaData.getColumnCount() >= 2);
-    assertEquals("TABLE_SCHEM", metaData.getColumnName(1));
-    assertEquals("TABLE_CATALOG", metaData.getColumnName(2));
-    resultSet.close();
-    connection.close();
-  }
-
-  @Test public void testTables() throws Exception {
-    final Connection connection = getMockConnection();
-    final ResultSet resultSet =
-        connection.getMetaData().getTables(null, null, null, new String[0]);
-    assertFalse(resultSet.next());
-    final ResultSetMetaData metaData = resultSet.getMetaData();
-    assertTrue(metaData.getColumnCount() >= 3);
-    assertEquals("TABLE_CAT", metaData.getColumnName(1));
-    assertEquals("TABLE_SCHEM", metaData.getColumnName(2));
-    assertEquals("TABLE_NAME", metaData.getColumnName(3));
-    resultSet.close();
-    connection.close();
-  }
-
-  @Ignore
-  @Test public void testNoFactory() throws Exception {
-    final Connection connection =
-        DriverManager.getConnection("jdbc:avatica:remote:");
-    assertThat(connection.isClosed(), is(false));
-    final ResultSet resultSet = connection.getMetaData().getSchemas();
-    assertFalse(resultSet.next());
-    final ResultSetMetaData metaData = resultSet.getMetaData();
-    assertEquals(2, metaData.getColumnCount());
-    assertEquals("TABLE_SCHEM", metaData.getColumnName(1));
-    assertEquals("TABLE_CATALOG", metaData.getColumnName(2));
-    resultSet.close();
-    connection.close();
-    assertThat(connection.isClosed(), is(true));
-  }
-
-  @Ignore
-  @Test public void testCatalogsMock() throws Exception {
-    final Connection connection = getMockConnection();
-    assertThat(connection.isClosed(), is(false));
-    final ResultSet resultSet = connection.getMetaData().getSchemas();
-    assertFalse(resultSet.next());
-    final ResultSetMetaData metaData = resultSet.getMetaData();
-    assertEquals(2, metaData.getColumnCount());
-    assertEquals("TABLE_SCHEM", metaData.getColumnName(1));
-    assertEquals("TABLE_CATALOG", metaData.getColumnName(2));
-    resultSet.close();
-    connection.close();
-    assertThat(connection.isClosed(), is(true));
-  }
-
-  @Ignore
-  @Test public void testStatementExecuteQueryMock() throws Exception {
-    checkStatementExecuteQuery(getMockConnection(), false);
-  }
-
-  @Ignore
-  @Test public void testPrepareExecuteQueryMock() throws Exception {
-    checkStatementExecuteQuery(getMockConnection(), true);
-  }
-
-  private void checkStatementExecuteQuery(Connection connection,
-      boolean prepare) throws SQLException {
-    final String sql = "select * from (\n"
-        + "  values (1, 'a'), (null, 'b'), (3, 'c')) as t (c1, c2)";
-    final Statement statement;
-    final ResultSet resultSet;
-    final ParameterMetaData parameterMetaData;
-    if (prepare) {
-      final PreparedStatement ps = connection.prepareStatement(sql);
-      statement = ps;
-      parameterMetaData = ps.getParameterMetaData();
-      resultSet = ps.executeQuery();
-    } else {
-      statement = connection.createStatement();
-      parameterMetaData = null;
-      resultSet = statement.executeQuery(sql);
-    }
-    if (parameterMetaData != null) {
-      assertThat(parameterMetaData.getParameterCount(), equalTo(0));
-    }
-    final ResultSetMetaData metaData = resultSet.getMetaData();
-    assertEquals(2, metaData.getColumnCount());
-    assertEquals("C1", metaData.getColumnName(1));
-    assertEquals("C2", metaData.getColumnName(2));
-    assertTrue(resultSet.next());
-    assertTrue(resultSet.next());
-    assertTrue(resultSet.next());
-    assertFalse(resultSet.next());
-    resultSet.close();
-    statement.close();
-    connection.close();
-  }
-
-  @Test public void testResultSetsFinagled() throws Exception {
-    // These values specified in MockJsonService
-    final String table = "my_table";
-    final long value = 10;
-
-    final Connection connection = getMockConnection();
-    // Not an accurate ResultSet per JDBC, but close enough for testing.
-    ResultSet results = connection.getMetaData().getColumns(null, null, table, null);
-    assertTrue(results.next());
-    assertEquals(table, results.getString(1));
-    assertEquals(value, results.getLong(2));
-  }
-
-}
-
-// End RemoteDriverMockTest.java


[32/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/util/Unsafe.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/util/Unsafe.java b/avatica/core/src/main/java/org/apache/calcite/avatica/util/Unsafe.java
deleted file mode 100644
index 1d0238c..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/util/Unsafe.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.util;
-
-import java.util.Calendar;
-import java.util.Locale;
-
-/**
- * Contains methods that call JDK methods that the
- * <a href="https://github.com/policeman-tools/forbidden-apis">forbidden
- * APIs checker</a> does not approve of.
- *
- * <p>This class is excluded from the check, so methods called via this class
- * will not fail the build.
- */
-public class Unsafe {
-  private Unsafe() {}
-
-  /** Calls {@link System#exit}. */
-  public static void systemExit(int status) {
-    System.exit(status);
-  }
-
-  /** Calls {@link Object#notifyAll()}. */
-  public static void notifyAll(Object o) {
-    o.notifyAll();
-  }
-
-  /** Calls {@link Object#wait()}. */
-  public static void wait(Object o) throws InterruptedException {
-    o.wait();
-  }
-
-  /** Returns a {@link java.util.Calendar} with the local time zone and root
-   * locale. */
-  public static Calendar localCalendar() {
-    return Calendar.getInstance(Locale.ROOT);
-  }
-}
-
-// End Unsafe.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/util/UnsynchronizedBuffer.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/util/UnsynchronizedBuffer.java b/avatica/core/src/main/java/org/apache/calcite/avatica/util/UnsynchronizedBuffer.java
deleted file mode 100644
index 8daee60..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/util/UnsynchronizedBuffer.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.util;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-/**
- * A utility class for reading and writing bytes to byte buffers without synchronization. A
- * reduced variant taken from Apache Accumulo. This class is <b>not</b> thread-safe by design.
- * It is up to the caller to guarantee mutual exclusion as necessary.
- */
-public class UnsynchronizedBuffer extends OutputStream {
-  // Anything larger than 64K, reap the backing buffer
-  private static final int LARGE_BUFFER_SIZE = 1024 * 64;
-
-  final int initialCapacity;
-  int offset = 0;
-  byte[] data;
-
-  /**
-   * Creates a new writer.
-   */
-  public UnsynchronizedBuffer() {
-    this(4096);
-  }
-
-  /**
-   * Creates a new writer.
-   *
-   * @param initialCapacity initial byte capacity
-   */
-  public UnsynchronizedBuffer(int initialCapacity) {
-    this.initialCapacity = initialCapacity;
-    data = new byte[initialCapacity];
-  }
-
-  private void reserve(int l) {
-    if (offset + l > data.length) {
-      int newSize = UnsynchronizedBuffer.nextArraySize(offset + l);
-
-      byte[] newData = new byte[newSize];
-      System.arraycopy(data, 0, newData, 0, offset);
-      data = newData;
-    }
-
-  }
-
-  /**
-   * Adds bytes to this writer's buffer.
-   *
-   * @param bytes byte array
-   * @param off offset into array to start copying bytes
-   * @param length number of bytes to add
-   * @throws IndexOutOfBoundsException if off or length are invalid
-   */
-  public void write(byte[] bytes, int off, int length) {
-    reserve(length);
-    System.arraycopy(bytes, off, data, offset, length);
-    offset += length;
-  }
-
-  @Override public void write(int b) throws IOException {
-    reserve(1);
-    data[offset] = (byte) b;
-    offset++;
-  }
-
-  /**
-   * Gets (a copy of) the contents of this writer's buffer.
-   *
-   * @return byte buffer contents
-   */
-  public byte[] toArray() {
-    byte[] ret = new byte[offset];
-    System.arraycopy(data, 0, ret, 0, offset);
-    return ret;
-  }
-
-  /**
-   * Resets the internal pointer into the buffer.
-   */
-  public void reset() {
-    offset = 0;
-    if (data.length >= LARGE_BUFFER_SIZE) {
-      data = new byte[this.initialCapacity];
-    }
-  }
-
-  /**
-   * @return The current offset into the backing array.
-   */
-  public int getOffset() {
-    return offset;
-  }
-
-  /**
-   * @return The current length of the backing array.
-   */
-  public long getSize() {
-    return data.length;
-  }
-
-  /**
-   * Determines what next array size should be by rounding up to next power of two.
-   *
-   * @param i current array size
-   * @return next array size
-   * @throws IllegalArgumentException if i is negative
-   */
-  public static int nextArraySize(int i) {
-    if (i < 0) {
-      throw new IllegalArgumentException();
-    }
-
-    if (i > (1 << 30)) {
-      return Integer.MAX_VALUE; // this is the next power of 2 minus one... a special case
-    }
-
-    if (i == 0) {
-      return 1;
-    }
-
-    // round up to next power of two
-    int ret = i;
-    ret--;
-    ret |= ret >> 1;
-    ret |= ret >> 2;
-    ret |= ret >> 4;
-    ret |= ret >> 8;
-    ret |= ret >> 16;
-    ret++;
-
-    return ret;
-  }
-}
-
-// End UnsynchronizedBuffer.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/util/package-info.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/util/package-info.java b/avatica/core/src/main/java/org/apache/calcite/avatica/util/package-info.java
deleted file mode 100644
index eab457c..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/util/package-info.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * Avatica utilities.
- */
-@PackageMarker
-package org.apache.calcite.avatica.util;
-
-// End package-info.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/protobuf/common.proto
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/protobuf/common.proto b/avatica/core/src/main/protobuf/common.proto
deleted file mode 100644
index affe5d5..0000000
--- a/avatica/core/src/main/protobuf/common.proto
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- * 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.
- */
-
-syntax = "proto3";
-
-option java_package = "org.apache.calcite.avatica.proto";
-
-// Details about a connection
-message ConnectionProperties {
-  bool is_dirty = 1;
-  bool auto_commit = 2;
-  bool has_auto_commit = 7; // field is a Boolean, need to discern null and default value
-  bool read_only = 3;
-  bool has_read_only = 8; // field is a Boolean, need to discern null and default value
-  uint32 transaction_isolation = 4;
-  string catalog = 5;
-  string schema = 6;
-}
-
-// Statement handle
-message StatementHandle {
-  string connection_id = 1;
-  uint32 id = 2;
-  Signature signature = 3;
-}
-
-// Results of preparing a statement
-message Signature {
-  repeated ColumnMetaData columns = 1;
-  string sql = 2;
-  repeated AvaticaParameter parameters = 3;
-  CursorFactory cursor_factory = 4;
-  StatementType statementType = 5;
-}
-
-// Has to be consistent with Meta.StatementType
-enum StatementType {
-  SELECT = 0;
-  INSERT = 1;
-  UPDATE = 2;
-  DELETE = 3;
-  UPSERT = 4;
-  MERGE = 5;
-  OTHER_DML = 6;
-  CREATE = 7;
-  DROP = 8;
-  ALTER = 9;
-  OTHER_DDL = 10;
-  CALL = 11;
-}
-
-message ColumnMetaData {
-  uint32 ordinal = 1;
-  bool auto_increment = 2;
-  bool case_sensitive = 3;
-  bool searchable = 4;
-  bool currency = 5;
-  uint32 nullable = 6;
-  bool signed = 7;
-  uint32 display_size = 8;
-  string label = 9;
-  string column_name = 10;
-  string schema_name = 11;
-  uint32 precision = 12;
-  uint32 scale = 13;
-  string table_name = 14;
-  string catalog_name = 15;
-  bool read_only = 16;
-  bool writable = 17;
-  bool definitely_writable = 18;
-  string column_class_name = 19;
-  AvaticaType type = 20;
-}
-
-enum Rep {
-  PRIMITIVE_BOOLEAN = 0;
-  PRIMITIVE_BYTE = 1;
-  PRIMITIVE_CHAR = 2;
-  PRIMITIVE_SHORT = 3;
-  PRIMITIVE_INT = 4;
-  PRIMITIVE_LONG = 5;
-  PRIMITIVE_FLOAT = 6;
-  PRIMITIVE_DOUBLE = 7;
-  BOOLEAN = 8;
-  BYTE = 9;
-  CHARACTER = 10;
-  SHORT = 11;
-  INTEGER = 12;
-  LONG = 13;
-  FLOAT = 14;
-  DOUBLE = 15;
-  BIG_INTEGER = 25;
-  BIG_DECIMAL = 26;
-  JAVA_SQL_TIME = 16;
-  JAVA_SQL_TIMESTAMP = 17;
-  JAVA_SQL_DATE = 18;
-  JAVA_UTIL_DATE = 19;
-  BYTE_STRING = 20;
-  STRING = 21;
-  NUMBER = 22;
-  OBJECT = 23;
-  NULL = 24;
-  ARRAY = 27;
-  STRUCT = 28;
-  MULTISET = 29;
-}
-
-// Base class for a column type
-message AvaticaType {
-  uint32 id = 1;
-  string name = 2;
-  Rep rep = 3;
-
-  repeated ColumnMetaData columns = 4; // Only present when name = STRUCT
-  AvaticaType component = 5; // Only present when name = ARRAY
-}
-
-// Metadata for a parameter
-message AvaticaParameter {
-  bool signed = 1;
-  uint32 precision = 2;
-  uint32 scale = 3;
-  uint32 parameter_type = 4;
-  string type_name = 5;
-  string class_name = 6;
-  string name = 7;
-}
-
-// Information necessary to convert an Iterable into a Calcite Cursor
-message CursorFactory {
-  enum Style {
-    OBJECT = 0;
-    RECORD = 1;
-    RECORD_PROJECTION = 2;
-    ARRAY = 3;
-    LIST = 4;
-    MAP = 5;
-  }
-
-  Style style = 1;
-  string class_name = 2;
-  repeated string field_names = 3;
-}
-
-// A collection of rows
-message Frame {
-  uint64 offset = 1;
-  bool done = 2;
-  repeated Row rows = 3;
-}
-
-// A row is a collection of values
-message Row {
-  repeated ColumnValue value = 1;
-}
-
-// Database property, list of functions the database provides for a certain operation
-message DatabaseProperty {
-  string name = 1;
-  repeated string functions = 2;
-}
-
-// Message which encapsulates another message to support a single RPC endpoint
-message WireMessage {
-  string name = 1;
-  bytes wrapped_message = 2;
-}
-
-// A value might be a TypedValue or an Array of TypedValue's
-message ColumnValue {
-  repeated TypedValue value = 1; // deprecated, use array_value or scalar_value
-  repeated TypedValue array_value = 2;
-  bool has_array_value = 3; // Is an array value set?
-  TypedValue scalar_value = 4;
-}
-
-// Generic wrapper to support any SQL type. Struct-like to work around no polymorphism construct.
-message TypedValue {
-  Rep type = 1; // The actual type that was serialized in the general attribute below
-
-  bool bool_value = 2; // boolean
-  string string_value = 3; // char/varchar
-  sint64 number_value = 4; // var-len encoding lets us shove anything from byte to long
-                           // includes numeric types and date/time types.
-  bytes bytes_value = 5; // binary/varbinary
-  double double_value = 6; // big numbers
-  bool null = 7; // a null object
-}
-
-// The severity of some unexpected outcome to an operation.
-// Protobuf enum values must be unique across all other enums
-enum Severity {
-  UNKNOWN_SEVERITY = 0;
-  FATAL_SEVERITY = 1;
-  ERROR_SEVERITY = 2;
-  WARNING_SEVERITY = 3;
-}
-
-// Enumeration corresponding to DatabaseMetaData operations
-enum MetaDataOperation {
-  GET_ATTRIBUTES = 0;
-  GET_BEST_ROW_IDENTIFIER = 1;
-  GET_CATALOGS = 2;
-  GET_CLIENT_INFO_PROPERTIES = 3;
-  GET_COLUMN_PRIVILEGES = 4;
-  GET_COLUMNS = 5;
-  GET_CROSS_REFERENCE = 6;
-  GET_EXPORTED_KEYS = 7;
-  GET_FUNCTION_COLUMNS = 8;
-  GET_FUNCTIONS = 9;
-  GET_IMPORTED_KEYS = 10;
-  GET_INDEX_INFO = 11;
-  GET_PRIMARY_KEYS = 12;
-  GET_PROCEDURE_COLUMNS = 13;
-  GET_PROCEDURES = 14;
-  GET_PSEUDO_COLUMNS = 15;
-  GET_SCHEMAS = 16;
-  GET_SCHEMAS_WITH_ARGS = 17;
-  GET_SUPER_TABLES = 18;
-  GET_SUPER_TYPES = 19;
-  GET_TABLE_PRIVILEGES = 20;
-  GET_TABLES = 21;
-  GET_TABLE_TYPES = 22;
-  GET_TYPE_INFO = 23;
-  GET_UDTS = 24;
-  GET_VERSION_COLUMNS = 25;
-}
-
-// Represents the breadth of arguments to DatabaseMetaData functions
-message MetaDataOperationArgument {
-  enum ArgumentType {
-    STRING = 0;
-    BOOL = 1;
-    INT = 2;
-    REPEATED_STRING = 3;
-    REPEATED_INT = 4;
-    NULL = 5;
-  }
-
-  string string_value = 1;
-  bool bool_value = 2;
-  sint32 int_value = 3;
-  repeated string string_array_values = 4;
-  repeated sint32 int_array_values = 5;
-  ArgumentType type = 6;
-}
-
-enum StateType {
-  SQL = 0;
-  METADATA = 1;
-}
-
-message QueryState {
-  StateType type = 1;
-  string sql = 2;
-  MetaDataOperation op = 3;
-  repeated MetaDataOperationArgument args = 4;
-  bool has_args = 5;
-  bool has_sql = 6;
-  bool has_op = 7;
-}

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/protobuf/requests.proto
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/protobuf/requests.proto b/avatica/core/src/main/protobuf/requests.proto
deleted file mode 100644
index 228be27..0000000
--- a/avatica/core/src/main/protobuf/requests.proto
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * 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.
- */
-syntax = "proto3";
-
-option java_package = "org.apache.calcite.avatica.proto";
-
-import "common.proto";
-
-// Request for Meta#getCatalogs()
-message CatalogsRequest {
-  string connection_id = 1;
-}
-
-// Request for Meta#getDatabaseProperties()
-message DatabasePropertyRequest {
-  string connection_id = 1;
-}
-
-// Request for Meta#getSchemas(String, org.apache.calcite.avatica.Meta.Pat)}
-message SchemasRequest {
-  string catalog = 1;
-  string schema_pattern = 2;
-  string connection_id = 3;
-}
-
-// Request for Request for Meta#getTables(String, org.apache.calcite.avatica.Meta.Pat,
-//   org.apache.calcite.avatica.Meta.Pat, java.util.List)
-message TablesRequest {
-  string catalog = 1;
-  string schema_pattern = 2;
-  string table_name_pattern = 3;
-  repeated string type_list = 4;
-  bool has_type_list = 6; // Having an empty type_list is distinct from a null type_list
-  string connection_id = 7;
-}
-
-// Request for Meta#getTableTypes()
-message TableTypesRequest {
-  string connection_id = 1;
-}
-
-// Request for Meta#getColumns(String, org.apache.calcite.avatica.Meta.Pat,
-//   org.apache.calcite.avatica.Meta.Pat, org.apache.calcite.avatica.Meta.Pat).
-message ColumnsRequest {
-  string catalog = 1;
-  string schema_pattern = 2;
-  string table_name_pattern = 3;
-  string column_name_pattern = 4;
-  string connection_id = 5;
-}
-
-// Request for Meta#getTypeInfo()
-message TypeInfoRequest {
-  string connection_id = 1;
-}
-
-// Request for Meta#prepareAndExecute(Meta.StatementHandle, String, long, Meta.PrepareCallback)
-message PrepareAndExecuteRequest {
-  string connection_id = 1;
-  string sql = 2;
-  uint64 max_row_count = 3; // Deprecated
-  uint32 statement_id = 4;
-  int64 max_rows_total = 5; // The maximum number of rows that will be allowed for this query
-  int32 first_frame_max_size = 6; // The maximum number of rows that will be returned in the
-                                  // first Frame returned for this query.
-}
-
-// Request for Meta.prepare(Meta.ConnectionHandle, String, long)
-message PrepareRequest {
-  string connection_id = 1;
-  string sql = 2;
-  uint64 max_row_count = 3; // Deprecated
-  int64 max_rows_total = 4; // The maximum number of rows that will be allowed for this query
-}
-
-// Request for Meta#fetch(Meta.StatementHandle, List, long, int)
-message FetchRequest {
-  string connection_id = 1;
-  uint32 statement_id = 2;
-  uint64 offset = 3;
-  uint32 fetch_max_row_count = 4; // Maximum number of rows to be returned in the frame. Negative means no limit. Deprecated!
-  int32 frame_max_size = 5;
-}
-
-// Request for Meta#createStatement(Meta.ConnectionHandle)
-message CreateStatementRequest {
-  string connection_id = 1;
-}
-
-// Request for Meta#closeStatement(Meta.StatementHandle)
-message CloseStatementRequest {
-  string connection_id = 1;
-  uint32 statement_id = 2;
-}
-
-// Request for Meta#openConnection(Meta.ConnectionHandle, Map<String, String>)
-message OpenConnectionRequest {
-  string connection_id = 1;
-  map<string, string> info = 2;
-}
-
-// Request for Meta#closeConnection(Meta.ConnectionHandle)
-message CloseConnectionRequest {
-  string connection_id = 1;
-}
-
-message ConnectionSyncRequest {
-  string connection_id = 1;
-  ConnectionProperties conn_props = 2;
-}
-
-// Request for Meta#execute(Meta.ConnectionHandle, list, long)
-message ExecuteRequest {
-  StatementHandle statementHandle = 1;
-  repeated TypedValue parameter_values = 2;
-  uint64 first_frame_max_size = 3; // The maximum number of rows to return in the first Frame
-  bool has_parameter_values = 4;
-}
-
-
-message SyncResultsRequest {
-  string connection_id = 1;
-  uint32 statement_id = 2;
-  QueryState state = 3;
-  uint64 offset = 4;
-}
-
-// Request to invoke a commit on a Connection
-message CommitRequest {
-  string connection_id = 1;
-}
-
-// Request to invoke rollback on a Connection
-message RollbackRequest {
-  string connection_id = 1;
-}
-
-// Request to prepare and execute a collection of sql statements.
-message PrepareAndExecuteBatchRequest {
-  string connection_id = 1;
-  uint32 statement_id = 2;
-  repeated string sql_commands = 3;
-}
-
-// Each command is a list of TypedValues
-message UpdateBatch {
-  repeated TypedValue parameter_values = 1;
-}
-
-message ExecuteBatchRequest {
-  string connection_id = 1;
-  uint32 statement_id = 2;
-  repeated UpdateBatch updates = 3; // A batch of updates is a list<list<typevalue>>
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/protobuf/responses.proto
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/protobuf/responses.proto b/avatica/core/src/main/protobuf/responses.proto
deleted file mode 100644
index a3cd3d2..0000000
--- a/avatica/core/src/main/protobuf/responses.proto
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * 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.
- */
-syntax = "proto3";
-
-option java_package = "org.apache.calcite.avatica.proto";
-
-import "common.proto";
-
-// Response that contains a result set.
-message ResultSetResponse {
-  string connection_id = 1;
-  uint32 statement_id = 2;
-  bool own_statement = 3;
-  Signature signature = 4;
-  Frame first_frame = 5;
-  uint64 update_count = 6; // -1 for normal result sets, else this response contains a dummy result set
-                                    // with no signature nor other data.
-  RpcMetadata metadata = 7;
-}
-
-// Response to PrepareAndExecuteRequest
-message ExecuteResponse {
-  repeated ResultSetResponse results = 1;
-  bool missing_statement = 2; // Did the request fail because of no-cached statement
-  RpcMetadata metadata = 3;
-}
-
-// Response to PrepareRequest
-message PrepareResponse {
-  StatementHandle statement = 1;
-  RpcMetadata metadata = 2;
-}
-
-// Response to FetchRequest
-message FetchResponse {
-  Frame frame = 1;
-  bool missing_statement = 2; // Did the request fail because of no-cached statement
-  bool missing_results = 3; // Did the request fail because of a cached-statement w/o ResultSet
-  RpcMetadata metadata = 4;
-}
-
-// Response to CreateStatementRequest
-message CreateStatementResponse {
-  string connection_id = 1;
-  uint32 statement_id = 2;
-  RpcMetadata metadata = 3;
-}
-
-// Response to CloseStatementRequest
-message CloseStatementResponse {
-  RpcMetadata metadata = 1;
-}
-
-// Response to OpenConnectionRequest {
-message OpenConnectionResponse {
-  RpcMetadata metadata = 1;
-}
-
-// Response to CloseConnectionRequest {
-message CloseConnectionResponse {
-  RpcMetadata metadata = 1;
-}
-
-// Response to ConnectionSyncRequest
-message ConnectionSyncResponse {
-  ConnectionProperties conn_props = 1;
-  RpcMetadata metadata = 2;
-}
-
-message DatabasePropertyElement {
-  DatabaseProperty key = 1;
-  TypedValue value = 2;
-  RpcMetadata metadata = 3;
-}
-
-// Response for Meta#getDatabaseProperties()
-message DatabasePropertyResponse {
-  repeated DatabasePropertyElement props = 1;
-  RpcMetadata metadata = 2;
-}
-
-// Send contextual information about some error over the wire from the server.
-message ErrorResponse {
-  repeated string exceptions = 1; // exception stacktraces, many for linked exceptions.
-  bool has_exceptions = 7; // are there stacktraces contained?
-  string error_message = 2; // human readable description
-  Severity severity = 3;
-  uint32 error_code = 4; // numeric identifier for error
-  string sql_state = 5; // five-character standard-defined value
-  RpcMetadata metadata = 6;
-}
-
-message SyncResultsResponse {
-  bool missing_statement = 1; // Server doesn't have the statement with the ID from the request
-  bool more_results = 2; // Should the client fetch() to get more results
-  RpcMetadata metadata = 3;
-}
-
-// Generic metadata for the server to return with each response.
-message RpcMetadata {
-  string server_address = 1; // The host:port of the server
-}
-
-// Response to a commit request
-message CommitResponse {
-
-}
-
-// Response to a rollback request
-message RollbackResponse {
-
-}
-
-// Response to a batch update request
-message ExecuteBatchResponse {
-  string connection_id = 1;
-  uint32 statement_id = 2;
-  repeated uint64 update_counts = 3;
-  bool missing_statement = 4; // Did the request fail because of no-cached statement
-  RpcMetadata metadata = 5;
-}

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/resources/META-INF/services/java.sql.Driver
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/resources/META-INF/services/java.sql.Driver b/avatica/core/src/main/resources/META-INF/services/java.sql.Driver
deleted file mode 100644
index beb1ac0..0000000
--- a/avatica/core/src/main/resources/META-INF/services/java.sql.Driver
+++ /dev/null
@@ -1 +0,0 @@
-org.apache.calcite.avatica.remote.Driver

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/test/java/org/apache/calcite/avatica/AvaticaConnectionTest.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/test/java/org/apache/calcite/avatica/AvaticaConnectionTest.java b/avatica/core/src/test/java/org/apache/calcite/avatica/AvaticaConnectionTest.java
deleted file mode 100644
index b1c003f..0000000
--- a/avatica/core/src/test/java/org/apache/calcite/avatica/AvaticaConnectionTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import java.util.Properties;
-
-/**
- * Tests for AvaticaConnection
- */
-public class AvaticaConnectionTest {
-
-  @Test
-  public void testNumExecuteRetries() {
-    AvaticaConnection statement = Mockito.mock(AvaticaConnection.class);
-
-    Mockito.when(statement.getNumStatementRetries(Mockito.nullable(Properties.class)))
-      .thenCallRealMethod();
-
-    // Bad argument should throw an exception
-    try {
-      statement.getNumStatementRetries(null);
-      Assert.fail("Calling getNumStatementRetries with a null object should throw an exception");
-    } catch (NullPointerException e) {
-      // Pass
-    }
-
-    Properties props = new Properties();
-
-    // Verify the default value
-    Assert.assertEquals(Long.valueOf(AvaticaConnection.NUM_EXECUTE_RETRIES_DEFAULT).longValue(),
-        statement.getNumStatementRetries(props));
-
-    // Set a non-default value
-    props.setProperty(AvaticaConnection.NUM_EXECUTE_RETRIES_KEY, "10");
-
-    // Verify that we observe that value
-    Assert.assertEquals(10, statement.getNumStatementRetries(props));
-  }
-
-}
-
-// End AvaticaConnectionTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/test/java/org/apache/calcite/avatica/AvaticaResultSetConversionsTest.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/test/java/org/apache/calcite/avatica/AvaticaResultSetConversionsTest.java b/avatica/core/src/test/java/org/apache/calcite/avatica/AvaticaResultSetConversionsTest.java
deleted file mode 100644
index bf3047f..0000000
--- a/avatica/core/src/test/java/org/apache/calcite/avatica/AvaticaResultSetConversionsTest.java
+++ /dev/null
@@ -1,1100 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import org.apache.calcite.avatica.ColumnMetaData.AvaticaType;
-import org.apache.calcite.avatica.remote.TypedValue;
-import org.apache.calcite.avatica.util.DateTimeUtils;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-
-import java.math.BigDecimal;
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.Date;
-import java.sql.ResultSet;
-import java.sql.SQLDataException;
-import java.sql.SQLException;
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.sql.Types;
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import static org.hamcrest.CoreMatchers.isA;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
-
-/**
- * Test {@code ResultSet#getXXX} conversions.
- */
-@RunWith(Parameterized.class)
-public class AvaticaResultSetConversionsTest {
-  /**
-   * A fake test driver for test.
-   */
-  private static final class TestDriver extends UnregisteredDriver {
-
-    @Override protected DriverVersion createDriverVersion() {
-      return new DriverVersion("test", "test 0.0.0", "test", "test 0.0.0", false, 0, 0, 0, 0);
-    }
-
-    @Override protected String getConnectStringPrefix() {
-      return "jdbc:test";
-    }
-
-    @Override public Meta createMeta(AvaticaConnection connection) {
-      return new TestMetaImpl(connection);
-    }
-  }
-
-  /**
-   * Fake meta implementation for test driver.
-   */
-  public static final class TestMetaImpl extends MetaImpl {
-    public TestMetaImpl(AvaticaConnection connection) {
-      super(connection);
-    }
-
-    @Override public StatementHandle prepare(ConnectionHandle ch, String sql, long maxRowCount) {
-      throw new UnsupportedOperationException();
-    }
-
-    @SuppressWarnings("deprecation")
-    @Override public ExecuteResult prepareAndExecute(StatementHandle h, String sql,
-        long maxRowCount, PrepareCallback callback) throws NoSuchStatementException {
-      throw new UnsupportedOperationException();
-    }
-
-    private static ColumnMetaData columnMetaData(String name, int ordinal, AvaticaType type,
-        int columnNullable) {
-      return new ColumnMetaData(
-          ordinal, false, true, false, false,
-          columnNullable,
-          true, -1, name, name, null,
-          0, 0, null, null, type, true, false, false,
-          type.columnClassName());
-    }
-
-    @Override public ExecuteResult prepareAndExecute(StatementHandle h, String sql,
-        long maxRowCount, int maxRowsInFirstFrame, PrepareCallback callback)
-        throws NoSuchStatementException {
-      assertEquals("SELECT * FROM TABLE", sql);
-      List<ColumnMetaData> columns = Arrays.asList(
-          columnMetaData("bool", 0,
-              ColumnMetaData.scalar(Types.BOOLEAN, "BOOLEAN",
-                  ColumnMetaData.Rep.PRIMITIVE_BOOLEAN),
-              DatabaseMetaData.columnNoNulls),
-          columnMetaData("byte", 1,
-              ColumnMetaData.scalar(Types.TINYINT, "TINYINT",
-                  ColumnMetaData.Rep.PRIMITIVE_BYTE),
-              DatabaseMetaData.columnNoNulls),
-          columnMetaData("short", 2,
-              ColumnMetaData.scalar(Types.SMALLINT, "SMALLINT",
-                  ColumnMetaData.Rep.PRIMITIVE_SHORT),
-              DatabaseMetaData.columnNoNulls),
-          columnMetaData("int", 3,
-              ColumnMetaData.scalar(Types.INTEGER, "INTEGER",
-                  ColumnMetaData.Rep.PRIMITIVE_INT),
-              DatabaseMetaData.columnNoNulls),
-          columnMetaData("long", 4,
-              ColumnMetaData.scalar(Types.BIGINT, "BIGINT",
-                  ColumnMetaData.Rep.PRIMITIVE_LONG),
-              DatabaseMetaData.columnNoNulls),
-          columnMetaData("float", 5,
-              ColumnMetaData.scalar(Types.REAL, "REAL",
-                  ColumnMetaData.Rep.FLOAT),
-              DatabaseMetaData.columnNoNulls),
-          columnMetaData("double", 6,
-              ColumnMetaData.scalar(Types.FLOAT, "FLOAT",
-                  ColumnMetaData.Rep.DOUBLE),
-              DatabaseMetaData.columnNoNulls),
-          columnMetaData("string", 7,
-              ColumnMetaData.scalar(Types.VARCHAR, "VARCHAR",
-                  ColumnMetaData.Rep.STRING),
-              DatabaseMetaData.columnNoNulls),
-          columnMetaData("date", 8,
-              ColumnMetaData.scalar(Types.DATE, "DATE",
-                  ColumnMetaData.Rep.JAVA_SQL_DATE),
-              DatabaseMetaData.columnNoNulls),
-          columnMetaData("time", 9,
-              ColumnMetaData.scalar(Types.TIME, "TIME",
-                  ColumnMetaData.Rep.JAVA_SQL_TIME),
-              DatabaseMetaData.columnNoNulls),
-          columnMetaData("timestamp", 10,
-              ColumnMetaData.scalar(Types.TIMESTAMP, "TIMESTAMP",
-                  ColumnMetaData.Rep.JAVA_SQL_TIMESTAMP),
-              DatabaseMetaData.columnNoNulls));
-
-      List<Object> row = Collections.<Object>singletonList(
-          new Object[] {
-            true, (byte) 1, (short) 2, 3, 4L, 5.0f, 6.0d, "testvalue",
-            new Date(1476130718123L), new Time(1476130718123L),
-            new Timestamp(1476130718123L)
-          });
-
-      CursorFactory factory = CursorFactory.deduce(columns, null);
-      Frame frame = new Frame(0, true, row);
-
-      Signature signature = Signature.create(columns, sql,
-          Collections.<AvaticaParameter>emptyList(), factory, StatementType.SELECT);
-      try {
-        synchronized (callback.getMonitor()) {
-          callback.clear();
-          callback.assign(signature, frame, -1);
-        }
-        callback.execute();
-      } catch (SQLException e) {
-        throw new RuntimeException();
-      }
-      MetaResultSet rs = MetaResultSet.create(h.connectionId, 0, false, signature, null);
-      return new ExecuteResult(Collections.singletonList(rs));
-    }
-
-    @Override public ExecuteBatchResult prepareAndExecuteBatch(StatementHandle h,
-        List<String> sqlCommands) throws NoSuchStatementException {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override public ExecuteBatchResult executeBatch(StatementHandle h,
-        List<List<TypedValue>> parameterValues) throws NoSuchStatementException {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override public Frame fetch(StatementHandle h, long offset, int fetchMaxRowCount)
-        throws NoSuchStatementException, MissingResultsException {
-      throw new UnsupportedOperationException();
-    }
-
-    @SuppressWarnings("deprecation")
-    @Override public ExecuteResult execute(StatementHandle h, List<TypedValue> parameterValues,
-        long maxRowCount) throws NoSuchStatementException {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override public ExecuteResult execute(StatementHandle h, List<TypedValue> parameterValues,
-        int maxRowsInFirstFrame) throws NoSuchStatementException {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override public void closeStatement(StatementHandle h) {
-    }
-
-    @Override public boolean syncResults(StatementHandle sh, QueryState state, long offset)
-        throws NoSuchStatementException {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override public void commit(ConnectionHandle ch) {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override public void rollback(ConnectionHandle ch) {
-      throw new UnsupportedOperationException();
-    }
-  }
-
-  /**
-   * Base accessor test helper
-   */
-  private static class AccessorTestHelper {
-    protected final int ordinal;
-
-    protected AccessorTestHelper(int ordinal) {
-      this.ordinal = ordinal;
-    }
-
-    public void testGetString(ResultSet resultSet) throws SQLException {
-      resultSet.getString(ordinal);
-    }
-
-    public void testGetBoolean(ResultSet resultSet) throws SQLException {
-      try {
-        resultSet.getBoolean(ordinal);
-        fail("Was expecting to throw SQLDataException");
-      } catch (Exception e) {
-        assertThat(e, isA((Class) SQLDataException.class)); // success
-      }
-    }
-
-    public void testGetByte(ResultSet resultSet) throws SQLException {
-      try {
-        resultSet.getByte(ordinal);
-        fail("Was expecting to throw SQLDataException");
-      } catch (Exception e) {
-        assertThat(e, isA((Class) SQLDataException.class)); // success
-      }
-    }
-
-    public void testGetShort(ResultSet resultSet) throws SQLException {
-      try {
-        resultSet.getShort(ordinal);
-        fail("Was expecting to throw SQLDataException");
-      } catch (Exception e) {
-        assertThat(e, isA((Class) SQLDataException.class)); // success
-      }
-    }
-
-    public void testGetInt(ResultSet resultSet) throws SQLException {
-      try {
-        resultSet.getInt(ordinal);
-        fail("Was expecting to throw SQLDataException");
-      } catch (Exception e) {
-        assertThat(e, isA((Class) SQLDataException.class)); // success
-      }
-    }
-
-    public void testGetLong(ResultSet resultSet) throws SQLException {
-      try {
-        resultSet.getLong(ordinal);
-        fail("Was expecting to throw SQLDataException");
-      } catch (Exception e) {
-        assertThat(e, isA((Class) SQLDataException.class)); // success
-      }
-    }
-
-    public void testGetFloat(ResultSet resultSet) throws SQLException {
-      try {
-        resultSet.getFloat(ordinal);
-        fail("Was expecting to throw SQLDataException");
-      } catch (Exception e) {
-        assertThat(e, isA((Class) SQLDataException.class)); // success
-      }
-    }
-
-    public void testGetDouble(ResultSet resultSet) throws SQLException {
-      try {
-        resultSet.getDouble(ordinal);
-        fail("Was expecting to throw SQLDataException");
-      } catch (Exception e) {
-        assertThat(e, isA((Class) SQLDataException.class)); // success
-      }
-    }
-
-    public void testGetDecimal(ResultSet resultSet) throws SQLException {
-      try {
-        resultSet.getBigDecimal(ordinal);
-        fail("Was expecting to throw SQLDataException");
-      } catch (Exception e) {
-        assertThat(e, isA((Class) SQLDataException.class)); // success
-      }
-    }
-
-    public void testGetBytes(ResultSet resultSet) throws SQLException {
-      try {
-        resultSet.getBytes(ordinal);
-        fail("Was expecting to throw SQLDataException");
-      } catch (Exception e) {
-        assertThat(e, isA((Class) SQLDataException.class)); // success
-      }
-    }
-
-    public void testGetAsciiStream(ResultSet resultSet) throws SQLException {
-      try {
-        resultSet.getAsciiStream(ordinal);
-        fail("Was expecting to throw SQLDataException");
-      } catch (Exception e) {
-        assertThat(e, isA((Class) SQLDataException.class)); // success
-      }
-    }
-
-    public void testGetBinaryStream(ResultSet resultSet) throws SQLException {
-      try {
-        resultSet.getBinaryStream(ordinal);
-        fail("Was expecting to throw SQLDataException");
-      } catch (Exception e) {
-        assertThat(e, isA((Class) SQLDataException.class)); // success
-      }
-    }
-
-    public void testGetObject(ResultSet resultSet) throws SQLException {
-      resultSet.getObject(ordinal);
-    }
-
-    public void testGetCharacterStream(ResultSet resultSet) throws SQLException {
-      try {
-        resultSet.getCharacterStream(ordinal);
-        fail("Was expecting to throw SQLDataException");
-      } catch (Exception e) {
-        assertThat(e, isA((Class) SQLDataException.class)); // success
-      }
-    }
-
-    public void testGetObject(ResultSet resultSet, Map<String, Class<?>> map) throws SQLException {
-      try {
-        resultSet.getObject(ordinal, map);
-        fail("Was expecting to throw SQLDataException");
-      } catch (Exception e) {
-        assertThat(e, isA((Class) SQLDataException.class)); // success
-      }
-    }
-
-    public void testGetRef(ResultSet resultSet) throws SQLException {
-      try {
-        resultSet.getRef(ordinal);
-        fail("Was expecting to throw SQLDataException");
-      } catch (Exception e) {
-        assertThat(e, isA((Class) SQLDataException.class)); // success
-      }
-    }
-
-    public void testGetBlob(ResultSet resultSet) throws SQLException {
-      try {
-        resultSet.getBlob(ordinal);
-        fail("Was expecting to throw SQLDataException");
-      } catch (Exception e) {
-        assertThat(e, isA((Class) SQLDataException.class)); // success
-      }
-    }
-
-    public void testGetClob(ResultSet resultSet) throws SQLException {
-      try {
-        resultSet.getBlob(ordinal);
-        fail("Was expecting to throw SQLDataException");
-      } catch (Exception e) {
-        assertThat(e, isA((Class) SQLDataException.class)); // success
-      }
-    }
-
-    public void testGetArray(ResultSet resultSet) throws SQLException {
-      try {
-        resultSet.getArray(ordinal);
-        fail("Was expecting to throw SQLDataException");
-      } catch (Exception e) {
-        assertThat(e, isA((Class) SQLDataException.class)); // success
-      }
-    }
-
-    public void testGetDate(ResultSet resultSet, Calendar calendar) throws SQLException {
-      try {
-        resultSet.getDate(ordinal, calendar);
-        fail("Was expecting to throw SQLDataException");
-      } catch (Exception e) {
-        assertThat(e, isA((Class) SQLDataException.class)); // success
-      }
-    }
-
-    public void testGetTime(ResultSet resultSet, Calendar calendar) throws SQLException {
-      try {
-        resultSet.getTime(ordinal, calendar);
-        fail("Was expecting to throw SQLDataException");
-      } catch (Exception e) {
-        assertThat(e, isA((Class) SQLDataException.class)); // success
-      }
-    }
-
-    public void testGetTimestamp(ResultSet resultSet, Calendar calendar) throws SQLException {
-      try {
-        resultSet.getTimestamp(ordinal, calendar);
-        fail("Was expecting to throw SQLDataException");
-      } catch (Exception e) {
-        assertThat(e, isA((Class) SQLDataException.class)); // success
-      }
-    }
-
-    public void getURL(ResultSet resultSet) throws SQLException {
-      try {
-        resultSet.getURL(ordinal);
-        fail("Was expecting to throw SQLDataException");
-      } catch (Exception e) {
-        assertThat(e, isA((Class) SQLDataException.class)); // success
-      }
-    }
-
-    public void testGetNClob(ResultSet resultSet) throws SQLException {
-      try {
-        resultSet.getNClob(ordinal);
-        fail("Was expecting to throw SQLDataException");
-      } catch (Exception e) {
-        assertThat(e, isA((Class) SQLDataException.class)); // success
-      }
-    }
-
-    public void testGetSQLXML(ResultSet resultSet) throws SQLException {
-      try {
-        resultSet.getSQLXML(ordinal);
-        fail("Was expecting to throw SQLDataException");
-      } catch (Exception e) {
-        assertThat(e, isA((Class) SQLDataException.class)); // success
-      }
-    }
-
-    public void testGetNString(ResultSet resultSet) throws SQLException {
-      try {
-        resultSet.getNString(ordinal);
-        fail("Was expecting to throw SQLDataException");
-      } catch (Exception e) {
-        assertThat(e, isA((Class) SQLDataException.class)); // success
-      }
-    }
-
-    public void testGetNCharacterStream(ResultSet resultSet) throws SQLException {
-      try {
-        resultSet.getNCharacterStream(ordinal);
-        fail("Was expecting to throw SQLDataException");
-      } catch (Exception e) {
-        assertThat(e, isA((Class) SQLDataException.class)); // success
-      }
-    }
-  }
-
-  /**
-   * accessor test helper for the boolean column
-   */
-  private static final class BooleanAccesorTestHelper extends AccessorTestHelper {
-    private BooleanAccesorTestHelper(int ordinal) {
-      super(ordinal);
-    }
-
-    @Override public void testGetString(ResultSet resultSet) throws SQLException {
-      assertEquals("true", resultSet.getString(ordinal));
-    }
-
-    @Override public void testGetBoolean(ResultSet resultSet) throws SQLException {
-      assertEquals(true, resultSet.getBoolean(ordinal));
-    }
-
-    @Override public void testGetByte(ResultSet resultSet) throws SQLException {
-      assertEquals((byte) 1, resultSet.getByte(ordinal));
-    }
-
-    @Override public void testGetShort(ResultSet resultSet) throws SQLException {
-      assertEquals((short) 1, resultSet.getShort(ordinal));
-    }
-
-    @Override public void testGetInt(ResultSet resultSet) throws SQLException {
-      assertEquals(1, resultSet.getInt(ordinal));
-    }
-
-    @Override public void testGetLong(ResultSet resultSet) throws SQLException {
-      assertEquals(1L, resultSet.getLong(ordinal));
-    }
-
-    @Override public void testGetDecimal(ResultSet resultSet) throws SQLException {
-      assertEquals(BigDecimal.ONE, resultSet.getBigDecimal(ordinal));
-    }
-
-    @Override public void testGetFloat(ResultSet resultSet) throws SQLException {
-      assertEquals(1.0f, resultSet.getFloat(ordinal), 0);
-    }
-
-    @Override public void testGetDouble(ResultSet resultSet) throws SQLException {
-      assertEquals(1.0d, resultSet.getDouble(ordinal), 0);
-    }
-  }
-
-  /**
-   * accessor test helper for the byte column
-   */
-  private static final class ByteAccesorTestHelper extends AccessorTestHelper {
-    private ByteAccesorTestHelper(int ordinal) {
-      super(ordinal);
-    }
-
-    @Override public void testGetString(ResultSet resultSet) throws SQLException {
-      assertEquals("1", resultSet.getString(ordinal));
-    }
-
-    @Override public void testGetBoolean(ResultSet resultSet) throws SQLException {
-      assertEquals(true, resultSet.getBoolean(ordinal));
-    }
-
-    @Override public void testGetByte(ResultSet resultSet) throws SQLException {
-      assertEquals((byte) 1, resultSet.getByte(ordinal));
-    }
-
-    @Override public void testGetShort(ResultSet resultSet) throws SQLException {
-      assertEquals((short) 1, resultSet.getShort(ordinal));
-    }
-
-    @Override public void testGetInt(ResultSet resultSet) throws SQLException {
-      assertEquals(1, resultSet.getInt(ordinal));
-    }
-
-    @Override public void testGetLong(ResultSet resultSet) throws SQLException {
-      assertEquals(1L, resultSet.getLong(ordinal));
-    }
-
-    @Override public void testGetDecimal(ResultSet resultSet) throws SQLException {
-      assertEquals(BigDecimal.ONE, resultSet.getBigDecimal(ordinal));
-    }
-
-    @Override public void testGetFloat(ResultSet resultSet) throws SQLException {
-      assertEquals(1.0f, resultSet.getFloat(ordinal), 0);
-    }
-
-    @Override public void testGetDouble(ResultSet resultSet) throws SQLException {
-      assertEquals(1.0d, resultSet.getDouble(ordinal), 0);
-    }
-  }
-
-  /**
-   * accessor test helper for the short column
-   */
-  private static final class ShortAccessorTestHelper extends AccessorTestHelper {
-    private ShortAccessorTestHelper(int ordinal) {
-      super(ordinal);
-    }
-
-    @Override public void testGetString(ResultSet resultSet) throws SQLException {
-      assertEquals("2", resultSet.getString(ordinal));
-    }
-
-    @Override public void testGetBoolean(ResultSet resultSet) throws SQLException {
-      assertEquals(true, resultSet.getBoolean(ordinal));
-    }
-
-    @Override public void testGetByte(ResultSet resultSet) throws SQLException {
-      assertEquals((byte) 2, resultSet.getByte(ordinal));
-    }
-
-    @Override public void testGetShort(ResultSet resultSet) throws SQLException {
-      assertEquals((short) 2, resultSet.getShort(ordinal));
-    }
-
-    @Override public void testGetInt(ResultSet resultSet) throws SQLException {
-      assertEquals(2, resultSet.getInt(ordinal));
-    }
-
-    @Override public void testGetLong(ResultSet resultSet) throws SQLException {
-      assertEquals(2L, resultSet.getLong(ordinal));
-    }
-
-    @Override public void testGetDecimal(ResultSet resultSet) throws SQLException {
-      assertEquals(new BigDecimal(2), resultSet.getBigDecimal(ordinal));
-    }
-
-    @Override public void testGetFloat(ResultSet resultSet) throws SQLException {
-      assertEquals(2.0f, resultSet.getFloat(ordinal), 0);
-    }
-
-    @Override public void testGetDouble(ResultSet resultSet) throws SQLException {
-      assertEquals(2.0d, resultSet.getDouble(ordinal), 0);
-    }
-  }
-
-  /**
-   * accessor test helper for the int column
-   */
-  private static final class IntAccessorTestHelper extends AccessorTestHelper {
-    private IntAccessorTestHelper(int ordinal) {
-      super(ordinal);
-    }
-
-    @Override public void testGetString(ResultSet resultSet) throws SQLException {
-      assertEquals("3", resultSet.getString(ordinal));
-    }
-
-    @Override public void testGetBoolean(ResultSet resultSet) throws SQLException {
-      assertEquals(true, resultSet.getBoolean(ordinal));
-    }
-
-    @Override public void testGetByte(ResultSet resultSet) throws SQLException {
-      assertEquals((byte) 3, resultSet.getByte(ordinal));
-    }
-
-    @Override public void testGetShort(ResultSet resultSet) throws SQLException {
-      assertEquals((short) 3, resultSet.getShort(ordinal));
-    }
-
-    @Override public void testGetInt(ResultSet resultSet) throws SQLException {
-      assertEquals(3, resultSet.getInt(ordinal));
-    }
-
-    @Override public void testGetLong(ResultSet resultSet) throws SQLException {
-      assertEquals(3L, resultSet.getLong(ordinal));
-    }
-
-    @Override public void testGetDecimal(ResultSet resultSet) throws SQLException {
-      assertEquals(new BigDecimal(3), resultSet.getBigDecimal(ordinal));
-    }
-
-    @Override public void testGetFloat(ResultSet resultSet) throws SQLException {
-      assertEquals(3.0f, resultSet.getFloat(ordinal), 0);
-    }
-
-    @Override public void testGetDouble(ResultSet resultSet) throws SQLException {
-      assertEquals(3.0d, resultSet.getDouble(ordinal), 0);
-    }
-  }
-
-  /**
-   * accessor test helper for the long column
-   */
-  private static final class LongAccessorTestHelper extends AccessorTestHelper {
-    private LongAccessorTestHelper(int ordinal) {
-      super(ordinal);
-    }
-
-    @Override public void testGetString(ResultSet resultSet) throws SQLException {
-      assertEquals("4", resultSet.getString(ordinal));
-    }
-
-    @Override public void testGetBoolean(ResultSet resultSet) throws SQLException {
-      assertEquals(true, resultSet.getBoolean(ordinal));
-    }
-
-    @Override public void testGetByte(ResultSet resultSet) throws SQLException {
-      assertEquals((byte) 4, resultSet.getByte(ordinal));
-    }
-
-    @Override public void testGetShort(ResultSet resultSet) throws SQLException {
-      assertEquals((short) 4, resultSet.getShort(ordinal));
-    }
-
-    @Override public void testGetInt(ResultSet resultSet) throws SQLException {
-      assertEquals(4, resultSet.getInt(ordinal));
-    }
-
-    @Override public void testGetLong(ResultSet resultSet) throws SQLException {
-      assertEquals(4L, resultSet.getLong(ordinal));
-    }
-
-    @Override public void testGetDecimal(ResultSet resultSet) throws SQLException {
-      assertEquals(new BigDecimal(4), resultSet.getBigDecimal(ordinal));
-    }
-
-    @Override public void testGetFloat(ResultSet resultSet) throws SQLException {
-      assertEquals(4.0f, resultSet.getFloat(ordinal), 0);
-    }
-
-    @Override public void testGetDouble(ResultSet resultSet) throws SQLException {
-      assertEquals(4.0d, resultSet.getDouble(ordinal), 0);
-    }
-  }
-
-  /**
-   * accessor test helper for the float column
-   */
-  private static final class FloatAccessorTestHelper extends AccessorTestHelper {
-    private FloatAccessorTestHelper(int ordinal) {
-      super(ordinal);
-    }
-
-    @Override public void testGetString(ResultSet resultSet) throws SQLException {
-      assertEquals("5.0", resultSet.getString(ordinal));
-    }
-
-    @Override public void testGetBoolean(ResultSet resultSet) throws SQLException {
-      assertEquals(true, resultSet.getBoolean(ordinal));
-    }
-
-    @Override public void testGetByte(ResultSet resultSet) throws SQLException {
-      assertEquals((byte) 5, resultSet.getByte(ordinal));
-    }
-
-    @Override public void testGetShort(ResultSet resultSet) throws SQLException {
-      assertEquals((short) 5, resultSet.getShort(ordinal));
-    }
-
-    @Override public void testGetInt(ResultSet resultSet) throws SQLException {
-      assertEquals(5, resultSet.getInt(ordinal));
-    }
-
-    @Override public void testGetLong(ResultSet resultSet) throws SQLException {
-      assertEquals(5L, resultSet.getLong(ordinal));
-    }
-
-    @Override public void testGetDecimal(ResultSet resultSet) throws SQLException {
-      assertEquals(new BigDecimal(5).setScale(1), resultSet.getBigDecimal(ordinal));
-    }
-
-    @Override public void testGetFloat(ResultSet resultSet) throws SQLException {
-      assertEquals(5.0f, resultSet.getFloat(ordinal), 0);
-    }
-
-    @Override public void testGetDouble(ResultSet resultSet) throws SQLException {
-      assertEquals(5.0d, resultSet.getDouble(ordinal), 0);
-    }
-  }
-
-  /**
-   * accessor test helper for the double column
-   */
-  private static final class DoubleAccessorTestHelper extends AccessorTestHelper {
-    private DoubleAccessorTestHelper(int ordinal) {
-      super(ordinal);
-    }
-
-    @Override public void testGetString(ResultSet resultSet) throws SQLException {
-      assertEquals("6.0", resultSet.getString(ordinal));
-    }
-
-    @Override public void testGetBoolean(ResultSet resultSet) throws SQLException {
-      assertEquals(true, resultSet.getBoolean(ordinal));
-    }
-
-    @Override public void testGetByte(ResultSet resultSet) throws SQLException {
-      assertEquals((byte) 6, resultSet.getByte(ordinal));
-    }
-
-    @Override public void testGetShort(ResultSet resultSet) throws SQLException {
-      assertEquals((short) 6, resultSet.getShort(ordinal));
-    }
-
-    @Override public void testGetInt(ResultSet resultSet) throws SQLException {
-      assertEquals(6, resultSet.getInt(ordinal));
-    }
-
-    @Override public void testGetLong(ResultSet resultSet) throws SQLException {
-      assertEquals(6L, resultSet.getLong(ordinal));
-    }
-
-    @Override public void testGetDecimal(ResultSet resultSet) throws SQLException {
-      assertEquals(new BigDecimal(6).setScale(1), resultSet.getBigDecimal(ordinal));
-    }
-
-    @Override public void testGetFloat(ResultSet resultSet) throws SQLException {
-      assertEquals(6.0f, resultSet.getFloat(ordinal), 0);
-    }
-
-    @Override public void testGetDouble(ResultSet resultSet) throws SQLException {
-      assertEquals(6.0d, resultSet.getDouble(ordinal), 0);
-    }
-  }
-
-  /**
-   * accessor test helper for the date column
-   */
-  private static final class DateAccessorTestHelper extends AccessorTestHelper {
-    private DateAccessorTestHelper(int ordinal) {
-      super(ordinal);
-    }
-
-    @Override public void testGetString(ResultSet resultSet) throws SQLException {
-      assertEquals("2016-10-10", resultSet.getString(ordinal));
-    }
-
-    @Override public void testGetBoolean(ResultSet resultSet) throws SQLException {
-      assertEquals(true, resultSet.getBoolean(ordinal));
-    }
-
-    @Override public void testGetByte(ResultSet resultSet) throws SQLException {
-      assertEquals((byte) -68, resultSet.getByte(ordinal));
-    }
-
-    @Override public void testGetShort(ResultSet resultSet) throws SQLException {
-      assertEquals((short) 17084, resultSet.getShort(ordinal));
-    }
-
-    @Override public void testGetInt(ResultSet resultSet) throws SQLException {
-      assertEquals(17084, resultSet.getInt(ordinal));
-    }
-
-    @Override public void testGetLong(ResultSet resultSet) throws SQLException {
-      assertEquals(17084, resultSet.getLong(ordinal));
-    }
-
-    @Override public void testGetDate(ResultSet resultSet, Calendar calendar) throws SQLException {
-      assertEquals(new Date(1476130718123L), resultSet.getDate(ordinal, calendar));
-    }
-  }
-
-  /**
-   * accessor test helper for the time column
-   */
-  private static final class TimeAccessorTestHelper extends AccessorTestHelper {
-    private TimeAccessorTestHelper(int ordinal) {
-      super(ordinal);
-    }
-
-    @Override public void testGetString(ResultSet resultSet) throws SQLException {
-      assertEquals("20:18:38", resultSet.getString(ordinal));
-    }
-
-    @Override public void testGetBoolean(ResultSet resultSet) throws SQLException {
-      assertEquals(true, resultSet.getBoolean(ordinal));
-    }
-
-    @Override public void testGetByte(ResultSet resultSet) throws SQLException {
-      assertEquals((byte) -85, resultSet.getByte(ordinal));
-    }
-
-    @Override public void testGetShort(ResultSet resultSet) throws SQLException {
-      assertEquals((short) -20053, resultSet.getShort(ordinal));
-    }
-
-    @Override public void testGetInt(ResultSet resultSet) throws SQLException {
-      assertEquals(73118123, resultSet.getInt(ordinal));
-    }
-
-    @Override public void testGetLong(ResultSet resultSet) throws SQLException {
-      assertEquals(73118123, resultSet.getLong(ordinal));
-    }
-
-    @Override public void testGetTime(ResultSet resultSet, Calendar calendar) throws SQLException {
-      assertEquals(new Time(1476130718123L), resultSet.getTime(ordinal, calendar));
-    }
-  }
-
-  /**
-   * accessor test helper for the timestamp column
-   */
-  private static final class TimestampAccessorTestHelper extends AccessorTestHelper {
-    private TimestampAccessorTestHelper(int ordinal) {
-      super(ordinal);
-    }
-
-    @Override public void testGetString(ResultSet resultSet) throws SQLException {
-      assertEquals("2016-10-10 20:18:38", resultSet.getString(ordinal));
-    }
-
-    @Override public void testGetBoolean(ResultSet resultSet) throws SQLException {
-      assertEquals(true, resultSet.getBoolean(ordinal));
-    }
-
-    @Override public void testGetByte(ResultSet resultSet) throws SQLException {
-      assertEquals((byte) -85, resultSet.getByte(ordinal));
-    }
-
-    @Override public void testGetShort(ResultSet resultSet) throws SQLException {
-      assertEquals((short) 16811, resultSet.getShort(ordinal));
-    }
-
-    @Override public void testGetInt(ResultSet resultSet) throws SQLException {
-      assertEquals(-1338031701, resultSet.getInt(ordinal));
-    }
-
-    @Override public void testGetLong(ResultSet resultSet) throws SQLException {
-      assertEquals(1476130718123L, resultSet.getLong(ordinal));
-    }
-
-    @Override public void testGetDate(ResultSet resultSet, Calendar calendar) throws SQLException {
-      assertEquals(new Date(1476130718123L), resultSet.getDate(ordinal, calendar));
-    }
-
-    @Override public void testGetTime(ResultSet resultSet, Calendar calendar) throws SQLException {
-      // how come both are different? DST...
-      //assertEquals(new Time(1476130718123L), resultSet.getTime(ordinal, calendar));
-      assertEquals(new Time(73118123L), resultSet.getTime(ordinal, calendar));
-    }
-
-    @Override public void testGetTimestamp(ResultSet resultSet, Calendar calendar)
-        throws SQLException {
-      assertEquals(new Timestamp(1476130718123L), resultSet.getTimestamp(ordinal, calendar));
-    }
-  }
-
-  /**
-   * accessor test helper for the string column
-   */
-  private static final class StringAccessorTestHelper extends AccessorTestHelper {
-    private StringAccessorTestHelper(int ordinal) {
-      super(ordinal);
-    }
-
-    @Override public void testGetString(ResultSet resultSet) throws SQLException {
-      assertEquals("testvalue", resultSet.getString(ordinal));
-    }
-  }
-
-  private static final Calendar DEFAULT_CALENDAR = DateTimeUtils.calendar();
-
-  private static Connection connection = null;
-  private static ResultSet resultSet = null;
-
-  @BeforeClass
-  public static void executeQuery() throws SQLException {
-    Properties properties = new Properties();
-    properties.setProperty("timeZone", "GMT");
-
-    connection = new TestDriver().connect("jdbc:test", properties);
-    resultSet = connection.createStatement().executeQuery("SELECT * FROM TABLE");
-    resultSet.next(); // move to the first record
-  }
-
-  @AfterClass
-  public static void cleanupQuery() throws SQLException {
-    if (resultSet != null) {
-      resultSet.close();
-    }
-
-    if (connection != null) {
-      connection.close();
-    }
-  }
-
-  @Parameters
-  public static Collection<AccessorTestHelper> data() {
-    return Arrays.<AccessorTestHelper>asList(
-        new BooleanAccesorTestHelper(1),
-        new ByteAccesorTestHelper(2),
-        new ShortAccessorTestHelper(3),
-        new IntAccessorTestHelper(4),
-        new LongAccessorTestHelper(5),
-        new FloatAccessorTestHelper(6),
-        new DoubleAccessorTestHelper(7),
-        new StringAccessorTestHelper(8),
-        new DateAccessorTestHelper(9),
-        new TimeAccessorTestHelper(10),
-        new TimestampAccessorTestHelper(11));
-  }
-
-  private final AccessorTestHelper testHelper;
-
-  public AvaticaResultSetConversionsTest(AccessorTestHelper testHelper) {
-    this.testHelper = testHelper;
-  }
-
-  @Test
-  public void testGetString() throws SQLException {
-    testHelper.testGetString(resultSet);
-  }
-
-  @Test
-  public void testGetBoolean() throws SQLException {
-    testHelper.testGetBoolean(resultSet);
-  }
-
-  @Test
-  public void testGetByte() throws SQLException {
-    testHelper.testGetByte(resultSet);
-  }
-
-  @Test
-  public void testGetShort() throws SQLException {
-    testHelper.testGetShort(resultSet);
-  }
-
-  @Test
-  public void testGetInt() throws SQLException {
-    testHelper.testGetInt(resultSet);
-  }
-
-  @Test
-  public void testGetLong() throws SQLException {
-    testHelper.testGetLong(resultSet);
-  }
-
-  @Test
-  public void testGetFloat() throws SQLException {
-    testHelper.testGetFloat(resultSet);
-  }
-
-  @Test
-  public void testGetDouble() throws SQLException {
-    testHelper.testGetDouble(resultSet);
-  }
-
-  @Test
-  public void testGetDecimal() throws SQLException {
-    testHelper.testGetDecimal(resultSet);
-  }
-
-  @Test
-  public void testGetBytes() throws SQLException {
-    testHelper.testGetBytes(resultSet);
-  }
-
-  @Test
-  public void testGetAsciiStream() throws SQLException {
-    testHelper.testGetAsciiStream(resultSet);
-  }
-
-  @Test
-  public void testGetBinaryStream() throws SQLException {
-    testHelper.testGetBinaryStream(resultSet);
-  }
-
-  @Test
-  public void testGetObject() throws SQLException {
-    testHelper.testGetObject(resultSet);
-  }
-
-  @Test
-  public void testGetCharacterStream() throws SQLException {
-    testHelper.testGetCharacterStream(resultSet);
-  }
-
-  @Test
-  public void testGetObjectWithMap() throws SQLException {
-    testHelper.testGetObject(resultSet, Collections.<String, Class<?>>emptyMap());
-  }
-
-  @Test
-  public void testGetRef() throws SQLException {
-    testHelper.testGetRef(resultSet);
-  }
-
-  @Test
-  public void testGetBlob() throws SQLException {
-    testHelper.testGetBlob(resultSet);
-  }
-
-  @Test
-  public void testGetClob() throws SQLException {
-    testHelper.testGetClob(resultSet);
-  }
-
-  @Test
-  public void testGetArray() throws SQLException {
-    testHelper.testGetArray(resultSet);
-  }
-
-  @Test
-  public void testGetDate() throws SQLException {
-    testHelper.testGetDate(resultSet, DEFAULT_CALENDAR);
-  }
-
-  @Test
-  public void testGetTime() throws SQLException {
-    testHelper.testGetTime(resultSet, DEFAULT_CALENDAR);
-  }
-
-  @Test
-  public void testGetTimestamp() throws SQLException {
-    testHelper.testGetTimestamp(resultSet, DEFAULT_CALENDAR);
-  }
-
-  @Test
-  public void getURL() throws SQLException {
-    testHelper.getURL(resultSet);
-  }
-
-  @Test
-  public void testGetNClob() throws SQLException {
-    testHelper.testGetNClob(resultSet);
-  }
-
-  @Test
-  public void testGetSQLXML() throws SQLException {
-    testHelper.testGetSQLXML(resultSet);
-  }
-
-  @Test
-  public void testGetNString() throws SQLException {
-    testHelper.testGetNString(resultSet);
-  }
-
-  @Test
-  public void testGetNCharacterStream() throws SQLException {
-    testHelper.testGetNCharacterStream(resultSet);
-  }
-}
-
-// End AvaticaResultSetConversionsTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/test/java/org/apache/calcite/avatica/AvaticaStatementTest.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/test/java/org/apache/calcite/avatica/AvaticaStatementTest.java b/avatica/core/src/test/java/org/apache/calcite/avatica/AvaticaStatementTest.java
deleted file mode 100644
index 5f6b56a..0000000
--- a/avatica/core/src/test/java/org/apache/calcite/avatica/AvaticaStatementTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import java.sql.SQLException;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-/**
- * Test class for AvaticaStatement
- */
-public class AvaticaStatementTest {
-
-  private AvaticaStatement statement;
-
-  @Before public void setup() {
-    statement = mock(AvaticaStatement.class);
-  }
-
-  @Test public void testUpdateCounts() throws SQLException {
-    long[] longValues = new long[] {-1, -3, 1, 5, ((long) Integer.MAX_VALUE) + 1};
-    int[] intValues = new int[] {-1, -3, 1, 5, Integer.MAX_VALUE};
-    when(statement.executeBatch()).thenCallRealMethod();
-    when(statement.executeLargeBatch()).thenCallRealMethod();
-    when(statement.executeBatchInternal()).thenReturn(longValues);
-
-    assertArrayEquals(intValues, statement.executeBatch());
-    assertArrayEquals(longValues, statement.executeLargeBatch());
-  }
-}
-
-// End AvaticaStatementTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/test/java/org/apache/calcite/avatica/ConnectionConfigImplTest.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/test/java/org/apache/calcite/avatica/ConnectionConfigImplTest.java b/avatica/core/src/test/java/org/apache/calcite/avatica/ConnectionConfigImplTest.java
deleted file mode 100644
index bbe30e1..0000000
--- a/avatica/core/src/test/java/org/apache/calcite/avatica/ConnectionConfigImplTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import org.junit.Test;
-
-import java.util.Properties;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-
-/**
- * Test class for {@link ConnectionConfigImpl}.
- */
-public class ConnectionConfigImplTest {
-
-  @Test public void testTrustStore() {
-    final String truststore = "/my/truststore.jks";
-    final String pw = "supremelysecret";
-    Properties props = new Properties();
-    props.setProperty(BuiltInConnectionProperty.TRUSTSTORE.name(), truststore);
-    props.setProperty(BuiltInConnectionProperty.TRUSTSTORE_PASSWORD.name(), pw);
-    ConnectionConfigImpl config = new ConnectionConfigImpl(props);
-    assertEquals(truststore, config.truststore().getAbsolutePath());
-    assertEquals(pw, config.truststorePassword());
-  }
-
-  @Test public void testNoTruststore() {
-    Properties props = new Properties();
-    ConnectionConfigImpl config = new ConnectionConfigImpl(props);
-    assertNull(config.truststore());
-    assertNull(config.truststorePassword());
-  }
-}
-
-// End ConnectionConfigImplTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/test/java/org/apache/calcite/avatica/FrameTest.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/test/java/org/apache/calcite/avatica/FrameTest.java b/avatica/core/src/test/java/org/apache/calcite/avatica/FrameTest.java
deleted file mode 100644
index e17bf92..0000000
--- a/avatica/core/src/test/java/org/apache/calcite/avatica/FrameTest.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import org.apache.calcite.avatica.Meta.Frame;
-import org.apache.calcite.avatica.proto.Common;
-import org.apache.calcite.avatica.proto.Common.ColumnValue;
-import org.apache.calcite.avatica.proto.Common.TypedValue;
-
-import org.junit.Test;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-/**
- * Tests serialization of {@link Frame}.
- */
-public class FrameTest {
-
-  private static final TypedValue NUMBER_VALUE = TypedValue.newBuilder().setNumberValue(1)
-      .setType(Common.Rep.LONG).build();
-
-  private void serializeAndTestEquality(Frame frame) {
-    Frame frameCopy = Frame.fromProto(frame.toProto());
-
-    assertEquals(frame.done, frameCopy.done);
-    assertEquals(frame.offset, frameCopy.offset);
-
-    Iterable<Object> origRows = frame.rows;
-    Iterable<Object> copiedRows = frameCopy.rows;
-
-    assertEquals("Expected rows to both be null, or both be non-null",
-        origRows == null, copiedRows == null);
-
-    Iterator<Object> origIter = origRows.iterator();
-    Iterator<Object> copiedIter = copiedRows.iterator();
-    while (origIter.hasNext() && copiedIter.hasNext()) {
-      Object orig = origIter.next();
-      Object copy = copiedIter.next();
-
-      assertEquals(orig == null, copy == null);
-
-      // This is goofy, but it seems like an Array comes from the JDBC implementation but then
-      // the resulting Frame has a List to support the Avatica typed Accessors
-      assertEquals(Object[].class, orig.getClass());
-      assertTrue("Expected List but got " + copy.getClass(), copy instanceof List);
-
-      @SuppressWarnings("unchecked")
-      List<Object> copyList = (List<Object>) copy;
-
-      assertArrayEquals((Object[]) orig, copyList.toArray(new Object[0]));
-    }
-
-    assertEquals(origIter.hasNext(), copiedIter.hasNext());
-  }
-
-  @Test
-  public void testEmpty() {
-    serializeAndTestEquality(Frame.EMPTY);
-  }
-
-  @Test
-  public void testSingleRow() {
-    ArrayList<Object> rows = new ArrayList<>();
-    rows.add(new Object[] {"string", Integer.MAX_VALUE, new Date().getTime()});
-
-    Frame singleRow = new Frame(0, true, rows);
-
-    serializeAndTestEquality(singleRow);
-  }
-
-  @Test
-  public void testMultipleRows() {
-    ArrayList<Object> rows = new ArrayList<>();
-    rows.add(new Object[] {"string", Integer.MAX_VALUE, new Date().getTime()});
-    rows.add(new Object[] {"gnirts", 0, Long.MIN_VALUE});
-    rows.add(new Object[] {"", null, Long.MAX_VALUE});
-
-    Frame singleRow = new Frame(0, true, rows);
-
-    serializeAndTestEquality(singleRow);
-  }
-
-  @Test public void testMalformedColumnValue() {
-    // Invalid ColumnValue: has an array and scalar
-    final ColumnValue bothAttributesColumnValue = ColumnValue.newBuilder().setHasArrayValue(true)
-        .setScalarValue(NUMBER_VALUE).build();
-    // Note omission of setScalarValue(TypedValue).
-    final ColumnValue neitherAttributeColumnValue = ColumnValue.newBuilder().setHasArrayValue(false)
-        .build();
-
-    try {
-      Frame.validateColumnValue(bothAttributesColumnValue);
-      fail("Validating the ColumnValue should have failed as it has an array and scalar");
-    } catch (IllegalArgumentException e) {
-      // Pass
-    }
-
-    try {
-      Frame.validateColumnValue(neitherAttributeColumnValue);
-      fail("Validating the ColumnValue should have failed as it has neither an array nor scalar");
-    } catch (IllegalArgumentException e) {
-      // Pass
-    }
-  }
-
-  @Test public void testColumnValueBackwardsCompatibility() {
-    // 1
-    final ColumnValue oldStyleScalarValue = ColumnValue.newBuilder().addValue(NUMBER_VALUE).build();
-    // [1, 1]
-    final ColumnValue oldStyleArrayValue = ColumnValue.newBuilder().addValue(NUMBER_VALUE)
-        .addValue(NUMBER_VALUE).build();
-
-    assertFalse(Frame.isNewStyleColumn(oldStyleScalarValue));
-    assertFalse(Frame.isNewStyleColumn(oldStyleArrayValue));
-
-    Object scalar = Frame.parseOldStyleColumn(oldStyleScalarValue);
-    assertEquals(1L, scalar);
-
-    Object array = Frame.parseOldStyleColumn(oldStyleArrayValue);
-    assertEquals(Arrays.asList(1L, 1L), array);
-  }
-
-  @Test public void testColumnValueParsing() {
-    // 1
-    final ColumnValue scalarValue = ColumnValue.newBuilder().setScalarValue(NUMBER_VALUE).build();
-    // [1, 1]
-    final ColumnValue arrayValue = ColumnValue.newBuilder().addArrayValue(NUMBER_VALUE)
-        .addArrayValue(NUMBER_VALUE).setHasArrayValue(true).build();
-
-    assertTrue(Frame.isNewStyleColumn(scalarValue));
-    assertTrue(Frame.isNewStyleColumn(arrayValue));
-
-    Object scalar = Frame.parseColumn(scalarValue);
-    assertEquals(1L, scalar);
-
-    Object array = Frame.parseColumn(arrayValue);
-    assertEquals(Arrays.asList(1L, 1L), array);
-  }
-
-  @Test public void testDeprecatedValueAttributeForScalars() {
-    // Create a row with schema: [VARCHAR, INTEGER, DATE]
-    List<Object> rows = Collections.<Object>singletonList(new Object[] {"string", Integer.MAX_VALUE,
-        new Date().getTime()});
-    Meta.Frame frame = Meta.Frame.create(0, true, rows);
-    // Convert it to a protobuf
-    Common.Frame protoFrame = frame.toProto();
-    assertEquals(1, protoFrame.getRowsCount());
-    // Get that row we created
-    Common.Row protoRow = protoFrame.getRows(0);
-    // One row has many columns
-    List<Common.ColumnValue> protoColumns = protoRow.getValueList();
-    assertEquals(3, protoColumns.size());
-    // Verify that the scalar value is also present in the deprecated values attributes.
-    List<Common.TypedValue> deprecatedValues = protoColumns.get(0).getValueList();
-    assertEquals(1, deprecatedValues.size());
-    Common.TypedValue scalarValue = protoColumns.get(0).getScalarValue();
-    assertEquals(deprecatedValues.get(0), scalarValue);
-  }
-
-  @Test public void testDeprecatedValueAttributeForArrays() {
-    // Create a row with schema: [VARCHAR, ARRAY]
-    List<Object> rows = Collections.<Object>singletonList(new Object[] {"string",
-        Arrays.asList(1, 2, 3)});
-    Meta.Frame frame = Meta.Frame.create(0, true, rows);
-    // Convert it to a protobuf
-    Common.Frame protoFrame = frame.toProto();
-    assertEquals(1, protoFrame.getRowsCount());
-    // Get that row we created
-    Common.Row protoRow = protoFrame.getRows(0);
-    // One row has many columns
-    List<Common.ColumnValue> protoColumns = protoRow.getValueList();
-    // We should have two columns
-    assertEquals(2, protoColumns.size());
-    // Fetch the ARRAY column
-    Common.ColumnValue protoColumn = protoColumns.get(1);
-    // We should have the 3 ARRAY elements in the array_values attribute as well as the deprecated
-    // values attribute.
-    List<Common.TypedValue> deprecatedValues = protoColumn.getValueList();
-    assertEquals(3, deprecatedValues.size());
-    assertTrue("Column 2 should have an array_value", protoColumns.get(1).getHasArrayValue());
-    List<Common.TypedValue> arrayValues = protoColumns.get(1).getArrayValueList();
-    assertEquals(arrayValues, deprecatedValues);
-  }
-}
-
-// End FrameTest.java


[21/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/server/src/test/java/org/apache/calcite/avatica/server/DigestAuthHttpServerTest.java
----------------------------------------------------------------------
diff --git a/avatica/server/src/test/java/org/apache/calcite/avatica/server/DigestAuthHttpServerTest.java b/avatica/server/src/test/java/org/apache/calcite/avatica/server/DigestAuthHttpServerTest.java
deleted file mode 100644
index 7277444..0000000
--- a/avatica/server/src/test/java/org/apache/calcite/avatica/server/DigestAuthHttpServerTest.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.server;
-
-import org.apache.calcite.avatica.ConnectionSpec;
-import org.apache.calcite.avatica.jdbc.JdbcMeta;
-import org.apache.calcite.avatica.remote.Driver;
-import org.apache.calcite.avatica.remote.LocalService;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import java.util.Properties;
-
-import static org.hamcrest.core.StringContains.containsString;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
-
-/**
- * Test class for HTTP Digest authentication.
- */
-public class DigestAuthHttpServerTest extends HttpAuthBase {
-
-  private static final ConnectionSpec CONNECTION_SPEC = ConnectionSpec.HSQLDB;
-  private static HttpServer server;
-  private static String url;
-
-  @BeforeClass public static void startServer() throws Exception {
-    final String userPropertiesFile = BasicAuthHttpServerTest.class
-        .getResource("/auth-users.properties").getFile();
-    assertNotNull("Could not find properties file for digest auth users", userPropertiesFile);
-
-    // Create a LocalService around HSQLDB
-    final JdbcMeta jdbcMeta = new JdbcMeta(CONNECTION_SPEC.url,
-        CONNECTION_SPEC.username, CONNECTION_SPEC.password);
-    LocalService service = new LocalService(jdbcMeta);
-
-    server = new HttpServer.Builder()
-        .withDigestAuthentication(userPropertiesFile, new String[] { "users" })
-        .withHandler(service, Driver.Serialization.PROTOBUF)
-        .withPort(0)
-        .build();
-    server.start();
-
-    url = "jdbc:avatica:remote:url=http://localhost:" + server.getPort()
-        + ";authentication=DIGEST;serialization=PROTOBUF";
-
-    // Create and grant permissions to our users
-    createHsqldbUsers();
-  }
-
-  @AfterClass public static void stopServer() throws Exception {
-    if (null != server) {
-      server.stop();
-    }
-  }
-
-  @Test public void testValidUser() throws Exception {
-    // Valid both with avatica and hsqldb
-    final Properties props = new Properties();
-    props.put("avatica_user", "USER2");
-    props.put("avatica_password", "password2");
-    props.put("user", "USER2");
-    props.put("password", "password2");
-
-    readWriteData(url, "VALID_USER", props);
-  }
-
-  @Test public void testInvalidAvaticaValidDb() throws Exception {
-    // Valid both with avatica and hsqldb
-    final Properties props = new Properties();
-    props.put("avatica_user", "USER2");
-    props.put("avatica_password", "foobar");
-    props.put("user", "USER2");
-    props.put("password", "password2");
-
-    try {
-      readWriteData(url, "INVALID_AVATICA_VALID_DB", props);
-      fail("Expected a failure");
-    } catch (RuntimeException e) {
-      assertThat(e.getMessage(), containsString("HTTP/401"));
-    }
-  }
-
-  @Test public void testValidAvaticaNoDb() throws Exception {
-    // Valid both with avatica and hsqldb
-    final Properties props = new Properties();
-    props.put("avatica_user", "USER2");
-    props.put("avatica_password", "password2");
-
-    readWriteData(url, "VALID_AVATICA_NO_DB", props);
-  }
-
-  @Test public void testInvalidAvaticaNoDb() throws Exception {
-    // Valid both with avatica and hsqldb
-    final Properties props = new Properties();
-    props.put("avatica_user", "USER2");
-    props.put("avatica_password", "foobar");
-
-    try {
-      readWriteData(url, "INVALID_AVATICA_NO_DB", props);
-      fail("Expected a failure");
-    } catch (RuntimeException e) {
-      assertThat(e.getMessage(), containsString("HTTP/401"));
-    }
-  }
-
-  @Test public void testInvalidUser() throws Exception {
-    // Invalid avatica user
-    final Properties props = new Properties();
-    props.put("avatica_user", "foo");
-    props.put("avatica_password", "bar");
-
-    try {
-      readWriteData(url, "INVALID_USER", props);
-      fail("Expected a failure");
-    } catch (RuntimeException e) {
-      assertThat(e.getMessage(), containsString("HTTP/401"));
-    }
-  }
-
-  @Test public void testUserWithDisallowedRole() throws Exception {
-    // User 4 is disallowed in avatica due to its roles
-    final Properties props = new Properties();
-    props.put("avatica_user", "USER4");
-    props.put("avatica_password", "password4");
-
-    try {
-      readWriteData(url, "DISALLOWED_USER", props);
-      fail("Expected a failure");
-    } catch (RuntimeException e) {
-      assertThat(e.getMessage(), containsString("HTTP/403"));
-    }
-  }
-
-  @Test public void testAllowedAvaticaDisabledHsqldbUser() throws Exception {
-    // Valid Avatica user, but an invalid database user
-    final Properties props = new Properties();
-    props.put("avatica_user", "USER1");
-    props.put("avatica_password", "password1");
-    props.put("user", "USER1");
-    props.put("password", "password1");
-
-    try {
-      readWriteData(url, "DISALLOWED_HSQLDB_USER", props);
-      fail("Expected a failure");
-    } catch (RuntimeException e) {
-      assertEquals("Remote driver error: RuntimeException: "
-          + "java.sql.SQLInvalidAuthorizationSpecException: invalid authorization specification"
-          + " - not found: USER1"
-          + " -> SQLInvalidAuthorizationSpecException: invalid authorization specification - "
-          + "not found: USER1"
-          + " -> HsqlException: invalid authorization specification - not found: USER1",
-          e.getMessage());
-    }
-  }
-}
-
-// End DigestAuthHttpServerTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/server/src/test/java/org/apache/calcite/avatica/server/HandlerFactoryTest.java
----------------------------------------------------------------------
diff --git a/avatica/server/src/test/java/org/apache/calcite/avatica/server/HandlerFactoryTest.java b/avatica/server/src/test/java/org/apache/calcite/avatica/server/HandlerFactoryTest.java
deleted file mode 100644
index 3504e02..0000000
--- a/avatica/server/src/test/java/org/apache/calcite/avatica/server/HandlerFactoryTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.server;
-
-import org.apache.calcite.avatica.remote.Driver.Serialization;
-import org.apache.calcite.avatica.remote.Service;
-
-import org.eclipse.jetty.server.Handler;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import static org.junit.Assert.assertTrue;
-
-/**
- * Tests the {@link HandlerFactory} implementation.
- */
-public class HandlerFactoryTest {
-
-  private HandlerFactory factory;
-  private Service service;
-
-  @Before
-  public void setup() {
-    this.factory = new HandlerFactory();
-    this.service = Mockito.mock(Service.class);
-  }
-
-  @Test
-  public void testJson() {
-    Handler handler = factory.getHandler(service, Serialization.JSON);
-    assertTrue("Expected an implementation of the AvaticaHandler, "
-        + "but got " + handler.getClass(), handler instanceof AvaticaJsonHandler);
-  }
-
-  @Test
-  public void testProtobuf() {
-    Handler handler = factory.getHandler(service, Serialization.PROTOBUF);
-    assertTrue("Expected an implementation of the AvaticaProtobufHandler, "
-        + "but got " + handler.getClass(), handler instanceof AvaticaProtobufHandler);
-  }
-}
-
-// End HandlerFactoryTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/server/src/test/java/org/apache/calcite/avatica/server/HttpAuthBase.java
----------------------------------------------------------------------
diff --git a/avatica/server/src/test/java/org/apache/calcite/avatica/server/HttpAuthBase.java b/avatica/server/src/test/java/org/apache/calcite/avatica/server/HttpAuthBase.java
deleted file mode 100644
index cfaf302..0000000
--- a/avatica/server/src/test/java/org/apache/calcite/avatica/server/HttpAuthBase.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.server;
-
-import org.apache.calcite.avatica.ConnectionSpec;
-
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.Properties;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-/**
- * Common test logic for HTTP basic and digest auth
- */
-public class HttpAuthBase {
-
-  static boolean userExists(Statement stmt, String user) throws SQLException {
-    ResultSet results = stmt.executeQuery(
-        "SELECT * FROM INFORMATION_SCHEMA.SYSTEM_USERS WHERE USER_NAME = '" + user + "'");
-    return results.next();
-  }
-
-  static void createHsqldbUsers() throws SQLException {
-    try (Connection conn = DriverManager.getConnection(ConnectionSpec.HSQLDB.url,
-        ConnectionSpec.HSQLDB.username, ConnectionSpec.HSQLDB.password);
-        Statement stmt = conn.createStatement()) {
-      for (int i = 2; i <= 5; i++) {
-        // Users 2-5 exist (not user1)
-        final String username = "USER" + i;
-        final String password = "password" + i;
-        if (userExists(stmt, username)) {
-          stmt.execute("DROP USER " + username);
-        }
-        stmt.execute("CREATE USER " + username + " PASSWORD '" + password + "'");
-        // Grant permission to the user we create (defined in the scottdb hsqldb impl)
-        stmt.execute("GRANT DBA TO " + username);
-      }
-    }
-  }
-
-  void readWriteData(String url, String tableName, Properties props) throws Exception {
-    try (Connection conn = DriverManager.getConnection(url, props);
-        Statement stmt = conn.createStatement()) {
-      assertFalse(stmt.execute("DROP TABLE IF EXISTS " + tableName));
-      assertFalse(stmt.execute("CREATE TABLE " + tableName + " (pk integer, msg varchar(10))"));
-
-      assertEquals(1, stmt.executeUpdate("INSERT INTO " + tableName + " VALUES(1, 'abcd')"));
-      assertEquals(1, stmt.executeUpdate("INSERT INTO " + tableName + " VALUES(2, 'bcde')"));
-      assertEquals(1, stmt.executeUpdate("INSERT INTO " + tableName + " VALUES(3, 'cdef')"));
-
-      ResultSet results = stmt.executeQuery("SELECT count(1) FROM " + tableName);
-      assertNotNull(results);
-      assertTrue(results.next());
-      assertEquals(3, results.getInt(1));
-    }
-  }
-}
-
-// End HttpAuthBase.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/server/src/test/java/org/apache/calcite/avatica/server/HttpServerBuilderTest.java
----------------------------------------------------------------------
diff --git a/avatica/server/src/test/java/org/apache/calcite/avatica/server/HttpServerBuilderTest.java b/avatica/server/src/test/java/org/apache/calcite/avatica/server/HttpServerBuilderTest.java
deleted file mode 100644
index 41bb88b..0000000
--- a/avatica/server/src/test/java/org/apache/calcite/avatica/server/HttpServerBuilderTest.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.server;
-
-import org.apache.calcite.avatica.remote.Driver.Serialization;
-import org.apache.calcite.avatica.remote.Service;
-
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertNull;
-
-/**
- * Test class for {@link HttpServer}.
- */
-public class HttpServerBuilderTest {
-
-  @Test public void extraAllowedRolesConfigured() {
-    final String[] extraRoles = new String[] {"BAR.COM"};
-    final Service mockService = Mockito.mock(Service.class);
-    HttpServer server = new HttpServer.Builder()
-        .withSpnego("HTTP/localhost.localdomain@EXAMPLE.COM", extraRoles)
-        .withHandler(mockService, Serialization.JSON)
-        .build();
-
-    assertArrayEquals(extraRoles, server.getConfig().getAllowedRoles());
-
-    assertArrayEquals(new String[] {"EXAMPLE.COM", "BAR.COM"},
-        server.getAllowedRealms("EXAMPLE.COM", server.getConfig()));
-  }
-
-  @Test public void lotsOfExtraRoles() {
-    final String[] extraRoles = new String[] {"BAR.COM", "BAZ.COM", "FOO.COM"};
-    final Service mockService = Mockito.mock(Service.class);
-    HttpServer server = new HttpServer.Builder()
-        .withSpnego("HTTP/localhost.localdomain@EXAMPLE.COM", extraRoles)
-        .withHandler(mockService, Serialization.JSON)
-        .build();
-
-    assertArrayEquals(extraRoles, server.getConfig().getAllowedRoles());
-
-    assertArrayEquals(new String[] {"EXAMPLE.COM", "BAR.COM", "BAZ.COM", "FOO.COM"},
-        server.getAllowedRealms("EXAMPLE.COM", server.getConfig()));
-  }
-
-  @Test public void nullExtraRoles() {
-    final String[] extraRoles = null;
-    final Service mockService = Mockito.mock(Service.class);
-    HttpServer server = new HttpServer.Builder()
-        .withSpnego("HTTP/localhost.localdomain@EXAMPLE.COM", extraRoles)
-        .withHandler(mockService, Serialization.JSON)
-        .build();
-
-    assertNull(server.getConfig().getAllowedRoles());
-
-    assertArrayEquals(new String[] {"EXAMPLE.COM"},
-        server.getAllowedRealms("EXAMPLE.COM", server.getConfig()));
-  }
-
-  @Test public void emptyExtraRoles() {
-    final String[] extraRoles = new String[0];
-    final Service mockService = Mockito.mock(Service.class);
-    HttpServer server = new HttpServer.Builder()
-        .withSpnego("HTTP/localhost.localdomain@EXAMPLE.COM", extraRoles)
-        .withHandler(mockService, Serialization.JSON)
-        .build();
-
-    assertArrayEquals(extraRoles, server.getConfig().getAllowedRoles());
-
-    assertArrayEquals(new String[] {"EXAMPLE.COM"},
-        server.getAllowedRealms("EXAMPLE.COM", server.getConfig()));
-  }
-
-  @Test public void extraAllowedRolesConfiguredWithExplitRealm() {
-    final String[] extraRoles = new String[] {"BAR.COM"};
-    final Service mockService = Mockito.mock(Service.class);
-    HttpServer server = new HttpServer.Builder()
-        .withSpnego("HTTP/localhost.localdomain@EXAMPLE.COM", "EXAMPLE.COM", extraRoles)
-        .withHandler(mockService, Serialization.JSON)
-        .build();
-
-    assertArrayEquals(extraRoles, server.getConfig().getAllowedRoles());
-
-    assertArrayEquals(new String[] {"EXAMPLE.COM", "BAR.COM"},
-        server.getAllowedRealms("EXAMPLE.COM", server.getConfig()));
-  }
-
-  @Test public void lotsOfExtraRolesWithExplitRealm() {
-    final String[] extraRoles = new String[] {"BAR.COM", "BAZ.COM", "FOO.COM"};
-    final Service mockService = Mockito.mock(Service.class);
-    HttpServer server = new HttpServer.Builder()
-        .withSpnego("HTTP/localhost.localdomain@EXAMPLE.COM", "EXAMPLE.COM", extraRoles)
-        .withHandler(mockService, Serialization.JSON)
-        .build();
-
-    assertArrayEquals(extraRoles, server.getConfig().getAllowedRoles());
-
-    assertArrayEquals(new String[] {"EXAMPLE.COM", "BAR.COM", "BAZ.COM", "FOO.COM"},
-        server.getAllowedRealms("EXAMPLE.COM", server.getConfig()));
-  }
-
-  @Test public void nullExtraRolesWithExplitRealm() {
-    final String[] extraRoles = null;
-    final Service mockService = Mockito.mock(Service.class);
-    HttpServer server = new HttpServer.Builder()
-        .withSpnego("HTTP/localhost.localdomain@EXAMPLE.COM", "EXAMPLE.COM", extraRoles)
-        .withHandler(mockService, Serialization.JSON)
-        .build();
-
-    assertNull(server.getConfig().getAllowedRoles());
-
-    assertArrayEquals(new String[] {"EXAMPLE.COM"},
-        server.getAllowedRealms("EXAMPLE.COM", server.getConfig()));
-  }
-
-  @Test public void emptyExtraRolesWithExplitRealm() {
-    final String[] extraRoles = new String[0];
-    final Service mockService = Mockito.mock(Service.class);
-    HttpServer server = new HttpServer.Builder()
-        .withSpnego("HTTP/localhost.localdomain@EXAMPLE.COM", "EXAMPLE.COM", extraRoles)
-        .withHandler(mockService, Serialization.JSON)
-        .build();
-
-    assertArrayEquals(extraRoles, server.getConfig().getAllowedRoles());
-
-    assertArrayEquals(new String[] {"EXAMPLE.COM"},
-        server.getAllowedRealms("EXAMPLE.COM", server.getConfig()));
-  }
-}
-
-// End HttpServerBuilderTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/server/src/test/java/org/apache/calcite/avatica/server/HttpServerSpnegoWithJaasTest.java
----------------------------------------------------------------------
diff --git a/avatica/server/src/test/java/org/apache/calcite/avatica/server/HttpServerSpnegoWithJaasTest.java b/avatica/server/src/test/java/org/apache/calcite/avatica/server/HttpServerSpnegoWithJaasTest.java
deleted file mode 100644
index 8f6fede..0000000
--- a/avatica/server/src/test/java/org/apache/calcite/avatica/server/HttpServerSpnegoWithJaasTest.java
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.server;
-
-import org.apache.calcite.avatica.SpnegoTestUtil;
-import org.apache.calcite.avatica.remote.AvaticaCommonsHttpClientSpnegoImpl;
-
-import org.apache.kerby.kerberos.kerb.KrbException;
-import org.apache.kerby.kerberos.kerb.client.JaasKrbUtil;
-import org.apache.kerby.kerberos.kerb.client.KrbConfig;
-import org.apache.kerby.kerberos.kerb.client.KrbConfigKey;
-import org.apache.kerby.kerberos.kerb.server.SimpleKdcServer;
-
-import org.ietf.jgss.GSSCredential;
-import org.ietf.jgss.GSSManager;
-import org.ietf.jgss.GSSName;
-import org.ietf.jgss.Oid;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.nio.charset.StandardCharsets;
-import java.security.Principal;
-import java.security.PrivilegedExceptionAction;
-import java.util.Set;
-
-import javax.security.auth.Subject;
-import javax.security.auth.kerberos.KerberosTicket;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-/**
- * Test class for SPNEGO with Kerberos. Purely testing SPNEGO, not the Avatica "protocol" on top
- * of that HTTP. This variant of the test requires that the user use JAAS configuration to
- * perform server-side login.
- */
-public class HttpServerSpnegoWithJaasTest {
-  private static final Logger LOG = LoggerFactory.getLogger(HttpServerSpnegoWithJaasTest.class);
-
-  private static SimpleKdcServer kdc;
-  private static HttpServer httpServer;
-
-  private static KrbConfig clientConfig;
-
-  private static int kdcPort;
-
-  private static File clientKeytab;
-  private static File serverKeytab;
-
-  private static File serverSpnegoConfigFile;
-
-  private static boolean isKdcStarted = false;
-  private static boolean isHttpServerStarted = false;
-
-  private static URL httpServerUrl;
-
-  @BeforeClass public static void setupKdc() throws Exception {
-    kdc = new SimpleKdcServer();
-    File target = new File(System.getProperty("user.dir"), "target");
-    assertTrue(target.exists());
-
-    File kdcDir = new File(target, HttpServerSpnegoWithJaasTest.class.getSimpleName());
-    if (kdcDir.exists()) {
-      SpnegoTestUtil.deleteRecursively(kdcDir);
-    }
-    kdcDir.mkdirs();
-    kdc.setWorkDir(kdcDir);
-
-    kdc.setKdcHost(SpnegoTestUtil.KDC_HOST);
-    kdcPort = SpnegoTestUtil.getFreePort();
-    kdc.setAllowTcp(true);
-    kdc.setAllowUdp(false);
-    kdc.setKdcTcpPort(kdcPort);
-
-    LOG.info("Starting KDC server at {}:{}", SpnegoTestUtil.KDC_HOST, kdcPort);
-
-    kdc.init();
-    kdc.start();
-    isKdcStarted = true;
-
-    File keytabDir = new File(target, HttpServerSpnegoWithJaasTest.class.getSimpleName()
-        + "_keytabs");
-    if (keytabDir.exists()) {
-      SpnegoTestUtil.deleteRecursively(keytabDir);
-    }
-    keytabDir.mkdirs();
-    setupUsers(keytabDir);
-
-    clientConfig = new KrbConfig();
-    clientConfig.setString(KrbConfigKey.KDC_HOST, SpnegoTestUtil.KDC_HOST);
-    clientConfig.setInt(KrbConfigKey.KDC_TCP_PORT, kdcPort);
-    clientConfig.setString(KrbConfigKey.DEFAULT_REALM, SpnegoTestUtil.REALM);
-
-    serverSpnegoConfigFile = new File(kdcDir, "server-spnego.conf");
-    SpnegoTestUtil.writeSpnegoConf(serverSpnegoConfigFile, serverKeytab);
-
-    // Kerby sets "java.security.krb5.conf" for us!
-    System.setProperty("java.security.auth.login.config", serverSpnegoConfigFile.toString());
-    // http://docs.oracle.com/javase/7/docs/technotes/guides/security/jgss/...
-    //    tutorials/BasicClientServer.html#useSub
-    System.setProperty("javax.security.auth.useSubjectCredsOnly", "false");
-    //System.setProperty("sun.security.spnego.debug", "true");
-    //System.setProperty("sun.security.krb5.debug", "true");
-
-    // Create and start an HTTP server configured only to allow SPNEGO requests
-    // We're not using `withAutomaticLogin(File)` which means we're relying on JAAS to log the
-    // server in.
-    httpServer = new HttpServer.Builder()
-        .withPort(0)
-        .withSpnego(SpnegoTestUtil.SERVER_PRINCIPAL, SpnegoTestUtil.REALM)
-        .withHandler(new SpnegoTestUtil.AuthenticationRequiredAvaticaHandler())
-        .build();
-    httpServer.start();
-    isHttpServerStarted = true;
-
-    httpServerUrl = new URL("http://" + SpnegoTestUtil.KDC_HOST + ":" + httpServer.getPort());
-    LOG.info("HTTP server running at {}", httpServerUrl);
-
-    SpnegoTestUtil.refreshJaasConfiguration();
-  }
-
-  @AfterClass public static void stopKdc() throws Exception {
-    if (isHttpServerStarted) {
-      LOG.info("Stopping HTTP server at {}", httpServerUrl);
-      httpServer.stop();
-    }
-
-    if (isKdcStarted) {
-      LOG.info("Stopping KDC on {}", kdcPort);
-      kdc.stop();
-    }
-  }
-
-  private static void setupUsers(File keytabDir) throws KrbException {
-    String clientPrincipal = SpnegoTestUtil.CLIENT_PRINCIPAL.substring(0,
-        SpnegoTestUtil.CLIENT_PRINCIPAL.indexOf('@'));
-    clientKeytab = new File(keytabDir, clientPrincipal.replace('/', '_') + ".keytab");
-    if (clientKeytab.exists()) {
-      SpnegoTestUtil.deleteRecursively(clientKeytab);
-    }
-    LOG.info("Creating {} with keytab {}", clientPrincipal, clientKeytab);
-    SpnegoTestUtil.setupUser(kdc, clientKeytab, clientPrincipal);
-
-    String serverPrincipal = SpnegoTestUtil.SERVER_PRINCIPAL.substring(0,
-        SpnegoTestUtil.SERVER_PRINCIPAL.indexOf('@'));
-    serverKeytab = new File(keytabDir, serverPrincipal.replace('/', '_') + ".keytab");
-    if (serverKeytab.exists()) {
-      SpnegoTestUtil.deleteRecursively(serverKeytab);
-    }
-    LOG.info("Creating {} with keytab {}", SpnegoTestUtil.SERVER_PRINCIPAL, serverKeytab);
-    SpnegoTestUtil.setupUser(kdc, serverKeytab, SpnegoTestUtil.SERVER_PRINCIPAL);
-  }
-
-  @Test public void testNormalClientsDisallowed() throws Exception {
-    LOG.info("Connecting to {}", httpServerUrl.toString());
-    HttpURLConnection conn = (HttpURLConnection) httpServerUrl.openConnection();
-    conn.setRequestMethod("GET");
-    // Authentication should fail because we didn't provide anything
-    assertEquals(401, conn.getResponseCode());
-  }
-
-  @Test public void testAuthenticatedClientsAllowed() throws Exception {
-    // Create the subject for the client
-    final Subject clientSubject = JaasKrbUtil.loginUsingKeytab(SpnegoTestUtil.CLIENT_PRINCIPAL,
-        clientKeytab);
-    final Set<Principal> clientPrincipals = clientSubject.getPrincipals();
-    // Make sure the subject has a principal
-    assertFalse(clientPrincipals.isEmpty());
-
-    // Get a TGT for the subject (might have many, different encryption types). The first should
-    // be the default encryption type.
-    Set<KerberosTicket> privateCredentials =
-            clientSubject.getPrivateCredentials(KerberosTicket.class);
-    assertFalse(privateCredentials.isEmpty());
-    KerberosTicket tgt = privateCredentials.iterator().next();
-    assertNotNull(tgt);
-    LOG.info("Using TGT with etype: {}", tgt.getSessionKey().getAlgorithm());
-
-    // The name of the principal
-    final String principalName = clientPrincipals.iterator().next().getName();
-
-    // Run this code, logged in as the subject (the client)
-    byte[] response = Subject.doAs(clientSubject, new PrivilegedExceptionAction<byte[]>() {
-      @Override public byte[] run() throws Exception {
-        // Logs in with Kerberos via GSS
-        GSSManager gssManager = GSSManager.getInstance();
-        Oid oid = new Oid(SpnegoTestUtil.JGSS_KERBEROS_TICKET_OID);
-        GSSName gssClient = gssManager.createName(principalName, GSSName.NT_USER_NAME);
-        GSSCredential credential = gssManager.createCredential(gssClient,
-            GSSCredential.DEFAULT_LIFETIME, oid, GSSCredential.INITIATE_ONLY);
-
-        // Passes the GSSCredential into the HTTP client implementation
-        final AvaticaCommonsHttpClientSpnegoImpl httpClient =
-            new AvaticaCommonsHttpClientSpnegoImpl(httpServerUrl, credential);
-
-        return httpClient.send(new byte[0]);
-      }
-    });
-
-    // We should get a response which is "OK" with our client's name
-    assertNotNull(response);
-    assertEquals("OK " + SpnegoTestUtil.CLIENT_PRINCIPAL,
-        new String(response, StandardCharsets.UTF_8));
-  }
-}
-
-// End HttpServerSpnegoWithJaasTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/server/src/test/java/org/apache/calcite/avatica/server/HttpServerSpnegoWithoutJaasTest.java
----------------------------------------------------------------------
diff --git a/avatica/server/src/test/java/org/apache/calcite/avatica/server/HttpServerSpnegoWithoutJaasTest.java b/avatica/server/src/test/java/org/apache/calcite/avatica/server/HttpServerSpnegoWithoutJaasTest.java
deleted file mode 100644
index d30b760..0000000
--- a/avatica/server/src/test/java/org/apache/calcite/avatica/server/HttpServerSpnegoWithoutJaasTest.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.server;
-
-import org.apache.calcite.avatica.SpnegoTestUtil;
-import org.apache.calcite.avatica.remote.AvaticaCommonsHttpClientSpnegoImpl;
-
-import org.apache.kerby.kerberos.kerb.KrbException;
-import org.apache.kerby.kerberos.kerb.client.JaasKrbUtil;
-import org.apache.kerby.kerberos.kerb.client.KrbConfig;
-import org.apache.kerby.kerberos.kerb.client.KrbConfigKey;
-import org.apache.kerby.kerberos.kerb.server.SimpleKdcServer;
-
-import org.ietf.jgss.GSSCredential;
-import org.ietf.jgss.GSSManager;
-import org.ietf.jgss.GSSName;
-import org.ietf.jgss.Oid;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.nio.charset.StandardCharsets;
-import java.security.Principal;
-import java.security.PrivilegedExceptionAction;
-import java.util.Set;
-
-import javax.security.auth.Subject;
-import javax.security.auth.kerberos.KerberosTicket;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-/**
- * Test class for SPNEGO with Kerberos. Purely testing SPNEGO, not the Avatica "protocol" on top
- * of that HTTP. This variant of the test relies on the "feature" Avatica provides to not require
- * JAAS configuration by the user.
- */
-public class HttpServerSpnegoWithoutJaasTest {
-  private static final Logger LOG = LoggerFactory.getLogger(HttpServerSpnegoWithoutJaasTest.class);
-
-  private static SimpleKdcServer kdc;
-  private static HttpServer httpServer;
-
-  private static KrbConfig clientConfig;
-
-  private static int kdcPort;
-
-  private static File clientKeytab;
-  private static File serverKeytab;
-
-  private static boolean isKdcStarted = false;
-  private static boolean isHttpServerStarted = false;
-
-  private static URL httpServerUrl;
-
-  @BeforeClass public static void setupKdc() throws Exception {
-    kdc = new SimpleKdcServer();
-    File target = new File(System.getProperty("user.dir"), "target");
-    assertTrue(target.exists());
-
-    File kdcDir = new File(target, HttpServerSpnegoWithoutJaasTest.class.getSimpleName());
-    if (kdcDir.exists()) {
-      SpnegoTestUtil.deleteRecursively(kdcDir);
-    }
-    kdcDir.mkdirs();
-    kdc.setWorkDir(kdcDir);
-
-    kdc.setKdcHost(SpnegoTestUtil.KDC_HOST);
-    kdcPort = SpnegoTestUtil.getFreePort();
-    kdc.setAllowTcp(true);
-    kdc.setAllowUdp(false);
-    kdc.setKdcTcpPort(kdcPort);
-
-    LOG.info("Starting KDC server at {}:{}", SpnegoTestUtil.KDC_HOST, kdcPort);
-
-    kdc.init();
-    kdc.start();
-    isKdcStarted = true;
-
-    File keytabDir = new File(target, HttpServerSpnegoWithoutJaasTest.class.getSimpleName()
-        + "_keytabs");
-    if (keytabDir.exists()) {
-      SpnegoTestUtil.deleteRecursively(keytabDir);
-    }
-    keytabDir.mkdirs();
-    setupUsers(keytabDir);
-
-    clientConfig = new KrbConfig();
-    clientConfig.setString(KrbConfigKey.KDC_HOST, SpnegoTestUtil.KDC_HOST);
-    clientConfig.setInt(KrbConfigKey.KDC_TCP_PORT, kdcPort);
-    clientConfig.setString(KrbConfigKey.DEFAULT_REALM, SpnegoTestUtil.REALM);
-
-    // Kerby sets "java.security.krb5.conf" for us!
-    System.clearProperty("java.security.auth.login.config");
-    System.setProperty("javax.security.auth.useSubjectCredsOnly", "false");
-    //System.setProperty("sun.security.spnego.debug", "true");
-    //System.setProperty("sun.security.krb5.debug", "true");
-
-    // Create and start an HTTP server configured only to allow SPNEGO requests
-    // We use `withAutomaticLogin(File)` here which should invalidate the need to do JAAS config
-    httpServer = new HttpServer.Builder()
-        .withPort(0)
-        .withAutomaticLogin(serverKeytab)
-        .withSpnego(SpnegoTestUtil.SERVER_PRINCIPAL, SpnegoTestUtil.REALM)
-        .withHandler(new SpnegoTestUtil.AuthenticationRequiredAvaticaHandler())
-        .build();
-    httpServer.start();
-    isHttpServerStarted = true;
-
-    httpServerUrl = new URL("http://" + SpnegoTestUtil.KDC_HOST + ":" + httpServer.getPort());
-    LOG.info("HTTP server running at {}", httpServerUrl);
-  }
-
-  @AfterClass public static void stopKdc() throws Exception {
-    if (isHttpServerStarted) {
-      LOG.info("Stopping HTTP server at {}", httpServerUrl);
-      httpServer.stop();
-    }
-
-    if (isKdcStarted) {
-      LOG.info("Stopping KDC on {}", kdcPort);
-      kdc.stop();
-    }
-  }
-
-  private static void setupUsers(File keytabDir) throws KrbException {
-    String clientPrincipal = SpnegoTestUtil.CLIENT_PRINCIPAL.substring(0,
-        SpnegoTestUtil.CLIENT_PRINCIPAL.indexOf('@'));
-    clientKeytab = new File(keytabDir, clientPrincipal.replace('/', '_') + ".keytab");
-    if (clientKeytab.exists()) {
-      SpnegoTestUtil.deleteRecursively(clientKeytab);
-    }
-    LOG.info("Creating {} with keytab {}", clientPrincipal, clientKeytab);
-    SpnegoTestUtil.setupUser(kdc, clientKeytab, clientPrincipal);
-
-    String serverPrincipal = SpnegoTestUtil.SERVER_PRINCIPAL.substring(0,
-        SpnegoTestUtil.SERVER_PRINCIPAL.indexOf('@'));
-    serverKeytab = new File(keytabDir, serverPrincipal.replace('/', '_') + ".keytab");
-    if (serverKeytab.exists()) {
-      SpnegoTestUtil.deleteRecursively(serverKeytab);
-    }
-    LOG.info("Creating {} with keytab {}", SpnegoTestUtil.SERVER_PRINCIPAL, serverKeytab);
-    SpnegoTestUtil.setupUser(kdc, serverKeytab, SpnegoTestUtil.SERVER_PRINCIPAL);
-  }
-
-  @Test public void testNormalClientsDisallowed() throws Exception {
-    LOG.info("Connecting to {}", httpServerUrl.toString());
-    HttpURLConnection conn = (HttpURLConnection) httpServerUrl.openConnection();
-    conn.setRequestMethod("GET");
-    // Authentication should fail because we didn't provide anything
-    assertEquals(401, conn.getResponseCode());
-  }
-
-  @Test public void testAuthenticatedClientsAllowed() throws Exception {
-    // Create the subject for the client
-    final Subject clientSubject = JaasKrbUtil.loginUsingKeytab(SpnegoTestUtil.CLIENT_PRINCIPAL,
-        clientKeytab);
-    final Set<Principal> clientPrincipals = clientSubject.getPrincipals();
-    // Make sure the subject has a principal
-    assertFalse(clientPrincipals.isEmpty());
-
-    // Get a TGT for the subject (might have many, different encryption types). The first should
-    // be the default encryption type.
-    Set<KerberosTicket> privateCredentials =
-            clientSubject.getPrivateCredentials(KerberosTicket.class);
-    assertFalse(privateCredentials.isEmpty());
-    KerberosTicket tgt = privateCredentials.iterator().next();
-    assertNotNull(tgt);
-    LOG.info("Using TGT with etype: {}", tgt.getSessionKey().getAlgorithm());
-
-    // The name of the principal
-    final String principalName = clientPrincipals.iterator().next().getName();
-
-    // Run this code, logged in as the subject (the client)
-    byte[] response = Subject.doAs(clientSubject, new PrivilegedExceptionAction<byte[]>() {
-      @Override public byte[] run() throws Exception {
-        // Logs in with Kerberos via GSS
-        GSSManager gssManager = GSSManager.getInstance();
-        Oid oid = new Oid(SpnegoTestUtil.JGSS_KERBEROS_TICKET_OID);
-        GSSName gssClient = gssManager.createName(principalName, GSSName.NT_USER_NAME);
-        GSSCredential credential = gssManager.createCredential(gssClient,
-            GSSCredential.DEFAULT_LIFETIME, oid, GSSCredential.INITIATE_ONLY);
-
-        // Passes the GSSCredential into the HTTP client implementation
-        final AvaticaCommonsHttpClientSpnegoImpl httpClient =
-            new AvaticaCommonsHttpClientSpnegoImpl(httpServerUrl, credential);
-
-        return httpClient.send(new byte[0]);
-      }
-    });
-
-    // We should get a response which is "OK" with our client's name
-    assertNotNull(response);
-    assertEquals("OK " + SpnegoTestUtil.CLIENT_PRINCIPAL,
-        new String(response, StandardCharsets.UTF_8));
-  }
-}
-
-// End HttpServerSpnegoWithoutJaasTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/server/src/test/java/org/apache/calcite/avatica/test/AvaticaSuite.java
----------------------------------------------------------------------
diff --git a/avatica/server/src/test/java/org/apache/calcite/avatica/test/AvaticaSuite.java b/avatica/server/src/test/java/org/apache/calcite/avatica/test/AvaticaSuite.java
deleted file mode 100644
index 4a0c26c..0000000
--- a/avatica/server/src/test/java/org/apache/calcite/avatica/test/AvaticaSuite.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.test;
-
-import org.apache.calcite.avatica.RemoteDriverTest;
-
-import org.junit.runner.RunWith;
-
-import org.junit.runners.Suite;
-
-/**
- * Avatica test suite.
- */
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
-    AvaticaUtilsTest.class,
-    ConnectStringParserTest.class,
-    RemoteDriverTest.class
-})
-public class AvaticaSuite {
-}
-
-// End AvaticaSuite.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/server/src/test/resources/auth-users.properties
----------------------------------------------------------------------
diff --git a/avatica/server/src/test/resources/auth-users.properties b/avatica/server/src/test/resources/auth-users.properties
deleted file mode 100644
index be19e02..0000000
--- a/avatica/server/src/test/resources/auth-users.properties
+++ /dev/null
@@ -1,20 +0,0 @@
-# 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.
-
-USER1: password1,role1,users
-USER2: password2,role2,users
-USER3: password3,role3,users
-USER4: password4,role4,admins
-USER5: password5,role5,admins

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/server/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/avatica/server/src/test/resources/log4j.properties b/avatica/server/src/test/resources/log4j.properties
deleted file mode 100644
index 662858e..0000000
--- a/avatica/server/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,28 +0,0 @@
-# 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.
-
-# Root logger is configured at INFO and is sent to A1
-log4j.rootLogger=INFO, A1
-
-# A1 goes to the console
-log4j.appender.A1=org.apache.log4j.ConsoleAppender
-
-# Set the pattern for each log message
-log4j.appender.A1.layout=org.apache.log4j.PatternLayout
-log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p - %m%n
-
-# Debug for JGSS and Jetty's security (Kerberos/SPNEGO debugging)
-#log4j.logger.sun.security.jgss=DEBUG
-#log4j.logger.org.eclipse.jetty.security=DEBUG
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/shaded/core/pom.xml
----------------------------------------------------------------------
diff --git a/avatica/shaded/core/pom.xml b/avatica/shaded/core/pom.xml
deleted file mode 100644
index e5a963d..0000000
--- a/avatica/shaded/core/pom.xml
+++ /dev/null
@@ -1,108 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <parent>
-    <groupId>org.apache.calcite.avatica</groupId>
-    <artifactId>avatica-parent</artifactId>
-    <version>1.10.0-SNAPSHOT</version>
-    <relativePath>../../pom.xml</relativePath>
-  </parent>
-
-  <artifactId>avatica</artifactId>
-  <packaging>jar</packaging>
-  <name>Apache Calcite Avatica (Shaded)</name>
-  <description>JDBC driver framework.</description>
-
-  <properties>
-    <top.dir>${project.basedir}/../..</top.dir>
-  </properties>
-
-  <dependencies>
-    <dependency>
-      <groupId>org.apache.calcite.avatica</groupId>
-      <artifactId>avatica-core</artifactId>
-    </dependency>
-  </dependencies>
-
-  <build>
-    <plugins>
-      <plugin>
-        <artifactId>maven-dependency-plugin</artifactId>
-        <version>${maven-dependency-plugin.version}</version>
-        <executions>
-          <execution>
-            <id>analyze</id>
-            <goals>
-              <goal>analyze-only</goal>
-            </goals>
-            <configuration>
-              <!-- ignore "unused but declared" warnings -->
-              <ignoredUnusedDeclaredDependencies>
-                <ignoredUnusedDeclaredDependency>org.apache.calcite.avatica:avatica-core</ignoredUnusedDeclaredDependency>
-              </ignoredUnusedDeclaredDependencies>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-            <configuration>
-              <relocations>
-                <relocation>
-                  <pattern>com.fasterxml.jackson</pattern>
-                  <shadedPattern>org.apache.calcite.avatica.com.fasterxml.jackson</shadedPattern>
-                </relocation>
-                <relocation>
-                  <pattern>com.google.protobuf</pattern>
-                  <shadedPattern>org.apache.calcite.avatica.com.google.protobuf</shadedPattern>
-                </relocation>
-                <relocation>
-                  <pattern>org.apache.http</pattern>
-                  <shadedPattern>org.apache.calcite.avatica.org.apache.http</shadedPattern>
-                </relocation>
-                <relocation>
-                  <pattern>org.apache.commons</pattern>
-                  <shadedPattern>org.apache.calcite.avatica.org.apache.commons</shadedPattern>
-                </relocation>
-              </relocations>
-              <createDependencyReducedPom>false</createDependencyReducedPom>
-              <transformers>
-                <transformer implementation="org.apache.maven.plugins.shade.resource.ApacheNoticeResourceTransformer">
-                    <addHeader>false</addHeader>
-                </transformer>
-                <transformer implementation="org.apache.maven.plugins.shade.resource.DontIncludeResourceTransformer">
-                  <resources>
-                    <resource>LICENSE.txt</resource>
-                  </resources>
-                </transformer>
-              </transformers>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-</project>

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/shaded/core/src/main/resources/META-INF/LICENSE
----------------------------------------------------------------------
diff --git a/avatica/shaded/core/src/main/resources/META-INF/LICENSE b/avatica/shaded/core/src/main/resources/META-INF/LICENSE
deleted file mode 100644
index e7e81b8..0000000
--- a/avatica/shaded/core/src/main/resources/META-INF/LICENSE
+++ /dev/null
@@ -1,257 +0,0 @@
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
-
-
-
-
-
------------------------------------------------------------------------
-
-APACHE CALCITE AVATICA SUBCOMPONENTS:
-
-The Apache Calcite Avatica project contains subcomponents with separate copyright
-notices and license terms. Your use of the source code for the these
-subcomponents is subject to the terms and conditions of the following
-licenses.
-
------------------------------------------------------------------------
- 3-clause BSD license
------------------------------------------------------------------------
-
-The Apache Calcite Avatica project bundles Protocol Buffers, which is available
-under the following "3-clause BSD" license:
-
-    Copyright 2014, Google Inc. All rights reserved.
-
-    Redistribution and use in source and binary forms, with or
-    without modification, are permitted provided that the following
-    conditions are met:
-
-    Redistributions of source code must retain the above copyright
-    notice, this list of conditions and the following disclaimer.
-
-    Redistributions in binary form must reproduce the above
-    copyright notice, this list of conditions and the following disclaimer
-    in the documentation and/or other materials provided with the
-    distribution.
-
-    Neither the name of Google Inc. nor the names of its
-    contributors may be used to endorse or promote products derived from
-    this software without specific prior written permission.
-
-    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-    "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-    A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-    OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-    Code generated by the Protocol Buffer compiler is owned by the owner
-    of the input file used when generating it. This code is not
-    standalone and requires a support library to be linked with it. This
-    support library is itself covered by the above license.

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/site/.gitignore
----------------------------------------------------------------------
diff --git a/avatica/site/.gitignore b/avatica/site/.gitignore
deleted file mode 100644
index 09c86a2..0000000
--- a/avatica/site/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-.sass-cache
-Gemfile.lock

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

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/site/README.md
----------------------------------------------------------------------
diff --git a/avatica/site/README.md b/avatica/site/README.md
deleted file mode 100644
index bd80bf1..0000000
--- a/avatica/site/README.md
+++ /dev/null
@@ -1,51 +0,0 @@
-<!--
-{% comment %}
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements.  See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License.  You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-{% endcomment %}
--->
-
-# Apache Calcite Avatica site
-
-This directory contains the code for the
-[Avatica web site](https://calcite.apache.org/avatica),
-a sub-directory of the
-[Apache Calcite web site](https://calcite.apache.org).
-
-## Setup
-
-1. Set up Calcite web site as described in its
-   [README](../site/README.md).
-
-## Add javadoc
-
-1. `cd avatica`
-2. `mvn -DskipTests site`
-3. `rm -rf ../site/target/avatica/apidocs ../site/target/avatica/testapidocs`
-4. `mv target/site/apidocs target/site/testapidocs ../site/target/avatica`
-
-## Running locally
-
-Before opening a pull request, you can preview your contributions by
-running from within the directory:
-
-1. `bundle exec jekyll serve`
-2. Open [http://localhost:4000/avatica](http://localhost:4000/avatica)
-
-## Pushing to site
-
-Push the Calcite site, which includes `avatica` as a sub-directory,
-as described in its
-[README](../site/README.md).

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/site/_config.yml
----------------------------------------------------------------------
diff --git a/avatica/site/_config.yml b/avatica/site/_config.yml
deleted file mode 100644
index 4d58d3e..0000000
--- a/avatica/site/_config.yml
+++ /dev/null
@@ -1,46 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to you under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-markdown: kramdown
-permalink: /news/:year/:month/:day/:title/
-excerpt_separator: ""
-
-repository: https://github.com/apache/calcite
-destination: ../../site/target/avatica
-exclude: [README.md,Gemfile*]
-keep_files: [".git", ".svn", "apidocs", "testapidocs"]
-
-collections:
-  docs:
-    output: true
-
-# The URL where the code can be found
-sourceRoot: https://github.com/apache/calcite/tree/master/avatica
-
-# The URL where Avatica Javadocs are located
-apiRoot: /avatica/apidocs
-# apiRoot: http://calcite.apache.org/avatica/apidocs
-
-# The URL where Test Javadocs are located
-testApiRoot: /avatica/testapidocs
-# testApiRoot: http://calcite.apache.org/avatica/testapidocs
-
-# The URL where the JDK's Javadocs are located
-jdkApiRoot: https://docs.oracle.com/javase/8/docs/api/
-
-# The base path where the website is deployed
-baseurl: /avatica
-
-# End _config.yml

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/site/_data/contributors.yml
----------------------------------------------------------------------
diff --git a/avatica/site/_data/contributors.yml b/avatica/site/_data/contributors.yml
deleted file mode 100644
index fb3e09b..0000000
--- a/avatica/site/_data/contributors.yml
+++ /dev/null
@@ -1,121 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to you under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# Database of contributors to Apache Calcite.
-# Pages such as developer.md use this data.
-#
-- name: Alan Gates
-  apacheId: gates
-  githubId: alanfgates
-  org: Hortonworks
-  role: PMC
-- name: Aman Sinha
-  apacheId: amansinha
-  githubId: amansinha100
-  org: MapR
-  role: PMC
-- name: Ashutosh Chauhan
-  apacheId: hashutosh
-  githubId: ashutoshc
-  org: Hortonworks
-  role: PMC
-- name: Francis Chuang
-  apacheId: francischuang
-  githubId: F21
-  org: Boostport
-  role: Committer
-- name: James R. Taylor
-  apacheId: jamestaylor
-  githubId: JamesRTaylor
-  org: Salesforce
-  role: PMC
-- name: Jacques Nadeau
-  apacheId: jacques
-  githubId: jacques-n
-  org: Dremio
-  role: PMC
-- name: Jes�s Camacho Rodr�guez
-  apacheId: jcamacho
-  githubId: jcamachor
-  org: Hortonworks
-  role: PMC Chair
-- name: Jinfeng Ni
-  apacheId: jni
-  githubId: jinfengni
-  org: MapR
-  role: PMC
-- name: John Pullokkaran
-  apacheId: jpullokk
-  githubId: jpullokkaran
-  org: Hortonworks
-  role: PMC
-- name: Josh Elser
-  apacheId: elserj
-  githubId: joshelser
-  org: Hortonworks
-  role: PMC
-- name: Julian Hyde
-  apacheId: jhyde
-  githubId: julianhyde
-  org: Hortonworks
-  role: PMC
-  homepage: http://people.apache.org/~jhyde
-- name: Maryann Xue
-  apacheId: maryannxue
-  githubId: maryannxue
-  org: Intel
-  role: Committer
-- name: Michael Mior
-  apacheId: mmior
-  githubId: michaelmior
-  org: University of Waterloo
-  role: Committer
-  homepage: http://michael.mior.ca/
-- name: Milinda Pathirage
-  apacheId: milinda
-  githubId: milinda
-  org: Indiana University
-  role: Committer
-  homepage: http://milinda.pathirage.org/
-- name: MinJi Kim
-  apacheId: minji
-  githubId: minji-kim
-  org: Dremio
-  role: Committer
-  avatar: http://web.mit.edu/minjikim/www/minji.png
-  homepage: http://web.mit.edu/minjikim/www/
-- name: Nick Dimiduk
-  apacheId: ndimiduk
-  githubId: ndimiduk
-  org: Hortonworks
-  role: PMC
-  homepage: http://www.n10k.com
-- name: Steven Noels
-  apacheId: stevenn
-  githubId: stevenn
-  org: NGData
-  role: PMC
-- name: Ted Dunning
-  apacheId: tdunning
-  githubId: tdunning
-  org: MapR
-  role: PMC
-  avatar: https://www.mapr.com/sites/default/files/otherpageimages/ted-circle-80.png
-- name: Vladimir Sitnikov
-  apacheId: vladimirsitnikov
-  githubId: vlsi
-  org: NetCracker
-  role: PMC
-# End contributors.yml

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/site/_data/docs.yml
----------------------------------------------------------------------
diff --git a/avatica/site/_data/docs.yml b/avatica/site/_data/docs.yml
deleted file mode 100644
index 276edad..0000000
--- a/avatica/site/_data/docs.yml
+++ /dev/null
@@ -1,38 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to you under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# Data that defines menu structure
-#
-- title: Overview
-  docs:
-  - index
-  - roadmap
-
-- title: Reference
-  docs:
-  - client_reference
-  - json_reference
-  - protobuf_reference
-  - howto
-  - security
-  - compatibility
-  - custom_client_artifacts
-
-- title: Meta
-  docs:
-  - history
-  - api
-  - testapi
-# End docs.yml

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/site/_docs/api.md
----------------------------------------------------------------------
diff --git a/avatica/site/_docs/api.md b/avatica/site/_docs/api.md
deleted file mode 100644
index 54b23c3..0000000
--- a/avatica/site/_docs/api.md
+++ /dev/null
@@ -1,28 +0,0 @@
----
-title: API
-layout: external
-external_url: http://calcite.apache.org/avatica/apidocs
----
-{% comment %}
-Ideally, we want to use {{ site.apiRoot }} instead of hardcoding
-the above external_url value, but I don't believe there's a way to do that
-{% endcomment %}
-
-<!--
-{% 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-avatica/blob/fc7b26c8/avatica/site/_docs/client_reference.md
----------------------------------------------------------------------
diff --git a/avatica/site/_docs/client_reference.md b/avatica/site/_docs/client_reference.md
deleted file mode 100644
index f49372a..0000000
--- a/avatica/site/_docs/client_reference.md
+++ /dev/null
@@ -1,174 +0,0 @@
----
-layout: docs
-title: Client Reference
-sidebar_title: Client Reference
-permalink: /docs/client_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 %}
--->
-
-Avatica provides a reference-implementation client in the form of a Java
-JDBC client that interacts with the Avatica server over HTTP. This client
-can be used just as any other JDBC driver. There are a number of options
-that are available for clients to specify via the JDBC connection URL.
-
-As a reminder, the JDBC connection URL for Avatica is:
-
-  `jdbc:avatica:remote:[option=value[;option=value]]`
-
-The following are a list of supported options:
-
-{% comment %}
-It's a shame that we have to embed HTML to get the anchors but the normal
-header tags from kramdown screw up the definition list. We lose the pretty
-on-hover images for the permalink, but oh well.
-{% endcomment %}
-
-<strong><a name="url" href="#url">url</a></strong>
-
-: _Description_: This property is a URL which refers to the location of the
-  Avatica Server which the driver will communicate with.
-
-: _Default_: This property's default value is `null`. It is required that the
-  user provides a value for this property.
-
-: _Required_: Yes.
-
-
-<strong><a name="serialization" href="#serialization">serialization</a></strong>
-
-: _Description_: Avatica supports multiple types of serialization mechanisms
-  to format data between the client and server. This property is used to ensure
-  that the client and server both use the same serialization mechanism. Valid
-  values presently include `json` and `protobuf`.
-
-: _Default_: `json` is the default value.
-
-: _Required_: No.
-
-
-<strong><a name="authentication" href="#authentication">authentication</a></strong>
-
-: _Description_: Avatica clients can specify the means in which it authenticates
-  with the Avatica server. Clients who want to use a specific form
-  of authentication should specify the appropriate value in this property. Valid
-  values for this property are presently: `NONE`, `BASIC`, `DIGEST`, and `SPNEGO`.
-
-: _Default_: `null` (implying "no authentication", equivalent to `NONE`).
-
-: _Required_: No.
-
-
-<strong><a name="timeZone" href="#timeZone">timeZone</a></strong>
-
-: _Description_: The timezone that will be used for dates and times. Valid values for this
-  property are defined by [RFC 822](https://www.ietf.org/rfc/rfc0822.txt), for
-  example: `GMT`, `GMT-3`, `EST` or `PDT`.
-
-: _Default_: This property's default value is `null` which will cause the Avatica Driver to
-  use the default timezone as specified by the JVM, commonly overriden by the
-  `user.timezone` system property.
-
-: _Required_: No.
-
-
-<strong><a name="httpclient-factory" href="#httpclient-factory">httpclient_factory</a></strong>
-
-: _Description_: The Avatica client is a "fancy" HTTP client. As such, there are
-  many libraries and APIs available for making HTTP calls. To determine which implementation
-  should be used, there is an interface `AvaticaHttpClientFactory` which can be provided
-  to control how the `AvaticaHttpClient` implementation is chosen.
-
-: _Default_: `AvaticaHttpClientFactoryImpl`.
-
-: _Required_: No.
-
-
-<strong><a name="httpclient-impl" href="#httpclient-impl">httpclient_impl</a></strong>
-
-: _Description_: When using the default `AvaticaHttpClientFactoryImpl` HTTP client factory
-  implementation, this factory should choose the correct client implementation for the
-  given client configuration. This property can be used to override the specific HTTP
-  client implementation. If it is not provided, the `AvaticaHttpClientFactoryImpl` will
-  automatically choose the HTTP client implementation.
-
-: _Default_: `null`.
-
-: _Required_: No.
-
-<strong><a name="avatica-user" href="#avatica-user">avatica_user</a></strong>
-
-: _Description_: This is the username used by an Avatica client to identify itself
-  to the Avatica server. It is unique to the traditional "user" JDBC property. It
-  is only necessary if Avatica is configured for HTTP Basic or Digest authentication.
-
-: _Default_: `null`.
-
-: _Required_: No.
-
-<strong><a name="avatica-password" href="#avatica-password">avatica_password</a></strong>
-
-: _Description_: This is the password used by an Avatica client to identify itself
-  to the Avatica server. It is unique to the traditional "password" JDBC property. It
-  is only necessary if Avatica is configured for HTTP Basic or Digest authentication.
-
-: _Default_: `null`.
-
-: _Required_: No.
-
-<strong><a name="principal" href="#principal">principal</a></strong>
-
-: _Description_: The Kerberos principal which can be used by the Avatica JDBC Driver
-  to automatically perform a Kerberos login before attempting to contact the Avatica
-  server. If this property is provided, it is also expected that `keytab` is provided
-  and that the Avatica server is configured for SPNEGO authentication. Users can perform
-  their own Kerberos login; this option is provided only as a convenience.
-
-: _Default_: `null`.
-
-: _Required_: No.
-
-<strong><a name="keytab" href="#keytab">keytab</a></strong>
-
-: _Description_: The Kerberos keytab which contains the secret material to perform
-  a Kerberos login with the `principal`. The value should be a path on the local
-  filesystem to a regular file.
-
-: _Default_: `null`.
-
-: _Required_: No.
-
-<strong><a name="truststore" href="#truststore">truststore</a></strong>
-
-: _Description_: A path to a Java KeyStore (JKS) file on the local filesystem
-  which contains the certificate authority to trust in a TLS handshake. Only
-  necessary when using HTTPS.
-
-: _Default_: `null`.
-
-: _Required_: No.
-
-<strong><a name="truststore_password" href="#truststore_password">truststore_password</a></strong>
-
-: _Description_: The password for the Java KeyStore file specified by <a href="#truststore">truststore</a>.
-
-: _Default_: `null`.
-
-: _Required_: Only if `truststore` was provided.

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/site/_docs/compatibility.md
----------------------------------------------------------------------
diff --git a/avatica/site/_docs/compatibility.md b/avatica/site/_docs/compatibility.md
deleted file mode 100644
index 18ae3a6..0000000
--- a/avatica/site/_docs/compatibility.md
+++ /dev/null
@@ -1,105 +0,0 @@
----
-layout: docs
-title: Compatibility
-sidebar_title: Compatibility
-permalink: /docs/compatibility.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 %}
--->
-
-Given Avatica's client-server model, it is no surprise that compatibility is
-important to the users and developers of Apache Calcite Avatica. This document
-defines what guarantees are made by Avatica with respect to compatibility
-between Avatica client and server across versions. This document is still a work
-in progress with many areas still requiring definition. Contributions are always
-welcome.
-
-## Avatica Technology Compatibility Kit (TCK)
-
-The [Avatica TCK project][github-tck] is a framework designed to automatically
-test an Avatica client against an Avatica server. A collection of JUnit tests,
-a YAML configuration file, and a Ruby script defines the TCK.
-The JUnit tests invoke specific portions of both the client and
-server components of Avatica to verify that they work as expected. The Ruby
-script uses the YAML configuration file to define the set of
-client and server version pairs to run the JUnit tests against.
-
-In the YAML configuration file, a name (e.g. `1.6.0`) and the following three
-items define an Avatica version:
-
-1. A filesystem path to an Avatica client jar (e.g. groupId=org.apache.calcite.avatica, artifactId=avatica)
-2. A URL to a running instance of an Avatica server
-3. A JDBC URL template to the Avatica server for the Avatica client JDBC driver.
-
-Users of the TCK define the collection of versions (defined by the above
-information) and the location of the [avatica-tck][github-tck] jar by a YAML
-configuration file. An [example YAML configuration file][github-tck-yml-file] is
-bundled with the project.
-
-Traditionally, Avatica does not provide any implementation of the Avatica server
-as the value in Avatica is recognized in the integrating project (e.g. Apache
-Drill or Apache Phoenix). However, for the purposes of compatibility testing, it
-makes sense that Avatica provides a standalone server instance.  A new artifact
-is introduced to Avatica with the original TCK codebase called
-[avatica-standalone-server][github-standalone-server].  This artifact is a
-runnable jar (e.g. `java -jar`) which starts an instance of the Avatica server
-on a random port using the in-memory [HSQLDB database](http://hsqldb.org/). This
-artifacts makes it extremely simple to start a version of the Avatica server for
-the specific version of Avatica to be tested.
-
-As mentioned, the Ruby script is the entry point for the TCK. Invoking the Ruby
-script which prints a summary of testing each specified version against itself and
-all other versions in the YAML configuration. An example summary is presented
-below which is the result of testing versions 1.6.0, 1.7.1 and 1.8.0-SNAPSHOT:
-
-```
-Summary:
-
-Identity test scenarios (ran 3)
-
-Testing identity for version v1.6.0: Passed
-Testing identity for version v1.7.1: Passed
-Testing identity for version v1.8.0-SNAPSHOT: Failed
-
-All test scenarios (ran 6)
-
-Testing client v1.6.0 against server v1.7.1: Passed
-Testing client v1.6.0 against server v1.8.0-SNAPSHOT: Failed
-Testing client v1.7.1 against server v1.6.0: Passed
-Testing client v1.7.1 against server v1.8.0-SNAPSHOT: Failed
-Testing client v1.8.0-SNAPSHOT against server v1.6.0: Failed
-Testing client v1.8.0-SNAPSHOT against server v1.7.1: Failed
-```
-
-It is not always expected that all tested version-pairs will pass unless the
-test is written with specific knowledge about past bugs in Avatica itself. While
-Avatica tries to handle all of these edge cases implicitly, it is not always
-feasible or desirable to do so. Adding new test cases is as easy as writing a
-JUnit test case in the [TCK module][github-tck-tests], but there is presently no
-automation around verifying the test cases as a part of the Maven build.
-
-For more information on running this TCK, including specific instructions for
-running the TCK, reference the provided [README][github-tck-readme] file.
-
-[github-tck]: https://github.com/apache/calcite/tree/master/avatica/tck
-[github-tck-tests]: https://github.com/apache/calcite/tree/master/avatica/tck/src/main/java/org/apache/calcite/avatica/tck/tests
-[github-standalone-server]: https://github.com/apache/calcite/tree/master/avatica/standalone-server
-[github-tck-readme]: https://github.com/apache/calcite/tree/master/avatica/tck/README.md
-[github-tck-yml-file]: https://github.com/apache/calcite/tree/master/avatica/tck/src/main/resources/example_config.yml


[50/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index c8fdab8..d54d884 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,5 +1,5 @@
 # Configuration file for Travis continuous integration.
-# See https://travis-ci.org/apache/calcite
+# See https://travis-ci.org/apache/calcite-avatica
 #
 # Licensed to the Apache Software Foundation (ASF) under one or more
 # contributor license agreements.  See the NOTICE file distributed with
@@ -28,11 +28,11 @@ branches:
     - /^branch-.*$/
     - /^[0-9]+-.*$/
 install:
-  - cd avatica && mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V && cd ..
-  - mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V
+  # Print the Maven version, skip tests and javadoc
+  - mvn -V install -DskipTests -Dmaven.javadoc.skip=true
 script:
-  - cd avatica && mvn -Dsurefire.useFile=false test && cd ..
-  - mvn -Dsurefire.useFile=false test
+  # Print surefire output to the console instead of files
+  - mvn -Dsurefire.useFile=false verify
 git:
   depth: 10000
 sudo: false

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/LICENSE
----------------------------------------------------------------------
diff --git a/LICENSE b/LICENSE
index f7b9863..f409fd8 100644
--- a/LICENSE
+++ b/LICENSE
@@ -207,9 +207,9 @@
 
 -----------------------------------------------------------------------
 
-APACHE CALCITE SUBCOMPONENTS:
+APACHE CALCITE AVATICA SUBCOMPONENTS:
 
-The Apache Calcite project contains subcomponents with separate copyright
+The Apache Calcite Avatica project contains subcomponents with separate copyright
 notices and license terms. Your use of the source code for the these
 subcomponents is subject to the terms and conditions of the following
 licenses.

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/NOTICE
----------------------------------------------------------------------
diff --git a/NOTICE b/NOTICE
index 589ab43..506738b 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1,12 +1,5 @@
 Apache Calcite
-Copyright 2012-2017 The Apache Software Foundation
+Copyright 2012-2016 The Apache Software Foundation
 
 This product includes software developed at
 The Apache Software Foundation (http://www.apache.org/).
-
-This product is based on source code originally developed
-by DynamoBI Corporation, LucidEra Inc., SQLstream Inc. and others
-under the auspices of the Eigenbase Foundation
-and released as the LucidDB project.
-
-The web site includes files generated by Jekyll.

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/README
----------------------------------------------------------------------
diff --git a/README b/README
index 985f675..451e39f 100644
--- a/README
+++ b/README
@@ -1,6 +1,7 @@
-Apache Calcite release 1.12.0
+Apache Calcite Avatica release 1.9.0
 
-This is a source or binary distribution of Apache Calcite.
+This is a source or binary distribution of Avatica, a framework for
+building database drivers. Avatica is a sub-project of Apache Calcite.
 
 Changes since the previous release are described in the
 site/_docs/history.md file.
@@ -11,7 +12,7 @@ If this is a source distribution, you can find instructions how to
 build the release in the "Building from a source distribution" section
 in site/_docs/howto.md.
 
-README.md contains examples of running Calcite.
+README.md contains examples of running Avatica.
 
-Further information about Apache Calcite is available at its web site,
-http://calcite.apache.org.
+Further information about Avatica is available at its web site,
+http://calcite.apache.org/avatica.

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index b490dc0..5e46264 100644
--- a/README.md
+++ b/README.md
@@ -16,10 +16,15 @@ See the License for the specific language governing permissions and
 limitations under the License.
 {% endcomment %}
 -->
-[![Build Status](https://travis-ci.org/julianhyde/calcite.svg?branch=master)](https://travis-ci.org/julianhyde/calcite)
+[![Build Status](https://travis-ci.org/joshelser/calcite-avatica.svg?branch=master)](https://travis-ci.org/joshelser/calcite-avatica)
 
-# Apache Calcite
+# Apache Calcite -- Avatica
 
-Apache Calcite is a dynamic data management framework.
+Apache Calcite's Avatica is a framework for building database drivers.
 
-For more details, see the [home page](http://calcite.apache.org).
+Avatica is a sub-project of [Apache Calcite](https://calcite.apache.org).
+
+For more details, see the [home page](https://calcite.apache.org/avatica).
+
+Release notes for all published versions are available on the [history
+page](https://calcite.apache.org/avatica/docs/history.html).

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/KEYS
----------------------------------------------------------------------
diff --git a/avatica/KEYS b/avatica/KEYS
deleted file mode 100644
index 61ee69c..0000000
--- a/avatica/KEYS
+++ /dev/null
@@ -1,285 +0,0 @@
-This file contains the PGP keys of various developers.
-Please don't use them for email unless you have to. Their main
-purpose is code signing.
-
-Examples of importing this file in your keystore:
- gpg --import KEYS.txt
- (need pgp and other examples here)
-
-Examples of adding your key to this file:
- pgp -kxa <your name> and append it to this file.
- (pgpk -ll <your name> && pgpk -xa <your name>) >> this file.
- (gpg --list-sigs <your name>
-     && gpg --armor --export <your name>) >> this file.
-
------------------------------------------------------------------------------------
-
-pub   4096R/2AD3FAE3 2014-07-24
-uid                  Julian Hyde (CODE SIGNING KEY) <jh...@apache.org>
-sig 3        2AD3FAE3 2014-07-24  Julian Hyde (CODE SIGNING KEY) <jh...@apache.org>
-sub   4096R/B9E5F68D 2014-07-24
-sig          2AD3FAE3 2014-07-24  Julian Hyde (CODE SIGNING KEY) <jh...@apache.org>
-
------BEGIN PGP PUBLIC KEY BLOCK-----
-Version: GnuPG v1
-
-mQINBFPRR3wBEACqQtKh1UgiB7RQ4et8YpMBtTEX1rMB6SUdZYfnYE+J72deirje
-N2AFVxjxj/o9UWynbep4wvcYiHnVvIIHrn+PusFY47nwLdTy2nEK9vA9Ighn26DS
-6TJlM2IIN9I3UJd8DXBkNnlXuiFh5wWYITgMTnd1y0En1JZKNqxXgw0PXBGkkCxf
-ipI0QImXX4FQYb9n4LzH2pQ3+oCuWpl7dEVCYnr5MxM3qfjlJJwvI32y33kNFmeA
-zSOY3vhXg0ISrj58rxnoaMiGjqmjLjPyl/h3KlowZNMKmGz1HIUxc5yO6c27dr8Z
-DeE0Ax4lr2/1J59KxmJ1SaBcjLsWZur3FKXF3An/jOGGPbWLdS1PqZ+BdqeJL/R7
-imOUlvUZwEaaf5jv1gxyxPi3BAwSkK44gI4JeBelPPwN8IblF7XvcIf1WQFDMwFL
-TzYARG5DOPwjjmfRqwUSTxU28O+bys4xTPvHyHHuXc104EFvwFuGY1NbdDzySBnX
-d/h15gNyjNn1DQiy16BFO+WU+zVV1I4VndtWW4lLU1rZOv6IMI395GVefUDqcnOd
-DG/sEbbOnSxqjrHsjuqFBUpFlwVC4Ept3+7DtZzradVWKnCDbQa7UBP/YhN/SEzC
-8wOu4cS++jpwbk8JyNuqvLy/ylnBZ/Ut6aABVLPYFzECy7daFD2BVE5iWQARAQAB
-tDFKdWxpYW4gSHlkZSAoQ09ERSBTSUdOSU5HIEtFWSkgPGpoeWRlQGFwYWNoZS5v
-cmc+iQI4BBMBAgAiBQJT0Ud8AhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAK
-CRDdtumBKtP64/rgD/9yEb9U5WFhtvj3Hiui706L5gJXFcCI1CQ5/ctyV5b7qJ71
-DK4W75bSuoeY4vK1wMXPp1bdMIJW//aGx3GHAV/sTXAwTm9OL7zlEFjGT/c6y6pT
-uPEUfHVpQ2dzOcHheCy10BfZFn7UnnLE9EUbwy40SjnZAXAeXOnVZ1DTSDLXaFHd
-7OTzKTcRZuQq+521WRjEp+PI6NLW756pqV6cz1JIub+XqF5wCpyVW58K2jUGWHel
-V0DjHhzGiEl2BX5FZqenh9lIFW7jG17pc+1KX1lMMFmfVDDEDBHBrWH2kg+90drh
-3tDZm/FImndokAHZO1hn6ZO7ZZKm/RCnTags08/il5WUA74wgCcmbQWLCtmS0X+k
-ymAZ90Tx/8NCQnck/V1Sq4lZL1FS+cwoRP+g/fXnLpR6iUoKttLOa3eDHf/Mvw5u
-4Wr1WxlfWWVMOXrsHbHgnQEsW+lwpeA+WUELCQ6ksJzwPr4TGH6c8r9pZNNvz2et
-pjZ7WIrPmR56w9INfeaENuNoS8pKmvtBpY+CZ4riSjmP3GpB1S37LvPsvgXapHpa
-0Niceb1jSBT/cfYf2Sp0yNzy+yr0DtG7d3HKvY+S3NpBygs+NLC1t7YVUzYiw+iu
-fmnIrpKwDNTGomvN2y+LEf7AuXe8+wt8bgLsZ0UiDT21KLZjCRCE1Bxx+8gkZ7kC
-DQRT0Ud8ARAAquRV7f+IHDjrbzDQkTI7N8XJOQJykR44vNdbt9BgNbBrbFZSYOU1
-d2DtudPMgPVCcNJ73fVOasXfCcLm1C8FGRb0BAOPvF97L2+RNMuD/JzNAYyZL/bU
-im61Dgz+HM9Fyu1PFNmywgAdBvK1rHhiyv3mfJUOLquoIxr3lzjAqCvHAFKeNOdv
-GpVByRK6BwvbCMMwwY2Alu7OlzEmv0KANbf1K2zIKG3VtN5bpIFvXWMDwMhZSEmg
-Z86vAapmpeMVfgvtDhB1xGL88ihwGQSVaGOurR8u6JpcbWKWu+hwkS61hzLXxdiJ
-fxC18wuXuIAKz01hETX8ktL4UZk0jISqoD+WAbajUiJIBvEoDSmVoQz0znLECU7U
-a4h3GguQ/tSJejGVk0gbNONi0CveYPzVWqoIkCaD08z62HeCuH4WbrP5NMag4iGt
-zkS6preP38M3uJYUrF47AqD8c9xqaqrqN9ePX2rTM8/v9tdcy7vtyBLyX7bVz2Bw
-cF7aCKtol7wxgrNf+npUmnAQ8ejCrnMaFB4X9C6BuP/Y1l1mplguHSim6WzNU/d2
-63kbxWQuOWcnMNoZ2v3vkmTS1o5kQcJyo1bjpzgV255gowTKQJspgUySPYjYxD14
-tBNW8kpp2sqiNq338t3DXBpznWEIGtbX3TjwtW1mKxITaL4Ks8uExqUAEQEAAYkC
-HwQYAQIACQUCU9FHfAIbDAAKCRDdtumBKtP645/ID/49Uq6/T+fleY7mt6pOuk0B
-M+zRF2nLPXzEqtf7rOgiQjyhhv40hDfJWOPtoOwpOMPZZYVmZf/2UUL0tDHqJum3
-iPVDP3mLw/6uNK+1Ifeg+1nK/g25jnIsyfRMKaKu6DOB3nTi7G86/5BTdr7wiXGb
-RUaTH7jhkUk5Np02ru3Wv/b8zZvfo/K7UfvsoJ936HRv2C6BwdiizEEnbfPmzzFp
-uEvnCFQHL2fxFtJaKthtRyudWTEEY+ZFMgvM7+YYqyg6mdoDAcg4FXYC6THF9H12
-z1/qPnOiCfiEJvpimCcVv5qKdWjd3r4YMmrfOPkGpqvwwm0OulO/1DlLmYTqkLmV
-TJjPb81zFgJlhBhFcFXHRq2KaJOsJr3+N6NEDKzmbYGBZTvWQBVaRxAbV9tCz12Q
-FCw65kJIjdJhaZKg89H9TDOzemEk4sbAHMF7dFmA9p+OX+MpUgsnG2fAh1zr2aqJ
-YqLHGuE5xiFcFsOOixpHwS3vr6L9Lsn+ixdIXtK0IXh1mHJ78yNaDKrFzIRGissF
-Mo0VX9LD8U6wT32+AXldZkFlFr1TsJtilgEen1AvxjVs9KLJjb0WhFsw0MGndMOD
-Uf2lGPk3WCmS8+NmQm4PePkNUIN1N6BNvLpeA8xUzUorfUHI74949+ppVQ8td5eS
-HFfYzFyXcqX3BhXdDWg/XQ==
-=9tCp
------END PGP PUBLIC KEY BLOCK-----
-
-pub   4096R/AB10D143 2013-09-01 [expires: 2017-09-01]
-uid                  Jacques Nadeau <ja...@apache.org>
-sig 3        AB10D143 2013-09-01  Jacques Nadeau <ja...@apache.org>
-sub   4096R/6B5FA695 2013-09-01 [expires: 2017-09-01]
-sig          AB10D143 2013-09-01  Jacques Nadeau <ja...@apache.org>
-
------BEGIN PGP PUBLIC KEY BLOCK-----
-Version: GnuPG v1.4.13 (Darwin)
-
-mQINBFIjwJwBEADtEHGy8BQWARs89O/erynRvY/yeeZNNFvpKvqfZNrwU4E+RIvi
-mh2HaKQ+jFyyQXBhzrdfNC5Vb6uegYFKer0sXxd3tNglnj9LjDz9P/vS/h6IDtiL
-LbbgVSqciW6OdJp86chXwzLjt6fNdPzTIP1w5a4t8JBRsiWUc8GqHQxhcckw4cpu
-FEE2fheC4vABGdSoFQvOHZRnlVKItlitFHgeWZOFyQ0izwIM8uWDkKCa2FatxHBV
-HgFPQdqbBd54xxe4klx1sOU3hJS1Dy9ezK4JgltPGDrVJsbu8+14Zg9mADT5pSz/
-Hp5vQN1l7Mm0qjAaDrbszYuRc4AICMSMZuCgl0QI6ZI+pI7kULjIYYiR/82YBsqr
-IqVyWoW3fcl7Bi5sY53bbZ1ilabyS6LH1fQdOB7jfyu7n4M2m1QioERLIj3FLt1I
-eu18PCVITuRReFRuc9qtwX8CQCx3J3IAIjUvdehiDfdeHR2DNRmNg8+Rx5QkZgDn
-JK0G22DwO6NpjzvdJ2dJ8GvF2VxtnE6tVvFb3Ws373FyjWEGwWcG/SD8PQ1Lv5Qq
-BeKBZ+Z7i0VtRVTj9Q4fiACXKGSIAjffx9j0KFUcKbPS4uDDw+TpqBD0YLwl9QSI
-AcBuAs8O0lBVDKKyEuuy4ogfX5wPu/0TPBLVEzul6haqsjGNoKYnxyvYRQARAQAB
-tCNKYWNxdWVzIE5hZGVhdSA8amFjcXVlc0BhcGFjaGUub3JnPokCPQQTAQoAJwUC
-UiPAnAIbLwUJB4YfgAULCQgHAwUVCgkICwUWAgMBAAIeAQIXgAAKCRDfK+AwqxDR
-QznfEACJ6/PHgL/bs+cTjIUazDfHuAA5Vwt3p9UjLsoavfeQyhWetDZlOPv18WQj
-Bs/hqelYEmRMmKFTA6soTBUVTPWcoxh4zHlg5pI6F9+GtBEfn268iGMYPQxTYG80
-eMlfOiMsSwHNNHF0JxNtdsOPTpiK90rilni4INW5GbRTZAWkYTkLD1+gbCSfJfLg
-zd/TJK6nCCH2Wr4fV9REg2hPHpHkq61Chg4psW/qRlMyPRDYAol2aSbMVegjwElK
-saLdn3vEyrydWeC+iB/tLAVFkvKuqXkCFm6u82LJ7dEoJx5Q1o6WcNsH1n5tI4aJ
-RXJP9GZYXPlnVMljlr0ZSyAYRWa81xOa9sYLWEqIuGkQnuBenhLtRBLYYpAA9QIY
-rhCdBuKo/ATDbOC5ejqYFb3SD7SomSS8OsB2qDP1/Hs6vsLgoPHzNYVYp/fZ5YRx
-T4O3NYbptVKCgRUHJKWQJHu/XEKmmrfS5+UpGxEJLwPxj/VkN/z6G8TxwN3zOGv7
-OeWs77+qFDLeEus0pv1inwFvWdTia3Y2XqRi4zDwS5pTQX6Kh21k1ryOEjHYeYJx
-qKRm+BJ7Nldmb14i5m0OqwBhKTsyFI7z36Lm9axlsF72yiWR5MdpJHA9vMZHn4WP
-qyH4ifmqAuCIm9JpsYHJPGaY+1Nkbolg1WypF2lykTlYkbIbHLkCDQRSI8CcARAA
-rB26ik4YAoTdc2cVXXC9SceVdSe48AMxCqkSdr/AtlLkf/NNXHw4yS8xdt8c0DqT
-qxVBqkWIQipZqkGzl6pC1FhXqPw0jujFVrYoOfeGyQbvTXmxZs1T1pRDKwgsNtOX
-QT5gY2kmbRcISPB8dyw3AujahM4UqkZ+Alyu9NyX/4zmTuNMDdhd+hnds8jba2yz
-U/dCHoM45QXgEzdVCoqoQAyqAcL/WN/qAMeb2yyLNgmJx7mHFnI97BB3uZhEaI/A
-TeZ+KuTPzJg/HjLVaRDPNfd2Re9NCNDPgyqDqPp/LPKKwhiZiod5VddtENJ/cc7O
-H/dHtZavIBOQQGcKZZ7y0XBHP7xCwboe8NECVuo2RLC/IjHNMpO3nKI/8PrbwnfS
-X5n+5Sel4xkRMCk1vKNf8FC8JFPaui2jm/BqTJ+//i8Ztgsvm7BrbFYMGmnEW/uG
-c1ECWkk1SLgv+TRF+w2gumQMKP08x03U6B/gTybfMt1/yAVeZKnGt6i6eOc70dQH
-k4znmIJhilHCk+fNT1T6xd8ZPAYtGOEOqWtlL2tRXF7eqAs2DkGtS9EQttUSknRh
-jsr2bd9PKZkShox8BVX5aMtsLe8M1sTBhrYKCYzM8yjDNr4qUc1SDcgahdFdCwVo
-ZUMA8LNrup9PmcxQfdS4nz6OuVCUkpyIjSA16B4bYScAEQEAAYkERAQYAQoADwUC
-UiPAnAIbLgUJB4YfgAIpCRDfK+AwqxDRQ8FdIAQZAQoABgUCUiPAnAAKCRDCxgIq
-a1+mlfd2D/9IhJLbvBqnVb0boUIKgplmtdgrVLbOX11BAcaHzf/oKbtThdtpakEe
-XN8cJc5sjHFH8hC5xreNhm7VfAYMB5cLPc2dklmo4TJuYzvKJmioQM91BhQBzt9j
-+ieklbl2hCE1AVYnwetTDP1jVfHc0SKS7Uq6PqSCybsnXy+FWDJO8U4ZC83cYkuo
-5RtADdNnEovxahv6kc8lRtOmnPoG4k4MxlZWqyinjGLRTGjYEKWQlmBlZx0qIVIP
-4V4EDJp15TyZgjq6yV5lMreoJ3R7vl+O1T97xlHWmJr9TDnF6Db30sLevTo0YP+4
-weNTfACBYBBrB6hJ8DrCEfqSZwFFFzpzF2WnPJqiH3JmZNtIdPw3hTP8NIvt6kAU
-gmTqbnaprpaZ5V7gxluWcVUIFGgC8uCRbp9COrp2dmDfuLbj1HEQ+6uDUDLsPZOw
-avdKpABe85DNJhRpcXO+p2Zvvz0vDYJI+PI0XVy7jfgtI6V6h/4qoqfQbKdcBlUX
-5a4B61cDHlRMQ4B9ZI6ZsyK3y35mz9dB2oBBQv8sAhekBYu2v8bmaz/UEioSN7lP
-MkMgJcvhdJ4qQZlllHi0WFDs0tf7SBTzqNvPjsBHBIf0FifAsO+grPadswWvyKUP
-h52IxWvh5AO2Yg08enyA6h+8X0hmZSpyXDLE+Hdnq8Dqn2q7conB3m5KD/9KrZbm
-gU+kMf7bEjPBWChGCmZG6NFVy9Kfjdv9ezKZi5vp/wl4Qfm7OgTonURbv/BM6Qdj
-R8ZnEe2wiKILSICW/mQ8Y5uUu5BIzODQvyh/WN4ylM+dnDSL/T6+Q4gES7/GeYth
-Es1dRpLKWtEfxQifZ1jhYiKNpFTmhf33O+0e1+aejgWwsLXnXBRMtxLem6BDQtA1
-QLRWBH4lysBgnxeH9KQ/eL6Wy2pTwmbpxyHx87HzEXXLS36/othdXhWAokDw5hqJ
-lbPe9lNkJ8KqtKKU/hxowBQDrj2s6AlPNkBBx5ur8ro9Wr+FYS57LPh4cVhMedHO
-P/9WRAgFctvyXVj//F7DlUWisPA6RDeb+Ot09WpdCDpJ+OL953pqKIPOOw6jEP5u
-u0rIBwtHYCMa5mq5E7OT6CQIZEUTkjKcLAlOPIgzkq+6kdincWtjf8tIiM6T9koS
-OfHgPH5T+RwkxjV/EPORahU4K4cwJYhHF79HiHooHtBAFks9Jysy54M8t7mhdPRZ
-+hzkWV6r/hnFHwcth1ypK7b1ugYW2a+hZ2DI8kN2mFcVIphoRSWKyLlNEsoBD3yl
-ql6lhZBgdT7euTI6sc0ch1M5a9C35k1yPFjh5bm6ed5VS+7qVZr2n7LWplQHhRQE
-P5iIjn4zOZYYd6Fobkpw3vi03ifusAeOzwpCmw==
-=6NWa
------END PGP PUBLIC KEY BLOCK-----
-
-pub   4096R/C516B444 2015-10-06
-uid                  Jesus Camacho Rodriguez <jc...@apache.org>
-sig 3        C516B444 2015-10-06  Jesus Camacho Rodriguez <jc...@apache.org>
-sub   4096R/141820C7 2015-10-06
-sig          C516B444 2015-10-06  Jesus Camacho Rodriguez <jc...@apache.org>
-
------BEGIN PGP PUBLIC KEY BLOCK-----
-Version: GnuPG v1
-
-mQINBFYT4qoBEADcy1JT5hTZ6eWJqLFGGLlx50cMZq1cCKkIov1qUOW5haHktnb2
-gie1NglHUq7ILPQyZUWC91PmKrca/g6D0AyxAJO4RVnsLxNwIVKO0Dz1EKVCnFA6
-Of+IOH7QA7lnVKfjmH66rvZCSARvktttmwve4hPXwZL7yIDhhxzjDoBQIue3uWC3
-YSIOoptY8YhfjmOPWnmKEm4GzVEvvWfetYiHpQZTXliYlBROvm1wKowtw3GuR+7T
-gHLo6mGZYbnzZM7NOgSqdZ6e2XlomG0QdLhhFkNNHarLY/xgAR4MucPvE/FRABY0
-eZux0Z3u2Cs3E0iFWX7RlCs9t1S/QTt1yofTGEctGxgQ18DuOxqZQER80ScseKpn
-11ea1zr5OcHE5cD8FDr1OTggjIJ2qHkEXLkdTy2WLveuBczZdqu5x2U6ceXVjY+Q
-3X/Yo4P720pQgh3ZrRkM8gt5TdcczZ2yFBWX+ezDuwCuou4kLFksjPXOnU2DYicW
-wnZGLqE/ZGdyyQd+mgA7DV3uCtCL8dMz3aBvG9QGgKw7H4J515PQmXS1wJK+cO9g
-yfSmymHO4vOIScMftmN7oRjbw/Pc1IzST/ElfWQgjWshP+YMO8i4FvH1AB0305+R
-GArkOnoy1FNAgAnwMDf9QYjwPq6ir3qAcozbEtoWNv+uZG7uRsxsjbr5uwARAQAB
-tC1KZXN1cyBDYW1hY2hvIFJvZHJpZ3VleiA8amNhbWFjaG9AYXBhY2hlLm9yZz6J
-AjgEEwECACIFAlYT4qoCGwMGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheAAAoJEJMe
-SrPFFrREDrgP/1ZgdSjqBNYCKbltHRrukoXguf+m6k1TG1528ICnjWShYsHJAhQ/
-PJ2db40wftd24gZC13DQ1Forl7BB+YeJschnqDYqd4HLP3SjIvDXApcPYllaU6XM
-qrGnjypeFlrTkjlcyuJS/tHQ2C+9jaSRUw8y9xL7qE9pzyiLXHhwzPUhBJJvnloX
-Z+0Dx8ybH3GxgMHyCLz80gUEf6kgek5gYxRf3Fk5WWqpK4XgeCdmBHTcO5uMm47Y
-GIEufbM8D9h7CL0n3aPqJMC3eWTP7C7f+efub//7mikYHCQPC8oNx1Rd/aAUndOU
-wgTNaePuO0NhFW03ZIAKct28/xGfKU9ZTlpupkGDQaLqZgb6sscfRKx2OVlN+P91
-5xaI1yTfGHMXpHcwKtrOOCiNpUwNkFXpfh8TbXDrgGnctaEnzhSXsbl/aI/vUXbx
-AnH2AhvWokVc2slbuon0siJArG6eC03LKtCVNpTS8xh3cSXguSaXdDoJjtWQ5QEd
-/pVKkv7Do9jmnWNCpAiRTjhiMto9SmXUpgkHPRM8xmDeedFBRZXiObWlXGEXCZuG
-E4Dp9nZpurP6gezuWnMWJU6hwqoNx8tbn45sk4iCePZPG6UvXvNK2ZkFdUPU2BR1
-6v6W6lj5gll+HBjnci+/nXeOhjPUTdZdgY9pV7yTTi6R24TO/xIbmJ7+uQINBFYT
-4qoBEACt48dYxlSppzpIMsPetAqFXXVh4wUEtmRtHAydgyPOLUpxDC2fWZ9W521F
-9wxKbfnQkQWvJuoTolouTfsIo0qYClFopjfCwoEqzNp9tPmC3mYmh4pisVnUJclB
-Xt4ilQ5UMasVr/gF+BnbaOO878R9HA9KerPY3SMMrv+pZTmOeeSZZ+F0EhCj8rKG
-vONUCB7VUfMOk7l9VTgnP2tLZ7/WrnVypRD8Enp3V7X+Z5MUnK0zadzC/DdAcNnn
-QiSDKmpFIQjxWPRQwWj9DbPjbxivMzKrZjhGqsHZS3MPjx1HfJ4/IcehpBEbKoa5
-jS2BpX3kvzbUySs1TaxD830nv5483RuZAGvUMXAv6w63SDb8dvL09IM7JnPtmSuQ
-SJFW98UneI8UAVF6S0sbJhUM7Kt6ZPJpSyfgdPhoA9hODNzv2JmkHmhsAlsNNhfw
-07hM21IibpmsnctGBKt+BR7m++vlgqxr7vvT65m8PAff16tXR5f9SwT1K1oBodOX
-R7hMOOy+LRVa1KY8Gi1/U6ae/lm4+2aBF++9xSgdMg22OIIsMhMlt2k46c2fHhwV
-NBX9MuJkcN2wb9zn9T+zI8gGG1j88CWKMC6OX+mQwO/8eO5DKchnxhVFp1NZQx4H
-FFxyMjxpQYk2I7iFjboP4ZCF79lycHtkifaYMthCokgdJKd8nQARAQABiQIfBBgB
-AgAJBQJWE+KqAhsMAAoJEJMeSrPFFrREus4P/2CRgAseRVY7a/fGi6bfF5EcHEOO
-TntS0uMprnx4EpNC0lRdc/4DFeWDzJQ8St0okDTikfHZ154OUUc3g9UT109/t1Dk
-qSJhh3Xmv25HXFUnwDqMeQ51c1/tjQjKHkeqzQ9xqIkgoc2V+WbF7cahR5JT2n5s
-b5yPsiCpWdGmMMSSiQYCyToltChS8DEIFQLIxK76ueeUdEG/tPXtdoV7DtLd1rqm
-6HTvFjUmE8M/9i+7cTpXUlDrKU7PzgSUwmirYNHacttGOQ0L1fFi7zUTtzzndEac
-v/euiATrnZJgO6LsdnRnNHcOiMsYzwssFvNkuHmChiVrJfrbMe0xMGPOEjeZOhEM
-qkGPCzWWEbaNAGTWuWO2oGz1IPHIr2mHFJomCY+SLn11lMAeKutoZ2U7T1VQbwpE
-PuujjiXJWyJnVPW4ptkaG0s6rkACM1+/Bk3MSedFtYOtd8kZWIheUN6K50UuoDVq
-7wrExKXFdxSd5q6OM5Q296nl1h7toY950Vx67Q552AYexzPAvpHeMSodGvBi/UeO
-fv47W9JoFvFtiJ77fm809tkIyb5fSCEJejc1LTohrPPgWf5H/++ZQhghcSfCnp12
-L2aEg774OgoVaPar0oMVE5cwD+Ozu97LbgNQdY++JWZ+L7Lz9cTXHdOQFl1UDS1I
-QLsX85oVrQIIqFPL
-=owGw
------END PGP PUBLIC KEY BLOCK-----
-
-pub   4096R/4677D66C 2013-05-04
-uid                  Josh Elser <jo...@gmail.com>
-sig 3        4677D66C 2013-05-04  Josh Elser <jo...@gmail.com>
-sig          00B6899D 2013-05-04  Christopher L Tubbs II (Christopher) <ct...@gmail.com>
-sig    R     ABBA8A49 2013-05-04  Eric Newton <er...@gmail.com>
-sub   4096R/99D5F66C 2013-05-04
-sig          4677D66C 2013-05-04  Josh Elser <jo...@gmail.com>
-
------BEGIN PGP PUBLIC KEY BLOCK-----
-
-mQINBFGFRlQBEACk3q10Uf5vjHZ8rsSt2DA/GSvST6CCvqPPk56dmtLCs8ojO0rb
-aOXXx1DFrrm9BILSp1edhPpCs+KbQnpO8f1YM+k+WY3lc/Ah0X5oUQQranCjC/Qi
-Uf1tgp9xLG58ic1zVov8QGhyC+7XjA03pZe86izv6UvfL6ufU8XicnIYlRBugkg9
-bkjjM6A3OZLFoxEp20KdeWqhTOjCEDR1ocNcQ4IF64iVU/Stnn5KmywhzlfwWoGZ
-kFAzxEyghD/49+oANPJtnL2aZ1FS9ZiR/dkR73nDPWDioS1MusMwlNDErzoqpJLK
-UyePh3AxY+v3R9oo+Mu1Nxmp7bIoyCmnxufOCUOtxSVpMMWOBsdpMKuMgG6GyBKR
-wP2mAPHgMwKfLeqsiKUTZHzspUshsHovuVYcGbpV9in27fo7K7bKf3M7CE639a+e
-Wz8sIhQ0wj9IPqt96t56LhINDSbG2DOJY5m5ljxmSaM3Z59QgU191b7ZAn6GLszM
-OZL9qpPf/oCjHuYs1qJFrWALvdRFXYD6cd8BrtBP+mpgnYFLEZ8lBBeJKKJxaxxb
-gk/TOzXqBxigz7fvMc9FoNEbZiJkIsquKUko3YohrAYVIIDzJKV6buP6IJg95LYb
-i94zd65OzHvjQV3ljo9mt60wgMhdLDOCKV4d++zutkekzrXNTYhk0HjjwwARAQAB
-tCFKb3NoIEVsc2VyIDxqb3NoLmVsc2VyQGdtYWlsLmNvbT6JAjcEEwEKACEFAlGF
-RlQCGwMFCwkIBwMFFQoJCAsFFgIDAQACHgECF4AACgkQt9XNRUZ31mzzBBAAkfuT
-HhL5vAxRy780dV4jIE+CjK242DlATe8J8xAP4kF34WD4qijDnysaGqNFNBO7sq1+
-EBn1OizYPcMEIwhoqZ9bBjwRGPmHyM3Y6vKFnXQwl+YR3gpYYR4csh2ZD9iX+U74
-jo+2tHICbCdpjQkAUe0yIivT3GMntKuaGuHZx0+0qmtNeYSjuuKyl+9V1/mTPUQA
-EUcPpG3BFpFURYDf0W39uGJMBUXLGB3dJiwb0Y0/NDFAZubuO2uUc0ihlaYMvYqw
-lhxI4BWxoLwSE1ATAyM04iLld6qNk/c35jb+NNsl07BC26A4nQdNa+L1V2M2pe25
-0zU65CATNdLf5T+Rg9i1k7li1KJmL9SzyDOQd2WEtv67Tx/T5qG5ISL86VIbzAdM
-Shc00FutRgQ5IJIj5msySL3O5x3MGaMUhVocWP4oCShk/BlBOkcjHYzqpI8hm8hf
-Rrip2zbO8Met64/fkwMTMXX4E76hCMblYjTa/H4VlQ08oukwJyZagbhkivAjsETM
-5wXgW/x0QU1Rkfwv6GLoZqS1rumrX6S12x31qBXT/KKuI3QdSStkJU96/MeC8oD6
-AvjtahBLiKalX64VFmM4vX2TIb4OjkO1fySBPXj4GR1F9eg7S2wlSLryG/tGrx9B
-GH7qD6aMCk4xyb5o4YxNylmM9pDGByqveXflDIqJAhwEEAEKAAYFAlGFS0gACgkQ
-bwza5wC2iZ2GQBAAvmZDHFMExlr76mKjw1uiecJB7cGVfOx2Lg/NSoV09K2BKNcV
-4gJrVH2lLIlR19rSP1U+YoWJr+es2HDUZz+uzJNZ8ZcgBfLuaEO2JGA+0P3aPBuJ
-kBkDk3YDSx5Q5U9KFM0RBOebC901ZFyUpRAdeb/a3xfX20G7KyTmfZXegmqKsiwU
-WHNqrOObRnXR2sif3ruuARK2/8SZo6isdRjssxkaJMOOt7rN1j3DxI1x8eiewAUs
-UXleuZZj/3kLP0WeJkJIVZ5Blkptn3owrZWoidKK5I4x0ge6zDGNCn50zechtksU
-+iV7Leu61P3s0ssoYlaJi2sJK5aZiInMafI5WJeevbNIeWNoCv5I4KNgw+XRPblU
-31O7BXFxImP3i6eBW4EbUHMycrIvN0itSrCsKpDX2XE6CEPSlhd7lXisXdaNLWP8
-DDvPv+ML7XlOBv0Ebho5PaQMhSjCQKsV1Edq+Po74/mxSRlqw/9qjymiB8a+6+qT
-cQxiGuyr1bD5rR5d2ns73H+QtOlvJ1v1bVNQbElgYTtYq5XL4+O1ZpTJYAmUB0z6
-wCIrmnpkOz82eqr+7eUIW1l2+t1Pi/LXlYOZ9SBIPxF85ZanBsUFyUC2R2woZdIf
-p5g+QtiNYzKZYH4EglztZ09uqWi2r6crMTZiq+c7EXOyQEOspwtaXCg+FiuJAh8E
-EAECAAkFAlGFSu8CBwAACgkQJSyQKKu6ikkdoRAAxfoQuL5cmJpN0Jwdo2ONIRpR
-+YkU4BgDPyWAIEsAMBRdZ06ZSsTjRMAWJqfIvsItSfJsN26eJ87aUbKctxmEpZ/e
-hXs2X1wrnjwqIWqDxLDvipRKBFA3S7rItGpskRajnkrc+ZGpUYVVNUF7H/DkRafW
-Fx2WOfZo33Zyoj/a11xmC6TPAzeoaTHd43jbJFLTX1TRdnubd9NLH2RBOZmJwOIu
-3tDuookK4Z6cvDv7HlgS7y869z21m9WQfKD2jcuh8+t7UqLhQITvlBxaPgri9xFn
-8Gsyr+ro7mEhK7vxGi2ozFYFpDbZerqTHysx6Yw6G5wL8UZlIAXaIfOpbA142EUY
-ynQPQbKr6xmKe/5EAM0FKmfRGCx/p3So9FLaYDHBTwu83ie6AUlEY8OhpL5xadMO
-VK+JCC6Y8VSymjnK8zO+743ePw9HCBuArAnSRSOfeJvs3JO6th9v/x18d/oMAy9n
-BMYbF12WTNRhKYcD350RgxucC9kVj+tFSJg/1034JZvg6oX1V1gPu5GuwuFacng/
-zB7XG3Sb7bDKmLWZUVXCD8JLrLY9F4K/jBClBFiARQ1gTUraA/vxvJBaXHtH82Hz
-twzISWWZriBMroj7DIHlJcu9FGKWo4uwvDFhWYsQgGhu1TFBki8hYVox7PpXnh3+
-qoqElhs5kqgzgE8HzzO5Ag0EUYVGVAEQAOhs+yIikgG9GLEzH3Hxm1B0oJG5fN3f
-nFnNmEeqQ6+vV61VsiQ2TMkMJ1Ukn0AadPZu8Gst27WtVeP1WY6BawJigfJFevJo
-IxvjoUcw7wdYCSuvA0A4vSw5uimwbkc3nilgNLVwMx6XBWGvSi9JFNzrhvK2NLWh
-l6D864qmhComruoof7D262iXXO0RqNtcjzgUN5pnDO+4DdCapqUpAN7hq59J47MD
-QYBTrTcu5oCdfsotMwhOwfizo1LCFfBUC3U4YbGbvyzArj94uROzGMYlSaNcbHQu
-F3bt9BK5wxEWmE6eYGJCgT9uZjhf54OsTLsm5vMJS9LxMagsNoa9+DYymFqqFZKa
-Z1AH7L9L1GP3x7nNBc5Dy4X3I4b1tjvaMTDBZ212mADw/KO+a61Z5j+wY1T9/pF7
-ktOHsOn+6xl4MUR7wnNQNeioeuoo8Qmcg3fd9Aj2BK8X02LhFXLWgw8KJXUmdx3p
-09kdCSAVZoREhFjciOILolYeM+AfHReigGSaCEPLzPpGmcXIC2nk07Tj2NFTZU6e
-h6p05teh4MAnkduf/zc2qDCzvuyzikOosav4yoDMt9N0dzS8ZTvbTJ6MHCIfEked
-1EwcokmjwhzN2ZaIvMMAJQ3f3AULc4T8DMsEH1BJiVHMZQ99UDm5vuf+idqZwreF
-f2YYFc3hdEEBABEBAAGJAh8EGAEKAAkFAlGFRlQCGwwACgkQt9XNRUZ31mxVkhAA
-k12GWx9pt/SQ5zTz/jiEhN8ANOLMXPtTxYVNe9qvz+JhC73Jhgx3AQbMxCf1PDZa
-P8kQZx18t/DAY8FAv1Y9lJcx/SwE05Umt/TZAfNo/Iu0n+451tpPvKoiAC0Rs2Yi
-v76LYkkoc3Dw2NZyBIjdOzJZzLa+uFKV7g36LFXSJ572xsWJEkuD/pvnYI3sf9Ba
-O4gABibcRJ1qyu67FMq/lk3xPSW9Xn/psrDbZgBnynREoIyPGMya+1qGWZK/Gz3m
-dJ+unOrqc1tiVcjDOjxRtb07HBBPkC0+yzHNdKfP4RzYaPn6MwJb405QxBdypuVy
-aPZ3kkQMxvGrShHy0Eu/UuYW3bv5HVzyuUaBTfi09QfKk6sjRXIOp4srGhCYESJD
-4X2jRd51YCWwVbpA3UPjgndRP6IrWZ4847dI7tpZQkkg5+rQsnIAOYMdJ2D4KMhi
-h5h7kh3oMpDU/sjlOmzfhWGYNlrmpj2aZz4A3GXt6XC03ADZZ99z5ojA2c9ZGpzn
-nqOGvphXYnOxBG1Uw4H+XpOxHov0pxCZ69D5N3Q0nhPyR97bvyaXrXQNpTWFBsVc
-vjyjCr3BPME50yhRMi8+Z4C9CFIvc11ZFWvRpDizb24KA5G0nfDCJI97k7j/H7xf
-8V2QfY4DaPLhfNs2zFYq1caxk2abqdWoid/qiDjVhDc=
-=6T6u
------END PGP PUBLIC KEY BLOCK-----

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/LICENSE
----------------------------------------------------------------------
diff --git a/avatica/LICENSE b/avatica/LICENSE
deleted file mode 100644
index f409fd8..0000000
--- a/avatica/LICENSE
+++ /dev/null
@@ -1,268 +0,0 @@
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
-
-
-
-
-
------------------------------------------------------------------------
-
-APACHE CALCITE AVATICA SUBCOMPONENTS:
-
-The Apache Calcite Avatica project contains subcomponents with separate copyright
-notices and license terms. Your use of the source code for the these
-subcomponents is subject to the terms and conditions of the following
-licenses.
-
------------------------------------------------------------------------
- The MIT License
------------------------------------------------------------------------
-
-The Apache Calcite project bundles the following files under the MIT License:
-
-- site
-    Parts of the web site generated by Jekyll (http://jekyllrb.com/)
-    Copyright (c) 2008-2015 Tom Preston-Werner
-- site/_sass/_font-awesome.scss
-    Font-awesome css files v4.1.0 (http://fortawesome.github.io/Font-Awesome/)
-    Copyright (c) 2013  Dave Gandy
-- site/_sass/_normalize.scss
-    normalize.css v3.0.2 | git.io/normalize
-    Copyright (c) Nicolas Gallagher and Jonathan Neal
-- site/_sass/_gridism.scss
-    Gridism: A simple, responsive, and handy CSS grid by @cobyism
-    https://github.com/cobyism/gridism
-    Copyright (c) 2013 Coby Chapple
-- site/js/html5shiv.min.js
-    HTML5 Shiv 3.7.2 | @afarkas @jdalton @jon_neal @rem
-- site/js/respond.min.js
-    Respond.js v1.4.2: min/max-width media query polyfill
-    Copyright 2013 Scott Jehl
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
------------------------------------------------------------------------
- The Open Font License
------------------------------------------------------------------------
-
-The Apache Calcite project bundles the following fonts under the
-SIL Open Font License (OFL) - http://scripts.sil.org/OFL/
-
-- site/fonts/fontawesome-webfont.*
-   Font-awesome font files v4.0.3 (http://fortawesome.github.io/Font-Awesome/)

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/NOTICE
----------------------------------------------------------------------
diff --git a/avatica/NOTICE b/avatica/NOTICE
deleted file mode 100644
index 506738b..0000000
--- a/avatica/NOTICE
+++ /dev/null
@@ -1,5 +0,0 @@
-Apache Calcite
-Copyright 2012-2016 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/README
----------------------------------------------------------------------
diff --git a/avatica/README b/avatica/README
deleted file mode 100644
index 451e39f..0000000
--- a/avatica/README
+++ /dev/null
@@ -1,18 +0,0 @@
-Apache Calcite Avatica release 1.9.0
-
-This is a source or binary distribution of Avatica, a framework for
-building database drivers. Avatica is a sub-project of Apache Calcite.
-
-Changes since the previous release are described in the
-site/_docs/history.md file.
-
-The LICENSE and NOTICE files contain license information.
-
-If this is a source distribution, you can find instructions how to
-build the release in the "Building from a source distribution" section
-in site/_docs/howto.md.
-
-README.md contains examples of running Avatica.
-
-Further information about Avatica is available at its web site,
-http://calcite.apache.org/avatica.

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/README.md
----------------------------------------------------------------------
diff --git a/avatica/README.md b/avatica/README.md
deleted file mode 100644
index 9bbf29b..0000000
--- a/avatica/README.md
+++ /dev/null
@@ -1,30 +0,0 @@
-<!--
-{% 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 %}
--->
-[![Build Status](https://travis-ci.org/julianhyde/calcite.svg?branch=master)](https://travis-ci.org/julianhyde/calcite)
-
-# Apache Calcite -- Avatica
-
-Apache Calcite's Avatica is a framework for building database drivers.
-
-Avatica is a sub-project of [Apache Calcite](https://calcite.apache.org).
-
-For more details, see the [home page](https://calcite.apache.org/avatica).
-
-Release notes for all published versions are available on the [history
-page](https://calcite.apache.org/avatica/docs/history.html).

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/pom.xml
----------------------------------------------------------------------
diff --git a/avatica/core/pom.xml b/avatica/core/pom.xml
deleted file mode 100644
index 7ed2816..0000000
--- a/avatica/core/pom.xml
+++ /dev/null
@@ -1,237 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <parent>
-    <groupId>org.apache.calcite.avatica</groupId>
-    <artifactId>avatica-parent</artifactId>
-    <version>1.10.0-SNAPSHOT</version>
-  </parent>
-
-  <artifactId>avatica-core</artifactId>
-  <packaging>jar</packaging>
-  <name>Apache Calcite Avatica</name>
-  <description>JDBC driver framework.</description>
-
-  <properties>
-    <top.dir>${project.basedir}/..</top.dir>
-  </properties>
-
-  <dependencies>
-    <!-- Make sure that there are no dependencies on other calcite modules,
-         or on libraries other than Jackson. -->
-    <dependency>
-      <groupId>org.apache.calcite.avatica</groupId>
-      <artifactId>avatica-metrics</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>com.fasterxml.jackson.core</groupId>
-      <artifactId>jackson-core</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>com.fasterxml.jackson.core</groupId>
-      <artifactId>jackson-annotations</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>com.fasterxml.jackson.core</groupId>
-      <artifactId>jackson-databind</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>com.google.protobuf</groupId>
-      <artifactId>protobuf-java</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.httpcomponents</groupId>
-      <artifactId>httpclient</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.httpcomponents</groupId>
-      <artifactId>httpcore</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-api</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.hamcrest</groupId>
-      <artifactId>hamcrest-core</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.mockito</groupId>
-      <artifactId>mockito-core</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-log4j12</artifactId>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
-
-  <build>
-    <pluginManagement>
-      <plugins>
-        <plugin>
-          <groupId>org.eclipse.m2e</groupId>
-          <artifactId>lifecycle-mapping</artifactId>
-          <version>1.0.0</version>
-          <configuration>
-            <lifecycleMappingMetadata>
-              <pluginExecutions>
-                <pluginExecution>
-                  <pluginExecutionFilter>
-                    <groupId>org.apache.maven.plugins</groupId>
-                    <artifactId>maven-checkstyle-plugin</artifactId>
-                    <versionRange>[2.12.1,)</versionRange>
-                    <goals>
-                      <goal>check</goal>
-                    </goals>
-                  </pluginExecutionFilter>
-                  <action>
-                    <ignore />
-                  </action>
-                </pluginExecution>
-              </pluginExecutions>
-            </lifecycleMappingMetadata>
-          </configuration>
-        </plugin>
-      </plugins>
-    </pluginManagement>
-    <plugins>
-      <plugin>
-        <groupId>org.codehaus.mojo</groupId>
-        <artifactId>build-helper-maven-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>add-filtered-java-source</id>
-            <goals>
-              <goal>add-source</goal>
-            </goals>
-            <phase>generate-sources</phase>
-            <configuration>
-              <sources>
-                <source>${project.build.directory}/filtered-java-src</source>
-              </sources>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <artifactId>maven-dependency-plugin</artifactId>
-        <version>${maven-dependency-plugin.version}</version>
-        <executions>
-          <execution>
-            <id>analyze</id>
-            <goals>
-              <goal>analyze-only</goal>
-            </goals>
-            <configuration>
-              <failOnWarning>true</failOnWarning>
-              <!-- ignore "unused but declared" warnings -->
-              <ignoredUnusedDeclaredDependencies>
-                <ignoredUnusedDeclaredDependency>org.slf4j:slf4j-log4j12</ignoredUnusedDeclaredDependency>
-              </ignoredUnusedDeclaredDependencies>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-      <!-- Parent module has the same plugin and does the work of
-           generating -sources.jar for each project. But without the
-           plugin declared here, IDEs don't know the sources are
-           available. -->
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-source-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>attach-sources</id>
-            <phase>verify</phase>
-            <goals>
-              <goal>jar-no-fork</goal>
-              <goal>test-jar-no-fork</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-
-      <!-- Produce a tests jar so that avatica-server/pom.xml can reference for suite.
-           TODO: remove after moving over to annotation-based TestSuite definitions. -->
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-jar-plugin</artifactId>
-        <executions>
-          <execution>
-            <goals>
-              <goal>test-jar</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <artifactId>maven-resources-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>prepare-filtered-java-source</id>
-            <goals>
-              <goal>copy-resources</goal>
-            </goals>
-            <phase>generate-sources</phase>
-            <configuration>
-              <outputDirectory>${project.build.directory}/filtered-java-src</outputDirectory>
-              <resources>
-                <resource>
-                  <directory>src/main/java-filtered</directory>
-                  <filtering>true</filtering>
-                </resource>
-              </resources>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <groupId>org.xolstice.maven.plugins</groupId>
-        <artifactId>protobuf-maven-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>compile-protoc</id>
-            <phase>generate-sources</phase>
-            <goals>
-              <goal>compile</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.rat</groupId>
-        <artifactId>apache-rat-plugin</artifactId>
-        <configuration>
-          <excludes>
-            <exclude>src/main/java/org/apache/calcite/avatica/proto/*.java</exclude>
-            <exclude>src/main/resources/META-INF/services/java.sql.Driver</exclude>
-          </excludes>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-</project>

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java-filtered/org/apache/calcite/avatica/util/FilteredConstants.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java-filtered/org/apache/calcite/avatica/util/FilteredConstants.java b/avatica/core/src/main/java-filtered/org/apache/calcite/avatica/util/FilteredConstants.java
deleted file mode 100644
index 53b76ee..0000000
--- a/avatica/core/src/main/java-filtered/org/apache/calcite/avatica/util/FilteredConstants.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.util;
-
-/**
- * A class which, at build time, will have build-specific variables substituted into it.
- */
-public class FilteredConstants {
-  public static final String VERSION = "${avatica.release.version}";
-}
-
-// End FilteredConstants.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaClientRuntimeException.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaClientRuntimeException.java b/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaClientRuntimeException.java
deleted file mode 100644
index df03b03..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaClientRuntimeException.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import org.apache.calcite.avatica.remote.AvaticaRuntimeException;
-import org.apache.calcite.avatica.remote.Service.ErrorResponse;
-import org.apache.calcite.avatica.remote.Service.RpcMetadataResponse;
-
-import java.util.Collections;
-import java.util.List;
-
-/**
- * The client-side representation of {@link AvaticaRuntimeException}. This exception is not intended
- * for consumption by clients, {@link AvaticaSqlException} serves that purpose. This exception only
- * exists to pass the original error attributes to a higher level of execution without modifying
- * existing exception-handling logic.
- */
-public class AvaticaClientRuntimeException extends RuntimeException {
-
-  private static final long serialVersionUID = 1L;
-
-  private final int errorCode;
-  private final String sqlState;
-  private final AvaticaSeverity severity;
-  private final List<String> serverExceptions;
-  private final RpcMetadataResponse metadata;
-
-  public AvaticaClientRuntimeException(String errorMessage, int errorCode, String sqlState,
-      AvaticaSeverity severity, List<String> serverExceptions, RpcMetadataResponse metadata) {
-    super(errorMessage);
-    this.errorCode = errorCode;
-    this.sqlState = sqlState;
-    this.severity = severity;
-    this.serverExceptions = serverExceptions;
-    this.metadata = metadata;
-  }
-
-  public AvaticaClientRuntimeException(String message, Throwable cause) {
-    super(message, cause);
-    errorCode = ErrorResponse.UNKNOWN_ERROR_CODE;
-    sqlState = ErrorResponse.UNKNOWN_SQL_STATE;
-    severity = AvaticaSeverity.UNKNOWN;
-    serverExceptions = Collections.singletonList("");
-    metadata = null;
-  }
-
-  public int getErrorCode() {
-    return errorCode;
-  }
-
-  public String getSqlState() {
-    return sqlState;
-  }
-
-  public AvaticaSeverity getSeverity() {
-    return severity;
-  }
-
-  public List<String> getServerExceptions() {
-    return serverExceptions;
-  }
-
-  public RpcMetadataResponse getRpcMetadata() {
-    return metadata;
-  }
-
-  @Override public String toString() {
-    StringBuilder sb = new StringBuilder(64);
-    sb.append(getClass().getSimpleName()).append(": ")
-    .append(getMessage()).append(". Error ").append(getErrorCode())
-    .append(" (").append(sqlState).append(") ").append(getSeverity()).append("\n\n");
-    for (String serverException : getServerExceptions()) {
-      sb.append(serverException).append("\n");
-    }
-    return sb.toString();
-  }
-
-}
-
-// End AvaticaClientRuntimeException.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaConnection.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaConnection.java b/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaConnection.java
deleted file mode 100644
index 51649c1..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaConnection.java
+++ /dev/null
@@ -1,769 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import org.apache.calcite.avatica.Meta.ExecuteBatchResult;
-import org.apache.calcite.avatica.Meta.MetaResultSet;
-import org.apache.calcite.avatica.remote.KerberosConnection;
-import org.apache.calcite.avatica.remote.Service;
-import org.apache.calcite.avatica.remote.Service.ErrorResponse;
-import org.apache.calcite.avatica.remote.Service.OpenConnectionRequest;
-import org.apache.calcite.avatica.remote.TypedValue;
-
-import java.sql.Array;
-import java.sql.Blob;
-import java.sql.CallableStatement;
-import java.sql.Clob;
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.NClob;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLClientInfoException;
-import java.sql.SQLException;
-import java.sql.SQLWarning;
-import java.sql.SQLXML;
-import java.sql.Savepoint;
-import java.sql.Statement;
-import java.sql.Struct;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Properties;
-import java.util.TimeZone;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.Executor;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-/**
- * Implementation of JDBC connection
- * for the Avatica framework.
- *
- * <p>Abstract to allow newer versions of JDBC to add methods.
- */
-public abstract class AvaticaConnection implements Connection {
-
-  /** The name of the sole column returned by DML statements, containing
-   * the number of rows modified. */
-  public static final String ROWCOUNT_COLUMN_NAME = "ROWCOUNT";
-
-  public static final String NUM_EXECUTE_RETRIES_KEY = "avatica.statement.retries";
-  public static final String NUM_EXECUTE_RETRIES_DEFAULT = "5";
-
-  /** The name of the sole column returned by an EXPLAIN statement.
-   *
-   * <p>Actually Avatica does not care what this column is called, but here is
-   * a useful place to define a suggested value. */
-  public static final String PLAN_COLUMN_NAME = "PLAN";
-
-  protected int statementCount;
-  private boolean closed;
-  private int holdability;
-  private int networkTimeout;
-  private KerberosConnection kerberosConnection;
-  private Service service;
-
-  public final String id;
-  public final Meta.ConnectionHandle handle;
-  protected final UnregisteredDriver driver;
-  protected final AvaticaFactory factory;
-  final String url;
-  protected final Properties info;
-  protected final Meta meta;
-  protected final AvaticaSpecificDatabaseMetaData metaData;
-  public final Helper helper = Helper.INSTANCE;
-  public final Map<InternalProperty, Object> properties = new HashMap<>();
-  public final Map<Integer, AvaticaStatement> statementMap =
-      new ConcurrentHashMap<>();
-  final Map<Integer, AtomicBoolean> flagMap = new ConcurrentHashMap<>();
-  protected final long maxRetriesPerExecute;
-
-  /**
-   * Creates an AvaticaConnection.
-   *
-   * <p>Not public; method is called only from the driver or a derived
-   * class.</p>
-   *
-   * @param driver Driver
-   * @param factory Factory for JDBC objects
-   * @param url Server URL
-   * @param info Other connection properties
-   */
-  protected AvaticaConnection(UnregisteredDriver driver,
-      AvaticaFactory factory,
-      String url,
-      Properties info) {
-    this.id = UUID.randomUUID().toString();
-    this.handle = new Meta.ConnectionHandle(this.id);
-    this.driver = driver;
-    this.factory = factory;
-    this.url = url;
-    this.info = info;
-    this.meta = driver.createMeta(this);
-    this.metaData = factory.newDatabaseMetaData(this);
-    try {
-      this.holdability = metaData.getResultSetHoldability();
-    } catch (SQLException e) {
-      // We know the impl doesn't throw this.
-      throw new RuntimeException(e);
-    }
-    this.maxRetriesPerExecute = getNumStatementRetries(info);
-  }
-
-  /** Computes the number of retries
-   * {@link AvaticaStatement#executeInternal(Meta.Signature, boolean)}
-   * should retry before failing. */
-  long getNumStatementRetries(Properties props) {
-    return Long.valueOf(Objects.requireNonNull(props)
-        .getProperty(NUM_EXECUTE_RETRIES_KEY, NUM_EXECUTE_RETRIES_DEFAULT));
-  }
-
-  /** Returns a view onto this connection's configuration properties. Code
-   * in Avatica and derived projects should use this view rather than calling
-   * {@link java.util.Properties#getProperty(String)}. Derived projects will
-   * almost certainly subclass {@link ConnectionConfig} with their own
-   * properties. */
-  public ConnectionConfig config() {
-    return new ConnectionConfigImpl(info);
-  }
-
-  /**
-   * Opens the connection on the server.
-   */
-  public void openConnection() {
-    // Open the connection on the server
-    this.meta.openConnection(handle, OpenConnectionRequest.serializeProperties(info));
-  }
-
-  // Connection methods
-
-  public AvaticaStatement createStatement() throws SQLException {
-    //noinspection MagicConstant
-    return createStatement(ResultSet.TYPE_FORWARD_ONLY,
-        ResultSet.CONCUR_READ_ONLY,
-        holdability);
-  }
-
-  public PreparedStatement prepareStatement(String sql) throws SQLException {
-    //noinspection MagicConstant
-    return prepareStatement(
-        sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY,
-        holdability);
-  }
-
-  public CallableStatement prepareCall(String sql) throws SQLException {
-    throw helper.unsupported();
-  }
-
-  public String nativeSQL(String sql) throws SQLException {
-    throw helper.unsupported();
-  }
-
-  public void setAutoCommit(boolean autoCommit) throws SQLException {
-    meta.connectionSync(handle, new ConnectionPropertiesImpl().setAutoCommit(autoCommit));
-  }
-
-  public boolean getAutoCommit() throws SQLException {
-    return unbox(sync().isAutoCommit(), true);
-  }
-
-  public void commit() throws SQLException {
-    meta.commit(handle);
-  }
-
-  public void rollback() throws SQLException {
-    meta.rollback(handle);
-  }
-
-  public void close() throws SQLException {
-    if (!closed) {
-      closed = true;
-
-      // Per specification, if onConnectionClose throws, this method will throw
-      // a SQLException, but statement will still be closed.
-      try {
-        meta.closeConnection(handle);
-        driver.handler.onConnectionClose(this);
-        if (null != kerberosConnection) {
-          kerberosConnection.stopRenewalThread();
-        }
-      } catch (RuntimeException e) {
-        throw helper.createException("While closing connection", e);
-      }
-    }
-  }
-
-  public boolean isClosed() throws SQLException {
-    return closed;
-  }
-
-  public DatabaseMetaData getMetaData() throws SQLException {
-    return metaData;
-  }
-
-  public void setReadOnly(boolean readOnly) throws SQLException {
-    meta.connectionSync(handle, new ConnectionPropertiesImpl().setReadOnly(readOnly));
-  }
-
-  public boolean isReadOnly() throws SQLException {
-    return unbox(sync().isReadOnly(), true);
-  }
-
-  public void setCatalog(String catalog) throws SQLException {
-    meta.connectionSync(handle, new ConnectionPropertiesImpl().setCatalog(catalog));
-  }
-
-  public String getCatalog() {
-    return sync().getCatalog();
-  }
-
-  public void setTransactionIsolation(int level) throws SQLException {
-    meta.connectionSync(handle, new ConnectionPropertiesImpl().setTransactionIsolation(level));
-  }
-
-  public int getTransactionIsolation() throws SQLException {
-    //noinspection MagicConstant
-    return unbox(sync().getTransactionIsolation(), TRANSACTION_NONE);
-  }
-
-  public SQLWarning getWarnings() throws SQLException {
-    return null;
-  }
-
-  public void clearWarnings() throws SQLException {
-    // no-op since connection pooling often calls this.
-  }
-
-  public Statement createStatement(
-      int resultSetType, int resultSetConcurrency) throws SQLException {
-    //noinspection MagicConstant
-    return createStatement(resultSetType, resultSetConcurrency, holdability);
-  }
-
-  public PreparedStatement prepareStatement(
-      String sql,
-      int resultSetType,
-      int resultSetConcurrency) throws SQLException {
-    //noinspection MagicConstant
-    return prepareStatement(
-        sql, resultSetType, resultSetConcurrency, holdability);
-  }
-
-  public CallableStatement prepareCall(
-      String sql,
-      int resultSetType,
-      int resultSetConcurrency) throws SQLException {
-    throw helper.unsupported();
-  }
-
-  public Map<String, Class<?>> getTypeMap() throws SQLException {
-    throw helper.unsupported();
-  }
-
-  public void setTypeMap(Map<String, Class<?>> map) throws SQLException {
-    throw helper.unsupported();
-  }
-
-  public void setHoldability(int holdability) throws SQLException {
-    if (!(holdability == ResultSet.CLOSE_CURSORS_AT_COMMIT
-        || holdability == ResultSet.HOLD_CURSORS_OVER_COMMIT)) {
-      throw new SQLException("invalid value");
-    }
-    this.holdability = holdability;
-  }
-
-  public int getHoldability() throws SQLException {
-    return holdability;
-  }
-
-  public Savepoint setSavepoint() throws SQLException {
-    throw helper.unsupported();
-  }
-
-  public Savepoint setSavepoint(String name) throws SQLException {
-    throw helper.unsupported();
-  }
-
-  public void rollback(Savepoint savepoint) throws SQLException {
-    throw helper.unsupported();
-  }
-
-  public void releaseSavepoint(Savepoint savepoint) throws SQLException {
-    throw helper.unsupported();
-  }
-
-  public AvaticaStatement createStatement(
-      int resultSetType,
-      int resultSetConcurrency,
-      int resultSetHoldability) throws SQLException {
-    return factory.newStatement(this, null, resultSetType, resultSetConcurrency,
-        resultSetHoldability);
-  }
-
-  public PreparedStatement prepareStatement(
-      String sql,
-      int resultSetType,
-      int resultSetConcurrency,
-      int resultSetHoldability) throws SQLException {
-    try {
-      final Meta.StatementHandle h = meta.prepare(handle, sql, -1);
-      return factory.newPreparedStatement(this, h, h.signature, resultSetType,
-          resultSetConcurrency, resultSetHoldability);
-    } catch (RuntimeException e) {
-      throw helper.createException("while preparing SQL: " + sql, e);
-    }
-  }
-
-  public CallableStatement prepareCall(
-      String sql,
-      int resultSetType,
-      int resultSetConcurrency,
-      int resultSetHoldability) throws SQLException {
-    throw helper.unsupported();
-  }
-
-  public PreparedStatement prepareStatement(
-      String sql, int autoGeneratedKeys) throws SQLException {
-    throw helper.unsupported();
-  }
-
-  public PreparedStatement prepareStatement(
-      String sql, int[] columnIndexes) throws SQLException {
-    throw helper.unsupported();
-  }
-
-  public PreparedStatement prepareStatement(
-      String sql, String[] columnNames) throws SQLException {
-    throw helper.unsupported();
-  }
-
-  public Clob createClob() throws SQLException {
-    throw helper.unsupported();
-  }
-
-  public Blob createBlob() throws SQLException {
-    throw helper.unsupported();
-  }
-
-  public NClob createNClob() throws SQLException {
-    throw helper.unsupported();
-  }
-
-  public SQLXML createSQLXML() throws SQLException {
-    throw helper.unsupported();
-  }
-
-  public boolean isValid(int timeout) throws SQLException {
-    throw helper.unsupported();
-  }
-
-  public void setClientInfo(String name, String value)
-      throws SQLClientInfoException {
-    throw helper.clientInfo();
-  }
-
-  public void setClientInfo(Properties properties)
-      throws SQLClientInfoException {
-    throw helper.clientInfo();
-  }
-
-  public String getClientInfo(String name) throws SQLException {
-    throw helper.unsupported();
-  }
-
-  public Properties getClientInfo() throws SQLException {
-    throw helper.unsupported();
-  }
-
-  public Array createArrayOf(String typeName, Object[] elements)
-      throws SQLException {
-    throw helper.unsupported();
-  }
-
-  public Struct createStruct(String typeName, Object[] attributes)
-      throws SQLException {
-    throw helper.unsupported();
-  }
-
-  public void setSchema(String schema) throws SQLException {
-    meta.connectionSync(handle, new ConnectionPropertiesImpl().setSchema(schema));
-  }
-
-  public String getSchema() {
-    return sync().getSchema();
-  }
-
-  public void abort(Executor executor) throws SQLException {
-    throw helper.unsupported();
-  }
-
-  public void setNetworkTimeout(
-      Executor executor, int milliseconds) throws SQLException {
-    this.networkTimeout = milliseconds;
-  }
-
-  public int getNetworkTimeout() throws SQLException {
-    return networkTimeout;
-  }
-
-  public <T> T unwrap(Class<T> iface) throws SQLException {
-    if (iface.isInstance(this)) {
-      return iface.cast(this);
-    }
-    throw helper.createException(
-        "does not implement '" + iface + "'");
-  }
-
-  public boolean isWrapperFor(Class<?> iface) throws SQLException {
-    return iface.isInstance(this);
-  }
-
-  /** Returns the time zone of this connection. Determines the offset applied
-   * when converting datetime values from the database into
-   * {@link java.sql.Timestamp} values. */
-  public TimeZone getTimeZone() {
-    final String timeZoneName = config().timeZone();
-    return timeZoneName == null
-        ? TimeZone.getDefault()
-        : TimeZone.getTimeZone(timeZoneName);
-  }
-
-  /**
-   * Executes a prepared query, closing any previously open result set.
-   *
-   * @param statement     Statement
-   * @param signature     Prepared query
-   * @param firstFrame    First frame of rows, or null if we need to execute
-   * @param state         The state used to create the given result
-   * @param isUpdate      Was the caller context via {@link PreparedStatement#executeUpdate()}.
-   * @return Result set
-   * @throws java.sql.SQLException if a database error occurs
-   */
-  protected ResultSet executeQueryInternal(AvaticaStatement statement,
-      Meta.Signature signature, Meta.Frame firstFrame, QueryState state, boolean isUpdate)
-      throws SQLException {
-    // Close the previous open result set, if there is one.
-    Meta.Frame frame = firstFrame;
-    Meta.Signature signature2 = signature;
-
-    synchronized (statement) {
-      if (statement.openResultSet != null) {
-        final AvaticaResultSet rs = statement.openResultSet;
-        statement.openResultSet = null;
-        try {
-          rs.close();
-        } catch (Exception e) {
-          throw helper.createException(
-              "Error while closing previous result set", e);
-        }
-      }
-
-      try {
-        if (statement.isWrapperFor(AvaticaPreparedStatement.class)) {
-          final AvaticaPreparedStatement pstmt = (AvaticaPreparedStatement) statement;
-          Meta.StatementHandle handle = pstmt.handle;
-          if (isUpdate) {
-            // Make a copy of the StatementHandle, nulling out the Signature.
-            // CALCITE-1086 we don't need to send the Signature to the server
-            // when we're only performing an update. Saves on serialization.
-            handle = new Meta.StatementHandle(handle.connectionId, handle.id, null);
-          }
-          final Meta.ExecuteResult executeResult =
-              meta.execute(handle, pstmt.getParameterValues(),
-                  statement.getFetchSize());
-          final MetaResultSet metaResultSet = executeResult.resultSets.get(0);
-          frame = metaResultSet.firstFrame;
-          statement.updateCount = metaResultSet.updateCount;
-          signature2 = executeResult.resultSets.get(0).signature;
-        }
-      } catch (Exception e) {
-        e.printStackTrace();
-        throw helper.createException(e.getMessage(), e);
-      }
-
-      final TimeZone timeZone = getTimeZone();
-      if (frame == null && signature2 == null && statement.updateCount != -1) {
-        statement.openResultSet = null;
-      } else {
-        // Duplicative SQL, for support non-prepared statements
-        statement.openResultSet =
-            factory.newResultSet(statement, state, signature2, timeZone, frame);
-      }
-    }
-    // Release the monitor before executing, to give another thread the
-    // opportunity to call cancel.
-    try {
-      if (statement.openResultSet != null) {
-        statement.openResultSet.execute();
-        isUpdateCapable(statement);
-      }
-    } catch (Exception e) {
-      throw helper.createException(
-          "exception while executing query: " + e.getMessage(), e);
-    }
-    return statement.openResultSet;
-  }
-
-  /** Executes a batch update using an {@link AvaticaPreparedStatement}.
-   *
-   * @param pstmt The prepared statement.
-   * @return An array of update counts containing one element for each command in the batch.
-   */
-  protected long[] executeBatchUpdateInternal(AvaticaPreparedStatement pstmt) throws SQLException {
-    try {
-      // Get the handle from the statement
-      Meta.StatementHandle handle = pstmt.handle;
-      // Execute it against meta
-      return meta.executeBatch(handle, pstmt.getParameterValueBatch()).updateCounts;
-    } catch (Exception e) {
-      throw helper.createException(e.getMessage(), e);
-    }
-  }
-
-  /** Returns whether a a statement is capable of updates and if so,
-   * and the statement's {@code updateCount} is still -1, proceeds to
-   * get updateCount value from statement's resultSet.
-   *
-   * <p>Handles "ROWCOUNT" object as Number or List
-   *
-   * @param statement Statement
-   * @throws SQLException on error
-   */
-  private void isUpdateCapable(final AvaticaStatement statement)
-      throws SQLException {
-    Meta.Signature signature = statement.getSignature();
-    if (signature == null || signature.statementType == null) {
-      return;
-    }
-    if (signature.statementType.canUpdate() && statement.updateCount == -1) {
-      statement.openResultSet.next();
-      Object obj = statement.openResultSet.getObject(ROWCOUNT_COLUMN_NAME);
-      if (obj instanceof Number) {
-        statement.updateCount = ((Number) obj).intValue();
-      } else if (obj instanceof List) {
-        @SuppressWarnings("unchecked")
-        final List<Number> numbers = (List<Number>) obj;
-        statement.updateCount = numbers.get(0).intValue();
-      } else {
-        throw helper.createException("Not a valid return result.");
-      }
-      statement.openResultSet = null;
-    }
-  }
-
-  protected Meta.ExecuteResult prepareAndExecuteInternal(
-      final AvaticaStatement statement, final String sql, long maxRowCount)
-      throws SQLException, NoSuchStatementException {
-    final Meta.PrepareCallback callback =
-        new Meta.PrepareCallback() {
-          public Object getMonitor() {
-            return statement;
-          }
-
-          public void clear() throws SQLException {
-            if (statement.openResultSet != null) {
-              final AvaticaResultSet rs = statement.openResultSet;
-              statement.openResultSet = null;
-              try {
-                rs.close();
-              } catch (Exception e) {
-                throw helper.createException(
-                    "Error while closing previous result set", e);
-              }
-            }
-          }
-
-          public void assign(Meta.Signature signature, Meta.Frame firstFrame,
-              long updateCount) throws SQLException {
-            statement.setSignature(signature);
-
-            if (updateCount != -1) {
-              statement.updateCount = updateCount;
-            } else {
-              final TimeZone timeZone = getTimeZone();
-              statement.openResultSet = factory.newResultSet(statement, new QueryState(sql),
-                  signature, timeZone, firstFrame);
-            }
-          }
-
-          public void execute() throws SQLException {
-            if (statement.openResultSet != null) {
-              statement.openResultSet.execute();
-              isUpdateCapable(statement);
-            }
-          }
-        };
-    // The old semantics were that maxRowCount was also treated as the maximum number of
-    // elements in the first Frame of results. A value of -1 would also preserve this, but an
-    // explicit (positive) number is easier to follow, IMO.
-    return meta.prepareAndExecute(statement.handle, sql, maxRowCount,
-        AvaticaUtils.toSaturatedInt(maxRowCount), callback);
-  }
-
-  protected ExecuteBatchResult prepareAndUpdateBatch(final AvaticaStatement statement,
-      final List<String> queries) throws NoSuchStatementException, SQLException {
-    return meta.prepareAndExecuteBatch(statement.handle, queries);
-  }
-
-  protected ResultSet createResultSet(Meta.MetaResultSet metaResultSet, QueryState state)
-      throws SQLException {
-    final Meta.StatementHandle h = new Meta.StatementHandle(
-        metaResultSet.connectionId, metaResultSet.statementId, null);
-    final AvaticaStatement statement = lookupStatement(h);
-    // These are all the metadata operations, no updates
-    ResultSet resultSet = executeQueryInternal(statement, metaResultSet.signature.sanitize(),
-        metaResultSet.firstFrame, state, false);
-    if (metaResultSet.ownStatement) {
-      resultSet.getStatement().closeOnCompletion();
-    }
-    return resultSet;
-  }
-
-  /** Creates a statement wrapper around an existing handle. */
-  protected AvaticaStatement lookupStatement(Meta.StatementHandle h)
-      throws SQLException {
-    final AvaticaStatement statement = statementMap.get(h.id);
-    if (statement != null) {
-      return statement;
-    }
-    //noinspection MagicConstant
-    return factory.newStatement(this, Objects.requireNonNull(h),
-        ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, holdability);
-  }
-
-  // do not make public
-  protected static Trojan createTrojan() {
-    return new Trojan();
-  }
-
-  /** Converts a {@link Boolean} to a {@code boolean}, with a default value. */
-  private boolean unbox(Boolean b, boolean defaultValue) {
-    return b == null ? defaultValue : b;
-  }
-
-  /** Converts an {@link Integer} to an {@code int}, with a default value. */
-  private int unbox(Integer i, int defaultValue) {
-    return i == null ? defaultValue : i;
-  }
-
-  private Meta.ConnectionProperties sync() {
-    return meta.connectionSync(handle, new ConnectionPropertiesImpl());
-  }
-
-  /** Returns or creates a slot whose state can be changed to cancel a
-   * statement. Statements will receive the same slot if and only if their id
-   * is the same. */
-  public AtomicBoolean getCancelFlag(Meta.StatementHandle h)
-      throws NoSuchStatementException {
-    AvaticaUtils.upgrade("after dropping JDK 1.7, use Map.computeIfAbsent");
-    synchronized (flagMap) {
-      AtomicBoolean b = flagMap.get(h.id);
-      if (b == null) {
-        b = new AtomicBoolean();
-        flagMap.put(h.id, b);
-      }
-      return b;
-    }
-  }
-
-  /** A way to call package-protected methods. But only a sub-class of
-   * connection can create one. */
-  public static class Trojan {
-    // must be private
-    private Trojan() {
-    }
-
-    /** A means for anyone who has a trojan to call the protected method
-     * {@link org.apache.calcite.avatica.AvaticaResultSet#execute()}.
-     * @throws SQLException if execute fails for some reason. */
-    public ResultSet execute(AvaticaResultSet resultSet) throws SQLException {
-      return resultSet.execute();
-    }
-
-    /** A means for anyone who has a trojan to call the protected method
-     * {@link org.apache.calcite.avatica.AvaticaStatement#getParameterValues()}.
-     */
-    public List<TypedValue> getParameterValues(AvaticaStatement statement) {
-      return statement.getParameterValues();
-    }
-
-    /** A means for anyone who has a trojan to get the protected field
-     * {@link org.apache.calcite.avatica.AvaticaConnection#meta}. */
-    public Meta getMeta(AvaticaConnection connection) {
-      return connection.meta;
-    }
-  }
-
-  /**
-   * A Callable-like interface but without a "throws Exception".
-   *
-   * @param <T> The return type from {@code call}.
-   */
-  public interface CallableWithoutException<T> {
-    T call();
-  }
-
-  /**
-   * Invokes the given "callable", retrying the call when the server responds with an error
-   * denoting that the connection is missing on the server.
-   *
-   * @param callable The function to invoke.
-   * @return The value from the result of the callable.
-   */
-  public <T> T invokeWithRetries(CallableWithoutException<T> callable) {
-    RuntimeException lastException = null;
-    for (int i = 0; i < maxRetriesPerExecute; i++) {
-      try {
-        return callable.call();
-      } catch (AvaticaClientRuntimeException e) {
-        lastException = e;
-        if (ErrorResponse.MISSING_CONNECTION_ERROR_CODE == e.getErrorCode()) {
-          this.openConnection();
-          continue;
-        }
-        throw e;
-      }
-    }
-    if (null != lastException) {
-      throw lastException;
-    } else {
-      // Shouldn't ever happen.
-      throw new IllegalStateException();
-    }
-  }
-
-  public void setKerberosConnection(KerberosConnection kerberosConnection) {
-    this.kerberosConnection = Objects.requireNonNull(kerberosConnection);
-  }
-
-  public KerberosConnection getKerberosConnection() {
-    return this.kerberosConnection;
-  }
-
-  public Service getService() {
-    assert null != service;
-    return service;
-  }
-
-  public void setService(Service service) {
-    this.service = Objects.requireNonNull(service);
-  }
-}
-
-// End AvaticaConnection.java


[39/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AbstractHandler.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AbstractHandler.java b/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AbstractHandler.java
deleted file mode 100644
index c37e063..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AbstractHandler.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import org.apache.calcite.avatica.AvaticaSeverity;
-import org.apache.calcite.avatica.NoSuchConnectionException;
-import org.apache.calcite.avatica.remote.Service.ErrorResponse;
-import org.apache.calcite.avatica.remote.Service.Request;
-import org.apache.calcite.avatica.remote.Service.Response;
-import org.apache.calcite.avatica.remote.Service.RpcMetadataResponse;
-
-import java.io.IOException;
-
-/**
- * Abstract base class for {@link Handler}s to extend to inherit functionality common across
- * serialization strategies.
- *
- * @param <T> The format Requests/Responses are serialized as.
- */
-public abstract class AbstractHandler<T> implements Handler<T> {
-  private static final String NULL_EXCEPTION_MESSAGE = "(null exception message)";
-  protected final Service service;
-  private RpcMetadataResponse metadata = null;
-
-  public AbstractHandler(Service service) {
-    this.service = service;
-  }
-
-  abstract Request decode(T serializedRequest) throws IOException;
-
-  /**
-   * Serialize the given {@link Response} per the concrete {@link Handler} implementation.
-   *
-   * @param response The {@link Response} to serialize.
-   * @return A serialized representation of the {@link Response}.
-   * @throws IOException
-   */
-  abstract T encode(Response response) throws IOException;
-
-  /**
-   * Unwrap Avatica-specific context about a given exception.
-   *
-   * @param e A caught exception throw by Avatica implementation.
-   * @return An {@link ErrorResponse}.
-   */
-  ErrorResponse unwrapException(Exception e) {
-    // By default, we know nothing extra.
-    int errorCode = ErrorResponse.UNKNOWN_ERROR_CODE;
-    String sqlState = ErrorResponse.UNKNOWN_SQL_STATE;
-    AvaticaSeverity severity = AvaticaSeverity.UNKNOWN;
-    String errorMsg = null;
-
-    // Extract the contextual information if we have it. We may not.
-    if (e instanceof AvaticaRuntimeException) {
-      AvaticaRuntimeException rte = (AvaticaRuntimeException) e;
-      errorCode = rte.getErrorCode();
-      sqlState = rte.getSqlState();
-      severity = rte.getSeverity();
-      errorMsg = rte.getErrorMessage();
-    } else if (e instanceof NoSuchConnectionException) {
-      errorCode = ErrorResponse.MISSING_CONNECTION_ERROR_CODE;
-      severity = AvaticaSeverity.ERROR;
-      errorMsg = e.getMessage();
-    } else {
-      // Try to construct a meaningful error message when the server impl doesn't provide one.
-      errorMsg = getCausalChain(e);
-    }
-
-    return new ErrorResponse(e, errorMsg, errorCode, sqlState, severity, metadata);
-  }
-
-  /**
-   * Compute a response for the given request, handling errors generated by that computation.
-   *
-   * @param serializedRequest The caller's request.
-   * @return A {@link Response} with additional context about that response.
-   */
-  public HandlerResponse<T> apply(T serializedRequest) {
-    try {
-      final Service.Request request = decode(serializedRequest);
-      final Service.Response response = request.accept(service);
-      return new HandlerResponse<>(encode(response), HTTP_OK);
-    } catch (Exception e) {
-      return convertToErrorResponse(e);
-    }
-  }
-
-  /**
-   * Attempts to convert an Exception to an ErrorResponse. If there is an issue in serialization,
-   * a RuntimeException is thrown instead (wrapping the original exception if necessary).
-   *
-   * @param e The exception to convert.
-   * @return A HandlerResponse instance.
-   */
-  public HandlerResponse<T> convertToErrorResponse(Exception e) {
-    ErrorResponse errorResp = unwrapException(e);
-
-    try {
-      return new HandlerResponse<>(encode(errorResp), HTTP_INTERNAL_SERVER_ERROR);
-    } catch (IOException e1) {
-      // TODO provide a canned ErrorResponse
-
-      // If we can't serialize the error message, we can't give a meaningful error to caller.
-      // Just try to not unnecessarily create more exceptions.
-      if (e instanceof RuntimeException) {
-        throw (RuntimeException) e;
-      }
-
-      throw new RuntimeException(e);
-    }
-  }
-
-  /**
-   * Constructs a message for the summary of an Exception.
-   *
-   * @param e The Exception to summarize.
-   * @return A summary message for the Exception.
-   */
-  private String getCausalChain(Exception e) {
-    StringBuilder sb = new StringBuilder(16);
-    Throwable curr = e;
-    // Could use Guava, but that would increase dependency set unnecessarily.
-    while (null != curr) {
-      if (sb.length() > 0) {
-        sb.append(" -> ");
-      }
-      String message = curr.getMessage();
-      sb.append(curr.getClass().getSimpleName()).append(": ");
-      sb.append(null == message ? NULL_EXCEPTION_MESSAGE : message);
-      curr = curr.getCause();
-    }
-    if (sb.length() == 0) {
-      // Catch the case where we have no error message.
-      return "Unknown error message";
-    }
-    return sb.toString();
-  }
-
-  @Override public void setRpcMetadata(RpcMetadataResponse metadata) {
-    this.metadata = metadata;
-  }
-}
-
-// End AbstractHandler.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AbstractService.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AbstractService.java b/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AbstractService.java
deleted file mode 100644
index ffaa360..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AbstractService.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import org.apache.calcite.avatica.ColumnMetaData;
-import org.apache.calcite.avatica.Meta;
-
-import java.sql.Types;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * A common base class for {@link Service} implementations that implement
- * modifications made to response objects.
- */
-public abstract class AbstractService implements Service {
-
-  private RpcMetadataResponse rpcMetadata = null;
-
-  /**
-   * Represents the serialization of the data over a transport.
-   */
-  enum SerializationType {
-    JSON,
-    PROTOBUF
-  }
-
-  /**
-   * @return The manner in which the data is serialized.
-   */
-  abstract SerializationType getSerializationType();
-
-  /** Modifies a signature, changing the representation of numeric columns
-   * within it. This deals with the fact that JSON transmits a small long value,
-   * or a float which is a whole number, as an integer. Thus the accessors need
-   * be prepared to accept any numeric type. */
-  Meta.Signature finagle(Meta.Signature signature) {
-    final List<ColumnMetaData> columns = new ArrayList<>();
-    for (ColumnMetaData column : signature.columns) {
-      columns.add(finagle(column));
-    }
-    if (columns.equals(signature.columns)) {
-      return signature;
-    }
-    return new Meta.Signature(columns, signature.sql,
-        signature.parameters, signature.internalParameters,
-        signature.cursorFactory, signature.statementType);
-  }
-
-  ColumnMetaData finagle(ColumnMetaData column) {
-    switch (column.type.rep) {
-    case BYTE:
-    case PRIMITIVE_BYTE:
-    case DOUBLE:
-    case PRIMITIVE_DOUBLE:
-    case FLOAT:
-    case PRIMITIVE_FLOAT:
-    case INTEGER:
-    case PRIMITIVE_INT:
-    case SHORT:
-    case PRIMITIVE_SHORT:
-    case LONG:
-    case PRIMITIVE_LONG:
-      return column.setRep(ColumnMetaData.Rep.NUMBER);
-    default:
-      // continue
-      break;
-    }
-    switch (column.type.id) {
-    case Types.VARBINARY:
-    case Types.BINARY:
-      switch (getSerializationType()) {
-      case JSON:
-        return column.setRep(ColumnMetaData.Rep.STRING);
-      case PROTOBUF:
-        return column;
-      default:
-        throw new IllegalStateException("Unhadled case statement");
-      }
-    case Types.DECIMAL:
-    case Types.NUMERIC:
-      return column.setRep(ColumnMetaData.Rep.NUMBER);
-    default:
-      return column;
-    }
-  }
-
-  PrepareResponse finagle(PrepareResponse response) {
-    final Meta.StatementHandle statement = finagle(response.statement);
-    if (statement == response.statement) {
-      return response;
-    }
-    return new PrepareResponse(statement, rpcMetadata);
-  }
-
-  Meta.StatementHandle finagle(Meta.StatementHandle h) {
-    final Meta.Signature signature = finagle(h.signature);
-    if (signature == h.signature) {
-      return h;
-    }
-    return new Meta.StatementHandle(h.connectionId, h.id, signature);
-  }
-
-  ResultSetResponse finagle(ResultSetResponse r) {
-    if (r.updateCount != -1) {
-      assert r.signature == null;
-      return r;
-    }
-    if (r.signature == null) {
-      return r;
-    }
-    final Meta.Signature signature = finagle(r.signature);
-    if (signature == r.signature) {
-      return r;
-    }
-    return new ResultSetResponse(r.connectionId, r.statementId, r.ownStatement,
-        signature, r.firstFrame, r.updateCount, rpcMetadata);
-  }
-
-  ExecuteResponse finagle(ExecuteResponse r) {
-    if (r.missingStatement) {
-      return r;
-    }
-    final List<ResultSetResponse> results = new ArrayList<>();
-    int changeCount = 0;
-    for (ResultSetResponse result : r.results) {
-      ResultSetResponse result2 = finagle(result);
-      if (result2 != result) {
-        ++changeCount;
-      }
-      results.add(result2);
-    }
-    if (changeCount == 0) {
-      return r;
-    }
-    return new ExecuteResponse(results, r.missingStatement, rpcMetadata);
-  }
-
-  @Override public void setRpcMetadata(RpcMetadataResponse metadata) {
-    // OK if this is null
-    this.rpcMetadata = metadata;
-  }
-}
-
-// End AbstractService.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AuthenticationType.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AuthenticationType.java b/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AuthenticationType.java
deleted file mode 100644
index 2662e14..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AuthenticationType.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-/**
- * An enumeration for support types of authentication for the HttpServer.
- */
-public enum AuthenticationType {
-  NONE,
-  BASIC,
-  DIGEST,
-  SPNEGO;
-}
-
-// End AuthenticationType.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AvaticaCommonsHttpClientImpl.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AvaticaCommonsHttpClientImpl.java b/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AvaticaCommonsHttpClientImpl.java
deleted file mode 100644
index 33872d0..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AvaticaCommonsHttpClientImpl.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import org.apache.http.HttpHost;
-import org.apache.http.NoHttpResponseException;
-import org.apache.http.auth.AuthSchemeProvider;
-import org.apache.http.auth.AuthScope;
-import org.apache.http.auth.UsernamePasswordCredentials;
-import org.apache.http.client.ClientProtocolException;
-import org.apache.http.client.CredentialsProvider;
-import org.apache.http.client.config.AuthSchemes;
-import org.apache.http.client.methods.CloseableHttpResponse;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.client.protocol.HttpClientContext;
-import org.apache.http.config.Lookup;
-import org.apache.http.config.RegistryBuilder;
-import org.apache.http.conn.socket.ConnectionSocketFactory;
-import org.apache.http.conn.socket.PlainConnectionSocketFactory;
-import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
-import org.apache.http.entity.ByteArrayEntity;
-import org.apache.http.entity.ContentType;
-import org.apache.http.impl.auth.BasicSchemeFactory;
-import org.apache.http.impl.auth.DigestSchemeFactory;
-import org.apache.http.impl.client.BasicAuthCache;
-import org.apache.http.impl.client.BasicCredentialsProvider;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.impl.client.HttpClients;
-import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
-import org.apache.http.ssl.SSLContexts;
-import org.apache.http.util.EntityUtils;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.HttpURLConnection;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.Objects;
-
-import javax.net.ssl.SSLContext;
-
-/**
- * A common class to invoke HTTP requests against the Avatica server agnostic of the data being
- * sent and received across the wire.
- */
-public class AvaticaCommonsHttpClientImpl implements AvaticaHttpClient,
-    UsernamePasswordAuthenticateable, TrustStoreConfigurable {
-  private static final Logger LOG = LoggerFactory.getLogger(AvaticaCommonsHttpClientImpl.class);
-
-  // Some basic exposed configurations
-  private static final String MAX_POOLED_CONNECTION_PER_ROUTE_KEY =
-      "avatica.pooled.connections.per.route";
-  private static final String MAX_POOLED_CONNECTION_PER_ROUTE_DEFAULT = "25";
-  private static final String MAX_POOLED_CONNECTIONS_KEY = "avatica.pooled.connections.max";
-  private static final String MAX_POOLED_CONNECTIONS_DEFAULT = "100";
-
-  protected final HttpHost host;
-  protected final URI uri;
-  protected BasicAuthCache authCache;
-  protected CloseableHttpClient client;
-  PoolingHttpClientConnectionManager pool;
-
-  protected UsernamePasswordCredentials credentials = null;
-  protected CredentialsProvider credentialsProvider = null;
-  protected Lookup<AuthSchemeProvider> authRegistry = null;
-
-  protected File truststore = null;
-  protected String truststorePassword = null;
-
-  public AvaticaCommonsHttpClientImpl(URL url) {
-    this.host = new HttpHost(url.getHost(), url.getPort(), url.getProtocol());
-    this.uri = toURI(Objects.requireNonNull(url));
-    initializeClient();
-  }
-
-  private void initializeClient() {
-    SSLConnectionSocketFactory sslFactory = null;
-    if (null != truststore && null != truststorePassword) {
-      try {
-        SSLContext sslcontext = SSLContexts.custom().loadTrustMaterial(
-            truststore, truststorePassword.toCharArray()).build();
-        sslFactory = new SSLConnectionSocketFactory(sslcontext);
-      } catch (Exception e) {
-        throw new RuntimeException(e);
-      }
-    } else {
-      LOG.debug("Not configuring HTTPS because of missing truststore/password");
-    }
-
-    RegistryBuilder<ConnectionSocketFactory> registryBuilder = RegistryBuilder.create();
-    registryBuilder.register("http", PlainConnectionSocketFactory.getSocketFactory());
-    // Only register the SSL factory when provided
-    if (null != sslFactory) {
-      registryBuilder.register("https", sslFactory);
-    }
-    pool = new PoolingHttpClientConnectionManager(registryBuilder.build());
-    // Increase max total connection to 100
-    final String maxCnxns =
-        System.getProperty(MAX_POOLED_CONNECTIONS_KEY,
-            MAX_POOLED_CONNECTIONS_DEFAULT);
-    pool.setMaxTotal(Integer.parseInt(maxCnxns));
-    // Increase default max connection per route to 25
-    final String maxCnxnsPerRoute = System.getProperty(MAX_POOLED_CONNECTION_PER_ROUTE_KEY,
-        MAX_POOLED_CONNECTION_PER_ROUTE_DEFAULT);
-    pool.setDefaultMaxPerRoute(Integer.parseInt(maxCnxnsPerRoute));
-
-    this.authCache = new BasicAuthCache();
-
-    // A single thread-safe HttpClient, pooling connections via the ConnectionManager
-    this.client = HttpClients.custom().setConnectionManager(pool).build();
-  }
-
-  public byte[] send(byte[] request) {
-    while (true) {
-      HttpClientContext context = HttpClientContext.create();
-
-      context.setTargetHost(host);
-
-      // Set the credentials if they were provided.
-      if (null != this.credentials) {
-        context.setCredentialsProvider(credentialsProvider);
-        context.setAuthSchemeRegistry(authRegistry);
-        context.setAuthCache(authCache);
-      }
-
-      ByteArrayEntity entity = new ByteArrayEntity(request, ContentType.APPLICATION_OCTET_STREAM);
-
-      // Create the client with the AuthSchemeRegistry and manager
-      HttpPost post = new HttpPost(uri);
-      post.setEntity(entity);
-
-      try (CloseableHttpResponse response = execute(post, context)) {
-        final int statusCode = response.getStatusLine().getStatusCode();
-        if (HttpURLConnection.HTTP_OK == statusCode
-            || HttpURLConnection.HTTP_INTERNAL_ERROR == statusCode) {
-          return EntityUtils.toByteArray(response.getEntity());
-        } else if (HttpURLConnection.HTTP_UNAVAILABLE == statusCode) {
-          LOG.debug("Failed to connect to server (HTTP/503), retrying");
-          continue;
-        }
-
-        throw new RuntimeException("Failed to execute HTTP Request, got HTTP/" + statusCode);
-      } catch (NoHttpResponseException e) {
-        // This can happen when sitting behind a load balancer and a backend server dies
-        LOG.debug("The server failed to issue an HTTP response, retrying");
-        continue;
-      } catch (RuntimeException e) {
-        throw e;
-      } catch (Exception e) {
-        LOG.debug("Failed to execute HTTP request", e);
-        throw new RuntimeException(e);
-      }
-    }
-  }
-
-  // Visible for testing
-  CloseableHttpResponse execute(HttpPost post, HttpClientContext context)
-      throws IOException, ClientProtocolException {
-    return client.execute(post, context);
-  }
-
-  @Override public void setUsernamePassword(AuthenticationType authType, String username,
-      String password) {
-    this.credentials = new UsernamePasswordCredentials(
-        Objects.requireNonNull(username), Objects.requireNonNull(password));
-
-    this.credentialsProvider = new BasicCredentialsProvider();
-    credentialsProvider.setCredentials(AuthScope.ANY, credentials);
-
-    RegistryBuilder<AuthSchemeProvider> authRegistryBuilder = RegistryBuilder.create();
-    switch (authType) {
-    case BASIC:
-      authRegistryBuilder.register(AuthSchemes.BASIC, new BasicSchemeFactory());
-      break;
-    case DIGEST:
-      authRegistryBuilder.register(AuthSchemes.DIGEST, new DigestSchemeFactory());
-      break;
-    default:
-      throw new IllegalArgumentException("Unsupported authentiation type: " + authType);
-    }
-    this.authRegistry = authRegistryBuilder.build();
-  }
-
-  private static URI toURI(URL url) throws RuntimeException {
-    try {
-      return url.toURI();
-    } catch (URISyntaxException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  @Override public void setTrustStore(File truststore, String password) {
-    this.truststore = Objects.requireNonNull(truststore);
-    if (!truststore.exists() || !truststore.isFile()) {
-      throw new IllegalArgumentException(
-          "Truststore is must be an existing, regular file: " + truststore);
-    }
-    this.truststorePassword = Objects.requireNonNull(password);
-    initializeClient();
-  }
-}
-
-// End AvaticaCommonsHttpClientImpl.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AvaticaCommonsHttpClientSpnegoImpl.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AvaticaCommonsHttpClientSpnegoImpl.java b/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AvaticaCommonsHttpClientSpnegoImpl.java
deleted file mode 100644
index c1ca658..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AvaticaCommonsHttpClientSpnegoImpl.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import org.apache.http.HttpHost;
-import org.apache.http.auth.AuthSchemeProvider;
-import org.apache.http.auth.AuthScope;
-import org.apache.http.auth.Credentials;
-import org.apache.http.auth.KerberosCredentials;
-import org.apache.http.client.config.AuthSchemes;
-import org.apache.http.client.methods.CloseableHttpResponse;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.client.protocol.HttpClientContext;
-import org.apache.http.config.Lookup;
-import org.apache.http.config.RegistryBuilder;
-import org.apache.http.entity.ByteArrayEntity;
-import org.apache.http.entity.ContentType;
-import org.apache.http.impl.auth.SPNegoSchemeFactory;
-import org.apache.http.impl.client.BasicAuthCache;
-import org.apache.http.impl.client.BasicCredentialsProvider;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.impl.client.HttpClients;
-import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
-import org.apache.http.util.EntityUtils;
-
-import org.ietf.jgss.GSSCredential;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.net.HttpURLConnection;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.security.Principal;
-import java.util.Objects;
-
-/**
- * Implementation of an AvaticaHttpClient which uses SPNEGO.
- */
-public class AvaticaCommonsHttpClientSpnegoImpl implements AvaticaHttpClient {
-  private static final Logger LOG = LoggerFactory
-      .getLogger(AvaticaCommonsHttpClientSpnegoImpl.class);
-
-  public static final String CACHED_CONNECTIONS_MAX_KEY = "avatica.http.spnego.max_cached";
-  public static final String CACHED_CONNECTIONS_MAX_DEFAULT = "100";
-  public static final String CACHED_CONNECTIONS_MAX_PER_ROUTE_KEY =
-      "avatica.http.spnego.max_per_route";
-  public static final String CACHED_CONNECTIONS_MAX_PER_ROUTE_DEFAULT = "25";
-
-  private static final boolean USE_CANONICAL_HOSTNAME = true;
-  private static final boolean STRIP_PORT_ON_SERVER_LOOKUP = true;
-
-  final URL url;
-  final HttpHost host;
-  final PoolingHttpClientConnectionManager pool;
-  final Lookup<AuthSchemeProvider> authRegistry;
-  final BasicCredentialsProvider credentialsProvider;
-  final BasicAuthCache authCache;
-  final CloseableHttpClient client;
-
-  /**
-   * Constructs an http client with the expectation that the user is already logged in with their
-   * Kerberos identity via JAAS.
-   *
-   * @param url The URL for the Avatica server
-   */
-  public AvaticaCommonsHttpClientSpnegoImpl(URL url) {
-    this(url, null);
-  }
-
-  /**
-   * Constructs an HTTP client with user specified by the given credentials.
-   *
-   * @param url The URL for the Avatica server
-   * @param credential The GSS credentials
-   */
-  public AvaticaCommonsHttpClientSpnegoImpl(URL url, GSSCredential credential) {
-    this.url = Objects.requireNonNull(url);
-
-    pool = new PoolingHttpClientConnectionManager();
-    // Increase max total connection to 100
-    final String maxCnxns =
-        System.getProperty(CACHED_CONNECTIONS_MAX_KEY, CACHED_CONNECTIONS_MAX_DEFAULT);
-    pool.setMaxTotal(Integer.parseInt(maxCnxns));
-    // Increase default max connection per route to 25
-    final String maxCnxnsPerRoute = System.getProperty(CACHED_CONNECTIONS_MAX_PER_ROUTE_KEY,
-        CACHED_CONNECTIONS_MAX_PER_ROUTE_DEFAULT);
-    pool.setDefaultMaxPerRoute(Integer.parseInt(maxCnxnsPerRoute));
-
-    this.host = new HttpHost(url.getHost(), url.getPort());
-
-    this.authRegistry = RegistryBuilder.<AuthSchemeProvider>create().register(AuthSchemes.SPNEGO,
-        new SPNegoSchemeFactory(STRIP_PORT_ON_SERVER_LOOKUP, USE_CANONICAL_HOSTNAME)).build();
-
-    this.credentialsProvider = new BasicCredentialsProvider();
-    if (null != credential) {
-      // Non-null credential should be used directly with KerberosCredentials.
-      this.credentialsProvider.setCredentials(AuthScope.ANY, new KerberosCredentials(credential));
-    } else {
-      // A null credential implies that the user is logged in via JAAS using the
-      // java.security.auth.login.config system property
-      this.credentialsProvider.setCredentials(AuthScope.ANY, EmptyCredentials.INSTANCE);
-    }
-
-    this.authCache = new BasicAuthCache();
-
-    // A single thread-safe HttpClient, pooling connections via the ConnectionManager
-    this.client = HttpClients.custom()
-        .setDefaultAuthSchemeRegistry(authRegistry)
-        .setConnectionManager(pool).build();
-  }
-
-  @Override public byte[] send(byte[] request) {
-    HttpClientContext context = HttpClientContext.create();
-
-    context.setTargetHost(host);
-    context.setCredentialsProvider(credentialsProvider);
-    context.setAuthSchemeRegistry(authRegistry);
-    context.setAuthCache(authCache);
-
-    ByteArrayEntity entity = new ByteArrayEntity(request, ContentType.APPLICATION_OCTET_STREAM);
-
-    // Create the client with the AuthSchemeRegistry and manager
-    HttpPost post = new HttpPost(toURI(url));
-    post.setEntity(entity);
-
-    try (CloseableHttpResponse response = client.execute(post, context)) {
-      final int statusCode = response.getStatusLine().getStatusCode();
-      if (HttpURLConnection.HTTP_OK == statusCode
-          || HttpURLConnection.HTTP_INTERNAL_ERROR == statusCode) {
-        return EntityUtils.toByteArray(response.getEntity());
-      }
-
-      throw new RuntimeException("Failed to execute HTTP Request, got HTTP/" + statusCode);
-    } catch (RuntimeException e) {
-      throw e;
-    } catch (Exception e) {
-      LOG.debug("Failed to execute HTTP request", e);
-      throw new RuntimeException(e);
-    }
-  }
-
-  private static URI toURI(URL url) throws RuntimeException {
-    try {
-      return url.toURI();
-    } catch (URISyntaxException e) {
-      throw new RuntimeException(e);
-    }
-  }
-
-  /**
-   * A credentials implementation which returns null.
-   */
-  private static class EmptyCredentials implements Credentials {
-    public static final EmptyCredentials INSTANCE = new EmptyCredentials();
-
-    @Override public String getPassword() {
-      return null;
-    }
-    @Override public Principal getUserPrincipal() {
-      return null;
-    }
-  }
-}
-
-// End AvaticaCommonsHttpClientSpnegoImpl.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AvaticaHttpClient.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AvaticaHttpClient.java b/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AvaticaHttpClient.java
deleted file mode 100644
index eac1b74..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AvaticaHttpClient.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-/**
- * An interface which defines how requests are sent to the Avatica server.
- */
-public interface AvaticaHttpClient {
-
-  /**
-   * Sends a serialized request to the Avatica server.
-   *
-   * @param request The serialized request.
-   * @return The serialized response.
-   */
-  byte[] send(byte[] request);
-
-}
-
-// End AvaticaHttpClient.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AvaticaHttpClientFactory.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AvaticaHttpClientFactory.java b/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AvaticaHttpClientFactory.java
deleted file mode 100644
index efb3c49..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AvaticaHttpClientFactory.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import org.apache.calcite.avatica.ConnectionConfig;
-
-import java.net.URL;
-
-/**
- * A factory for constructing {@link AvaticaHttpClient}'s.
- */
-public interface AvaticaHttpClientFactory {
-
-  /**
-   * Construct the appropriate implementation of {@link AvaticaHttpClient}.
-   *
-   * @param url URL that the client is for.
-   * @param config Configuration to use when constructing the implementation.
-   * @return An instance of {@link AvaticaHttpClient}.
-   */
-  AvaticaHttpClient getClient(URL url, ConnectionConfig config, KerberosConnection kerberosUtil);
-
-}
-
-// End AvaticaHttpClientFactory.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AvaticaHttpClientFactoryImpl.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AvaticaHttpClientFactoryImpl.java b/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AvaticaHttpClientFactoryImpl.java
deleted file mode 100644
index 8778c3d..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AvaticaHttpClientFactoryImpl.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import org.apache.calcite.avatica.ConnectionConfig;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.lang.reflect.Constructor;
-import java.net.URL;
-import java.util.Objects;
-
-/**
- * Default implementation of {@link AvaticaHttpClientFactory} which chooses an implementation
- * from a property.
- */
-public class AvaticaHttpClientFactoryImpl implements AvaticaHttpClientFactory {
-  private static final Logger LOG = LoggerFactory.getLogger(AvaticaHttpClientFactoryImpl.class);
-
-  public static final String HTTP_CLIENT_IMPL_DEFAULT =
-      AvaticaCommonsHttpClientImpl.class.getName();
-  public static final String SPNEGO_HTTP_CLIENT_IMPL_DEFAULT =
-      AvaticaCommonsHttpClientSpnegoImpl.class.getName();
-
-  // Public for Type.PLUGIN
-  public static final AvaticaHttpClientFactoryImpl INSTANCE = new AvaticaHttpClientFactoryImpl();
-
-  // Public for Type.PLUGIN
-  public AvaticaHttpClientFactoryImpl() {}
-
-  /**
-   * Returns a singleton instance of {@link AvaticaHttpClientFactoryImpl}.
-   *
-   * @return A singleton instance.
-   */
-  public static AvaticaHttpClientFactoryImpl getInstance() {
-    return INSTANCE;
-  }
-
-  @Override public AvaticaHttpClient getClient(URL url, ConnectionConfig config,
-      KerberosConnection kerberosUtil) {
-    String className = config.httpClientClass();
-    if (null == className) {
-      // Provide an implementation that works with SPNEGO if that's the authentication is use.
-      if ("SPNEGO".equalsIgnoreCase(config.authentication())) {
-        className = SPNEGO_HTTP_CLIENT_IMPL_DEFAULT;
-      } else {
-        className = HTTP_CLIENT_IMPL_DEFAULT;
-      }
-    }
-
-    AvaticaHttpClient client = instantiateClient(className, url);
-    if (null != kerberosUtil) {
-      client = new DoAsAvaticaHttpClient(client, kerberosUtil);
-    }
-
-    if (client instanceof TrustStoreConfigurable) {
-      File truststore = config.truststore();
-      String truststorePassword = config.truststorePassword();
-      if (null != truststore && null != truststorePassword) {
-        ((TrustStoreConfigurable) client).setTrustStore(truststore, truststorePassword);
-      }
-    } else {
-      LOG.debug("{} is not capable of SSL/TLS communication", client.getClass().getName());
-    }
-
-    if (client instanceof UsernamePasswordAuthenticateable) {
-      // Shortcircuit quickly if authentication wasn't provided (implies NONE)
-      final String authString = config.authentication();
-      if (null == authString) {
-        return client;
-      }
-
-      final AuthenticationType authType = AuthenticationType.valueOf(authString);
-      final String username = config.avaticaUser();
-      final String password = config.avaticaPassword();
-
-      // Can't authenticate with NONE or w/o username and password
-      if (isUserPasswordAuth(authType)) {
-        if (null != username && null != password) {
-          ((UsernamePasswordAuthenticateable) client)
-              .setUsernamePassword(authType, username, password);
-        } else {
-          LOG.debug("Username or password was null");
-        }
-      } else {
-        LOG.debug("{} is not capable of username/password authentication.", authType);
-      }
-    }
-
-    return client;
-  }
-
-  private AvaticaHttpClient instantiateClient(String className, URL url) {
-    try {
-      Class<?> clz = Class.forName(className);
-      Constructor<?> constructor = clz.getConstructor(URL.class);
-      Object instance = constructor.newInstance(Objects.requireNonNull(url));
-      return AvaticaHttpClient.class.cast(instance);
-    } catch (Exception e) {
-      throw new RuntimeException("Failed to construct AvaticaHttpClient implementation "
-          + className, e);
-    }
-  }
-
-  private boolean isUserPasswordAuth(AuthenticationType authType) {
-    return AuthenticationType.BASIC == authType || AuthenticationType.DIGEST == authType;
-  }
-}
-
-// End AvaticaHttpClientFactoryImpl.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AvaticaHttpClientImpl.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AvaticaHttpClientImpl.java b/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AvaticaHttpClientImpl.java
deleted file mode 100644
index c100eec..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AvaticaHttpClientImpl.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import org.apache.calcite.avatica.AvaticaUtils;
-
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.HttpURLConnection;
-import java.net.URL;
-
-/**
- * A common class to invoke HTTP requests against the Avatica server agnostic of the data being
- * sent and received across the wire.
- */
-public class AvaticaHttpClientImpl implements AvaticaHttpClient {
-  protected final URL url;
-
-  public AvaticaHttpClientImpl(URL url) {
-    this.url = url;
-  }
-
-  public byte[] send(byte[] request) {
-    // TODO back-off policy?
-    while (true) {
-      try {
-        final HttpURLConnection connection = openConnection();
-        connection.setRequestMethod("POST");
-        connection.setDoInput(true);
-        connection.setDoOutput(true);
-        try (DataOutputStream wr = new DataOutputStream(connection.getOutputStream())) {
-          wr.write(request);
-          wr.flush();
-          wr.close();
-        }
-        final int responseCode = connection.getResponseCode();
-        final InputStream inputStream;
-        if (responseCode == HttpURLConnection.HTTP_UNAVAILABLE) {
-          // Could be sitting behind a load-balancer, try again.
-          continue;
-        } else if (responseCode != HttpURLConnection.HTTP_OK) {
-          inputStream = connection.getErrorStream();
-        } else {
-          inputStream = connection.getInputStream();
-        }
-        return AvaticaUtils.readFullyToBytes(inputStream);
-      } catch (IOException e) {
-        throw new RuntimeException(e);
-      }
-    }
-  }
-
-  HttpURLConnection openConnection() throws IOException {
-    return (HttpURLConnection) url.openConnection();
-  }
-}
-
-// End AvaticaHttpClientImpl.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AvaticaRemoteConnectionConfigImpl.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AvaticaRemoteConnectionConfigImpl.java b/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AvaticaRemoteConnectionConfigImpl.java
deleted file mode 100644
index d5ae9b1..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AvaticaRemoteConnectionConfigImpl.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import org.apache.calcite.avatica.ConnectionConfigImpl;
-
-import java.util.Properties;
-
-/** Implementation of {@link org.apache.calcite.avatica.ConnectionConfig}
- * with extra properties specific to Remote Driver. */
-public class AvaticaRemoteConnectionConfigImpl extends ConnectionConfigImpl {
-  public AvaticaRemoteConnectionConfigImpl(Properties properties) {
-    super(properties);
-  }
-
-  public Service.Factory factory() {
-    return AvaticaRemoteConnectionProperty.FACTORY.wrap(properties)
-        .getPlugin(Service.Factory.class, null);
-  }
-}
-
-// End AvaticaRemoteConnectionConfigImpl.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AvaticaRemoteConnectionProperty.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AvaticaRemoteConnectionProperty.java b/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AvaticaRemoteConnectionProperty.java
deleted file mode 100644
index e965989..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AvaticaRemoteConnectionProperty.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import org.apache.calcite.avatica.ConnectionProperty;
-
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Properties;
-
-import static org.apache.calcite.avatica.ConnectionConfigImpl.PropEnv;
-import static org.apache.calcite.avatica.ConnectionConfigImpl.parse;
-
-/**
- * Enumeration of Avatica remote driver's built-in connection properties.
- */
-public enum AvaticaRemoteConnectionProperty implements ConnectionProperty {
-  /** Factory. */
-  FACTORY("factory", Type.STRING, null);
-
-  private final String camelName;
-  private final Type type;
-  private final Object defaultValue;
-
-  private static final Map<String, AvaticaRemoteConnectionProperty> NAME_TO_PROPS;
-
-  static {
-    NAME_TO_PROPS = new HashMap<>();
-    for (AvaticaRemoteConnectionProperty p
-        : AvaticaRemoteConnectionProperty.values()) {
-      NAME_TO_PROPS.put(p.camelName.toUpperCase(Locale.ROOT), p);
-      NAME_TO_PROPS.put(p.name(), p);
-    }
-  }
-
-  AvaticaRemoteConnectionProperty(String camelName,
-      Type type,
-      Object defaultValue) {
-    this.camelName = camelName;
-    this.type = type;
-    this.defaultValue = defaultValue;
-    assert type.valid(defaultValue, type.defaultValueClass());
-  }
-
-  public String camelName() {
-    return camelName;
-  }
-
-  public Object defaultValue() {
-    return defaultValue;
-  }
-
-  public Type type() {
-    return type;
-  }
-
-  public Class valueClass() {
-    return type.defaultValueClass();
-  }
-
-  public PropEnv wrap(Properties properties) {
-    return new PropEnv(parse(properties, NAME_TO_PROPS), this);
-  }
-
-  public boolean required() {
-    return false;
-  }
-}
-
-// End AvaticaRemoteConnectionProperty.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AvaticaRuntimeException.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AvaticaRuntimeException.java b/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AvaticaRuntimeException.java
deleted file mode 100644
index 2f9a1cd..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/AvaticaRuntimeException.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import org.apache.calcite.avatica.AvaticaSeverity;
-import org.apache.calcite.avatica.remote.Service.ErrorResponse;
-
-import java.util.Objects;
-
-/**
- * A {@link RuntimeException} thrown by Avatica with additional contextual information about
- * what happened to cause the Exception.
- */
-public class AvaticaRuntimeException extends RuntimeException {
-  private static final long serialVersionUID = 1L;
-  private final String errorMessage;
-  private final int errorCode;
-  private final String sqlState;
-  private final AvaticaSeverity severity;
-
-  /**
-   * Constructs an {@code AvaticaRuntimeException} with no additional information.
-   *
-   * <p>It is strongly preferred that the caller invoke
-   * {@link #AvaticaRuntimeException(String, int, String, AvaticaSeverity)}
-   * with proper contextual information.
-   */
-  public AvaticaRuntimeException() {
-    this("No additional context on exception", ErrorResponse.UNKNOWN_ERROR_CODE,
-        ErrorResponse.UNKNOWN_SQL_STATE, AvaticaSeverity.UNKNOWN);
-  }
-
-  /**
-   * Constructs an {@code AvaticaRuntimeException} with the given
-   * contextual information surrounding the error.
-   *
-   * @param errorMessage A human-readable explanation about what happened
-   * @param errorCode Numeric identifier for error
-   * @param sqlState 5-character identifier for error
-   * @param severity Severity
-   */
-  public AvaticaRuntimeException(String errorMessage, int errorCode, String sqlState,
-      AvaticaSeverity severity) {
-    this.errorMessage = Objects.requireNonNull(errorMessage);
-    this.errorCode = errorCode;
-    this.sqlState = Objects.requireNonNull(sqlState);
-    this.severity = Objects.requireNonNull(severity);
-  }
-
-  /**
-   * Returns a human-readable error message.
-   */
-  public String getErrorMessage() {
-    return errorMessage;
-  }
-
-  /**
-   * Returns a numeric code for this error.
-   */
-  public int getErrorCode() {
-    return errorCode;
-  }
-
-  /**
-   * Returns the five-character identifier for this error.
-   */
-  public String getSqlState() {
-    return sqlState;
-  }
-
-  /**
-   * Returns the severity at which this exception is thrown.
-   */
-  public AvaticaSeverity getSeverity() {
-    return severity;
-  }
-
-  @Override public String toString() {
-    StringBuilder sb = new StringBuilder(64);
-    return sb.append("AvaticaRuntimeException: [")
-        .append("Messsage: '").append(errorMessage).append("', ")
-        .append("Error code: '").append(errorCode).append("', ")
-        .append("SQL State: '").append(sqlState).append("', ")
-        .append("Severity: '").append(severity).append("']").toString();
-  }
-}
-
-// End AvaticaRuntimeException.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/remote/DoAsAvaticaHttpClient.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/DoAsAvaticaHttpClient.java b/avatica/core/src/main/java/org/apache/calcite/avatica/remote/DoAsAvaticaHttpClient.java
deleted file mode 100644
index e06760d..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/DoAsAvaticaHttpClient.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import java.security.PrivilegedAction;
-import java.util.Objects;
-
-import javax.security.auth.Subject;
-
-/**
- * HTTP client implementation which invokes the wrapped HTTP client in a doAs with the provided
- * Subject.
- */
-public class DoAsAvaticaHttpClient implements AvaticaHttpClient {
-  private final AvaticaHttpClient wrapped;
-  private final KerberosConnection kerberosUtil;
-
-  public DoAsAvaticaHttpClient(AvaticaHttpClient wrapped, KerberosConnection kerberosUtil) {
-    this.wrapped = Objects.requireNonNull(wrapped);
-    this.kerberosUtil = Objects.requireNonNull(kerberosUtil);
-  }
-
-  @Override public byte[] send(final byte[] request) {
-    return Subject.doAs(kerberosUtil.getSubject(), new PrivilegedAction<byte[]>() {
-      @Override public byte[] run() {
-        return wrapped.send(request);
-      }
-    });
-  }
-}
-
-// End DoAsAvaticaHttpClient.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/remote/Driver.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/Driver.java b/avatica/core/src/main/java/org/apache/calcite/avatica/remote/Driver.java
deleted file mode 100644
index 3f6d4df..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/Driver.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import org.apache.calcite.avatica.AvaticaConnection;
-import org.apache.calcite.avatica.BuiltInConnectionProperty;
-import org.apache.calcite.avatica.ConnectionConfig;
-import org.apache.calcite.avatica.ConnectionProperty;
-import org.apache.calcite.avatica.DriverVersion;
-import org.apache.calcite.avatica.Meta;
-import org.apache.calcite.avatica.UnregisteredDriver;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Locale;
-import java.util.Properties;
-
-/**
- * Avatica Remote JDBC driver.
- */
-public class Driver extends UnregisteredDriver {
-  private static final Logger LOG = LoggerFactory.getLogger(Driver.class);
-
-  public static final String CONNECT_STRING_PREFIX = "jdbc:avatica:remote:";
-
-  static {
-    new Driver().register();
-  }
-
-  public Driver() {
-    super();
-  }
-
-  /**
-   * Defines the method of message serialization used by the Driver
-   */
-  public static enum Serialization {
-    JSON,
-    PROTOBUF;
-  }
-
-  @Override protected String getConnectStringPrefix() {
-    return CONNECT_STRING_PREFIX;
-  }
-
-  protected DriverVersion createDriverVersion() {
-    return DriverVersion.load(
-        Driver.class,
-        "org-apache-calcite-jdbc.properties",
-        "Avatica Remote JDBC Driver",
-        "unknown version",
-        "Avatica",
-        "unknown version");
-  }
-
-  @Override protected Collection<ConnectionProperty> getConnectionProperties() {
-    final List<ConnectionProperty> list = new ArrayList<ConnectionProperty>();
-    Collections.addAll(list, BuiltInConnectionProperty.values());
-    Collections.addAll(list, AvaticaRemoteConnectionProperty.values());
-    return list;
-  }
-
-  @Override public Meta createMeta(AvaticaConnection connection) {
-    final ConnectionConfig config = connection.config();
-
-    // Perform the login and launch the renewal thread if necessary
-    final KerberosConnection kerberosUtil = createKerberosUtility(config);
-    if (null != kerberosUtil) {
-      kerberosUtil.login();
-      connection.setKerberosConnection(kerberosUtil);
-    }
-
-    // Create a single Service and set it on the Connection instance
-    final Service service = createService(connection, config);
-    connection.setService(service);
-    return new RemoteMeta(connection, service);
-  }
-
-  KerberosConnection createKerberosUtility(ConnectionConfig config) {
-    final String principal = config.kerberosPrincipal();
-    if (null != principal) {
-      return new KerberosConnection(principal, config.kerberosKeytab());
-    }
-    return null;
-  }
-
-  /**
-   * Creates a {@link Service} with the given {@link AvaticaConnection} and configuration.
-   *
-   * @param connection The {@link AvaticaConnection} to use.
-   * @param config Configuration properties
-   * @return A Service implementation.
-   */
-  Service createService(AvaticaConnection connection, ConnectionConfig config) {
-    final Service.Factory metaFactory = config.factory();
-    final Service service;
-    if (metaFactory != null) {
-      service = metaFactory.create(connection);
-    } else if (config.url() != null) {
-      final AvaticaHttpClient httpClient = getHttpClient(connection, config);
-      final Serialization serializationType = getSerialization(config);
-
-      LOG.debug("Instantiating {} service", serializationType);
-      switch (serializationType) {
-      case JSON:
-        service = new RemoteService(httpClient);
-        break;
-      case PROTOBUF:
-        service = new RemoteProtobufService(httpClient, new ProtobufTranslationImpl());
-        break;
-      default:
-        throw new IllegalArgumentException("Unhandled serialization type: " + serializationType);
-      }
-    } else {
-      service = new MockJsonService(Collections.<String, String>emptyMap());
-    }
-    return service;
-  }
-
-  /**
-   * Creates the HTTP client that communicates with the Avatica server.
-   *
-   * @param connection The {@link AvaticaConnection}.
-   * @param config The configuration.
-   * @return An {@link AvaticaHttpClient} implementation.
-   */
-  AvaticaHttpClient getHttpClient(AvaticaConnection connection, ConnectionConfig config) {
-    URL url;
-    try {
-      url = new URL(config.url());
-    } catch (MalformedURLException e) {
-      throw new RuntimeException(e);
-    }
-
-    AvaticaHttpClientFactory httpClientFactory = config.httpClientFactory();
-
-    return httpClientFactory.getClient(url, config, connection.getKerberosConnection());
-  }
-
-  @Override public Connection connect(String url, Properties info)
-      throws SQLException {
-    AvaticaConnection conn = (AvaticaConnection) super.connect(url, info);
-    if (conn == null) {
-      // It's not an url for our driver
-      return null;
-    }
-
-    Service service = conn.getService();
-
-    // super.connect(...) should be creating a service and setting it in the AvaticaConnection
-    assert null != service;
-
-    service.apply(
-        new Service.OpenConnectionRequest(conn.id,
-            Service.OpenConnectionRequest.serializeProperties(info)));
-
-    return conn;
-  }
-
-  Serialization getSerialization(ConnectionConfig config) {
-    final String serializationStr = config.serialization();
-    Serialization serializationType = Serialization.JSON;
-    if (null != serializationStr) {
-      try {
-        serializationType =
-            Serialization.valueOf(serializationStr.toUpperCase(Locale.ROOT));
-      } catch (Exception e) {
-        // Log a warning instead of failing harshly? Intentionally no loggers available?
-        throw new RuntimeException(e);
-      }
-    }
-
-    return serializationType;
-  }
-}
-
-// End Driver.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/remote/Handler.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/Handler.java b/avatica/core/src/main/java/org/apache/calcite/avatica/remote/Handler.java
deleted file mode 100644
index 30d026c..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/Handler.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import org.apache.calcite.avatica.remote.Service.RpcMetadataResponse;
-
-import java.util.Objects;
-
-/**
- * API for text request-response calls to an Avatica server.
- *
- * @param <T> The type this handler accepts and returns
- */
-public interface Handler<T> {
-  int HTTP_OK = 200;
-  int HTTP_INTERNAL_SERVER_ERROR = 500;
-  String HANDLER_SERIALIZATION_METRICS_NAME = "Handler.Serialization";
-
-  /**
-   * Struct that encapsulates the context of the result of a request to Avatica.
-   */
-  public class HandlerResponse<T> {
-    private final T response;
-    private final int statusCode;
-
-    public HandlerResponse(T response, int statusCode) {
-      this.response = Objects.requireNonNull(response);
-      this.statusCode = statusCode;
-    }
-
-    public T getResponse() {
-      return response;
-    }
-
-    public int getStatusCode() {
-      return statusCode;
-    }
-
-    @Override public String toString() {
-      return "Response: " + response + ", Status:" + statusCode;
-    }
-  }
-
-  HandlerResponse<T> apply(T request);
-
-  /**
-   * Sets some general server information to return to the client in all responses.
-   *
-   * @param metadata Server-wide information
-   */
-  void setRpcMetadata(RpcMetadataResponse metadata);
-}
-
-// End Handler.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/remote/JsonHandler.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/JsonHandler.java b/avatica/core/src/main/java/org/apache/calcite/avatica/remote/JsonHandler.java
deleted file mode 100644
index fd57078..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/JsonHandler.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import org.apache.calcite.avatica.metrics.MetricsSystem;
-import org.apache.calcite.avatica.metrics.Timer;
-import org.apache.calcite.avatica.metrics.Timer.Context;
-import org.apache.calcite.avatica.remote.Service.Request;
-import org.apache.calcite.avatica.remote.Service.Response;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-import java.io.IOException;
-import java.io.StringWriter;
-
-/**
- * Implementation of {@link org.apache.calcite.avatica.remote.Handler}
- * that decodes JSON requests, sends them to a {@link Service},
- * and encodes the responses into JSON.
- *
- * @see org.apache.calcite.avatica.remote.JsonService
- */
-public class JsonHandler extends AbstractHandler<String> {
-
-  protected static final ObjectMapper MAPPER = JsonService.MAPPER;
-
-  final MetricsSystem metrics;
-  final Timer serializationTimer;
-
-  public JsonHandler(Service service, MetricsSystem metrics) {
-    super(service);
-    this.metrics = metrics;
-    this.serializationTimer = this.metrics.getTimer(
-        MetricsHelper.concat(JsonHandler.class, HANDLER_SERIALIZATION_METRICS_NAME));
-  }
-
-  public HandlerResponse<String> apply(String jsonRequest) {
-    return super.apply(jsonRequest);
-  }
-
-  @Override Request decode(String request) throws IOException {
-    try (final Context ctx = serializationTimer.start()) {
-      return MAPPER.readValue(request, Service.Request.class);
-    }
-  }
-
-  /**
-   * Serializes the provided object as JSON.
-   *
-   * @param response The object to serialize.
-   * @return A JSON string.
-   */
-  @Override String encode(Response response) throws IOException {
-    try (final Context ctx = serializationTimer.start()) {
-      final StringWriter w = new StringWriter();
-      MAPPER.writeValue(w, response);
-      return w.toString();
-    }
-  }
-}
-
-// End JsonHandler.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/remote/JsonService.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/JsonService.java b/avatica/core/src/main/java/org/apache/calcite/avatica/remote/JsonService.java
deleted file mode 100644
index 19c95e7..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/remote/JsonService.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-import java.io.IOException;
-import java.io.StringWriter;
-
-/**
- * Implementation of {@link org.apache.calcite.avatica.remote.Service}
- * that encodes requests and responses as JSON.
- */
-public abstract class JsonService extends AbstractService {
-  public static final ObjectMapper MAPPER;
-  static {
-    MAPPER = new ObjectMapper();
-    MAPPER.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true);
-    MAPPER.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true);
-    MAPPER.configure(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS, true);
-  }
-
-  public JsonService() {
-  }
-
-  /** Derived class should implement this method to transport requests and
-   * responses to and from the peer service. */
-  public abstract String apply(String request);
-
-  @Override SerializationType getSerializationType() {
-    return SerializationType.JSON;
-  }
-
-  //@VisibleForTesting
-  protected static <T> T decode(String response, Class<T> expectedType)
-      throws IOException {
-    Response resp = MAPPER.readValue(response, Response.class);
-    if (resp instanceof ErrorResponse) {
-      throw ((ErrorResponse) resp).toException();
-    } else if (!expectedType.isAssignableFrom(resp.getClass())) {
-      throw new ClassCastException("Cannot cast " + resp.getClass() + " into " + expectedType);
-    }
-
-    return expectedType.cast(resp);
-  }
-
-  //@VisibleForTesting
-  protected static <T> String encode(T request) throws IOException {
-    final StringWriter w = new StringWriter();
-    MAPPER.writeValue(w, request);
-    return w.toString();
-  }
-
-  protected RuntimeException handle(IOException e) {
-    return new RuntimeException(e);
-  }
-
-  public ResultSetResponse apply(CatalogsRequest request) {
-    try {
-      return finagle(decode(apply(encode(request)), ResultSetResponse.class));
-    } catch (IOException e) {
-      throw handle(e);
-    }
-  }
-
-  public ResultSetResponse apply(SchemasRequest request) {
-    try {
-      return finagle(decode(apply(encode(request)), ResultSetResponse.class));
-    } catch (IOException e) {
-      throw handle(e);
-    }
-  }
-
-  public ResultSetResponse apply(TablesRequest request) {
-    try {
-      return finagle(decode(apply(encode(request)), ResultSetResponse.class));
-    } catch (IOException e) {
-      throw handle(e);
-    }
-  }
-
-  public ResultSetResponse apply(TableTypesRequest request) {
-    try {
-      return finagle(decode(apply(encode(request)), ResultSetResponse.class));
-    } catch (IOException e) {
-      throw handle(e);
-    }
-  }
-
-  public ResultSetResponse apply(TypeInfoRequest request) {
-    try {
-      return finagle(decode(apply(encode(request)), ResultSetResponse.class));
-    } catch (IOException e) {
-      throw handle(e);
-    }
-  }
-
-  public ResultSetResponse apply(ColumnsRequest request) {
-    try {
-      return finagle(decode(apply(encode(request)), ResultSetResponse.class));
-    } catch (IOException e) {
-      throw handle(e);
-    }
-  }
-
-  public PrepareResponse apply(PrepareRequest request) {
-    try {
-      return finagle(decode(apply(encode(request)), PrepareResponse.class));
-    } catch (IOException e) {
-      throw handle(e);
-    }
-  }
-
-  public ExecuteResponse apply(PrepareAndExecuteRequest request) {
-    try {
-      return finagle(decode(apply(encode(request)), ExecuteResponse.class));
-    } catch (IOException e) {
-      throw handle(e);
-    }
-  }
-
-  public FetchResponse apply(FetchRequest request) {
-    try {
-      return decode(apply(encode(request)), FetchResponse.class);
-    } catch (IOException e) {
-      throw handle(e);
-    }
-  }
-
-  public ExecuteResponse apply(ExecuteRequest request) {
-    try {
-      return finagle(decode(apply(encode(request)), ExecuteResponse.class));
-    } catch (IOException e) {
-      throw handle(e);
-    }
-  }
-
-  public CreateStatementResponse apply(CreateStatementRequest request) {
-    try {
-      return decode(apply(encode(request)), CreateStatementResponse.class);
-    } catch (IOException e) {
-      throw handle(e);
-    }
-  }
-
-  public CloseStatementResponse apply(CloseStatementRequest request) {
-    try {
-      return decode(apply(encode(request)), CloseStatementResponse.class);
-    } catch (IOException e) {
-      throw handle(e);
-    }
-  }
-
-  public OpenConnectionResponse apply(OpenConnectionRequest request) {
-    try {
-      return decode(apply(encode(request)), OpenConnectionResponse.class);
-    } catch (IOException e) {
-      throw handle(e);
-    }
-  }
-
-  public CloseConnectionResponse apply(CloseConnectionRequest request) {
-    try {
-      return decode(apply(encode(request)), CloseConnectionResponse.class);
-    } catch (IOException e) {
-      throw handle(e);
-    }
-  }
-
-  public ConnectionSyncResponse apply(ConnectionSyncRequest request) {
-    try {
-      return decode(apply(encode(request)), ConnectionSyncResponse.class);
-    } catch (IOException e) {
-      throw handle(e);
-    }
-  }
-
-  public DatabasePropertyResponse apply(DatabasePropertyRequest request) {
-    try {
-      return decode(apply(encode(request)), DatabasePropertyResponse.class);
-    } catch (IOException e) {
-      throw handle(e);
-    }
-  }
-
-  public SyncResultsResponse apply(SyncResultsRequest request) {
-    try {
-      return decode(apply(encode(request)), SyncResultsResponse.class);
-    } catch (IOException e) {
-      throw handle(e);
-    }
-  }
-
-  public CommitResponse apply(CommitRequest request) {
-    try {
-      return decode(apply(encode(request)), CommitResponse.class);
-    } catch (IOException e) {
-      throw handle(e);
-    }
-  }
-
-  public RollbackResponse apply(RollbackRequest request) {
-    try {
-      return decode(apply(encode(request)), RollbackResponse.class);
-    } catch (IOException e) {
-      throw handle(e);
-    }
-  }
-
-  public ExecuteBatchResponse apply(PrepareAndExecuteBatchRequest request) {
-    try {
-      return decode(apply(encode(request)), ExecuteBatchResponse.class);
-    } catch (IOException e) {
-      throw handle(e);
-    }
-  }
-
-  public ExecuteBatchResponse apply(ExecuteBatchRequest request) {
-    try {
-      return decode(apply(encode(request)), ExecuteBatchResponse.class);
-    } catch (IOException e) {
-      throw handle(e);
-    }
-  }
-}
-
-// End JsonService.java


[46/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/DriverVersion.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/DriverVersion.java b/avatica/core/src/main/java/org/apache/calcite/avatica/DriverVersion.java
deleted file mode 100644
index 15c966a..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/DriverVersion.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Properties;
-
-/**
- * Driver version information.
- *
- * <p>Each driver implementation must provide an instance of this class, in
- * order to implement {@link UnregisteredDriver#createDriverVersion()}.</p>
- *
- * <p>There are two typical ways for a driver to instantiate its version
- * information:</p>
- *
- * <ul>
- *
- * <li>A driver might create a subclass in a with a constructor that provides
- * all of the arguments for the base class. The instance is held in a separate
- * file, so that that version information can be generated.</li>
- *
- * <li>A driver might store the version information in a .properties file and
- * load it using {@link #load}.</li>
- *
- * </ul>
- */
-public class DriverVersion {
-  public final int majorVersion;
-  public final int minorVersion;
-  public final String name;
-  public final String versionString;
-  public final String productName;
-  public final String productVersion;
-  public final boolean jdbcCompliant;
-  public final int databaseMajorVersion;
-  public final int databaseMinorVersion;
-
-  /** Creates a DriverVersion. */
-  public DriverVersion(
-      String name,
-      String versionString,
-      String productName,
-      String productVersion,
-      boolean jdbcCompliant,
-      int majorVersion,
-      int minorVersion,
-      int databaseMajorVersion,
-      int databaseMinorVersion) {
-    this.majorVersion = majorVersion;
-    this.minorVersion = minorVersion;
-    this.name = name;
-    this.versionString = versionString;
-    this.productName = productName;
-    this.productVersion = productVersion;
-    this.jdbcCompliant = jdbcCompliant;
-    this.databaseMajorVersion = databaseMajorVersion;
-    this.databaseMinorVersion = databaseMinorVersion;
-  }
-
-  /** Loads a driver version from a properties file, read from the classpath.
-   * The arguments provide defaults if the properties cannot be loaded.
-   *
-   * @param driverClass Class of driver; used to find resource
-   * @param resourceName Name of resource file
-   * @param driverName Fallback name of driver
-   * @param driverVersion Fallback version of driver
-   * @param productName Fallback product name
-   * @param productVersion Fallback product version
-   * @return A populated driver version object, never null
-   */
-  public static DriverVersion load(
-      Class<? extends UnregisteredDriver> driverClass,
-      String resourceName,
-      String driverName,
-      String driverVersion,
-      String productName,
-      String productVersion) {
-    boolean jdbcCompliant = true;
-    int majorVersion = 0;
-    int minorVersion = 0;
-    int databaseMajorVersion = 0;
-    int databaseMinorVersion = 0;
-    try {
-      final InputStream inStream =
-          driverClass.getClassLoader().getResourceAsStream(resourceName);
-      if (inStream != null) {
-        final Properties properties = new Properties();
-        properties.load(inStream);
-        driverName = properties.getProperty("driver.name");
-        driverVersion = properties.getProperty("driver.version");
-        productName = properties.getProperty("product.name");
-        productVersion = properties.getProperty("product.version");
-        jdbcCompliant =
-            Boolean.valueOf(properties.getProperty("jdbc.compliant"));
-        String[] s = driverVersion.replaceAll("-.*$", "").split("\\.");
-        final int major = Integer.valueOf(s[0]);
-        final int minor = Integer.valueOf(s[1]);
-        try {
-          majorVersion =
-              Integer.valueOf(properties.getProperty("driver.version.major"));
-        } catch (NumberFormatException e) {
-          majorVersion = major;
-        }
-        try {
-          minorVersion =
-              Integer.valueOf(properties.getProperty("driver.version.minor"));
-        } catch (NumberFormatException e) {
-          minorVersion = minor;
-        }
-        try {
-          databaseMajorVersion =
-              Integer.valueOf(properties.getProperty("database.version.major"));
-        } catch (NumberFormatException e) {
-          databaseMajorVersion = major;
-        }
-        try {
-          databaseMinorVersion =
-              Integer.valueOf(properties.getProperty("database.version.minor"));
-        } catch (NumberFormatException e) {
-          databaseMinorVersion = minor;
-        }
-      }
-    } catch (IOException e) {
-      e.printStackTrace();
-    }
-    return new DriverVersion(
-        driverName, driverVersion, productName, productVersion,
-        jdbcCompliant, majorVersion, minorVersion, databaseMajorVersion,
-        databaseMinorVersion);
-  }
-}
-
-// End DriverVersion.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/Handler.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/Handler.java b/avatica/core/src/main/java/org/apache/calcite/avatica/Handler.java
deleted file mode 100644
index 831e66d..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/Handler.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import java.sql.SQLException;
-
-/**
- * Called at various points in the JDBC lifecycle.
- *
- * <p>Most drivers will use {@link HandlerImpl}, which provides no-op
- * implementations of all methods. You only need to override methods if you
- * need to achieve special effects.</p>
- */
-public interface Handler {
-  /** Called by container when a connection is being created.
-   *
-   * <p>If the implementation of this method throws, the connection
-   * will not be created.</p>
-   *
-   * @param connection Connection
-   * @throws SQLException on error
-   */
-  void onConnectionInit(AvaticaConnection connection) throws SQLException;
-
-  /** Called by container when a connection is being closed.
-   *
-   * <p>If the implementation of this method throws, the call to
-   * {@link java.sql.Connection#close} that triggered this method will throw an
-   * exception, but the connection will still be marked closed.</p>
-   *
-   * @param connection Connection
-   */
-  void onConnectionClose(AvaticaConnection connection);
-
-  /** Called by container when a statement is being executed.
-   *
-   * <p>If the session would like the statement results stored in a temporary
-   * table, {@code resultSink} is not null.
-   * The provider must call its {@link ResultSink#toBeCompleted}
-   * method at some point during execution (not necessarily before the call to
-   * this method returns).</p>
-   *
-   * @param statement Statement
-   * @param resultSink Place to put result of query. Null if container does not
-   *                   want results stored to a temporary table
-   * @throws RuntimeException on error
-   */
-  void onStatementExecute(
-      AvaticaStatement statement,
-      ResultSink resultSink);
-
-  /** Called by container when a statement is being closed.
-   *
-   * <p>This method is called after marking the statement closed, and after
-   * closing any open {@link java.sql.ResultSet} objects.</p>
-   *
-   * <p>If the implementation of this method throws, the call to
-   * {@link java.sql.Statement#close} that triggered this method will throw an
-   * exception, but the statement will still be marked closed.
-   *
-   * @param statement Statement
-   * @throws RuntimeException on error
-   */
-  void onStatementClose(AvaticaStatement statement);
-
-  /** Handler for temporary tables. */
-  interface ResultSink {
-    /** Registers a temporary table. */
-    void toBeCompleted();
-  }
-}
-
-// End Handler.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/HandlerImpl.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/HandlerImpl.java b/avatica/core/src/main/java/org/apache/calcite/avatica/HandlerImpl.java
deleted file mode 100644
index c2e6c1a..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/HandlerImpl.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import java.sql.SQLException;
-
-/**
- * Implementation of {@link Handler} that does nothing for each callback.
- * It is recommended implementations of {@code Handler} use this as a base
- * class, to ensure forward compatibility.
- */
-public class HandlerImpl implements Handler {
-  public void onConnectionInit(AvaticaConnection connection)
-      throws SQLException {
-    // nothing
-  }
-
-  public void onConnectionClose(AvaticaConnection connection) {
-    // nothing
-  }
-
-  public void onStatementExecute(
-      AvaticaStatement statement,
-      ResultSink resultSink) {
-    // nothing
-  }
-
-  public void onStatementClose(AvaticaStatement statement) {
-    // nothing
-  }
-}
-
-// End HandlerImpl.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/Helper.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/Helper.java b/avatica/core/src/main/java/org/apache/calcite/avatica/Helper.java
deleted file mode 100644
index 27c6056..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/Helper.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import java.sql.SQLClientInfoException;
-import java.sql.SQLException;
-import java.sql.SQLFeatureNotSupportedException;
-
-/**
- * Utility methods, mainly concerning error-handling.
- */
-public class Helper {
-  public static final Helper INSTANCE = new Helper();
-
-  private Helper() {
-  }
-
-  public RuntimeException todo() {
-    return new RuntimeException("todo: implement this method");
-  }
-
-  public RuntimeException wrap(String message, Exception e) {
-    return new RuntimeException(message, e);
-  }
-
-  public SQLException createException(String message, Exception e) {
-    return createException(message, null, e);
-  }
-
-  public SQLException createException(String message, String sql, Exception e) {
-    if (e instanceof AvaticaClientRuntimeException) {
-      // The AvaticaClientRuntimeException contains extra information about what/why
-      // the exception was thrown that we can pass back to the user.
-      AvaticaClientRuntimeException rte = (AvaticaClientRuntimeException) e;
-      String serverAddress = null;
-      if (null != rte.getRpcMetadata()) {
-        serverAddress = rte.getRpcMetadata().serverAddress;
-      }
-      return new AvaticaSqlException(message, rte.getSqlState(), rte.getErrorCode(),
-          rte.getServerExceptions(), serverAddress);
-    }
-    return new SQLException(message, e);
-  }
-
-  public SQLException createException(String message) {
-    return new SQLException(message);
-  }
-
-  public SQLException toSQLException(SQLException exception) {
-    return exception;
-  }
-
-  public SQLException unsupported() {
-    return new SQLFeatureNotSupportedException();
-  }
-
-  public SQLClientInfoException clientInfo() {
-    return new SQLClientInfoException();
-  }
-}
-
-// End Helper.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/InternalProperty.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/InternalProperty.java b/avatica/core/src/main/java/org/apache/calcite/avatica/InternalProperty.java
deleted file mode 100644
index a5a3852..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/InternalProperty.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import org.apache.calcite.avatica.ConnectionProperty.Type;
-import org.apache.calcite.avatica.util.Casing;
-import org.apache.calcite.avatica.util.Quoting;
-
-import java.util.Map;
-
-/**
- * Definitions of properties that drive the behavior of
- * {@link org.apache.calcite.avatica.AvaticaDatabaseMetaData}.
- */
-public enum InternalProperty {
-  /** Whether identifiers are matched case-sensitively. */
-  CASE_SENSITIVE(Type.BOOLEAN, true),
-
-  /** Character that quotes identifiers. */
-  SQL_KEYWORDS(Type.STRING, null),
-
-  /** How identifiers are quoted. */
-  QUOTING(Quoting.class, Quoting.DOUBLE_QUOTE),
-
-  /** How identifiers are stored if they are quoted. */
-  QUOTED_CASING(Casing.class, Casing.UNCHANGED),
-
-  /** How identifiers are stored if they are not quoted. */
-  UNQUOTED_CASING(Casing.class, Casing.TO_UPPER),
-
-  /** How identifiers are stored if they are not quoted. */
-  NULL_SORTING(NullSorting.class, NullSorting.END);
-
-  private final Type type;
-  private final Class enumClass;
-  private final Object defaultValue;
-
-  /** Creates an InternalProperty based on an enum. */
-  <E extends Enum> InternalProperty(Class<E> enumClass, E defaultValue) {
-    this(Type.ENUM, enumClass, defaultValue);
-  }
-
-  /** Creates an InternalProperty based on a non-enum type. */
-  InternalProperty(Type type, Object defaultValue) {
-    this(type, null, defaultValue);
-  }
-
-  private InternalProperty(Type type, Class enumClass, Object defaultValue) {
-    this.type = type;
-    this.enumClass = enumClass;
-    this.defaultValue = defaultValue;
-  }
-
-  private <T> T get_(Map<InternalProperty, Object> map, T defaultValue) {
-    final Object s = map.get(this);
-    if (s != null) {
-      return (T) s;
-    }
-    if (defaultValue != null) {
-      return (T) defaultValue;
-    }
-    throw new RuntimeException("Required property '" + name()
-        + "' not specified");
-  }
-
-  /** Returns the string value of this property, or null if not specified and
-   * no default. */
-  public String getString(Map<InternalProperty, Object> map) {
-    assert type == Type.STRING;
-    return get_(map, (String) defaultValue);
-  }
-
-  /** Returns the boolean value of this property. Throws if not set and no
-   * default. */
-  public boolean getBoolean(Map<InternalProperty, Object> map) {
-    assert type == Type.BOOLEAN;
-    return get_(map, (Boolean) defaultValue);
-  }
-
-  /** Returns the enum value of this property. Throws if not set and no
-   * default. */
-  public <E extends Enum> E getEnum(Map<InternalProperty, Object> map,
-      Class<E> enumClass) {
-    assert type == Type.ENUM;
-    //noinspection unchecked
-    return get_(map, (E) defaultValue);
-  }
-
-  /** Where nulls appear in a sorted relation. */
-  enum NullSorting {
-    START, END, LOW, HIGH,
-  }
-}
-
-// End InternalProperty.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/Meta.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/Meta.java b/avatica/core/src/main/java/org/apache/calcite/avatica/Meta.java
deleted file mode 100644
index 7df9ade..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/Meta.java
+++ /dev/null
@@ -1,1338 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import org.apache.calcite.avatica.proto.Common;
-import org.apache.calcite.avatica.remote.TypedValue;
-import org.apache.calcite.avatica.util.FilteredConstants;
-
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonSubTypes;
-import com.fasterxml.jackson.annotation.JsonTypeInfo;
-import com.google.protobuf.Descriptors.FieldDescriptor;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Properties;
-
-/**
- * Command handler for getting various metadata. Should be implemented by each
- * driver.
- *
- * <p>Also holds other abstract methods that are not related to metadata
- * that each provider must implement. This is not ideal.</p>
- */
-public interface Meta {
-
-  /**
-   * Returns a map of static database properties.
-   *
-   * <p>The provider can omit properties whose value is the same as the
-   * default.
-   */
-  Map<DatabaseProperty, Object> getDatabaseProperties(ConnectionHandle ch);
-
-  /** Per {@link DatabaseMetaData#getTables(String, String, String, String[])}. */
-  MetaResultSet getTables(ConnectionHandle ch,
-      String catalog,
-      Pat schemaPattern,
-      Pat tableNamePattern,
-      List<String> typeList);
-
-  /** Per {@link DatabaseMetaData#getColumns(String, String, String, String)}. */
-  MetaResultSet getColumns(ConnectionHandle ch,
-      String catalog,
-      Pat schemaPattern,
-      Pat tableNamePattern,
-      Pat columnNamePattern);
-
-  MetaResultSet getSchemas(ConnectionHandle ch, String catalog, Pat schemaPattern);
-
-  /** Per {@link DatabaseMetaData#getCatalogs()}. */
-  MetaResultSet getCatalogs(ConnectionHandle ch);
-
-  /** Per {@link DatabaseMetaData#getTableTypes()}. */
-  MetaResultSet getTableTypes(ConnectionHandle ch);
-
-  /** Per {@link DatabaseMetaData#getProcedures(String, String, String)}. */
-  MetaResultSet getProcedures(ConnectionHandle ch,
-      String catalog,
-      Pat schemaPattern,
-      Pat procedureNamePattern);
-
-  /** Per {@link DatabaseMetaData#getProcedureColumns(String, String, String, String)}. */
-  MetaResultSet getProcedureColumns(ConnectionHandle ch,
-      String catalog,
-      Pat schemaPattern,
-      Pat procedureNamePattern,
-      Pat columnNamePattern);
-
-  /** Per {@link DatabaseMetaData#getColumnPrivileges(String, String, String, String)}. */
-  MetaResultSet getColumnPrivileges(ConnectionHandle ch,
-      String catalog,
-      String schema,
-      String table,
-      Pat columnNamePattern);
-
-  /** Per {@link DatabaseMetaData#getTablePrivileges(String, String, String)}. */
-  MetaResultSet getTablePrivileges(ConnectionHandle ch,
-      String catalog,
-      Pat schemaPattern,
-      Pat tableNamePattern);
-
-  /** Per
-   * {@link DatabaseMetaData#getBestRowIdentifier(String, String, String, int, boolean)}. */
-  MetaResultSet getBestRowIdentifier(ConnectionHandle ch,
-      String catalog,
-      String schema,
-      String table,
-      int scope,
-      boolean nullable);
-
-  /** Per {@link DatabaseMetaData#getVersionColumns(String, String, String)}. */
-  MetaResultSet getVersionColumns(ConnectionHandle ch, String catalog, String schema, String table);
-
-  /** Per {@link DatabaseMetaData#getPrimaryKeys(String, String, String)}. */
-  MetaResultSet getPrimaryKeys(ConnectionHandle ch, String catalog, String schema, String table);
-
-  /** Per {@link DatabaseMetaData#getImportedKeys(String, String, String)}. */
-  MetaResultSet getImportedKeys(ConnectionHandle ch, String catalog, String schema, String table);
-
-  /** Per {@link DatabaseMetaData#getExportedKeys(String, String, String)}. */
-  MetaResultSet getExportedKeys(ConnectionHandle ch, String catalog, String schema, String table);
-
-  /** Per
-   * {@link DatabaseMetaData#getCrossReference(String, String, String, String, String, String)}. */
-  MetaResultSet getCrossReference(ConnectionHandle ch,
-      String parentCatalog,
-      String parentSchema,
-      String parentTable,
-      String foreignCatalog,
-      String foreignSchema,
-      String foreignTable);
-
-  /** Per {@link DatabaseMetaData#getTypeInfo()}. */
-  MetaResultSet getTypeInfo(ConnectionHandle ch);
-
-  /** Per {@link DatabaseMetaData#getIndexInfo(String, String, String, boolean, boolean)}. */
-  MetaResultSet getIndexInfo(ConnectionHandle ch, String catalog,
-      String schema,
-      String table,
-      boolean unique,
-      boolean approximate);
-
-  /** Per {@link DatabaseMetaData#getUDTs(String, String, String, int[])}. */
-  MetaResultSet getUDTs(ConnectionHandle ch,
-      String catalog,
-      Pat schemaPattern,
-      Pat typeNamePattern,
-      int[] types);
-
-  /** Per {@link DatabaseMetaData#getSuperTypes(String, String, String)}. */
-  MetaResultSet getSuperTypes(ConnectionHandle ch,
-      String catalog,
-      Pat schemaPattern,
-      Pat typeNamePattern);
-
-  /** Per {@link DatabaseMetaData#getSuperTables(String, String, String)}. */
-  MetaResultSet getSuperTables(ConnectionHandle ch,
-      String catalog,
-      Pat schemaPattern,
-      Pat tableNamePattern);
-
-  /** Per {@link DatabaseMetaData#getAttributes(String, String, String, String)}. */
-  MetaResultSet getAttributes(ConnectionHandle ch,
-      String catalog,
-      Pat schemaPattern,
-      Pat typeNamePattern,
-      Pat attributeNamePattern);
-
-  /** Per {@link DatabaseMetaData#getClientInfoProperties()}. */
-  MetaResultSet getClientInfoProperties(ConnectionHandle ch);
-
-  /** Per {@link DatabaseMetaData#getFunctions(String, String, String)}. */
-  MetaResultSet getFunctions(ConnectionHandle ch,
-      String catalog,
-      Pat schemaPattern,
-      Pat functionNamePattern);
-
-  /** Per {@link DatabaseMetaData#getFunctionColumns(String, String, String, String)}. */
-  MetaResultSet getFunctionColumns(ConnectionHandle ch,
-      String catalog,
-      Pat schemaPattern,
-      Pat functionNamePattern,
-      Pat columnNamePattern);
-
-  /** Per {@link DatabaseMetaData#getPseudoColumns(String, String, String, String)}. */
-  MetaResultSet getPseudoColumns(ConnectionHandle ch,
-      String catalog,
-      Pat schemaPattern,
-      Pat tableNamePattern,
-      Pat columnNamePattern);
-
-  /** Creates an iterable for a result set.
-   *
-   * <p>The default implementation just returns {@code iterable}, which it
-   * requires to be not null; derived classes may instead choose to execute the
-   * relational expression in {@code signature}. */
-  Iterable<Object> createIterable(StatementHandle stmt, QueryState state, Signature signature,
-      List<TypedValue> parameterValues, Frame firstFrame);
-
-  /** Prepares a statement.
-   *
-   * @param ch Connection handle
-   * @param sql SQL query
-   * @param maxRowCount Negative for no limit (different meaning than JDBC)
-   * @return Signature of prepared statement
-   */
-  StatementHandle prepare(ConnectionHandle ch, String sql, long maxRowCount);
-
-  /** Prepares and executes a statement.
-   *
-   * @param h Statement handle
-   * @param sql SQL query
-   * @param maxRowCount Negative for no limit (different meaning than JDBC)
-   * @param callback Callback to lock, clear and assign cursor
-   *
-   * @return Result containing statement ID, and if a query, a result set and
-   *     first frame of data
-   * @deprecated See {@link #prepareAndExecute(StatementHandle, String, long, int, PrepareCallback)}
-   */
-  @Deprecated // to be removed before 2.0
-  ExecuteResult prepareAndExecute(StatementHandle h, String sql,
-      long maxRowCount, PrepareCallback callback) throws NoSuchStatementException;
-
-  /** Prepares and executes a statement.
-   *
-   * @param h Statement handle
-   * @param sql SQL query
-   * @param maxRowCount Maximum number of rows for the entire query. Negative for no limit
-   *    (different meaning than JDBC).
-   * @param maxRowsInFirstFrame Maximum number of rows for the first frame. This value should
-   *    always be less than or equal to {@code maxRowCount} as the number of results are guaranteed
-   *    to be restricted by {@code maxRowCount} and the underlying database.
-   * @param callback Callback to lock, clear and assign cursor
-   *
-   * @return Result containing statement ID, and if a query, a result set and
-   *     first frame of data
-   */
-  ExecuteResult prepareAndExecute(StatementHandle h, String sql,
-      long maxRowCount, int maxRowsInFirstFrame, PrepareCallback callback)
-      throws NoSuchStatementException;
-
-  /** Prepares a statement and then executes a number of SQL commands in one pass.
-   *
-   * @param h Statement handle
-   * @param sqlCommands SQL commands to run
-   * @return An array of update counts containing one element for each command in the batch.
-   */
-  ExecuteBatchResult prepareAndExecuteBatch(StatementHandle h, List<String> sqlCommands)
-      throws NoSuchStatementException;
-
-  /** Executes a collection of bound parameter values on a prepared statement.
-   *
-   * @param h Statement handle
-   * @param parameterValues A collection of list of typed values, one list per batch
-   * @return An array of update counts containing one element for each command in the batch.
-   */
-  ExecuteBatchResult executeBatch(StatementHandle h, List<List<TypedValue>> parameterValues)
-      throws NoSuchStatementException;
-
-  /** Returns a frame of rows.
-   *
-   * <p>The frame describes whether there may be another frame. If there is not
-   * another frame, the current iteration is done when we have finished the
-   * rows in the this frame.
-   *
-   * <p>The default implementation always returns null.
-   *
-   * @param h Statement handle
-   * @param offset Zero-based offset of first row in the requested frame
-   * @param fetchMaxRowCount Maximum number of rows to return; negative means
-   * no limit
-   * @return Frame, or null if there are no more
-   */
-  Frame fetch(StatementHandle h, long offset, int fetchMaxRowCount) throws
-      NoSuchStatementException, MissingResultsException;
-
-  /** Executes a prepared statement.
-   *
-   * @param h Statement handle
-   * @param parameterValues A list of parameter values; may be empty, not null
-   * @param maxRowCount Maximum number of rows to return; negative means
-   * no limit
-   * @return Execute result
-   * @deprecated See {@link #execute(StatementHandle, List, int)}
-   */
-  @Deprecated // to be removed before 2.0
-  ExecuteResult execute(StatementHandle h, List<TypedValue> parameterValues,
-      long maxRowCount) throws NoSuchStatementException;
-
-  /** Executes a prepared statement.
-   *
-   * @param h Statement handle
-   * @param parameterValues A list of parameter values; may be empty, not null
-   * @param maxRowsInFirstFrame Maximum number of rows to return in the Frame.
-   * @return Execute result
-   */
-  ExecuteResult execute(StatementHandle h, List<TypedValue> parameterValues,
-      int maxRowsInFirstFrame) throws NoSuchStatementException;
-
-  /** Called during the creation of a statement to allocate a new handle.
-   *
-   * @param ch Connection handle
-   */
-  StatementHandle createStatement(ConnectionHandle ch);
-
-  /** Closes a statement.
-   *
-   * <p>If the statement handle is not known, or is already closed, does
-   * nothing.
-   *
-   * @param h Statement handle
-   */
-  void closeStatement(StatementHandle h);
-
-  /**
-   * Opens (creates) a connection. The client allocates its own connection ID which the server is
-   * then made aware of through the {@link ConnectionHandle}. The Map {@code info} argument is
-   * analogous to the {@link Properties} typically passed to a "normal" JDBC Driver. Avatica
-   * specific properties should not be included -- only properties for the underlying driver.
-   *
-   * @param ch A ConnectionHandle encapsulates information about the connection to be opened
-   *    as provided by the client.
-   * @param info A Map corresponding to the Properties typically passed to a JDBC Driver.
-   */
-  void openConnection(ConnectionHandle ch, Map<String, String> info);
-
-  /** Closes a connection */
-  void closeConnection(ConnectionHandle ch);
-
-  /**
-   * Re-sets the {@link ResultSet} on a Statement. Not a JDBC method.
-   *
-   * @return True if there are results to fetch after resetting to the given offset. False otherwise
-   */
-  boolean syncResults(StatementHandle sh, QueryState state, long offset)
-      throws NoSuchStatementException;
-
-  /**
-   * Makes all changes since the last commit/rollback permanent. Analogous to
-   * {@link Connection#commit()}.
-   *
-   * @param ch A reference to the real JDBC Connection
-   */
-  void commit(ConnectionHandle ch);
-
-  /**
-   * Undoes all changes since the last commit/rollback. Analogous to
-   * {@link Connection#rollback()};
-   *
-   * @param ch A reference to the real JDBC Connection
-   */
-  void rollback(ConnectionHandle ch);
-
-  /** Synchronizes client and server view of connection properties.
-   *
-   * <p>Note: this interface is considered "experimental" and may undergo further changes as this
-   * functionality is extended to other aspects of state management for
-   * {@link java.sql.Connection}, {@link java.sql.Statement}, and {@link java.sql.ResultSet}.</p>
-   */
-  ConnectionProperties connectionSync(ConnectionHandle ch, ConnectionProperties connProps);
-
-  /** Factory to create instances of {@link Meta}. */
-  interface Factory {
-    Meta create(List<String> args);
-  }
-
-  /** Wrapper to remind API calls that a parameter is a pattern (allows '%' and
-   * '_' wildcards, per the JDBC spec) rather than a string to be matched
-   * exactly. */
-  class Pat {
-    public final String s;
-
-    private Pat(String s) {
-      this.s = s;
-    }
-
-    @Override public String toString() {
-      return "Pat[" + s + "]";
-    }
-
-    @JsonCreator
-    public static Pat of(@JsonProperty("s") String name) {
-      return new Pat(name);
-    }
-  }
-
-  /** Database property.
-   *
-   * <p>Values exist for methods, such as
-   * {@link DatabaseMetaData#getSQLKeywords()}, which always return the same
-   * value at all times and across connections.
-   *
-   * @see #getDatabaseProperties(Meta.ConnectionHandle)
-   */
-  enum DatabaseProperty {
-    /** Database property containing the value of
-     * {@link DatabaseMetaData#getNumericFunctions()}. */
-    GET_NUMERIC_FUNCTIONS(""),
-
-    /** Database property containing the value of
-     * {@link DatabaseMetaData#getStringFunctions()}. */
-    GET_STRING_FUNCTIONS(""),
-
-    /** Database property containing the value of
-     * {@link DatabaseMetaData#getSystemFunctions()}. */
-    GET_SYSTEM_FUNCTIONS(""),
-
-    /** Database property containing the value of
-     * {@link DatabaseMetaData#getTimeDateFunctions()}. */
-    GET_TIME_DATE_FUNCTIONS(""),
-
-    /** Database property containing the value of
-     * {@link DatabaseMetaData#getSQLKeywords()}. */
-    GET_S_Q_L_KEYWORDS(""),
-
-    /** Database property containing the value of
-     * {@link DatabaseMetaData#getDefaultTransactionIsolation()}. */
-    GET_DEFAULT_TRANSACTION_ISOLATION(Connection.TRANSACTION_NONE),
-
-    /** Database property which is the Avatica version */
-    AVATICA_VERSION(FilteredConstants.VERSION),
-
-    /** Database property containing the value of
-     * {@link DatabaseMetaData#getDriverVersion()}. */
-    GET_DRIVER_VERSION(""),
-
-    /** Database property containing the value of
-     * {@link DatabaseMetaData#getDriverMinorVersion()}. */
-    GET_DRIVER_MINOR_VERSION(-1),
-
-    /** Database property containing the value of
-     * {@link DatabaseMetaData#getDriverMajorVersion()}. */
-    GET_DRIVER_MAJOR_VERSION(-1),
-
-    /** Database property containing the value of
-     * {@link DatabaseMetaData#getDriverName()}. */
-    GET_DRIVER_NAME(""),
-
-    /** Database property containing the value of
-     * {@link DatabaseMetaData#getDatabaseMinorVersion()}. */
-    GET_DATABASE_MINOR_VERSION(-1),
-
-    /** Database property containing the value of
-     * {@link DatabaseMetaData#getDatabaseMajorVersion()}. */
-    GET_DATABASE_MAJOR_VERSION(-1),
-
-    /** Database property containing the value of
-     * {@link DatabaseMetaData#getDatabaseProductName()}. */
-    GET_DATABASE_PRODUCT_NAME(""),
-
-    /** Database property containing the value of
-     * {@link DatabaseMetaData#getDatabaseProductVersion()}. */
-    GET_DATABASE_PRODUCT_VERSION("");
-
-    public final Class<?> type;
-    public final Object defaultValue;
-    public final Method method;
-    public final boolean isJdbc;
-
-    <T> DatabaseProperty(T defaultValue) {
-      this.defaultValue = defaultValue;
-      final String methodName = AvaticaUtils.toCamelCase(name());
-      Method localMethod = null;
-      try {
-        localMethod = DatabaseMetaData.class.getMethod(methodName);
-      } catch (NoSuchMethodException e) {
-        // Pass, localMethod stays null.
-      }
-
-      if (null == localMethod) {
-        this.method = null;
-        this.type = null;
-        this.isJdbc = false;
-      } else {
-        this.method = localMethod;
-        this.type = AvaticaUtils.box(method.getReturnType());
-        this.isJdbc = true;
-      }
-
-      // It's either: 1) not a JDBC method, 2) has no default value,
-      // 3) the defaultValue is of the expected type
-      assert !isJdbc || defaultValue == null || defaultValue.getClass() == type;
-    }
-
-    /** Returns a value of this property, using the default value if the map
-     * does not contain an explicit value. */
-    public <T> T getProp(Meta meta, ConnectionHandle ch, Class<T> aClass) {
-      return getProp(meta.getDatabaseProperties(ch), aClass);
-    }
-
-    /** Returns a value of this property, using the default value if the map
-     * does not contain an explicit value. */
-    public <T> T getProp(Map<DatabaseProperty, Object> map, Class<T> aClass) {
-      assert aClass == type;
-      Object v = map.get(this);
-      if (v == null) {
-        v = defaultValue;
-      }
-      return aClass.cast(v);
-    }
-
-    public static DatabaseProperty fromProto(Common.DatabaseProperty proto) {
-      return DatabaseProperty.valueOf(proto.getName());
-    }
-
-    public Common.DatabaseProperty toProto() {
-      return Common.DatabaseProperty.newBuilder().setName(name()).build();
-    }
-  }
-
-  /** Response from execute.
-   *
-   * <p>Typically a query will have a result set and rowCount = -1;
-   * a DML statement will have a rowCount and no result sets.
-   */
-  class ExecuteResult {
-    public final List<MetaResultSet> resultSets;
-
-    public ExecuteResult(List<MetaResultSet> resultSets) {
-      this.resultSets = resultSets;
-    }
-  }
-
-  /**
-   * Response from a collection of SQL commands or parameter values in a single batch.
-   */
-  class ExecuteBatchResult {
-    public final long[] updateCounts;
-
-    public ExecuteBatchResult(long[] updateCounts) {
-      this.updateCounts = Objects.requireNonNull(updateCounts);
-    }
-  }
-
-  /** Meta data from which a result set can be constructed.
-   *
-   * <p>If {@code updateCount} is not -1, the result is just a count. A result
-   * set cannot be constructed. */
-  class MetaResultSet {
-    public final String connectionId;
-    public final int statementId;
-    public final boolean ownStatement;
-    public final Frame firstFrame;
-    public final Signature signature;
-    public final long updateCount;
-
-    @Deprecated // to be removed before 2.0
-    protected MetaResultSet(String connectionId, int statementId,
-        boolean ownStatement, Signature signature, Frame firstFrame,
-        int updateCount) {
-      this(connectionId, statementId, ownStatement, signature, firstFrame,
-          (long) updateCount);
-    }
-
-    protected MetaResultSet(String connectionId, int statementId,
-        boolean ownStatement, Signature signature, Frame firstFrame,
-        long updateCount) {
-      this.signature = signature;
-      this.connectionId = connectionId;
-      this.statementId = statementId;
-      this.ownStatement = ownStatement;
-      this.firstFrame = firstFrame; // may be null even if signature is not null
-      this.updateCount = updateCount;
-    }
-
-    public static MetaResultSet create(String connectionId, int statementId,
-        boolean ownStatement, Signature signature, Frame firstFrame) {
-      return new MetaResultSet(connectionId, statementId, ownStatement,
-          Objects.requireNonNull(signature), firstFrame, -1L);
-    }
-
-    public static MetaResultSet count(String connectionId, int statementId,
-        long updateCount) {
-      assert updateCount >= 0
-          : "Meta.count(" + connectionId + ", " + statementId + ", "
-          + updateCount + ")";
-      return new MetaResultSet(connectionId, statementId, false, null, null,
-          updateCount);
-    }
-  }
-
-  /** Information necessary to convert an {@link Iterable} into a
-   * {@link org.apache.calcite.avatica.util.Cursor}. */
-  final class CursorFactory {
-    private static final FieldDescriptor CLASS_NAME_DESCRIPTOR = Common.CursorFactory.
-        getDescriptor().findFieldByNumber(Common.CursorFactory.CLASS_NAME_FIELD_NUMBER);
-
-    public final Style style;
-    public final Class clazz;
-    @JsonIgnore
-    public final List<Field> fields;
-    public final List<String> fieldNames;
-
-    private CursorFactory(Style style, Class clazz, List<Field> fields,
-        List<String> fieldNames) {
-      assert (fieldNames != null)
-          == (style == Style.RECORD_PROJECTION || style == Style.MAP);
-      assert (fields != null) == (style == Style.RECORD_PROJECTION);
-      this.style = Objects.requireNonNull(style);
-      this.clazz = clazz;
-      this.fields = fields;
-      this.fieldNames = fieldNames;
-    }
-
-    @JsonCreator
-    public static CursorFactory create(@JsonProperty("style") Style style,
-        @JsonProperty("clazz") Class clazz,
-        @JsonProperty("fieldNames") List<String> fieldNames) {
-      switch (style) {
-      case OBJECT:
-        return OBJECT;
-      case ARRAY:
-        return ARRAY;
-      case LIST:
-        return LIST;
-      case RECORD:
-        return record(clazz);
-      case RECORD_PROJECTION:
-        return record(clazz, null, fieldNames);
-      case MAP:
-        return map(fieldNames);
-      default:
-        throw new AssertionError("unknown style: " + style);
-      }
-    }
-
-    public static final CursorFactory OBJECT =
-        new CursorFactory(Style.OBJECT, null, null, null);
-
-    public static final CursorFactory ARRAY =
-        new CursorFactory(Style.ARRAY, null, null, null);
-
-    public static final CursorFactory LIST =
-        new CursorFactory(Style.LIST, null, null, null);
-
-    public static CursorFactory record(Class resultClazz) {
-      return new CursorFactory(Style.RECORD, resultClazz, null, null);
-    }
-
-    public static CursorFactory record(Class resultClass, List<Field> fields,
-        List<String> fieldNames) {
-      if (fields == null) {
-        fields = new ArrayList<>();
-        for (String fieldName : fieldNames) {
-          try {
-            fields.add(resultClass.getField(fieldName));
-          } catch (NoSuchFieldException e) {
-            throw new RuntimeException(e);
-          }
-        }
-      }
-      return new CursorFactory(Style.RECORD_PROJECTION, resultClass, fields,
-          fieldNames);
-    }
-
-    public static CursorFactory map(List<String> fieldNames) {
-      return new CursorFactory(Style.MAP, null, null, fieldNames);
-    }
-
-    public static CursorFactory deduce(List<ColumnMetaData> columns,
-        Class resultClazz) {
-      if (columns.size() == 1) {
-        return OBJECT;
-      }
-      if (resultClazz == null) {
-        return ARRAY;
-      }
-      if (resultClazz.isArray()) {
-        return ARRAY;
-      }
-      if (List.class.isAssignableFrom(resultClazz)) {
-        return LIST;
-      }
-      return record(resultClazz);
-    }
-
-    public Common.CursorFactory toProto() {
-      Common.CursorFactory.Builder builder = Common.CursorFactory.newBuilder();
-
-      if (null != clazz) {
-        builder.setClassName(clazz.getName());
-      }
-      builder.setStyle(style.toProto());
-      if (null != fieldNames) {
-        builder.addAllFieldNames(fieldNames);
-      }
-
-      return builder.build();
-    }
-
-    public static CursorFactory fromProto(Common.CursorFactory proto) {
-      // Reconstruct CursorFactory
-      Class<?> clz = null;
-
-      if (proto.hasField(CLASS_NAME_DESCRIPTOR)) {
-        try {
-          clz = Class.forName(proto.getClassName());
-        } catch (ClassNotFoundException e) {
-          throw new RuntimeException(e);
-        }
-      }
-
-      return CursorFactory.create(Style.fromProto(proto.getStyle()), clz,
-          proto.getFieldNamesList());
-    }
-
-    @Override public int hashCode() {
-      return Objects.hash(clazz, fieldNames, fields, style);
-    }
-
-    @Override public boolean equals(Object o) {
-      return o == this
-          || o instanceof CursorFactory
-          && Objects.equals(clazz, ((CursorFactory) o).clazz)
-          && Objects.equals(fieldNames, ((CursorFactory) o).fieldNames)
-          && Objects.equals(fields, ((CursorFactory) o).fields)
-          && style == ((CursorFactory) o).style;
-    }
-  }
-
-  /** How logical fields are represented in the objects returned by the
-   * iterator. */
-  enum Style {
-    OBJECT,
-    RECORD,
-    RECORD_PROJECTION,
-    ARRAY,
-    LIST,
-    MAP;
-
-    public Common.CursorFactory.Style toProto() {
-      return Common.CursorFactory.Style.valueOf(name());
-    }
-
-    public static Style fromProto(Common.CursorFactory.Style proto) {
-      return Style.valueOf(proto.name());
-    }
-  }
-
-  /** Result of preparing a statement. */
-  public class Signature {
-    private static final FieldDescriptor SQL_DESCRIPTOR = Common.Signature
-        .getDescriptor().findFieldByNumber(Common.Signature.SQL_FIELD_NUMBER);
-    private static final FieldDescriptor CURSOR_FACTORY_DESCRIPTOR = Common.Signature
-        .getDescriptor().findFieldByNumber(Common.Signature.CURSOR_FACTORY_FIELD_NUMBER);
-
-    public final List<ColumnMetaData> columns;
-    public final String sql;
-    public final List<AvaticaParameter> parameters;
-    public final transient Map<String, Object> internalParameters;
-    public final CursorFactory cursorFactory;
-
-    public final Meta.StatementType statementType;
-
-    /** Creates a Signature. */
-    public Signature(List<ColumnMetaData> columns,
-        String sql,
-        List<AvaticaParameter> parameters,
-        Map<String, Object> internalParameters,
-        CursorFactory cursorFactory,
-        Meta.StatementType statementType) {
-      this.columns = columns;
-      this.sql = sql;
-      this.parameters = parameters;
-      this.internalParameters = internalParameters;
-      this.cursorFactory = cursorFactory;
-      this.statementType = statementType;
-    }
-
-    /** Used by Jackson to create a Signature by de-serializing JSON. */
-    @JsonCreator
-    public static Signature create(
-        @JsonProperty("columns") List<ColumnMetaData> columns,
-        @JsonProperty("sql") String sql,
-        @JsonProperty("parameters") List<AvaticaParameter> parameters,
-        @JsonProperty("cursorFactory") CursorFactory cursorFactory,
-        @JsonProperty("statementType") Meta.StatementType statementType) {
-      return new Signature(columns, sql, parameters,
-          Collections.<String, Object>emptyMap(), cursorFactory, statementType);
-    }
-
-    /** Returns a copy of this Signature, substituting given CursorFactory. */
-    public Signature setCursorFactory(CursorFactory cursorFactory) {
-      return new Signature(columns, sql, parameters, internalParameters,
-          cursorFactory, statementType);
-    }
-
-    /** Creates a copy of this Signature with null lists and maps converted to
-     * empty. */
-    public Signature sanitize() {
-      if (columns == null || parameters == null || internalParameters == null
-          || statementType == null) {
-        return new Signature(sanitize(columns), sql, sanitize(parameters),
-            sanitize(internalParameters), cursorFactory,
-            Meta.StatementType.SELECT);
-      }
-      return this;
-    }
-
-    private <E> List<E> sanitize(List<E> list) {
-      return list == null ? Collections.<E>emptyList() : list;
-    }
-
-    private <K, V> Map<K, V> sanitize(Map<K, V> map) {
-      return map == null ? Collections.<K, V>emptyMap() : map;
-    }
-
-    public Common.Signature toProto() {
-      Common.Signature.Builder builder = Common.Signature.newBuilder();
-
-      if (null != sql) {
-        builder.setSql(sql);
-      }
-
-      if (null != cursorFactory) {
-        builder.setCursorFactory(cursorFactory.toProto());
-      }
-
-      if (null != columns) {
-        for (ColumnMetaData column : columns) {
-          builder.addColumns(column.toProto());
-        }
-      }
-
-      if (null != parameters) {
-        for (AvaticaParameter parameter : parameters) {
-          builder.addParameters(parameter.toProto());
-        }
-      }
-
-      return builder.build();
-    }
-
-    public static Signature fromProto(Common.Signature protoSignature) {
-      List<ColumnMetaData> metadata = new ArrayList<>(protoSignature.getColumnsCount());
-      for (Common.ColumnMetaData protoMetadata : protoSignature.getColumnsList()) {
-        metadata.add(ColumnMetaData.fromProto(protoMetadata));
-      }
-
-      List<AvaticaParameter> parameters = new ArrayList<>(protoSignature.getParametersCount());
-      for (Common.AvaticaParameter protoParam : protoSignature.getParametersList()) {
-        parameters.add(AvaticaParameter.fromProto(protoParam));
-      }
-
-      String sql = null;
-      if (protoSignature.hasField(SQL_DESCRIPTOR)) {
-        sql = protoSignature.getSql();
-      }
-
-      CursorFactory cursorFactory = null;
-      if (protoSignature.hasField(CURSOR_FACTORY_DESCRIPTOR)) {
-        cursorFactory = CursorFactory.fromProto(protoSignature.getCursorFactory());
-      }
-      final Meta.StatementType statementType =
-          Meta.StatementType.fromProto(protoSignature.getStatementType());
-
-      return Signature.create(metadata, sql, parameters, cursorFactory, statementType);
-    }
-
-    @Override public int hashCode() {
-      return Objects.hash(columns, cursorFactory, parameters, sql);
-    }
-
-    @Override public boolean equals(Object o) {
-      return o == this
-          || o instanceof Signature
-          && Objects.equals(columns, ((Signature) o).columns)
-          && Objects.equals(cursorFactory, ((Signature) o).cursorFactory)
-          && Objects.equals(parameters, ((Signature) o).parameters)
-          && Objects.equals(sql, ((Signature) o).sql);
-    }
-  }
-
-  /** A collection of rows. */
-  class Frame {
-    private static final FieldDescriptor HAS_ARRAY_VALUE_DESCRIPTOR = Common.ColumnValue
-        .getDescriptor().findFieldByNumber(Common.ColumnValue.HAS_ARRAY_VALUE_FIELD_NUMBER);
-    private static final FieldDescriptor SCALAR_VALUE_DESCRIPTOR = Common.ColumnValue
-        .getDescriptor().findFieldByNumber(Common.ColumnValue.SCALAR_VALUE_FIELD_NUMBER);
-    /** Frame that has zero rows and is the last frame. */
-    public static final Frame EMPTY =
-        new Frame(0, true, Collections.emptyList());
-
-    /** Frame that has zero rows but may have another frame. */
-    public static final Frame MORE =
-        new Frame(0, false, Collections.emptyList());
-
-    /** Zero-based offset of first row. */
-    public final long offset;
-    /** Whether this is definitely the last frame of rows.
-     * If true, there are no more rows.
-     * If false, there may or may not be more rows. */
-    public final boolean done;
-    /** The rows. */
-    public final Iterable<Object> rows;
-
-    public Frame(long offset, boolean done, Iterable<Object> rows) {
-      this.offset = offset;
-      this.done = done;
-      this.rows = rows;
-    }
-
-    @JsonCreator
-    public static Frame create(@JsonProperty("offset") long offset,
-        @JsonProperty("done") boolean done,
-        @JsonProperty("rows") List<Object> rows) {
-      if (offset == 0 && done && rows.isEmpty()) {
-        return EMPTY;
-      }
-      return new Frame(offset, done, rows);
-    }
-
-    public Common.Frame toProto() {
-      Common.Frame.Builder builder = Common.Frame.newBuilder();
-
-      builder.setDone(done).setOffset(offset);
-
-      for (Object row : this.rows) {
-        if (null == row) {
-          // Does this need to be persisted for some reason?
-          continue;
-        }
-
-        if (row instanceof Object[]) {
-          final Common.Row.Builder rowBuilder = Common.Row.newBuilder();
-
-          for (Object element : (Object[]) row) {
-            final Common.ColumnValue.Builder columnBuilder = Common.ColumnValue.newBuilder();
-
-            if (element instanceof List) {
-              columnBuilder.setHasArrayValue(true);
-              List<?> list = (List<?>) element;
-              // Add each element in the list/array to the column's value
-              for (Object listItem : list) {
-                final Common.TypedValue scalarListItem = serializeScalar(listItem);
-                columnBuilder.addArrayValue(scalarListItem);
-                // Add the deprecated 'value' repeated attribute for backwards compat
-                columnBuilder.addValue(scalarListItem);
-              }
-            } else {
-              // The default value, but still explicit.
-              columnBuilder.setHasArrayValue(false);
-              // Only one value for this column, a scalar.
-              final Common.TypedValue scalarVal = serializeScalar(element);
-              columnBuilder.setScalarValue(scalarVal);
-              // Add the deprecated 'value' repeated attribute for backwards compat
-              columnBuilder.addValue(scalarVal);
-            }
-
-            // Add value to row
-            rowBuilder.addValue(columnBuilder.build());
-          }
-
-          // Collect all rows
-          builder.addRows(rowBuilder.build());
-        } else {
-          // Can a "row" be a primitive? A struct? Only an Array?
-          throw new RuntimeException("Only arrays are supported");
-        }
-      }
-
-      return builder.build();
-    }
-
-    static Common.TypedValue serializeScalar(Object element) {
-      final Common.TypedValue.Builder valueBuilder = Common.TypedValue.newBuilder();
-
-      // Let TypedValue handle the serialization for us.
-      TypedValue.toProto(valueBuilder, element);
-
-      return valueBuilder.build();
-    }
-
-    public static Frame fromProto(Common.Frame proto) {
-      List<Object> parsedRows = new ArrayList<>(proto.getRowsCount());
-      for (Common.Row protoRow : proto.getRowsList()) {
-        ArrayList<Object> row = new ArrayList<>(protoRow.getValueCount());
-        for (Common.ColumnValue protoColumn : protoRow.getValueList()) {
-          final Object value;
-          if (!isNewStyleColumn(protoColumn)) {
-            // Backward compatibility
-            value = parseOldStyleColumn(protoColumn);
-          } else {
-            // Current style parsing (separate scalar and array values)
-            value = parseColumn(protoColumn);
-          }
-
-          row.add(value);
-        }
-
-        parsedRows.add(row);
-      }
-
-      return new Frame(proto.getOffset(), proto.getDone(), parsedRows);
-    }
-
-    /**
-     * Determines whether this message contains the new attributes in the
-     * message. We can't directly test for the negative because our
-     * {@code hasField} trick does not work on repeated fields.
-     *
-     * @param column The protobuf column object
-     * @return True if the message is the new style, false otherwise.
-     */
-    static boolean isNewStyleColumn(Common.ColumnValue column) {
-      return column.hasField(HAS_ARRAY_VALUE_DESCRIPTOR)
-          || column.hasField(SCALAR_VALUE_DESCRIPTOR);
-    }
-
-    /**
-     * For Calcite 1.5, we made the mistake of using array length to determine when the value for a
-     * column is a scalar or an array. This method performs the old parsing for backwards
-     * compatibility.
-     *
-     * @param column The protobuf ColumnValue object
-     * @return The parsed value for this column
-     */
-    static Object parseOldStyleColumn(Common.ColumnValue column) {
-      if (column.getValueCount() > 1) {
-        List<Object> array = new ArrayList<>(column.getValueCount());
-        for (Common.TypedValue columnValue : column.getValueList()) {
-          array.add(deserializeScalarValue(columnValue));
-        }
-        return array;
-      } else {
-        return deserializeScalarValue(column.getValue(0));
-      }
-    }
-
-    /**
-     * Parses the value for a ColumnValue using the separated array and scalar attributes.
-     *
-     * @param column The protobuf ColumnValue object
-     * @return The parse value for this column
-     */
-    static Object parseColumn(Common.ColumnValue column) {
-      // Verify that we have one or the other (scalar or array)
-      validateColumnValue(column);
-
-      if (!column.hasField(SCALAR_VALUE_DESCRIPTOR)) {
-        // Array
-        List<Object> array = new ArrayList<>(column.getArrayValueCount());
-        for (Common.TypedValue arrayValue : column.getArrayValueList()) {
-          array.add(deserializeScalarValue(arrayValue));
-        }
-        return array;
-      } else {
-        // Scalar
-        return deserializeScalarValue(column.getScalarValue());
-      }
-    }
-
-    /**
-     * Verifies that a ColumnValue has only a scalar or array value, not both and not neither.
-     *
-     * @param column The protobuf ColumnValue object
-     * @throws IllegalArgumentException When the above condition is not met
-     */
-    static void validateColumnValue(Common.ColumnValue column) {
-      final boolean hasScalar = column.hasField(SCALAR_VALUE_DESCRIPTOR);
-      final boolean hasArrayValue = column.getHasArrayValue();
-
-      // These should always be different
-      if (hasScalar == hasArrayValue) {
-        throw new IllegalArgumentException("A column must have a scalar or array value, not "
-            + (hasScalar ? "both" : "neither"));
-      }
-    }
-
-    static Object deserializeScalarValue(Common.TypedValue protoElement) {
-      // ByteString is a single case where TypedValue is representing the data differently
-      // (in its "local" form) than Frame does. We need to unwrap the Base64 encoding.
-      if (Common.Rep.BYTE_STRING == protoElement.getType()) {
-        // Protobuf is sending native bytes (not b64) across the wire. B64 bytes is only for
-        // TypedValue's benefit
-        return protoElement.getBytesValue().toByteArray();
-      }
-      // Again, let TypedValue deserialize things for us.
-      return TypedValue.fromProto(protoElement).value;
-    }
-
-    @Override public int hashCode() {
-      return Objects.hash(done, offset, rows);
-    }
-
-    @Override public boolean equals(Object o) {
-      return o == this
-          || o instanceof Frame
-          && equalRows(rows, ((Frame) o).rows)
-          && offset == ((Frame) o).offset
-          && done == ((Frame) o).done;
-    }
-
-    private static boolean equalRows(Iterable<Object> rows, Iterable<Object> otherRows) {
-      if (null == rows) {
-        if (null != otherRows) {
-          return false;
-        }
-      } else {
-        Iterator<Object> iter1 = rows.iterator();
-        Iterator<Object> iter2 = otherRows.iterator();
-        while (iter1.hasNext() && iter2.hasNext()) {
-          Object obj1 = iter1.next();
-          Object obj2 = iter2.next();
-
-          // Can't just call equals on an array
-          if (obj1 instanceof Object[]) {
-            if (obj2 instanceof Object[]) {
-              // Compare array and array
-              if (!Arrays.equals((Object[]) obj1, (Object[]) obj2)) {
-                return false;
-              }
-            } else if (obj2 instanceof List) {
-              // compare array and list
-              @SuppressWarnings("unchecked")
-              List<Object> obj2List = (List<Object>) obj2;
-              if (!Arrays.equals((Object[]) obj1, obj2List.toArray())) {
-                return false;
-              }
-            } else {
-              // compare array and something that isn't an array will always fail
-              return false;
-            }
-          } else if (obj1 instanceof List) {
-            if (obj2 instanceof Object[]) {
-              // Compare list and array
-              @SuppressWarnings("unchecked")
-              List<Object> obj1List = (List<Object>) obj1;
-              if (!Arrays.equals(obj1List.toArray(), (Object[]) obj2)) {
-                return false;
-              }
-            } else if (!obj1.equals(obj2)) {
-              // compare list and something else, let it fall to equals()
-              return false;
-            }
-          } else if (!obj1.equals(obj2)) {
-            // Not an array, leave it to equals()
-            return false;
-          }
-        }
-
-        // More elements in one of the iterables
-        if (iter1.hasNext() || iter2.hasNext()) {
-          return false;
-        }
-      }
-
-      return true;
-    }
-  }
-
-  /** Connection handle. */
-  public class ConnectionHandle {
-    public final String id;
-
-    @Override public String toString() {
-      return id;
-    }
-
-    @JsonCreator
-    public ConnectionHandle(@JsonProperty("id") String id) {
-      this.id = id;
-    }
-  }
-
-  /** Statement handle. */
-  // Visible for testing
-  public class StatementHandle {
-    private static final FieldDescriptor SIGNATURE_DESCRIPTOR = Common.StatementHandle
-        .getDescriptor().findFieldByNumber(Common.StatementHandle.SIGNATURE_FIELD_NUMBER);
-    public final String connectionId;
-    public final int id;
-
-    // not final because LocalService#apply(PrepareRequest)
-    /** Only present for PreparedStatement handles, null otherwise. */
-    public Signature signature;
-
-    @Override public String toString() {
-      return connectionId + "::" + Integer.toString(id);
-    }
-
-    @JsonCreator
-    public StatementHandle(
-        @JsonProperty("connectionId") String connectionId,
-        @JsonProperty("id") int id,
-        @JsonProperty("signature") Signature signature) {
-      this.connectionId = connectionId;
-      this.id = id;
-      this.signature = signature;
-    }
-
-    public Common.StatementHandle toProto() {
-      Common.StatementHandle.Builder builder = Common.StatementHandle.newBuilder()
-          .setConnectionId(connectionId).setId(id);
-      if (null != signature) {
-        builder.setSignature(signature.toProto());
-      }
-      return builder.build();
-    }
-
-    public static StatementHandle fromProto(Common.StatementHandle protoHandle) {
-      // Signature is optional in the update path for executes.
-      Signature signature = null;
-      if (protoHandle.hasField(SIGNATURE_DESCRIPTOR)) {
-        signature = Signature.fromProto(protoHandle.getSignature());
-      }
-      return new StatementHandle(protoHandle.getConnectionId(), protoHandle.getId(), signature);
-    }
-
-    @Override public int hashCode() {
-      return Objects.hash(connectionId, id, signature);
-    }
-
-    @Override public boolean equals(Object o) {
-      return o == this
-          || o instanceof StatementHandle
-          && Objects.equals(connectionId, ((StatementHandle) o).connectionId)
-          && Objects.equals(signature, ((StatementHandle) o).signature)
-          && id == ((StatementHandle) o).id;
-    }
-  }
-
-  /** A pojo containing various client-settable {@link java.sql.Connection} properties.
-   *
-   * <p>{@code java.lang} types are used here so that {@code null} can be used to indicate
-   * a value has no been set.</p>
-   *
-   * <p>Note: this interface is considered "experimental" and may undergo further changes as this
-   * functionality is extended to other aspects of state management for
-   * {@link java.sql.Connection}, {@link java.sql.Statement}, and {@link java.sql.ResultSet}.</p>
-   */
-  @JsonTypeInfo(
-      use = JsonTypeInfo.Id.NAME,
-      property = "connProps",
-      defaultImpl = ConnectionPropertiesImpl.class)
-  @JsonSubTypes({
-      @JsonSubTypes.Type(value = ConnectionPropertiesImpl.class, name = "connPropsImpl")
-  })
-  interface ConnectionProperties {
-
-    /** Overwrite fields in {@code this} with any non-null fields in {@code that}
-     *
-     * @return {@code this}
-     */
-    ConnectionProperties merge(ConnectionProperties that);
-
-    /** @return {@code true} when no properies have been set, {@code false} otherwise. */
-    @JsonIgnore
-    boolean isEmpty();
-
-    /** Set {@code autoCommit} status.
-     *
-     * @return {@code this}
-     */
-    ConnectionProperties setAutoCommit(boolean val);
-
-    Boolean isAutoCommit();
-
-    /** Set {@code readOnly} status.
-     *
-     * @return {@code this}
-     */
-    ConnectionProperties setReadOnly(boolean val);
-
-    Boolean isReadOnly();
-
-    /** Set {@code transactionIsolation} status.
-     *
-     * @return {@code this}
-     */
-    ConnectionProperties setTransactionIsolation(int val);
-
-    Integer getTransactionIsolation();
-
-    /** Set {@code catalog}.
-     *
-     * @return {@code this}
-     */
-    ConnectionProperties setCatalog(String val);
-
-    String getCatalog();
-
-    /** Set {@code schema}.
-     *
-     * @return {@code this}
-     */
-    ConnectionProperties setSchema(String val);
-
-    String getSchema();
-
-    Common.ConnectionProperties toProto();
-  }
-
-  /** API to put a result set into a statement, being careful to enforce
-   * thread-safety and not to overwrite existing open result sets. */
-  interface PrepareCallback {
-    Object getMonitor();
-    void clear() throws SQLException;
-    void assign(Signature signature, Frame firstFrame, long updateCount)
-        throws SQLException;
-    void execute() throws SQLException;
-  }
-
-  /** Type of statement. */
-  enum StatementType {
-    SELECT, INSERT, UPDATE, DELETE, UPSERT, MERGE, OTHER_DML, IS_DML,
-    CREATE, DROP, ALTER, OTHER_DDL, CALL;
-
-    public boolean canUpdate() {
-      switch(this) {
-      case INSERT:
-        return true;
-      case IS_DML:
-        return true;
-      default:
-        return false;
-      }
-    }
-
-    public Common.StatementType toProto() {
-      return Common.StatementType.valueOf(name());
-    }
-
-    public static StatementType fromProto(Common.StatementType proto) {
-      return StatementType.valueOf(proto.name());
-    }
-  }
-}
-
-// End Meta.java


[18/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/site/_posts/2016-06-04-release-1.8.0.md
----------------------------------------------------------------------
diff --git a/avatica/site/_posts/2016-06-04-release-1.8.0.md b/avatica/site/_posts/2016-06-04-release-1.8.0.md
deleted file mode 100644
index e891cd0..0000000
--- a/avatica/site/_posts/2016-06-04-release-1.8.0.md
+++ /dev/null
@@ -1,87 +0,0 @@
----
-layout: news_item
-date: "2016-06-04 12:00:00 +0000"
-author: elserj
-version: 1.8.0
-categories: [release]
-tag: v1-8-0
-sha: ddfaf07
----
-<!--
-{% comment %}
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements.  See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License.  You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-{% endcomment %}
--->
-
-Apache Calcite Avatica 1.8.0 continues the focus on compatibility with previous
-versions while also adding support for authentication between Avatica client and server.
-Performance, notably on the write-path, is also major area of improvement
-in this release, increasing as much as two to three times over previous versions
-with the addition of new API support. The documentation for both users and developers
-continues to receive improvements.
-
-Authentication is a major theme of this release, providing multiple layers of
-additional authentication mechanisms over previous versions. In these earlier
-versions, the only authentication provided by Avatica was achieved via the JDBC URL's
-standard user and password options. These have always been passed directly into
-the backend database's authentication system, but not all databases provide username
-and password based authentication systems. [CALCITE-1173](https://issues.apache.org/jira/browse/CALCITE-1173)
-adds Avatica-level authentication over [HTTP Basic](https://en.wikipedia.org/wiki/Basic_access_authentication)
-and [HTTP Digest](https://en.wikipedia.org/wiki/Digest_access_authentication)
-authentication mechanisms. These are provided specifically for the case when
-Avatica is used with a database that _does not already_ provide its own authentication
-implementation.
-
-Some systems rely on [Kerberos](http://web.mit.edu/kerberos/) for strong, centrally-
-managed authentication. [CALCITE-1159](https://issues.apache.org/jira/browse/CALCITE-1159)
-introduces Kerberos-based authentication for clients via [SPNEGO](https://en.wikipedia.org/wiki/SPNEGO).
-The Avatica server can be configured to only allow clients with a valid Kerberos ticket,
-optionally, also passing this information to the backend database to implement
-basic "impersonation" (where the Avatica server issues requests on behalf of the end user).
-
-Building on top of the work done in Avatica-1.7.0 in [CALCITE-1091](https://issues.apache.org/jira/browse/CALCITE-1091),
-this release also contains [CALCITE-1128](https://issues.apache.org/jira/browse/CALCITE-1128) which
-implements the batch-oriented JDBC APIs on `Statement`. Through careful inspection, it
-was observed that the overall performance of Avatica clients in 100% write workloads was
-dominated by the cost of the HTTP calls. By leveraging the `Statement#addBatch()`
-and `Statement#executeBatch()` API calls, clients can efficiently batch multiple updates
-in a single HTTP call. In testing this over the previous single HTTP call per update with
-[Apache Phoenix](https://phoenix.apache.org), it was observed that performance increased by
-two to three times, bringing Avatica's performance on par with the Phoenix "native" driver.
-
-Returning back to compatibility, a new component appears in this release which is designed to
-test versions of Avatica against each other. [CALCITE-1190](https://issues.apache.org/jira/browse/CALCITE-1190)
-introduces a "Technology Compatibility Kit" (TCK) which automates the testing of one version
-of Avatica against other versions. To further ease this testing, a runnable JAR to launch
-an HSQLDB instance and an Avatica server also makes it debut with these changes. This TCK
-makes it much easier to run tests of newer clients against older servers and vice versa.
-Validating the backwards compatibility that is being built is extremely important to be
-confident in the guarantees being provided to users.
-
-Finally, a number of bugs are also fixed in the Protocol Buffer wire API. Some of these
-include [CALCITE-1113](https://issues.apache.org/jira/browse/CALCITE-1113) and
-[CALCITE-1103](https://issues.apache.org/jira/browse/CALCITE-1103) which fix how certain
-numbers are serialized, [CALITE-1243](https://issues.apache.org/jira/browse/CALCITE-1243)
-which corrects some fields in Protocol Buffer messages which were incorrectly marked
-as unsigned integers instead of signed integers, and [CALCITE-1209](https://issues.apache.org/jira/browse/CALCITE-1209)
-which removes incorrect parsing of binary fields as Base64-encoded strings. All of
-these issues are fixed in a backwards-compatible manner and should have no additional negative
-impact on older clients (older clients will not break, but they may continue to return
-incorrect data for certain numbers).
-
-For users of the Avatica driver, a new [client reference page]({{ base_url }}/avatica/docs/client_reference.html)
-is added which details the options that are available in the Avatica JDBC Driver's URL.
-The wire API documentation for Protocol Buffers continues to receive updates as the API continues to evolve.

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/site/_posts/2016-11-01-release-1.9.0.md
----------------------------------------------------------------------
diff --git a/avatica/site/_posts/2016-11-01-release-1.9.0.md b/avatica/site/_posts/2016-11-01-release-1.9.0.md
deleted file mode 100644
index 8809add..0000000
--- a/avatica/site/_posts/2016-11-01-release-1.9.0.md
+++ /dev/null
@@ -1,46 +0,0 @@
----
-layout: news_item
-date: "2016-11-01 07:30:00 +0000"
-author: jhyde
-version: 1.9.0
-categories: [release]
-tag: v1-9-0
-sha: e32d778
----
-<!--
-{% comment %}
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements.  See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License.  You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-{% endcomment %}
--->
-
-Apache Calcite Avatica 1.9.0 includes various improvements to make it
-more robust and secure, while maintaining API and protocol
-compatibility with previous versions.
-
-We now [include non-shaded and shaded artifacts](https://issues.apache.org/jira/browse/CALCITE-1224),
-to make it easier to embed Avatica in your application.
-
-There are improvements to the JDBC API, adding support for
-[canceling statements](https://issues.apache.org/jira/browse/CALCITE-1301),
-and improving
-[type conversions](https://issues.apache.org/jira/browse/CALCITE-1408)
-and
-[metadata](https://issues.apache.org/jira/browse/CALCITE-1410).
-
-The transport is upgraded to use
-[protobuf-3.1.0](https://issues.apache.org/jira/browse/CALCITE-1355)
-(previously 3.0 beta); we have also
-[upgraded Jetty](https://issues.apache.org/jira/browse/CALCITE-1464).

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/site/_sass/_font-awesome.scss
----------------------------------------------------------------------
diff --git a/avatica/site/_sass/_font-awesome.scss b/avatica/site/_sass/_font-awesome.scss
deleted file mode 100644
index d90676c..0000000
--- a/avatica/site/_sass/_font-awesome.scss
+++ /dev/null
@@ -1,25 +0,0 @@
-/*!
- *  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";
-}

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/site/_sass/_gridism.scss
----------------------------------------------------------------------
diff --git a/avatica/site/_sass/_gridism.scss b/avatica/site/_sass/_gridism.scss
deleted file mode 100644
index 40d2163..0000000
--- a/avatica/site/_sass/_gridism.scss
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Gridism
- * A simple, responsive, and handy CSS grid by @cobyism
- * https://github.com/cobyism/gridism
- */
-
-/* Preserve some sanity */
-.grid,
-.unit {
-  -webkit-box-sizing: border-box;
-  -moz-box-sizing: border-box;
-  box-sizing: border-box;
-}
-
-/* Set up some rules to govern the grid */
-.grid {
-  display: block;
-  clear: both;
-}
-.grid .unit {
-  float: left;
-  width: 100%;
-  padding: 10px;
-}
-
-/* This ensures the outer gutters are equal to the (doubled) inner gutters. */
-.grid .unit:first-child { padding-left: 20px; }
-.grid .unit:last-child { padding-right: 20px; }
-
-/* Nested grids already have padding though, so let\u2019s nuke it */
-.unit .unit:first-child { padding-left: 0; }
-.unit .unit:last-child { padding-right: 0; }
-.unit .grid:first-child > .unit { padding-top: 0; }
-.unit .grid:last-child > .unit { padding-bottom: 0; }
-
-/* Let people nuke the gutters/padding completely in a couple of ways */
-.no-gutters .unit,
-.unit.no-gutters {
-  padding: 0 !important;
-}
-
-/* Wrapping at a maximum width is optional */
-.wrap .grid,
-.grid.wrap {
-  max-width: 978px;
-  margin: 0 auto;
-}
-
-/* Width classes also have shorthand versions numbered as fractions
- * For example: for a grid unit 1/3 (one third) of the parent width,
- * simply apply class="w-1-3" to the element. */
-.grid .whole,          .grid .w-1-1 { width: 100%; }
-.grid .half,           .grid .w-1-2 { width: 50%; }
-.grid .one-third,      .grid .w-1-3 { width: 33.3332%; }
-.grid .two-thirds,     .grid .w-2-3 { width: 66.6665%; }
-.grid .one-quarter,
-.grid .one-fourth,     .grid .w-1-4 { width: 25%; }
-.grid .three-quarters,
-.grid .three-fourths,  .grid .w-3-4 { width: 75%; }
-.grid .one-fifth,      .grid .w-1-5 { width: 20%; }
-.grid .two-fifths,     .grid .w-2-5 { width: 40%; }
-.grid .three-fifths,   .grid .w-3-5 { width: 60%; }
-.grid .four-fifths,    .grid .w-4-5 { width: 80%; }
-.grid .golden-small,   .grid .w-g-s { width: 38.2716%; } /* Golden section: smaller piece */
-.grid .golden-large,   .grid .w-g-l { width: 61.7283%; } /* Golden section: larger piece */
-
-/* Clearfix after every .grid */
-.grid {
-  *zoom: 1;
-}
-.grid:before, .grid:after {
-  display: table;
-  content: "";
-  line-height: 0;
-}
-.grid:after {
-  clear: both;
-}
-
-/* Utility classes */
-.align-center { text-align: center; }
-.align-left   { text-align: left; }
-.align-right  { text-align: right; }
-.pull-left    { float: left; }
-.pull-right   { float: right; }
-
-/* A property for a better rendering of images in units: in
-   this way bigger pictures are just resized if the unit
-   becomes smaller */
-.unit img {
-  max-width: 100%;
-}
-
-/* Responsive Stuff */
-@media screen and (max-width: 568px) {
-  /* Stack anything that isn\u2019t full-width on smaller screens
-     and doesn't provide the no-stacking-on-mobiles class */
-  .grid:not(.no-stacking-on-mobiles) > .unit {
-    width: 100% !important;
-    padding-left: 20px;
-    padding-right: 20px;
-  }
-  .unit .grid .unit {
-    padding-left: 0px;
-    padding-right: 0px;
-  }
-
-  /* Sometimes, you just want to be different on small screens */
-  .center-on-mobiles {
-    text-align: center !important;
-  }
-  .hide-on-mobiles {
-    display: none !important;
-  }
-}
-
-/* Expand the wrap a bit further on larger screens */
-@media screen and (min-width: 1180px) {
-  .wider .grid,
-  .grid.wider {
-    max-width: 1180px;
-    margin: 0 auto;
-  }
-}

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/site/_sass/_mixins.scss
----------------------------------------------------------------------
diff --git a/avatica/site/_sass/_mixins.scss b/avatica/site/_sass/_mixins.scss
deleted file mode 100644
index 5b9bb43..0000000
--- a/avatica/site/_sass/_mixins.scss
+++ /dev/null
@@ -1,38 +0,0 @@
-@mixin box-shadow($shadow...) {
-  -webkit-box-shadow: $shadow;
-     -moz-box-shadow: $shadow;
-          box-shadow: $shadow;
-}
-
-@mixin border-radius($radius...) {
-  -webkit-border-radius: $radius;
-     -moz-border-radius: $radius;
-          border-radius: $radius;
-}
-
-@mixin border-top-left-radius($radius...) {
-  -webkit-border-top-left-radius: $radius;
-     -moz-border-radius-topleft:  $radius;
-          border-top-left-radius: $radius;
-}
-
-@mixin border-top-right-radius($radius...) {
-  -webkit-border-top-right-radius: $radius;
-     -moz-border-radius-topright:  $radius;
-          border-top-right-radius: $radius;
-}
-
-@mixin transition($transition...) {
-  -webkit-transition: $transition;
-     -moz-transition: $transition;
-       -o-transition: $transition;
-          transition: $transition;
-}
-
-@mixin user-select($select...) {
-  -webkit-user-select: $select;    /* Chrome all / Safari all */
-     -moz-user-select: $select;    /* Firefox all */
-      -ms-user-select: $select;    /* IE 10+ */
-       -o-user-select: $select;
-          user-select: $select;
-}

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/site/_sass/_normalize.scss
----------------------------------------------------------------------
diff --git a/avatica/site/_sass/_normalize.scss b/avatica/site/_sass/_normalize.scss
deleted file mode 100644
index f6e0b65..0000000
--- a/avatica/site/_sass/_normalize.scss
+++ /dev/null
@@ -1 +0,0 @@
-/*! normalize.css v3.0.2 | MIT License | git.io/normalize */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{
 color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:700}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/site/_sass/_pygments.scss
----------------------------------------------------------------------
diff --git a/avatica/site/_sass/_pygments.scss b/avatica/site/_sass/_pygments.scss
deleted file mode 100644
index 2858bcd..0000000
--- a/avatica/site/_sass/_pygments.scss
+++ /dev/null
@@ -1,78 +0,0 @@
-.highlight {
-  .hll { background-color: #ffffcc }
-  .c { color: #87ceeb} /* Comment */
-  .err { color: #ffffff} /* Error */
-  .g { color: #ffffff} /* Generic */
-  .k { color: #f0e68c} /* Keyword */
-  .l { color: #ffffff} /* Literal */
-  .n { color: #ffffff} /* Name */
-  .o { color: #ffffff} /* Operator */
-  .x { color: #ffffff} /* Other */
-  .p { color: #ffffff} /* Punctuation */
-  .cm { color: #87ceeb} /* Comment.Multiline */
-  .cp { color: #cd5c5c} /* Comment.Preproc */
-  .c1 { color: #87ceeb} /* Comment.Single */
-  .cs { color: #87ceeb} /* Comment.Special */
-  .gd { color: #0000c0; font-weight: bold; background-color: #008080 } /* Generic.Deleted */
-  .ge { color: #c000c0; text-decoration: underline} /* Generic.Emph */
-  .gr { color: #c0c0c0; font-weight: bold; background-color: #c00000 } /* Generic.Error */
-  .gh { color: #cd5c5c} /* Generic.Heading */
-  .gi { color: #ffffff; background-color: #0000c0 } /* Generic.Inserted */
-  span.go { color: #add8e6; font-weight: bold; background-color: #4d4d4d } /* Generic.Output, qualified with span to prevent applying this style to the Go language, see #1153. */
-  .gp { color: #ffffff} /* Generic.Prompt */
-  .gs { color: #ffffff} /* Generic.Strong */
-  .gu { color: #cd5c5c} /* Generic.Subheading */
-  .gt { color: #c0c0c0; font-weight: bold; background-color: #c00000 } /* Generic.Traceback */
-  .kc { color: #f0e68c} /* Keyword.Constant */
-  .kd { color: #f0e68c} /* Keyword.Declaration */
-  .kn { color: #f0e68c} /* Keyword.Namespace */
-  .kp { color: #f0e68c} /* Keyword.Pseudo */
-  .kr { color: #f0e68c} /* Keyword.Reserved */
-  .kt { color: #bdb76b} /* Keyword.Type */
-  .ld { color: #ffffff} /* Literal.Date */
-  .m { color: #ffffff} /* Literal.Number */
-  .s { color: #ffffff} /* Literal.String */
-  .na { color: #ffffff} /* Name.Attribute */
-  .nb { color: #ffffff} /* Name.Builtin */
-  .nc { color: #ffffff} /* Name.Class */
-  .no { color: #ffa0a0} /* Name.Constant */
-  .nd { color: #ffffff} /* Name.Decorator */
-  .ni { color: #ffdead} /* Name.Entity */
-  .ne { color: #ffffff} /* Name.Exception */
-  .nf { color: #ffffff} /* Name.Function */
-  .nl { color: #ffffff} /* Name.Label */
-  .nn { color: #ffffff} /* Name.Namespace */
-  .nx { color: #ffffff} /* Name.Other */
-  .py { color: #ffffff} /* Name.Property */
-  .nt { color: #f0e68c} /* Name.Tag */
-  .nv { color: #98fb98} /* Name.Variable */
-  .ow { color: #ffffff} /* Operator.Word */
-  .w { color: #ffffff} /* Text.Whitespace */
-  .mf { color: #ffffff} /* Literal.Number.Float */
-  .mh { color: #ffffff} /* Literal.Number.Hex */
-  .mi { color: #ffffff} /* Literal.Number.Integer */
-  .mo { color: #ffffff} /* Literal.Number.Oct */
-  .sb { color: #ffffff} /* Literal.String.Backtick */
-  .sc { color: #ffffff} /* Literal.String.Char */
-  .sd { color: #ffffff} /* Literal.String.Doc */
-  .s2 { color: #ffffff} /* Literal.String.Double */
-  .se { color: #ffffff} /* Literal.String.Escape */
-  .sh { color: #ffffff} /* Literal.String.Heredoc */
-  .si { color: #ffffff} /* Literal.String.Interpol */
-  .sx { color: #ffffff} /* Literal.String.Other */
-  .sr { color: #ffffff} /* Literal.String.Regex */
-  .s1 { color: #ffffff} /* Literal.String.Single */
-  .ss { color: #ffffff} /* Literal.String.Symbol */
-  .bp { color: #ffffff} /* Name.Builtin.Pseudo */
-  .vc { color: #98fb98} /* Name.Variable.Class */
-  .vg { color: #98fb98} /* Name.Variable.Global */
-  .vi { color: #98fb98} /* Name.Variable.Instance */
-  .il { color: #ffffff} /* Literal.Number.Integer.Long */
-  .bash .nv {
-    -webkit-user-select: none;
-       -moz-user-select: none;
-        -ms-user-select: none;
-         -o-user-select: none;
-            user-select: none;
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/site/_sass/_style.scss
----------------------------------------------------------------------
diff --git a/avatica/site/_sass/_style.scss b/avatica/site/_sass/_style.scss
deleted file mode 100644
index b433050..0000000
--- a/avatica/site/_sass/_style.scss
+++ /dev/null
@@ -1,989 +0,0 @@
-/* Base */
-
-* {
-  -webkit-box-sizing: border-box;
-  -moz-box-sizing: border-box;
-  box-sizing: border-box;
-}
-
-body {
-  font: 300 21px Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif;
-  color: #ddd;
-  background-color: #333;
-  border-top: 5px solid #937cb0;
-  @include box-shadow(inset 0 3px 30px rgba(0,0,0,.3));
-  text-shadow: 0 1px 3px rgba(0,0,0,.5);
-  -webkit-font-feature-settings: "kern" 1;
-  -moz-font-feature-settings: "kern" 1;
-  -o-font-feature-settings: "kern" 1;
-  font-feature-settings: "kern" 1;
-  font-kerning: normal;
-}
-
-.clear {
-  display: block;
-}
-
-.clear:after {
-  content: " ";
-  display: block;
-  height: 0;
-  clear: both;
-  visibility: hidden;
-}
-
-/* Sections */
-
-header,
-section,
-footer {
-  float: left;
-  width: 100%;
-  clear: both;
-}
-
-/* Header */
-
-header {
-
-  h1,
-  nav { display: inline-block; }
-
-}
-
-nav {
-
-  ul {
-    padding: 0;
-    margin: 0;
-  }
-
-  li { display: inline-block; }
-}
-
-.main-nav {
-  margin-top: 52px;
-
-  li {
-    margin-right: 10px;
-
-    a {
-      @include border-radius(5px);
-      font-weight: 900;
-      font-size: 14px;
-      padding: 0.5em 1em;
-      text-shadow: none;
-      text-transform: uppercase;
-      @include transition(all .25s);
-
-      &:hover {
-        background-color: #252525;
-        @include box-shadow(inset 0 1px 3px rgba(0,0,0,.5), 0 1px 0 rgba(255,255,255,.1));
-        text-shadow: 0 1px 3px rgba(0,0,0,.5);
-      }
-    }
-
-    &.current {
-
-      a {
-        background-color: #937cb0;
-        color: #222;
-        @include box-shadow(inset 0 1px 0 rgba(255,255,255,.5), 0 1px 5px rgba(0,0,0,.5));
-        text-shadow: 0 1px 0 rgba(255,255,255,.3);
-      }
-    }
-  }
-}
-
-.mobile-nav {
-
-  ul {
-    overflow: hidden;
-    width: 100%;
-    display: table;
-  }
-
-  a {
-    float: left;
-    width: 100%;
-    background-color: #333;
-    color: #937cb0;
-    text-align: center;
-    text-transform: uppercase;
-    font-size: 14px;
-    font-weight: 900;
-    padding: 5px;
-    @include border-radius(5px);
-  }
-
-  li {
-    display: table-cell;
-    width: 20%;
-    padding: 8px 2px;
-  }
-
-  .current {
-
-    a {
-      background-color: #937cb0;
-      color: #222;
-      @include box-shadow(inset 0 1px 0 rgba(255,255,255,.5), 0 1px 5px rgba(0,0,0,.5));
-      text-shadow: 0 1px 0 rgba(255,255,255,.3);
-    }
-  }
-}
-
-/*
- * This code is courtesy Ben Balter, modified by Parker Moore.
- * http://ben.balter.com/2014/03/13/pages-anchor-links/
- */
-.header-link {
-  position: relative;
-  left: 0.5em;
-  opacity: 0;
-  font-size: 0.8em;
-  @include transition(opacity 0.2s ease-in-out 0.1s);
-}
-h2:hover .header-link,
-h3:hover .header-link,
-h4:hover .header-link,
-h5:hover .header-link,
-h6:hover .header-link {
-  opacity: 1;
-}
-
-@media (max-width: 768px) {
-  .main-nav ul {
-    text-align: right;
-  }
-}
-@media (max-width: 830px) {
-  .main-nav {
-    .show-on-mobiles { display: inline; }
-    .hide-on-mobiles { display: none; }
-  }
-}
-
-/* Footer */
-
-footer {
-  background-color: #212121;
-  font-size: 16px;
-  padding-bottom: 5px;
-  padding-left: 5px;
-  padding-right: 5px;
-  color: #c0c0c0;
-  margin-top: 40px;
-
-  a {
-    color: #fff;
-
-    &:hover {
-
-      img { opacity: 1; }
-    }
-  }
-
-  .align-right {
-
-    p { display: inline-block; }
-  }
-
-  img {
-    display: inline-block;
-    position: relative;
-    top: 8px;
-    margin-left: 5px;
-    opacity: .8;
-    padding: 1px;
-    @include transition(opacity .2s);
-  }
-}
-
-@media (max-width: 568px) {
-  footer {
-    .one-third p { margin-bottom: 0; }
-    .two-thirds p { margin-top: -20px; }
-  }
-}
-
-/* Intro */
-
-.intro {
-
-  .unit { padding: 10px 0 40px; }
-
-  p {
-    font-size: 1.75em;
-    line-height: 1em;
-    margin: 0;
-  }
-}
-
-@media (min-width: 569px) {
-  .intro p { font-size: 3.2em; }
-}
-
-/* Quickstart */
-
-.quickstart {
-  background-color: #3F1F1F;
-  color: #fff;
-  margin: 60px 0;
-  @include box-shadow(inset 0 3px 10px rgba(0,0,0,.4));
-
-  .content { padding: 0; }
-
-  h3 {
-    font-size: 24px;
-    line-height: 24px;
-    margin-top: 20px;
-    text-shadow: 0 1px 3px rgba(0,0,0,.8);
-  }
-
-  .code {
-    font-size: 12px;
-    display: block;
-    margin: 0 0 -30px;
-  }
-}
-
-@media (min-width: 768px) {
-  .quickstart {
-
-    .code {
-      font-size: 18px;
-      margin: -30px 0;
-      float: right;
-    }
-
-    h3 {
-      margin: 50px 0 0;
-      text-align: center;
-    }
-  }
-}
-
-/* Code */
-
-.quickstart {
-
-  .code {
-    display: block;
-    padding: 0;
-    font-family: Menlo, Consolas, "Courier New", Courier, "Liberation Mono", monospace;
-    line-height: 1.3em;
-
-    .title {
-      display: block;
-      text-align: center;
-      margin: 0 20px;
-      padding: 5px 0;
-      @include border-radius(5px 5px 0 0);
-      @include box-shadow(0 3px 10px rgba(0,0,0,.5));
-      font: 400 16px/24px 'Helvetica Neue', Helvetica, Arial, sans-serif;
-      color: #444;
-      text-shadow: 0 1px 0 rgba(255,255,255,.5);
-      background-color: #f7f7f7;
-      background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2Y3ZjdmNyIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjclIiBzdG9wLWNvbG9yPSIjY2ZjZmNmIiBzdG9wLW9wYWNpdHk9IjEiLz4KICAgIDxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iI2FhYWFhYSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgPC9saW5lYXJHcmFkaWVudD4KICA8cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSJ1cmwoI2dyYWQtdWNnZy1nZW5lcmF0ZWQpIiAvPgo8L3N2Zz4=);
-      background-image: -webkit-gradient(linear, left top, left bottom, from(#f7f7f7), color-stop(7%, #cfcfcf), to(#aaaaaa));
-      background-image: -webkit-linear-gradient(top, #f7f7f7 0%, #cfcfcf 7%, #aaaaaa 100%);
-      background-image: -moz-linear-gradient(top, #f7f7f7 0%, #cfcfcf 7%, #aaaaaa 100%);
-      background-image: -o-linear-gradient(top, #f7f7f7 0%, #cfcfcf 7%, #aaaaaa 100%);
-      background-image: linear-gradient(top, #f7f7f7 0%,#cfcfcf 7%,#aaaaaa 100%);
-      filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f7f7f7', endColorstr='#aaaaaa',GradientType=0 );
-      border-bottom: 1px solid #111;
-    }
-
-    .shell {
-      padding: 20px;
-      text-shadow: none;
-      margin: 0 20px;
-      background-color: #171717;
-      @include border-radius(0 0 5px 5px);
-      @include box-shadow(0 5px 30px rgba(0,0,0,.3));
-    }
-
-    .line {
-      display: block;
-      margin: 0;
-      padding: 0;
-
-      span { display: inline-block; }
-    }
-
-    .path {
-      color: #87ceeb;
-      @include user-select(none);
-    }
-
-    .prompt {
-      color: #cd5c5c;
-      -webkit-user-select: none;  /* Chrome all / Safari all */
-      -moz-user-select: none;     /* Firefox all */
-      -ms-user-select: none;      /* IE 10+ */
-      -o-user-select: none;
-      user-select: none;
-    }
-
-    .command { color: #f0e68c; }
-
-    .output { color: #888; }
-  }
-}
-
-@media (min-width: 768px) {
-  .free-hosting {
-
-    img {
-      float: left;
-      margin: -20px -30px -30px -50px;
-      width: 300px;
-      height: 251px;
-    }
-
-    .pane-content {
-      margin-top: 35px;
-      padding-right: 30px;
-    }
-
-    p,
-    a { font-size: 18px; }
-
-    .pane:after {
-      content: " ";
-      float: right;
-      background: url(../img/footer-arrow.png) top left no-repeat;
-      width: 73px;
-      height: 186px;
-      position: absolute;
-      right: 0;
-      bottom: -30px;
-    }
-  }
-}
-
-/* Article - Used for both docs and news */
-
-
-article {
-  background-color: #444;
-  @include border-radius(10px);
-  padding: 20px;
-  margin: 0 10px;
-  @include box-shadow(0 3px 10px rgba(0,0,0,.1));
-  font-size: 16px;
-}
-
-@media (max-width: 480px) {
-  article ul { padding-left: 20px; }
-}
-
-@media (max-width: 568px) {
-  article { margin: 0; }
-}
-
-@media (min-width: 768px) {
-  article {
-    padding: 40px 40px 30px;
-    font-size: 21px;
-  }
-}
-
-/* Right-side nav - used by both docs and news */
-
-aside {
-  padding-top: 30px;
-
-  h4 {
-    text-transform: uppercase;
-    font-size: 14px;
-    font-weight: 700;
-    padding: 0 0 10px 30px;
-    margin-left: -30px;
-    display: inline-block;
-    border-bottom: 1px solid #ff0;
-  }
-
-  ul {
-    padding-left: 0;
-
-    &:first-child { margin-top: 0; }
-  }
-
-  li {
-    list-style-type: none;
-
-    a {
-      font-size: 16px;
-      position: relative
-    }
-
-    &.current a:before {
-      content: "";
-      border-color: transparent transparent transparent #444;
-      border-style: solid;
-      border-width: 10px;
-      width: 0;
-      height: 0;
-      position: absolute;
-      top: 0;
-      left: -30px;
-    }
-  }
-}
-
-/* Documentation */
-
-.docs {
-
-  article { min-height: 800px; }
-
-  .content { padding: 0; }
-}
-
-.section-nav {
-  text-align: center;
-  padding-top: 40px;
-  position: relative;
-  background: url(../img/article-footer.png) top center no-repeat;
-  margin: 40px -20px 10px;
-
-  > div { width: 49.5%; }
-
-  a,
-  span {
-    color: #fff;
-    font-size: 16px;
-    text-transform: uppercase;
-    font-weight: 700;
-    padding: 8px 12px 10px;
-    @include border-radius(5px);
-    /*border: 1px solid #333;*/
-    @include box-shadow(0 1px 3px rgba(0,0,0,.3), inset 0 1px 1px rgba(255,255,255,.5));
-    background-color: #767676;
-  }
-
-  a:hover {
-    color: #fff;
-    background-color: #888;
-  }
-
-  .next,
-  .prev { position: relative; }
-
-  .next:after,
-  .prev:before {
-    font-size: 36px;
-    color: #222;
-    font-weight: 900;
-    text-shadow: 0 1px 0 rgba(255,255,255,.4);
-    position: absolute;
-    top: -7px;
-  }
-
-  .next:after {
-    content: '\203A';
-    right: 10px;
-  }
-
-  .prev:before {
-    content: '\2039';
-    left: 10px;
-  }
-
-  .prev,
-  .prev:hover { padding-left: 30px; }
-
-  .next,
-  .next:hover { padding-right: 30px; }
-
-  .disabled {
-    opacity: .5;
-    cursor: default;
-  }
-}
-
-.improve {
-  padding-top: 25px;
-  font-size: 16px;
-  a {
-    color: #999;
-  }
-}
-
-.docs-nav-mobile select {
-  color: #000;
-  width: 100%;
-}
-
-/* News */
-
-article h2:first-child { margin-top: 0; }
-
-.post-category,
-.post-meta {
-  display: inline-block;
-  vertical-align: middle;
-  font-size: .8em;
-}
-
-.post-category {
-  display: inline-block;
-  margin-left: -30px;
-  padding: 6px 10px 8px;
-  padding-left: 50px;
-  @include border-radius(0 5px 5px 0);
-  position: relative;
-  @include box-shadow(0 1px 5px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255,255,255,.2), inset 0 -1px 0 rgba(0,0,0,.3));
-  background-color: #9e2812;
-  background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzllMjgxMiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiM2ZjBkMGQiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
-  background-image: -webkit-gradient(linear, left top, left bottom, from(#9e2812), to(#6f0d0d));
-  background-image: -webkit-linear-gradient(top, #9e2812 0%, #6f0d0d 100%);
-  background-image: -moz-linear-gradient(top, #9e2812 0%, #6f0d0d 100%);
-  background-image: -o-linear-gradient(top, #9e2812 0%, #6f0d0d 100%);
-  background-image: linear-gradient(to bottom, #9e2812 0%,#6f0d0d 100%);
-  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#9e2812', endColorstr='#6f0d0d',GradientType=0 );
-
-  &:before {
-    content: "";
-    position: absolute;
-    top: -10px;
-    left: 0;
-    border-color: transparent #6f0d0d #6f0d0d transparent;
-    border-style: solid;
-    border-width: 5px;
-    width: 0;
-    height: 0;
-  }
-}
-
-.post-content img { max-width: 100% }
-
-.label {
-  float: left;
-  text-transform: uppercase;
-  font-weight: 700;
-  text-shadow: 0 -1px 0 rgba(0,0,0,.5);
-}
-
-@media (max-width: 568px) {
-  .post-category { padding-left: 30px; }
-}
-
-@media (min-width: 768px) {
-  .post-category { margin-left: -50px; }
-}
-
-.avatar {
-  @include border-radius(3px);
-  display: inline-block;
-  vertical-align: middle;
-}
-
-.post-meta {
-  padding: 5px 0;
-  color: #c0c0c0;
-  font-weight: 600;
-  text-shadow: 0 -1px 0 #000;
-}
-
-.post-date,
-.post-author { margin-left: 10px; }
-
-.news article + article {
-  margin-top: -10px;
-  @include border-radius(0 0 10px 10px);
-  border-top: 1px solid #555;
-  @include box-shadow(0 -1px 0 #2f2f2f);
-}
-
-/* Code Highlighting */
-
-
-pre,
-code {
-  white-space: pre;
-  display: inline-block;
-  margin: 0;
-  font: 14px/1.8em Menlo, Consolas, "Courier New", Courier, "Liberation Mono", monospace;
-  padding: 0 0.5em;
-}
-
-@media (min-width: 768px) {
-  pre, code { font-size: 16px; }
-}
-
-.highlight,
-p > pre,
-p > code,
-p > nobr > code,
-li > code,
-h5 > code,
-.note > code {
-  background-color: #2b2b2b;
-  color: #fff;
-  @include border-radius(5px);
-  @include box-shadow(inset 0 1px 10px rgba(0,0,0,.3),
-    0 1px 0 rgba(255,255,255,.1),
-    0 -1px 0 rgba(0,0,0,.5));
-}
-
-.note code {
-  background-color: #333;
-  background-color: rgba(0,0,0,0.2);
-  margin-left: 2.5px;
-  margin-right: 2.5px;
-  font-size: 0.8em;
-}
-
-.highlight {
-  margin: 1em 0;
-  padding: 10px 0;
-  width: 100%;
-  overflow: auto;
-}
-
-/* HTML Elements */
-
-h1, h2, h3, h4, h5, h6 { margin: 0; }
-
-a {
-  color: #937cb0;
-  text-decoration: none;
-  @include transition(all .25s);
-
-  &:hover { color: #937cb0; }
-}
-
-strong { font-weight: 700; }
-
-p { line-height: 1.5em; }
-
-.left { float: left; }
-.right { float: right; }
-.align-right { text-align: right; }
-.align-left { text-align: left; }
-.align-center { text-align: center; }
-
-/* Article HTML */
-
-article {
-
-  h2, h3, h4, h5, h6 { margin: 1em 0; }
-
-  h4 { color: #fff; }
-
-  ul li {
-
-    p { margin: 0; }
-
-    blockquote { margin: 10px 0; }
-  }
-
-  ul li,
-  ol li {
-    line-height: 1.5em;
-    margin-bottom: 0.5em;
-  }
-
-}
-
-h5, h6 {
-  font-size: 1em;
-  font-style: italic;
-}
-
-blockquote {
-  border-left: 2px solid #777;
-  padding-left: 20px;
-  font-style: italic;
-  font-size: 18px;
-  font-weight: 500;
-}
-
-
-/* Tables */
-
-table {
-  width: 100%;
-  background-color: #555;
-  margin: .5em 0;
-  @include border-radius(5px);
-  @include box-shadow(0 1px 3px rgba(0,0,0,.3));
-}
-
-thead {
-  @include border-top-left-radius(5px);
-  @include border-top-right-radius(5px);
-  color: #fff;
-  background-color: #3a3a3a;
-  background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzNhM2EzYSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiMxZTFlMWUiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
-  background-image: -webkit-gradient(linear, left top, left bottom, from(#3a3a3a), to(#1e1e1e));
-  background-image: -webkit-linear-gradient(top, #3a3a3a 0%, #1e1e1e 100%);
-  background-image: -moz-linear-gradient(top, #3a3a3a 0%, #1e1e1e 100%);
-  background-image: -o-linear-gradient(top, #3a3a3a 0%, #1e1e1e 100%);
-  background-image: linear-gradient(to bottom, #3a3a3a 0%,#1e1e1e 100%);
-  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#3a3a3a', endColorstr='#1e1e1e',GradientType=0 );
-
-  th {
-    position: relative;
-    @include box-shadow(inset 0 1px 0 rgba(255,255,255,.1));
-
-    &:first-child {
-      @include border-top-left-radius(5px);
-    }
-
-    &:last-child {
-      @include border-top-right-radius(5px);
-    }
-  }
-}
-
-td { padding: .5em .75em; }
-
-td p { margin: 0; }
-
-th {
-  text-transform: uppercase;
-  font-size: 16px;
-  padding: .5em .75em;
-  text-shadow: 0 -1px 0 rgba(0,0,0,.9);
-  color: #888;
-}
-
-tbody td {
-  border-top: 1px solid #747474;
-  border-top: 1px solid rgba(0,0,0,.1);
-  @include box-shadow(inset 0 1px 0 rgba(255,255,255,.1));
-  background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2ZmZmZmZiIgc3RvcC1vcGFjaXR5PSIwLjEiLz4KICAgIDxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iI2ZmZmZmZiIgc3RvcC1vcGFjaXR5PSIwIi8+CiAgPC9saW5lYXJHcmFkaWVudD4KICA8cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSJ1cmwoI2dyYWQtdWNnZy1nZW5lcmF0ZWQpIiAvPgo8L3N2Zz4=);
-  background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(255,255,255,0.1)), to(rgba(255,255,255,0)));
-  background-image: -webkit-linear-gradient(top, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
-  background-image: -moz-linear-gradient(top, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
-  background-image: -o-linear-gradient(top, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
-  background-image: linear-gradient(to bottom, rgba(255,255,255,0.1) 0%,rgba(255,255,255,0) 100%);
-  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1affffff', endColorstr='#00ffffff',GradientType=0 );
-
-  p {
-    font-size: 16px;
-
-    code { font-size: 14px; }
-  }
-}
-
-code.option,
-th .option,
-code.filter,
-th .filter {
-  color: #50B600;
-}
-
-code.flag,
-th .flag,
-code.output,
-th .output {
-  color: #049DCE;
-}
-
-code.option,
-code.flag,
-code.filter,
-code.output {
-  margin-bottom: 2px;
-}
-
-/* Note types */
-
-.note {
-  margin: 30px 0;
-  margin-left: -30px;
-  padding: 20px 20px 24px;
-  padding-left: 50px;
-  @include border-radius(0 5px 5px 0);
-  position: relative;
-  @include box-shadow(0 1px 5px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255,255,255,.2), inset 0 -1px 0 rgba(0,0,0,.3));
-  background-color: #7e6d42;
-  background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzdlNmQ0MiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiM1YzRlMzUiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
-  background-image: -webkit-gradient(linear, left top, left bottom, from(#7e6d42), to(#5c4e35));
-  background-image: -webkit-linear-gradient(top, #7e6d42 0%, #5c4e35 100%);
-  background-image: -moz-linear-gradient(top, #7e6d42 0%, #5c4e35 100%);
-  background-image: -o-linear-gradient(top, #7e6d42 0%, #5c4e35 100%);
-  background-image: linear-gradient(to bottom, #7e6d42 0%,#5c4e35 100%);
-  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#7e6d42', endColorstr='#5c4e35',GradientType=0 );
-}
-
-@media (max-width: 568px) {
-  .note { margin-right: -30px; }
-}
-
-@media (min-width: 768px) {
-  .note { margin-left: -50px; }
-}
-
-.configtable {
-    font-size: 14px;
-}
-
-.note {
-  &:before {
-    content: "";
-    position: absolute;
-    top: -10px;
-    left: 0;
-    border-color: transparent #222 #222 transparent;
-    border-style: solid;
-    border-width: 5px;
-    width: 0;
-    height: 0;
-  }
-
-  h5,
-  p {
-    margin: 0;
-    color: #fff;
-  }
-
-  h5 {
-    line-height: 1.5em;
-    font-weight: 900;
-    font-style: normal;
-  }
-
-  p {
-    font-weight: 400;
-    font-size: .75em;
-  }
-
-  &:after {
-    content: '\2605';
-    color: #937cb0;
-    position: absolute;
-    top: 14px;
-    left: 14px;
-    font-size: 28px;
-    font-weight: 700;
-    text-shadow: 0 -1px 0 rgba(0,0,0,.5);
-  }
-}
-
-.info {
-  background-color: #0389aa;
-  background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzAzODlhYSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiMwMDYxN2YiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
-  background-image: -webkit-gradient(linear, left top, left bottom, from(#0389aa), to(#00617f));
-  background-image: -webkit-linear-gradient(top, #0389aa 0%, #00617f 100%);
-  background-image: -moz-linear-gradient(top, #0389aa 0%, #00617f 100%);
-  background-image: -o-linear-gradient(top, #0389aa 0%, #00617f 100%);
-  background-image: linear-gradient(to bottom, #0389aa 0%,#00617f 100%);
-  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#0389aa', endColorstr='#00617f',GradientType=0 );
-}
-
-.warning {
-  background-color: #9e2812;
-  background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzllMjgxMiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiM2ZjBkMGQiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
-  background-image: -webkit-gradient(linear, left top, left bottom, from(#9e2812), to(#6f0d0d));
-  background-image: -webkit-linear-gradient(top, #9e2812 0%, #6f0d0d 100%);
-  background-image: -moz-linear-gradient(top, #9e2812 0%, #6f0d0d 100%);
-  background-image: -o-linear-gradient(top, #9e2812 0%, #6f0d0d 100%);
-  background-image: linear-gradient(to bottom, #9e2812 0%,#6f0d0d 100%);
-  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#9e2812', endColorstr='#6f0d0d',GradientType=0 );
-}
-
-.unreleased {
-  background-color: #cd9239;
-  background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2NkOTIzOSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNhMjc1MjgiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
-  background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(205,146,57,1)), to(rgba(162,117,40,1)));
-  background-image: -webkit-linear-gradient(top, rgba(205,146,57,1) 0%, rgba(162,117,40,1) 100%);
-  background-image: -moz-linear-gradient(top, rgba(205,146,57,1) 0%, rgba(162,117,40,1) 100%);
-  background-image: -o-linear-gradient(top, rgba(205,146,57,1) 0%, rgba(162,117,40,1) 100%);
-  background-image: linear-gradient(to bottom, rgba(205,146,57,1) 0%,rgba(162,117,40,1) 100%);
-  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cd9239', endColorstr='#a27528',GradientType=0 );
-}
-
-.info:before { border-color: transparent #00617f #00617f transparent; }
-
-.warning:before { border-color: transparent #6f0d0d #6f0d0d transparent; }
-
-.unreleased:before { border-color: transparent #664719 #664719 transparent; }
-
-.info:after {
-  content: '\24D8';
-  color: #fff;
-  position: absolute;
-  top: 15px;
-  left: 15px;
-  font-size: 28px;
-  font-weight: 700;
-  text-shadow: 0 -1px 0 rgba(0,0,0,.5);
-}
-
-.warning:after {
-  content: '\203C';
-  color: #937cb0;
-  position: absolute;
-  top: 15px;
-  left: 15px;
-  font-size: 32px;
-  font-weight: 700;
-  text-shadow: 0 -1px 0 rgba(0,0,0,.5);
-}
-
-.unreleased:after {
-  content: '\2692';
-  color: #2b2a12;
-  position: absolute;
-  top: 8px;
-  left: 15px;
-  font-size: 38px;
-  font-weight: 700;
-  text-shadow: 0 1px 0 rgba(255,255,255,.25);
-}
-
-/* Responsive tables */
-
-@media (max-width: 768px) {
-  .mobile-side-scroller {
-    overflow-x: scroll;
-    margin: 0 -40px;
-    padding: 0 10px;
-  }
-}
-
-
-.show-on-mobiles {
-  display: none;
-}
-
-@media screen and (max-width: 568px) {
-  .show-on-mobiles {
-    display: block !important;
-  }
-  a .show-on-mobiles {
-    display: inline !important;
-  }
-}
-
-
-/* Helper class taken from Bootstrap.
-   Hides an element to all devices except screen readers.
-*/
-.sr-only {
-  position: absolute;
-  width: 1px;
-  height: 1px;
-  padding: 0;
-  margin: -1px;
-  overflow: hidden;
-  clip: rect(0, 0, 0, 0);
-  border: 0;
-}
-
-#poweredby {
-  float: right;
-  text-align: right;
-  width: 200px;
-  height: 87px;
-}
-
-#resources {
-  background-color: #000;
-}

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/site/community/index.md
----------------------------------------------------------------------
diff --git a/avatica/site/community/index.md b/avatica/site/community/index.md
deleted file mode 100644
index d437852..0000000
--- a/avatica/site/community/index.md
+++ /dev/null
@@ -1,70 +0,0 @@
----
-layout: page
-title: Community
----
-<!--
-{% 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 %}
--->
-
-* TOC
-{:toc}
-
-# Project Members
-
-Name (Apache ID) | Github | Org | Role
-:--------------- | :----- | :-- | :---
-{% for c in site.data.contributors %}  {{ c.name }} (<a href="http://people.apache.org/phonebook.html?uid={{ c.apacheId }}">{{ c.apacheId }}</a>) | <a href="http://github.com/{{ c.githubId }}"><img width="64" src="{% unless c.avatar %}http://github.com/{{ c.githubId }}.png{% else %}{{ c.avatar }}{% endunless %}"></a> | {{ c.org }} | {{ c.role }}
-{% endfor %}
-
-# Mailing Lists
-
-There are several development mailing lists for Calcite:
-
-* [dev@calcite.apache.org](mailto:dev@calcite.apache.org) - Development discussions
-  [[archive](https://mail-archives.apache.org/mod_mbox/calcite-dev/)]
-* [issues@calcite.apache.org](mailto:issues@calcite.apache.org) - Bug tracking
-  [[archive](https://mail-archives.apache.org/mod_mbox/calcite-issues/)]
-* [commits@calcite.apache.org](mailto:commits@calcite.apache.org) - Git tracking
-  [[archive](https://mail-archives.apache.org/mod_mbox/calcite-commits/)]
-
-You can subscribe to the lists by sending email to
-*list*-subscribe@calcite.apache.org and unsubscribe by sending email to
-*list*-unsubscribe@calcite.apache.org.
-
-# Help
-
-Need help with Calcite? Try these resources:
-
-* **Mailing Lists**.
-  The best option is to send email to the developers list
-  [dev@calcite.apache.org](mailto:dev@calcite.apache.org). All
-  of the historic traffic is available in the
-  [archive](http://mail-archives.apache.org/mod_mbox/calcite-dev/). To
-  subscribe to the user list, please send email to
-  [dev-subscribe@calcite.apache.org](mailto:dev-subscribe@calcite.apache.org).
-* **Bug Reports**.
-  Please file any issues you encounter or fixes you'd like on the
-  [Calcite Jira](https://issues.apache.org/jira/browse/CALCITE). We welcome
-  patches!
-* **StackOverflow**.
-  [StackOverflow](http://stackoverflow.com) is a wonderful resource for
-  any developer. Take a look over there to see if someone has answered
-  your question.
-* **Browse the code**.
-  One of the advantages of open source software is that you can browse the code.
-  The code is available on [github](https://github.com/apache/calcite/tree/master/avatica).

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/site/css/screen.scss
----------------------------------------------------------------------
diff --git a/avatica/site/css/screen.scss b/avatica/site/css/screen.scss
deleted file mode 100644
index 2eff7f8..0000000
--- a/avatica/site/css/screen.scss
+++ /dev/null
@@ -1,9 +0,0 @@
----
----
-
-@import "mixins";
-@import "normalize";
-@import "gridism";
-@import "pygments";
-@import "font-awesome";
-@import "style";

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/site/develop/index.md
----------------------------------------------------------------------
diff --git a/avatica/site/develop/index.md b/avatica/site/develop/index.md
deleted file mode 100644
index f32836f..0000000
--- a/avatica/site/develop/index.md
+++ /dev/null
@@ -1,116 +0,0 @@
----
-layout: page
-title: Developing Calcite
----
-<!--
-{% comment %}
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements.  See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License.  You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-{% endcomment %}
--->
-
-Want to help add a feature or fix a bug?
-
-* TOC
-{:toc}
-
-## Source code
-
-You can get the source code by
-[downloading a release]({{ site.baseurl }}/downloads)
-or from source control.
-
-Calcite uses git for version control.  The canonical source is in
-[Apache](https://git-wip-us.apache.org/repos/asf/calcite.git),
-but most people find the
-[Github mirror](https://github.com/apache/calcite) more
-user-friendly.
-
-## Download source, build, and run tests
-
-Prerequisites are git, maven (3.2.1 or later) and Java (JDK 1.7 or
-later, 1.8 preferred) on your path.
-
-Create a local copy of the git repository, `cd` to its root directory,
-then build using maven:
-
-{% highlight bash %}
-$ git clone git://github.com/apache/calcite.git
-$ cd calcite/avatica
-$ mvn install
-{% endhighlight %}
-
-The HOWTO describes how to
-[build from a source distribution]({{ site.baseurl }}/docs/howto.html#building-from-a-source-distribution),
-[run more or fewer tests]({{ site.baseurl }}/docs/howto.html#running-tests) and
-[run integration tests]({{ site.baseurl }}/docs/howto.html#running-integration-tests).
-
-## Contributing
-
-We welcome contributions.
-
-If you are planning to make a large contribution, talk to us first! It
-helps to agree on the general approach. Log a
-[JIRA case](https://issues.apache.org/jira/browse/CALCITE) for your
-proposed feature or start a discussion on the dev list.
-
-Fork the github repository, and create a branch for your feature.
-
-Develop your feature and test cases, and make sure that
-`mvn install` succeeds. (Run extra tests if your change warrants it.)
-
-Commit your change to your branch, and use a comment that starts with
-the JIRA case number, like this:
-
-{% highlight text %}
-[CALCITE-345] AssertionError in RexToLixTranslator comparing to date literal
-{% endhighlight %}
-
-If your change had multiple commits, use `git rebase -i master` to
-squash them into a single commit, and to bring your code up to date
-with the latest on the main line.
-
-Then push your commit(s) to github, and create a pull request from
-your branch to the calcite master branch. Update the JIRA case
-to reference your pull request, and a committer will review your
-changes.
-
-## Continuous Integration Testing
-
-Calcite has a collection of Jenkins jobs on ASF-hosted infrastructure.
-They are all organized in a single view and available at
-[https://builds.apache.org/view/A-D/view/Calcite-Avatica/](https://builds.apache.org/view/A-D/view/Calcite-Avatica/).
-
-## Getting started
-
-Calcite is a community, so the first step to joining the project is to introduce yourself.
-Join the [developers list](http://mail-archives.apache.org/mod_mbox/calcite-dev/)
-and send an email.
-
-If you have the chance to attend a [meetup](http://www.meetup.com/Apache-Calcite/),
-or meet [members of the community](http://calcite.apache.org/develop/#project-members)
-at a conference, that's also great.
-
-Choose an initial task to work on. It should be something really simple,
-such as a bug fix or a [Jira task that we have labeled
-"newbie"](https://issues.apache.org/jira/issues/?jql=labels%20%3D%20newbie%20%26%20project%20%3D%20Calcite%20%26%20status%20%3D%20Open).
-Follow the [contributing guidelines](#contributing) to get your change committed.
-
-After you have made several useful contributions we may
-[invite you to become a committer](https://community.apache.org/contributors/).
-We value all contributions that help to build a vibrant community, not just code.
-You can contribute by testing the code, helping verify a release,
-writing documentation or the web site,
-or just by answering questions on the list.

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/site/downloads/index.md
----------------------------------------------------------------------
diff --git a/avatica/site/downloads/index.md b/avatica/site/downloads/index.md
deleted file mode 100644
index a5c9c84..0000000
--- a/avatica/site/downloads/index.md
+++ /dev/null
@@ -1,108 +0,0 @@
----
-layout: page
-title: Downloads
----
-
-<!--
-{% 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 is released as a source artifact, and also through Maven.
-
-# Source releases
-
-Release          | Date       | Commit   | Download
-:--------------- | :--------- | :------- | :-------
-{% for post in site.categories.release %}{% comment %}
-{% endcomment %}{% if post.fullVersion %}{% comment %}
-{% endcomment %}{% assign v = post.fullVersion %}{% comment %}
-{% endcomment %}{% else %}{% comment %}
-{% endcomment %}{% capture v %}apache-calcite-avatica-{{ post.version }}{% endcapture %}{% comment %}
-{% endcomment %}{% endif %}{% comment %}
-{% endcomment %}{% if forloop.index0 < 1 %}{% comment %}
-{% endcomment %}{% capture p %}http://www.apache.org/dyn/closer.lua?filename=calcite/{{ v }}{% endcapture %}{% comment %}
-{% endcomment %}{% assign q = "&action=download" %}{% comment %}
-{% endcomment %}{% assign d = "https://www.apache.org/dist" %}{% comment %}
-{% endcomment %}{% else %}{% comment %}
-{% endcomment %}{% capture p %}http://archive.apache.org/dist/calcite/{{ v }}{% endcapture %}{% comment %}
-{% endcomment %}{% assign q = "" %}{% comment %}
-{% endcomment %}{% assign d = "https://archive.apache.org/dist" %}{% comment %}
-{% endcomment %}{% endif %}{% comment %}
-{% endcomment %}<a href="{{ site.baseurl }}/docs/history.html#{{ post.tag }}">{{ post.version }}</a>{% comment %}
-{% endcomment %} | {{ post.date | date_to_string }}{% comment %}
-{% endcomment %} | <a href="https://github.com/apache/calcite/commit/{{ post.sha }}">{{ post.sha }}</a>{% comment %}
-{% endcomment %} | <a href="{{ p }}/{{ v }}-src.tar.gz{{ q }}">tar</a>{% comment %}
-{% endcomment %} (<a href="{{ d }}/calcite/{{ v }}/{{ v }}-src.tar.gz.md5">md5</a>{% comment %}
-{% endcomment %} <a href="{{ d }}/calcite/{{ v }}/{{ v }}-src.tar.gz.asc">pgp</a>){% comment %}
-{% endcomment %} {% raw %}<br>{% endraw %}{% comment %}
-{% endcomment %} <a href="{{ p }}/{{ v }}-src.zip{{ q }}">zip</a>{% comment %}
-{% endcomment %} (<a href="{{ d }}/calcite/{{ v }}/{{ v }}-src.zip.md5">md5</a>{% comment %}
-{% endcomment %} <a href="{{ d }}/calcite/{{ v }}/{{ v }}-src.zip.asc">pgp</a>){% comment %}
-{% endcomment %}
-{% endfor %}
-
-Choose a source distribution in either *tar* or *zip* format,
-and [verify](http://www.apache.org/dyn/closer.cgi#verify)
-using the corresponding *pgp* signature (using the committer file in
-[KEYS](http://www.apache.org/dist/calcite/KEYS)).
-If you cannot do that, the *md5* hash file may be used to check that the
-download has completed OK.
-
-For fast downloads, current source distributions are hosted on mirror servers;
-older source distributions are in the
-[archive](http://archive.apache.org/dist/calcite/).
-If a download from a mirror fails, retry, and the second download will likely
-succeed.
-
-For security, hash and signature files are always hosted at
-[Apache](https://www.apache.org/dist).
-
-# Maven artifacts
-
-Add the following to the dependencies section of your `pom.xml` file:
-
-{% for post in site.categories.release limit:1 %}
-{% assign current_release = post %}
-{% endfor %}
-
-{% highlight xml %}
-<dependencies>
-  <dependency>
-    <groupId>org.apache.calcite.avatica</groupId>
-    <artifactId>avatica</artifactId>
-    <version>{{ current_release.version }}</version>
-  </dependency>
-  <dependency>
-    <groupId>org.apache.calcite.avatica</groupId>
-    <artifactId>avatica-server</artifactId>
-    <version>{{ current_release.version }}</version>
-  </dependency>
-</dependencies>
-{% endhighlight %}
-
-As of Apache Calcite Avatica 1.9.0, the following un-shaded client artifact is also available:
-
-{% highlight xml %}
-<dependencies>
-  <dependency>
-    <groupId>org.apache.calcite.avatica</groupId>
-    <artifactId>avatica-core</artifactId>
-    <version>{{ current_release.version }}</version>
-  </dependency>
-</dependencies>
-{% endhighlight %}

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/site/fonts/fontawesome-webfont.eot
----------------------------------------------------------------------
diff --git a/avatica/site/fonts/fontawesome-webfont.eot b/avatica/site/fonts/fontawesome-webfont.eot
deleted file mode 100755
index 84677bc..0000000
Binary files a/avatica/site/fonts/fontawesome-webfont.eot and /dev/null differ


[11/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java-filtered/org/apache/calcite/avatica/util/FilteredConstants.java
----------------------------------------------------------------------
diff --git a/core/src/main/java-filtered/org/apache/calcite/avatica/util/FilteredConstants.java b/core/src/main/java-filtered/org/apache/calcite/avatica/util/FilteredConstants.java
new file mode 100644
index 0000000..53b76ee
--- /dev/null
+++ b/core/src/main/java-filtered/org/apache/calcite/avatica/util/FilteredConstants.java
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+package org.apache.calcite.avatica.util;
+
+/**
+ * A class which, at build time, will have build-specific variables substituted into it.
+ */
+public class FilteredConstants {
+  public static final String VERSION = "${avatica.release.version}";
+}
+
+// End FilteredConstants.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/DataContext.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/DataContext.java b/core/src/main/java/org/apache/calcite/DataContext.java
deleted file mode 100644
index 78642aa..0000000
--- a/core/src/main/java/org/apache/calcite/DataContext.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite;
-
-import org.apache.calcite.adapter.java.JavaTypeFactory;
-import org.apache.calcite.linq4j.QueryProvider;
-import org.apache.calcite.linq4j.tree.Expressions;
-import org.apache.calcite.linq4j.tree.ParameterExpression;
-import org.apache.calcite.schema.SchemaPlus;
-import org.apache.calcite.sql.advise.SqlAdvisor;
-
-import com.google.common.base.CaseFormat;
-
-import java.lang.reflect.Modifier;
-import java.util.TimeZone;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-/**
- * Runtime context allowing access to the tables in a database.
- */
-public interface DataContext {
-  ParameterExpression ROOT =
-      Expressions.parameter(Modifier.FINAL, DataContext.class, "root");
-
-  /**
-   * Returns a sub-schema with a given name, or null.
-   */
-  SchemaPlus getRootSchema();
-
-  /**
-   * Returns the type factory.
-   */
-  JavaTypeFactory getTypeFactory();
-
-  /**
-   * Returns the query provider.
-   */
-  QueryProvider getQueryProvider();
-
-  /**
-   * Returns a context variable.
-   *
-   * <p>Supported variables include: "sparkContext", "currentTimestamp",
-   * "localTimestamp".</p>
-   *
-   * @param name Name of variable
-   */
-  Object get(String name);
-
-  /** Variable that may be asked for in a call to {@link DataContext#get}. */
-  enum Variable {
-    UTC_TIMESTAMP("utcTimestamp", Long.class),
-
-    /** The time at which the current statement started executing. In
-     * milliseconds after 1970-01-01 00:00:00, UTC. Required. */
-    CURRENT_TIMESTAMP("currentTimestamp", Long.class),
-
-    /** The time at which the current statement started executing. In
-     * milliseconds after 1970-01-01 00:00:00, in the time zone of the current
-     * statement. Required. */
-    LOCAL_TIMESTAMP("localTimestamp", Long.class),
-
-    /** The Spark engine. Available if Spark is on the class path. */
-    SPARK_CONTEXT("sparkContext", Object.class),
-
-    /** A mutable flag that indicates whether user has requested that the
-     * current statement be canceled. Cancellation may not be immediate, but
-     * implementations of relational operators should check the flag fairly
-     * frequently and cease execution (e.g. by returning end of data). */
-    CANCEL_FLAG("cancelFlag", AtomicBoolean.class),
-
-    /** Advisor that suggests completion hints for SQL statements. */
-    SQL_ADVISOR("sqlAdvisor", SqlAdvisor.class),
-
-    /** Time zone in which the current statement is executing. Required;
-     * defaults to the time zone of the JVM if the connection does not specify a
-     * time zone. */
-    TIME_ZONE("timeZone", TimeZone.class);
-
-    public final String camelName;
-    public final Class clazz;
-
-    Variable(String camelName, Class clazz) {
-      this.camelName = camelName;
-      this.clazz = clazz;
-      assert camelName.equals(
-          CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, name()));
-    }
-
-    /** Returns the value of this variable in a given data context. */
-    public <T> T get(DataContext dataContext) {
-      //noinspection unchecked
-      return (T) clazz.cast(dataContext.get(camelName));
-    }
-  }
-}
-
-// End DataContext.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/Demo.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/Demo.java b/core/src/main/java/org/apache/calcite/Demo.java
deleted file mode 100644
index 27f65fe..0000000
--- a/core/src/main/java/org/apache/calcite/Demo.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite;
-
-import java.util.ArrayList;
-
-/**
- * Demo.
- */
-public class Demo {
-  private Demo() {
-  }
-
-  public static void main(String[] args) {
-    ArrayList<String> names = new ArrayList<String>();
-    names.add("John");
-    names.add("Paul");
-    names.add("George");
-    names.add("Ringo");
-
-    Iterable<String> nameIterable = names;
-
-    for (String name : nameIterable) {
-      System.out.println(name);
-    }
-  }
-}
-
-// End Demo.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/clone/ArrayTable.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/clone/ArrayTable.java b/core/src/main/java/org/apache/calcite/adapter/clone/ArrayTable.java
deleted file mode 100644
index d87165c..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/clone/ArrayTable.java
+++ /dev/null
@@ -1,900 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.clone;
-
-import org.apache.calcite.DataContext;
-import org.apache.calcite.adapter.java.AbstractQueryableTable;
-import org.apache.calcite.linq4j.AbstractEnumerable;
-import org.apache.calcite.linq4j.Enumerable;
-import org.apache.calcite.linq4j.Enumerator;
-import org.apache.calcite.linq4j.Ord;
-import org.apache.calcite.linq4j.QueryProvider;
-import org.apache.calcite.linq4j.Queryable;
-import org.apache.calcite.linq4j.tree.Primitive;
-import org.apache.calcite.rel.RelCollation;
-import org.apache.calcite.rel.RelCollations;
-import org.apache.calcite.rel.type.RelDataType;
-import org.apache.calcite.rel.type.RelDataTypeFactory;
-import org.apache.calcite.rel.type.RelProtoDataType;
-import org.apache.calcite.schema.ScannableTable;
-import org.apache.calcite.schema.SchemaPlus;
-import org.apache.calcite.schema.Statistic;
-import org.apache.calcite.schema.Statistics;
-import org.apache.calcite.schema.impl.AbstractTableQueryable;
-import org.apache.calcite.util.ImmutableBitSet;
-import org.apache.calcite.util.Pair;
-
-import com.google.common.base.Supplier;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
-
-import java.lang.reflect.Array;
-import java.lang.reflect.Type;
-import java.util.AbstractList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * Implementation of table that reads rows from column stores, one per column.
- * Column store formats are chosen based on the type and distribution of the
- * values in the column; see {@link Representation} and
- * {@link RepresentationType}.
- */
-class ArrayTable extends AbstractQueryableTable implements ScannableTable {
-  private final RelProtoDataType protoRowType;
-  private final Supplier<Content> supplier;
-
-  /** Creates an ArrayTable. */
-  public ArrayTable(Type elementType, RelProtoDataType protoRowType,
-      Supplier<Content> supplier) {
-    super(elementType);
-    this.protoRowType = protoRowType;
-    this.supplier = supplier;
-  }
-
-  public RelDataType getRowType(RelDataTypeFactory typeFactory) {
-    return protoRowType.apply(typeFactory);
-  }
-
-  public Statistic getStatistic() {
-    final List<ImmutableBitSet> keys = Lists.newArrayList();
-    final Content content = supplier.get();
-    for (Ord<Column> ord : Ord.zip(content.columns)) {
-      if (ord.e.cardinality == content.size) {
-        keys.add(ImmutableBitSet.of(ord.i));
-      }
-    }
-    return Statistics.of(content.size, keys, content.collations);
-  }
-
-  public Enumerable<Object[]> scan(DataContext root) {
-    return new AbstractEnumerable<Object[]>() {
-      public Enumerator<Object[]> enumerator() {
-        final Content content = supplier.get();
-        return content.arrayEnumerator();
-      }
-    };
-  }
-
-  public <T> Queryable<T> asQueryable(final QueryProvider queryProvider,
-      SchemaPlus schema, String tableName) {
-    return new AbstractTableQueryable<T>(queryProvider, schema, this,
-        tableName) {
-      @SuppressWarnings("unchecked")
-      public Enumerator<T> enumerator() {
-        final Content content = supplier.get();
-        return content.enumerator();
-      }
-    };
-  }
-
-  @SuppressWarnings("unchecked")
-  private static <T> Pair<Object, T> toPair(Object dataSet) {
-    return (Pair<Object, T>) dataSet;
-  }
-
-  /** How a column's values are represented. */
-  enum RepresentationType {
-    /** Constant. Contains only one value.
-     *
-     * <p>We can't store 0-bit values in
-     * an array: we'd have no way of knowing how many there were.</p>
-     *
-     * @see Constant
-     */
-    CONSTANT,
-
-    /** Object array. Null values are represented by null. Values may or may
-     * not be canonized; if canonized, = and != can be implemented using
-     * pointer.
-     *
-     * @see ObjectArray
-     */
-    OBJECT_ARRAY,
-
-    /**
-     * Array of primitives. Null values not possible. Only for primitive
-     * types (and not optimal for boolean).
-     *
-     * @see PrimitiveArray
-     */
-    PRIMITIVE_ARRAY,
-
-    /** Bit-sliced primitive array. Values are {@code bitCount} bits each,
-     * and interpreted as signed. Stored as an array of long values.
-     *
-     * <p>If gcd(bitCount, 64) != 0, some values will cross boundaries.
-     * bits each. But for all of those values except 4, there is a primitive
-     * type (8 byte, 16 short, 32 int) which is more efficient.
-     *
-     * @see BitSlicedPrimitiveArray
-     */
-    BIT_SLICED_PRIMITIVE_ARRAY,
-
-    /**
-     * Dictionary of primitives. Use one of the previous methods to store
-     * unsigned offsets into the dictionary. Dictionary is canonized and
-     * sorted, so v1 &lt; v2 if and only if code(v1) &lt; code(v2). The
-     * dictionary may or may not contain a null value.
-     *
-     * <p>The dictionary is not beneficial unless the codes are
-     * significantly shorter than the values. A column of {@code long}
-     * values with many duplicates is a win; a column of mostly distinct
-     * {@code short} values is likely a loss. The other win is if there are
-     * null values; otherwise the best option would be an
-     * {@link #OBJECT_ARRAY}.</p>
-     *
-     * @see PrimitiveDictionary
-     */
-    PRIMITIVE_DICTIONARY,
-
-    /**
-     * Dictionary of objects. Use one of the previous methods to store
-     * unsigned offsets into the dictionary.
-     *
-     * @see ObjectDictionary
-     */
-    OBJECT_DICTIONARY,
-
-    /**
-     * Compressed string table. Block of char data. Strings represented
-     * using an unsigned offset into the table (stored using one of the
-     * previous methods).
-     *
-     * <p>First 2 bytes are unsigned length; subsequent bytes are string
-     * contents. The null value, strings longer than 64k and strings that
-     * occur very commonly are held in an 'exceptions' array and are
-     * recognized by their high offsets. Other strings are created on demand
-     * (this reduces the number of objects that need to be created during
-     * deserialization from cache.</p>
-     *
-     * @see StringDictionary
-     */
-    STRING_DICTIONARY,
-
-    /**
-     * Compressed byte array table. Similar to compressed string table.
-     *
-     * @see ByteStringDictionary
-     */
-    BYTE_STRING_DICTIONARY,
-  }
-
-  /** Column definition and value set. */
-  public static class Column {
-    final Representation representation;
-    final Object dataSet;
-    final int cardinality;
-
-    Column(Representation representation, Object data, int cardinality) {
-      this.representation = representation;
-      this.dataSet = data;
-      this.cardinality = cardinality;
-    }
-
-    public Column permute(int[] sources) {
-      return new Column(
-          representation,
-          representation.permute(dataSet, sources),
-          cardinality);
-    }
-
-    @Override public String toString() {
-      return "Column(representation=" + representation
-          + ", value=" + representation.toString(dataSet) + ")";
-    }
-
-    /** Returns a list view onto a data set. */
-    public static List asList(final Representation representation,
-        final Object dataSet) {
-      // Cache size. It might be expensive to compute.
-      final int size = representation.size(dataSet);
-      return new AbstractList() {
-        public Object get(int index) {
-          return representation.getObject(dataSet, index);
-        }
-
-        public int size() {
-          return size;
-        }
-      };
-    }
-  }
-
-  /** Representation of the values of a column. */
-  public interface Representation {
-    /** Returns the representation type. */
-    RepresentationType getType();
-
-    /** Converts a value set into a compact representation. If
-     * {@code sources} is not null, permutes. */
-    Object freeze(ColumnLoader.ValueSet valueSet, int[] sources);
-
-    Object getObject(Object dataSet, int ordinal);
-    int getInt(Object dataSet, int ordinal);
-
-    /** Creates a data set that is the same as a given data set
-     * but re-ordered. */
-    Object permute(Object dataSet, int[] sources);
-
-    /** Returns the number of elements in a data set. (Some representations
-     * return the capacity, which may be slightly larger than the actual
-     * size.) */
-    int size(Object dataSet);
-
-    /** Converts a data set to a string. */
-    String toString(Object dataSet);
-  }
-
-  /** Representation that stores the column values in an array. */
-  public static class ObjectArray implements Representation {
-    final int ordinal;
-
-    public ObjectArray(int ordinal) {
-      this.ordinal = ordinal;
-    }
-
-    public String toString() {
-      return "ObjectArray(ordinal=" + ordinal + ")";
-    }
-
-    public RepresentationType getType() {
-      return RepresentationType.OBJECT_ARRAY;
-    }
-
-    public Object freeze(ColumnLoader.ValueSet valueSet, int[] sources) {
-      // We assume the values have been canonized.
-      final List<Comparable> list = permuteList(valueSet.values, sources);
-      return list.toArray(new Comparable[list.size()]);
-    }
-
-    public Object permute(Object dataSet, int[] sources) {
-      Comparable[] list = (Comparable[]) dataSet;
-      final int size = list.length;
-      final Comparable[] comparables = new Comparable[size];
-      for (int i = 0; i < size; i++) {
-        comparables[i] = list[sources[i]];
-      }
-      return comparables;
-    }
-
-    public Object getObject(Object dataSet, int ordinal) {
-      return ((Comparable[]) dataSet)[ordinal];
-    }
-
-    public int getInt(Object dataSet, int ordinal) {
-      return ((Number) getObject(dataSet, ordinal)).intValue();
-    }
-
-    public int size(Object dataSet) {
-      return ((Comparable[]) dataSet).length;
-    }
-
-    public String toString(Object dataSet) {
-      return Arrays.toString((Comparable[]) dataSet);
-    }
-  }
-
-  /** Representation that stores the values of a column in an array of
-   * primitive values. */
-  public static class PrimitiveArray implements Representation {
-    final int ordinal;
-    private final Primitive primitive;
-    private final Primitive p;
-
-    public PrimitiveArray(int ordinal, Primitive primitive, Primitive p) {
-      this.ordinal = ordinal;
-      this.primitive = primitive;
-      this.p = p;
-    }
-
-    public String toString() {
-      return "PrimitiveArray(ordinal=" + ordinal
-          + ", primitive=" + primitive
-          + ", p=" + p
-          + ")";
-    }
-
-    public RepresentationType getType() {
-      return RepresentationType.PRIMITIVE_ARRAY;
-    }
-
-    public Object freeze(ColumnLoader.ValueSet valueSet, int[] sources) {
-      //noinspection unchecked
-      return primitive.toArray2(
-          permuteList((List) valueSet.values, sources));
-    }
-
-    public Object permute(Object dataSet, int[] sources) {
-      return primitive.permute(dataSet, sources);
-    }
-
-    public Object getObject(Object dataSet, int ordinal) {
-      return p.arrayItem(dataSet, ordinal);
-    }
-
-    public int getInt(Object dataSet, int ordinal) {
-      return Array.getInt(dataSet, ordinal);
-    }
-
-    public int size(Object dataSet) {
-      return Array.getLength(dataSet);
-    }
-
-    public String toString(Object dataSet) {
-      return p.arrayToString(dataSet);
-    }
-  }
-
-  /** Representation that stores column values in a dictionary of
-   * primitive values, then uses a short code for each row. */
-  public static class PrimitiveDictionary implements Representation {
-    public PrimitiveDictionary() {
-    }
-
-    public String toString() {
-      return "PrimitiveDictionary()";
-    }
-
-    public RepresentationType getType() {
-      return RepresentationType.PRIMITIVE_DICTIONARY;
-    }
-
-    public Object freeze(ColumnLoader.ValueSet valueSet, int[] sources) {
-      throw new UnsupportedOperationException(); // TODO:
-    }
-
-    public Object permute(Object dataSet, int[] sources) {
-      throw new UnsupportedOperationException(); // TODO:
-    }
-
-    public Object getObject(Object dataSet, int ordinal) {
-      throw new UnsupportedOperationException(); // TODO:
-    }
-
-    public int getInt(Object dataSet, int ordinal) {
-      throw new UnsupportedOperationException(); // TODO:
-    }
-
-    public int size(Object dataSet) {
-      throw new UnsupportedOperationException(); // TODO:
-    }
-
-    public String toString(Object dataSet) {
-      throw new UnsupportedOperationException(); // TODO:
-    }
-  }
-
-  /** Representation that stores the values of a column as a
-   * dictionary of objects. */
-  public static class ObjectDictionary implements Representation {
-    final int ordinal;
-    final Representation representation;
-
-    public ObjectDictionary(
-        int ordinal,
-        Representation representation) {
-      this.ordinal = ordinal;
-      this.representation = representation;
-    }
-
-    public String toString() {
-      return "ObjectDictionary(ordinal=" + ordinal
-          + ", representation=" + representation
-          + ")";
-    }
-
-    public RepresentationType getType() {
-      return RepresentationType.OBJECT_DICTIONARY;
-    }
-
-    public Object freeze(ColumnLoader.ValueSet valueSet, int[] sources) {
-      final int n = valueSet.map.keySet().size();
-      int extra = valueSet.containsNull ? 1 : 0;
-      Comparable[] codeValues =
-          valueSet.map.keySet().toArray(new Comparable[n + extra]);
-      Arrays.sort(codeValues, 0, n);
-      ColumnLoader.ValueSet codeValueSet =
-          new ColumnLoader.ValueSet(int.class);
-      final List<Comparable> list = permuteList(valueSet.values, sources);
-      for (Comparable value : list) {
-        int code;
-        if (value == null) {
-          code = n;
-        } else {
-          code = Arrays.binarySearch(codeValues, value);
-          assert code >= 0 : code + ", " + value;
-        }
-        codeValueSet.add(code);
-      }
-      Object codes = representation.freeze(codeValueSet, null);
-      return Pair.of(codes, codeValues);
-    }
-
-    public Object permute(Object dataSet, int[] sources) {
-      final Pair<Object, Comparable[]> pair = toPair(dataSet);
-      Object codes = pair.left;
-      Comparable[] codeValues = pair.right;
-      return Pair.of(representation.permute(codes, sources), codeValues);
-    }
-
-    public Object getObject(Object dataSet, int ordinal) {
-      final Pair<Object, Comparable[]> pair = toPair(dataSet);
-      int code = representation.getInt(pair.left, ordinal);
-      return pair.right[code];
-    }
-
-    public int getInt(Object dataSet, int ordinal) {
-      return ((Number) getObject(dataSet, ordinal)).intValue();
-    }
-
-    public int size(Object dataSet) {
-      final Pair<Object, Comparable[]> pair = toPair(dataSet);
-      return representation.size(pair.left);
-    }
-
-    public String toString(Object dataSet) {
-      return Column.asList(this, dataSet).toString();
-    }
-  }
-
-  /** Representation that stores string column values. */
-  public static class StringDictionary implements Representation {
-    public StringDictionary() {
-    }
-
-    @Override public String toString() {
-      return "StringDictionary()";
-    }
-
-    public RepresentationType getType() {
-      return RepresentationType.STRING_DICTIONARY;
-    }
-
-    public Object freeze(ColumnLoader.ValueSet valueSet, int[] sources) {
-      throw new UnsupportedOperationException(); // TODO:
-    }
-
-    public Object permute(Object dataSet, int[] sources) {
-      throw new UnsupportedOperationException(); // TODO:
-    }
-
-    public Object getObject(Object dataSet, int ordinal) {
-      throw new UnsupportedOperationException(); // TODO:
-    }
-
-    public int getInt(Object dataSet, int ordinal) {
-      throw new UnsupportedOperationException(); // TODO:
-    }
-
-    public int size(Object dataSet) {
-      throw new UnsupportedOperationException(); // TODO:
-    }
-
-    public String toString(Object dataSet) {
-      return Column.asList(this, dataSet).toString();
-    }
-  }
-
-  /** Representation that stores byte-string column values. */
-  public static class ByteStringDictionary implements Representation {
-    public ByteStringDictionary() {
-    }
-
-    public String toString() {
-      return "ByteStringDictionary()";
-    }
-
-    public RepresentationType getType() {
-      return RepresentationType.BYTE_STRING_DICTIONARY;
-    }
-
-    public Object freeze(ColumnLoader.ValueSet valueSet, int[] sources) {
-      throw new UnsupportedOperationException(); // TODO:
-    }
-
-    public Object permute(Object dataSet, int[] sources) {
-      throw new UnsupportedOperationException(); // TODO:
-    }
-
-    public Object getObject(Object dataSet, int ordinal) {
-      throw new UnsupportedOperationException(); // TODO:
-    }
-
-    public int getInt(Object dataSet, int ordinal) {
-      throw new UnsupportedOperationException(); // TODO:
-    }
-
-    public int size(Object dataSet) {
-      throw new UnsupportedOperationException(); // TODO:
-    }
-
-    public String toString(Object dataSet) {
-      return Column.asList(this, dataSet).toString();
-    }
-  }
-
-  /** Representation of a column that has the same value for every row. */
-  public static class Constant implements Representation {
-    final int ordinal;
-
-    public Constant(int ordinal) {
-      this.ordinal = ordinal;
-    }
-
-    public String toString() {
-      return "Constant(ordinal=" + ordinal + ")";
-    }
-
-    public RepresentationType getType() {
-      return RepresentationType.CONSTANT;
-    }
-
-    public Object freeze(ColumnLoader.ValueSet valueSet, int[] sources) {
-      final int size = valueSet.values.size();
-      return Pair.of(size == 0 ? null : valueSet.values.get(0), size);
-    }
-
-    public Object permute(Object dataSet, int[] sources) {
-      return dataSet;
-    }
-
-    public Object getObject(Object dataSet, int ordinal) {
-      Pair<Object, Integer> pair = toPair(dataSet);
-      return pair.left;
-    }
-
-    public int getInt(Object dataSet, int ordinal) {
-      Pair<Object, Integer> pair = toPair(dataSet);
-      return ((Number) pair.left).intValue();
-    }
-
-    public int size(Object dataSet) {
-      Pair<Object, Integer> pair = toPair(dataSet);
-      return pair.right;
-    }
-
-    public String toString(Object dataSet) {
-      Pair<Object, Integer> pair = toPair(dataSet);
-      return Collections.nCopies(pair.right, pair.left).toString();
-    }
-  }
-
-  /** Representation that stores numeric values in a bit-sliced
-   * array. Each value does not necessarily occupy 8, 16, 32 or 64
-   * bits (the number of bits used by the built-in types). This
-   * representation is often used to store the value codes for a
-   * dictionary-based representation. */
-  public static class BitSlicedPrimitiveArray implements Representation {
-    final int ordinal;
-    final int bitCount;
-    final Primitive primitive;
-    final boolean signed;
-
-    BitSlicedPrimitiveArray(
-        int ordinal, int bitCount, Primitive primitive, boolean signed) {
-      assert bitCount > 0;
-      this.ordinal = ordinal;
-      this.bitCount = bitCount;
-      this.primitive = primitive;
-      this.signed = signed;
-    }
-
-    @Override public String toString() {
-      return "BitSlicedPrimitiveArray(ordinal=" + ordinal
-          + ", bitCount=" + bitCount
-          + ", primitive=" + primitive
-          + ", signed=" + signed + ")";
-    }
-
-    public RepresentationType getType() {
-      return RepresentationType.BIT_SLICED_PRIMITIVE_ARRAY;
-    }
-
-    public Object freeze(ColumnLoader.ValueSet valueSet, int[] sources) {
-      final int chunksPerWord = 64 / bitCount;
-      final List<Comparable> valueList =
-          permuteList(valueSet.values, sources);
-      final int valueCount = valueList.size();
-      final int wordCount =
-          (valueCount + (chunksPerWord - 1)) / chunksPerWord;
-      final int remainingChunkCount = valueCount % chunksPerWord;
-      final long[] longs = new long[wordCount];
-      final int n = valueCount / chunksPerWord;
-      int i;
-      int k = 0;
-      if (valueCount > 0
-          && valueList.get(0) instanceof Boolean) {
-        @SuppressWarnings("unchecked")
-        final List<Boolean> booleans = (List) valueList;
-        for (i = 0; i < n; i++) {
-          long v = 0;
-          for (int j = 0; j < chunksPerWord; j++) {
-            v |= booleans.get(k++) ? (1 << (bitCount * j)) : 0;
-          }
-          longs[i] = v;
-        }
-        if (remainingChunkCount > 0) {
-          long v = 0;
-          for (int j = 0; j < remainingChunkCount; j++) {
-            v |= booleans.get(k++) ? (1 << (bitCount * j)) : 0;
-          }
-          longs[i] = v;
-        }
-      } else {
-        @SuppressWarnings("unchecked")
-        final List<Number> numbers = (List) valueList;
-        for (i = 0; i < n; i++) {
-          long v = 0;
-          for (int j = 0; j < chunksPerWord; j++) {
-            v |= numbers.get(k++).longValue() << (bitCount * j);
-          }
-          longs[i] = v;
-        }
-        if (remainingChunkCount > 0) {
-          long v = 0;
-          for (int j = 0; j < remainingChunkCount; j++) {
-            v |= numbers.get(k++).longValue() << (bitCount * j);
-          }
-          longs[i] = v;
-        }
-      }
-      return longs;
-    }
-
-    public Object permute(Object dataSet, int[] sources) {
-      final long[] longs0 = (long[]) dataSet;
-      int n = sources.length;
-      final long[] longs = new long[longs0.length];
-      for (int i = 0; i < n; i++) {
-        orLong(
-            bitCount, longs, i,
-            getLong(bitCount, longs0, sources[i]));
-      }
-      return longs;
-    }
-
-    public Object getObject(Object dataSet, int ordinal) {
-      final long[] longs = (long[]) dataSet;
-      final int chunksPerWord = 64 / bitCount;
-      final int word = ordinal / chunksPerWord;
-      final long v = longs[word];
-      final int chunk = ordinal % chunksPerWord;
-      final int mask = (1 << bitCount) - 1;
-      final int signMask = 1 << (bitCount - 1);
-      final int shift = chunk * bitCount;
-      final long w = v >> shift;
-      long x = w & mask;
-      if (signed && (x & signMask) != 0) {
-        x = -x;
-      }
-      switch (primitive) {
-      case BOOLEAN:
-        return x != 0;
-      case BYTE:
-        return (byte) x;
-      case CHAR:
-        return (char) x;
-      case SHORT:
-        return (short) x;
-      case INT:
-        return (int) x;
-      case LONG:
-        return x;
-      default:
-        throw new AssertionError(primitive + " unexpected");
-      }
-    }
-
-    public int getInt(Object dataSet, int ordinal) {
-      final long[] longs = (long[]) dataSet;
-      final int chunksPerWord = 64 / bitCount;
-      final int word = ordinal / chunksPerWord;
-      final long v = longs[word];
-      final int chunk = ordinal % chunksPerWord;
-      final int mask = (1 << bitCount) - 1;
-      final int signMask = 1 << (bitCount - 1);
-      final int shift = chunk * bitCount;
-      final long w = v >> shift;
-      long x = w & mask;
-      if (signed && (x & signMask) != 0) {
-        x = -x;
-      }
-      return (int) x;
-    }
-
-    public static long getLong(int bitCount, long[] values, int ordinal) {
-      return getLong(
-          bitCount, 64 / bitCount, (1L << bitCount) - 1L,
-          values, ordinal);
-    }
-
-    public static long getLong(
-        int bitCount,
-        int chunksPerWord,
-        long mask,
-        long[] values,
-        int ordinal) {
-      final int word = ordinal / chunksPerWord;
-      final int chunk = ordinal % chunksPerWord;
-      final long value = values[word];
-      final int shift = chunk * bitCount;
-      return (value >> shift) & mask;
-    }
-
-    public static void orLong(
-        int bitCount, long[] values, int ordinal, long value) {
-      orLong(bitCount, 64 / bitCount, values, ordinal, value);
-    }
-
-    public static void orLong(
-        int bitCount, int chunksPerWord, long[] values, int ordinal,
-        long value) {
-      final int word = ordinal / chunksPerWord;
-      final int chunk = ordinal % chunksPerWord;
-      final int shift = chunk * bitCount;
-      values[word] |= value << shift;
-    }
-
-    public int size(Object dataSet) {
-      final long[] longs = (long[]) dataSet;
-      final int chunksPerWord = 64 / bitCount;
-      return longs.length * chunksPerWord; // may be slightly too high
-    }
-
-    public String toString(Object dataSet) {
-      return Column.asList(this, dataSet).toString();
-    }
-  }
-
-  private static <E> List<E> permuteList(
-      final List<E> list, final int[] sources) {
-    if (sources == null) {
-      return list;
-    }
-    return new AbstractList<E>() {
-      public E get(int index) {
-        return list.get(sources[index]);
-      }
-
-      public int size() {
-        return list.size();
-      }
-    };
-  }
-
-  /** Contents of a table. */
-  public static class Content {
-    private final List<Column> columns;
-    private final int size;
-    private final ImmutableList<RelCollation> collations;
-
-    public Content(List<? extends Column> columns, int size,
-        Iterable<? extends RelCollation> collations) {
-      this.columns = ImmutableList.copyOf(columns);
-      this.size = size;
-      this.collations = ImmutableList.copyOf(collations);
-    }
-
-    @Deprecated // to be removed before 2.0
-    public Content(List<? extends Column> columns, int size, int sortField) {
-      this(columns, size,
-          sortField >= 0
-              ? RelCollations.createSingleton(sortField)
-              : ImmutableList.<RelCollation>of());
-    }
-
-    @SuppressWarnings("unchecked")
-    public <T> Enumerator<T> enumerator() {
-      if (columns.size() == 1) {
-        return (Enumerator<T>) new ObjectEnumerator(size, columns.get(0));
-      } else {
-        return (Enumerator<T>) new ArrayEnumerator(size, columns);
-      }
-    }
-
-    public Enumerator<Object[]> arrayEnumerator() {
-      return new ArrayEnumerator(size, columns);
-    }
-
-    /** Enumerator over a table with a single column; each element
-     * returned is an object. */
-    private static class ObjectEnumerator implements Enumerator<Object> {
-      final int rowCount;
-      final Object dataSet;
-      final Representation representation;
-      int i = -1;
-
-      public ObjectEnumerator(int rowCount, Column column) {
-        this.rowCount = rowCount;
-        this.dataSet = column.dataSet;
-        this.representation = column.representation;
-      }
-
-      public Object current() {
-        return representation.getObject(dataSet, i);
-      }
-
-      public boolean moveNext() {
-        return ++i < rowCount;
-      }
-
-      public void reset() {
-        i = -1;
-      }
-
-      public void close() {
-      }
-    }
-
-    /** Enumerator over a table with more than one column; each element
-     * returned is an array. */
-    private static class ArrayEnumerator implements Enumerator<Object[]> {
-      final int rowCount;
-      final List<Column> columns;
-      int i = -1;
-
-      public ArrayEnumerator(int rowCount, List<Column> columns) {
-        this.rowCount = rowCount;
-        this.columns = columns;
-      }
-
-      public Object[] current() {
-        Object[] objects = new Object[columns.size()];
-        for (int j = 0; j < objects.length; j++) {
-          final Column pair = columns.get(j);
-          objects[j] = pair.representation.getObject(pair.dataSet, i);
-        }
-        return objects;
-      }
-
-      public boolean moveNext() {
-        return ++i < rowCount;
-      }
-
-      public void reset() {
-        i = -1;
-      }
-
-      public void close() {
-      }
-    }
-  }
-}
-
-// End ArrayTable.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/clone/CloneSchema.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/clone/CloneSchema.java b/core/src/main/java/org/apache/calcite/adapter/clone/CloneSchema.java
deleted file mode 100644
index afd3798..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/clone/CloneSchema.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.clone;
-
-import org.apache.calcite.adapter.java.JavaTypeFactory;
-import org.apache.calcite.adapter.jdbc.JdbcSchema;
-import org.apache.calcite.avatica.ColumnMetaData;
-import org.apache.calcite.jdbc.CalciteConnection;
-import org.apache.calcite.linq4j.Enumerable;
-import org.apache.calcite.linq4j.QueryProvider;
-import org.apache.calcite.linq4j.Queryable;
-import org.apache.calcite.rel.RelCollation;
-import org.apache.calcite.rel.RelCollations;
-import org.apache.calcite.rel.type.RelProtoDataType;
-import org.apache.calcite.schema.QueryableTable;
-import org.apache.calcite.schema.Schema;
-import org.apache.calcite.schema.SchemaFactory;
-import org.apache.calcite.schema.SchemaPlus;
-import org.apache.calcite.schema.Schemas;
-import org.apache.calcite.schema.Table;
-import org.apache.calcite.schema.impl.AbstractSchema;
-
-import com.google.common.base.Supplier;
-import com.google.common.base.Suppliers;
-import com.google.common.collect.ImmutableList;
-
-import java.lang.reflect.Type;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import static org.apache.calcite.schema.impl.MaterializedViewTable.MATERIALIZATION_CONNECTION;
-
-/**
- * Schema that contains in-memory copies of tables from a JDBC schema.
- */
-public class CloneSchema extends AbstractSchema {
-  // TODO: implement 'driver' property
-  // TODO: implement 'source' property
-  // TODO: test Factory
-
-  private final SchemaPlus sourceSchema;
-
-  /**
-   * Creates a CloneSchema.
-   *
-   * @param sourceSchema JDBC data source
-   */
-  public CloneSchema(SchemaPlus sourceSchema) {
-    super();
-    this.sourceSchema = sourceSchema;
-  }
-
-  @Override protected Map<String, Table> getTableMap() {
-    final Map<String, Table> map = new LinkedHashMap<>();
-    for (String name : sourceSchema.getTableNames()) {
-      final Table table = sourceSchema.getTable(name);
-      if (table instanceof QueryableTable) {
-        final QueryableTable sourceTable = (QueryableTable) table;
-        map.put(name,
-            createCloneTable(MATERIALIZATION_CONNECTION, sourceTable, name));
-      }
-    }
-    return map;
-  }
-
-  private Table createCloneTable(QueryProvider queryProvider,
-      QueryableTable sourceTable, String name) {
-    final Queryable<Object> queryable =
-        sourceTable.asQueryable(queryProvider, sourceSchema, name);
-    final JavaTypeFactory typeFactory =
-        ((CalciteConnection) queryProvider).getTypeFactory();
-    return createCloneTable(typeFactory, Schemas.proto(sourceTable),
-        ImmutableList.<RelCollation>of(), null, queryable);
-  }
-
-  @Deprecated // to be removed before 2.0
-  public static <T> Table createCloneTable(final JavaTypeFactory typeFactory,
-      final RelProtoDataType protoRowType,
-      final List<ColumnMetaData.Rep> repList,
-      final Enumerable<T> source) {
-    return createCloneTable(typeFactory, protoRowType,
-        ImmutableList.<RelCollation>of(), repList, source);
-  }
-
-  public static <T> Table createCloneTable(final JavaTypeFactory typeFactory,
-      final RelProtoDataType protoRowType, final List<RelCollation> collations,
-      final List<ColumnMetaData.Rep> repList, final Enumerable<T> source) {
-    final Type elementType;
-    if (source instanceof QueryableTable) {
-      elementType = ((QueryableTable) source).getElementType();
-    } else if (protoRowType.apply(typeFactory).getFieldCount() == 1) {
-      if (repList != null) {
-        elementType = repList.get(0).clazz;
-      } else {
-        elementType = Object.class;
-      }
-    } else {
-      elementType = Object[].class;
-    }
-    return new ArrayTable(
-        elementType,
-        protoRowType,
-        Suppliers.memoize(
-            new Supplier<ArrayTable.Content>() {
-              public ArrayTable.Content get() {
-                final ColumnLoader loader =
-                    new ColumnLoader<>(typeFactory, source, protoRowType,
-                        repList);
-                final List<RelCollation> collation2 =
-                    collations.isEmpty()
-                        && loader.sortField >= 0
-                        ? RelCollations.createSingleton(loader.sortField)
-                        : collations;
-                return new ArrayTable.Content(loader.representationValues,
-                    loader.size(), collation2);
-              }
-            }));
-  }
-
-  /** Schema factory that creates a
-   * {@link org.apache.calcite.adapter.clone.CloneSchema}.
-   * This allows you to create a clone schema inside a model.json file.
-   *
-   * <pre>{@code
-   * {
-   *   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'
-   *       }
-   *     }
-   *   ]
-   * }
-   * }</pre>
-   */
-  public static class Factory implements SchemaFactory {
-    public Schema create(
-        SchemaPlus parentSchema,
-        String name,
-        Map<String, Object> operand) {
-      SchemaPlus schema =
-          parentSchema.add(name,
-              JdbcSchema.create(parentSchema, name + "$source", operand));
-      return new CloneSchema(schema);
-    }
-  }
-}
-
-// End CloneSchema.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/clone/ColumnLoader.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/clone/ColumnLoader.java b/core/src/main/java/org/apache/calcite/adapter/clone/ColumnLoader.java
deleted file mode 100644
index d33ee61..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/clone/ColumnLoader.java
+++ /dev/null
@@ -1,476 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.clone;
-
-import org.apache.calcite.adapter.java.JavaTypeFactory;
-import org.apache.calcite.avatica.ColumnMetaData;
-import org.apache.calcite.avatica.util.DateTimeUtils;
-import org.apache.calcite.linq4j.Enumerable;
-import org.apache.calcite.linq4j.Ord;
-import org.apache.calcite.linq4j.tree.Primitive;
-import org.apache.calcite.rel.type.RelDataType;
-import org.apache.calcite.rel.type.RelDataTypeField;
-import org.apache.calcite.rel.type.RelProtoDataType;
-
-import com.google.common.base.Function;
-import com.google.common.collect.Lists;
-
-import java.lang.reflect.Type;
-import java.sql.Date;
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.util.AbstractList;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Column loader.
- *
- * @param <T> Element type of source table
- */
-class ColumnLoader<T> {
-  static final int[] INT_B = {0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000};
-  static final int[] INT_S = {1, 2, 4, 8, 16};
-  static final long[] LONG_B = {
-    0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000, 0xFFFFFFFF00000000L};
-  static final int[] LONG_S = {1, 2, 4, 8, 16, 32};
-
-  private static final Function<Timestamp, Long> TIMESTAMP_TO_LONG =
-      new Function<Timestamp, Long>() {
-        public Long apply(Timestamp a0) {
-          return a0 == null ? null : a0.getTime();
-        }
-      };
-
-  private static final Function<Time, Integer> TIME_TO_INT =
-      new Function<Time, Integer>() {
-        public Integer apply(Time a0) {
-          return a0 == null
-              ? null
-              : (int) (a0.getTime() % DateTimeUtils.MILLIS_PER_DAY);
-        }
-      };
-
-  private static final Function<Date, Integer> DATE_TO_INT =
-      new Function<Date, Integer>() {
-        public Integer apply(Date a0) {
-          return a0 == null
-              ? null
-              : (int) (a0.getTime() / DateTimeUtils.MILLIS_PER_DAY);
-        }
-      };
-
-  public final List<T> list = new ArrayList<>();
-  public final List<ArrayTable.Column> representationValues = new ArrayList<>();
-  private final JavaTypeFactory typeFactory;
-  public final int sortField;
-
-  /** Creates a column loader, and performs the load.
-   *
-   * @param typeFactory Type factory
-   * @param sourceTable Source data
-   * @param protoRowType Logical row type
-   * @param repList Physical row types, or null if not known */
-  ColumnLoader(JavaTypeFactory typeFactory,
-      Enumerable<T> sourceTable,
-      RelProtoDataType protoRowType,
-      List<ColumnMetaData.Rep> repList) {
-    this.typeFactory = typeFactory;
-    final RelDataType rowType = protoRowType.apply(typeFactory);
-    if (repList == null) {
-      repList =
-          Collections.nCopies(rowType.getFieldCount(),
-              ColumnMetaData.Rep.OBJECT);
-    }
-    sourceTable.into(list);
-    final int[] sorts = {-1};
-    load(rowType, repList, sorts);
-    this.sortField = sorts[0];
-  }
-
-  static int nextPowerOf2(int v) {
-    v--;
-    v |= v >>> 1;
-    v |= v >>> 2;
-    v |= v >>> 4;
-    v |= v >>> 8;
-    v |= v >>> 16;
-    v++;
-    return v;
-  }
-
-  static long nextPowerOf2(long v) {
-    v--;
-    v |= v >>> 1;
-    v |= v >>> 2;
-    v |= v >>> 4;
-    v |= v >>> 8;
-    v |= v >>> 16;
-    v |= v >>> 32;
-    v++;
-    return v;
-  }
-
-  static int log2(int v) {
-    int r = 0;
-    for (int i = 4; i >= 0; i--) {
-      if ((v & INT_B[i]) != 0) {
-        v >>= INT_S[i];
-        r |= INT_S[i];
-      }
-    }
-    return r;
-  }
-
-  static int log2(long v) {
-    int r = 0;
-    for (int i = 5; i >= 0; i--) {
-      if ((v & LONG_B[i]) != 0) {
-        v >>= LONG_S[i];
-        r |= LONG_S[i];
-      }
-    }
-    return r;
-  }
-
-  static int[] invert(int[] targets) {
-    final int[] sources = new int[targets.length];
-    for (int i = 0; i < targets.length; i++) {
-      sources[targets[i]] = i;
-    }
-    return sources;
-  }
-
-  static boolean isIdentity(int[] sources) {
-    for (int i = 0; i < sources.length; i++) {
-      if (sources[i] != i) {
-        return false;
-      }
-    }
-    return true;
-  }
-
-  public int size() {
-    return list.size();
-  }
-
-  private void load(final RelDataType elementType,
-      List<ColumnMetaData.Rep> repList, int[] sort) {
-    final List<Type> types =
-        new AbstractList<Type>() {
-          final List<RelDataTypeField> fields =
-              elementType.getFieldList();
-          public Type get(int index) {
-            return typeFactory.getJavaClass(
-                fields.get(index).getType());
-          }
-
-          public int size() {
-            return fields.size();
-          }
-        };
-    int[] sources = null;
-    for (final Ord<Type> pair : Ord.zip(types)) {
-      @SuppressWarnings("unchecked")
-      final List<?> sliceList =
-          types.size() == 1
-              ? list
-              : new AbstractList<Object>() {
-                final int slice = pair.i;
-
-                public Object get(int index) {
-                  return ((Object[]) list.get(index))[slice];
-                }
-
-                public int size() {
-                  return list.size();
-                }
-              };
-      final List<?> list2 =
-          wrap(
-              repList.get(pair.i),
-              sliceList,
-              elementType.getFieldList().get(pair.i).getType());
-      final Class clazz = pair.e instanceof Class
-          ? (Class) pair.e
-          : Object.class;
-      ValueSet valueSet = new ValueSet(clazz);
-      for (Object o : list2) {
-        valueSet.add((Comparable) o);
-      }
-      if (sort != null
-          && sort[0] < 0
-          && valueSet.map.keySet().size() == list.size()) {
-        // We have discovered a the first unique key in the table.
-        sort[0] = pair.i;
-        final Comparable[] values =
-            valueSet.values.toArray(new Comparable[list.size()]);
-        final Kev[] kevs = new Kev[list.size()];
-        for (int i = 0; i < kevs.length; i++) {
-          kevs[i] = new Kev(i, values[i]);
-        }
-        Arrays.sort(kevs);
-        sources = new int[list.size()];
-        for (int i = 0; i < sources.length; i++) {
-          sources[i] = kevs[i].source;
-        }
-
-        if (isIdentity(sources)) {
-          // Table was already sorted. Clear the permutation.
-          // We've already set sort[0], so we won't check for another
-          // sorted column.
-          sources = null;
-        } else {
-          // Re-sort all previous columns.
-          for (int i = 0; i < pair.i; i++) {
-            representationValues.set(
-                i, representationValues.get(i).permute(sources));
-          }
-        }
-      }
-      representationValues.add(valueSet.freeze(pair.i, sources));
-    }
-  }
-
-  /** Adapt for some types that we represent differently internally than their
-   * JDBC types. {@link java.sql.Timestamp} values that are not null are
-   * converted to {@code long}, but nullable timestamps are acquired using
-   * {@link java.sql.ResultSet#getObject(int)} and therefore the Timestamp
-   * value needs to be converted to a {@link Long}. Similarly
-   * {@link java.sql.Date} and {@link java.sql.Time} values to
-   * {@link Integer}. */
-  private static List wrap(ColumnMetaData.Rep rep, List list,
-      RelDataType type) {
-    switch (type.getSqlTypeName()) {
-    case TIMESTAMP:
-      switch (rep) {
-      case OBJECT:
-      case JAVA_SQL_TIMESTAMP:
-        return Lists.transform(list, TIMESTAMP_TO_LONG);
-      }
-      break;
-    case TIME:
-      switch (rep) {
-      case OBJECT:
-      case JAVA_SQL_TIME:
-        return Lists.transform(list, TIME_TO_INT);
-      }
-      break;
-    case DATE:
-      switch (rep) {
-      case OBJECT:
-      case JAVA_SQL_DATE:
-        return Lists.transform(list, DATE_TO_INT);
-      }
-      break;
-    }
-    return list;
-  }
-
-  /**
-   * Set of values of a column, created during the load process, and converted
-   * to a serializable (and more compact) form before load completes.
-   */
-  static class ValueSet {
-    final Class clazz;
-    final Map<Comparable, Comparable> map = new HashMap<>();
-    final List<Comparable> values = new ArrayList<>();
-    Comparable min;
-    Comparable max;
-    boolean containsNull;
-
-    ValueSet(Class clazz) {
-      this.clazz = clazz;
-    }
-
-    void add(Comparable e) {
-      if (e != null) {
-        final Comparable old = e;
-        e = map.get(e);
-        if (e == null) {
-          e = old;
-          map.put(e, e);
-          //noinspection unchecked
-          if (min == null || min.compareTo(e) > 0) {
-            min = e;
-          }
-          //noinspection unchecked
-          if (max == null || max.compareTo(e) < 0) {
-            max = e;
-          }
-        }
-      } else {
-        containsNull = true;
-      }
-      values.add(e);
-    }
-
-    /** Freezes the contents of this value set into a column, optionally
-     * re-ordering if {@code sources} is specified. */
-    ArrayTable.Column freeze(int ordinal, int[] sources) {
-      ArrayTable.Representation representation = chooseRep(ordinal);
-      final int cardinality = map.size() + (containsNull ? 1 : 0);
-      final Object data = representation.freeze(this, sources);
-      return new ArrayTable.Column(representation, data, cardinality);
-    }
-
-    ArrayTable.Representation chooseRep(int ordinal) {
-      Primitive primitive = Primitive.of(clazz);
-      Primitive boxPrimitive = Primitive.ofBox(clazz);
-      Primitive p = primitive != null ? primitive : boxPrimitive;
-      if (!containsNull && p != null) {
-        switch (p) {
-        case FLOAT:
-        case DOUBLE:
-          return new ArrayTable.PrimitiveArray(ordinal, p, p);
-        case OTHER:
-        case VOID:
-          throw new AssertionError("wtf?!");
-        }
-        if (canBeLong(min) && canBeLong(max)) {
-          return chooseFixedRep(
-              ordinal, p, toLong(min), toLong(max));
-        }
-      }
-
-      // We don't want to use a dictionary if:
-      // (a) there are so many values that an object pointer (with one
-      //     indirection) has about as many bits as a code (with two
-      //     indirections); or
-      // (b) if there are very few copies of each value.
-      // The condition kind of captures this, but needs to be tuned.
-      final int codeCount = map.size() + (containsNull ? 1 : 0);
-      final int codeBitCount = log2(nextPowerOf2(codeCount));
-      if (codeBitCount < 10 && values.size() > 2000) {
-        final ArrayTable.Representation representation =
-            chooseFixedRep(-1, Primitive.INT, 0, codeCount - 1);
-        return new ArrayTable.ObjectDictionary(ordinal, representation);
-      }
-      return new ArrayTable.ObjectArray(ordinal);
-    }
-
-    private long toLong(Object o) {
-      // We treat Boolean and Character as if they were subclasses of
-      // Number but actually they are not.
-      if (o instanceof Boolean) {
-        return (Boolean) o ? 1 : 0;
-      } else if (o instanceof Character) {
-        return (long) (Character) o;
-      } else {
-        return ((Number) o).longValue();
-      }
-    }
-
-    private boolean canBeLong(Object o) {
-      return o instanceof Boolean
-          || o instanceof Character
-          || o instanceof Number;
-    }
-
-    /** Chooses a representation for a fixed-precision primitive type
-     * (boolean, byte, char, short, int, long).
-     *
-     * @param ordinal Ordinal of this column in table
-     * @param p Type that values are to be returned as (not necessarily the
-     *     same as they will be stored)
-     * @param min Minimum value to be encoded
-     * @param max Maximum value to be encoded (inclusive)
-     */
-    private ArrayTable.Representation chooseFixedRep(
-        int ordinal, Primitive p, long min, long max) {
-      if (min == max) {
-        return new ArrayTable.Constant(ordinal);
-      }
-      final int bitCountMax = log2(nextPowerOf2(abs2(max) + 1));
-      int bitCount; // 1 for sign
-      boolean signed;
-
-      if (min >= 0) {
-        signed = false;
-        bitCount = bitCountMax;
-      } else {
-        signed = true;
-        int bitCountMin = log2(nextPowerOf2(abs2(min) + 1));
-        bitCount = Math.max(bitCountMin, bitCountMax) + 1;
-      }
-
-      // Must be a fixed point primitive.
-      if (bitCount > 21 && bitCount < 32) {
-        // Can't get more than 2 into a word.
-        signed = true;
-        bitCount = 32;
-      }
-      if (bitCount >= 33 && bitCount < 64) {
-        // Can't get more than one into a word.
-        signed = true;
-        bitCount = 64;
-      }
-      if (signed) {
-        switch (bitCount) {
-        case 8:
-          return new ArrayTable.PrimitiveArray(
-              ordinal, Primitive.BYTE, p);
-        case 16:
-          return new ArrayTable.PrimitiveArray(
-              ordinal, Primitive.SHORT, p);
-        case 32:
-          return new ArrayTable.PrimitiveArray(
-              ordinal, Primitive.INT, p);
-        case 64:
-          return new ArrayTable.PrimitiveArray(
-              ordinal, Primitive.LONG, p);
-        }
-      }
-      return new ArrayTable.BitSlicedPrimitiveArray(
-          ordinal, bitCount, p, signed);
-    }
-
-    /** Two's complement absolute on int value. */
-    private static int abs2(int v) {
-      // -128 becomes +127
-      return v < 0 ? ~v : v;
-    }
-
-    /** Two's complement absolute on long value. */
-    private static long abs2(long v) {
-      // -128 becomes +127
-      return v < 0 ? ~v : v;
-    }
-  }
-
-  /** Key-value pair. */
-  private static class Kev implements Comparable<Kev> {
-    private final int source;
-    private final Comparable key;
-
-    public Kev(int source, Comparable key) {
-      this.source = source;
-      this.key = key;
-    }
-
-    public int compareTo(Kev o) {
-      //noinspection unchecked
-      return key.compareTo(o.key);
-    }
-  }
-}
-
-// End ColumnLoader.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/clone/ListTable.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/clone/ListTable.java b/core/src/main/java/org/apache/calcite/adapter/clone/ListTable.java
deleted file mode 100644
index e75fb07..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/clone/ListTable.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.clone;
-
-import org.apache.calcite.adapter.java.AbstractQueryableTable;
-import org.apache.calcite.linq4j.AbstractQueryable;
-import org.apache.calcite.linq4j.Enumerator;
-import org.apache.calcite.linq4j.Linq4j;
-import org.apache.calcite.linq4j.QueryProvider;
-import org.apache.calcite.linq4j.Queryable;
-import org.apache.calcite.linq4j.tree.Expression;
-import org.apache.calcite.rel.type.RelDataType;
-import org.apache.calcite.rel.type.RelDataTypeFactory;
-import org.apache.calcite.rel.type.RelProtoDataType;
-import org.apache.calcite.schema.SchemaPlus;
-import org.apache.calcite.schema.Statistic;
-import org.apache.calcite.schema.Statistics;
-import org.apache.calcite.util.ImmutableBitSet;
-
-import com.google.common.collect.ImmutableList;
-
-import java.lang.reflect.Type;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * Implementation of table that reads rows from a read-only list and returns
- * an enumerator of rows. Each row is object (if there is just one column) or
- * an object array (if there are multiple columns).
- */
-class ListTable extends AbstractQueryableTable {
-  private final RelProtoDataType protoRowType;
-  private final Expression expression;
-  private final List list;
-
-  /** Creates a ListTable. */
-  public ListTable(
-      Type elementType,
-      RelProtoDataType protoRowType,
-      Expression expression,
-      List list) {
-    super(elementType);
-    this.protoRowType = protoRowType;
-    this.expression = expression;
-    this.list = list;
-  }
-
-  public RelDataType getRowType(RelDataTypeFactory typeFactory) {
-    return protoRowType.apply(typeFactory);
-  }
-
-  public Statistic getStatistic() {
-    return Statistics.of(list.size(), ImmutableList.<ImmutableBitSet>of());
-  }
-
-  public <T> Queryable<T> asQueryable(final QueryProvider queryProvider,
-      SchemaPlus schema, String tableName) {
-    return new AbstractQueryable<T>() {
-      public Type getElementType() {
-        return elementType;
-      }
-
-      public Expression getExpression() {
-        return expression;
-      }
-
-      public QueryProvider getProvider() {
-        return queryProvider;
-      }
-
-      public Iterator<T> iterator() {
-        //noinspection unchecked
-        return list.iterator();
-      }
-
-      public Enumerator<T> enumerator() {
-        //noinspection unchecked
-        return Linq4j.enumerator(list);
-      }
-    };
-  }
-}
-
-// End ListTable.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/clone/package-info.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/clone/package-info.java b/core/src/main/java/org/apache/calcite/adapter/clone/package-info.java
deleted file mode 100644
index e7f4b89..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/clone/package-info.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * Provides utility classes.
- */
-@PackageMarker
-package org.apache.calcite.adapter.clone;
-
-import org.apache.calcite.avatica.util.PackageMarker;
-
-// End package-info.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/AggAddContext.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/AggAddContext.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/AggAddContext.java
deleted file mode 100644
index 4da0447..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/AggAddContext.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.linq4j.tree.Expression;
-import org.apache.calcite.rex.RexNode;
-
-import java.util.List;
-
-/**
- * Information for a call to
- * {@link org.apache.calcite.adapter.enumerable.AggImplementor#implementAdd(AggContext, AggAddContext)}.
- *
- * <p>Typically, the aggregation implementation will use {@link #arguments()}
- * or {@link #rexArguments()} to update aggregate value.
- */
-public interface AggAddContext extends AggResultContext {
-  /**
-   * Returns {@link org.apache.calcite.rex.RexNode} representation of arguments.
-   * This can be useful for manual translation of required arguments with
-   * different {@link NullPolicy}.
-   * @return {@link org.apache.calcite.rex.RexNode} representation of arguments
-   */
-  List<RexNode> rexArguments();
-
-  /**
-   * Returns {@link org.apache.calcite.rex.RexNode} representation of the
-   * filter, or null.
-   */
-  RexNode rexFilterArgument();
-
-  /**
-   * Returns Linq4j form of arguments.
-   * The resulting value is equivalent to
-   * {@code rowTranslator().translateList(rexArguments())}.
-   * This is handy if you need just operate on argument.
-   * @return Linq4j form of arguments.
-   */
-  List<Expression> arguments();
-
-  /**
-   * Returns a
-   * {@link org.apache.calcite.adapter.enumerable.RexToLixTranslator}
-   * suitable to transform the arguments.
-   *
-   * @return {@link RexToLixTranslator} suitable to transform the arguments
-   */
-  RexToLixTranslator rowTranslator();
-}
-
-// End AggAddContext.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/AggContext.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/AggContext.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/AggContext.java
deleted file mode 100644
index 542e3a2..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/AggContext.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.rel.type.RelDataType;
-import org.apache.calcite.sql.SqlAggFunction;
-
-import java.lang.reflect.Type;
-import java.util.List;
-
-/**
- * Information on the aggregate calculation context.
- * {@link AggAddContext} provides basic static information on types of arguments
- * and the return value of the aggregate being implemented.
- */
-public interface AggContext {
-  /**
-   * Returns the aggregation being implemented.
-   * @return aggregation being implemented.
-   */
-  SqlAggFunction aggregation();
-
-  /**
-   * Returns the return type of the aggregate as
-   * {@link org.apache.calcite.rel.type.RelDataType}.
-   * This can be helpful to test
-   * {@link org.apache.calcite.rel.type.RelDataType#isNullable()}.
-   *
-   * @return return type of the aggregate
-   */
-  RelDataType returnRelType();
-
-  /**
-   * Returns the return type of the aggregate as {@link java.lang.reflect.Type}.
-   * @return return type of the aggregate as {@link java.lang.reflect.Type}
-   */
-  Type returnType();
-
-  /**
-   * Returns the parameter types of the aggregate as
-   * {@link org.apache.calcite.rel.type.RelDataType}.
-   * This can be helpful to test
-   * {@link org.apache.calcite.rel.type.RelDataType#isNullable()}.
-   *
-   * @return Parameter types of the aggregate
-   */
-  List<? extends RelDataType> parameterRelTypes();
-
-  /**
-   * Returns the parameter types of the aggregate as
-   * {@link java.lang.reflect.Type}.
-   *
-   * @return Parameter types of the aggregate
-   */
-  List<? extends Type> parameterTypes();
-}
-
-// End AggContext.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/AggImpState.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/AggImpState.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/AggImpState.java
deleted file mode 100644
index b100cec..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/AggImpState.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.linq4j.tree.Expression;
-import org.apache.calcite.rel.core.AggregateCall;
-
-import java.util.List;
-
-/**
- * Represents internal state when implementing aggregate functions.
- */
-public class AggImpState {
-  public final int aggIdx;
-  public final AggregateCall call;
-  public final AggImplementor implementor;
-  public AggContext context;
-  public Expression result;
-  public List<Expression> state;
-
-  public AggImpState(int aggIdx, AggregateCall call, boolean windowContext) {
-    this.aggIdx = aggIdx;
-    this.call = call;
-    this.implementor =
-        RexImpTable.INSTANCE.get(call.getAggregation(), windowContext);
-    if (implementor == null) {
-      throw new IllegalArgumentException(
-          "Unable to get aggregate implementation for aggregate "
-          + call.getAggregation()
-          + (windowContext ? " in window context" : ""));
-    }
-  }
-}
-
-// End AggImpState.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/AggImplementor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/AggImplementor.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/AggImplementor.java
deleted file mode 100644
index 9c18376..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/AggImplementor.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.linq4j.tree.Expression;
-
-import java.lang.reflect.Type;
-import java.util.List;
-
-/**
- * Implements an aggregate function by generating expressions to
- * initialize, add to, and get a result from, an accumulator.
- *
- * @see org.apache.calcite.adapter.enumerable.StrictAggImplementor
- * @see org.apache.calcite.adapter.enumerable.StrictWinAggImplementor
- * @see org.apache.calcite.adapter.enumerable.RexImpTable.CountImplementor
- * @see org.apache.calcite.adapter.enumerable.RexImpTable.SumImplementor
- */
-public interface AggImplementor {
-  /**
-   * Returns the types of the intermediate variables used by the aggregate
-   * implementation.
-   *
-   * <p>For instance, for "concatenate to string" this can be
-   * {@link java.lang.StringBuilder}.
-   * Calcite calls this method before all other {@code implement*} methods.
-   *
-   * @param info Aggregate context
-   * @return Types of the intermediate variables used by the aggregate
-   *   implementation
-   */
-  List<Type> getStateType(AggContext info);
-
-  /**
-   * Implements reset of the intermediate variables to the initial state.
-   * {@link AggResetContext#accumulator()} should be used to reference
-   * the state variables.
-   * For instance, to zero the count, use the following code:
-   *
-   * <blockquote><code>reset.currentBlock().add(<br>
-   *   Expressions.statement(<br>
-   *     Expressions.assign(reset.accumulator().get(0),<br>
-   *       Expressions.constant(0)));</code></blockquote>
-   *
-   * @param info Aggregate context
-   * @param reset Reset context
-   */
-  void implementReset(AggContext info, AggResetContext reset);
-
-  /**
-   * Updates intermediate values to account for the newly added value.
-   * {@link AggResetContext#accumulator()} should be used to reference
-   * the state variables.
-   *
-   * @param info Aggregate context
-   * @param add Add context
-   */
-  void implementAdd(AggContext info, AggAddContext add);
-
-  /**
-   * Calculates the resulting value based on the intermediate variables.
-   * Note: this method must NOT destroy the intermediate variables as
-   * calcite might reuse the state when calculating sliding aggregates.
-   * {@link AggResetContext#accumulator()} should be used to reference
-   * the state variables.
-   *
-   * @param info Aggregate context
-   * @param result Result context
-   * @return Expression that is a result of calculating final value of
-   *   the aggregate being implemented
-   */
-  Expression implementResult(AggContext info, AggResultContext result);
-}
-
-// End AggImplementor.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/AggResetContext.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/AggResetContext.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/AggResetContext.java
deleted file mode 100644
index b3efb21..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/AggResetContext.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.linq4j.tree.Expression;
-
-import java.util.List;
-
-/**
- * Information for a call to
- * {@link AggImplementor#implementReset(AggContext, AggResetContext)}.
- *
- * {@link AggResetContext} provides access to the accumulator variables
- * that should be reset.
- */
-public interface AggResetContext extends NestedBlockBuilder {
-  /**
-   * Returns accumulator variables that should be reset.
-   * There MUST be an assignment even if you just assign the default value.
-   *
-   * @return accumulator variables that should be reset or empty list when no
-   *   accumulator variables are used by the aggregate implementation.
-   *
-   * @see AggImplementor#getStateType(org.apache.calcite.adapter.enumerable.AggContext)
-   */
-  List<Expression> accumulator();
-}
-
-// End AggResetContext.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/AggResultContext.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/AggResultContext.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/AggResultContext.java
deleted file mode 100644
index fe7ee06..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/AggResultContext.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-/**
- * Information for a call to
- * {@link AggImplementor#implementResult(AggContext, AggResultContext)}
- *
- * <p>Typically, the aggregation implementation will convert
- * {@link #accumulator()} to the resulting value of the aggregation.  The
- * implementation MUST NOT destroy the contents of {@link #accumulator()}.
- */
-public interface AggResultContext extends NestedBlockBuilder, AggResetContext {
-}
-
-// End AggResultContext.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/core/src/main/java/org/apache/calcite/adapter/enumerable/CallImplementor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/CallImplementor.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/CallImplementor.java
deleted file mode 100644
index a258082..0000000
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/CallImplementor.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.linq4j.tree.Expression;
-import org.apache.calcite.rex.RexCall;
-
-/**
- * Implements a call via given translator.
- *
- * @see org.apache.calcite.schema.ScalarFunction
- * @see org.apache.calcite.schema.TableFunction
- * @see org.apache.calcite.adapter.enumerable.RexImpTable
- */
-public interface CallImplementor {
-  /**
-   * Implements a call.
-   *
-   * @param translator Translator for the call
-   * @param call Call that should be implemented
-   * @param nullAs The desired mode of {@code null} translation
-   * @return Translated call
-   */
-  Expression implement(
-      RexToLixTranslator translator,
-      RexCall call,
-      RexImpTable.NullAs nullAs);
-}
-
-// End CallImplementor.java


[44/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/SqlState.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/SqlState.java b/avatica/core/src/main/java/org/apache/calcite/avatica/SqlState.java
deleted file mode 100644
index 9f967aa..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/SqlState.java
+++ /dev/null
@@ -1,1861 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import java.io.BufferedWriter;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.nio.charset.StandardCharsets;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * SQL error codes.
- *
- * <p>Based upon Table 33 &mdash; SQLSTATE class and subclass values in
- * SQL:2014 section 24.1, which is as follows.
- *
- * <table border=1>
- * <caption>Table 33 &mdash; SQLSTATE class and subclass values</caption>
- * <tr>
- *   <th>Category</th>
- *   <th>Condition</th>
- *   <th>Class</th>
- *   <th>Subcondition</th>
- *   <th>Subclass</th>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>ambiguous cursor name</td>
- *   <td>3C</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>attempt to assign to non-updatable column</td>
- *   <td>0U</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>attempt to assign to ordering column</td>
- *   <td>0V</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>cli specific condition</td>
- *   <td>HY</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>cardinality violation</td>
- *   <td>21</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>connection exception</td>
- *   <td>08</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>connection does not exist</td>
- *   <td>003</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>connection failure</td>
- *   <td>006</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>connection name in use</td>
- *   <td>002</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>SQL-client unable to establish SQL-connection</td>
- *   <td>001</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>SQL-server rejected establishment of SQL-connection</td>
- *   <td>004</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>transaction resolution unknown</td>
- *   <td>007</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>cursor sensitivity exception</td>
- *   <td>36</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>request failed</td>
- *   <td>002</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>request rejected</td>
- *   <td>001</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>data exception</td>
- *   <td>22</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>array data, right truncation</td>
- *   <td>02F</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>array element error</td>
- *   <td>02E</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>attempt to replace a zero-length string</td>
- *   <td>01U</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>character not in repertoire</td>
- *   <td>021</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>datetime field overflow</td>
- *   <td>008</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>division by zero</td>
- *   <td>012</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>error in assignment</td>
- *   <td>005</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>escape character conflict</td>
- *   <td>00B</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>indicator overflow</td>
- *   <td>022</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>interval field overflow</td>
- *   <td>015</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>interval value out of range</td>
- *   <td>00P</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>invalid argument for natural logarithm</td>
- *   <td>01E</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>invalid argument for NTILE function</td>
- *   <td>014</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>invalid argument for NTH_VALUE function</td>
- *   <td>016</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>invalid argument for power function</td>
- *   <td>01F</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>invalid argument for row pattern navigation operation</td>
- *   <td>02J</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>invalid argument for width bucket function</td>
- *   <td>01G</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>invalid character value for cast</td>
- *   <td>018</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>invalid datetime format</td>
- *   <td>007</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>invalid escape character</td>
- *   <td>019</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>invalid escape octet</td>
- *   <td>00D</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>invalid escape sequence</td>
- *   <td>025</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>invalid indicator parameter value</td>
- *   <td>010</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>invalid interval format</td>
- *   <td>006</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>invalid parameter value</td>
- *   <td>023</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>invalid period value</td>
- *   <td>020</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>invalid preceding or following size in window function</td>
- *   <td>013</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>invalid regular expression</td>
- *   <td>01B</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>invalid repeat argument in a sample clause</td>
- *   <td>02G</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>invalid row count in fetch first clause</td>
- *   <td>01W</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>invalid row count in result offset clause</td>
- *   <td>01X</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>invalid row version</td>
- *   <td>01H</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>invalid sample size</td>
- *   <td>02H</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>invalid time zone displacement value</td>
- *   <td>009</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>invalid use of escape character</td>
- *   <td>00C</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>invalid XQuery option flag</td>
- *   <td>01T</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>invalid XQuery regular expression</td>
- *   <td>01S</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>invalid XQuery replacement string</td>
- *   <td>01V</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>most specific type mismatch</td>
- *   <td>00G</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>multiset value overflow</td>
- *   <td>00Q</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>noncharacter in UCS string</td>
- *   <td>029</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>null value substituted for mutator subject parameter</td>
- *   <td>02D</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>null row not permitted in table</td>
- *   <td>01C</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>null value in array target</td>
- *   <td>00E</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>null value, no indicator parameter</td>
- *   <td>002</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>null value not allowed</td>
- *   <td>004</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>numeric value out of range</td>
- *   <td>003</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>sequence generator limit exceeded</td>
- *   <td>00H</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>skip to non-existent row</td>
- *   <td>02K</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>skip to first row of match</td>
- *   <td>02L</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>string data, length mismatch</td>
- *   <td>026</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>string data, right truncation</td>
- *   <td>001</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>substring error</td>
- *   <td>011</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>trim error</td>
- *   <td>027</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>unterminated C string</td>
- *   <td>024</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>zero-length character string</td>
- *   <td>00F</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>dependent privilege descriptors still exist</td>
- *   <td>2B</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>diagnostics exception</td>
- *   <td>0Z</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>maximum number of stacked diagnostics areas exceeded</td>
- *   <td>001</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>dynamic SQL error</td>
- *   <td>07</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>cursor specification cannot be executed</td>
- *   <td>003</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>data type transform function violation</td>
- *   <td>00B</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>invalid DATA target</td>
- *   <td>00D</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>invalid DATETIME_INTERVAL_CODE</td>
- *   <td>00F</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>invalid descriptor count</td>
- *   <td>008</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>invalid descriptor index</td>
- *   <td>009</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>invalid LEVEL value</td>
- *   <td>00E</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>prepared statement not a cursor specification</td>
- *   <td>005</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>restricted data type attribute violation</td>
- *   <td>006</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>undefined DATA value</td>
- *   <td>00C</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>using clause does not match dynamic parameter specifications</td>
- *   <td>001</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>using clause does not match target specifications</td>
- *   <td>002</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>using clause required for dynamic parameters</td>
- *   <td>004</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>using clause required for result fields</td>
- *   <td>007</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>external routine exception</td>
- *   <td>38</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>containing SQL not permitted</td>
- *   <td>001</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>modifying SQL-data not permitted</td>
- *   <td>002</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>prohibited SQL-statement attempted</td>
- *   <td>003</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>reading SQL-data not permitted</td>
- *   <td>004</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>external routine invocation exception</td>
- *   <td>39</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>null value not allowed</td>
- *   <td>004</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>feature not supported</td>
- *   <td>0A</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>multiple server transactions</td>
- *   <td>001</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>integrity constraint violation</td>
- *   <td>23</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>restrict violation</td>
- *   <td>001</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>invalid authorization specification</td>
- *   <td>28</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>invalid catalog name</td>
- *   <td>3D</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>invalid character set name</td>
- *   <td>2C</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>cannot drop SQL-session default character set</td>
- *   <td>001</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>invalid condition number</td>
- *   <td>35</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>invalid connection name</td>
- *   <td>2E</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>invalid cursor name</td>
- *   <td>34</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>invalid cursor state</td>
- *   <td>24</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>invalid grantor</td>
- *   <td>0L</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>invalid role specification</td>
- *   <td>0P</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>invalid schema name</td>
- *   <td>3F</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>invalid schema name list specification</td>
- *   <td>0E</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>invalid collation name</td>
- *   <td>2H</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>invalid SQL descriptor name</td>
- *   <td>33</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>invalid SQL-invoked procedure reference</td>
- *   <td>0M</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>invalid SQL statement name</td>
- *   <td>26</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>invalid SQL statement identifier</td>
- *   <td>30</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>invalid target type specification</td>
- *   <td>0D</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>invalid transaction state</td>
- *   <td>25</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>active SQL-transaction</td>
- *   <td>001</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>branch transaction already active</td>
- *   <td>002</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>held cursor requires same isolation level</td>
- *   <td>008</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>inappropriate access mode for branch transaction</td>
- *   <td>003</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>inappropriate isolation level for branch transaction</td>
- *   <td>004</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>no active SQL-transaction for branch transaction</td>
- *   <td>005</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>read-only SQL-transaction</td>
- *   <td>006</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>schema and data statement mixing not supported</td>
- *   <td>007</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>invalid transaction termination</td>
- *   <td>2D</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>invalid transform group name specification</td>
- *   <td>0S</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>locator exception</td>
- *   <td>0F</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>invalid specification</td>
- *   <td>001</td>
- * </tr>
- * <tr>
- *   <td>N</td>
- *   <td>no data</td>
- *   <td>02</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>no additional result sets returned</td>
- *   <td>001</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>prohibited statement encountered during trigger execution</td>
- *   <td>0W</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>modify table modified by data change delta table</td>
- *   <td>001</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>Remote Database Access</td>
- *   <td>HZ</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>savepoint exception</td>
- *   <td>3B</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>invalid specification</td>
- *   <td>001</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>too many</td>
- *   <td>002</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>SQL routine exception</td>
- *   <td>2F</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>function executed no return statement</td>
- *   <td>005</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>modifying SQL-data not permitted</td>
- *   <td>002</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>prohibited SQL-statement attempted</td>
- *   <td>003</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>reading SQL-data not permitted</td>
- *   <td>004</td>
- * </tr>
- * <tr>
- *   <td>S</td>
- *   <td>successful completion</td>
- *   <td>00</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>syntax error or access rule violation</td>
- *   <td>42</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>syntax error or access rule violation in direct statement</td>
- *   <td>2A</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>syntax error or access rule violation in dynamic statement</td>
- *   <td>37</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>target table disagrees with cursor specification</td>
- *   <td>0T</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>transaction rollback</td>
- *   <td>40</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>integrity constraint violation</td>
- *   <td>002</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>serialization failure</td>
- *   <td>001</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>statement completion unknown</td>
- *   <td>003</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>triggered action exception</td>
- *   <td>004</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>triggered action exception</td>
- *   <td>09</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>triggered data change violation</td>
- *   <td>27</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>modify table modified by data change delta table</td>
- *   <td>001</td>
- * </tr>
- * <tr>
- *   <td>W</td>
- *   <td>warning</td>
- *   <td>01</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>additional result sets returned</td>
- *   <td>00D</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>array data, right truncation</td>
- *   <td>02F</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>attempt to return too many result sets</td>
- *   <td>00E</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>cursor operation conflict</td>
- *   <td>001</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>default value too long for information schema</td>
- *   <td>00B</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>disconnect error</td>
- *   <td>002</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>insufficient item descriptor areas</td>
- *   <td>005</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>invalid number of conditions</td>
- *   <td>012</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>null value eliminated in set function</td>
- *   <td>003</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>privilege not granted</td>
- *   <td>007</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>privilege not revoked</td>
- *   <td>006</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>query expression too long for information schema</td>
- *   <td>00A</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>result sets returned</td>
- *   <td>00C</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>search condition too long for information schema</td>
- *   <td>009</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>statement too long for information schema</td>
- *   <td>00F</td>
- * </tr>
- * <tr>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>&nbsp;</td>
- *   <td>string data, right truncation</td>
- *   <td>004</td>
- * </tr>
- * <tr>
- *   <td>X</td>
- *   <td>with check option violation</td>
- *   <td>44</td>
- *   <td>(no subclass)</td>
- *   <td>000</td>
- * </tr>
- * </table>
- */
-public enum SqlState {
-  /** 3C000: ambiguous cursor name */
-  AMBIGUOUS_CURSOR_NAME_NO_SUBCLASS(Category.X, "ambiguous cursor name", "3C", null, null),
-  /** 0U000: attempt to assign to non-updatable column */
-  ATTEMPT_TO_ASSIGN_TO_NON_UPDATABLE_COLUMN_NO_SUBCLASS(Category.X,
-      "attempt to assign to non-updatable column", "0U", null, null),
-  /** 0V000: attempt to assign to ordering column */
-  ATTEMPT_TO_ASSIGN_TO_ORDERING_COLUMN_NO_SUBCLASS(Category.X,
-      "attempt to assign to ordering column", "0V", null, null),
-  /** HY000: cli specific condition */
-  CLI_SPECIFIC_CONDITION_NO_SUBCLASS(Category.X, "cli specific condition", "HY", null, null),
-  /** 21000: cardinality violation */
-  CARDINALITY_VIOLATION_NO_SUBCLASS(Category.X, "cardinality violation", "21", null, null),
-  /** 08000: connection exception */
-  CONNECTION_EXCEPTION_NO_SUBCLASS(Category.X, "connection exception", "08", null, null),
-  /** 08003: connection exception: connection does not exist */
-  CONNECTION_EXCEPTION_CONNECTION_DOES_NOT_EXIST(Category.X, "connection exception", "08",
-      "connection does not exist", "003"),
-  /** 08006: connection exception: connection failure */
-  CONNECTION_EXCEPTION_CONNECTION_FAILURE(Category.X, "connection exception", "08",
-      "connection failure", "006"),
-  /** 08002: connection exception: connection name in use */
-  CONNECTION_EXCEPTION_CONNECTION_NAME_IN_USE(Category.X, "connection exception", "08",
-      "connection name in use", "002"),
-  /** 08001: connection exception: SQL-client unable to establish SQL-connection */
-  CONNECTION_EXCEPTION_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION(Category.X,
-      "connection exception", "08", "SQL-client unable to establish SQL-connection", "001"),
-  /** 08004: connection exception: SQL-server rejected establishment of SQL-connection */
-  CONNECTION_EXCEPTION_SQLSERVER_REJECTED_ESTABLISHMENT_OF_SQLCONNECTION(Category.X,
-      "connection exception", "08", "SQL-server rejected establishment of SQL-connection", "004"),
-  /** 08007: connection exception: transaction resolution unknown */
-  CONNECTION_EXCEPTION_TRANSACTION_RESOLUTION_UNKNOWN(Category.X, "connection exception", "08",
-      "transaction resolution unknown", "007"),
-  /** 36000: cursor sensitivity exception */
-  CURSOR_SENSITIVITY_EXCEPTION_NO_SUBCLASS(Category.X, "cursor sensitivity exception", "36", null,
-      null),
-  /** 36002: cursor sensitivity exception: request failed */
-  CURSOR_SENSITIVITY_EXCEPTION_REQUEST_FAILED(Category.X, "cursor sensitivity exception", "36",
-      "request failed", "002"),
-  /** 36001: cursor sensitivity exception: request rejected */
-  CURSOR_SENSITIVITY_EXCEPTION_REQUEST_REJECTED(Category.X, "cursor sensitivity exception", "36",
-      "request rejected", "001"),
-  /** 22000: data exception */
-  DATA_EXCEPTION_NO_SUBCLASS(Category.X, "data exception", "22", null, null),
-  /** 2202F: data exception: array data, right truncation */
-  DATA_EXCEPTION_ARRAY_DATA_RIGHT_TRUNCATION(Category.X, "data exception", "22",
-      "array data, right truncation", "02F"),
-  /** 2202E: data exception: array element error */
-  DATA_EXCEPTION_ARRAY_ELEMENT_ERROR(Category.X, "data exception", "22", "array element error",
-      "02E"),
-  /** 2201U: data exception: attempt to replace a zero-length string */
-  DATA_EXCEPTION_ATTEMPT_TO_REPLACE_A_ZERO_LENGTH_STRING(Category.X, "data exception", "22",
-      "attempt to replace a zero-length string", "01U"),
-  /** 22021: data exception: character not in repertoire */
-  DATA_EXCEPTION_CHARACTER_NOT_IN_REPERTOIRE(Category.X, "data exception", "22",
-      "character not in repertoire", "021"),
-  /** 22008: data exception: datetime field overflow */
-  DATA_EXCEPTION_DATETIME_FIELD_OVERFLOW(Category.X, "data exception", "22",
-      "datetime field overflow", "008"),
-  /** 22012: data exception: division by zero */
-  DATA_EXCEPTION_DIVISION_BY_ZERO(Category.X, "data exception", "22", "division by zero", "012"),
-  /** 22005: data exception: error in assignment */
-  DATA_EXCEPTION_ERROR_IN_ASSIGNMENT(Category.X, "data exception", "22", "error in assignment",
-      "005"),
-  /** 2200B: data exception: escape character conflict */
-  DATA_EXCEPTION_ESCAPE_CHARACTER_CONFLICT(Category.X, "data exception", "22",
-      "escape character conflict", "00B"),
-  /** 22022: data exception: indicator overflow */
-  DATA_EXCEPTION_INDICATOR_OVERFLOW(Category.X, "data exception", "22", "indicator overflow",
-      "022"),
-  /** 22015: data exception: interval field overflow */
-  DATA_EXCEPTION_INTERVAL_FIELD_OVERFLOW(Category.X, "data exception", "22",
-      "interval field overflow", "015"),
-  /** 2200P: data exception: interval value out of range */
-  DATA_EXCEPTION_INTERVAL_VALUE_OUT_OF_RANGE(Category.X, "data exception", "22",
-      "interval value out of range", "00P"),
-  /** 2201E: data exception: invalid argument for natural logarithm */
-  DATA_EXCEPTION_INVALID_ARGUMENT_FOR_NATURAL_LOGARITHM(Category.X, "data exception", "22",
-      "invalid argument for natural logarithm", "01E"),
-  /** 22014: data exception: invalid argument for NTILE function */
-  DATA_EXCEPTION_INVALID_ARGUMENT_FOR_NTILE_FUNCTION(Category.X, "data exception", "22",
-      "invalid argument for NTILE function", "014"),
-  /** 22016: data exception: invalid argument for NTH_VALUE function */
-  DATA_EXCEPTION_INVALID_ARGUMENT_FOR_NTH_VALUE_FUNCTION(Category.X, "data exception", "22",
-      "invalid argument for NTH_VALUE function", "016"),
-  /** 2201F: data exception: invalid argument for power function */
-  DATA_EXCEPTION_INVALID_ARGUMENT_FOR_POWER_FUNCTION(Category.X, "data exception", "22",
-      "invalid argument for power function", "01F"),
-  /** 2202J: data exception: invalid argument for row pattern navigation operation */
-  DATA_EXCEPTION_INVALID_ARGUMENT_FOR_ROW_PATTERN_NAVIGATION_OPERATION(Category.X, "data exception",
-      "22", "invalid argument for row pattern navigation operation", "02J"),
-  /** 2201G: data exception: invalid argument for width bucket function */
-  DATA_EXCEPTION_INVALID_ARGUMENT_FOR_WIDTH_BUCKET_FUNCTION(Category.X, "data exception", "22",
-      "invalid argument for width bucket function", "01G"),
-  /** 22018: data exception: invalid character value for cast */
-  DATA_EXCEPTION_INVALID_CHARACTER_VALUE_FOR_CAST(Category.X, "data exception", "22",
-      "invalid character value for cast", "018"),
-  /** 22007: data exception: invalid datetime format */
-  DATA_EXCEPTION_INVALID_DATETIME_FORMAT(Category.X, "data exception", "22",
-      "invalid datetime format", "007"),
-  /** 22019: data exception: invalid escape character */
-  DATA_EXCEPTION_INVALID_ESCAPE_CHARACTER(Category.X, "data exception", "22",
-      "invalid escape character", "019"),
-  /** 2200D: data exception: invalid escape octet */
-  DATA_EXCEPTION_INVALID_ESCAPE_OCTET(Category.X, "data exception", "22", "invalid escape octet",
-      "00D"),
-  /** 22025: data exception: invalid escape sequence */
-  DATA_EXCEPTION_INVALID_ESCAPE_SEQUENCE(Category.X, "data exception", "22",
-      "invalid escape sequence", "025"),
-  /** 22010: data exception: invalid indicator parameter value */
-  DATA_EXCEPTION_INVALID_INDICATOR_PARAMETER_VALUE(Category.X, "data exception", "22",
-      "invalid indicator parameter value", "010"),
-  /** 22006: data exception: invalid interval format */
-  DATA_EXCEPTION_INVALID_INTERVAL_FORMAT(Category.X, "data exception", "22",
-      "invalid interval format", "006"),
-  /** 22023: data exception: invalid parameter value */
-  DATA_EXCEPTION_INVALID_PARAMETER_VALUE(Category.X, "data exception", "22",
-      "invalid parameter value", "023"),
-  /** 22020: data exception: invalid period value */
-  DATA_EXCEPTION_INVALID_PERIOD_VALUE(Category.X, "data exception", "22", "invalid period value",
-      "020"),
-  /** 22013: data exception: invalid preceding or following size in window function */
-  DATA_EXCEPTION_INVALID_PRECEDING_OR_FOLLOWING_SIZE_IN_WINDOW_FUNCTION(Category.X,
-      "data exception", "22", "invalid preceding or following size in window function", "013"),
-  /** 2201B: data exception: invalid regular expression */
-  DATA_EXCEPTION_INVALID_REGULAR_EXPRESSION(Category.X, "data exception", "22",
-      "invalid regular expression", "01B"),
-  /** 2202G: data exception: invalid repeat argument in a sample clause */
-  DATA_EXCEPTION_INVALID_REPEAT_ARGUMENT_IN_A_SAMPLE_CLAUSE(Category.X, "data exception", "22",
-      "invalid repeat argument in a sample clause", "02G"),
-  /** 2201W: data exception: invalid row count in fetch first clause */
-  DATA_EXCEPTION_INVALID_ROW_COUNT_IN_FETCH_FIRST_CLAUSE(Category.X, "data exception", "22",
-      "invalid row count in fetch first clause", "01W"),
-  /** 2201X: data exception: invalid row count in result offset clause */
-  DATA_EXCEPTION_INVALID_ROW_COUNT_IN_RESULT_OFFSET_CLAUSE(Category.X, "data exception", "22",
-      "invalid row count in result offset clause", "01X"),
-  /** 2201H: data exception: invalid row version */
-  DATA_EXCEPTION_INVALID_ROW_VERSION(Category.X, "data exception", "22", "invalid row version",
-      "01H"),
-  /** 2202H: data exception: invalid sample size */
-  DATA_EXCEPTION_INVALID_SAMPLE_SIZE(Category.X, "data exception", "22", "invalid sample size",
-      "02H"),
-  /** 22009: data exception: invalid time zone displacement value */
-  DATA_EXCEPTION_INVALID_TIME_ZONE_DISPLACEMENT_VALUE(Category.X, "data exception", "22",
-      "invalid time zone displacement value", "009"),
-  /** 2200C: data exception: invalid use of escape character */
-  DATA_EXCEPTION_INVALID_USE_OF_ESCAPE_CHARACTER(Category.X, "data exception", "22",
-      "invalid use of escape character", "00C"),
-  /** 2201T: data exception: invalid XQuery option flag */
-  DATA_EXCEPTION_INVALID_XQUERY_OPTION_FLAG(Category.X, "data exception", "22",
-      "invalid XQuery option flag", "01T"),
-  /** 2201S: data exception: invalid XQuery regular expression */
-  DATA_EXCEPTION_INVALID_XQUERY_REGULAR_EXPRESSION(Category.X, "data exception", "22",
-      "invalid XQuery regular expression", "01S"),
-  /** 2201V: data exception: invalid XQuery replacement string */
-  DATA_EXCEPTION_INVALID_XQUERY_REPLACEMENT_STRING(Category.X, "data exception", "22",
-      "invalid XQuery replacement string", "01V"),
-  /** 2200G: data exception: most specific type mismatch */
-  DATA_EXCEPTION_MOST_SPECIFIC_TYPE_MISMATCH(Category.X, "data exception", "22",
-      "most specific type mismatch", "00G"),
-  /** 2200Q: data exception: multiset value overflow */
-  DATA_EXCEPTION_MULTISET_VALUE_OVERFLOW(Category.X, "data exception", "22",
-      "multiset value overflow", "00Q"),
-  /** 22029: data exception: noncharacter in UCS string */
-  DATA_EXCEPTION_NONCHARACTER_IN_UCS_STRING(Category.X, "data exception", "22",
-      "noncharacter in UCS string", "029"),
-  /** 2202D: data exception: null value substituted for mutator subject parameter */
-  DATA_EXCEPTION_NULL_VALUE_SUBSTITUTED_FOR_MUTATOR_SUBJECT_PARAMETER(Category.X, "data exception",
-      "22", "null value substituted for mutator subject parameter", "02D"),
-  /** 2201C: data exception: null row not permitted in table */
-  DATA_EXCEPTION_NULL_ROW_NOT_PERMITTED_IN_TABLE(Category.X, "data exception", "22",
-      "null row not permitted in table", "01C"),
-  /** 2200E: data exception: null value in array target */
-  DATA_EXCEPTION_NULL_VALUE_IN_ARRAY_TARGET(Category.X, "data exception", "22",
-      "null value in array target", "00E"),
-  /** 22002: data exception: null value, no indicator parameter */
-  DATA_EXCEPTION_NULL_VALUE_NO_INDICATOR_PARAMETER(Category.X, "data exception", "22",
-      "null value, no indicator parameter", "002"),
-  /** 22004: data exception: null value not allowed */
-  DATA_EXCEPTION_NULL_VALUE_NOT_ALLOWED(Category.X, "data exception", "22",
-      "null value not allowed", "004"),
-  /** 22003: data exception: numeric value out of range */
-  DATA_EXCEPTION_NUMERIC_VALUE_OUT_OF_RANGE(Category.X, "data exception", "22",
-      "numeric value out of range", "003"),
-  /** 2200H: data exception: sequence generator limit exceeded */
-  DATA_EXCEPTION_SEQUENCE_GENERATOR_LIMIT_EXCEEDED(Category.X, "data exception", "22",
-      "sequence generator limit exceeded", "00H"),
-  /** 2202K: data exception: skip to non-existent row */
-  DATA_EXCEPTION_SKIP_TO_NON_EXISTENT_ROW(Category.X, "data exception", "22",
-      "skip to non-existent row", "02K"),
-  /** 2202L: data exception: skip to first row of match */
-  DATA_EXCEPTION_SKIP_TO_FIRST_ROW_OF_MATCH(Category.X, "data exception", "22",
-      "skip to first row of match", "02L"),
-  /** 22026: data exception: string data, length mismatch */
-  DATA_EXCEPTION_STRING_DATA_LENGTH_MISMATCH(Category.X, "data exception", "22",
-      "string data, length mismatch", "026"),
-  /** 22001: data exception: string data, right truncation */
-  DATA_EXCEPTION_STRING_DATA_RIGHT_TRUNCATION(Category.X, "data exception", "22",
-      "string data, right truncation", "001"),
-  /** 22011: data exception: substring error */
-  DATA_EXCEPTION_SUBSTRING_ERROR(Category.X, "data exception", "22", "substring error", "011"),
-  /** 22027: data exception: trim error */
-  DATA_EXCEPTION_TRIM_ERROR(Category.X, "data exception", "22", "trim error", "027"),
-  /** 22024: data exception: unterminated C string */
-  DATA_EXCEPTION_UNTERMINATED_C_STRING(Category.X, "data exception", "22", "unterminated C string",
-      "024"),
-  /** 2200F: data exception: zero-length character string */
-  DATA_EXCEPTION_ZERO_LENGTH_CHARACTER_STRING(Category.X, "data exception", "22",
-      "zero-length character string", "00F"),
-  /** 2B000: dependent privilege descriptors still exist */
-  DEPENDENT_PRIVILEGE_DESCRIPTORS_STILL_EXIST_NO_SUBCLASS(Category.X,
-      "dependent privilege descriptors still exist", "2B", null, null),
-  /** 0Z000: diagnostics exception */
-  DIAGNOSTICS_EXCEPTION_NO_SUBCLASS(Category.X, "diagnostics exception", "0Z", null, null),
-  /** 0Z001: diagnostics exception: maximum number of stacked diagnostics areas exceeded */
-  DIAGNOSTICS_EXCEPTION_MAXIMUM_NUMBER_OF_DIAGNOSTICS_AREAS_EXCEEDED(Category.X,
-      "diagnostics exception", "0Z", "maximum number of stacked diagnostics areas exceeded", "001"),
-  /** 07000: dynamic SQL error */
-  DYNAMIC_SQL_ERROR_NO_SUBCLASS(Category.X, "dynamic SQL error", "07", null, null),
-  /** 07003: dynamic SQL error: cursor specification cannot be executed */
-  DYNAMIC_SQL_ERROR_CURSOR_SPECIFICATION_CANNOT_BE_EXECUTED(Category.X, "dynamic SQL error", "07",
-      "cursor specification cannot be executed", "003"),
-  /** 0700B: dynamic SQL error: data type transform function violation */
-  DYNAMIC_SQL_ERROR_DATA_TYPE_TRANSFORM_FUNCTION_VIOLATION(Category.X, "dynamic SQL error", "07",
-      "data type transform function violation", "00B"),
-  /** 0700D: dynamic SQL error: invalid DATA target */
-  DYNAMIC_SQL_ERROR_INVALID_DATA_TARGET(Category.X, "dynamic SQL error", "07",
-      "invalid DATA target", "00D"),
-  /** 0700F: dynamic SQL error: invalid DATETIME_INTERVAL_CODE */
-  DYNAMIC_SQL_ERROR_INVALID_DATETIME_INTERVAL_CODE(Category.X, "dynamic SQL error", "07",
-      "invalid DATETIME_INTERVAL_CODE", "00F"),
-  /** 07008: dynamic SQL error: invalid descriptor count */
-  DYNAMIC_SQL_ERROR_INVALID_DESCRIPTOR_COUNT(Category.X, "dynamic SQL error", "07",
-      "invalid descriptor count", "008"),
-  /** 07009: dynamic SQL error: invalid descriptor index */
-  DYNAMIC_SQL_ERROR_INVALID_DESCRIPTOR_INDEX(Category.X, "dynamic SQL error", "07",
-      "invalid descriptor index", "009"),
-  /** 0700E: dynamic SQL error: invalid LEVEL value */
-  DYNAMIC_SQL_ERROR_INVALID_LEVEL_VALUE(Category.X, "dynamic SQL error", "07",
-      "invalid LEVEL value", "00E"),
-  /** 07005: dynamic SQL error: prepared statement not a cursor specification */
-  DYNAMIC_SQL_ERROR_PREPARED_STATEMENT_NOT_A_CURSOR_SPECIFICATION(
-      Category.X, "dynamic SQL error", "07",
-      "prepared statement not a cursor specification", "005"),
-  /** 07006: dynamic SQL error: restricted data type attribute violation */
-  DYNAMIC_SQL_ERROR_RESTRICTED_DATA_TYPE_ATTRIBUTE_VIOLATION(
-      Category.X, "dynamic SQL error", "07", "restricted data type attribute violation", "006"),
-  /** 0700C: dynamic SQL error: undefined DATA value */
-  DYNAMIC_SQL_ERROR_UNDEFINED_DATA_VALUE(Category.X, "dynamic SQL error", "07",
-      "undefined DATA value", "00C"),
-  /** 07001: dynamic SQL error: using clause does not match dynamic parameter specifications */
-  DYNAMIC_SQL_ERROR_USING_CLAUSE_DOES_NOT_MATCH_DYNAMIC_PARAMETER_SPEC(Category.X,
-      "dynamic SQL error", "07", "using clause does not match dynamic parameter specifications",
-      "001"),
-  /** 07002: dynamic SQL error: using clause does not match target specifications */
-  DYNAMIC_SQL_ERROR_USING_CLAUSE_DOES_NOT_MATCH_TARGET_SPEC(Category.X,
-      "dynamic SQL error", "07", "using clause does not match target specifications", "002"),
-  /** 07004: dynamic SQL error: using clause required for dynamic parameters */
-  DYNAMIC_SQL_ERROR_USING_CLAUSE_REQUIRED_FOR_DYNAMIC_PARAMETERS(Category.X, "dynamic SQL error",
-      "07", "using clause required for dynamic parameters", "004"),
-  /** 07007: dynamic SQL error: using clause required for result fields */
-  DYNAMIC_SQL_ERROR_USING_CLAUSE_REQUIRED_FOR_RESULT_FIELDS(Category.X, "dynamic SQL error", "07",
-      "using clause required for result fields", "007"),
-  /** 38000: external routine exception */
-  EXTERNAL_ROUTINE_EXCEPTION_NO_SUBCLASS(Category.X, "external routine exception", "38", null,
-      null),
-  /** 38001: external routine exception: containing SQL not permitted */
-  EXTERNAL_ROUTINE_EXCEPTION_CONTAINING_SQL_NOT_PERMITTED(Category.X, "external routine exception",
-      "38", "containing SQL not permitted", "001"),
-  /** 38002: external routine exception: modifying SQL-data not permitted */
-  EXTERNAL_ROUTINE_EXCEPTION_MODIFYING_SQL_DATA_NOT_PERMITTED(Category.X,
-      "external routine exception", "38", "modifying SQL-data not permitted", "002"),
-  /** 38003: external routine exception: prohibited SQL-statement attempted */
-  EXTERNAL_ROUTINE_EXCEPTION_PROHIBITED_SQL_STATEMENT_ATTEMPTED(Category.X,
-      "external routine exception", "38", "prohibited SQL-statement attempted", "003"),
-  /** 38004: external routine exception: reading SQL-data not permitted */
-  EXTERNAL_ROUTINE_EXCEPTION_READING_SQL_DATA_NOT_PERMITTED(Category.X,
-      "external routine exception", "38", "reading SQL-data not permitted", "004"),
-  /** 39000: external routine invocation exception */
-  EXTERNAL_ROUTINE_INVOCATION_EXCEPTION_NO_SUBCLASS(Category.X,
-      "external routine invocation exception", "39", null, null),
-  /** 39004: external routine invocation exception: null value not allowed */
-  EXTERNAL_ROUTINE_INVOCATION_EXCEPTION_NULL_VALUE_NOT_ALLOWED(Category.X,
-      "external routine invocation exception", "39", "null value not allowed", "004"),
-  /** 0A000: feature not supported */
-  FEATURE_NOT_SUPPORTED_NO_SUBCLASS(Category.X, "feature not supported", "0A", null, null),
-  /** 0A001: feature not supported: multiple server transactions */
-  FEATURE_NOT_SUPPORTED_MULTIPLE_ENVIRONMENT_TRANSACTIONS(Category.X, "feature not supported", "0A",
-      "multiple server transactions", "001"),
-  /** 23000: integrity constraint violation */
-  INTEGRITY_CONSTRAINT_VIOLATION_NO_SUBCLASS(Category.X, "integrity constraint violation", "23",
-      null, null),
-  /** 23001: integrity constraint violation: restrict violation */
-  INTEGRITY_CONSTRAINT_VIOLATION_RESTRICT_VIOLATION(Category.X, "integrity constraint violation",
-      "23", "restrict violation", "001"),
-  /** 28000: invalid authorization specification */
-  INVALID_AUTHORIZATION_SPECIFICATION_NO_SUBCLASS(Category.X, "invalid authorization specification",
-      "28", null, null),
-  /** 3D000: invalid catalog name */
-  INVALID_CATALOG_NAME_NO_SUBCLASS(Category.X, "invalid catalog name", "3D", null, null),
-  /** 2C000: invalid character set name */
-  INVALID_CHARACTER_SET_NAME_NO_SUBCLASS(Category.X, "invalid character set name", "2C", null,
-      null),
-  /** 2C001: invalid character set name: cannot drop SQL-session default character set */
-  INVALID_CHARACTER_SET_NAME_CANNOT_DROP_SQLSESSION_DEFAULT_CHARACTER_SET(Category.X,
-      "invalid character set name", "2C", "cannot drop SQL-session default character set", "001"),
-  /** 35000: invalid condition number */
-  INVALID_CONDITION_NUMBER_NO_SUBCLASS(Category.X, "invalid condition number", "35", null, null),
-  /** 2E000: invalid connection name */
-  INVALID_CONNECTION_NAME_NO_SUBCLASS(Category.X, "invalid connection name", "2E", null, null),
-  /** 34000: invalid cursor name */
-  INVALID_CURSOR_NAME_NO_SUBCLASS(Category.X, "invalid cursor name", "34", null, null),
-  /** 24000: invalid cursor state */
-  INVALID_CURSOR_STATE_NO_SUBCLASS(Category.X, "invalid cursor state", "24", null, null),
-  /** 0L000: invalid grantor */
-  INVALID_GRANTOR_STATE_NO_SUBCLASS(Category.X, "invalid grantor", "0L", null, null),
-  /** 0P000: invalid role specification */
-  INVALID_ROLE_SPECIFICATION(Category.X, "invalid role specification", "0P", null,
-      null),
-  /** 3F000: invalid schema name */
-  INVALID_SCHEMA_NAME_NO_SUBCLASS(Category.X, "invalid schema name", "3F", null, null),
-  /** 0E000: invalid schema name list specification */
-  INVALID_SCHEMA_NAME_LIST_SPECIFICATION_NO_SUBCLASS(Category.X,
-      "invalid schema name list specification", "0E", null, null),
-  /** 2H000: invalid collation name */
-  INVALID_COLLATION_NAME_NO_SUBCLASS(Category.X, "invalid collation name", "2H", null, null),
-  /** 33000: invalid SQL descriptor name */
-  INVALID_SQL_DESCRIPTOR_NAME_NO_SUBCLASS(Category.X, "invalid SQL descriptor name", "33", null,
-      null),
-  /** 0M000: invalid SQL-invoked procedure reference */
-  INVALID_SQL_INVOKED_PROCEDURE_REFERENCE_NO_SUBCLASS(Category.X,
-      "invalid SQL-invoked procedure reference", "0M", null, null),
-  /** 26000: invalid SQL statement name */
-  INVALID_SQL_STATEMENT_NAME_NO_SUBCLASS(Category.X, "invalid SQL statement name", "26", null,
-      null),
-  /** 30000: invalid SQL statement identifier */
-  INVALID_SQL_STATEMENT_IDENTIFIER_NO_SUBCLASS(Category.X, "invalid SQL statement identifier", "30",
-      null, null),
-  /** 0D000: invalid target type specification */
-  INVALID_TARGET_TYPE_SPECIFICATION_NO_SUBCLASS(Category.X, "invalid target type specification",
-      "0D", null, null),
-  /** 25000: invalid transaction state */
-  INVALID_TRANSACTION_STATE_NO_SUBCLASS(Category.X, "invalid transaction state", "25", null, null),
-  /** 25001: invalid transaction state: active SQL-transaction */
-  INVALID_TRANSACTION_STATE_ACTIVE_SQL_TRANSACTION(Category.X, "invalid transaction state", "25",
-      "active SQL-transaction", "001"),
-  /** 25002: invalid transaction state: branch transaction already active */
-  INVALID_TRANSACTION_STATE_BRANCH_TRANSACTION_ALREADY_ACTIVE(Category.X,
-      "invalid transaction state", "25", "branch transaction already active", "002"),
-  /** 25008: invalid transaction state: held cursor requires same isolation level */
-  INVALID_TRANSACTION_STATE_HELD_CURSOR_REQUIRES_SAME_ISOLATION_LEVEL(Category.X,
-      "invalid transaction state", "25", "held cursor requires same isolation level", "008"),
-  /** 25003: invalid transaction state: inappropriate access mode for branch transaction */
-  INVALID_TRANSACTION_STATE_INAPPROPRIATE_ACCESS_MODE_FOR_BRANCH_TRANSACTION(Category.X,
-      "invalid transaction state", "25", "inappropriate access mode for branch transaction", "003"),
-  /** 25004: invalid transaction state: inappropriate isolation level for branch transaction */
-  INVALID_TRANSACTION_STATE_INAPPROPRIATE_ISOLATION_LEVEL_FOR_BRANCH_TRANSACTION(Category.X,
-      "invalid transaction state", "25", "inappropriate isolation level for branch transaction",
-      "004"),
-  /** 25005: invalid transaction state: no active SQL-transaction for branch transaction */
-  INVALID_TRANSACTION_STATE_NO_ACTIVE_SQL_TRANSACTION_FOR_BRANCH_TRANSACTION(Category.X,
-      "invalid transaction state", "25", "no active SQL-transaction for branch transaction", "005"),
-  /** 25006: invalid transaction state: read-only SQL-transaction */
-  INVALID_TRANSACTION_STATE_READ_ONLY_SQL_TRANSACTION(Category.X, "invalid transaction state", "25",
-      "read-only SQL-transaction", "006"),
-  /** 25007: invalid transaction state: schema and data statement mixing not supported */
-  INVALID_TRANSACTION_STATE_SCHEMA_AND_DATA_STATEMENT_MIXING_NOT_SUPPORTED(Category.X,
-      "invalid transaction state", "25", "schema and data statement mixing not supported", "007"),
-  /** 2D000: invalid transaction termination */
-  INVALID_TRANSACTION_TERMINATION_NO_SUBCLASS(Category.X, "invalid transaction termination", "2D",
-      null, null),
-  /** 0S000: invalid transform group name specification */
-  INVALID_TRANSFORM_GROUP_NAME_SPECIFICATION_NO_SUBCLASS(Category.X,
-      "invalid transform group name specification", "0S", null, null),
-  /** 0F000: locator exception */
-  LOCATOR_EXCEPTION_NO_SUBCLASS(Category.X, "locator exception", "0F", null, null),
-  /** 0F001: locator exception: invalid specification */
-  LOCATOR_EXCEPTION_INVALID_SPECIFICATION(Category.X, "locator exception", "0F",
-      "invalid specification", "001"),
-  /** 02000: no data */
-  NO_DATA_NO_SUBCLASS(Category.N, "no data", "02", null, null),
-  /** 02001: no data: no additional result sets returned */
-  NO_DATA_NO_ADDITIONAL_RESULT_SETS_RETURNED(Category.N, "no data", "02",
-      "no additional result sets returned", "001"),
-  /** 0W000: prohibited statement encountered during trigger execution */
-  PROHIBITED_STATEMENT_DURING_TRIGGER_EXECUTION_NO_SUBCLASS(Category.X,
-      "prohibited statement encountered during trigger execution", "0W", null, null),
-  /** 0W001: prohibited statement encountered during trigger execution: modify table modified by
-   * data change delta table */
-  PROHIBITED_STATEMENT_DURING_TRIGGER_EXECUTION_MODIFY_TABLE_MODIFIED_BY_DATA_CHANGE_DELTA_TABLE(
-      Category.X, "prohibited statement encountered during trigger execution", "0W",
-      "modify table modified by data change delta table", "001"),
-  /** HZ: Remote Database Access
-   *
-   * <p>(See Table 12, 'SQLSTATE class and subclass values for RDA-specific conditions' in
-   * [ISO9579], Subclause 8.1, 'Exception codes for RDA-specific Conditions', for the definition of
-   * protocol subconditions and subclass code values.) */
-  REMOTE_DATABASE_ACCESS_NO_SUBCLASS(Category.X, "Remote Database Access", "HZ", null, null),
-  /** 3B000: savepoint exception */
-  SAVEPOINT_EXCEPTION_NO_SUBCLASS(Category.X, "savepoint exception", "3B", null, null),
-  /** 3B001: savepoint exception: invalid specification */
-  SAVEPOINT_EXCEPTION_INVALID_SPECIFICATION(Category.X, "savepoint exception", "3B",
-      "invalid specification", "001"),
-  /** 3B002: savepoint exception: too many */
-  SAVEPOINT_EXCEPTION_TOO_MANY(Category.X, "savepoint exception", "3B", "too many", "002"),
-  /** 2F000: SQL routine exception */
-  SQL_ROUTINE_EXCEPTION_NO_SUBCLASS(Category.X, "SQL routine exception", "2F", null, null),
-  /** 2F005: SQL routine exception: function executed no return statement */
-  SQL_ROUTINE_EXCEPTION_FUNCTION_EXECUTED_NO_RETURN_STATEMENT(Category.X, "SQL routine exception",
-      "2F", "function executed no return statement", "005"),
-  /** 2F002: SQL routine exception: modifying SQL-data not permitted */
-  SQL_ROUTINE_EXCEPTION_MODIFYING_SQL_DATA_NOT_PERMITTED(Category.X, "SQL routine exception", "2F",
-      "modifying SQL-data not permitted", "002"),
-  /** 2F003: SQL routine exception: prohibited SQL-statement attempted */
-  SQL_ROUTINE_EXCEPTION_PROHIBITED_SQL_STATEMENT_ATTEMPTED(Category.X, "SQL routine exception",
-      "2F", "prohibited SQL-statement attempted", "003"),
-  /** 2F004: SQL routine exception: reading SQL-data not permitted */
-  SQL_ROUTINE_EXCEPTION_READING_SQL_DATA_NOT_PERMITTED(Category.X, "SQL routine exception", "2F",
-      "reading SQL-data not permitted", "004"),
-  /** 00000: successful completion */
-  SUCCESSFUL_COMPLETION_NO_SUBCLASS(Category.S, "successful completion", "00", null, null),
-  /** 42000: syntax error or access rule violation */
-  SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION_NO_SUBCLASS(Category.X,
-      "syntax error or access rule violation", "42", null, null),
-  /** 2A000: syntax error or access rule violation */
-  SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION_IN_DIRECT_STATEMENT_NO_SUBCLASS(Category.X,
-      "syntax error or access rule violation in direct statement", "2A", null, null),
-  /** 37000: syntax error or access rule violation */
-  SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION_IN_DYNAMIC_STATEMENT_NO_SUBCLASS(Category.X,
-      "syntax error or access rule violation in dynamic statement", "37", null, null),
-  /** 0T000: target table disagrees with cursor specification */
-  TARGET_TABLE_DISAGREES_WITH_CURSOR_SPECIFICATION_NO_SUBCLASS(Category.X,
-      "target table disagrees with cursor specification", "0T", null, null),
-  /** 40000: transaction rollback */
-  TRANSACTION_ROLLBACK_NO_SUBCLASS(Category.X, "transaction rollback", "40", null, null),
-  /** 40002: transaction rollback: integrity constraint violation */
-  TRANSACTION_ROLLBACK_INTEGRITY_CONSTRAINT_VIOLATION(Category.X, "transaction rollback", "40",
-      "integrity constraint violation", "002"),
-  /** 40001: transaction rollback: serialization failure */
-  TRANSACTION_ROLLBACK_SERIALIZATION_FAILURE(Category.X, "transaction rollback", "40",
-      "serialization failure", "001"),
-  /** 40003: transaction rollback: statement completion unknown */
-  TRANSACTION_ROLLBACK_STATEMENT_COMPLETION_UNKNOWN(Category.X, "transaction rollback", "40",
-      "statement completion unknown", "003"),
-  /** 40004: transaction rollback: triggered action exception */
-  TRANSACTION_ROLLBACK_TRIGGERED_ACTION_EXCEPTION(Category.X, "transaction rollback", "40",
-      "triggered action exception", "004"),
-  /** 09000: triggered action exception */
-  TRIGGERED_ACTION_EXCEPTION_NO_SUBCLASS(Category.X, "triggered action exception", "09", null,
-      null),
-  /** 27000: triggered data change violation */
-  TRIGGERED_DATA_CHANGE_VIOLATION_NO_SUBCLASS(Category.X, "triggered data change violation", "27",
-      null, null),
-  /** 27001: triggered data change violation: modify table modified by data change delta table */
-  TRIGGERED_DATA_CHANGE_VIOLATION_MODIFY_TABLE_MODIFIED_BY_DATA_CHANGE_DELTA_TABLE(Category.X,
-      "triggered data change violation", "27", "modify table modified by data change delta table",
-      "001"),
-  /** 01000: warning */
-  WARNING_NO_SUBCLASS(Category.W, "warning", "01", null, null),
-  /** 0100D: warning: additional result sets returned */
-  WARNING_ADDITIONAL_RESULT_SETS_RETURNED(Category.W, "warning", "01",
-      "additional result sets returned", "00D"),
-  /** 0102F: warning: array data, right truncation */
-  WARNING_ARRAY_DATA_RIGHT_TRUNCATION(Category.W, "warning", "01", "array data, right truncation",
-      "02F"),
-  /** 0100E: warning: attempt to return too many result sets */
-  WARNING_ATTEMPT_TO_RETURN_TOO_MANY_RESULT_SETS(Category.W, "warning", "01",
-      "attempt to return too many result sets", "00E"),
-  /** 01001: warning: cursor operation conflict */
-  WARNING_CURSOR_OPERATION_CONFLICT(Category.W, "warning", "01", "cursor operation conflict",
-      "001"),
-  /** 0100B: warning: default value too long for information schema */
-  WARNING_DEFAULT_VALUE_TOO_LONG_FOR_INFORMATION_SCHEMA(Category.W, "warning", "01",
-      "default value too long for information schema", "00B"),
-  /** 01002: warning: disconnect error */
-  WARNING_DISCONNECT_ERROR(Category.W, "warning", "01", "disconnect error", "002"),
-  /** 01005: warning: insufficient item descriptor areas */
-  WARNING_INSUFFICIENT_ITEM_DESCRIPTOR_AREAS(Category.W, "warning", "01",
-      "insufficient item descriptor areas", "005"),
-  /** 01012: warning: invalid number of conditions */
-  WARNING_INVALID_NUMBER_OF_CONDITIONS(Category.W, "warning", "01", "invalid number of conditions",
-      "012"),
-  /** 01003: warning: null value eliminated in set function */
-  WARNING_NULL_VALUE_ELIMINATED_IN_SET_FUNCTION(Category.W, "warning", "01",
-      "null value eliminated in set function", "003"),
-  /** 01007: warning: privilege not granted */
-  WARNING_PRIVILEGE_NOT_GRANTED(Category.W, "warning", "01", "privilege not granted", "007"),
-  /** 01006: warning: privilege not revoked */
-  WARNING_PRIVILEGE_NOT_REVOKED(Category.W, "warning", "01", "privilege not revoked", "006"),
-  /** 0100A: warning: query expression too long for information schema */
-  WARNING_QUERY_EXPRESSION_TOO_LONG_FOR_INFORMATION_SCHEMA(Category.W, "warning", "01",
-      "query expression too long for information schema", "00A"),
-  /** 0100C: warning: result sets returned */
-  WARNING_DYNAMIC_RESULT_SETS_RETURNED(Category.W, "warning", "01", "result sets returned", "00C"),
-  /** 01009: warning: search condition too long for information schema */
-  WARNING_SEARCH_CONDITION_TOO_LONG_FOR_INFORMATION_SCHEMA(Category.W, "warning", "01",
-      "search condition too long for information schema", "009"),
-  /** 0100F: warning: statement too long for information schema */
-  WARNING_STATEMENT_TOO_LONG_FOR_INFORMATION_SCHEMA(Category.W, "warning", "01",
-      "statement too long for information schema", "00F"),
-  /** 01004: warning: string data, right truncation */
-  WARNING_STRING_DATA_RIGHT_TRUNCATION_WARNING(Category.W, "warning", "01",
-      "string data, right truncation", "004"),
-  /** 44000: with check option violation */
-  WITH_CHECK_OPTION_VIOLATION_NO_SUBCLASS(Category.X, "with check option violation", "44", null,
-      null);
-
-  public final Category category;
-  public final String condition;
-  public final String klass;
-  public final String subCondition;
-  public final String subClass;
-  public final String code;
-
-  /** Alias for backwards compatibility with previous versions of SQL spec. */
-  public static final SqlState INVALID_SQL_STATEMENT =
-      INVALID_SQL_STATEMENT_IDENTIFIER_NO_SUBCLASS;
-
-  public static final Map<String, SqlState> BY_CODE;
-
-  static {
-    Map<String, SqlState> m = new HashMap<>();
-    for (SqlState s : values()) {
-      m.put(s.code, s);
-    }
-    BY_CODE = Collections.unmodifiableMap(m);
-  }
-
-  SqlState(Category category, String condition, String klass, String subCondition,
-      String subClass) {
-    this.category = category;
-    this.condition = condition;
-    this.klass = klass;
-    this.subCondition = subCondition;
-    this.subClass = subClass;
-    this.code = klass + (subClass == null ? "000" : subClass);
-  }
-
-  /** Validates the data, and generates the HTML table. */
-  private static void main(String[] args) {
-    PrintWriter pw = new PrintWriter(
-        new BufferedWriter(
-            new OutputStreamWriter(System.out, StandardCharsets.UTF_8)));
-    pw.println(" * <table>");
-    SqlState parent = null;
-    for (SqlState s : values()) {
-      assert s.klass.length() == 2;
-      assert s.subClass == null || s.subClass.length() == 3;
-      if (s.subClass == null) {
-        assert s.subCondition == null;
-        parent = s;
-      } else {
-        assert parent != null;
-        assert s.subCondition != null;
-        assert s.category == parent.category;
-        assert s.klass.equals(parent.klass);
-        assert s.condition.equals(parent.condition);
-      }
-      pw.println(" * <tr>");
-      pw.println(" *   <td>" + (parent == s ? s.category : "&nbsp;") + "</td>");
-      pw.println(" *   <td>" + (parent == s ? s.condition : "&nbsp;") + "</td>");
-      pw.println(" *   <td>" + (parent == s ? s.klass : "&nbsp;") + "</td>");
-      pw.println(" *   <td>" + (s.subCondition == null ? "(no subclass)" : s.subCondition)
-          + "</td>");
-      pw.println(" *   <td>" + (s.subCondition == null ? "000" : s.subClass) + "</td>");
-      pw.println(" * </tr>");
-    }
-    pw.println(" * </table>");
-    pw.close();
-  }
-
-  /** Severity types. */
-  enum Category {
-    /** Success (class 00). */
-    S,
-    /** Warning (class 01). */
-    W,
-    /** No data (class 02). */
-    N,
-    /** Exception (all other classes). */
-    X,
-  }
-
-}
-
-// End SqlState.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/SqlType.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/SqlType.java b/avatica/core/src/main/java/org/apache/calcite/avatica/SqlType.java
deleted file mode 100644
index 2d0c086..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/SqlType.java
+++ /dev/null
@@ -1,559 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import org.apache.calcite.avatica.util.ByteString;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.net.URL;
-import java.sql.Array;
-import java.sql.Blob;
-import java.sql.Clob;
-import java.sql.NClob;
-import java.sql.PreparedStatement;
-import java.sql.Ref;
-import java.sql.RowId;
-import java.sql.Struct;
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.sql.Types;
-import java.util.AbstractMap;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collection;
-import java.util.EnumSet;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/** Extends the information in {@link java.sql.Types}.
- *
- * <p>The information in the following conversions tables
- * (from the JDBC 4.1 specification) is held in members of this class.
- *
- * <p>Table B-1: JDBC Types Mapped to Java Types
- *
- * <pre>
- * JDBC Type     Java Type
- * ============= =========================
- * CHAR          String
- * VARCHAR       String
- * LONGVARCHAR   String
- * NUMERIC       java.math.BigDecimal
- * DECIMAL       java.math.BigDecimal
- * BIT           boolean
- * BOOLEAN       boolean
- * TINYINT       byte
- * SMALLINT      short
- * INTEGER       int
- * BIGINT        long
- * REAL          float
- * FLOAT         double
- * DOUBLE        double
- * BINARY        byte[]
- * VARBINARY     byte[]
- * LONGVARBINARY byte[]
- * DATE          java.sql.Date
- * TIME          java.sql.Time
- * TIMESTAMP     java.sql.Timestamp
- * CLOB          java.sql.Clob
- * BLOB          java.sql.Blob
- * ARRAY         java.sql.Array
- * DISTINCT      mapping of underlying type
- * STRUCT        java.sql.Struct
- * REF           java.sql.Ref
- * DATALINK      java.net.URL
- * JAVA_OBJECT   underlying Java class
- * ROWID         java.sql.RowId
- * NCHAR         String
- * NVARCHAR      String
- * LONGNVARCHAR  String
- * NCLOB         java.sql.NClob
- * SQLXML        java.sql.SQLXML
- * </pre>
- *
- * <p>Table B-2: Standard Mapping from Java Types to JDBC Types
- *
- * <pre>
- * Java Type            JDBC Type
- * ==================== ==============================================
- * String               CHAR, VARCHAR, LONGVARCHAR, NCHAR, NVARCHAR or
- *                      LONGNVARCHAR
- * java.math.BigDecimal NUMERIC
- * boolean              BIT or BOOLEAN
- * byte                 TINYINT
- * short                SMALLINT
- * int                  INTEGER
- * long                 BIGINT
- * float                REAL
- * double               DOUBLE
- * byte[]               BINARY, VARBINARY, or LONGVARBINARY
- * java.sql.Date        DATE
- * java.sql.Time        TIME
- * java.sql.Timestamp   TIMESTAMP
- * java.sql.Clob        CLOB
- * java.sql.Blob        BLOB
- * java.sql.Array       ARRAY
- * java.sql.Struct      STRUCT
- * java.sql.Ref         REF
- * java.net.URL         DATALINK
- * Java class           JAVA_OBJECT
- * java.sql.RowId       ROWID
- * java.sql.NClob       NCLOB
- * java.sql.SQLXML      SQLXML
- * </pre>
- *
- * <p>TABLE B-3: Mapping from JDBC Types to Java Object Types
- *
- * <pre>
- * JDBC Type     Java Object Type
- * ============= ======================
- * CHAR          String
- * VARCHAR       String
- * LONGVARCHAR   String
- * NUMERIC       java.math.BigDecimal
- * DECIMAL       java.math.BigDecimal
- * BIT           Boolean
- * BOOLEAN       Boolean
- * TINYINT       Integer
- * SMALLINT      Integer
- * INTEGER       Integer
- * BIGINT        Long
- * REAL          Float
- * FLOAT         Double
- * DOUBLE        Double
- * BINARY        byte[]
- * VARBINARY     byte[]
- * LONGVARBINARY byte[]
- * DATE          java.sql.Date
- * TIME          java.sql.Time
- * TIMESTAMP     java.sql.Timestamp
- * DISTINCT      Object type of underlying type
- * CLOB          java.sql.Clob
- * BLOB          java.sql.Blob
- * ARRAY         java.sql.Array
- * STRUCT        java.sql.Struct or java.sql.SQLData
- * REF           java.sql.Ref
- * DATALINK      java.net.URL
- * JAVA_OBJECT   underlying Java class
- * ROWID         java.sql.RowId
- * NCHAR         String
- * NVARCHAR      String
- * LONGNVARCHAR  String
- * NCLOB         java.sql.NClob
- * SQLXML        java.sql.SQLXML
- * </pre>
- *
- * <p>TABLE B-4: Mapping from Java Object Types to JDBC Types
- *
- * <pre>
- * Java Object Type     JDBC Type
- * ==================== ===========================================
- * String               CHAR, VARCHAR, LONGVARCHAR, NCHAR, NVARCHAR
- *                      or LONGNVARCHAR
- * java.math.BigDecimal NUMERIC
- * Boolean              BIT or BOOLEAN
- * Byte                 TINYINT
- * Short                SMALLINT
- * Integer              INTEGER
- * Long                 BIGINT
- * Float                REAL
- * Double               DOUBLE
- * byte[]               BINARY, VARBINARY, or LONGVARBINARY
- * java.math.BigInteger BIGINT
- * java.sql.Date        DATE
- * java.sql.Time        TIME
- * java.sql.Timestamp   TIMESTAMP
- * java.sql.Clob        CLOB
- * java.sql.Blob        BLOB
- * java.sql.Array       ARRAY
- * java.sql.Struct      STRUCT
- * java.sql.Ref         REF
- * java.net.URL         DATALINK
- * Java class           JAVA_OBJECT
- * java.sql.RowId       ROWID
- * java.sql.NClob       NCLOB
- * java.sql.SQLXML      SQLXML
- * java.util.Calendar   TIMESTAMP
- * java.util.Date       TIMESTAMP
- * </pre>
- *
- * <p><a name="B5">TABLE B-5</a>: Conversions performed by {@code setObject} and
- * {@code setNull} between Java object types and target JDBC types
- *
- * <!--
- * CHECKSTYLE: OFF
- * -->
- * <pre>
- *                      T S I B R F D D N B B C V L B V L D T T A B C S R D J R N N L N S
- *                      I M N I E L O E U I O H A O I A O A I I R L L T E A A O C V O C Q
- *                      N A T G A O U C M T O A R N N R N T M M R O O R F T V W H A N L L
- *                      Y L E I L A B I E   L R C G A B G E E E A B B U   A A I A R G O X
- *                      I L G N   T L M R   E   H V R I V E   S Y     C   L _ D R C N B M
- *                      N I E T     E A I   A   A A Y N A     T       T   I O     H V   L
- *                      T N R         L C   N   R R   A R     A           N B     A A
- *                        T                       C   R B     M           K J     R R
- *                                                H   Y I     P                     C
- * Java type
- * ==================== = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
- * String               x x x x x x x x x x x x x x x x x x x x . . . . . . . . x x x . .
- * java.math.BigDecimal x x x x x x x x x x x x x . . . . . . . . . . . . . . . . . . . .
- * Boolean              x x x x x x x x x x x x x . . . . . . . . . . . . . . . . . . . .
- * Byte                 x x x x x x x x x x x x x . . . . . . . . . . . . . . . . . . . .
- * Short                x x x x x x x x x x x x x . . . . . . . . . . . . . . . . . . . .
- * Integer              x x x x x x x x x x x x x . . . . . . . . . . . . . . . . . . . .
- * Long                 x x x x x x x x x x x x x . . . . . . . . . . . . . . . . . . . .
- * Float                x x x x x x x x x x x x x . . . . . . . . . . . . . . . . . . . .
- * Double               x x x x x x x x x x x x x . . . . . . . . . . . . . . . . . . . .
- * byte[]               . . . . . . . . . . . . . . x x x . . . . . . . . . . . . . . . .
- * java.math.BigInteger . . . x . . . . . . . x x x . . . . . . . . . . . . . . . . . . .
- * java.sql.Date        . . . . . . . . . . . x x x . . . x . x . . . . . . . . . . . . .
- * java.sql.Time        . . . . . . . . . . . x x x . . . . x x . . . . . . . . . . . . .
- * java.sql.Timestamp   . . . . . . . . . . . x x x . . . x x x . . . . . . . . . . . . .
- * java.sql.Array       . . . . . . . . . . . . . . . . . . . . x . . . . . . . . . . . .
- * java.sql.Blob        . . . . . . . . . . . . . . . . . . . . . x . . . . . . . . . . .
- * java.sql.Clob        . . . . . . . . . . . . . . . . . . . . . . x . . . . . . . . . .
- * java.sql.Struct      . . . . . . . . . . . . . . . . . . . . . . . x . . . . . . . . .
- * java.sql.Ref         . . . . . . . . . . . . . . . . . . . . . . . . x . . . . . . . .
- * java.net.URL         . . . . . . . . . . . . . . . . . . . . . . . . . x . . . . . . .
- * Java class           . . . . . . . . . . . . . . . . . . . . . . . . . . x . . . . . .
- * java.sql.Rowid       . . . . . . . . . . . . . . . . . . . . . . . . . . . x . . . . .
- * java.sql.NClob       . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . x .
- * java.sql.SQLXML      . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . x
- * java.util.Calendar   . . . . . . . . . . . x x x . . . x x x . . . . . . . . . . . . .
- * java.util.Date       . . . . . . . . . . . x x x . . . x x x . . . . . . . . . . . . .
- * </pre>
- * <!--
- * CHECKSTYLE: ON
- * -->
- *
- * <p><a name="B6">TABLE B-6</a>: Use of {@code ResultSet} getter methods to
- * retrieve JDBC data types
- *
- * <!--
- * CHECKSTYLE: OFF
- * -->
- * <pre>
- *                      T S I B R F D D N B B C V L B V L D T T C B A R D S J R N N L N S
- *                      I M N I E L O E U I O H A O I A O A I I L L R E A T A O C V O C Q
- *                      N A T G A O U C M T O A R N N R N T M M O O R F T R V W H A N L L
- *                      Y L E I L A B I E   L R C G A B G E E E B B A   A U A I A R G O X
- *                      I L G N   T L M R   E   H V R I V E   S     Y   L C _ D R C N B M
- *                      N I E T     E A I   A   A A Y N A     T         I T O     H V   L
- *                      T N R         L C   N   R R   A R     A         N   B     A A
- *                        T                       C   R B     M         K   J     R R
- *                                                H   Y I     P                     C
- * Java type
- * ==================== = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
- * getByte              X x x x x x x x x x x x x . . . . . . . . . . . . . . x . . . . .
- * getShort             x X x x x x x x x x x x x . . . . . . . . . . . . . . . . . . . .
- * getInt               x x X x x x x x x x x x x . . . . . . . . . . . . . . . . . . . .
- * getLong              x x x X x x x x x x x x x . . . . . . . . . . . . . . . . . . . .
- * getFloat             x x x x X x x x x x x x x . . . . . . . . . . . . . . . . . . . .
- * getDouble            x x x x x X X x x x x x x . . . . . . . . . . . . . . . . . . . .
- * getBigDecimal        x x x x x x x X X x x x x . . . . . . . . . . . . . . . . . . . .
- * getBoolean           x x x x x x x x x X x x x . . . . . . . . . . . . . . . . . . . .
- * getString            x x x x x x x x x x x X X x x x x x x x . . . . x . . . x x x . .
- * getNString           x x x x x x x x x x x x x x x x x x x x . . . . x . . . X X x . .
- * getBytes             . . . . . . . . . . . . . . X X x . . . . . . . . . . . . . . . .
- * getDate              . . . . . . . . . . . x x x . . . X . x . . . . . . . . . . . . .
- * getTime              . . . . . . . . . . . x x x . . . . X x . . . . . . . . . . . . .
- * getTimestamp         . . . . . . . . . . . x x x . . . x x X . . . . . . . . . . . x .
- * getAsciiStream       . . . . . . . . . . . x x X x x x . . . x . . . . . . . . . . . x
- * getBinaryStream      . . . . . . . . . . . . . . x x X . . . . x . . . . . . . . . x x
- * getCharacterStream   . . . . . . . . . . . x x X x x x . . . x . . . . . . . x x x x x
- * getNCharacterStream  . . . . . . . . . . . x x x x x x . . . x . . . . . . . x x X x x
- * getClob              . . . . . . . . . . . . . . . . . . . . X . . . . . . . . . . x .
- * getNClob             . . . . . . . . . . . . . . . . . . . . x . . . . . . . . . . X .
- * getBlob              . . . . . . . . . . . . . . . . . . . . . X . . . . . . . . . . .
- * getArray             . . . . . . . . . . . . . . . . . . . . . . X . . . . . . . . . .
- * getRef               . . . . . . . . . . . . . . . . . . . . . . . X . . . . . . . . .
- * getURL               . . . . . . . . . . . . . . . . . . . . . . . . X . . . . . . . .
- * getObject            x x x x x x x x x x x x x x x x x x x x x x x x x X X x x x x x x
- * getRowId             . . . . . . . . . . . . . . . . . . . . . . . . . . . X . . . . .
- * getSQLXML            . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . X
- * </pre>
- * <!--
- * CHECKSTYLE: ON
- * -->
- */
-public enum SqlType {
-  BIT(Types.BIT, boolean.class),
-  BOOLEAN(Types.BOOLEAN, boolean.class),
-  TINYINT(Types.TINYINT, byte.class),
-  SMALLINT(Types.SMALLINT, short.class),
-  INTEGER(Types.INTEGER, int.class),
-  BIGINT(Types.BIGINT, long.class),
-  NUMERIC(Types.NUMERIC, BigDecimal.class),
-  DECIMAL(Types.DECIMAL, BigDecimal.class),
-  FLOAT(Types.FLOAT, double.class),
-  REAL(Types.REAL, float.class),
-  DOUBLE(Types.DOUBLE, double.class),
-  DATE(Types.DATE, java.sql.Date.class, int.class),
-  TIME(Types.TIME, Time.class, int.class),
-  TIMESTAMP(Types.TIMESTAMP, Timestamp.class, long.class),
-  INTERVAL_YEAR_MONTH(Types.OTHER, Boolean.class),
-  INTERVAL_DAY_TIME(Types.OTHER, Boolean.class),
-  CHAR(Types.CHAR, String.class),
-  VARCHAR(Types.VARCHAR, String.class),
-  LONGVARCHAR(Types.LONGVARCHAR, String.class),
-  BINARY(Types.BINARY, byte[].class, ByteString.class, String.class),
-  VARBINARY(Types.VARBINARY, byte[].class, ByteString.class, String.class),
-  LONGVARBINARY(Types.LONGVARBINARY, byte[].class, ByteString.class,
-      String.class),
-  NULL(Types.NULL, Void.class),
-  ANY(Types.JAVA_OBJECT, Object.class),
-  SYMBOL(Types.OTHER, Object.class),
-  MULTISET(Types.ARRAY, List.class),
-  ARRAY(Types.ARRAY, Array.class),
-  BLOB(Types.BLOB, Blob.class),
-  CLOB(Types.CLOB, Clob.class),
-  SQLXML(Types.SQLXML, java.sql.SQLXML.class),
-  MAP(Types.OTHER, Map.class),
-  DISTINCT(Types.DISTINCT, Object.class),
-  STRUCT(Types.STRUCT, Struct.class),
-  REF(Types.REF, Ref.class),
-  DATALINK(Types.DATALINK, URL.class),
-  JAVA_OBJECT(Types.JAVA_OBJECT, Object.class),
-  ROWID(Types.ROWID, RowId.class),
-  NCHAR(Types.NCHAR, String.class),
-  NVARCHAR(Types.NVARCHAR, String.class),
-  LONGNVARCHAR(Types.LONGNVARCHAR, String.class),
-  NCLOB(Types.NCLOB, NClob.class),
-  ROW(Types.STRUCT, Object.class),
-  OTHER(Types.OTHER, Object.class),
-  CURSOR(2012, Object.class),
-  COLUMN_LIST(Types.OTHER + 2, Object.class);
-
-  /** Type id as appears in {@link java.sql.Types},
-   * e.g. {@link java.sql.Types#INTEGER}. */
-  public final int id;
-
-  /** Default Java type for this SQL type, as described in table B-1. */
-  public final Class clazz;
-
-  /** Class used internally in Calcite to represent instances of this type. */
-  public final Class internal;
-
-  /** Class used to serialize values of this type as JSON. */
-  public final Class serial;
-
-  private static final Map<Integer, SqlType> BY_ID = new HashMap<>();
-  static {
-    for (SqlType sqlType : values()) {
-      BY_ID.put(sqlType.id, sqlType);
-    }
-  }
-
-  SqlType(int id, Class clazz, Class internal, Class serial) {
-    this.id = id;
-    this.clazz = clazz;
-    this.internal = internal;
-    this.serial = serial;
-  }
-
-  SqlType(int id, Class clazz, Class internal) {
-    this(id, clazz, internal, internal);
-  }
-
-  SqlType(int id, Class clazz) {
-    this(id, clazz, clazz, clazz);
-  }
-
-  public static SqlType valueOf(int type) {
-    final SqlType sqlType = BY_ID.get(type);
-    if (sqlType == null) {
-      throw new IllegalArgumentException("Unknown SQL type " + type);
-    }
-    return sqlType;
-  }
-
-  /** Returns the boxed type. */
-  public Class boxedClass() {
-    return AvaticaUtils.box(clazz);
-  }
-
-  /** Returns the entries in JDBC table B-5. */
-  public static Iterable<Map.Entry<Class, SqlType>> getSetConversions() {
-    final ArrayList<Map.Entry<Class, SqlType>> list = new ArrayList<>();
-    for (Map.Entry<Class, EnumSet<SqlType>> entry : SET_LIST.entrySet()) {
-      for (SqlType sqlType : entry.getValue()) {
-        list.add(new AbstractMap.SimpleEntry<>(entry.getKey(), sqlType));
-      }
-    }
-    return list;
-  }
-
-  public static final Map<Class, EnumSet<SqlType>> SET_LIST;
-  public static final Map<Method, EnumSet<SqlType>> GET_LIST;
-
-  static {
-    SET_LIST = new HashMap<>();
-    GET_LIST = new HashMap<>();
-
-    EnumSet<SqlType> numericTypes = EnumSet.of(TINYINT, SMALLINT, INTEGER,
-        BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, BOOLEAN);
-    Class[] numericClasses = {
-      BigDecimal.class, Boolean.class, Byte.class, Short.class, Integer.class,
-      Long.class, Float.class, Double.class
-    };
-    EnumSet<SqlType> charTypes = EnumSet.of(CHAR, VARCHAR, LONGVARCHAR);
-    EnumSet<SqlType> ncharTypes = EnumSet.of(NCHAR, NVARCHAR, LONGNVARCHAR);
-    EnumSet<SqlType> binaryTypes = EnumSet.of(BINARY, VARBINARY, LONGVARBINARY);
-    EnumSet<SqlType> dateTimeTypes = EnumSet.of(DATE, TIME, TIMESTAMP);
-    final EnumSet<SqlType> numericCharTypes = concat(numericTypes, charTypes);
-    SET_LIST.put(String.class,
-        concat(numericCharTypes, binaryTypes, dateTimeTypes, ncharTypes));
-    for (Class clazz : numericClasses) {
-      SET_LIST.put(clazz, numericCharTypes);
-    }
-    SET_LIST.put(byte[].class, binaryTypes);
-    SET_LIST.put(BigInteger.class,
-        EnumSet.of(BIGINT, CHAR, VARCHAR, LONGVARCHAR));
-    SET_LIST.put(java.sql.Date.class,
-        concat(charTypes, EnumSet.of(DATE, TIMESTAMP)));
-    SET_LIST.put(Time.class,
-        concat(charTypes, EnumSet.of(TIME, TIMESTAMP)));
-    SET_LIST.put(Timestamp.class,
-        concat(charTypes, EnumSet.of(DATE, TIME, TIMESTAMP)));
-    SET_LIST.put(Array.class, EnumSet.of(ARRAY));
-    SET_LIST.put(Blob.class, EnumSet.of(BLOB));
-    SET_LIST.put(Clob.class, EnumSet.of(CLOB));
-    SET_LIST.put(Struct.class, EnumSet.of(STRUCT));
-    SET_LIST.put(Ref.class, EnumSet.of(REF));
-    SET_LIST.put(URL.class, EnumSet.of(DATALINK));
-    SET_LIST.put(Class.class, EnumSet.of(JAVA_OBJECT));
-    SET_LIST.put(RowId.class, EnumSet.of(ROWID));
-    SET_LIST.put(NClob.class, EnumSet.of(NCLOB));
-    SET_LIST.put(java.sql.SQLXML.class, EnumSet.of(SQLXML));
-    SET_LIST.put(Calendar.class,
-        concat(charTypes, EnumSet.of(DATE, TIME, TIMESTAMP)));
-    SET_LIST.put(java.util.Date.class,
-        concat(charTypes, EnumSet.of(DATE, TIME, TIMESTAMP)));
-
-    EnumSet<Method> numericMethods =
-        EnumSet.of(Method.GET_BYTE, Method.GET_SHORT, Method.GET_INT,
-            Method.GET_LONG, Method.GET_FLOAT, Method.GET_DOUBLE,
-            Method.GET_BIG_DECIMAL, Method.GET_BOOLEAN);
-    for (Method method : numericMethods) {
-      GET_LIST.put(method, numericCharTypes);
-    }
-    GET_LIST.put(Method.GET_BYTE, EnumSet.of(ROWID));
-    for (Method method : EnumSet.of(Method.GET_STRING, Method.GET_N_STRING)) {
-      GET_LIST.put(method,
-          concat(numericCharTypes, binaryTypes, dateTimeTypes,
-              EnumSet.of(DATALINK), ncharTypes));
-    }
-    GET_LIST.put(Method.GET_BYTES, binaryTypes);
-    GET_LIST.put(Method.GET_DATE,
-        concat(charTypes, EnumSet.of(DATE, TIMESTAMP)));
-    GET_LIST.put(Method.GET_TIME,
-        concat(charTypes, EnumSet.of(TIME, TIMESTAMP)));
-    GET_LIST.put(Method.GET_TIMESTAMP,
-        concat(charTypes, EnumSet.of(DATE, TIME, TIMESTAMP)));
-    GET_LIST.put(Method.GET_ASCII_STREAM,
-        concat(charTypes, binaryTypes, EnumSet.of(CLOB, NCLOB)));
-    GET_LIST.put(Method.GET_BINARY_STREAM,
-        concat(binaryTypes, EnumSet.of(BLOB, SQLXML)));
-    GET_LIST.put(Method.GET_CHARACTER_STREAM,
-        concat(charTypes, binaryTypes, ncharTypes,
-            EnumSet.of(CLOB, NCLOB, SQLXML)));
-    GET_LIST.put(Method.GET_N_CHARACTER_STREAM,
-        concat(
-            charTypes, binaryTypes, ncharTypes, EnumSet.of(CLOB, NCLOB, SQLXML)));
-    GET_LIST.put(Method.GET_CLOB, EnumSet.of(CLOB, NCLOB));
-    GET_LIST.put(Method.GET_N_CLOB, EnumSet.of(CLOB, NCLOB));
-    GET_LIST.put(Method.GET_BLOB, EnumSet.of(BLOB));
-    GET_LIST.put(Method.GET_ARRAY, EnumSet.of(ARRAY));
-    GET_LIST.put(Method.GET_REF, EnumSet.of(REF));
-    GET_LIST.put(Method.GET_BLOB, EnumSet.of(BLOB));
-    GET_LIST.put(Method.GET_URL, EnumSet.of(DATALINK));
-    GET_LIST.put(Method.GET_OBJECT, EnumSet.allOf(SqlType.class));
-    GET_LIST.put(Method.GET_ROW_ID, EnumSet.of(ROWID));
-    GET_LIST.put(Method.GET_SQLXML, EnumSet.of(SQLXML));
-  }
-
-  @SafeVarargs
-  private static <E extends Enum<E>> EnumSet<E> concat(Collection<E>... ess) {
-    final List<E> list = new ArrayList<>();
-    for (Collection<E> es : ess) {
-      list.addAll(es);
-    }
-    return EnumSet.copyOf(list);
-  }
-
-  /** Returns whether {@link java.sql.PreparedStatement#setObject} and
-   * {@link PreparedStatement#setNull} can assign a value of a particular class
-   * to a column of a particular SQL type.
-   *
-   * <p>The JDBC standard describes the mapping in table <a href="#B5">B-5</a>.
-   */
-  public static boolean canSet(Class aClass, SqlType sqlType) {
-    final EnumSet<SqlType> sqlTypes = SET_LIST.get(aClass);
-    return sqlTypes != null && sqlTypes.contains(sqlType);
-  }
-
-  /** Returns whether {@link java.sql.ResultSet#getInt(int)} and similar methods
-   * can convert a value to a particular SQL type.
-   *
-   * <p>The JDBC standard describes the mapping in table <a href="#B6">B-6</a>.
-   */
-  public static boolean canGet(Method method, SqlType sqlType) {
-    final EnumSet<SqlType> sqlTypes = GET_LIST.get(method);
-    return sqlTypes != null && sqlTypes.contains(sqlType);
-  }
-
-  /** Getter methods in {@link java.sql.ResultSet}. */
-  public enum Method {
-    GET_BYTE("getByte"),
-    GET_SHORT("getShort"),
-    GET_INT("getInt"),
-    GET_LONG("getLong"),
-    GET_FLOAT("getFloat"),
-    GET_DOUBLE("getDouble"),
-    GET_BIG_DECIMAL("getBigDecimal"),
-    GET_BOOLEAN("getBoolean"),
-    GET_STRING("getString"),
-    GET_N_STRING("getNString"),
-    GET_BYTES("getBytes"),
-    GET_DATE("getDate"),
-    GET_TIME("getTime"),
-    GET_TIMESTAMP("getTimestamp"),
-    GET_ASCII_STREAM("getAsciiStream"),
-    GET_BINARY_STREAM("getBinaryStream"),
-    GET_CHARACTER_STREAM("getCharacterStream"),
-    GET_N_CHARACTER_STREAM("getNCharacterStream"),
-    GET_CLOB("getClob"),
-    GET_N_CLOB("getNClob"),
-    GET_BLOB("getBlob"),
-    GET_ARRAY("getArray"),
-    GET_REF("getRef"),
-    GET_URL("getURL"),
-    GET_OBJECT("getObject"),
-    GET_ROW_ID("getRowId"),
-    GET_SQLXML("getSQLXML");
-
-    public final String methodName;
-
-    Method(String methodName) {
-      this.methodName = methodName;
-    }
-  }
-}
-
-// End SqlType.java


[31/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/test/java/org/apache/calcite/avatica/MetaResultSetTest.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/test/java/org/apache/calcite/avatica/MetaResultSetTest.java b/avatica/core/src/test/java/org/apache/calcite/avatica/MetaResultSetTest.java
deleted file mode 100644
index 3d5eb80..0000000
--- a/avatica/core/src/test/java/org/apache/calcite/avatica/MetaResultSetTest.java
+++ /dev/null
@@ -1,655 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-
-import org.apache.calcite.avatica.remote.TypedValue;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
-import java.sql.SQLException;
-import java.sql.Types;
-import java.util.List;
-import java.util.Locale;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * Test that {@code ResultSet} returned by {@code DatabaseMetaData} methods
- * conform to JDBC specification.
- */
-public class MetaResultSetTest {
-  /**
-   * A fake test driver for test.
-   */
-  private static final class TestDriver extends UnregisteredDriver {
-
-    @Override protected DriverVersion createDriverVersion() {
-      return new DriverVersion("test", "test 0.0.0", "test", "test 0.0.0", false, 0, 0, 0, 0);
-    }
-
-    @Override protected String getConnectStringPrefix() {
-      return "jdbc:test";
-    }
-
-    @Override public Meta createMeta(AvaticaConnection connection) {
-      return new TestMetaImpl(connection);
-    }
-  }
-
-  /**
-   * Fake meta implementation for test driver.
-   */
-  public static final class TestMetaImpl extends MetaImpl {
-    public TestMetaImpl(AvaticaConnection connection) {
-      super(connection);
-    }
-
-    @Override public StatementHandle prepare(ConnectionHandle ch, String sql, long maxRowCount) {
-      throw new UnsupportedOperationException();
-    }
-
-    @SuppressWarnings("deprecation")
-    @Override public ExecuteResult prepareAndExecute(StatementHandle h, String sql,
-        long maxRowCount, PrepareCallback callback) throws NoSuchStatementException {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override public ExecuteResult prepareAndExecute(StatementHandle h, String sql,
-        long maxRowCount, int maxRowsInFirstFrame, PrepareCallback callback)
-        throws NoSuchStatementException {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override public ExecuteBatchResult prepareAndExecuteBatch(StatementHandle h,
-        List<String> sqlCommands) throws NoSuchStatementException {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override public ExecuteBatchResult executeBatch(StatementHandle h,
-        List<List<TypedValue>> parameterValues) throws NoSuchStatementException {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override public Frame fetch(StatementHandle h, long offset, int fetchMaxRowCount)
-        throws NoSuchStatementException, MissingResultsException {
-      throw new UnsupportedOperationException();
-    }
-
-    @SuppressWarnings("deprecation")
-    @Override public ExecuteResult execute(StatementHandle h, List<TypedValue> parameterValues,
-        long maxRowCount) throws NoSuchStatementException {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override public ExecuteResult execute(StatementHandle h, List<TypedValue> parameterValues,
-        int maxRowsInFirstFrame) throws NoSuchStatementException {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override public void closeStatement(StatementHandle h) {
-    }
-
-    @Override public boolean syncResults(StatementHandle sh, QueryState state, long offset)
-        throws NoSuchStatementException {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override public void commit(ConnectionHandle ch) {
-      throw new UnsupportedOperationException();
-    }
-
-    @Override public void rollback(ConnectionHandle ch) {
-      throw new UnsupportedOperationException();
-    }
-  }
-
-  private Connection connection;
-
-  @Before public void setUp() throws SQLException {
-    connection = new TestDriver().connect("jdbc:test", null);
-  }
-
-  @After public void tearDown() throws SQLException {
-    connection.close();
-  }
-
-  @Test public void testGetAttributes() throws SQLException {
-    DatabaseMetaData metadata = getDatabaseMetadata();
-    try (ResultSet rs = metadata.getAttributes(null, null, null, null)) {
-      ResultSetMetaData rsMeta = rs.getMetaData();
-
-      assertEquals(21, rsMeta.getColumnCount());
-      assertColumn(rsMeta, 1, "TYPE_CAT", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 2, "TYPE_SCHEM", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 3, "TYPE_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 4, "ATTR_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 5, "DATA_TYPE", Types.INTEGER, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 6, "ATTR_TYPE_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 7, "ATTR_SIZE", Types.INTEGER, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 8, "DECIMAL_DIGITS", Types.INTEGER, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 9, "NUM_PREC_RADIX", Types.INTEGER, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 10, "NULLABLE", Types.INTEGER, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 11, "REMARKS", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 12, "ATTR_DEF", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 13, "SQL_DATA_TYPE", Types.INTEGER,
-          DatabaseMetaData.columnNullableUnknown);
-      assertColumn(rsMeta, 14, "SQL_DATETIME_SUB", Types.INTEGER,
-          DatabaseMetaData.columnNullableUnknown);
-      assertColumn(rsMeta, 15, "CHAR_OCTET_LENGTH", Types.INTEGER, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 16, "ORDINAL_POSITION", Types.INTEGER, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 17, "IS_NULLABLE", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 18, "SCOPE_CATALOG", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 19, "SCOPE_SCHEMA", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 20, "SCOPE_TABLE", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 21, "SOURCE_DATA_TYPE", Types.SMALLINT, DatabaseMetaData.columnNullable);
-    }
-  }
-
-  @Test public void testGetBestRowIdentifier() throws SQLException {
-    DatabaseMetaData metadata = getDatabaseMetadata();
-    try (ResultSet rs = metadata.getBestRowIdentifier(null, null, null,
-        DatabaseMetaData.bestRowUnknown, false)) {
-      ResultSetMetaData rsMeta = rs.getMetaData();
-
-      assertEquals(8, rsMeta.getColumnCount());
-      assertColumn(rsMeta, 1, "SCOPE", Types.SMALLINT, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 2, "COLUMN_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 3, "DATA_TYPE", Types.INTEGER, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 4, "TYPE_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 5, "COLUMN_SIZE", Types.INTEGER, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 6, "BUFFER_LENGTH", Types.INTEGER,
-          DatabaseMetaData.columnNullableUnknown);
-      assertColumn(rsMeta, 7, "DECIMAL_DIGITS", Types.SMALLINT, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 8, "PSEUDO_COLUMN", Types.SMALLINT, DatabaseMetaData.columnNoNulls);
-    }
-  }
-
-  @Test public void testGetCatalogs() throws SQLException {
-    DatabaseMetaData metadata = getDatabaseMetadata();
-    try (ResultSet rs = metadata.getCatalogs()) {
-      ResultSetMetaData rsMeta = rs.getMetaData();
-
-      assertEquals(1, rsMeta.getColumnCount());
-      assertColumn(rsMeta, 1, "TABLE_CAT", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-    }
-  }
-
-  @Test public void testGetClientInfoProperties() throws SQLException {
-    DatabaseMetaData metadata = getDatabaseMetadata();
-    try (ResultSet rs = metadata.getClientInfoProperties()) {
-      ResultSetMetaData rsMeta = rs.getMetaData();
-
-      assertEquals(4, rsMeta.getColumnCount());
-      assertColumn(rsMeta, 1, "NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 2, "MAX_LEN", Types.INTEGER, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 3, "DEFAULT_VALUE", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 4, "DESCRIPTION", Types.VARCHAR, DatabaseMetaData.columnNullable);
-    }
-  }
-
-  @Test public void testGetColumnPrivileges() throws SQLException {
-    DatabaseMetaData metadata = getDatabaseMetadata();
-    try (ResultSet rs = metadata.getColumnPrivileges(null, null, null, null)) {
-      ResultSetMetaData rsMeta = rs.getMetaData();
-
-      assertEquals(8, rsMeta.getColumnCount());
-      assertColumn(rsMeta, 1, "TABLE_CAT", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 2, "TABLE_SCHEM", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 3, "TABLE_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 4, "COLUMN_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 5, "GRANTOR", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 6, "GRANTEE", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 7, "PRIVILEGE", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 8, "IS_GRANTABLE", Types.VARCHAR, DatabaseMetaData.columnNullable);
-    }
-  }
-
-  @Test public void testGetColumns() throws SQLException {
-    DatabaseMetaData metadata = getDatabaseMetadata();
-    try (ResultSet rs = metadata.getColumns(null, null, null, null)) {
-      ResultSetMetaData rsMeta = rs.getMetaData();
-
-      assertEquals(24, rsMeta.getColumnCount());
-      assertColumn(rsMeta, 1, "TABLE_CAT", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 2, "TABLE_SCHEM", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 3, "TABLE_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 4, "COLUMN_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 5, "DATA_TYPE", Types.INTEGER, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 6, "TYPE_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 7, "COLUMN_SIZE", Types.INTEGER, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 8, "BUFFER_LENGTH", Types.INTEGER,
-          DatabaseMetaData.columnNullableUnknown);
-      assertColumn(rsMeta, 9, "DECIMAL_DIGITS", Types.INTEGER, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 10, "NUM_PREC_RADIX", Types.INTEGER, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 11, "NULLABLE", Types.INTEGER, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 12, "REMARKS", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 13, "COLUMN_DEF", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 14, "SQL_DATA_TYPE", Types.INTEGER,
-          DatabaseMetaData.columnNullableUnknown);
-      assertColumn(rsMeta, 15, "SQL_DATETIME_SUB", Types.INTEGER,
-          DatabaseMetaData.columnNullableUnknown);
-      assertColumn(rsMeta, 16, "CHAR_OCTET_LENGTH", Types.INTEGER, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 17, "ORDINAL_POSITION", Types.INTEGER, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 18, "IS_NULLABLE", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 19, "SCOPE_CATALOG", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 20, "SCOPE_SCHEMA", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 21, "SCOPE_TABLE", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 22, "SOURCE_DATA_TYPE", Types.SMALLINT, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 23, "IS_AUTOINCREMENT", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 24, "IS_GENERATEDCOLUMN", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-    }
-  }
-
-  @Test public void testGetCrossReference() throws SQLException {
-    DatabaseMetaData metadata = getDatabaseMetadata();
-    try (ResultSet rs = metadata.getCrossReference(null, null, null, null, null, null)) {
-      ResultSetMetaData rsMeta = rs.getMetaData();
-
-      assertEquals(14, rsMeta.getColumnCount());
-      assertColumn(rsMeta, 1, "PKTABLE_CAT", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 2, "PKTABLE_SCHEM", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 3, "PKTABLE_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 4, "PKCOLUMN_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 5, "FKTABLE_CAT", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 6, "FKTABLE_SCHEM", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 7, "FKTABLE_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 8, "FKCOLUMN_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 9, "KEY_SEQ", Types.SMALLINT, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 10, "UPDATE_RULE", Types.SMALLINT, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 11, "DELETE_RULE", Types.SMALLINT, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 12, "FK_NAME", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 13, "PK_NAME", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 14, "DEFERABILITY", Types.SMALLINT, DatabaseMetaData.columnNoNulls);
-    }
-  }
-
-  @Test public void testGetExportedKeys() throws SQLException {
-    DatabaseMetaData metadata = getDatabaseMetadata();
-    try (ResultSet rs = metadata.getExportedKeys(null, null, null)) {
-      ResultSetMetaData rsMeta = rs.getMetaData();
-
-      assertEquals(14, rsMeta.getColumnCount());
-      assertColumn(rsMeta, 1, "PKTABLE_CAT", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 2, "PKTABLE_SCHEM", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 3, "PKTABLE_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 4, "PKCOLUMN_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 5, "FKTABLE_CAT", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 6, "FKTABLE_SCHEM", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 7, "FKTABLE_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 8, "FKCOLUMN_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 9, "KEY_SEQ", Types.SMALLINT, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 10, "UPDATE_RULE", Types.SMALLINT, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 11, "DELETE_RULE", Types.SMALLINT, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 12, "FK_NAME", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 13, "PK_NAME", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 14, "DEFERABILITY", Types.SMALLINT, DatabaseMetaData.columnNoNulls);
-    }
-  }
-
-  @Test public void testGetFunctionColumns() throws SQLException {
-    DatabaseMetaData metadata = getDatabaseMetadata();
-    try (ResultSet rs = metadata.getFunctionColumns(null, null, null, null)) {
-      ResultSetMetaData rsMeta = rs.getMetaData();
-
-      assertEquals(17, rsMeta.getColumnCount());
-      assertColumn(rsMeta, 1, "FUNCTION_CAT", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 2, "FUNCTION_SCHEM", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 3, "FUNCTION_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 4, "COLUMN_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 5, "COLUMN_TYPE", Types.SMALLINT, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 6, "DATA_TYPE", Types.INTEGER, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 7, "TYPE_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 8, "PRECISION", Types.INTEGER, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 9, "LENGTH", Types.INTEGER, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 10, "SCALE", Types.SMALLINT, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 11, "RADIX", Types.SMALLINT, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 12, "NULLABLE", Types.SMALLINT, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 13, "REMARKS", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 14, "CHAR_OCTET_LENGTH", Types.INTEGER, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 15, "ORDINAL_POSITION", Types.INTEGER, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 16, "IS_NULLABLE", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 17, "SPECIFIC_NAME", Types.VARCHAR, DatabaseMetaData.columnNullable);
-    }
-  }
-
-  @Test public void testGetFunctions() throws SQLException {
-    DatabaseMetaData metadata = getDatabaseMetadata();
-    try (ResultSet rs = metadata.getFunctions(null, null, null)) {
-      ResultSetMetaData rsMeta = rs.getMetaData();
-
-      assertEquals(6, rsMeta.getColumnCount());
-      assertColumn(rsMeta, 1, "FUNCTION_CAT", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 2, "FUNCTION_SCHEM", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 3, "FUNCTION_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 4, "REMARKS", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 5, "FUNCTION_TYPE", Types.SMALLINT, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 6, "SPECIFIC_NAME", Types.VARCHAR, DatabaseMetaData.columnNullable);
-    }
-  }
-
-  @Test public void testGetImportedKeys() throws SQLException {
-    DatabaseMetaData metadata = getDatabaseMetadata();
-    try (ResultSet rs = metadata.getImportedKeys(null, null, null)) {
-      ResultSetMetaData rsMeta = rs.getMetaData();
-
-      assertEquals(14, rsMeta.getColumnCount());
-      assertColumn(rsMeta, 1, "PKTABLE_CAT", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 2, "PKTABLE_SCHEM", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 3, "PKTABLE_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 4, "PKCOLUMN_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 5, "FKTABLE_CAT", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 6, "FKTABLE_SCHEM", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 7, "FKTABLE_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 8, "FKCOLUMN_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 9, "KEY_SEQ", Types.SMALLINT, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 10, "UPDATE_RULE", Types.SMALLINT, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 11, "DELETE_RULE", Types.SMALLINT, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 12, "FK_NAME", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 13, "PK_NAME", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 14, "DEFERABILITY", Types.SMALLINT, DatabaseMetaData.columnNoNulls);
-    }
-  }
-
-  @Test public void testGetIndexInfo() throws SQLException {
-    DatabaseMetaData metadata = getDatabaseMetadata();
-    try (ResultSet rs = metadata.getIndexInfo(null, null, null, false, false)) {
-      ResultSetMetaData rsMeta = rs.getMetaData();
-
-      assertEquals(13, rsMeta.getColumnCount());
-      assertColumn(rsMeta, 1, "TABLE_CAT", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 2, "TABLE_SCHEM", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 3, "TABLE_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 4, "NON_UNIQUE", Types.BOOLEAN, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 5, "INDEX_QUALIFIER", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 6, "INDEX_NAME", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 7, "TYPE", Types.SMALLINT, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 8, "ORDINAL_POSITION", Types.SMALLINT, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 9, "COLUMN_NAME", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 10, "ASC_OR_DESC", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 11, "CARDINALITY", Types.BIGINT, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 12, "PAGES", Types.BIGINT, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 13, "FILTER_CONDITION", Types.VARCHAR, DatabaseMetaData.columnNullable);
-    }
-  }
-
-  @Test public void testGetPrimaryKeys() throws SQLException {
-    DatabaseMetaData metadata = getDatabaseMetadata();
-    try (ResultSet rs = metadata.getPrimaryKeys(null, null, null)) {
-      ResultSetMetaData rsMeta = rs.getMetaData();
-
-      assertEquals(6, rsMeta.getColumnCount());
-      assertColumn(rsMeta, 1, "TABLE_CAT", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 2, "TABLE_SCHEM", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 3, "TABLE_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 4, "COLUMN_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 5, "KEY_SEQ", Types.SMALLINT, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 6, "PK_NAME", Types.VARCHAR, DatabaseMetaData.columnNullable);
-    }
-  }
-
-  @Test public void testGetProcedureColumns() throws SQLException {
-    DatabaseMetaData metadata = getDatabaseMetadata();
-    try (ResultSet rs = metadata.getProcedureColumns(null, null, null, null)) {
-      ResultSetMetaData rsMeta = rs.getMetaData();
-
-      assertEquals(20, rsMeta.getColumnCount());
-      assertColumn(rsMeta, 1, "PROCEDURE_CAT", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 2, "PROCEDURE_SCHEM", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 3, "PROCEDURE_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 4, "COLUMN_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 5, "COLUMN_TYPE", Types.SMALLINT, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 6, "DATA_TYPE", Types.INTEGER, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 7, "TYPE_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 8, "PRECISION", Types.INTEGER, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 9, "LENGTH", Types.INTEGER, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 10, "SCALE", Types.SMALLINT, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 11, "RADIX", Types.SMALLINT, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 12, "NULLABLE", Types.SMALLINT, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 13, "REMARKS", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 14, "COLUMN_DEF", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 15, "SQL_DATA_TYPE", Types.INTEGER,
-          DatabaseMetaData.columnNullableUnknown);
-      assertColumn(rsMeta, 16, "SQL_DATETIME_SUB", Types.INTEGER,
-          DatabaseMetaData.columnNullableUnknown);
-      assertColumn(rsMeta, 17, "CHAR_OCTET_LENGTH", Types.INTEGER, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 18, "ORDINAL_POSITION", Types.INTEGER, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 19, "IS_NULLABLE", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 20, "SPECIFIC_NAME", Types.VARCHAR, DatabaseMetaData.columnNullable);
-    }
-  }
-
-  @Test public void testGetProcedures() throws SQLException {
-    DatabaseMetaData metadata = getDatabaseMetadata();
-    try (ResultSet rs = metadata.getProcedures(null, null, null)) {
-      ResultSetMetaData rsMeta = rs.getMetaData();
-
-      assertEquals(9, rsMeta.getColumnCount());
-      assertColumn(rsMeta, 1, "PROCEDURE_CAT", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 2, "PROCEDURE_SCHEM", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 3, "PROCEDURE_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 7, "REMARKS", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 8, "PROCEDURE_TYPE", Types.SMALLINT, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 9, "SPECIFIC_NAME", Types.VARCHAR, DatabaseMetaData.columnNullable);
-    }
-  }
-
-  @Test public void testGetPseudoColumns() throws SQLException {
-    DatabaseMetaData metadata = getDatabaseMetadata();
-    try (ResultSet rs = metadata.getPseudoColumns(null, null, null, null)) {
-      ResultSetMetaData rsMeta = rs.getMetaData();
-
-      assertEquals(12, rsMeta.getColumnCount());
-      assertColumn(rsMeta, 1, "TABLE_CAT", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 2, "TABLE_SCHEM", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 3, "TABLE_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 4, "COLUMN_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 5, "DATA_TYPE", Types.INTEGER, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 6, "COLUMN_SIZE", Types.INTEGER, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 7, "DECIMAL_DIGITS", Types.INTEGER, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 8, "NUM_PREC_RADIX", Types.INTEGER, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 9, "COLUMN_USAGE", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 10, "REMARKS", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 11, "CHAR_OCTET_LENGTH", Types.INTEGER, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 12, "IS_NULLABLE", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-    }
-  }
-
-  @Test public void testGetSchemas() throws SQLException {
-    DatabaseMetaData metadata = getDatabaseMetadata();
-    try (ResultSet rs = metadata.getSchemas(null, null)) {
-      ResultSetMetaData rsMeta = rs.getMetaData();
-
-      assertEquals(2, rsMeta.getColumnCount());
-      assertColumn(rsMeta, 1, "TABLE_SCHEM", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 2, "TABLE_CATALOG", Types.VARCHAR, DatabaseMetaData.columnNullable);
-    }
-  }
-
-  @Test public void testGetSuperTables() throws SQLException {
-    DatabaseMetaData metadata = getDatabaseMetadata();
-    try (ResultSet rs = metadata.getSuperTables(null, null, null)) {
-      ResultSetMetaData rsMeta = rs.getMetaData();
-
-      assertEquals(4, rsMeta.getColumnCount());
-      assertColumn(rsMeta, 1, "TABLE_CAT", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 2, "TABLE_SCHEM", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 3, "TABLE_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 4, "SUPERTABLE_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-    }
-  }
-
-  @Test public void testGetSuperTypes() throws SQLException {
-    DatabaseMetaData metadata = getDatabaseMetadata();
-    try (ResultSet rs = metadata.getSuperTypes(null, null, null)) {
-      ResultSetMetaData rsMeta = rs.getMetaData();
-
-      assertEquals(6, rsMeta.getColumnCount());
-      assertColumn(rsMeta, 1, "TYPE_CAT", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 2, "TYPE_SCHEM", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 3, "TYPE_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 4, "SUPERTYPE_CAT", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 5, "SUPERTYPE_SCHEM", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 6, "SUPERTYPE_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-    }
-  }
-
-  @Test public void testGetTablePrivileges() throws SQLException {
-    DatabaseMetaData metadata = getDatabaseMetadata();
-    try (ResultSet rs = metadata.getTablePrivileges(null, null, null)) {
-      ResultSetMetaData rsMeta = rs.getMetaData();
-
-      assertEquals(7, rsMeta.getColumnCount());
-      assertColumn(rsMeta, 1, "TABLE_CAT", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 2, "TABLE_SCHEM", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 3, "TABLE_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 4, "GRANTOR", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 5, "GRANTEE", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 6, "PRIVILEGE", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 7, "IS_GRANTABLE", Types.VARCHAR, DatabaseMetaData.columnNullable);
-    }
-  }
-
-  @Test public void testGetTables() throws SQLException {
-    DatabaseMetaData metadata = getDatabaseMetadata();
-    try (ResultSet rs = metadata.getTables(null, null, null, null)) {
-      ResultSetMetaData rsMeta = rs.getMetaData();
-
-      assertEquals(10, rsMeta.getColumnCount());
-      assertColumn(rsMeta, 1, "TABLE_CAT", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 2, "TABLE_SCHEM", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 3, "TABLE_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 4, "TABLE_TYPE", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 5, "REMARKS", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 6, "TYPE_CAT", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 7, "TYPE_SCHEM", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 8, "TYPE_NAME", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 9, "SELF_REFERENCING_COL_NAME", Types.VARCHAR,
-          DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 10, "REF_GENERATION", Types.VARCHAR, DatabaseMetaData.columnNullable);
-    }
-  }
-
-  @Test public void testGetTableTypes() throws SQLException {
-    DatabaseMetaData metadata = getDatabaseMetadata();
-    try (ResultSet rs = metadata.getTableTypes()) {
-      ResultSetMetaData rsMeta = rs.getMetaData();
-
-      assertEquals(1, rsMeta.getColumnCount());
-      assertColumn(rsMeta, 1, "TABLE_TYPE", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-    }
-  }
-
-  @Test public void testGetTypeInfo() throws SQLException {
-    DatabaseMetaData metadata = getDatabaseMetadata();
-    try (ResultSet rs = metadata.getTypeInfo()) {
-      ResultSetMetaData rsMeta = rs.getMetaData();
-
-      assertEquals(18, rsMeta.getColumnCount());
-      assertColumn(rsMeta, 1, "TYPE_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 2, "DATA_TYPE", Types.INTEGER, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 3, "PRECISION", Types.INTEGER, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 4, "LITERAL_PREFIX", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 5, "LITERAL_SUFFIX", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 6, "CREATE_PARAMS", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 7, "NULLABLE", Types.SMALLINT, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 8, "CASE_SENSITIVE", Types.BOOLEAN, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 9, "SEARCHABLE", Types.SMALLINT, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 10, "UNSIGNED_ATTRIBUTE", Types.BOOLEAN, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 11, "FIXED_PREC_SCALE", Types.BOOLEAN, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 12, "AUTO_INCREMENT", Types.BOOLEAN, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 13, "LOCAL_TYPE_NAME", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 14, "MINIMUM_SCALE", Types.SMALLINT, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 15, "MAXIMUM_SCALE", Types.SMALLINT, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 16, "SQL_DATA_TYPE", Types.INTEGER,
-          DatabaseMetaData.columnNullableUnknown);
-      assertColumn(rsMeta, 17, "SQL_DATETIME_SUB", Types.INTEGER,
-          DatabaseMetaData.columnNullableUnknown);
-      assertColumn(rsMeta, 18, "NUM_PREC_RADIX", Types.INTEGER, DatabaseMetaData.columnNullable);
-    }
-  }
-
-  @Test public void testGetUDTs() throws SQLException {
-    DatabaseMetaData metadata = getDatabaseMetadata();
-    try (ResultSet rs = metadata.getUDTs(null, null, null, null)) {
-      ResultSetMetaData rsMeta = rs.getMetaData();
-
-      assertEquals(7, rsMeta.getColumnCount());
-      assertColumn(rsMeta, 1, "TYPE_CAT", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 2, "TYPE_SCHEM", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 3, "TYPE_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 4, "CLASS_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 5, "DATA_TYPE", Types.INTEGER, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 6, "REMARKS", Types.VARCHAR, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 7, "BASE_TYPE", Types.SMALLINT, DatabaseMetaData.columnNullable);
-    }
-  }
-
-  @Test public void testGetVersionColumns() throws SQLException {
-    DatabaseMetaData metadata = getDatabaseMetadata();
-    try (ResultSet rs = metadata.getVersionColumns(null, null, null)) {
-      ResultSetMetaData rsMeta = rs.getMetaData();
-
-      assertEquals(8, rsMeta.getColumnCount());
-      assertColumn(rsMeta, 1, "SCOPE", Types.SMALLINT, DatabaseMetaData.columnNullableUnknown);
-      assertColumn(rsMeta, 2, "COLUMN_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 3, "DATA_TYPE", Types.INTEGER, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 4, "TYPE_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
-      assertColumn(rsMeta, 5, "COLUMN_SIZE", Types.INTEGER, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 6, "BUFFER_LENGTH", Types.INTEGER, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 7, "DECIMAL_DIGITS", Types.SMALLINT, DatabaseMetaData.columnNullable);
-      assertColumn(rsMeta, 8, "PSEUDO_COLUMN", Types.SMALLINT, DatabaseMetaData.columnNoNulls);
-    }
-  }
-
-  private static void assertColumn(ResultSetMetaData rsMeta, int column, String name, int type,
-      int nullable) throws SQLException {
-    assertEquals(
-        String.format(Locale.ROOT,
-            "Expected column %d to be named '%s', was '%s'.",
-            column, name, rsMeta.getColumnName(column)),
-        name,
-        rsMeta.getColumnName(column));
-
-    assertEquals(
-        String.format(Locale.ROOT,
-            "Expected column %d type to be '%d', was '%d'.",
-            column, type, rsMeta.getColumnType(column)),
-        type,
-        rsMeta.getColumnType(column));
-
-    assertEquals(
-        String.format(Locale.ROOT,
-            "Expected column %d nullability to be '%d', was '%d'.",
-            column, nullable, rsMeta.isNullable(column)),
-        nullable,
-        rsMeta.isNullable(column));
-  }
-
-  private DatabaseMetaData getDatabaseMetadata() throws SQLException {
-    return connection.getMetaData();
-  }
-
-}
-
-// End MetaResultSetTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/test/java/org/apache/calcite/avatica/QueryStateTest.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/test/java/org/apache/calcite/avatica/QueryStateTest.java b/avatica/core/src/test/java/org/apache/calcite/avatica/QueryStateTest.java
deleted file mode 100644
index d97bfa2..0000000
--- a/avatica/core/src/test/java/org/apache/calcite/avatica/QueryStateTest.java
+++ /dev/null
@@ -1,513 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import org.apache.calcite.avatica.remote.MetaDataOperation;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.ResultSet;
-import java.sql.Statement;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * Tests that {@link QueryState} properly retains the necessary state to recreate
- * a {@link ResultSet}.
- */
-public class QueryStateTest {
-
-  private Connection conn;
-  private DatabaseMetaData metadata;
-  private Statement statement;
-
-
-  @Before
-  public void setup() throws Exception {
-    conn = Mockito.mock(Connection.class);
-    metadata = Mockito.mock(DatabaseMetaData.class);
-    statement = Mockito.mock(Statement.class);
-
-    Mockito.when(conn.getMetaData()).thenReturn(metadata);
-  }
-
-  @Test
-  public void testMetadataGetAttributes() throws Exception {
-    final String catalog = "catalog";
-    final String schemaPattern = null;
-    final String typeNamePattern = "%";
-    final String attributeNamePattern = "%";
-
-    QueryState state = new QueryState(MetaDataOperation.GET_ATTRIBUTES, catalog, schemaPattern,
-        typeNamePattern, attributeNamePattern);
-
-    state.invoke(conn, statement);
-
-    Mockito.verify(metadata).getAttributes(catalog, schemaPattern, typeNamePattern,
-        attributeNamePattern);
-  }
-
-  @Test
-  public void testMetadataGetBestRowIdentifier() throws Exception {
-    final String catalog = "catalog";
-    final String schema = null;
-    final String table = "table";
-    final int scope = 1;
-    final boolean nullable = true;
-
-    QueryState state = new QueryState(MetaDataOperation.GET_BEST_ROW_IDENTIFIER, new Object[] {
-      catalog,
-      schema,
-      table,
-      scope,
-      nullable
-    });
-
-    state.invoke(conn, statement);
-
-    Mockito.verify(metadata).getBestRowIdentifier(catalog, schema, table, scope, nullable);
-  }
-
-  @Test
-  public void testMetadataGetCatalogs() throws Exception {
-    QueryState state = new QueryState(MetaDataOperation.GET_CATALOGS, new Object[0]);
-
-    state.invoke(conn, statement);
-
-    Mockito.verify(metadata).getCatalogs();
-  }
-
-  @Test
-  public void testMetadataGetColumnPrivileges() throws Exception {
-    final String catalog = null;
-    final String schema = "schema";
-    final String table = "table";
-    final String columnNamePattern = "%";
-
-    QueryState state = new QueryState(MetaDataOperation.GET_COLUMN_PRIVILEGES, new Object[] {
-      catalog,
-      schema,
-      table,
-      columnNamePattern
-    });
-
-    state.invoke(conn, statement);
-
-    Mockito.verify(metadata).getColumnPrivileges(catalog, schema, table, columnNamePattern);
-  }
-
-  @Test
-  public void testMetadataGetColumns() throws Exception {
-    final String catalog = null;
-    final String schemaPattern = "%";
-    final String tableNamePattern = "%";
-    final String columnNamePattern = "%";
-
-    QueryState state = new QueryState(MetaDataOperation.GET_COLUMNS, new Object[] {
-      catalog,
-      schemaPattern,
-      tableNamePattern,
-      columnNamePattern
-    });
-
-    state.invoke(conn, statement);
-
-    Mockito.verify(metadata).getColumns(catalog, schemaPattern, tableNamePattern,
-        columnNamePattern);
-  }
-
-  @Test
-  public void testMetadataGetCrossReference() throws Exception {
-    final String parentCatalog = null;
-    final String parentSchema = null;
-    final String parentTable = "%";
-    final String foreignCatalog = null;
-    final String foreignSchema = null;
-    final String foreignTable = "%";
-
-    QueryState state = new QueryState(MetaDataOperation.GET_CROSS_REFERENCE, new Object[] {
-      parentCatalog,
-      parentSchema,
-      parentTable,
-      foreignCatalog,
-      foreignSchema,
-      foreignTable
-    });
-
-    state.invoke(conn, statement);
-
-    Mockito.verify(metadata).getCrossReference(parentCatalog, parentSchema, parentTable,
-        foreignCatalog, foreignSchema, foreignTable);
-  }
-
-  @Test
-  public void testMetadataGetExportedKeys() throws Exception {
-    final String catalog = "";
-    final String schema = null;
-    final String table = "mytable";
-
-    QueryState state = new QueryState(MetaDataOperation.GET_EXPORTED_KEYS, new Object[] {
-      catalog,
-      schema,
-      table
-    });
-
-    state.invoke(conn, statement);
-
-    Mockito.verify(metadata).getExportedKeys(catalog, schema, table);
-  }
-
-  @Test
-  public void testMetadataGetFunctionColumns() throws Exception {
-    final String catalog = null;
-    final String schemaPattern = "%";
-    final String functionNamePattern = "%";
-    final String columnNamePattern = "%";
-
-    QueryState state = new QueryState(MetaDataOperation.GET_FUNCTION_COLUMNS, new Object[] {
-      catalog,
-      schemaPattern,
-      functionNamePattern,
-      columnNamePattern
-    });
-
-    state.invoke(conn, statement);
-
-    Mockito.verify(metadata).getFunctionColumns(catalog, schemaPattern, functionNamePattern,
-        columnNamePattern);
-  }
-
-  @Test
-  public void testMetadataGetFunctions() throws Exception {
-    final String catalog = null;
-    final String schemaPattern = "%";
-    final String functionNamePattern = "%";
-
-    QueryState state = new QueryState(MetaDataOperation.GET_FUNCTIONS, new Object[] {
-      catalog,
-      schemaPattern,
-      functionNamePattern
-    });
-
-    state.invoke(conn, statement);
-
-    Mockito.verify(metadata).getFunctions(catalog, schemaPattern, functionNamePattern);
-  }
-
-  @Test
-  public void testMetadataGetImportedKeys() throws Exception {
-    final String catalog = "";
-    final String schema = null;
-    final String table = "my_table";
-
-    QueryState state = new QueryState(MetaDataOperation.GET_IMPORTED_KEYS, new Object[] {
-      catalog,
-      schema,
-      table
-    });
-
-    state.invoke(conn, statement);
-
-    Mockito.verify(metadata).getImportedKeys(catalog, schema, table);
-  }
-
-  @Test
-  public void testMetadataGetIndexInfo() throws Exception {
-    final String catalog = "";
-    final String schema = null;
-    final String table = "my_table";
-    final boolean unique = true;
-    final boolean approximate = true;
-
-    QueryState state = new QueryState(MetaDataOperation.GET_INDEX_INFO, new Object[] {
-      catalog,
-      schema,
-      table,
-      unique,
-      approximate
-    });
-
-    state.invoke(conn, statement);
-
-    Mockito.verify(metadata).getIndexInfo(catalog, schema, table, unique, approximate);
-  }
-
-  @Test
-  public void testMetadataGetPrimaryKeys() throws Exception {
-    final String catalog = "";
-    final String schema = null;
-    final String table = "my_table";
-
-    QueryState state = new QueryState(MetaDataOperation.GET_PRIMARY_KEYS, new Object[] {
-      catalog,
-      schema,
-      table
-    });
-
-    state.invoke(conn, statement);
-
-    Mockito.verify(metadata).getPrimaryKeys(catalog, schema, table);
-  }
-
-  @Test
-  public void testMetadataGetProcedureColumns() throws Exception {
-    final String catalog = "";
-    final String schemaPattern = null;
-    final String procedureNamePattern = "%";
-    final String columnNamePattern = "%";
-
-    QueryState state = new QueryState(MetaDataOperation.GET_PROCEDURE_COLUMNS, new Object[] {
-      catalog,
-      schemaPattern,
-      procedureNamePattern,
-      columnNamePattern
-    });
-
-    state.invoke(conn, statement);
-
-    Mockito.verify(metadata).getProcedureColumns(catalog, schemaPattern, procedureNamePattern,
-        columnNamePattern);
-  }
-
-  @Test
-  public void testMetadataGetProcedures() throws Exception {
-    final String catalog = "";
-    final String schemaPattern = null;
-    final String procedureNamePattern = "%";
-
-    QueryState state = new QueryState(MetaDataOperation.GET_PROCEDURES, new Object[] {
-      catalog,
-      schemaPattern,
-      procedureNamePattern,
-    });
-
-    state.invoke(conn, statement);
-
-    Mockito.verify(metadata).getProcedures(catalog, schemaPattern, procedureNamePattern);
-  }
-
-  @Test
-  public void testMetadataGetPseudoColumns() throws Exception {
-    final String catalog = "";
-    final String schemaPattern = null;
-    final String tableNamePattern = "%";
-    final String columnNamePattern = "%";
-
-    QueryState state = new QueryState(MetaDataOperation.GET_PSEUDO_COLUMNS, new Object[] {
-      catalog,
-      schemaPattern,
-      tableNamePattern,
-      columnNamePattern
-    });
-
-    state.invoke(conn, statement);
-
-    Mockito.verify(metadata).getPseudoColumns(catalog, schemaPattern, tableNamePattern,
-        columnNamePattern);
-  }
-
-  @Test
-  public void testMetadataGetSchemas() throws Exception {
-    QueryState state = new QueryState(MetaDataOperation.GET_SCHEMAS, new Object[0]);
-
-    state.invoke(conn, statement);
-
-    Mockito.verify(metadata).getSchemas();
-  }
-
-  @Test
-  public void testMetadataGetSchemasWithArgs() throws Exception {
-    final String catalog = "";
-    final String schemaPattern = null;
-
-    QueryState state = new QueryState(MetaDataOperation.GET_SCHEMAS_WITH_ARGS, new Object[] {
-      catalog,
-      schemaPattern
-    });
-
-    state.invoke(conn, statement);
-
-    Mockito.verify(metadata).getSchemas(catalog, schemaPattern);
-  }
-
-  @Test
-  public void testMetadataGetSuperTables() throws Exception {
-    final String catalog = "";
-    final String schemaPattern = null;
-    final String tableNamePattern = "%";
-
-    QueryState state = new QueryState(MetaDataOperation.GET_SUPER_TABLES, new Object[] {
-      catalog,
-      schemaPattern,
-      tableNamePattern
-    });
-
-    state.invoke(conn, statement);
-
-    Mockito.verify(metadata).getSuperTables(catalog, schemaPattern, tableNamePattern);
-  }
-
-  @Test
-  public void testMetadataGetSuperTypes() throws Exception {
-    final String catalog = "";
-    final String schemaPattern = null;
-    final String tableNamePattern = "%";
-
-    QueryState state = new QueryState(MetaDataOperation.GET_SUPER_TYPES, new Object[] {
-      catalog,
-      schemaPattern,
-      tableNamePattern
-    });
-
-    state.invoke(conn, statement);
-
-    Mockito.verify(metadata).getSuperTypes(catalog, schemaPattern, tableNamePattern);
-  }
-
-  @Test
-  public void testMetadataGetTablePrivileges() throws Exception {
-    final String catalog = "";
-    final String schemaPattern = null;
-    final String tableNamePattern = "%";
-
-    QueryState state = new QueryState(MetaDataOperation.GET_TABLE_PRIVILEGES, new Object[] {
-      catalog,
-      schemaPattern,
-      tableNamePattern
-    });
-
-    state.invoke(conn, statement);
-
-    Mockito.verify(metadata).getTablePrivileges(catalog, schemaPattern, tableNamePattern);
-  }
-
-  @Test
-  public void testMetadataGetTables() throws Exception {
-    final String catalog = "";
-    final String schemaPattern = null;
-    final String tableNamePattern = "%";
-    final String[] types = new String[] {"VIEW", "TABLE"};
-
-    QueryState state = new QueryState(MetaDataOperation.GET_TABLES, new Object[] {
-      catalog,
-      schemaPattern,
-      tableNamePattern,
-      types
-    });
-
-    state.invoke(conn, statement);
-
-    Mockito.verify(metadata).getTables(catalog, schemaPattern, tableNamePattern, types);
-  }
-
-  @Test
-  public void testMetadataGetTableTypes() throws Exception {
-    QueryState state = new QueryState(MetaDataOperation.GET_TABLE_TYPES, new Object[0]);
-
-    state.invoke(conn, statement);
-
-    Mockito.verify(metadata).getTableTypes();
-  }
-
-  @Test
-  public void testMetadataGetTypeInfo() throws Exception {
-    QueryState state = new QueryState(MetaDataOperation.GET_TYPE_INFO, new Object[0]);
-
-    state.invoke(conn, statement);
-
-    Mockito.verify(metadata).getTypeInfo();
-  }
-
-  @Test
-  public void testMetadataGetUDTs() throws Exception {
-    final String catalog = "";
-    final String schemaPattern = null;
-    final String typeNamePattern = "%";
-    final int[] types = new int[] {1, 2};
-
-    QueryState state = new QueryState(MetaDataOperation.GET_UDTS, new Object[] {
-      catalog,
-      schemaPattern,
-      typeNamePattern,
-      types
-    });
-
-    state.invoke(conn, statement);
-
-    Mockito.verify(metadata).getUDTs(catalog, schemaPattern, typeNamePattern, types);
-  }
-
-  @Test
-  public void testMetadataGetVersionColumns() throws Exception {
-    final String catalog = "";
-    final String schemaPattern = null;
-    final String table = "my_table";
-
-    QueryState state = new QueryState(MetaDataOperation.GET_VERSION_COLUMNS, new Object[] {
-      catalog,
-      schemaPattern,
-      table
-    });
-
-    state.invoke(conn, statement);
-
-    Mockito.verify(metadata).getVersionColumns(catalog, schemaPattern, table);
-  }
-
-  @Test
-  public void testSerialization() throws Exception {
-    final String catalog = "catalog";
-    final String schema = null;
-    final String table = "table";
-    final int scope = 1;
-    final boolean nullable = true;
-
-    QueryState state = new QueryState(MetaDataOperation.GET_BEST_ROW_IDENTIFIER, new Object[] {
-      catalog,
-      schema,
-      table,
-      scope,
-      nullable
-    });
-
-    assertEquals(state, QueryState.fromProto(state.toProto()));
-
-    final String schemaPattern = null;
-    final String typeNamePattern = "%";
-    final int[] types = new int[] {1, 2};
-
-    state = new QueryState(MetaDataOperation.GET_UDTS, new Object[] {
-      catalog,
-      schemaPattern,
-      typeNamePattern,
-      types
-    });
-
-    assertEquals(state, QueryState.fromProto(state.toProto()));
-
-    state = new QueryState("SELECT * FROM foo");
-
-    assertEquals(state, QueryState.fromProto(state.toProto()));
-  }
-
-}
-
-// End QueryStateTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/test/java/org/apache/calcite/avatica/metrics/MetricsHelperTest.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/test/java/org/apache/calcite/avatica/metrics/MetricsHelperTest.java b/avatica/core/src/test/java/org/apache/calcite/avatica/metrics/MetricsHelperTest.java
deleted file mode 100644
index c85312d..0000000
--- a/avatica/core/src/test/java/org/apache/calcite/avatica/metrics/MetricsHelperTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.metrics;
-
-import org.apache.calcite.avatica.remote.MetricsHelper;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * Test class for {@link MetricsHelper}.
- */
-public class MetricsHelperTest {
-
-  @Test(expected = NullPointerException.class) public void testNullConcat() {
-    MetricsHelper.concat(null, "foo");
-  }
-
-  @Test public void testConcat() {
-    String suffix = "suffix";
-    String finalName = getClass().getName() + "." + suffix;
-    assertEquals(finalName, MetricsHelper.concat(getClass(), suffix));
-  }
-
-}
-
-// End MetricsHelperTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/test/java/org/apache/calcite/avatica/remote/AbstractHandlerTest.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/test/java/org/apache/calcite/avatica/remote/AbstractHandlerTest.java b/avatica/core/src/test/java/org/apache/calcite/avatica/remote/AbstractHandlerTest.java
deleted file mode 100644
index 83bf50f..0000000
--- a/avatica/core/src/test/java/org/apache/calcite/avatica/remote/AbstractHandlerTest.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import org.apache.calcite.avatica.AvaticaSeverity;
-import org.apache.calcite.avatica.remote.Handler.HandlerResponse;
-import org.apache.calcite.avatica.remote.Service.ErrorResponse;
-import org.apache.calcite.avatica.remote.Service.Request;
-import org.apache.calcite.avatica.remote.Service.Response;
-
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.Arrays;
-import java.util.Objects;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-/**
- * Test for common functionality across {@link Handler} implementations.
- */
-public class AbstractHandlerTest {
-
-  private String exceptionToString(Exception e) {
-    StringWriter sw = new StringWriter();
-    PrintWriter pw = new PrintWriter(sw);
-    Objects.requireNonNull(e).printStackTrace(pw);
-    return sw.toString();
-  }
-
-  @Test public void testExceptionUnwrappingWithoutContext() {
-    @SuppressWarnings("unchecked")
-    AbstractHandler<String> handler = Mockito.mock(AbstractHandler.class);
-
-    Mockito.when(handler.unwrapException(Mockito.any(Exception.class))).thenCallRealMethod();
-
-    Exception e = new RuntimeException();
-    Response resp = handler.unwrapException(e);
-    assertTrue("Response should be ErrorResponse, but was " + resp.getClass(),
-        resp instanceof ErrorResponse);
-    ErrorResponse errorResp = (ErrorResponse) resp;
-    assertEquals(ErrorResponse.UNKNOWN_ERROR_CODE, errorResp.errorCode);
-    assertEquals(AvaticaSeverity.UNKNOWN, errorResp.severity);
-    assertEquals(Arrays.asList(exceptionToString(e)), errorResp.exceptions);
-
-    e = new AvaticaRuntimeException();
-    resp = handler.unwrapException(e);
-    assertTrue("Response should be ErrorResponse, but was " + resp.getClass(),
-        resp instanceof ErrorResponse);
-    errorResp = (ErrorResponse) resp;
-    assertEquals(ErrorResponse.UNKNOWN_ERROR_CODE, errorResp.errorCode);
-    assertEquals(AvaticaSeverity.UNKNOWN, errorResp.severity);
-    assertEquals(Arrays.asList(exceptionToString(e)), errorResp.exceptions);
-  }
-
-  @Test public void testExceptionUnwrappingWithContext() {
-    @SuppressWarnings("unchecked")
-    AbstractHandler<String> handler = Mockito.mock(AbstractHandler.class);
-
-    Mockito.when(handler.unwrapException(Mockito.any(Exception.class))).thenCallRealMethod();
-
-    final String msg = "Something failed!";
-    AvaticaRuntimeException e = new AvaticaRuntimeException(msg,
-        ErrorResponse.UNKNOWN_ERROR_CODE, ErrorResponse.UNKNOWN_SQL_STATE, AvaticaSeverity.FATAL);
-    Response resp = handler.unwrapException(e);
-    assertTrue("Response should be ErrorResponse, but was " + resp.getClass(),
-        resp instanceof ErrorResponse);
-    ErrorResponse errorResp = (ErrorResponse) resp;
-    assertEquals(ErrorResponse.UNKNOWN_ERROR_CODE, errorResp.errorCode);
-    assertEquals(AvaticaSeverity.FATAL, errorResp.severity);
-    assertEquals(Arrays.asList(exceptionToString(e)), errorResp.exceptions);
-    assertEquals(msg, errorResp.errorMessage);
-  }
-
-  @Test public void testFailedResponseSerialization() throws IOException {
-    @SuppressWarnings("unchecked")
-    final AbstractHandler<String> handler = Mockito.mock(AbstractHandler.class);
-    final Request request = Mockito.mock(Request.class);
-    final Response response = Mockito.mock(Response.class);
-    final IOException exception = new IOException();
-    final ErrorResponse errorResponse = Mockito.mock(ErrorResponse.class);
-    final String serializedErrorResponse = "An ErrorResponse";
-
-    // Accept a serialized request
-    Mockito.when(handler.apply(Mockito.anyString())).thenCallRealMethod();
-    // Deserialize it back into a POJO
-    Mockito.when(handler.decode(Mockito.anyString())).thenReturn(request);
-    // Construct the Response for that Request
-    Mockito.when(request.accept(Mockito.nullable(Service.class))).thenReturn(response);
-    // Throw an IOException when serializing the Response.
-    Mockito.when(handler.encode(response)).thenThrow(exception);
-    Mockito.when(handler.convertToErrorResponse(exception)).thenCallRealMethod();
-    // Convert the IOException into an ErrorResponse
-    Mockito.when(handler.unwrapException(exception)).thenReturn(errorResponse);
-    Mockito.when(handler.encode(errorResponse)).thenReturn(serializedErrorResponse);
-
-    HandlerResponse<String> handlerResp = handler.apply("this is mocked out");
-    assertEquals(500, handlerResp.getStatusCode());
-    assertEquals(serializedErrorResponse, handlerResp.getResponse());
-  }
-
-  @Test public void testFailedErrorResponseSerialization() throws IOException {
-    @SuppressWarnings("unchecked")
-    final AbstractHandler<String> handler = Mockito.mock(AbstractHandler.class);
-    final Request request = Mockito.mock(Request.class);
-    final Response response = Mockito.mock(Response.class);
-    final IOException exception = new IOException();
-    final ErrorResponse errorResponse = Mockito.mock(ErrorResponse.class);
-
-    // Accept a serialized request
-    Mockito.when(handler.apply(Mockito.anyString())).thenCallRealMethod();
-    // Deserialize it back into a POJO
-    Mockito.when(handler.decode(Mockito.anyString())).thenReturn(request);
-    // Construct the Response for that Request
-    Mockito.when(request.accept(Mockito.any(Service.class))).thenReturn(response);
-    // Throw an IOException when serializing the Response.
-    Mockito.when(handler.encode(response)).thenThrow(exception);
-    // Convert the IOException into an ErrorResponse
-    Mockito.when(handler.unwrapException(exception)).thenReturn(errorResponse);
-    // Fail to serialize the ErrorResponse
-    Mockito.when(handler.encode(errorResponse)).thenThrow(exception);
-
-    try {
-      handler.apply("this is mocked out");
-    } catch (RuntimeException e) {
-      assertEquals(exception, e.getCause());
-    }
-  }
-
-  @Test public void testFailedRequestDeserialization() throws IOException {
-    @SuppressWarnings("unchecked")
-    final AbstractHandler<String> handler = Mockito.mock(AbstractHandler.class);
-    final IOException exception = new IOException();
-    final ErrorResponse errorResponse = new ErrorResponse();
-    final String serializedErrorResponse = "Serialized ErrorResponse"; // Faked out
-
-    // Accept a serialized request
-    Mockito.when(handler.apply(Mockito.anyString())).thenCallRealMethod();
-    // Throw an Exception trying to convert it back into a POJO
-    Mockito.when(handler.decode(Mockito.anyString())).thenThrow(exception);
-    Mockito.when(handler.convertToErrorResponse(exception)).thenCallRealMethod();
-    Mockito.when(handler.unwrapException(exception)).thenReturn(errorResponse);
-    Mockito.when(handler.encode(errorResponse)).thenReturn(serializedErrorResponse);
-
-    HandlerResponse<String> response = handler.apply("this is mocked out");
-    assertEquals(serializedErrorResponse, response.getResponse());
-    assertEquals(500, response.getStatusCode());
-  }
-}
-
-// End AbstractHandlerTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/test/java/org/apache/calcite/avatica/remote/AvaticaCommonsHttpClientImplTest.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/test/java/org/apache/calcite/avatica/remote/AvaticaCommonsHttpClientImplTest.java b/avatica/core/src/test/java/org/apache/calcite/avatica/remote/AvaticaCommonsHttpClientImplTest.java
deleted file mode 100644
index 990ecd2..0000000
--- a/avatica/core/src/test/java/org/apache/calcite/avatica/remote/AvaticaCommonsHttpClientImplTest.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import org.apache.http.NoHttpResponseException;
-import org.apache.http.StatusLine;
-import org.apache.http.client.methods.CloseableHttpResponse;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.client.protocol.HttpClientContext;
-import org.apache.http.entity.StringEntity;
-
-import org.junit.Test;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
-
-import java.net.HttpURLConnection;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import static java.nio.charset.StandardCharsets.UTF_8;
-
-/**
- * Test class for {@link AvaticaCommonsHttpClientImpl}
- */
-public class AvaticaCommonsHttpClientImplTest {
-
-  @Test public void testRetryOnHttp503() throws Exception {
-    final byte[] requestBytes = "fake_request".getBytes(UTF_8);
-    final CloseableHttpResponse badResponse = mock(CloseableHttpResponse.class);
-    final CloseableHttpResponse goodResponse = mock(CloseableHttpResponse.class);
-    final StatusLine badStatusLine = mock(StatusLine.class);
-    final StatusLine goodStatusLine = mock(StatusLine.class);
-    final StringEntity responseEntity = new StringEntity("success");
-    final Answer<CloseableHttpResponse> failThenSucceed = new Answer<CloseableHttpResponse>() {
-      private int iteration = 0;
-      @Override public CloseableHttpResponse answer(InvocationOnMock invocation) throws Throwable {
-        iteration++;
-        if (1 == iteration) {
-          return badResponse;
-        } else {
-          return goodResponse;
-        }
-      }
-    };
-
-    final AvaticaCommonsHttpClientImpl client = mock(AvaticaCommonsHttpClientImpl.class);
-
-    when(client.send(any(byte[].class))).thenCallRealMethod();
-    when(client.execute(any(HttpPost.class), any(HttpClientContext.class))).then(failThenSucceed);
-
-    when(badResponse.getStatusLine()).thenReturn(badStatusLine);
-    when(badStatusLine.getStatusCode()).thenReturn(HttpURLConnection.HTTP_UNAVAILABLE);
-
-    when(goodResponse.getStatusLine()).thenReturn(goodStatusLine);
-    when(goodStatusLine.getStatusCode()).thenReturn(HttpURLConnection.HTTP_OK);
-    when(goodResponse.getEntity()).thenReturn(responseEntity);
-
-    byte[] responseBytes = client.send(requestBytes);
-    assertEquals("success", new String(responseBytes, UTF_8));
-  }
-
-  @Test public void testRetryOnMissingHttpResponse() throws Exception {
-    final byte[] requestBytes = "fake_request".getBytes(UTF_8);
-    final CloseableHttpResponse badResponse = mock(CloseableHttpResponse.class);
-    final CloseableHttpResponse goodResponse = mock(CloseableHttpResponse.class);
-    final StatusLine badStatusLine = mock(StatusLine.class);
-    final StatusLine goodStatusLine = mock(StatusLine.class);
-    final StringEntity responseEntity = new StringEntity("success");
-    final Answer<CloseableHttpResponse> failThenSucceed = new Answer<CloseableHttpResponse>() {
-      private int iteration = 0;
-      @Override public CloseableHttpResponse answer(InvocationOnMock invocation) throws Throwable {
-        iteration++;
-        if (1 == iteration) {
-          throw new NoHttpResponseException("The server didn't respond!");
-        } else {
-          return goodResponse;
-        }
-      }
-    };
-
-    final AvaticaCommonsHttpClientImpl client = mock(AvaticaCommonsHttpClientImpl.class);
-
-    when(client.send(any(byte[].class))).thenCallRealMethod();
-    when(client.execute(any(HttpPost.class), any(HttpClientContext.class))).then(failThenSucceed);
-
-    when(badResponse.getStatusLine()).thenReturn(badStatusLine);
-    when(badStatusLine.getStatusCode()).thenReturn(HttpURLConnection.HTTP_UNAVAILABLE);
-
-    when(goodResponse.getStatusLine()).thenReturn(goodStatusLine);
-    when(goodStatusLine.getStatusCode()).thenReturn(HttpURLConnection.HTTP_OK);
-    when(goodResponse.getEntity()).thenReturn(responseEntity);
-
-    byte[] responseBytes = client.send(requestBytes);
-    assertEquals("success", new String(responseBytes, UTF_8));
-  }
-}
-
-// End AvaticaCommonsHttpClientImplTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/test/java/org/apache/calcite/avatica/remote/AvaticaHttpClientFactoryTest.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/test/java/org/apache/calcite/avatica/remote/AvaticaHttpClientFactoryTest.java b/avatica/core/src/test/java/org/apache/calcite/avatica/remote/AvaticaHttpClientFactoryTest.java
deleted file mode 100644
index 8e1397c..0000000
--- a/avatica/core/src/test/java/org/apache/calcite/avatica/remote/AvaticaHttpClientFactoryTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import org.apache.calcite.avatica.BuiltInConnectionProperty;
-import org.apache.calcite.avatica.ConnectionConfig;
-import org.apache.calcite.avatica.ConnectionConfigImpl;
-
-import org.junit.Test;
-
-import java.net.URL;
-import java.util.Properties;
-
-import static org.junit.Assert.assertTrue;
-
-/**
- * Tests for the factory that creates http clients.
- */
-public class AvaticaHttpClientFactoryTest {
-
-  @Test public void testDefaultHttpClient() throws Exception {
-    Properties props = new Properties();
-    URL url = new URL("http://localhost:8765");
-    ConnectionConfig config = new ConnectionConfigImpl(props);
-    AvaticaHttpClientFactory httpClientFactory = new AvaticaHttpClientFactoryImpl();
-
-    AvaticaHttpClient client = httpClientFactory.getClient(url, config, null);
-    assertTrue("Client was an instance of " + client.getClass(),
-        client instanceof AvaticaCommonsHttpClientImpl);
-  }
-
-  @Test public void testOverridenHttpClient() throws Exception {
-    Properties props = new Properties();
-    props.setProperty(BuiltInConnectionProperty.HTTP_CLIENT_IMPL.name(),
-        AvaticaHttpClientImpl.class.getName());
-    URL url = new URL("http://localhost:8765");
-    ConnectionConfig config = new ConnectionConfigImpl(props);
-    AvaticaHttpClientFactory httpClientFactory = new AvaticaHttpClientFactoryImpl();
-
-    AvaticaHttpClient client = httpClientFactory.getClient(url, config, null);
-    assertTrue("Client was an instance of " + client.getClass(),
-        client instanceof AvaticaHttpClientImpl);
-  }
-}
-
-// End AvaticaHttpClientFactoryTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/test/java/org/apache/calcite/avatica/remote/AvaticaHttpClientTest.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/test/java/org/apache/calcite/avatica/remote/AvaticaHttpClientTest.java b/avatica/core/src/test/java/org/apache/calcite/avatica/remote/AvaticaHttpClientTest.java
deleted file mode 100644
index 33369d2..0000000
--- a/avatica/core/src/test/java/org/apache/calcite/avatica/remote/AvaticaHttpClientTest.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.nio.charset.StandardCharsets;
-
-import static org.junit.Assert.assertArrayEquals;
-
-/**
- * Tests for the HTTP transport.
- */
-public class AvaticaHttpClientTest {
-  private static final String REQUEST =
-      "{\"request\":\"createStatement\",\"connectionId\":\"8f3f28ee-d0bb-4cdb-a4b1-8f6e8476c534\"}";
-  private static final String RESPONSE =
-      "{\"response\":\"createStatement\",\"connectionId\":"
-          + "\"8f3f28ee-d0bb-4cdb-a4b1-8f6e8476c534\",\"statementId\":1608176856}";
-
-  @Test
-  public void testRetryOnUnavailable() throws Exception {
-    // HTTP-503, try again
-    URL url = new URL("http://127.0.0.1:8765");
-    final HttpURLConnection cnxn = Mockito.mock(HttpURLConnection.class);
-    ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    ByteArrayInputStream bais = new ByteArrayInputStream(RESPONSE.getBytes(StandardCharsets.UTF_8));
-
-    // Create the HTTP client
-    AvaticaHttpClientImpl client = new AvaticaHttpClientImpl(url) {
-      @Override HttpURLConnection openConnection() throws IOException {
-        return cnxn;
-      }
-    };
-
-    // HTTP 503 then 200
-    Mockito.when(cnxn.getResponseCode()).thenReturn(HttpURLConnection.HTTP_UNAVAILABLE,
-        HttpURLConnection.HTTP_OK);
-
-    Mockito.when(cnxn.getOutputStream()).thenReturn(baos);
-    Mockito.when(cnxn.getInputStream()).thenReturn(bais);
-
-    byte[] response = client.send(REQUEST.getBytes(StandardCharsets.UTF_8));
-
-    assertArrayEquals(RESPONSE.getBytes(StandardCharsets.UTF_8), response);
-  }
-
-  @Test(expected = RuntimeException.class)
-  public void testServerError() throws Exception {
-    // HTTP 500 should error out
-    URL url = new URL("http://127.0.0.1:8765");
-    final HttpURLConnection cnxn = Mockito.mock(HttpURLConnection.class);
-    ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
-    // Create the HTTP client
-    AvaticaHttpClientImpl client = new AvaticaHttpClientImpl(url) {
-      @Override HttpURLConnection openConnection() throws IOException {
-        return cnxn;
-      }
-    };
-
-    // HTTP 500
-    Mockito.when(cnxn.getResponseCode()).thenReturn(HttpURLConnection.HTTP_INTERNAL_ERROR);
-
-    Mockito.when(cnxn.getOutputStream()).thenReturn(baos);
-
-    // Should throw an RTE
-    client.send(REQUEST.getBytes(StandardCharsets.UTF_8));
-  }
-
-}
-
-// End AvaticaHttpClientTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/test/java/org/apache/calcite/avatica/remote/ErrorResponseTest.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/test/java/org/apache/calcite/avatica/remote/ErrorResponseTest.java b/avatica/core/src/test/java/org/apache/calcite/avatica/remote/ErrorResponseTest.java
deleted file mode 100644
index f66cb26..0000000
--- a/avatica/core/src/test/java/org/apache/calcite/avatica/remote/ErrorResponseTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import org.apache.calcite.avatica.AvaticaClientRuntimeException;
-import org.apache.calcite.avatica.AvaticaSeverity;
-import org.apache.calcite.avatica.remote.Service.ErrorResponse;
-import org.apache.calcite.avatica.remote.Service.RpcMetadataResponse;
-
-import org.junit.Test;
-
-import java.util.Arrays;
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-/**
- * A test class for ErrorResponse.
- */
-public class ErrorResponseTest {
-
-  @Test public void testEquality() {
-    final String message = "There was an error";
-    final int code = 23;
-    final String state = "a1b2c";
-    final AvaticaSeverity severity = AvaticaSeverity.ERROR;
-    final List<String> exceptions = Arrays.asList("Server Stacktrace 1", "Server Stacktace 2");
-    final RpcMetadataResponse metadata = new RpcMetadataResponse("localhost:8765");
-    assertEquals(new ErrorResponse(message, code, state, severity, exceptions, metadata),
-        new ErrorResponse(message, code, state, severity, exceptions, metadata));
-  }
-
-  @Test public void testToClientRTE() {
-    final String message = "There was an error";
-    final int code = 23;
-    final String state = "a1b2c";
-    final AvaticaSeverity severity = AvaticaSeverity.ERROR;
-    final List<String> exceptions = Arrays.asList("Server Stacktrace 1", "Server Stacktace 2");
-    final RpcMetadataResponse metadata = new RpcMetadataResponse("localhost:8765");
-    final ErrorResponse resp = new ErrorResponse(message, code, state, severity, exceptions,
-        metadata);
-    AvaticaClientRuntimeException exception = resp.toException();
-    assertTrue("Expected error message to end with '" + resp.errorMessage + "', but was '"
-        + exception.getMessage() + "'", exception.getMessage().endsWith(resp.errorMessage));
-    assertEquals(resp.errorCode, exception.getErrorCode());
-    assertEquals(resp.severity, exception.getSeverity());
-    assertEquals(resp.sqlState, exception.getSqlState());
-    assertEquals(resp.exceptions, exception.getServerExceptions());
-    assertEquals(resp.rpcMetadata, exception.getRpcMetadata());
-  }
-}
-
-// End ErrorResponseTest.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/test/java/org/apache/calcite/avatica/remote/ExecuteBatchRequestTest.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/test/java/org/apache/calcite/avatica/remote/ExecuteBatchRequestTest.java b/avatica/core/src/test/java/org/apache/calcite/avatica/remote/ExecuteBatchRequestTest.java
deleted file mode 100644
index 134ea15..0000000
--- a/avatica/core/src/test/java/org/apache/calcite/avatica/remote/ExecuteBatchRequestTest.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica.remote;
-
-import org.apache.calcite.avatica.ColumnMetaData.Rep;
-import org.apache.calcite.avatica.proto.Common;
-import org.apache.calcite.avatica.proto.Requests;
-import org.apache.calcite.avatica.proto.Requests.UpdateBatch;
-import org.apache.calcite.avatica.remote.Service.ExecuteBatchRequest;
-
-import org.junit.Test;
-
-import java.util.Arrays;
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-/**
- * Test class for ExecuteBatchRequest
- */
-public class ExecuteBatchRequestTest {
-
-  private ExecuteBatchRequest identityRequest = new ExecuteBatchRequest();
-  private List<TypedValue> paramValues =
-      Arrays.asList(TypedValue.create(Rep.BOOLEAN.name(), Boolean.TRUE),
-          TypedValue.create(Rep.STRING.name(), "string"));
-
-  @Test public void testConversionFromProtobuf() {
-    ExecuteBatchRequest request = new ExecuteBatchRequest("connectionId", 12345,
-        Arrays.asList(paramValues, paramValues, paramValues));
-
-    assertFalse("A request with the POJO TypedValue list should return false",
-        request.hasProtoUpdateBatches());
-
-    // Everything will be serialized via protobuf
-    Requests.ExecuteBatchRequest protoRequest = request.serialize();
-
-    ExecuteBatchRequest copy = identityRequest.deserialize(protoRequest);
-
-    assertNull("Parameter values (pojo) list should be null", copy.parameterValues);
-    assertTrue("hasProtoUpdateBatches() should return true", copy.hasProtoUpdateBatches());
-    List<UpdateBatch> protoParameterValues = copy.getProtoUpdateBatches();
-    assertNotNull("Protobuf serialized parameterValues should not be null", protoParameterValues);
-
-    assertEquals(request.parameterValues.size(), protoParameterValues.size());
-
-    for (int i = 0; i < request.parameterValues.size(); i++) {
-      List<TypedValue> orig = request.parameterValues.get(i);
-      List<Common.TypedValue> proto = protoParameterValues.get(i).getParameterValuesList();
-      assertEquals("Mismatch in length of TypedValues at index " + i, orig.size(), proto.size());
-
-      // Don't re-test TypedValue serialization
-    }
-
-    // Everything else should be equivalent.
-    assertEquals(request.connectionId, copy.connectionId);
-    assertEquals(request.statementId, copy.statementId);
-  }
-}
-
-// End ExecuteBatchRequestTest.java


[48/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaResultSet.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaResultSet.java b/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaResultSet.java
deleted file mode 100644
index 51bf8fa..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaResultSet.java
+++ /dev/null
@@ -1,1060 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import org.apache.calcite.avatica.remote.TypedValue;
-import org.apache.calcite.avatica.util.ArrayImpl;
-import org.apache.calcite.avatica.util.Cursor;
-
-import java.io.InputStream;
-import java.io.Reader;
-import java.math.BigDecimal;
-import java.net.URL;
-import java.sql.Array;
-import java.sql.Blob;
-import java.sql.Clob;
-import java.sql.Date;
-import java.sql.NClob;
-import java.sql.Ref;
-import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
-import java.sql.RowId;
-import java.sql.SQLException;
-import java.sql.SQLWarning;
-import java.sql.SQLXML;
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.util.Calendar;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.TimeZone;
-
-/**
- * Implementation of {@link java.sql.ResultSet}
- * for the Avatica engine.
- */
-public class AvaticaResultSet implements ResultSet, ArrayImpl.Factory {
-  protected final AvaticaStatement statement;
-  protected final QueryState state;
-  protected final Meta.Signature signature;
-  protected final Meta.Frame firstFrame;
-  protected final List<ColumnMetaData> columnMetaDataList;
-  protected final ResultSetMetaData resultSetMetaData;
-  protected final Calendar localCalendar;
-
-  protected Cursor cursor;
-  protected List<Cursor.Accessor> accessorList;
-  private int row;
-  private boolean afterLast;
-  private int fetchDirection;
-  private int fetchSize;
-  private int type;
-  private int concurrency;
-  private int holdability;
-  private boolean closed;
-  private long timeoutMillis;
-  private Cursor timeoutCursor;
-
-  /** Creates an {@link AvaticaResultSet}. */
-  public AvaticaResultSet(AvaticaStatement statement,
-      QueryState state,
-      Meta.Signature signature,
-      ResultSetMetaData resultSetMetaData,
-      TimeZone timeZone,
-      Meta.Frame firstFrame) {
-    this.statement = statement;
-    this.state = state;
-    this.signature = signature;
-    this.firstFrame = firstFrame;
-    this.columnMetaDataList = signature.columns;
-    this.type = statement.resultSetType;
-    this.concurrency = statement.resultSetConcurrency;
-    this.holdability = statement.resultSetHoldability;
-    this.fetchSize = statement.getFetchSize();
-    this.fetchDirection = statement.getFetchDirection();
-    this.resultSetMetaData = resultSetMetaData;
-    this.localCalendar = Calendar.getInstance(timeZone, Locale.ROOT);
-  }
-
-  private int findColumn0(String columnLabel) throws SQLException {
-    for (ColumnMetaData columnMetaData : columnMetaDataList) {
-      // Per JDBC 3.0 specification, match is case-insensitive and if there is
-      // more than one column with a particular name, take the first.
-      if (columnMetaData.label.equalsIgnoreCase(columnLabel)) {
-        return columnMetaData.ordinal; // 0-based
-      }
-    }
-    throw new SQLException("column '" + columnLabel + "' not found");
-  }
-
-  /**
-   * Returns the accessor for column with a given index.
-   *
-   * @param columnIndex 1-based column index
-   * @return Accessor
-   * @throws SQLException if index is not valid
-   */
-  private Cursor.Accessor getAccessor(int columnIndex) throws SQLException {
-    try {
-      return accessorList.get(columnIndex - 1);
-    } catch (IndexOutOfBoundsException e) {
-      throw new SQLException("invalid column ordinal: " + columnIndex);
-    }
-  }
-
-  /**
-   * Returns the accessor for column with a given label.
-   *
-   * @param columnLabel Column label
-   * @return Accessor
-   * @throws SQLException if there is no column with that label
-   */
-  private Cursor.Accessor getAccessor(String columnLabel) throws SQLException {
-    return accessorList.get(findColumn0(columnLabel));
-  }
-
-  public void close() {
-    closed = true;
-    final Cursor cursor = this.cursor;
-    if (cursor != null) {
-      this.cursor = null;
-      cursor.close();
-    }
-    statement.onResultSetClose(this);
-    // TODO: for timeout, see IteratorResultSet.close
-/*
-        if (timeoutCursor != null) {
-            final long noTimeout = 0;
-            timeoutCursor.close(noTimeout);
-            timeoutCursor = null;
-        }
-*/
-  }
-
-  /**
-   * Sets the timeout that this result set will wait for a row from the
-   * underlying iterator.
-   *
-   * <p>Not a JDBC method.
-   *
-   * @param timeoutMillis Timeout in milliseconds. Must be greater than zero.
-   */
-  void setTimeout(long timeoutMillis) {
-    assert timeoutMillis > 0;
-    assert this.timeoutMillis == 0;
-    this.timeoutMillis = timeoutMillis;
-    assert timeoutCursor == null;
-    timeoutCursor = cursor;
-
-    // TODO: for timeout, see IteratorResultSet.setTimeout
-/*
-        timeoutCursor = new TimeoutCursor(timeoutMillis);
-        timeoutCursor.start();
-*/
-  }
-
-  /** Sets the flag to indicate that cancel has been requested.
-   *
-   * <p>The implementation should check this flag periodically and cease
-   * processing.
-   *
-   * <p>Not a JDBC method. */
-  protected void cancel() {
-    statement.cancelFlag.compareAndSet(false, true);
-  }
-
-  /**
-   * Executes this result set. (Not a JDBC method.)
-   *
-   * <p>Note that execute cannot occur in the constructor, because the
-   * constructor occurs while the statement is locked, to make sure that
-   * execute/cancel don't happen at the same time.</p>
-   *
-   * @see org.apache.calcite.avatica.AvaticaConnection.Trojan#execute(AvaticaResultSet)
-   *
-   * @throws SQLException if execute fails for some reason.
-   */
-  protected AvaticaResultSet execute() throws SQLException {
-    final List<TypedValue> parameterValues = statement.getBoundParameterValues();
-    final Iterable<Object> iterable1 =
-        statement.connection.meta.createIterable(statement.handle, state, signature,
-            parameterValues, firstFrame);
-    this.cursor = MetaImpl.createCursor(signature.cursorFactory, iterable1);
-    this.accessorList =
-        cursor.createAccessors(columnMetaDataList, localCalendar, this);
-    this.row = -1;
-    this.afterLast = false;
-    return this;
-  }
-
-  protected AvaticaResultSet execute2(Cursor cursor,
-      List<ColumnMetaData> columnMetaDataList) {
-    this.cursor = cursor;
-    this.accessorList =
-        cursor.createAccessors(columnMetaDataList, localCalendar, this);
-    this.row = -1;
-    this.afterLast = false;
-    return this;
-  }
-
-  public ResultSet create(ColumnMetaData.AvaticaType elementType,
-      Iterable<Object> iterable) {
-    throw new UnsupportedOperationException();
-  }
-
-  public boolean next() throws SQLException {
-    // TODO: for timeout, see IteratorResultSet.next
-    if (isClosed()) {
-      throw new SQLException("next() called on closed cursor");
-    }
-    if (statement.cancelFlag.get()) {
-      throw new SQLException("Statement canceled");
-    }
-    if (cursor.next()) {
-      ++row;
-      return true;
-    } else {
-      afterLast = true;
-      return false;
-    }
-  }
-
-  public int findColumn(String columnLabel) throws SQLException {
-    return findColumn0(columnLabel) + 1;
-  }
-
-  public boolean wasNull() throws SQLException {
-    return cursor.wasNull();
-  }
-
-  public String getString(int columnIndex) throws SQLException {
-    return getAccessor(columnIndex).getString();
-  }
-
-  public boolean getBoolean(int columnIndex) throws SQLException {
-    return getAccessor(columnIndex).getBoolean();
-  }
-
-  public byte getByte(int columnIndex) throws SQLException {
-    return getAccessor(columnIndex).getByte();
-  }
-
-  public short getShort(int columnIndex) throws SQLException {
-    return getAccessor(columnIndex).getShort();
-  }
-
-  public int getInt(int columnIndex) throws SQLException {
-    return getAccessor(columnIndex).getInt();
-  }
-
-  public long getLong(int columnIndex) throws SQLException {
-    return getAccessor(columnIndex).getLong();
-  }
-
-  public float getFloat(int columnIndex) throws SQLException {
-    return getAccessor(columnIndex).getFloat();
-  }
-
-  public double getDouble(int columnIndex) throws SQLException {
-    return getAccessor(columnIndex).getDouble();
-  }
-
-  @SuppressWarnings("deprecation")
-  public BigDecimal getBigDecimal(
-      int columnIndex, int scale) throws SQLException {
-    return getAccessor(columnIndex).getBigDecimal(scale);
-  }
-
-  public byte[] getBytes(int columnIndex) throws SQLException {
-    return getAccessor(columnIndex).getBytes();
-  }
-
-  public Date getDate(int columnIndex) throws SQLException {
-    return getAccessor(columnIndex).getDate(localCalendar);
-  }
-
-  public Time getTime(int columnIndex) throws SQLException {
-    return getAccessor(columnIndex).getTime(localCalendar);
-  }
-
-  public Timestamp getTimestamp(int columnIndex) throws SQLException {
-    return getAccessor(columnIndex).getTimestamp(localCalendar);
-  }
-
-  public InputStream getAsciiStream(int columnIndex) throws SQLException {
-    return getAccessor(columnIndex).getAsciiStream();
-  }
-
-  @SuppressWarnings("deprecation")
-  public InputStream getUnicodeStream(int columnIndex) throws SQLException {
-    return getAccessor(columnIndex).getUnicodeStream();
-  }
-
-  public InputStream getBinaryStream(int columnIndex) throws SQLException {
-    return getAccessor(columnIndex).getBinaryStream();
-  }
-
-  public String getString(String columnLabel) throws SQLException {
-    return getAccessor(columnLabel).getString();
-  }
-
-  public boolean getBoolean(String columnLabel) throws SQLException {
-    return getAccessor(columnLabel).getBoolean();
-  }
-
-  public byte getByte(String columnLabel) throws SQLException {
-    return getAccessor(columnLabel).getByte();
-  }
-
-  public short getShort(String columnLabel) throws SQLException {
-    return getAccessor(columnLabel).getShort();
-  }
-
-  public int getInt(String columnLabel) throws SQLException {
-    return getAccessor(columnLabel).getInt();
-  }
-
-  public long getLong(String columnLabel) throws SQLException {
-    return getAccessor(columnLabel).getLong();
-  }
-
-  public float getFloat(String columnLabel) throws SQLException {
-    return getAccessor(columnLabel).getFloat();
-  }
-
-  public double getDouble(String columnLabel) throws SQLException {
-    return getAccessor(columnLabel).getDouble();
-  }
-
-  @SuppressWarnings("deprecation")
-  public BigDecimal getBigDecimal(
-      String columnLabel, int scale) throws SQLException {
-    return getAccessor(columnLabel).getBigDecimal(scale);
-  }
-
-  public byte[] getBytes(String columnLabel) throws SQLException {
-    return getAccessor(columnLabel).getBytes();
-  }
-
-  public Date getDate(String columnLabel) throws SQLException {
-    return getAccessor(columnLabel).getDate(localCalendar);
-  }
-
-  public Time getTime(String columnLabel) throws SQLException {
-    return getAccessor(columnLabel).getTime(localCalendar);
-  }
-
-  public Timestamp getTimestamp(String columnLabel) throws SQLException {
-    return getAccessor(columnLabel).getTimestamp(localCalendar);
-  }
-
-  public InputStream getAsciiStream(String columnLabel) throws SQLException {
-    return getAccessor(columnLabel).getAsciiStream();
-  }
-
-  @SuppressWarnings("deprecation")
-  public InputStream getUnicodeStream(String columnLabel) throws SQLException {
-    return getAccessor(columnLabel).getUnicodeStream();
-  }
-
-  public InputStream getBinaryStream(String columnLabel) throws SQLException {
-    return getAccessor(columnLabel).getBinaryStream();
-  }
-
-  public SQLWarning getWarnings() throws SQLException {
-    return null; // no warnings, since warnings are not supported
-  }
-
-  public void clearWarnings() throws SQLException {
-    // no-op since warnings are not supported
-  }
-
-  public String getCursorName() throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public ResultSetMetaData getMetaData() throws SQLException {
-    return resultSetMetaData;
-  }
-
-  public Object getObject(int columnIndex) throws SQLException {
-    final Cursor.Accessor accessor = getAccessor(columnIndex);
-    final ColumnMetaData metaData = columnMetaDataList.get(columnIndex - 1);
-    return AvaticaSite.get(accessor, metaData.type.id, localCalendar);
-  }
-
-  public Object getObject(String columnLabel) throws SQLException {
-    return getAccessor(columnLabel).getObject();
-  }
-
-  public Reader getCharacterStream(int columnIndex) throws SQLException {
-    return getAccessor(columnIndex).getCharacterStream();
-  }
-
-  public Reader getCharacterStream(String columnLabel) throws SQLException {
-    return getAccessor(columnLabel).getCharacterStream();
-  }
-
-  public BigDecimal getBigDecimal(int columnIndex) throws SQLException {
-    return getAccessor(columnIndex).getBigDecimal();
-  }
-
-  public BigDecimal getBigDecimal(String columnLabel) throws SQLException {
-    return getAccessor(columnLabel).getBigDecimal();
-  }
-
-  public boolean isBeforeFirst() throws SQLException {
-    return row < 0;
-  }
-
-  public boolean isAfterLast() throws SQLException {
-    return afterLast;
-  }
-
-  public boolean isFirst() throws SQLException {
-    return row == 0;
-  }
-
-  public boolean isLast() throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void beforeFirst() throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void afterLast() throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public boolean first() throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public boolean last() throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public int getRow() throws SQLException {
-    return row;
-  }
-
-  public boolean absolute(int row) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public boolean relative(int rows) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public boolean previous() throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void setFetchDirection(int direction) throws SQLException {
-    this.fetchDirection = direction;
-  }
-
-  public int getFetchDirection() throws SQLException {
-    return fetchDirection;
-  }
-
-  public void setFetchSize(int fetchSize) throws SQLException {
-    this.fetchSize = fetchSize;
-  }
-
-  public int getFetchSize() throws SQLException {
-    return fetchSize;
-  }
-
-  public int getType() throws SQLException {
-    return type;
-  }
-
-  public int getConcurrency() throws SQLException {
-    return concurrency;
-  }
-
-  public boolean rowUpdated() throws SQLException {
-    return false;
-  }
-
-  public boolean rowInserted() throws SQLException {
-    return false;
-  }
-
-  public boolean rowDeleted() throws SQLException {
-    return false;
-  }
-
-  public void updateNull(int columnIndex) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateBoolean(int columnIndex, boolean x) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateByte(int columnIndex, byte x) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateShort(int columnIndex, short x) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateInt(int columnIndex, int x) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateLong(int columnIndex, long x) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateFloat(int columnIndex, float x) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateDouble(int columnIndex, double x) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateBigDecimal(
-      int columnIndex, BigDecimal x) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateString(int columnIndex, String x) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateBytes(int columnIndex, byte[] x) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateDate(int columnIndex, Date x) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateTime(int columnIndex, Time x) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateTimestamp(
-      int columnIndex, Timestamp x) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateAsciiStream(
-      int columnIndex, InputStream x, int length) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateBinaryStream(
-      int columnIndex, InputStream x, int length) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateCharacterStream(
-      int columnIndex, Reader x, int length) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateObject(
-      int columnIndex, Object x, int scaleOrLength) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateObject(int columnIndex, Object x) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateNull(String columnLabel) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateBoolean(
-      String columnLabel, boolean x) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateByte(String columnLabel, byte x) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateShort(String columnLabel, short x) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateInt(String columnLabel, int x) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateLong(String columnLabel, long x) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateFloat(String columnLabel, float x) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateDouble(String columnLabel, double x) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateBigDecimal(
-      String columnLabel, BigDecimal x) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateString(String columnLabel, String x) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateBytes(String columnLabel, byte[] x) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateDate(String columnLabel, Date x) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateTime(String columnLabel, Time x) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateTimestamp(
-      String columnLabel, Timestamp x) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateAsciiStream(
-      String columnLabel, InputStream x, int length) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateBinaryStream(
-      String columnLabel, InputStream x, int length) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateCharacterStream(
-      String columnLabel, Reader reader, int length) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateObject(
-      String columnLabel, Object x, int scaleOrLength) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateObject(String columnLabel, Object x) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void insertRow() throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateRow() throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void deleteRow() throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void refreshRow() throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void cancelRowUpdates() throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void moveToInsertRow() throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void moveToCurrentRow() throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public AvaticaStatement getStatement() {
-    return statement;
-  }
-
-  public Object getObject(
-      int columnIndex, Map<String, Class<?>> map) throws SQLException {
-    return getAccessor(columnIndex).getObject(map);
-  }
-
-  public Ref getRef(int columnIndex) throws SQLException {
-    return getAccessor(columnIndex).getRef();
-  }
-
-  public Blob getBlob(int columnIndex) throws SQLException {
-    return getAccessor(columnIndex).getBlob();
-  }
-
-  public Clob getClob(int columnIndex) throws SQLException {
-    return getAccessor(columnIndex).getClob();
-  }
-
-  public Array getArray(int columnIndex) throws SQLException {
-    return getAccessor(columnIndex).getArray();
-  }
-
-  public Object getObject(
-      String columnLabel, Map<String, Class<?>> map) throws SQLException {
-    return getAccessor(columnLabel).getObject(map);
-  }
-
-  public Ref getRef(String columnLabel) throws SQLException {
-    return getAccessor(columnLabel).getRef();
-  }
-
-  public Blob getBlob(String columnLabel) throws SQLException {
-    return getAccessor(columnLabel).getBlob();
-  }
-
-  public Clob getClob(String columnLabel) throws SQLException {
-    return getAccessor(columnLabel).getClob();
-  }
-
-  public Array getArray(String columnLabel) throws SQLException {
-    return getAccessor(columnLabel).getArray();
-  }
-
-  public Date getDate(int columnIndex, Calendar cal) throws SQLException {
-    return getAccessor(columnIndex).getDate(cal);
-  }
-
-  public Date getDate(String columnLabel, Calendar cal) throws SQLException {
-    return getAccessor(columnLabel).getDate(cal);
-  }
-
-  public Time getTime(int columnIndex, Calendar cal) throws SQLException {
-    return getAccessor(columnIndex).getTime(cal);
-  }
-
-  public Time getTime(String columnLabel, Calendar cal) throws SQLException {
-    return getAccessor(columnLabel).getTime(cal);
-  }
-
-  public Timestamp getTimestamp(
-      int columnIndex, Calendar cal) throws SQLException {
-    return getAccessor(columnIndex).getTimestamp(cal);
-  }
-
-  public Timestamp getTimestamp(
-      String columnLabel, Calendar cal) throws SQLException {
-    return getAccessor(columnLabel).getTimestamp(cal);
-  }
-
-  public URL getURL(int columnIndex) throws SQLException {
-    return getAccessor(columnIndex).getURL();
-  }
-
-  public URL getURL(String columnLabel) throws SQLException {
-    return getAccessor(columnLabel).getURL();
-  }
-
-  public void updateRef(int columnIndex, Ref x) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateRef(String columnLabel, Ref x) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateBlob(int columnIndex, Blob x) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateBlob(String columnLabel, Blob x) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateClob(int columnIndex, Clob x) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateClob(String columnLabel, Clob x) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateArray(int columnIndex, Array x) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateArray(String columnLabel, Array x) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public RowId getRowId(int columnIndex) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public RowId getRowId(String columnLabel) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateRowId(int columnIndex, RowId x) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateRowId(String columnLabel, RowId x) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public int getHoldability() throws SQLException {
-    return holdability;
-  }
-
-  public boolean isClosed() throws SQLException {
-    return closed;
-  }
-
-  public void updateNString(
-      int columnIndex, String nString) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateNString(
-      String columnLabel, String nString) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateNClob(int columnIndex, NClob nClob) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateNClob(
-      String columnLabel, NClob nClob) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public NClob getNClob(int columnIndex) throws SQLException {
-    return getAccessor(columnIndex).getNClob();
-  }
-
-  public NClob getNClob(String columnLabel) throws SQLException {
-    return getAccessor(columnLabel).getNClob();
-  }
-
-  public SQLXML getSQLXML(int columnIndex) throws SQLException {
-    return getAccessor(columnIndex).getSQLXML();
-  }
-
-  public SQLXML getSQLXML(String columnLabel) throws SQLException {
-    return getAccessor(columnLabel).getSQLXML();
-  }
-
-  public void updateSQLXML(
-      int columnIndex, SQLXML xmlObject) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateSQLXML(
-      String columnLabel, SQLXML xmlObject) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public String getNString(int columnIndex) throws SQLException {
-    return getAccessor(columnIndex).getNString();
-  }
-
-  public String getNString(String columnLabel) throws SQLException {
-    return getAccessor(columnLabel).getNString();
-  }
-
-  public Reader getNCharacterStream(int columnIndex) throws SQLException {
-    return getAccessor(columnIndex).getNCharacterStream();
-  }
-
-  public Reader getNCharacterStream(String columnLabel) throws SQLException {
-    return getAccessor(columnLabel).getNCharacterStream();
-  }
-
-  public void updateNCharacterStream(
-      int columnIndex, Reader x, long length) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateNCharacterStream(
-      String columnLabel, Reader reader, long length) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateAsciiStream(
-      int columnIndex, InputStream x, long length) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateBinaryStream(
-      int columnIndex, InputStream x, long length) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateCharacterStream(
-      int columnIndex, Reader x, long length) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateAsciiStream(
-      String columnLabel, InputStream x, long length) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateBinaryStream(
-      String columnLabel, InputStream x, long length) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateCharacterStream(
-      String columnLabel, Reader reader, long length) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateBlob(
-      int columnIndex,
-      InputStream inputStream,
-      long length) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateBlob(
-      String columnLabel,
-      InputStream inputStream,
-      long length) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateClob(
-      int columnIndex, Reader reader, long length) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateClob(
-      String columnLabel, Reader reader, long length) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateNClob(
-      int columnIndex, Reader reader, long length) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateNClob(
-      String columnLabel, Reader reader, long length) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateNCharacterStream(
-      int columnIndex, Reader x) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateNCharacterStream(
-      String columnLabel, Reader reader) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateAsciiStream(
-      int columnIndex, InputStream x) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateBinaryStream(
-      int columnIndex, InputStream x) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateCharacterStream(
-      int columnIndex, Reader x) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateAsciiStream(
-      String columnLabel, InputStream x) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateBinaryStream(
-      String columnLabel, InputStream x) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateCharacterStream(
-      String columnLabel, Reader reader) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateBlob(
-      int columnIndex, InputStream inputStream) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateBlob(
-      String columnLabel, InputStream inputStream) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateClob(int columnIndex, Reader reader) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateClob(
-      String columnLabel, Reader reader) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateNClob(
-      int columnIndex, Reader reader) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public void updateNClob(
-      String columnLabel, Reader reader) throws SQLException {
-    throw new UnsupportedOperationException();
-  }
-
-  public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
-    return getAccessor(columnIndex).getObject(type);
-  }
-
-  public <T> T getObject(
-      String columnLabel, Class<T> type) throws SQLException {
-    return getAccessor(columnLabel).getObject(type);
-  }
-
-  public <T> T unwrap(Class<T> iface) throws SQLException {
-    if (iface.isInstance(this)) {
-      return iface.cast(this);
-    }
-    throw statement.connection.helper.createException(
-        "does not implement '" + iface + "'");
-  }
-
-  public boolean isWrapperFor(Class<?> iface) throws SQLException {
-    return iface.isInstance(this);
-  }
-}
-
-// End AvaticaResultSet.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaResultSetMetaData.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaResultSetMetaData.java b/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaResultSetMetaData.java
deleted file mode 100644
index b4e8892..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaResultSetMetaData.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import java.sql.ResultSetMetaData;
-import java.sql.SQLException;
-
-/**
- * Implementation of {@link ResultSetMetaData}
- * for the Avatica framework.
- */
-public class AvaticaResultSetMetaData implements ResultSetMetaData {
-  final AvaticaStatement statement;
-  final Object query; // reserved for future use
-  final Meta.Signature signature;
-
-  public AvaticaResultSetMetaData(
-      AvaticaStatement statement,
-      Object query,
-      Meta.Signature signature) {
-    this.statement = statement;
-    this.query = query;
-    this.signature = signature;
-  }
-
-  private ColumnMetaData getColumnMetaData(int column) {
-    return signature.columns.get(column - 1);
-  }
-
-  // implement ResultSetMetaData
-
-  public int getColumnCount() throws SQLException {
-    return signature.columns.size();
-  }
-
-  public boolean isAutoIncrement(int column) throws SQLException {
-    return getColumnMetaData(column).autoIncrement;
-  }
-
-  public boolean isCaseSensitive(int column) throws SQLException {
-    return getColumnMetaData(column).caseSensitive;
-  }
-
-  public boolean isSearchable(int column) throws SQLException {
-    return getColumnMetaData(column).searchable;
-  }
-
-  public boolean isCurrency(int column) throws SQLException {
-    return getColumnMetaData(column).currency;
-  }
-
-  public int isNullable(int column) throws SQLException {
-    return getColumnMetaData(column).nullable;
-  }
-
-  public boolean isSigned(int column) throws SQLException {
-    return getColumnMetaData(column).signed;
-  }
-
-  public int getColumnDisplaySize(int column) throws SQLException {
-    return getColumnMetaData(column).displaySize;
-  }
-
-  public String getColumnLabel(int column) throws SQLException {
-    return getColumnMetaData(column).label;
-  }
-
-  public String getColumnName(int column) throws SQLException {
-    return getColumnMetaData(column).columnName;
-  }
-
-  public String getSchemaName(int column) throws SQLException {
-    return getColumnMetaData(column).schemaName;
-  }
-
-  public int getPrecision(int column) throws SQLException {
-    return getColumnMetaData(column).precision;
-  }
-
-  public int getScale(int column) throws SQLException {
-    return getColumnMetaData(column).scale;
-  }
-
-  public String getTableName(int column) throws SQLException {
-    return getColumnMetaData(column).tableName;
-  }
-
-  public String getCatalogName(int column) throws SQLException {
-    return getColumnMetaData(column).catalogName;
-  }
-
-  public int getColumnType(int column) throws SQLException {
-    return getColumnMetaData(column).type.id;
-  }
-
-  public String getColumnTypeName(int column) throws SQLException {
-    return getColumnMetaData(column).type.name;
-  }
-
-  public boolean isReadOnly(int column) throws SQLException {
-    return getColumnMetaData(column).readOnly;
-  }
-
-  public boolean isWritable(int column) throws SQLException {
-    return getColumnMetaData(column).writable;
-  }
-
-  public boolean isDefinitelyWritable(int column) throws SQLException {
-    return getColumnMetaData(column).definitelyWritable;
-  }
-
-  public String getColumnClassName(int column) throws SQLException {
-    return getColumnMetaData(column).columnClassName;
-  }
-
-  // implement Wrapper
-
-  public <T> T unwrap(Class<T> iface) throws SQLException {
-    if (iface.isInstance(this)) {
-      return iface.cast(this);
-    }
-    throw statement.connection.helper.createException(
-        "does not implement '" + iface + "'");
-  }
-
-  public boolean isWrapperFor(Class<?> iface) throws SQLException {
-    return iface.isInstance(this);
-  }
-}
-
-// End AvaticaResultSetMetaData.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaSeverity.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaSeverity.java b/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaSeverity.java
deleted file mode 100644
index 675c8af..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaSeverity.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import org.apache.calcite.avatica.proto.Common;
-
-import java.util.Objects;
-
-/**
- * An enumeration that denotes the severity of a given unexpected state.
- */
-public enum AvaticaSeverity {
-  /**
-   * The severity of the outcome of some unexpected state is unknown.
-   */
-  UNKNOWN(0),
-
-  /**
-   * The system has been left in an unrecoverable state as a result of an operation.
-   */
-  FATAL(1),
-
-  /**
-   * The result of an action resulted in an error which the current operation cannot recover
-   * from. Clients can attempt to execute the operation again.
-   */
-  ERROR(2),
-
-  /**
-   * The operation completed successfully but a message was generated to warn the client about
-   * some unexpected state or action.
-   */
-  WARNING(3);
-
-  private final int value;
-
-  AvaticaSeverity(int value) {
-    this.value = value;
-  }
-
-  public int getValue() {
-    return value;
-  }
-
-  public Common.Severity toProto() {
-    switch (this) {
-    case UNKNOWN:
-      return Common.Severity.UNKNOWN_SEVERITY;
-    case FATAL:
-      return Common.Severity.FATAL_SEVERITY;
-    case ERROR:
-      return Common.Severity.ERROR_SEVERITY;
-    case WARNING:
-      return Common.Severity.WARNING_SEVERITY;
-    default:
-      throw new RuntimeException("Unhandled Severity level: " + this);
-    }
-  }
-
-  public static AvaticaSeverity fromProto(Common.Severity proto) {
-    switch (Objects.requireNonNull(proto)) {
-    case UNKNOWN_SEVERITY:
-      return AvaticaSeverity.UNKNOWN;
-    case FATAL_SEVERITY:
-      return AvaticaSeverity.FATAL;
-    case ERROR_SEVERITY:
-      return AvaticaSeverity.ERROR;
-    case WARNING_SEVERITY:
-      return AvaticaSeverity.WARNING;
-    default:
-      throw new RuntimeException("Unhandled protobuf Severity level: " + proto);
-    }
-  }
-}
-
-// End AvaticaSeverity.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaSite.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaSite.java b/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaSite.java
deleted file mode 100644
index 0e23866..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaSite.java
+++ /dev/null
@@ -1,588 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import org.apache.calcite.avatica.remote.TypedValue;
-import org.apache.calcite.avatica.util.Cursor;
-
-import java.io.InputStream;
-import java.io.Reader;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.net.URL;
-import java.nio.charset.StandardCharsets;
-import java.sql.Array;
-import java.sql.Blob;
-import java.sql.Clob;
-import java.sql.Date;
-import java.sql.NClob;
-import java.sql.Ref;
-import java.sql.RowId;
-import java.sql.SQLException;
-import java.sql.SQLXML;
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.sql.Types;
-import java.util.Calendar;
-
-/**
- * A location that a value can be written to or read from.
- */
-public class AvaticaSite {
-  final AvaticaParameter parameter;
-
-  /** Calendar is not thread-safe. But calendar is only used from within one
-   * thread, and we have to trust that clients are not modifying calendars
-   * that they pass to us in a method such as
-   * {@link java.sql.PreparedStatement#setTime(int, Time, Calendar)}, so we do
-   * not need to synchronize access. */
-  final Calendar calendar;
-  private final int index;
-  final TypedValue[] slots;
-
-  /** Value that means the parameter has been set to null.
-   * If value is null, parameter has not been set. */
-  public static final Object DUMMY_VALUE = Dummy.INSTANCE;
-
-  public AvaticaSite(AvaticaParameter parameter, Calendar calendar, int index,
-      TypedValue[] slots) {
-    assert calendar != null;
-    assert parameter != null;
-    assert slots != null;
-    this.parameter = parameter;
-    this.calendar = calendar;
-    this.index = index;
-    this.slots = slots;
-  }
-
-  private TypedValue wrap(ColumnMetaData.Rep rep, Object o,
-      Calendar calendar) {
-    return TypedValue.ofJdbc(rep, o, calendar);
-  }
-
-  private TypedValue wrap(ColumnMetaData.Rep rep, Object o) {
-    return TypedValue.ofJdbc(rep, o, calendar);
-  }
-
-  public boolean isSet(int index) {
-    return slots[index] != null;
-  }
-
-  public void setByte(byte o) {
-    slots[index] = wrap(ColumnMetaData.Rep.BYTE, o);
-  }
-
-  public void setChar(char o) {
-    slots[index] = wrap(ColumnMetaData.Rep.CHARACTER, o);
-  }
-
-  public void setShort(short o) {
-    slots[index] = wrap(ColumnMetaData.Rep.SHORT, o);
-  }
-
-  public void setInt(int o) {
-    slots[index] = wrap(ColumnMetaData.Rep.INTEGER, o);
-  }
-
-  public void setLong(long o) {
-    slots[index] = wrap(ColumnMetaData.Rep.LONG, o);
-  }
-
-  public void setBoolean(boolean o) {
-    slots[index] = wrap(ColumnMetaData.Rep.BOOLEAN, o);
-  }
-
-  public void setRowId(RowId x) {
-    slots[index] = wrap(ColumnMetaData.Rep.OBJECT, x);
-  }
-
-  public void setNString(String o) {
-    slots[index] = wrap(ColumnMetaData.Rep.STRING, o);
-  }
-
-  public void setNCharacterStream(Reader value, long length) {
-  }
-
-  public void setNClob(NClob value) {
-    slots[index] = wrap(ColumnMetaData.Rep.OBJECT, value);
-  }
-
-  public void setClob(Reader reader, long length) {
-  }
-
-  public void setBlob(InputStream inputStream, long length) {
-  }
-
-  public void setNClob(Reader reader, long length) {
-  }
-
-  public void setSQLXML(SQLXML xmlObject) {
-    slots[index] = wrap(ColumnMetaData.Rep.OBJECT, xmlObject);
-  }
-
-  public void setAsciiStream(InputStream x, long length) {
-  }
-
-  public void setBinaryStream(InputStream x, long length) {
-  }
-
-  public void setCharacterStream(Reader reader, long length) {
-  }
-
-  public void setAsciiStream(InputStream x) {
-  }
-
-  public void setBinaryStream(InputStream x) {
-  }
-
-  public void setCharacterStream(Reader reader) {
-  }
-
-  public void setNCharacterStream(Reader value) {
-  }
-
-  public void setClob(Reader reader) {
-  }
-
-  public void setBlob(InputStream inputStream) {
-  }
-
-  public void setNClob(Reader reader) {
-  }
-
-  public void setUnicodeStream(InputStream x, int length) {
-  }
-
-  public void setFloat(float x) {
-    slots[index] = wrap(ColumnMetaData.Rep.FLOAT, x);
-  }
-
-  public void setDouble(double x) {
-    slots[index] = wrap(ColumnMetaData.Rep.DOUBLE, x);
-  }
-
-  public void setBigDecimal(BigDecimal x) {
-    slots[index] = wrap(ColumnMetaData.Rep.NUMBER, x);
-  }
-
-  public void setString(String x) {
-    slots[index] = wrap(ColumnMetaData.Rep.STRING, x);
-  }
-
-  public void setBytes(byte[] x) {
-    slots[index] = wrap(ColumnMetaData.Rep.BYTE_STRING, x);
-  }
-
-  public void setTimestamp(Timestamp x, Calendar calendar) {
-    slots[index] = wrap(ColumnMetaData.Rep.JAVA_SQL_TIMESTAMP, x, calendar);
-  }
-
-  public void setTime(Time x, Calendar calendar) {
-    slots[index] = wrap(ColumnMetaData.Rep.JAVA_SQL_TIME, x, calendar);
-  }
-
-  public void setDate(Date x, Calendar calendar) {
-    slots[index] = wrap(ColumnMetaData.Rep.JAVA_SQL_DATE, x, calendar);
-  }
-
-  public void setObject(Object x, int targetSqlType) {
-    if (x == null || Types.NULL == targetSqlType) {
-      setNull(targetSqlType);
-      return;
-    }
-    switch (targetSqlType) {
-    case Types.CLOB:
-    case Types.DATALINK:
-    case Types.NCLOB:
-    case Types.OTHER:
-    case Types.REF:
-    case Types.SQLXML:
-    case Types.STRUCT:
-      throw notImplemented();
-    case Types.ARRAY:
-      setArray(toArray(x));
-      break;
-    case Types.BIGINT:
-      setLong(toLong(x));
-      break;
-    case Types.BINARY:
-    case Types.LONGVARBINARY:
-    case Types.VARBINARY:
-      setBytes(toBytes(x));
-      break;
-    case Types.BIT:
-    case Types.BOOLEAN:
-      setBoolean(toBoolean(x));
-      break;
-    case Types.BLOB:
-      if (x instanceof Blob) {
-        setBlob((Blob) x);
-        break;
-      } else if (x instanceof InputStream) {
-        setBlob((InputStream) x);
-      }
-      throw unsupportedCast(x.getClass(), Blob.class);
-    case Types.DATE:
-      setDate(toDate(x), calendar);
-      break;
-    case Types.DECIMAL:
-    case Types.NUMERIC:
-      setBigDecimal(toBigDecimal(x));
-      break;
-    case Types.DISTINCT:
-      throw notImplemented();
-    case Types.DOUBLE:
-    case Types.FLOAT: // yes really; SQL FLOAT is up to 8 bytes
-      setDouble(toDouble(x));
-      break;
-    case Types.INTEGER:
-      setInt(toInt(x));
-      break;
-    case Types.JAVA_OBJECT:
-      setObject(x);
-      break;
-    case Types.LONGNVARCHAR:
-    case Types.LONGVARCHAR:
-    case Types.NVARCHAR:
-    case Types.VARCHAR:
-    case Types.CHAR:
-    case Types.NCHAR:
-      setString(toString(x));
-      break;
-    case Types.REAL:
-      setFloat(toFloat(x));
-      break;
-    case Types.ROWID:
-      if (x instanceof RowId) {
-        setRowId((RowId) x);
-        break;
-      }
-      throw unsupportedCast(x.getClass(), RowId.class);
-    case Types.SMALLINT:
-      setShort(toShort(x));
-      break;
-    case Types.TIME:
-      setTime(toTime(x), calendar);
-      break;
-    case Types.TIMESTAMP:
-      setTimestamp(toTimestamp(x), calendar);
-      break;
-    case Types.TINYINT:
-      setByte(toByte(x));
-      break;
-    default:
-      throw notImplemented();
-    }
-  }
-
-  /** Similar logic to {@link #setObject}. */
-  public static Object get(Cursor.Accessor accessor, int targetSqlType,
-      Calendar localCalendar) throws SQLException {
-    switch (targetSqlType) {
-    case Types.CLOB:
-    case Types.DATALINK:
-    case Types.NCLOB:
-    case Types.REF:
-    case Types.SQLXML:
-    case Types.STRUCT:
-      throw notImplemented();
-    case Types.ARRAY:
-      return accessor.getArray();
-    case Types.BIGINT:
-      final long aLong = accessor.getLong();
-      if (aLong == 0 && accessor.wasNull()) {
-        return null;
-      }
-      return aLong;
-    case Types.BINARY:
-    case Types.LONGVARBINARY:
-    case Types.VARBINARY:
-      return accessor.getBytes();
-    case Types.BIT:
-    case Types.BOOLEAN:
-      final boolean aBoolean = accessor.getBoolean();
-      if (!aBoolean && accessor.wasNull()) {
-        return null;
-      }
-      return aBoolean;
-    case Types.BLOB:
-      return accessor.getBlob();
-    case Types.DATE:
-      return accessor.getDate(localCalendar);
-    case Types.DECIMAL:
-    case Types.NUMERIC:
-      return accessor.getBigDecimal();
-    case Types.DISTINCT:
-      throw notImplemented();
-    case Types.DOUBLE:
-    case Types.FLOAT: // yes really; SQL FLOAT is up to 8 bytes
-      final double aDouble = accessor.getDouble();
-      if (aDouble == 0 && accessor.wasNull()) {
-        return null;
-      }
-      return aDouble;
-    case Types.INTEGER:
-      final int anInt = accessor.getInt();
-      if (anInt == 0 && accessor.wasNull()) {
-        return null;
-      }
-      return anInt;
-    case Types.JAVA_OBJECT:
-    case Types.OTHER:
-      return accessor.getObject();
-    case Types.LONGNVARCHAR:
-    case Types.LONGVARCHAR:
-    case Types.NVARCHAR:
-    case Types.VARCHAR:
-    case Types.CHAR:
-    case Types.NCHAR:
-      return accessor.getString();
-    case Types.REAL:
-      final float aFloat = accessor.getFloat();
-      if (aFloat == 0 && accessor.wasNull()) {
-        return null;
-      }
-      return aFloat;
-    case Types.ROWID:
-      throw notImplemented();
-    case Types.SMALLINT:
-      final short aShort = accessor.getShort();
-      if (aShort == 0 && accessor.wasNull()) {
-        return null;
-      }
-      return aShort;
-    case Types.TIME:
-      return accessor.getTime(localCalendar);
-    case Types.TIMESTAMP:
-      return accessor.getTimestamp(localCalendar);
-    case Types.TINYINT:
-      final byte aByte = accessor.getByte();
-      if (aByte == 0 && accessor.wasNull()) {
-        return null;
-      }
-      return aByte;
-    default:
-      throw notImplemented();
-    }
-  }
-
-  public void setObject(Object x) {
-    slots[index] = TypedValue.ofJdbc(x, calendar);
-  }
-
-  public void setNull(int sqlType) {
-    slots[index] = wrap(ColumnMetaData.Rep.OBJECT, null);
-  }
-
-  public void setRef(Ref x) {
-  }
-
-  public void setBlob(Blob x) {
-  }
-
-  public void setClob(Clob x) {
-  }
-
-  public void setArray(Array x) {
-  }
-
-  public void setNull(int sqlType, String typeName) {
-  }
-
-  public void setURL(URL x) {
-  }
-
-  public void setObject(Object x, int targetSqlType,
-      int scaleOrLength) {
-  }
-
-  private static RuntimeException unsupportedCast(Class<?> from, Class<?> to) {
-    return new UnsupportedOperationException("Cannot convert from "
-        + from.getCanonicalName() + " to " + to.getCanonicalName());
-  }
-
-  private static RuntimeException notImplemented() {
-    return new RuntimeException("not implemented");
-  }
-
-  private static Array toArray(Object x) {
-    if (x instanceof Array) {
-      return (Array) x;
-    }
-    throw unsupportedCast(x.getClass(), Array.class);
-  }
-
-  public static BigDecimal toBigDecimal(Object x) {
-    if (x instanceof BigDecimal) {
-      return (BigDecimal) x;
-    } else if (x instanceof BigInteger) {
-      return new BigDecimal((BigInteger) x);
-    } else if (x instanceof Number) {
-      if (x instanceof Double || x instanceof Float) {
-        return new BigDecimal(((Number) x).doubleValue());
-      } else {
-        return new BigDecimal(((Number) x).longValue());
-      }
-    } else if (x instanceof Boolean) {
-      return (Boolean) x ? BigDecimal.ONE : BigDecimal.ZERO;
-    } else if (x instanceof String) {
-      return new BigDecimal((String) x);
-    }
-    throw unsupportedCast(x.getClass(), BigDecimal.class);
-  }
-
-  private static boolean toBoolean(Object x) {
-    if (x instanceof Boolean) {
-      return (Boolean) x;
-    } else if (x instanceof Number) {
-      return ((Number) x).intValue() != 0;
-    } else if (x instanceof String) {
-      String s = (String) x;
-      if (s.equalsIgnoreCase("true") || s.equalsIgnoreCase("yes")) {
-        return true;
-      } else if (s.equalsIgnoreCase("false") || s.equalsIgnoreCase("no")) {
-        return false;
-      }
-    }
-    throw unsupportedCast(x.getClass(), Boolean.TYPE);
-  }
-
-  private static byte toByte(Object x) {
-    if (x instanceof Number) {
-      return ((Number) x).byteValue();
-    } else if (x instanceof Boolean) {
-      return (Boolean) x ? (byte) 1 : (byte) 0;
-    } else if (x instanceof String) {
-      return Byte.parseByte((String) x);
-    } else {
-      throw unsupportedCast(x.getClass(), Byte.TYPE);
-    }
-  }
-
-  private static byte[] toBytes(Object x) {
-    if (x instanceof byte[]) {
-      return (byte[]) x;
-    }
-    if (x instanceof String) {
-      return ((String) x).getBytes(StandardCharsets.UTF_8);
-    }
-    throw unsupportedCast(x.getClass(), byte[].class);
-  }
-
-  private static Date toDate(Object x) {
-    if (x instanceof String) {
-      return Date.valueOf((String) x);
-    }
-    return new Date(toLong(x));
-  }
-
-  private static Time toTime(Object x) {
-    if (x instanceof String) {
-      return Time.valueOf((String) x);
-    }
-    return new Time(toLong(x));
-  }
-
-  private static Timestamp toTimestamp(Object x) {
-    if (x instanceof String) {
-      return Timestamp.valueOf((String) x);
-    }
-    return new Timestamp(toLong(x));
-  }
-
-  private static double toDouble(Object x) {
-    if (x instanceof Number) {
-      return ((Number) x).doubleValue();
-    } else if (x instanceof Boolean) {
-      return (Boolean) x ? 1D : 0D;
-    } else if (x instanceof String) {
-      return Double.parseDouble((String) x);
-    } else {
-      throw unsupportedCast(x.getClass(), Double.TYPE);
-    }
-  }
-
-  private static float toFloat(Object x) {
-    if (x instanceof Number) {
-      return ((Number) x).floatValue();
-    } else if (x instanceof Boolean) {
-      return (Boolean) x ? 1F : 0F;
-    } else if (x instanceof String) {
-      return Float.parseFloat((String) x);
-    } else {
-      throw unsupportedCast(x.getClass(), Float.TYPE);
-    }
-  }
-
-  private static int toInt(Object x) {
-    if (x instanceof Number) {
-      return ((Number) x).intValue();
-    } else if (x instanceof Boolean) {
-      return (Boolean) x ? 1 : 0;
-    } else if (x instanceof String) {
-      return Integer.parseInt((String) x);
-    } else {
-      throw unsupportedCast(x.getClass(), Integer.TYPE);
-    }
-  }
-
-  private static long toLong(Object x) {
-    if (x instanceof Number) {
-      return ((Number) x).longValue();
-    } else if (x instanceof Boolean) {
-      return (Boolean) x ? 1L : 0L;
-    } else if (x instanceof String) {
-      return Long.parseLong((String) x);
-    } else {
-      throw unsupportedCast(x.getClass(), Long.TYPE);
-    }
-  }
-
-  private static short toShort(Object x) {
-    if (x instanceof Number) {
-      return ((Number) x).shortValue();
-    } else if (x instanceof Boolean) {
-      return (Boolean) x ? (short) 1 : (short) 0;
-    } else if (x instanceof String) {
-      return Short.parseShort((String) x);
-    } else {
-      throw unsupportedCast(x.getClass(), Short.TYPE);
-    }
-  }
-
-  private static String toString(Object x) {
-    if (x instanceof String) {
-      return (String) x;
-    } else if (x instanceof Character
-        || x instanceof Boolean) {
-      return x.toString();
-    }
-    throw unsupportedCast(x.getClass(), String.class);
-  }
-
-  /** Singleton value to denote parameters that have been set to null (as
-   * opposed to not set).
-   *
-   * <p>Not a valid value for a parameter.
-   *
-   * <p>As an enum, it is serializable by Jackson. */
-  private enum Dummy {
-    INSTANCE
-  }
-}
-
-// End AvaticaSite.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaSpecificDatabaseMetaData.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaSpecificDatabaseMetaData.java b/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaSpecificDatabaseMetaData.java
deleted file mode 100644
index 6a608ca..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaSpecificDatabaseMetaData.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import java.sql.DatabaseMetaData;
-import java.util.Properties;
-
-/**
- * Avatica additions to the JDBC {@link DatabaseMetaData} interface. An instance of this is can be
- * obtained by using {@link #unwrap(Class)} to cast an instance of {@link DatabaseMetaData} to
- * {@link AvaticaSpecificDatabaseMetaData}. {@link #isWrapperFor(Class)} can be used to ensure that
- * the generic interface can be cast to the desired class.
- *
- * <p>A list of all available server-side properties is enumerated by
- * {@link org.apache.calcite.avatica.Meta.DatabaseProperty}. The name of the enum value will be
- * the name of the key in the {@link Properties} returned.
- *
- * <p>Some properties defined in {@link org.apache.calcite.avatica.Meta.DatabaseProperty} do not
- * correspond to a typical JDBC method/property. Those are enumerated here:
- * <table summary="Avatica-Specific Properties">
- *   <tr><th>Property</th><th>Method</th></tr>
- *   <tr><td>AVATICA_VERSION</td><td>getAvaticaServerVersion()</td></tr>
- * </table>
- */
-public interface AvaticaSpecificDatabaseMetaData extends DatabaseMetaData {
-
-  /**
-   * Retrieves all Avatica-centric properties from the server. See
-   * {@link org.apache.calcite.avatica.Meta.DatabaseProperty} for a list of properties that will be
-   * returned.
-   *
-   * @return A {@link Properties} instance containing Avatica properties.
-   */
-  Properties getRemoteAvaticaProperties();
-
-  /**
-   * Retrieves the Avatica version from the server.
-   * @return A string corresponding to the server's version.
-   */
-  String getAvaticaServerVersion();
-}
-
-// End AvaticaSpecificDatabaseMetaData.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaSqlException.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaSqlException.java b/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaSqlException.java
deleted file mode 100644
index 9408a7b..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaSqlException.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import java.io.PrintStream;
-import java.io.PrintWriter;
-import java.sql.SQLException;
-import java.util.List;
-import java.util.Objects;
-
-/**
- * A client-facing {@link SQLException} which encapsulates errors from the remote Avatica server.
- */
-public class AvaticaSqlException extends SQLException {
-
-  private static final long serialVersionUID = 1L;
-
-  private final String errorMessage;
-  private final List<String> stackTraces;
-  private final String remoteServer;
-
-  /**
-   * Construct the Exception with information from the server.
-   *
-   * @param errorMessage A human-readable error message.
-   * @param errorCode An integer corresponding to a known error.
-   * @param stackTraces Server-side stacktrace.
-   * @param remoteServer The host:port where the Avatica server is located
-   */
-  public AvaticaSqlException(String errorMessage, String sqlState, int errorCode,
-      List<String> stackTraces, String remoteServer) {
-    super("Error " + errorCode + " (" + sqlState + ") : " + errorMessage, sqlState, errorCode);
-    this.errorMessage = errorMessage;
-    this.stackTraces = Objects.requireNonNull(stackTraces);
-    this.remoteServer = remoteServer;
-  }
-
-  public String getErrorMessage() {
-    return errorMessage;
-  }
-
-  /**
-   * @return The stacktraces for exceptions thrown on the Avatica server.
-   */
-  public List<String> getStackTraces() {
-    return stackTraces;
-  }
-
-  /**
-   * @return The host:port for the remote Avatica server. May be null.
-   */
-  public String getRemoteServer() {
-    return remoteServer;
-  }
-
-  // printStackTrace() will get redirected to printStackTrace(PrintStream), don't need to override.
-
-  @Override public void printStackTrace(PrintStream stream) {
-    super.printStackTrace(stream);
-    stream.flush();
-    printServerStackTrace(new PrintStreamOrWriter(stream));
-  }
-
-  @Override public void printStackTrace(PrintWriter writer) {
-    super.printStackTrace(writer);
-    writer.flush();
-    printServerStackTrace(new PrintStreamOrWriter(writer));
-  }
-
-  void printServerStackTrace(PrintStreamOrWriter streamOrWriter) {
-    for (String serverStackTrace : this.stackTraces) {
-      streamOrWriter.println(serverStackTrace);
-    }
-  }
-
-  /**
-   * A class that encapsulates either a PrintStream or a PrintWriter.
-   */
-  private static class PrintStreamOrWriter {
-    /**
-     * Enumeration to differentiate between a PrintStream and a PrintWriter.
-     */
-    private enum Type {
-      STREAM,
-      WRITER
-    }
-
-    private PrintStream stream;
-    private PrintWriter writer;
-    private final Type type;
-
-    public PrintStreamOrWriter(PrintStream stream) {
-      this.stream = stream;
-      type = Type.STREAM;
-    }
-
-    public PrintStreamOrWriter(PrintWriter writer) {
-      this.writer = writer;
-      type = Type.WRITER;
-    }
-
-    /**
-     * Prints the given string to the the provided stream or writer.
-     *
-     * @param string The string to print
-     */
-    public void println(String string) {
-      switch (type) {
-      case STREAM:
-        stream.println(string);
-        stream.flush();
-        return;
-      case WRITER:
-        writer.println(string);
-        writer.flush();
-        return;
-      default:
-        throw new IllegalStateException();
-      }
-    }
-  }
-}
-
-// End AvaticaSqlException.java

http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/fc7b26c8/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaStatement.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaStatement.java b/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaStatement.java
deleted file mode 100644
index 2900229..0000000
--- a/avatica/core/src/main/java/org/apache/calcite/avatica/AvaticaStatement.java
+++ /dev/null
@@ -1,573 +0,0 @@
-/*
- * 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.
- */
-package org.apache.calcite.avatica;
-
-import org.apache.calcite.avatica.remote.TypedValue;
-
-import java.sql.CallableStatement;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.SQLWarning;
-import java.sql.Statement;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Objects;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-/**
- * Implementation of {@link java.sql.Statement}
- * for the Avatica engine.
- */
-public abstract class AvaticaStatement
-    implements Statement {
-  /** The default value for {@link Statement#getFetchSize()}. */
-  public static final int DEFAULT_FETCH_SIZE = 100;
-
-  public final AvaticaConnection connection;
-  /** Statement id; unique within connection. */
-  public Meta.StatementHandle handle;
-  protected boolean closed;
-
-  /** Support for {@link #cancel()} method. */
-  protected final AtomicBoolean cancelFlag;
-
-  /**
-   * Support for {@link #closeOnCompletion()} method.
-   */
-  protected boolean closeOnCompletion;
-
-  /**
-   * Current result set, or null if the statement is not executing anything.
-   * Any method which modifies this member must synchronize
-   * on the AvaticaStatement.
-   */
-  protected AvaticaResultSet openResultSet;
-
-  /** Current update count. Same lifecycle as {@link #openResultSet}. */
-  protected long updateCount;
-
-  private int queryTimeoutMillis;
-  final int resultSetType;
-  final int resultSetConcurrency;
-  final int resultSetHoldability;
-  private int fetchSize = DEFAULT_FETCH_SIZE;
-  private int fetchDirection;
-  protected long maxRowCount = 0;
-
-  private Meta.Signature signature;
-
-  private final List<String> batchedSql;
-
-  protected void setSignature(Meta.Signature signature) {
-    this.signature = signature;
-  }
-
-  protected Meta.Signature getSignature() {
-    return signature;
-  }
-
-  public Meta.StatementType getStatementType() {
-    return signature.statementType;
-  }
-
-  /**
-   * Creates an AvaticaStatement.
-   *
-   * @param connection Connection
-   * @param h Statement handle
-   * @param resultSetType Result set type
-   * @param resultSetConcurrency Result set concurrency
-   * @param resultSetHoldability Result set holdability
-   */
-  protected AvaticaStatement(AvaticaConnection connection,
-      Meta.StatementHandle h, int resultSetType, int resultSetConcurrency,
-      int resultSetHoldability) {
-    this(connection, h, resultSetType, resultSetConcurrency, resultSetHoldability, null);
-  }
-
-  protected AvaticaStatement(AvaticaConnection connection,
-      Meta.StatementHandle h, int resultSetType, int resultSetConcurrency,
-      int resultSetHoldability, Meta.Signature signature) {
-    this.connection = Objects.requireNonNull(connection);
-    this.resultSetType = resultSetType;
-    this.resultSetConcurrency = resultSetConcurrency;
-    this.resultSetHoldability = resultSetHoldability;
-    this.signature = signature;
-    this.closed = false;
-    if (h == null) {
-      final Meta.ConnectionHandle ch = connection.handle;
-      h = connection.meta.createStatement(ch);
-    }
-    connection.statementMap.put(h.id, this);
-    this.handle = h;
-    this.batchedSql = new ArrayList<>();
-    try {
-      this.cancelFlag = connection.getCancelFlag(h);
-    } catch (NoSuchStatementException e) {
-      throw new AssertionError("no statement", e);
-    }
-  }
-
-  /** Returns the identifier of the statement, unique within its connection. */
-  public int getId() {
-    return handle.id;
-  }
-
-  private void checkNotPreparedOrCallable(String s) throws SQLException {
-    if (this instanceof PreparedStatement
-        || this instanceof CallableStatement) {
-      throw connection.helper.createException("Cannot call " + s
-          + " on prepared or callable statement");
-    }
-  }
-
-  protected void executeInternal(String sql) throws SQLException {
-    // reset previous state before moving forward.
-    this.updateCount = -1;
-    try {
-      // In JDBC, maxRowCount = 0 means no limit; in prepare it means LIMIT 0
-      final long maxRowCount1 = maxRowCount <= 0 ? -1 : maxRowCount;
-      for (int i = 0; i < connection.maxRetriesPerExecute; i++) {
-        try {
-          Meta.ExecuteResult x =
-              connection.prepareAndExecuteInternal(this, sql, maxRowCount1);
-          return;
-        } catch (NoSuchStatementException e) {
-          resetStatement();
-        }
-      }
-    } catch (RuntimeException e) {
-      throw connection.helper.createException("Error while executing SQL \"" + sql + "\": "
-          + e.getMessage(), e);
-    }
-
-    throw new RuntimeException("Failed to successfully execute query after "
-        + connection.maxRetriesPerExecute + " attempts.");
-  }
-
-  /**
-   * Executes a collection of updates in a single batch RPC.
-   *
-   * @return an array of long mapping to the update count per SQL command.
-   */
-  protected long[] executeBatchInternal() throws SQLException {
-    for (int i = 0; i < connection.maxRetriesPerExecute; i++) {
-      try {
-        return connection.prepareAndUpdateBatch(this, batchedSql).updateCounts;
-      } catch (NoSuchStatementException e) {
-        resetStatement();
-      }
-    }
-
-    throw new RuntimeException("Failed to successfully execute batch update after "
-        +  connection.maxRetriesPerExecute + " attempts");
-  }
-
-  protected void resetStatement() {
-    // Invalidate the old statement
-    connection.statementMap.remove(handle.id);
-    connection.flagMap.remove(handle.id);
-    // Get a new one
-    final Meta.ConnectionHandle ch = new Meta.ConnectionHandle(connection.id);
-    Meta.StatementHandle h = connection.meta.createStatement(ch);
-    // Cache it in the connection
-    connection.statementMap.put(h.id, this);
-    // Update the local state and try again
-    this.handle = h;
-  }
-
-  /**
-   * Re-initialize the ResultSet on the server with the given state.
-   * @param state The ResultSet's state.
-   * @param offset Offset into the desired ResultSet
-   * @return True if the ResultSet has more results, false if there are no more results.
-   */
-  protected boolean syncResults(QueryState state, long offset) throws NoSuchStatementException {
-    return connection.meta.syncResults(handle, state, offset);
-  }
-
-  // implement Statement
-
-  public boolean execute(String sql) throws SQLException {
-    checkNotPreparedOrCallable("execute(String)");
-    executeInternal(sql);
-    // Result set is null for DML or DDL.
-    // Result set is closed if user cancelled the query.
-    return openResultSet != null && !openResultSet.isClosed();
-  }
-
-  public ResultSet executeQuery(String sql) throws SQLException {
-    checkNotPreparedOrCallable("executeQuery(String)");
-    try {
-      executeInternal(sql);
-      if (openResultSet == null) {
-        throw connection.helper.createException(
-            "Statement did not return a result set");
-      }
-      return openResultSet;
-    } catch (RuntimeException e) {
-      throw connection.helper.createException("Error while executing SQL \"" + sql + "\": "
-          + e.getMessage(), e);
-    }
-  }
-
-  public final int executeUpdate(String sql) throws SQLException {
-    return AvaticaUtils.toSaturatedInt(executeLargeUpdate(sql));
-  }
-
-  public long executeLargeUpdate(String sql) throws SQLException {
-    checkNotPreparedOrCallable("executeUpdate(String)");
-    executeInternal(sql);
-    return updateCount;
-  }
-
-  public synchronized void close() throws SQLException {
-    try {
-      close_();
-    } catch (RuntimeException e) {
-      throw connection.helper.createException("While closing statement", e);
-    }
-  }
-
-  protected void close_() {
-    if (!closed) {
-      closed = true;
-      if (openResultSet != null) {
-        AvaticaResultSet c = openResultSet;
-        openResultSet = null;
-        c.close();
-      }
-      try {
-        // inform the server to close the resource
-        connection.meta.closeStatement(handle);
-      } finally {
-        // make sure we don't leak on our side
-        connection.statementMap.remove(handle.id);
-        connection.flagMap.remove(handle.id);
-      }
-      // If onStatementClose throws, this method will throw an exception (later
-      // converted to SQLException), but this statement still gets closed.
-      connection.driver.handler.onStatementClose(this);
-    }
-  }
-
-  public int getMaxFieldSize() throws SQLException {
-    throw connection.helper.unsupported();
-  }
-
-  public void setMaxFieldSize(int max) throws SQLException {
-    throw connection.helper.unsupported();
-  }
-
-  public final int getMaxRows() {
-    return AvaticaUtils.toSaturatedInt(getLargeMaxRows());
-  }
-
-  public long getLargeMaxRows() {
-    return maxRowCount;
-  }
-
-  public final void setMaxRows(int maxRowCount) throws SQLException {
-    setLargeMaxRows(maxRowCount);
-  }
-
-  public void setLargeMaxRows(long maxRowCount) throws SQLException {
-    if (maxRowCount < 0) {
-      throw connection.helper.createException(
-          "illegal maxRows value: " + maxRowCount);
-    }
-    this.maxRowCount = maxRowCount;
-  }
-
-  public void setEscapeProcessing(boolean enable) throws SQLException {
-    throw connection.helper.unsupported();
-  }
-
-  public int getQueryTimeout() throws SQLException {
-    long timeoutSeconds = getQueryTimeoutMillis() / 1000;
-    if (timeoutSeconds > Integer.MAX_VALUE) {
-      return Integer.MAX_VALUE;
-    }
-    if (timeoutSeconds == 0 && getQueryTimeoutMillis() > 0) {
-      // Don't return timeout=0 if e.g. timeoutMillis=500. 0 is special.
-      return 1;
-    }
-    return (int) timeoutSeconds;
-  }
-
-  int getQueryTimeoutMillis() {
-    return queryTimeoutMillis;
-  }
-
-  public void setQueryTimeout(int seconds) throws SQLException {
-    if (seconds < 0) {
-      throw connection.helper.createException(
-          "illegal timeout value " + seconds);
-    }
-    setQueryTimeoutMillis(seconds * 1000);
-  }
-
-  void setQueryTimeoutMillis(int millis) {
-    this.queryTimeoutMillis = millis;
-  }
-
-  public synchronized void cancel() throws SQLException {
-    if (openResultSet != null) {
-      openResultSet.cancel();
-    }
-    // If there is an open result set, it probably just set the same flag.
-    cancelFlag.compareAndSet(false, true);
-  }
-
-  public SQLWarning getWarnings() throws SQLException {
-    return null; // no warnings, since warnings are not supported
-  }
-
-  public void clearWarnings() throws SQLException {
-    // no-op since warnings are not supported
-  }
-
-  public void setCursorName(String name) throws SQLException {
-    throw connection.helper.unsupported();
-  }
-
-  public ResultSet getResultSet() throws SQLException {
-    // NOTE: result set becomes visible in this member while
-    // executeQueryInternal is still in progress, and before it has
-    // finished executing. Its internal state may not be ready for API
-    // calls. JDBC never claims to be thread-safe! (Except for calls to the
-    // cancel method.) It is not possible to synchronize, because it would
-    // block 'cancel'.
-    return openResultSet;
-  }
-
-  public int getUpdateCount() throws SQLException {
-    return AvaticaUtils.toSaturatedInt(updateCount);
-  }
-
-  public long getLargeUpdateCount() throws SQLException {
-    return updateCount;
-  }
-
-  public boolean getMoreResults() throws SQLException {
-    throw connection.helper.unsupported();
-  }
-
-  public void setFetchDirection(int direction) throws SQLException {
-    this.fetchDirection = direction;
-  }
-
-  public int getFetchDirection() {
-    return fetchDirection;
-  }
-
-  public void setFetchSize(int rows) throws SQLException {
-    this.fetchSize = rows;
-  }
-
-  public int getFetchSize() {
-    return fetchSize;
-  }
-
-  public int getResultSetConcurrency() throws SQLException {
-    throw connection.helper.unsupported();
-  }
-
-  public int getResultSetType() throws SQLException {
-    throw connection.helper.unsupported();
-  }
-
-  public void addBatch(String sql) throws SQLException {
-    this.batchedSql.add(Objects.requireNonNull(sql));
-  }
-
-  public void clearBatch() throws SQLException {
-    this.batchedSql.clear();
-  }
-
-  public int[] executeBatch() throws SQLException {
-    return AvaticaUtils.toSaturatedInts(executeLargeBatch());
-  }
-
-  public long[] executeLargeBatch() throws SQLException {
-    try {
-      return executeBatchInternal();
-    } finally {
-      // If we failed to send this batch, that's a problem for the user to handle, not us.
-      // Make sure we always clear the statements we collected to submit in one RPC.
-      clearBatch();
-    }
-  }
-
-  public AvaticaConnection getConnection() {
-    return connection;
-  }
-
-  public boolean getMoreResults(int current) throws SQLException {
-    throw connection.helper.unsupported();
-  }
-
-  public ResultSet getGeneratedKeys() throws SQLException {
-    throw connection.helper.unsupported();
-  }
-
-  public int executeUpdate(
-      String sql, int autoGeneratedKeys) throws SQLException {
-    throw connection.helper.unsupported();
-  }
-
-  public int executeUpdate(
-      String sql, int[] columnIndexes) throws SQLException {
-    throw connection.helper.unsupported();
-  }
-
-  public int executeUpdate(
-      String sql, String[] columnNames) throws SQLException {
-    throw connection.helper.unsupported();
-  }
-
-  public boolean execute(
-      String sql, int autoGeneratedKeys) throws SQLException {
-    throw connection.helper.unsupported();
-  }
-
-  public boolean execute(
-      String sql, int[] columnIndexes) throws SQLException {
-    throw connection.helper.unsupported();
-  }
-
-  public boolean execute(
-      String sql, String[] columnNames) throws SQLException {
-    throw connection.helper.unsupported();
-  }
-
-  public int getResultSetHoldability() throws SQLException {
-    throw connection.helper.unsupported();
-  }
-
-  public boolean isClosed() throws SQLException {
-    return closed;
-  }
-
-  public void setPoolable(boolean poolable) throws SQLException {
-    throw connection.helper.unsupported();
-  }
-
-  public boolean isPoolable() throws SQLException {
-    throw connection.helper.unsupported();
-  }
-
-  // implements java.sql.Statement.closeOnCompletion (added in JDK 1.7)
-  public void closeOnCompletion() throws SQLException {
-    closeOnCompletion = true;
-  }
-
-  // implements java.sql.Statement.isCloseOnCompletion (added in JDK 1.7)
-  public boolean isCloseOnCompletion() throws SQLException {
-    return closeOnCompletion;
-  }
-
-  // implement Wrapper
-
-  public <T> T unwrap(Class<T> iface) throws SQLException {
-    if (iface.isInstance(this)) {
-      return iface.cast(this);
-    }
-    throw connection.helper.createException(
-        "does not implement '" + iface + "'");
-  }
-
-  public boolean isWrapperFor(Class<?> iface) throws SQLException {
-    return iface.isInstance(this);
-  }
-
-  /**
-   * Executes a prepared statement.
-   *
-   * @param signature Parsed statement
-   * @param isUpdate if the execute is for an update
-   *
-   * @return as specified by {@link java.sql.Statement#execute(String)}
-   * @throws java.sql.SQLException if a database error occurs
-   */
-  protected boolean executeInternal(Meta.Signature signature, boolean isUpdate)
-      throws SQLException {
-    ResultSet resultSet = executeQueryInternal(signature, isUpdate);
-    // user may have cancelled the query
-    if (resultSet.isClosed()) {
-      return false;
-    }
-    return true;
-  }
-
-  /**
-   * Executes a prepared query, closing any previously open result set.
-   *
-   * @param signature Parsed query
-   * @param isUpdate If the execute is for an update
-   * @return Result set
-   * @throws java.sql.SQLException if a database error occurs
-   */
-  protected ResultSet executeQueryInternal(Meta.Signature signature, boolean isUpdate)
-      throws SQLException {
-    return connection.executeQueryInternal(this, signature, null, null, isUpdate);
-  }
-
-  /**
-   * Called by each child result set when it is closed.
-   *
-   * @param resultSet Result set or cell set
-   */
-  void onResultSetClose(ResultSet resultSet) {
-    if (closeOnCompletion) {
-      close_();
-    }
-  }
-
-  /** Returns the list of values of this statement's parameters.
-   *
-   * <p>Called at execute time. Not a public API.</p>
-   *
-   * <p>The default implementation returns the empty list, because non-prepared
-   * statements have no parameters.</p>
-   *
-   * @see org.apache.calcite.avatica.AvaticaConnection.Trojan#getParameterValues(AvaticaStatement)
-   */
-  protected List<TypedValue> getParameterValues() {
-    return Collections.emptyList();
-  }
-
-  /** Returns a list of bound parameter values.
-   *
-   * <p>If any of the parameters have not been bound, throws.
-   * If parameters have been bound to null, the value in the list is null.
-   */
-  protected List<TypedValue> getBoundParameterValues() throws SQLException {
-    final List<TypedValue> parameterValues = getParameterValues();
-    for (Object parameterValue : parameterValues) {
-      if (parameterValue == null) {
-        throw new SQLException("unbound parameter");
-      }
-    }
-    return parameterValues;
-  }
-
-}
-
-// End AvaticaStatement.java


[51/51] [partial] calcite-avatica git commit: [CALCITE-1717] Remove Calcite code and lift avatica

Posted by el...@apache.org.
[CALCITE-1717] Remove Calcite code and lift avatica

* Update .travis.yml
* Update source URLs in site
* Fix Github references across markdown files
* Update the README with the right travis badge
* Blog post for the new repo

Closes apache/calcite-avatica#1


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

Branch: refs/heads/master
Commit: fc7b26c8b8545f4b969108cb3d8e8064d870a09c
Parents: 8a1a287
Author: Josh Elser <el...@apache.org>
Authored: Thu Mar 30 17:47:08 2017 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Sat Apr 1 16:34:36 2017 -0400

----------------------------------------------------------------------
 .travis.yml                                     |    10 +-
 LICENSE                                         |     4 +-
 NOTICE                                          |     9 +-
 README                                          |    11 +-
 README.md                                       |    13 +-
 avatica/KEYS                                    |   285 -
 avatica/LICENSE                                 |   268 -
 avatica/NOTICE                                  |     5 -
 avatica/README                                  |    18 -
 avatica/README.md                               |    30 -
 avatica/core/pom.xml                            |   237 -
 .../calcite/avatica/util/FilteredConstants.java |    26 -
 .../avatica/AvaticaClientRuntimeException.java  |    94 -
 .../calcite/avatica/AvaticaConnection.java      |   769 -
 .../avatica/AvaticaDatabaseMetaData.java        |  1460 --
 .../apache/calcite/avatica/AvaticaFactory.java  |    83 -
 .../calcite/avatica/AvaticaJdbc41Factory.java   |   256 -
 .../calcite/avatica/AvaticaParameter.java       |   135 -
 .../avatica/AvaticaPreparedStatement.java       |   387 -
 .../calcite/avatica/AvaticaResultSet.java       |  1060 -
 .../avatica/AvaticaResultSetMetaData.java       |   145 -
 .../apache/calcite/avatica/AvaticaSeverity.java |    90 -
 .../org/apache/calcite/avatica/AvaticaSite.java |   588 -
 .../AvaticaSpecificDatabaseMetaData.java        |    57 -
 .../calcite/avatica/AvaticaSqlException.java    |   138 -
 .../calcite/avatica/AvaticaStatement.java       |   573 -
 .../apache/calcite/avatica/AvaticaUtils.java    |   423 -
 .../avatica/BuiltInConnectionProperty.java      |   156 -
 .../apache/calcite/avatica/ColumnMetaData.java  |   599 -
 .../calcite/avatica/ConnectStringParser.java    |   394 -
 .../calcite/avatica/ConnectionConfig.java       |    58 -
 .../calcite/avatica/ConnectionConfigImpl.java   |   374 -
 .../avatica/ConnectionPropertiesImpl.java       |   279 -
 .../calcite/avatica/ConnectionProperty.java     |   119 -
 .../apache/calcite/avatica/DriverVersion.java   |   149 -
 .../org/apache/calcite/avatica/Handler.java     |    87 -
 .../org/apache/calcite/avatica/HandlerImpl.java |    47 -
 .../java/org/apache/calcite/avatica/Helper.java |    76 -
 .../calcite/avatica/InternalProperty.java       |   109 -
 .../java/org/apache/calcite/avatica/Meta.java   |  1338 --
 .../org/apache/calcite/avatica/MetaImpl.java    |  1653 --
 .../avatica/MissingResultsException.java        |    41 -
 .../avatica/NoSuchConnectionException.java      |    37 -
 .../avatica/NoSuchStatementException.java       |    39 -
 .../org/apache/calcite/avatica/QueryState.java  |   466 -
 .../org/apache/calcite/avatica/SqlState.java    |  1861 --
 .../org/apache/calcite/avatica/SqlType.java     |   559 -
 .../calcite/avatica/UnregisteredDriver.java     |   249 -
 .../apache/calcite/avatica/package-info.java    |    26 -
 .../apache/calcite/avatica/proto/Common.java    | 18319 -----------------
 .../apache/calcite/avatica/proto/Requests.java  | 16608 ---------------
 .../apache/calcite/avatica/proto/Responses.java | 13962 -------------
 .../calcite/avatica/remote/AbstractHandler.java |   158 -
 .../calcite/avatica/remote/AbstractService.java |   159 -
 .../avatica/remote/AuthenticationType.java      |    29 -
 .../remote/AvaticaCommonsHttpClientImpl.java    |   221 -
 .../AvaticaCommonsHttpClientSpnegoImpl.java     |   180 -
 .../avatica/remote/AvaticaHttpClient.java       |    34 -
 .../remote/AvaticaHttpClientFactory.java        |    39 -
 .../remote/AvaticaHttpClientFactoryImpl.java    |   127 -
 .../avatica/remote/AvaticaHttpClientImpl.java   |    73 -
 .../AvaticaRemoteConnectionConfigImpl.java      |    36 -
 .../remote/AvaticaRemoteConnectionProperty.java |    85 -
 .../avatica/remote/AvaticaRuntimeException.java |   102 -
 .../avatica/remote/DoAsAvaticaHttpClient.java   |    46 -
 .../apache/calcite/avatica/remote/Driver.java   |   200 -
 .../apache/calcite/avatica/remote/Handler.java  |    68 -
 .../calcite/avatica/remote/JsonHandler.java     |    76 -
 .../calcite/avatica/remote/JsonService.java     |   243 -
 .../avatica/remote/KerberosConnection.java      |   400 -
 .../avatica/remote/LocalJsonService.java        |    46 -
 .../avatica/remote/LocalProtobufService.java    |    58 -
 .../calcite/avatica/remote/LocalService.java    |   376 -
 .../avatica/remote/MetaDataOperation.java       |   181 -
 .../calcite/avatica/remote/MetricsHelper.java   |    36 -
 .../calcite/avatica/remote/MockJsonService.java |   118 -
 .../avatica/remote/MockProtobufService.java     |   144 -
 .../calcite/avatica/remote/ProtobufHandler.java |    62 -
 .../calcite/avatica/remote/ProtobufMeta.java    |    45 -
 .../calcite/avatica/remote/ProtobufService.java |   140 -
 .../avatica/remote/ProtobufTranslation.java     |    64 -
 .../avatica/remote/ProtobufTranslationImpl.java |   399 -
 .../calcite/avatica/remote/RemoteMeta.java      |   436 -
 .../avatica/remote/RemoteProtobufService.java   |    70 -
 .../calcite/avatica/remote/RemoteService.java   |    39 -
 .../avatica/remote/RequestTranslator.java       |    45 -
 .../avatica/remote/ResponseTranslator.java      |    44 -
 .../apache/calcite/avatica/remote/Service.java  |  3114 ---
 .../avatica/remote/TrustStoreConfigurable.java  |    36 -
 .../calcite/avatica/remote/TypedValue.java      |   656 -
 .../UsernamePasswordAuthenticateable.java       |    35 -
 .../calcite/avatica/remote/package-info.java    |    26 -
 .../calcite/avatica/util/AbstractCursor.java    |  1384 --
 .../apache/calcite/avatica/util/ArrayImpl.java  |   204 -
 .../avatica/util/ArrayIteratorCursor.java       |    41 -
 .../org/apache/calcite/avatica/util/Base64.java |  2093 --
 .../apache/calcite/avatica/util/ByteString.java |   353 -
 .../org/apache/calcite/avatica/util/Casing.java |    35 -
 .../org/apache/calcite/avatica/util/Cursor.java |   145 -
 .../calcite/avatica/util/DateTimeUtils.java     |  1034 -
 .../calcite/avatica/util/IteratorCursor.java    |    85 -
 .../avatica/util/ListIteratorCursor.java        |    43 -
 .../calcite/avatica/util/MapIteratorCursor.java |    51 -
 .../calcite/avatica/util/PackageMarker.java     |    37 -
 .../calcite/avatica/util/PositionedCursor.java  |   134 -
 .../apache/calcite/avatica/util/Quoting.java    |    37 -
 .../avatica/util/RecordIteratorCursor.java      |    63 -
 .../org/apache/calcite/avatica/util/Spacer.java |    80 -
 .../org/apache/calcite/avatica/util/Spaces.java |   185 -
 .../apache/calcite/avatica/util/StructImpl.java |    79 -
 .../apache/calcite/avatica/util/TimeUnit.java   |    96 -
 .../calcite/avatica/util/TimeUnitRange.java     |   119 -
 .../org/apache/calcite/avatica/util/Unsafe.java |    55 -
 .../avatica/util/UnsynchronizedBuffer.java      |   152 -
 .../calcite/avatica/util/package-info.java      |    24 -
 avatica/core/src/main/protobuf/common.proto     |   275 -
 avatica/core/src/main/protobuf/requests.proto   |   168 -
 avatica/core/src/main/protobuf/responses.proto  |   135 -
 .../resources/META-INF/services/java.sql.Driver |     1 -
 .../calcite/avatica/AvaticaConnectionTest.java  |    60 -
 .../AvaticaResultSetConversionsTest.java        |  1100 -
 .../calcite/avatica/AvaticaStatementTest.java   |    51 -
 .../avatica/ConnectionConfigImplTest.java       |    50 -
 .../org/apache/calcite/avatica/FrameTest.java   |   211 -
 .../calcite/avatica/MetaResultSetTest.java      |   655 -
 .../apache/calcite/avatica/QueryStateTest.java  |   513 -
 .../avatica/metrics/MetricsHelperTest.java      |    42 -
 .../avatica/remote/AbstractHandlerTest.java     |   169 -
 .../AvaticaCommonsHttpClientImplTest.java       |   115 -
 .../remote/AvaticaHttpClientFactoryTest.java    |    60 -
 .../avatica/remote/AvaticaHttpClientTest.java   |    93 -
 .../avatica/remote/ErrorResponseTest.java       |    68 -
 .../avatica/remote/ExecuteBatchRequestTest.java |    79 -
 .../avatica/remote/KerberosConnectionTest.java  |   145 -
 .../avatica/remote/MetaDataOperationTest.java   |    37 -
 .../avatica/remote/ProtobufHandlerTest.java     |   138 -
 .../remote/ProtobufSerializationTest.java       |   253 -
 .../avatica/remote/ProtobufServiceTest.java     |    58 -
 .../remote/ProtobufTranslationImplTest.java     |   387 -
 .../calcite/avatica/remote/TypedValueTest.java  |   208 -
 .../test/AvaticaClientRuntimeExceptionTest.java |    53 -
 .../avatica/test/AvaticaSeverityTest.java       |    39 -
 .../avatica/test/AvaticaSqlExceptionTest.java   |    52 -
 .../calcite/avatica/test/AvaticaUtilsTest.java  |   340 -
 .../avatica/test/ConnectStringParserTest.java   |   255 -
 .../calcite/avatica/test/JsonHandlerTest.java   |   195 -
 .../calcite/avatica/test/package-info.java      |    26 -
 .../calcite/avatica/util/DateTimeUtilsTest.java |   526 -
 .../avatica/util/NumberAccessorTest.java        |    55 -
 .../avatica/util/UnsynchronizedBufferTest.java  |    41 -
 avatica/metrics-dropwizardmetrics3/pom.xml      |   117 -
 .../metrics/dropwizard3/DropwizardCounter.java  |    51 -
 .../metrics/dropwizard3/DropwizardGauge.java    |    39 -
 .../dropwizard3/DropwizardHistogram.java        |    43 -
 .../metrics/dropwizard3/DropwizardMeter.java    |    43 -
 .../dropwizard3/DropwizardMetricsSystem.java    |    62 -
 .../DropwizardMetricsSystemConfiguration.java   |    42 -
 .../DropwizardMetricsSystemFactory.java         |    42 -
 .../metrics/dropwizard3/DropwizardTimer.java    |    54 -
 .../metrics/dropwizard3/package-info.java       |    26 -
 ...calcite.avatica.metrics.MetricsSystemFactory |     2 -
 .../dropwizard3/DropwizardCounterTest.java      |    61 -
 .../dropwizard3/DropwizardGaugeTest.java        |    60 -
 .../dropwizard3/DropwizardHistogramTest.java    |    49 -
 .../dropwizard3/DropwizardMeterTest.java        |    50 -
 .../DropwizardMetricsSystemFactoryTest.java     |    54 -
 .../DropwizardMetricsSystemTest.java            |   161 -
 .../dropwizard3/DropwizardTimerTest.java        |    56 -
 avatica/metrics/pom.xml                         |   129 -
 .../apache/calcite/avatica/metrics/Counter.java |    49 -
 .../apache/calcite/avatica/metrics/Gauge.java   |    30 -
 .../calcite/avatica/metrics/Histogram.java      |    40 -
 .../apache/calcite/avatica/metrics/Meter.java   |    38 -
 .../apache/calcite/avatica/metrics/Metric.java  |    26 -
 .../calcite/avatica/metrics/MetricsSystem.java  |    68 -
 .../metrics/MetricsSystemConfiguration.java     |    33 -
 .../avatica/metrics/MetricsSystemFactory.java   |    32 -
 .../avatica/metrics/MetricsSystemLoader.java    |    87 -
 .../calcite/avatica/metrics/PackageMarker.java  |    37 -
 .../apache/calcite/avatica/metrics/Timer.java   |    37 -
 .../avatica/metrics/noop/NoopCounter.java       |    36 -
 .../avatica/metrics/noop/NoopHistogram.java     |    32 -
 .../calcite/avatica/metrics/noop/NoopMeter.java |    32 -
 .../avatica/metrics/noop/NoopMetricsSystem.java |    69 -
 .../noop/NoopMetricsSystemConfiguration.java    |    40 -
 .../metrics/noop/NoopMetricsSystemFactory.java  |    35 -
 .../calcite/avatica/metrics/noop/NoopTimer.java |    43 -
 .../avatica/metrics/noop/package-info.java      |    26 -
 .../calcite/avatica/metrics/package-info.java   |    24 -
 .../metrics/MetricsSystemLoaderTest.java        |   114 -
 .../noop/NoopMetricsSystemFactoryTest.java      |    37 -
 .../metrics/noop/NoopMetricsSystemTest.java     |    73 -
 .../metrics/src/test/resources/log4j.properties |    24 -
 avatica/noop-driver/pom.xml                     |   108 -
 .../avatica/noop/AvaticaNoopConnection.java     |   256 -
 .../noop/AvaticaNoopDatabaseMetaData.java       |   770 -
 .../calcite/avatica/noop/AvaticaNoopDriver.java |    74 -
 .../noop/AvaticaNoopParameterMetaData.java      |    85 -
 .../noop/AvaticaNoopPreparedStatement.java      |   345 -
 .../avatica/noop/AvaticaNoopResultSet.java      |   665 -
 .../noop/AvaticaNoopResultSetMetaData.java      |   133 -
 .../avatica/noop/AvaticaNoopStatement.java      |   191 -
 .../calcite/avatica/noop/PackageMarker.java     |    37 -
 .../calcite/avatica/noop/package-info.java      |    24 -
 .../resources/META-INF/services/java.sql.Driver |     1 -
 avatica/pom.xml                                 |   815 -
 avatica/server/pom.xml                          |   223 -
 .../apache/calcite/avatica/jdbc/JdbcMeta.java   |  1101 -
 .../calcite/avatica/jdbc/JdbcResultSet.java     |   215 -
 .../calcite/avatica/jdbc/StatementInfo.java     |   170 -
 .../calcite/avatica/jdbc/package-info.java      |    22 -
 .../avatica/server/AbstractAvaticaHandler.java  |    73 -
 .../calcite/avatica/server/AvaticaHandler.java  |    32 -
 .../avatica/server/AvaticaJsonHandler.java      |   157 -
 .../avatica/server/AvaticaProtobufHandler.java  |   152 -
 .../server/AvaticaServerConfiguration.java      |    97 -
 .../server/DelegatingAvaticaHandler.java        |   116 -
 .../avatica/server/DoAsRemoteUserCallback.java  |    42 -
 .../calcite/avatica/server/HandlerFactory.java  |   146 -
 .../calcite/avatica/server/HttpServer.java      |   826 -
 .../org/apache/calcite/avatica/server/Main.java |   104 -
 .../server/MetricsAwareAvaticaHandler.java      |    43 -
 .../server/PropertyBasedSpnegoLoginService.java |    50 -
 .../calcite/avatica/server/package-info.java    |    26 -
 .../calcite/avatica/AvaticaSpnegoTest.java      |   246 -
 .../apache/calcite/avatica/ConnectionSpec.java  |    55 -
 .../calcite/avatica/RemoteDriverMockTest.java   |   219 -
 .../calcite/avatica/RemoteDriverTest.java       |  2077 --
 .../apache/calcite/avatica/SpnegoTestUtil.java  |   214 -
 .../apache/calcite/avatica/SslDriverTest.java   |   225 -
 .../calcite/avatica/jdbc/JdbcMetaTest.java      |   123 -
 .../calcite/avatica/jdbc/StatementInfoTest.java |   138 -
 .../remote/AlternatingRemoteMetaTest.java       |   398 -
 .../calcite/avatica/remote/RemoteMetaTest.java  |   774 -
 .../server/AbstractAvaticaHandlerTest.java      |   102 -
 .../avatica/server/BasicAuthHttpServerTest.java |   162 -
 .../server/DigestAuthHttpServerTest.java        |   176 -
 .../avatica/server/HandlerFactoryTest.java      |    58 -
 .../calcite/avatica/server/HttpAuthBase.java    |    80 -
 .../avatica/server/HttpServerBuilderTest.java   |   146 -
 .../server/HttpServerSpnegoWithJaasTest.java    |   229 -
 .../server/HttpServerSpnegoWithoutJaasTest.java |   220 -
 .../calcite/avatica/test/AvaticaSuite.java      |    37 -
 .../src/test/resources/auth-users.properties    |    20 -
 .../server/src/test/resources/log4j.properties  |    28 -
 avatica/shaded/core/pom.xml                     |   108 -
 .../core/src/main/resources/META-INF/LICENSE    |   257 -
 avatica/site/.gitignore                         |     2 -
 avatica/site/Gemfile                            |    20 -
 avatica/site/README.md                          |    51 -
 avatica/site/_config.yml                        |    46 -
 avatica/site/_data/contributors.yml             |   121 -
 avatica/site/_data/docs.yml                     |    38 -
 avatica/site/_docs/api.md                       |    28 -
 avatica/site/_docs/client_reference.md          |   174 -
 avatica/site/_docs/compatibility.md             |   105 -
 avatica/site/_docs/custom_client_artifacts.md   |   133 -
 avatica/site/_docs/history.md                   |   314 -
 avatica/site/_docs/howto.md                     |   535 -
 avatica/site/_docs/index.md                     |   176 -
 avatica/site/_docs/json_reference.md            |  1191 --
 avatica/site/_docs/protobuf_reference.md        |  1304 --
 avatica/site/_docs/roadmap.md                   |    51 -
 avatica/site/_docs/security.md                  |   253 -
 avatica/site/_docs/testapi.md                   |    28 -
 avatica/site/_includes/anchor_links.html        |    33 -
 avatica/site/_includes/docs_contents.html       |     8 -
 .../site/_includes/docs_contents_mobile.html    |    10 -
 avatica/site/_includes/docs_option.html         |    11 -
 avatica/site/_includes/docs_ul.html             |    30 -
 avatica/site/_includes/footer.html              |    15 -
 avatica/site/_includes/header.html              |    18 -
 avatica/site/_includes/news_contents.html       |    30 -
 .../site/_includes/news_contents_mobile.html    |    11 -
 avatica/site/_includes/news_item.html           |    62 -
 avatica/site/_includes/primary-nav-items.html   |    20 -
 avatica/site/_includes/section_nav.html         |    39 -
 avatica/site/_includes/top.html                 |    15 -
 avatica/site/_layouts/default.html              |    12 -
 avatica/site/_layouts/docs.html                 |    23 -
 avatica/site/_layouts/external.html             |     9 -
 avatica/site/_layouts/news.html                 |    19 -
 avatica/site/_layouts/news_item.html            |    49 -
 avatica/site/_layouts/page.html                 |    18 -
 avatica/site/_plugins/bundler.rb                |    20 -
 .../site/_posts/2016-03-03-separate-project.md  |    34 -
 avatica/site/_posts/2016-03-18-release-1.7.1.md |    87 -
 avatica/site/_posts/2016-06-04-release-1.8.0.md |    87 -
 avatica/site/_posts/2016-11-01-release-1.9.0.md |    46 -
 avatica/site/_sass/_font-awesome.scss           |    25 -
 avatica/site/_sass/_gridism.scss                |   124 -
 avatica/site/_sass/_mixins.scss                 |    38 -
 avatica/site/_sass/_normalize.scss              |     1 -
 avatica/site/_sass/_pygments.scss               |    78 -
 avatica/site/_sass/_style.scss                  |   989 -
 avatica/site/community/index.md                 |    70 -
 avatica/site/css/screen.scss                    |     9 -
 avatica/site/develop/index.md                   |   116 -
 avatica/site/downloads/index.md                 |   108 -
 avatica/site/fonts/fontawesome-webfont.eot      |   Bin 56006 -> 0 bytes
 avatica/site/fonts/fontawesome-webfont.svg      |   520 -
 avatica/site/fonts/fontawesome-webfont.ttf      |   Bin 112160 -> 0 bytes
 avatica/site/fonts/fontawesome-webfont.woff     |   Bin 65452 -> 0 bytes
 avatica/site/img/feather.png                    |   Bin 12607 -> 0 bytes
 avatica/site/img/logo.png                       |   Bin 27763 -> 0 bytes
 avatica/site/index.html                         |    66 -
 avatica/site/js/html5shiv.min.js                |     4 -
 avatica/site/js/respond.min.js                  |     5 -
 avatica/site/news/index.html                    |    35 -
 avatica/site/news/releases/index.html           |    26 -
 .../main/config/assemblies/source-assembly.xml  |   103 -
 avatica/src/main/config/checkstyle/checker.xml  |   279 -
 avatica/src/main/config/checkstyle/header.txt   |    16 -
 .../src/main/config/checkstyle/suppressions.xml |    49 -
 .../main/config/forbidden-apis/signatures.txt   |    39 -
 avatica/standalone-server/.gitignore            |     1 -
 avatica/standalone-server/pom.xml               |   217 -
 .../avatica/standalone/StandaloneServer.java    |   138 -
 .../avatica/standalone/package-info.java        |    26 -
 .../src/main/resources/log4j.properties         |    24 -
 .../src/main/shaded-resources/LICENSE           |   251 -
 avatica/tck/.gitignore                          |     1 -
 avatica/tck/README.md                           |    80 -
 avatica/tck/pom.xml                             |   224 -
 .../calcite/avatica/tck/PackageMarker.java      |    37 -
 .../apache/calcite/avatica/tck/TestRunner.java  |   274 -
 .../org/apache/calcite/avatica/tck/Unsafe.java  |    55 -
 .../calcite/avatica/tck/package-info.java       |    24 -
 .../calcite/avatica/tck/tests/BaseTckTest.java  |    56 -
 .../calcite/avatica/tck/tests/BinaryTest.java   |   105 -
 .../calcite/avatica/tck/tests/InsertTest.java   |   213 -
 .../calcite/avatica/tck/tests/MetadataTest.java |   132 -
 .../calcite/avatica/tck/tests/package-info.java |    26 -
 avatica/tck/src/main/resources/META-INF/LICENSE |   251 -
 .../tck/src/main/resources/example_config.yml   |    38 -
 avatica/tck/src/main/resources/log4j.properties |    24 -
 avatica/tck/src/main/ruby/test_runner.rb        |   125 -
 cassandra/pom.xml                               |   143 -
 .../adapter/cassandra/CassandraEnumerator.java  |   113 -
 .../adapter/cassandra/CassandraFilter.java      |   284 -
 .../adapter/cassandra/CassandraLimit.java       |    71 -
 .../adapter/cassandra/CassandraMethod.java      |    51 -
 .../adapter/cassandra/CassandraProject.java     |    74 -
 .../calcite/adapter/cassandra/CassandraRel.java |    74 -
 .../adapter/cassandra/CassandraRules.java       |   411 -
 .../adapter/cassandra/CassandraSchema.java      |   305 -
 .../cassandra/CassandraSchemaFactory.java       |    44 -
 .../adapter/cassandra/CassandraSort.java        |    85 -
 .../adapter/cassandra/CassandraTable.java       |   256 -
 .../adapter/cassandra/CassandraTableScan.java   |    78 -
 .../CassandraToEnumerableConverter.java         |   156 -
 .../CassandraToEnumerableConverterRule.java     |    43 -
 .../calcite/adapter/cassandra/package-info.java |    28 -
 .../apache/calcite/test/CassandraAdapterIT.java |   171 -
 cassandra/src/test/resources/model.json         |    31 -
 core/pom.xml                                    |   485 +-
 core/src/main/codegen/config.fmpp               |   105 -
 .../codegen/includes/compoundIdentifier.ftl     |    34 -
 core/src/main/codegen/includes/parserImpls.ftl  |    34 -
 core/src/main/codegen/templates/Parser.jj       |  6623 ------
 .../calcite/avatica/util/FilteredConstants.java |    26 +
 .../java/org/apache/calcite/DataContext.java    |   112 -
 core/src/main/java/org/apache/calcite/Demo.java |    43 -
 .../calcite/adapter/clone/ArrayTable.java       |   900 -
 .../calcite/adapter/clone/CloneSchema.java      |   172 -
 .../calcite/adapter/clone/ColumnLoader.java     |   476 -
 .../apache/calcite/adapter/clone/ListTable.java |    98 -
 .../calcite/adapter/clone/package-info.java     |    26 -
 .../adapter/enumerable/AggAddContext.java       |    65 -
 .../calcite/adapter/enumerable/AggContext.java  |    72 -
 .../calcite/adapter/enumerable/AggImpState.java |    49 -
 .../adapter/enumerable/AggImplementor.java      |    89 -
 .../adapter/enumerable/AggResetContext.java     |    43 -
 .../adapter/enumerable/AggResultContext.java    |    30 -
 .../adapter/enumerable/CallImplementor.java     |    44 -
 .../calcite/adapter/enumerable/EnumUtils.java   |   269 -
 .../adapter/enumerable/EnumerableAggregate.java |   468 -
 .../enumerable/EnumerableAggregateRule.java     |    56 -
 .../adapter/enumerable/EnumerableBindable.java  |   102 -
 .../adapter/enumerable/EnumerableCalc.java      |   274 -
 .../adapter/enumerable/EnumerableCalcRule.java  |    47 -
 .../adapter/enumerable/EnumerableCollect.java   |    71 -
 .../enumerable/EnumerableCollectRule.java       |    49 -
 .../enumerable/EnumerableConvention.java        |    69 -
 .../adapter/enumerable/EnumerableCorrelate.java |   117 -
 .../enumerable/EnumerableCorrelateRule.java     |    51 -
 .../adapter/enumerable/EnumerableFilter.java    |    87 -
 .../enumerable/EnumerableFilterRule.java        |    46 -
 .../enumerable/EnumerableFilterToCalcRule.java  |    52 -
 .../enumerable/EnumerableInterpretable.java     |   205 -
 .../enumerable/EnumerableInterpreter.java       |   104 -
 .../enumerable/EnumerableInterpreterRule.java   |    44 -
 .../adapter/enumerable/EnumerableIntersect.java |    81 -
 .../enumerable/EnumerableIntersectRule.java     |    48 -
 .../adapter/enumerable/EnumerableJoin.java      |   227 -
 .../adapter/enumerable/EnumerableJoinRule.java  |    98 -
 .../adapter/enumerable/EnumerableLimit.java     |   139 -
 .../adapter/enumerable/EnumerableLimitRule.java |    68 -
 .../adapter/enumerable/EnumerableMergeJoin.java |   190 -
 .../enumerable/EnumerableMergeJoinRule.java     |   116 -
 .../adapter/enumerable/EnumerableMinus.java     |    81 -
 .../adapter/enumerable/EnumerableMinusRule.java |    49 -
 .../adapter/enumerable/EnumerableProject.java   |    96 -
 .../enumerable/EnumerableProjectRule.java       |    46 -
 .../enumerable/EnumerableProjectToCalcRule.java |    45 -
 .../adapter/enumerable/EnumerableRel.java       |   132 -
 .../enumerable/EnumerableRelImplementor.java    |   535 -
 .../adapter/enumerable/EnumerableRules.java     |   103 -
 .../adapter/enumerable/EnumerableSemiJoin.java  |   133 -
 .../enumerable/EnumerableSemiJoinRule.java      |    52 -
 .../adapter/enumerable/EnumerableSort.java      |    96 -
 .../adapter/enumerable/EnumerableSortRule.java  |    50 -
 .../enumerable/EnumerableTableFunctionScan.java |   116 -
 .../EnumerableTableFunctionScanRule.java        |    45 -
 .../enumerable/EnumerableTableModify.java       |   173 -
 .../enumerable/EnumerableTableModifyRule.java   |    58 -
 .../adapter/enumerable/EnumerableTableScan.java |   271 -
 .../enumerable/EnumerableTableScanRule.java     |    52 -
 .../adapter/enumerable/EnumerableThetaJoin.java |   189 -
 .../adapter/enumerable/EnumerableUncollect.java |   130 -
 .../enumerable/EnumerableUncollectRule.java     |    47 -
 .../adapter/enumerable/EnumerableUnion.java     |    81 -
 .../adapter/enumerable/EnumerableUnionRule.java |    44 -
 .../adapter/enumerable/EnumerableValues.java    |   128 -
 .../enumerable/EnumerableValuesRule.java        |    41 -
 .../adapter/enumerable/EnumerableWindow.java    |   972 -
 .../enumerable/EnumerableWindowRule.java        |    48 -
 .../adapter/enumerable/JavaRelImplementor.java  |    57 -
 .../adapter/enumerable/JavaRowFormat.java       |   296 -
 .../adapter/enumerable/NestedBlockBuilder.java  |    77 -
 .../enumerable/NestedBlockBuilderImpl.java      |   120 -
 .../adapter/enumerable/NotNullImplementor.java  |    48 -
 .../calcite/adapter/enumerable/NullPolicy.java  |    44 -
 .../calcite/adapter/enumerable/PhysType.java    |   205 -
 .../adapter/enumerable/PhysTypeImpl.java        |   659 -
 .../ReflectiveCallNotNullImplementor.java       |    63 -
 .../calcite/adapter/enumerable/RexImpTable.java |  2181 --
 .../adapter/enumerable/RexToLixTranslator.java  |  1146 --
 .../enumerable/StrictAggImplementor.java        |   211 -
 .../enumerable/StrictWinAggImplementor.java     |    82 -
 .../adapter/enumerable/WinAggAddContext.java    |    44 -
 .../adapter/enumerable/WinAggContext.java       |    27 -
 .../adapter/enumerable/WinAggFrameContext.java  |    75 -
 .../enumerable/WinAggFrameResultContext.java    |    68 -
 .../adapter/enumerable/WinAggImplementor.java   |    65 -
 .../adapter/enumerable/WinAggResetContext.java  |    35 -
 .../adapter/enumerable/WinAggResultContext.java |    54 -
 .../enumerable/impl/AggAddContextImpl.java      |    40 -
 .../enumerable/impl/AggResetContextImpl.java    |    50 -
 .../enumerable/impl/AggResultContextImpl.java   |    43 -
 .../enumerable/impl/WinAggAddContextImpl.java   |    53 -
 .../enumerable/impl/WinAggResetContextImpl.java |    89 -
 .../impl/WinAggResultContextImpl.java           |   107 -
 .../adapter/enumerable/impl/package-info.java   |    26 -
 .../adapter/enumerable/package-info.java        |    26 -
 .../adapter/java/AbstractQueryableTable.java    |    49 -
 .../org/apache/calcite/adapter/java/Array.java  |    41 -
 .../calcite/adapter/java/JavaTypeFactory.java   |    56 -
 .../org/apache/calcite/adapter/java/Map.java    |    44 -
 .../calcite/adapter/java/ReflectiveSchema.java  |   362 -
 .../calcite/adapter/java/package-info.java      |    27 -
 .../calcite/adapter/jdbc/JdbcConvention.java    |    74 -
 .../calcite/adapter/jdbc/JdbcImplementor.java   |    47 -
 .../calcite/adapter/jdbc/JdbcQueryProvider.java |    38 -
 .../apache/calcite/adapter/jdbc/JdbcRel.java    |    28 -
 .../apache/calcite/adapter/jdbc/JdbcRules.java  |   813 -
 .../apache/calcite/adapter/jdbc/JdbcSchema.java |   440 -
 .../apache/calcite/adapter/jdbc/JdbcTable.java  |   222 -
 .../calcite/adapter/jdbc/JdbcTableScan.java     |    57 -
 .../adapter/jdbc/JdbcToEnumerableConverter.java |   325 -
 .../jdbc/JdbcToEnumerableConverterRule.java     |    41 -
 .../apache/calcite/adapter/jdbc/JdbcUtils.java  |   229 -
 .../calcite/adapter/jdbc/package-info.java      |    26 -
 .../apache/calcite/adapter/package-info.java    |    45 -
 .../avatica/AvaticaClientRuntimeException.java  |    94 +
 .../calcite/avatica/AvaticaConnection.java      |   769 +
 .../avatica/AvaticaDatabaseMetaData.java        |  1460 ++
 .../apache/calcite/avatica/AvaticaFactory.java  |    83 +
 .../calcite/avatica/AvaticaJdbc41Factory.java   |   256 +
 .../calcite/avatica/AvaticaParameter.java       |   135 +
 .../avatica/AvaticaPreparedStatement.java       |   387 +
 .../calcite/avatica/AvaticaResultSet.java       |  1060 +
 .../avatica/AvaticaResultSetMetaData.java       |   145 +
 .../apache/calcite/avatica/AvaticaSeverity.java |    90 +
 .../org/apache/calcite/avatica/AvaticaSite.java |   588 +
 .../AvaticaSpecificDatabaseMetaData.java        |    57 +
 .../calcite/avatica/AvaticaSqlException.java    |   138 +
 .../calcite/avatica/AvaticaStatement.java       |   573 +
 .../apache/calcite/avatica/AvaticaUtils.java    |   423 +
 .../avatica/BuiltInConnectionProperty.java      |   156 +
 .../apache/calcite/avatica/ColumnMetaData.java  |   599 +
 .../calcite/avatica/ConnectStringParser.java    |   394 +
 .../calcite/avatica/ConnectionConfig.java       |    58 +
 .../calcite/avatica/ConnectionConfigImpl.java   |   374 +
 .../avatica/ConnectionPropertiesImpl.java       |   279 +
 .../calcite/avatica/ConnectionProperty.java     |   119 +
 .../apache/calcite/avatica/DriverVersion.java   |   149 +
 .../org/apache/calcite/avatica/Handler.java     |    87 +
 .../org/apache/calcite/avatica/HandlerImpl.java |    47 +
 .../java/org/apache/calcite/avatica/Helper.java |    76 +
 .../calcite/avatica/InternalProperty.java       |   109 +
 .../java/org/apache/calcite/avatica/Meta.java   |  1338 ++
 .../org/apache/calcite/avatica/MetaImpl.java    |  1653 ++
 .../avatica/MissingResultsException.java        |    41 +
 .../avatica/NoSuchConnectionException.java      |    37 +
 .../avatica/NoSuchStatementException.java       |    39 +
 .../org/apache/calcite/avatica/QueryState.java  |   466 +
 .../org/apache/calcite/avatica/SqlState.java    |  1861 ++
 .../org/apache/calcite/avatica/SqlType.java     |   559 +
 .../calcite/avatica/UnregisteredDriver.java     |   249 +
 .../apache/calcite/avatica/package-info.java    |    26 +
 .../apache/calcite/avatica/proto/Common.java    | 18319 +++++++++++++++++
 .../apache/calcite/avatica/proto/Requests.java  | 16608 +++++++++++++++
 .../apache/calcite/avatica/proto/Responses.java | 13962 +++++++++++++
 .../calcite/avatica/remote/AbstractHandler.java |   158 +
 .../calcite/avatica/remote/AbstractService.java |   159 +
 .../avatica/remote/AuthenticationType.java      |    29 +
 .../remote/AvaticaCommonsHttpClientImpl.java    |   221 +
 .../AvaticaCommonsHttpClientSpnegoImpl.java     |   180 +
 .../avatica/remote/AvaticaHttpClient.java       |    34 +
 .../remote/AvaticaHttpClientFactory.java        |    39 +
 .../remote/AvaticaHttpClientFactoryImpl.java    |   127 +
 .../avatica/remote/AvaticaHttpClientImpl.java   |    73 +
 .../AvaticaRemoteConnectionConfigImpl.java      |    36 +
 .../remote/AvaticaRemoteConnectionProperty.java |    85 +
 .../avatica/remote/AvaticaRuntimeException.java |   102 +
 .../avatica/remote/DoAsAvaticaHttpClient.java   |    46 +
 .../apache/calcite/avatica/remote/Driver.java   |   200 +
 .../apache/calcite/avatica/remote/Handler.java  |    68 +
 .../calcite/avatica/remote/JsonHandler.java     |    76 +
 .../calcite/avatica/remote/JsonService.java     |   243 +
 .../avatica/remote/KerberosConnection.java      |   400 +
 .../avatica/remote/LocalJsonService.java        |    46 +
 .../avatica/remote/LocalProtobufService.java    |    58 +
 .../calcite/avatica/remote/LocalService.java    |   376 +
 .../avatica/remote/MetaDataOperation.java       |   181 +
 .../calcite/avatica/remote/MetricsHelper.java   |    36 +
 .../calcite/avatica/remote/MockJsonService.java |   118 +
 .../avatica/remote/MockProtobufService.java     |   144 +
 .../calcite/avatica/remote/ProtobufHandler.java |    62 +
 .../calcite/avatica/remote/ProtobufMeta.java    |    45 +
 .../calcite/avatica/remote/ProtobufService.java |   140 +
 .../avatica/remote/ProtobufTranslation.java     |    64 +
 .../avatica/remote/ProtobufTranslationImpl.java |   399 +
 .../calcite/avatica/remote/RemoteMeta.java      |   436 +
 .../avatica/remote/RemoteProtobufService.java   |    70 +
 .../calcite/avatica/remote/RemoteService.java   |    39 +
 .../avatica/remote/RequestTranslator.java       |    45 +
 .../avatica/remote/ResponseTranslator.java      |    44 +
 .../apache/calcite/avatica/remote/Service.java  |  3114 +++
 .../avatica/remote/TrustStoreConfigurable.java  |    36 +
 .../calcite/avatica/remote/TypedValue.java      |   656 +
 .../UsernamePasswordAuthenticateable.java       |    35 +
 .../calcite/avatica/remote/package-info.java    |    26 +
 .../calcite/avatica/util/AbstractCursor.java    |  1384 ++
 .../apache/calcite/avatica/util/ArrayImpl.java  |   204 +
 .../avatica/util/ArrayIteratorCursor.java       |    41 +
 .../org/apache/calcite/avatica/util/Base64.java |  2093 ++
 .../apache/calcite/avatica/util/ByteString.java |   353 +
 .../org/apache/calcite/avatica/util/Casing.java |    35 +
 .../org/apache/calcite/avatica/util/Cursor.java |   145 +
 .../calcite/avatica/util/DateTimeUtils.java     |  1034 +
 .../calcite/avatica/util/IteratorCursor.java    |    85 +
 .../avatica/util/ListIteratorCursor.java        |    43 +
 .../calcite/avatica/util/MapIteratorCursor.java |    51 +
 .../calcite/avatica/util/PackageMarker.java     |    37 +
 .../calcite/avatica/util/PositionedCursor.java  |   134 +
 .../apache/calcite/avatica/util/Quoting.java    |    37 +
 .../avatica/util/RecordIteratorCursor.java      |    63 +
 .../org/apache/calcite/avatica/util/Spacer.java |    80 +
 .../org/apache/calcite/avatica/util/Spaces.java |   185 +
 .../apache/calcite/avatica/util/StructImpl.java |    79 +
 .../apache/calcite/avatica/util/TimeUnit.java   |    96 +
 .../calcite/avatica/util/TimeUnitRange.java     |   119 +
 .../org/apache/calcite/avatica/util/Unsafe.java |    55 +
 .../avatica/util/UnsynchronizedBuffer.java      |   152 +
 .../calcite/avatica/util/package-info.java      |    24 +
 .../calcite/config/CalciteConnectionConfig.java |    73 -
 .../config/CalciteConnectionConfigImpl.java     |   175 -
 .../config/CalciteConnectionProperty.java       |   224 -
 .../java/org/apache/calcite/config/Lex.java     |    76 -
 .../apache/calcite/config/NullCollation.java    |    50 -
 .../org/apache/calcite/config/package-info.java |    26 -
 .../calcite/interpreter/AbstractSingleNode.java |    38 -
 .../calcite/interpreter/AggregateNode.java      |   528 -
 .../calcite/interpreter/BindableConvention.java |    74 -
 .../apache/calcite/interpreter/BindableRel.java |    31 -
 .../apache/calcite/interpreter/Bindables.java   |   686 -
 .../org/apache/calcite/interpreter/Context.java |    35 -
 .../apache/calcite/interpreter/FilterNode.java  |    51 -
 .../interpreter/InterpretableConvention.java    |    68 -
 .../interpreter/InterpretableConverter.java     |    55 -
 .../calcite/interpreter/InterpretableRel.java   |    55 -
 .../apache/calcite/interpreter/Interpreter.java |   513 -
 .../calcite/interpreter/Interpreters.java       |    50 -
 .../calcite/interpreter/JaninoRexCompiler.java  |   183 -
 .../apache/calcite/interpreter/JoinNode.java    |    76 -
 .../org/apache/calcite/interpreter/Node.java    |    26 -
 .../org/apache/calcite/interpreter/Nodes.java   |    90 -
 .../NoneToBindableConverterRule.java            |    44 -
 .../apache/calcite/interpreter/ProjectNode.java |    49 -
 .../org/apache/calcite/interpreter/Row.java     |   142 -
 .../org/apache/calcite/interpreter/Scalar.java  |    27 -
 .../org/apache/calcite/interpreter/Sink.java    |    36 -
 .../apache/calcite/interpreter/SortNode.java    |   124 -
 .../org/apache/calcite/interpreter/Source.java  |    31 -
 .../calcite/interpreter/TableScanNode.java      |   299 -
 .../apache/calcite/interpreter/UnionNode.java   |    58 -
 .../apache/calcite/interpreter/ValuesNode.java  |    70 -
 .../apache/calcite/interpreter/WindowNode.java  |    39 -
 .../calcite/interpreter/package-info.java       |    30 -
 .../calcite/jdbc/CachingCalciteSchema.java      |   274 -
 .../apache/calcite/jdbc/CalciteConnection.java  |    81 -
 .../calcite/jdbc/CalciteConnectionImpl.java     |   543 -
 .../org/apache/calcite/jdbc/CalciteFactory.java |    62 -
 .../calcite/jdbc/CalciteJdbc41Factory.java      |   266 -
 .../apache/calcite/jdbc/CalciteMetaImpl.java    |   841 -
 .../org/apache/calcite/jdbc/CalcitePrepare.java |   377 -
 .../calcite/jdbc/CalcitePreparedStatement.java  |    56 -
 .../apache/calcite/jdbc/CalciteResultSet.java   |   118 -
 .../apache/calcite/jdbc/CalciteRootSchema.java  |    32 -
 .../org/apache/calcite/jdbc/CalciteSchema.java  |   641 -
 .../apache/calcite/jdbc/CalciteStatement.java   |   104 -
 .../java/org/apache/calcite/jdbc/Driver.java    |   181 -
 .../org/apache/calcite/jdbc/JavaRecordType.java |    54 -
 .../calcite/jdbc/JavaTypeFactoryImpl.java       |   403 -
 .../org/apache/calcite/jdbc/MetadataSchema.java |    69 -
 .../calcite/jdbc/SimpleCalciteSchema.java       |   147 -
 .../calcite/jdbc/SqlTimeoutException.java       |    34 -
 .../org/apache/calcite/jdbc/package-info.java   |    26 -
 .../CachingLatticeStatisticProvider.java        |    59 -
 .../DelegatingLatticeStatisticProvider.java     |    41 -
 .../org/apache/calcite/materialize/Lattice.java |   859 -
 .../materialize/LatticeStatisticProvider.java   |    27 -
 .../apache/calcite/materialize/Lattices.java    |    40 -
 .../materialize/MaterializationActor.java       |   114 -
 .../calcite/materialize/MaterializationKey.java |    46 -
 .../materialize/MaterializationService.java     |   408 -
 .../SqlLatticeStatisticProvider.java            |    48 -
 .../org/apache/calcite/materialize/TileKey.java |    61 -
 .../calcite/materialize/TileSuggester.java      |   222 -
 .../calcite/materialize/package-info.java       |    40 -
 .../org/apache/calcite/model/JsonColumn.java    |    34 -
 .../apache/calcite/model/JsonCustomSchema.java  |    53 -
 .../apache/calcite/model/JsonCustomTable.java   |    49 -
 .../org/apache/calcite/model/JsonFunction.java  |    68 -
 .../apache/calcite/model/JsonJdbcSchema.java    |    70 -
 .../org/apache/calcite/model/JsonLattice.java   |   146 -
 .../org/apache/calcite/model/JsonMapSchema.java |    58 -
 .../calcite/model/JsonMaterialization.java      |    56 -
 .../org/apache/calcite/model/JsonMeasure.java   |    59 -
 .../java/org/apache/calcite/model/JsonRoot.java |    69 -
 .../org/apache/calcite/model/JsonSchema.java    |   115 -
 .../org/apache/calcite/model/JsonStream.java    |    41 -
 .../org/apache/calcite/model/JsonTable.java     |    60 -
 .../java/org/apache/calcite/model/JsonTile.java |    56 -
 .../java/org/apache/calcite/model/JsonView.java |   100 -
 .../org/apache/calcite/model/ModelHandler.java  |   461 -
 .../org/apache/calcite/model/package-info.java  |    41 -
 .../java/org/apache/calcite/package-info.java   |    26 -
 .../calcite/plan/AbstractRelOptPlanner.java     |   429 -
 .../calcite/plan/CommonRelSubExprRule.java      |    38 -
 .../java/org/apache/calcite/plan/Context.java   |    32 -
 .../java/org/apache/calcite/plan/Contexts.java  |   160 -
 .../org/apache/calcite/plan/Convention.java     |   110 -
 .../apache/calcite/plan/ConventionTraitDef.java |   251 -
 .../MaterializedViewSubstitutionVisitor.java    |   285 -
 .../calcite/plan/MulticastRelOptListener.java   |    87 -
 .../apache/calcite/plan/RelCompositeTrait.java  |   149 -
 .../org/apache/calcite/plan/RelImplementor.java |    30 -
 .../apache/calcite/plan/RelMultipleTrait.java   |    32 -
 .../calcite/plan/RelOptAbstractTable.java       |   110 -
 .../org/apache/calcite/plan/RelOptCluster.java  |   172 -
 .../apache/calcite/plan/RelOptConnection.java   |    32 -
 .../org/apache/calcite/plan/RelOptCost.java     |   136 -
 .../apache/calcite/plan/RelOptCostFactory.java  |    49 -
 .../org/apache/calcite/plan/RelOptCostImpl.java |   148 -
 .../org/apache/calcite/plan/RelOptLattice.java  |    88 -
 .../org/apache/calcite/plan/RelOptListener.java |   187 -
 .../calcite/plan/RelOptMaterialization.java     |   299 -
 .../calcite/plan/RelOptMaterializations.java    |   235 -
 .../org/apache/calcite/plan/RelOptNode.java     |    94 -
 .../org/apache/calcite/plan/RelOptPlanner.java  |   351 -
 .../calcite/plan/RelOptPredicateList.java       |   184 -
 .../org/apache/calcite/plan/RelOptQuery.java    |   131 -
 .../org/apache/calcite/plan/RelOptRule.java     |   640 -
 .../org/apache/calcite/plan/RelOptRuleCall.java |   236 -
 .../apache/calcite/plan/RelOptRuleOperand.java  |   219 -
 .../plan/RelOptRuleOperandChildPolicy.java      |    52 -
 .../calcite/plan/RelOptRuleOperandChildren.java |    55 -
 .../calcite/plan/RelOptSamplingParameters.java  |    99 -
 .../org/apache/calcite/plan/RelOptSchema.java   |    56 -
 .../calcite/plan/RelOptSchemaWithSampling.java  |    46 -
 .../org/apache/calcite/plan/RelOptTable.java    |   138 -
 .../org/apache/calcite/plan/RelOptUtil.java     |  3738 ----
 .../java/org/apache/calcite/plan/RelTrait.java  |    90 -
 .../org/apache/calcite/plan/RelTraitDef.java    |   228 -
 .../plan/RelTraitPropagationVisitor.java        |    79 -
 .../org/apache/calcite/plan/RelTraitSet.java    |   561 -
 .../calcite/plan/RexImplicationChecker.java     |   533 -
 .../java/org/apache/calcite/plan/Strong.java    |   262 -
 .../calcite/plan/SubstitutionVisitor.java       |  1534 --
 .../org/apache/calcite/plan/TableAccessMap.java |   204 -
 .../apache/calcite/plan/VisitorDataContext.java |   204 -
 .../apache/calcite/plan/hep/HepInstruction.java |   197 -
 .../apache/calcite/plan/hep/HepMatchOrder.java  |    43 -
 .../org/apache/calcite/plan/hep/HepPlanner.java |   975 -
 .../org/apache/calcite/plan/hep/HepProgram.java |    78 -
 .../calcite/plan/hep/HepProgramBuilder.java     |   268 -
 .../plan/hep/HepRelMetadataProvider.java        |    71 -
 .../apache/calcite/plan/hep/HepRelVertex.java   |    99 -
 .../apache/calcite/plan/hep/HepRuleCall.java    |    66 -
 .../apache/calcite/plan/hep/package-info.java   |    27 -
 .../org/apache/calcite/plan/package-info.java   |    27 -
 .../calcite/plan/volcano/AbstractConverter.java |   127 -
 .../ChainedPhaseRuleMappingInitializer.java     |    70 -
 .../org/apache/calcite/plan/volcano/RelSet.java |   378 -
 .../apache/calcite/plan/volcano/RelSubset.java  |   479 -
 .../apache/calcite/plan/volcano/RuleQueue.java  |   704 -
 .../calcite/plan/volcano/VolcanoCost.java       |   236 -
 .../calcite/plan/volcano/VolcanoPlanner.java    |  1843 --
 .../plan/volcano/VolcanoPlannerPhase.java       |    28 -
 ...lcanoPlannerPhaseRuleMappingInitializer.java |    51 -
 .../volcano/VolcanoRelMetadataProvider.java     |   124 -
 .../calcite/plan/volcano/VolcanoRuleCall.java   |   341 -
 .../calcite/plan/volcano/VolcanoRuleMatch.java  |   200 -
 .../calcite/plan/volcano/package-info.java      |   276 -
 .../calcite/prepare/CalciteCatalogReader.java   |   416 -
 .../calcite/prepare/CalciteMaterializer.java    |   213 -
 .../calcite/prepare/CalcitePrepareImpl.java     |  1485 --
 .../calcite/prepare/CalciteSqlValidator.java    |    49 -
 .../calcite/prepare/LixToRelTranslator.java     |   180 -
 .../org/apache/calcite/prepare/PlannerImpl.java |   349 -
 .../org/apache/calcite/prepare/Prepare.java     |   649 -
 .../calcite/prepare/QueryableRelBuilder.java    |   738 -
 .../apache/calcite/prepare/RelOptTableImpl.java |   432 -
 .../apache/calcite/prepare/package-info.java    |    26 -
 .../org/apache/calcite/rel/AbstractRelNode.java |   427 -
 .../main/java/org/apache/calcite/rel/BiRel.java |    84 -
 .../apache/calcite/rel/InvalidRelException.java |    57 -
 .../org/apache/calcite/rel/RelCollation.java    |    38 -
 .../apache/calcite/rel/RelCollationImpl.java    |   171 -
 .../calcite/rel/RelCollationTraitDef.java       |   103 -
 .../org/apache/calcite/rel/RelCollations.java   |   170 -
 .../org/apache/calcite/rel/RelDistribution.java |    94 -
 .../calcite/rel/RelDistributionTraitDef.java    |    75 -
 .../apache/calcite/rel/RelDistributions.java    |   176 -
 .../apache/calcite/rel/RelFieldCollation.java   |   272 -
 .../calcite/rel/RelHomogeneousShuttle.java      |    96 -
 .../java/org/apache/calcite/rel/RelInput.java   |   100 -
 .../java/org/apache/calcite/rel/RelNode.java    |   451 -
 .../java/org/apache/calcite/rel/RelNodes.java   |    69 -
 .../java/org/apache/calcite/rel/RelRoot.java    |   189 -
 .../java/org/apache/calcite/rel/RelShuttle.java |    69 -
 .../org/apache/calcite/rel/RelShuttleImpl.java  |   135 -
 .../java/org/apache/calcite/rel/RelVisitor.java |    66 -
 .../java/org/apache/calcite/rel/RelWriter.java  |    84 -
 .../java/org/apache/calcite/rel/SingleRel.java  |    92 -
 .../apache/calcite/rel/convert/Converter.java   |    77 -
 .../calcite/rel/convert/ConverterImpl.java      |    84 -
 .../calcite/rel/convert/ConverterRule.java      |   126 -
 .../calcite/rel/convert/NoneConverter.java      |    62 -
 .../calcite/rel/convert/TraitMatchingRule.java  |    70 -
 .../calcite/rel/convert/package-info.java       |    27 -
 .../org/apache/calcite/rel/core/Aggregate.java  |   526 -
 .../apache/calcite/rel/core/AggregateCall.java  |   295 -
 .../java/org/apache/calcite/rel/core/Calc.java  |   180 -
 .../org/apache/calcite/rel/core/Collect.java    |   128 -
 .../org/apache/calcite/rel/core/Correlate.java  |   213 -
 .../apache/calcite/rel/core/CorrelationId.java  |   127 -
 .../org/apache/calcite/rel/core/EquiJoin.java   |    68 -
 .../org/apache/calcite/rel/core/Exchange.java   |   108 -
 .../org/apache/calcite/rel/core/Filter.java     |   157 -
 .../org/apache/calcite/rel/core/Intersect.java  |    65 -
 .../java/org/apache/calcite/rel/core/Join.java  |   300 -
 .../org/apache/calcite/rel/core/JoinInfo.java   |   143 -
 .../apache/calcite/rel/core/JoinRelType.java    |    99 -
 .../java/org/apache/calcite/rel/core/Match.java |   274 -
 .../java/org/apache/calcite/rel/core/Minus.java |    57 -
 .../org/apache/calcite/rel/core/Project.java    |   370 -
 .../apache/calcite/rel/core/RelFactories.java   |   416 -
 .../org/apache/calcite/rel/core/Sample.java     |    90 -
 .../org/apache/calcite/rel/core/SemiJoin.java   |   128 -
 .../java/org/apache/calcite/rel/core/SetOp.java |   142 -
 .../java/org/apache/calcite/rel/core/Sort.java  |   201 -
 .../apache/calcite/rel/core/SortExchange.java   |   112 -
 .../calcite/rel/core/TableFunctionScan.java     |   221 -
 .../apache/calcite/rel/core/TableModify.java    |   237 -
 .../org/apache/calcite/rel/core/TableScan.java  |   171 -
 .../org/apache/calcite/rel/core/Uncollect.java  |   152 -
 .../java/org/apache/calcite/rel/core/Union.java |    71 -
 .../org/apache/calcite/rel/core/Values.java     |   196 -
 .../org/apache/calcite/rel/core/Window.java     |   362 -
 .../apache/calcite/rel/core/package-info.java   |    39 -
 .../apache/calcite/rel/externalize/RelJson.java |   466 -
 .../calcite/rel/externalize/RelJsonReader.java  |   296 -
 .../calcite/rel/externalize/RelJsonWriter.java  |   158 -
 .../calcite/rel/externalize/RelWriterImpl.java  |   195 -
 .../calcite/rel/externalize/RelXmlWriter.java   |   162 -
 .../calcite/rel/externalize/package-info.java   |    27 -
 .../apache/calcite/rel/jdbc/package-info.java   |    27 -
 .../calcite/rel/logical/LogicalAggregate.java   |   114 -
 .../apache/calcite/rel/logical/LogicalCalc.java |   129 -
 .../calcite/rel/logical/LogicalCorrelate.java   |   121 -
 .../calcite/rel/logical/LogicalExchange.java    |    75 -
 .../calcite/rel/logical/LogicalFilter.java      |   150 -
 .../calcite/rel/logical/LogicalIntersect.java   |    80 -
 .../apache/calcite/rel/logical/LogicalJoin.java |   204 -
 .../calcite/rel/logical/LogicalMatch.java       |    77 -
 .../calcite/rel/logical/LogicalMinus.java       |    80 -
 .../calcite/rel/logical/LogicalProject.java     |   133 -
 .../apache/calcite/rel/logical/LogicalSort.java |    79 -
 .../rel/logical/LogicalTableFunctionScan.java   |   122 -
 .../calcite/rel/logical/LogicalTableModify.java |    87 -
 .../calcite/rel/logical/LogicalTableScan.java   |   114 -
 .../calcite/rel/logical/LogicalUnion.java       |    81 -
 .../calcite/rel/logical/LogicalValues.java      |   128 -
 .../calcite/rel/logical/LogicalWindow.java      |   376 -
 .../calcite/rel/logical/package-info.java       |    39 -
 .../calcite/rel/metadata/BuiltInMetadata.java   |   554 -
 .../metadata/CachingRelMetadataProvider.java    |   149 -
 .../metadata/ChainedRelMetadataProvider.java    |   152 -
 .../rel/metadata/CyclicMetadataException.java   |    37 -
 .../metadata/DefaultRelMetadataProvider.java    |    64 -
 .../rel/metadata/JaninoRelMetadataProvider.java |   536 -
 .../apache/calcite/rel/metadata/Metadata.java   |    47 -
 .../calcite/rel/metadata/MetadataDef.java       |    67 -
 .../calcite/rel/metadata/MetadataFactory.java   |    47 -
 .../rel/metadata/MetadataFactoryImpl.java       |    82 -
 .../calcite/rel/metadata/MetadataHandler.java   |    28 -
 .../calcite/rel/metadata/NullSentinel.java      |    43 -
 .../metadata/ReflectiveRelMetadataProvider.java |   373 -
 .../calcite/rel/metadata/RelColumnMapping.java  |    55 -
 .../calcite/rel/metadata/RelColumnOrigin.java   |    95 -
 .../calcite/rel/metadata/RelMdCollation.java    |   380 -
 .../rel/metadata/RelMdColumnOrigins.java        |   261 -
 .../rel/metadata/RelMdColumnUniqueness.java     |   421 -
 .../rel/metadata/RelMdDistinctRowCount.java     |   311 -
 .../calcite/rel/metadata/RelMdDistribution.java |   165 -
 .../rel/metadata/RelMdExplainVisibility.java    |    57 -
 .../calcite/rel/metadata/RelMdMaxRowCount.java  |   187 -
 .../calcite/rel/metadata/RelMdMemory.java       |   104 -
 .../calcite/rel/metadata/RelMdMinRowCount.java  |   161 -
 .../calcite/rel/metadata/RelMdParallelism.java  |    85 -
 .../metadata/RelMdPercentageOriginalRows.java   |   182 -
 .../rel/metadata/RelMdPopulationSize.java       |   163 -
 .../calcite/rel/metadata/RelMdPredicates.java   |   875 -
 .../calcite/rel/metadata/RelMdRowCount.java     |   214 -
 .../calcite/rel/metadata/RelMdSelectivity.java  |   192 -
 .../apache/calcite/rel/metadata/RelMdSize.java  |   394 -
 .../calcite/rel/metadata/RelMdUniqueKeys.java   |   233 -
 .../apache/calcite/rel/metadata/RelMdUtil.java  |   848 -
 .../rel/metadata/RelMetadataProvider.java       |    73 -
 .../calcite/rel/metadata/RelMetadataQuery.java  |   842 -
 .../calcite/rel/metadata/UnboundMetadata.java   |    31 -
 .../calcite/rel/metadata/package-info.java      |    27 -
 .../org/apache/calcite/rel/mutable/Holder.java  |    46 -
 .../calcite/rel/mutable/MutableAggregate.java   |    97 -
 .../calcite/rel/mutable/MutableBiRel.java       |    77 -
 .../apache/calcite/rel/mutable/MutableCalc.java |    64 -
 .../calcite/rel/mutable/MutableCollect.java     |    65 -
 .../calcite/rel/mutable/MutableCorrelate.java   |    91 -
 .../calcite/rel/mutable/MutableExchange.java    |    62 -
 .../calcite/rel/mutable/MutableFilter.java      |    64 -
 .../calcite/rel/mutable/MutableIntersect.java   |    55 -
 .../apache/calcite/rel/mutable/MutableJoin.java |    94 -
 .../calcite/rel/mutable/MutableLeafRel.java     |    48 -
 .../calcite/rel/mutable/MutableMinus.java       |    55 -
 .../calcite/rel/mutable/MutableMultiRel.java    |    71 -
 .../calcite/rel/mutable/MutableProject.java     |   100 -
 .../apache/calcite/rel/mutable/MutableRel.java  |   148 -
 .../calcite/rel/mutable/MutableRelType.java     |    44 -
 .../calcite/rel/mutable/MutableRelVisitor.java  |    34 -
 .../apache/calcite/rel/mutable/MutableRels.java |   400 -
 .../calcite/rel/mutable/MutableSample.java      |    69 -
 .../apache/calcite/rel/mutable/MutableScan.java |    56 -
 .../calcite/rel/mutable/MutableSemiJoin.java    |    90 -
 .../calcite/rel/mutable/MutableSetOp.java       |    52 -
 .../calcite/rel/mutable/MutableSingleRel.java   |    61 -
 .../apache/calcite/rel/mutable/MutableSort.java |    81 -
 .../rel/mutable/MutableTableFunctionScan.java   |    96 -
 .../calcite/rel/mutable/MutableTableModify.java |   113 -
 .../calcite/rel/mutable/MutableUncollect.java   |    67 -
 .../calcite/rel/mutable/MutableUnion.java       |    55 -
 .../calcite/rel/mutable/MutableValues.java      |    56 -
 .../calcite/rel/mutable/MutableWindow.java      |    73 -
 .../calcite/rel/mutable/package-info.java       |    39 -
 .../org/apache/calcite/rel/package-info.java    |    43 -
 .../calcite/rel/rel2sql/RelToSqlConverter.java  |   415 -
 .../calcite/rel/rel2sql/SqlImplementor.java     |  1155 --
 .../calcite/rel/rel2sql/package-info.java       |    26 -
 .../AggregateExpandDistinctAggregatesRule.java  |   934 -
 .../rel/rules/AggregateFilterTransposeRule.java |   162 -
 .../rel/rules/AggregateJoinTransposeRule.java   |   416 -
 .../rel/rules/AggregateProjectMergeRule.java    |   154 -
 .../AggregateProjectPullUpConstantsRule.java    |   186 -
 .../rel/rules/AggregateReduceFunctionsRule.java |   546 -
 .../calcite/rel/rules/AggregateRemoveRule.java  |    85 -
 .../rel/rules/AggregateStarTableRule.java       |   252 -
 .../rel/rules/AggregateUnionAggregateRule.java  |   113 -
 .../rel/rules/AggregateUnionTransposeRule.java  |   181 -
 .../calcite/rel/rules/AggregateValuesRule.java  |   101 -
 .../apache/calcite/rel/rules/CalcMergeRule.java |    89 -
 .../calcite/rel/rules/CalcRelSplitter.java      |   992 -
 .../calcite/rel/rules/CalcRemoveRule.java       |    64 -
 .../apache/calcite/rel/rules/CalcSplitRule.java |    61 -
 .../calcite/rel/rules/CoerceInputsRule.java     |   105 -
 .../calcite/rel/rules/DateRangeRules.java       |   399 -
 .../org/apache/calcite/rel/rules/EquiJoin.java  |    46 -
 .../rel/rules/FilterAggregateTransposeRule.java |   154 -
 .../calcite/rel/rules/FilterCalcMergeRule.java  |    88 -
 .../calcite/rel/rules/FilterCorrelateRule.java  |   133 -
 .../calcite/rel/rules/FilterJoinRule.java       |   360 -
 .../calcite/rel/rules/FilterMergeRule.java      |   103 -
 .../rel/rules/FilterMultiJoinMergeRule.java     |    69 -
 .../rel/rules/FilterProjectTransposeRule.java   |   147 -
 .../FilterRemoveIsNotDistinctFromRule.java      |   114 -
 .../rel/rules/FilterSetOpTransposeRule.java     |    97 -
 .../rules/FilterTableFunctionTransposeRule.java |   119 -
 .../calcite/rel/rules/FilterTableScanRule.java  |   123 -
 .../calcite/rel/rules/FilterToCalcRule.java     |    74 -
 .../rel/rules/IntersectToDistinctRule.java      |   128 -
 .../rel/rules/JoinAddRedundantSemiJoinRule.java |    89 -
 .../calcite/rel/rules/JoinAssociateRule.java    |   155 -
 .../calcite/rel/rules/JoinCommuteRule.java      |   236 -
 .../rel/rules/JoinExtractFilterRule.java        |    96 -
 .../rel/rules/JoinProjectTransposeRule.java     |   396 -
 .../rel/rules/JoinPushExpressionsRule.java      |    73 -
 .../rel/rules/JoinPushThroughJoinRule.java      |   330 -
 .../rules/JoinPushTransitivePredicatesRule.java |    97 -
 .../calcite/rel/rules/JoinToCorrelateRule.java  |   135 -
 .../calcite/rel/rules/JoinToMultiJoinRule.java  |   559 -
 .../rel/rules/JoinUnionTransposeRule.java       |   114 -
 .../apache/calcite/rel/rules/LoptJoinTree.java  |   217 -
 .../apache/calcite/rel/rules/LoptMultiJoin.java |   873 -
 .../calcite/rel/rules/LoptOptimizeJoinRule.java |  2057 --
 .../rel/rules/LoptSemiJoinOptimizer.java        |   847 -
 .../rules/MaterializedViewFilterScanRule.java   |   102 -
 .../rel/rules/MaterializedViewJoinRule.java     |   373 -
 .../org/apache/calcite/rel/rules/MultiJoin.java |   279 -
 .../rel/rules/MultiJoinOptimizeBushyRule.java   |   389 -
 .../rules/MultiJoinProjectTransposeRule.java    |   136 -
 .../calcite/rel/rules/ProjectCalcMergeRule.java |   107 -
 .../rel/rules/ProjectFilterTransposeRule.java   |   113 -
 .../rel/rules/ProjectJoinTransposeRule.java     |   146 -
 .../calcite/rel/rules/ProjectMergeRule.java     |   127 -
 .../rel/rules/ProjectMultiJoinMergeRule.java    |    79 -
 .../calcite/rel/rules/ProjectRemoveRule.java    |   100 -
 .../rel/rules/ProjectSetOpTransposeRule.java    |   114 -
 .../rel/rules/ProjectSortTransposeRule.java     |    76 -
 .../calcite/rel/rules/ProjectTableScanRule.java |   126 -
 .../calcite/rel/rules/ProjectToCalcRule.java    |    68 -
 .../calcite/rel/rules/ProjectToWindowRule.java  |   362 -
 .../rel/rules/ProjectWindowTransposeRule.java   |   238 -
 .../calcite/rel/rules/PruneEmptyRules.java      |   358 -
 .../apache/calcite/rel/rules/PushProjector.java |   805 -
 .../calcite/rel/rules/ReduceDecimalsRule.java   |  1322 --
 .../rel/rules/ReduceExpressionsRule.java        |   989 -
 .../rel/rules/SemiJoinFilterTransposeRule.java  |    76 -
 .../rel/rules/SemiJoinJoinTransposeRule.java    |   220 -
 .../rel/rules/SemiJoinProjectTransposeRule.java |   188 -
 .../calcite/rel/rules/SemiJoinRemoveRule.java   |    52 -
 .../apache/calcite/rel/rules/SemiJoinRule.java  |   196 -
 .../rel/rules/SortJoinTransposeRule.java        |   157 -
 .../rel/rules/SortProjectTransposeRule.java     |   141 -
 .../calcite/rel/rules/SortRemoveRule.java       |    63 -
 .../rel/rules/SortUnionTransposeRule.java       |   122 -
 .../calcite/rel/rules/SubQueryRemoveRule.java   |   368 -
 .../apache/calcite/rel/rules/TableScanRule.java |    53 -
 .../calcite/rel/rules/UnionEliminatorRule.java  |    60 -
 .../calcite/rel/rules/UnionMergeRule.java       |   140 -
 .../rel/rules/UnionPullUpConstantsRule.java     |   143 -
 .../calcite/rel/rules/UnionToDistinctRule.java  |    70 -
 .../calcite/rel/rules/ValuesReduceRule.java     |   259 -
 .../apache/calcite/rel/rules/package-info.java  |    55 -
 .../java/org/apache/calcite/rel/stream/Chi.java |    38 -
 .../org/apache/calcite/rel/stream/Delta.java    |    49 -
 .../apache/calcite/rel/stream/LogicalChi.java   |    33 -
 .../apache/calcite/rel/stream/LogicalDelta.java |    61 -
 .../apache/calcite/rel/stream/StreamRules.java  |   278 -
 .../apache/calcite/rel/stream/package-info.java |    35 -
 .../calcite/rel/type/DynamicRecordType.java     |    42 -
 .../calcite/rel/type/DynamicRecordTypeImpl.java |    89 -
 .../apache/calcite/rel/type/RelCrossType.java   |    80 -
 .../apache/calcite/rel/type/RelDataType.java    |   246 -
 .../rel/type/RelDataTypeComparability.java      |    39 -
 .../calcite/rel/type/RelDataTypeFactory.java    |   459 -
 .../rel/type/RelDataTypeFactoryImpl.java        |   684 -
 .../calcite/rel/type/RelDataTypeFamily.java     |    26 -
 .../calcite/rel/type/RelDataTypeField.java      |    83 -
 .../calcite/rel/type/RelDataTypeFieldImpl.java  |   111 -
 .../calcite/rel/type/RelDataTypeHolder.java     |    83 -
 .../calcite/rel/type/RelDataTypeImpl.java       |   398 -
 .../rel/type/RelDataTypePrecedenceList.java     |    51 -
 .../calcite/rel/type/RelDataTypeSystem.java     |    82 -
 .../calcite/rel/type/RelDataTypeSystemImpl.java |   221 -
 .../calcite/rel/type/RelProtoDataType.java      |    31 -
 .../apache/calcite/rel/type/RelRecordType.java  |   132 -
 .../org/apache/calcite/rel/type/StructKind.java |    83 -
 .../apache/calcite/rel/type/package-info.java   |    26 -
 .../org/apache/calcite/rex/LogicVisitor.java    |   171 -
 .../java/org/apache/calcite/rex/RexAction.java  |    29 -
 .../org/apache/calcite/rex/RexBiVisitor.java    |    54 -
 .../java/org/apache/calcite/rex/RexBuilder.java |  1482 --
 .../java/org/apache/calcite/rex/RexCall.java    |   173 -
 .../org/apache/calcite/rex/RexCallBinding.java  |   159 -
 .../java/org/apache/calcite/rex/RexChecker.java |   188 -
 .../java/org/apache/calcite/rex/RexCopier.java  |   100 -
 .../apache/calcite/rex/RexCorrelVariable.java   |    59 -
 .../org/apache/calcite/rex/RexDynamicParam.java |    64 -
 .../org/apache/calcite/rex/RexExecutable.java   |   110 -
 .../org/apache/calcite/rex/RexExecutor.java     |    37 -
 .../org/apache/calcite/rex/RexExecutorImpl.java |   166 -
 .../org/apache/calcite/rex/RexFieldAccess.java  |    96 -
 .../apache/calcite/rex/RexFieldCollation.java   |    70 -
 .../org/apache/calcite/rex/RexInputRef.java     |   128 -
 .../java/org/apache/calcite/rex/RexLiteral.java |   701 -
 .../org/apache/calcite/rex/RexLocalRef.java     |    87 -
 .../org/apache/calcite/rex/RexMultisetUtil.java |   202 -
 .../java/org/apache/calcite/rex/RexNode.java    |   101 -
 .../java/org/apache/calcite/rex/RexOver.java    |   161 -
 .../java/org/apache/calcite/rex/RexPattern.java |    35 -
 .../apache/calcite/rex/RexPatternFieldRef.java  |    59 -
 .../calcite/rex/RexPermutationShuttle.java      |    49 -
 .../calcite/rex/RexPermuteInputsShuttle.java    |   114 -
 .../java/org/apache/calcite/rex/RexProgram.java |   945 -
 .../apache/calcite/rex/RexProgramBuilder.java   |  1060 -
 .../org/apache/calcite/rex/RexRangeRef.java     |    79 -
 .../java/org/apache/calcite/rex/RexShuttle.java |   283 -
 .../org/apache/calcite/rex/RexSimplify.java     |   805 -
 .../java/org/apache/calcite/rex/RexSlot.java    |   106 -
 .../apache/calcite/rex/RexSqlConvertlet.java    |    39 -
 .../calcite/rex/RexSqlConvertletTable.java      |    31 -
 .../rex/RexSqlReflectiveConvertletTable.java    |    86 -
 .../rex/RexSqlStandardConvertletTable.java      |   272 -
 .../org/apache/calcite/rex/RexSubQuery.java     |   115 -
 .../calcite/rex/RexToSqlNodeConverter.java      |    63 -
 .../calcite/rex/RexToSqlNodeConverterImpl.java  |   124 -
 .../org/apache/calcite/rex/RexTransformer.java  |   230 -
 .../java/org/apache/calcite/rex/RexUtil.java    |  2421 ---
 .../org/apache/calcite/rex/RexVariable.java     |    56 -
 .../java/org/apache/calcite/rex/RexVisitor.java |    54 -
 .../org/apache/calcite/rex/RexVisitorImpl.java  |   162 -
 .../java/org/apache/calcite/rex/RexWindow.java  |   154 -
 .../org/apache/calcite/rex/RexWindowBound.java  |   258 -
 .../org/apache/calcite/rex/package-info.java    |    87 -
 .../calcite/runtime/AbstractImmutableList.java  |   107 -
 .../apache/calcite/runtime/ArrayBindable.java   |    30 -
 .../apache/calcite/runtime/ArrayComparator.java |    62 -
 .../calcite/runtime/ArrayEnumeratorCursor.java  |    41 -
 .../apache/calcite/runtime/BinarySearch.java    |   275 -
 .../org/apache/calcite/runtime/Bindable.java    |    39 -
 .../runtime/CalciteContextException.java        |   184 -
 .../calcite/runtime/CalciteException.java       |    65 -
 .../apache/calcite/runtime/CalciteResource.java |   697 -
 .../org/apache/calcite/runtime/ConsList.java    |   146 -
 .../org/apache/calcite/runtime/Enumerables.java |    75 -
 .../calcite/runtime/EnumeratorCursor.java       |    58 -
 .../org/apache/calcite/runtime/Feature.java     |    31 -
 .../org/apache/calcite/runtime/FlatLists.java   |  1310 --
 .../java/org/apache/calcite/runtime/Hook.java   |   179 -
 .../org/apache/calcite/runtime/HttpUtils.java   |   149 -
 .../java/org/apache/calcite/runtime/Like.java   |   306 -
 .../calcite/runtime/ObjectEnumeratorCursor.java |    56 -
 .../apache/calcite/runtime/PredicateImpl.java   |    43 -
 .../apache/calcite/runtime/RandomFunction.java  |    74 -
 .../calcite/runtime/RecordEnumeratorCursor.java |    50 -
 .../calcite/runtime/ResultSetEnumerable.java    |   270 -
 .../calcite/runtime/SocketFactoryImpl.java      |   165 -
 .../apache/calcite/runtime/SortedMultiMap.java  |    80 -
 .../apache/calcite/runtime/SqlFunctions.java    |  2196 --
 .../runtime/TrustAllSslSocketFactory.java       |   129 -
 .../java/org/apache/calcite/runtime/Typed.java  |    31 -
 .../java/org/apache/calcite/runtime/Unit.java   |    39 -
 .../org/apache/calcite/runtime/Utilities.java   |   222 -
 .../apache/calcite/runtime/package-info.java    |    26 -
 .../calcite/schema/AggregateFunction.java       |    35 -
 .../schema/CustomColumnResolvingTable.java      |    58 -
 .../apache/calcite/schema/ExtensibleTable.java  |    50 -
 .../apache/calcite/schema/FilterableTable.java  |    44 -
 .../org/apache/calcite/schema/Function.java     |    44 -
 .../calcite/schema/FunctionParameter.java       |    75 -
 .../schema/ImplementableAggFunction.java        |    39 -
 .../calcite/schema/ImplementableFunction.java   |    35 -
 .../java/org/apache/calcite/schema/Member.java  |    85 -
 .../apache/calcite/schema/ModifiableTable.java  |    54 -
 .../apache/calcite/schema/ModifiableView.java   |    69 -
 .../java/org/apache/calcite/schema/Path.java    |    45 -
 .../schema/ProjectableFilterableTable.java      |    63 -
 .../apache/calcite/schema/QueryableTable.java   |    47 -
 .../apache/calcite/schema/ScalarFunction.java   |    35 -
 .../apache/calcite/schema/ScannableTable.java   |    32 -
 .../java/org/apache/calcite/schema/Schema.java  |   329 -
 .../apache/calcite/schema/SchemaFactory.java    |    77 -
 .../org/apache/calcite/schema/SchemaPlus.java   |    86 -
 .../java/org/apache/calcite/schema/Schemas.java |   621 -
 .../calcite/schema/SemiMutableSchema.java       |    26 -
 .../org/apache/calcite/schema/Statistic.java    |    48 -
 .../org/apache/calcite/schema/Statistics.java   |    89 -
 .../apache/calcite/schema/StreamableTable.java  |    32 -
 .../java/org/apache/calcite/schema/Table.java   |    65 -
 .../org/apache/calcite/schema/TableFactory.java |    92 -
 .../apache/calcite/schema/TableFunction.java    |    57 -
 .../org/apache/calcite/schema/TableMacro.java   |    38 -
 .../calcite/schema/TranslatableTable.java       |    40 -
 .../java/org/apache/calcite/schema/Wrapper.java |    28 -
 .../calcite/schema/impl/AbstractSchema.java     |   155 -
 .../calcite/schema/impl/AbstractTable.java      |    41 -
 .../schema/impl/AbstractTableQueryable.java     |    70 -
 .../schema/impl/AggregateFunctionImpl.java      |   145 -
 .../calcite/schema/impl/DelegatingSchema.java   |    85 -
 .../schema/impl/MaterializedViewTable.java      |   131 -
 .../schema/impl/ModifiableViewTable.java        |   241 -
 .../schema/impl/ReflectiveFunctionBase.java     |   145 -
 .../calcite/schema/impl/ScalarFunctionImpl.java |   120 -
 .../apache/calcite/schema/impl/StarTable.java   |   140 -
 .../calcite/schema/impl/TableFunctionImpl.java  |   166 -
 .../calcite/schema/impl/TableMacroImpl.java     |    96 -
 .../apache/calcite/schema/impl/ViewTable.java   |   135 -
 .../calcite/schema/impl/ViewTableMacro.java     |   108 -
 .../calcite/schema/impl/package-info.java       |    26 -
 .../org/apache/calcite/schema/package-info.java |    30 -
 .../apache/calcite/server/CalciteServer.java    |    44 -
 .../calcite/server/CalciteServerStatement.java  |    44 -
 .../org/apache/calcite/server/package-info.java |    26 -
 .../calcite/sql/ExplicitOperatorBinding.java    |    96 -
 .../apache/calcite/sql/JoinConditionType.java   |    51 -
 .../java/org/apache/calcite/sql/JoinType.java   |    72 -
 .../org/apache/calcite/sql/SemiJoinType.java    |   116 -
 .../calcite/sql/SqlAbstractDateTimeLiteral.java |   152 -
 .../calcite/sql/SqlAbstractStringLiteral.java   |    50 -
 .../org/apache/calcite/sql/SqlAccessEnum.java   |    26 -
 .../org/apache/calcite/sql/SqlAccessType.java   |    74 -
 .../org/apache/calcite/sql/SqlAggFunction.java  |   130 -
 .../java/org/apache/calcite/sql/SqlAlter.java   |    60 -
 .../org/apache/calcite/sql/SqlAsOperator.java   |   143 -
 .../org/apache/calcite/sql/SqlBasicCall.java    |   100 -
 .../apache/calcite/sql/SqlBinaryOperator.java   |   226 -
 .../calcite/sql/SqlBinaryStringLiteral.java     |    78 -
 .../java/org/apache/calcite/sql/SqlCall.java    |   207 -
 .../org/apache/calcite/sql/SqlCallBinding.java  |   303 -
 .../calcite/sql/SqlCharStringLiteral.java       |    91 -
 .../org/apache/calcite/sql/SqlCollation.java    |   304 -
 .../java/org/apache/calcite/sql/SqlCreate.java  |    46 -
 .../org/apache/calcite/sql/SqlDataTypeSpec.java |   380 -
 .../org/apache/calcite/sql/SqlDateLiteral.java  |    80 -
 .../java/org/apache/calcite/sql/SqlDelete.java  |   149 -
 .../apache/calcite/sql/SqlDescribeSchema.java   |    73 -
 .../apache/calcite/sql/SqlDescribeTable.java    |    86 -
 .../java/org/apache/calcite/sql/SqlDialect.java |   686 -
 .../java/org/apache/calcite/sql/SqlDrop.java    |    34 -
 .../org/apache/calcite/sql/SqlDynamicParam.java |    92 -
 .../calcite/sql/SqlExecutableStatement.java     |    31 -
 .../java/org/apache/calcite/sql/SqlExplain.java |   220 -
 .../apache/calcite/sql/SqlExplainFormat.java    |    43 -
 .../org/apache/calcite/sql/SqlExplainLevel.java |    59 -
 .../apache/calcite/sql/SqlFilterOperator.java   |   122 -
 .../org/apache/calcite/sql/SqlFunction.java     |   306 -
 .../apache/calcite/sql/SqlFunctionCategory.java |    91 -
 .../calcite/sql/SqlFunctionalOperator.java      |    59 -
 .../org/apache/calcite/sql/SqlIdentifier.java   |   393 -
 .../apache/calcite/sql/SqlInfixOperator.java    |    81 -
 .../java/org/apache/calcite/sql/SqlInsert.java  |   152 -
 .../apache/calcite/sql/SqlInsertKeyword.java    |    38 -
 .../apache/calcite/sql/SqlInternalOperator.java |    87 -
 .../apache/calcite/sql/SqlIntervalLiteral.java  |   165 -
 .../calcite/sql/SqlIntervalQualifier.java       |  1221 --
 .../apache/calcite/sql/SqlJdbcDataTypeName.java |   102 -
 .../apache/calcite/sql/SqlJdbcFunctionCall.java |   782 -
 .../java/org/apache/calcite/sql/SqlJoin.java    |   258 -
 .../java/org/apache/calcite/sql/SqlKind.java    |  1160 --
 .../apache/calcite/sql/SqlLateralOperator.java  |    48 -
 .../java/org/apache/calcite/sql/SqlLiteral.java |   910 -
 .../apache/calcite/sql/SqlMatchRecognize.java   |   223 -
 .../java/org/apache/calcite/sql/SqlMerge.java   |   226 -
 .../java/org/apache/calcite/sql/SqlNode.java    |   308 -
 .../org/apache/calcite/sql/SqlNodeList.java     |   207 -
 .../apache/calcite/sql/SqlNullSemantics.java    |    47 -
 .../apache/calcite/sql/SqlNumericLiteral.java   |   124 -
 .../calcite/sql/SqlOperandCountRange.java       |    41 -
 .../org/apache/calcite/sql/SqlOperator.java     |   941 -
 .../apache/calcite/sql/SqlOperatorBinding.java  |   245 -
 .../apache/calcite/sql/SqlOperatorTable.java    |    53 -
 .../java/org/apache/calcite/sql/SqlOrderBy.java |   123 -
 .../org/apache/calcite/sql/SqlOverOperator.java |   143 -
 .../apache/calcite/sql/SqlPostfixOperator.java  |    99 -
 .../apache/calcite/sql/SqlPrefixOperator.java   |   108 -
 .../calcite/sql/SqlProcedureCallOperator.java   |    63 -
 .../org/apache/calcite/sql/SqlRankFunction.java |    42 -
 .../org/apache/calcite/sql/SqlSampleSpec.java   |   171 -
 .../java/org/apache/calcite/sql/SqlSelect.java  |   251 -
 .../apache/calcite/sql/SqlSelectKeyword.java    |    38 -
 .../apache/calcite/sql/SqlSelectOperator.java   |   251 -
 .../org/apache/calcite/sql/SqlSetOperator.java  |    94 -
 .../org/apache/calcite/sql/SqlSetOption.java    |   179 -
 .../apache/calcite/sql/SqlSpecialOperator.java  |   125 -
 .../calcite/sql/SqlSplittableAggFunction.java   |   267 -
 .../org/apache/calcite/sql/SqlStateCodes.java   |    62 -
 .../java/org/apache/calcite/sql/SqlSyntax.java  |   160 -
 .../org/apache/calcite/sql/SqlTimeLiteral.java  |    89 -
 .../apache/calcite/sql/SqlTimestampLiteral.java |   106 -
 .../apache/calcite/sql/SqlUnnestOperator.java   |   105 -
 .../calcite/sql/SqlUnresolvedFunction.java      |    73 -
 .../java/org/apache/calcite/sql/SqlUpdate.java  |   194 -
 .../java/org/apache/calcite/sql/SqlUtil.java    |  1011 -
 .../apache/calcite/sql/SqlValuesOperator.java   |    46 -
 .../java/org/apache/calcite/sql/SqlWindow.java  |   911 -
 .../java/org/apache/calcite/sql/SqlWith.java    |   124 -
 .../org/apache/calcite/sql/SqlWithItem.java     |   109 -
 .../java/org/apache/calcite/sql/SqlWriter.java  |   501 -
 .../apache/calcite/sql/advise/SqlAdvisor.java   |   579 -
 .../sql/advise/SqlAdvisorGetHintsFunction.java  |   122 -
 .../calcite/sql/advise/SqlAdvisorHint.java      |    51 -
 .../calcite/sql/advise/SqlAdvisorValidator.java |   201 -
 .../calcite/sql/advise/SqlSimpleParser.java     |   791 -
 .../apache/calcite/sql/advise/package-info.java |    32 -
 .../calcite/sql/fun/OracleSqlOperatorTable.java |   129 -
 .../sql/fun/SqlAbstractGroupFunction.java       |    93 -
 .../sql/fun/SqlAbstractTimeFunction.java        |    92 -
 .../sql/fun/SqlArgumentAssignmentOperator.java  |    52 -
 .../sql/fun/SqlArrayQueryConstructor.java       |    33 -
 .../sql/fun/SqlArrayValueConstructor.java       |    46 -
 .../calcite/sql/fun/SqlAvgAggFunction.java      |    87 -
 .../calcite/sql/fun/SqlBaseContextVariable.java |    59 -
 .../calcite/sql/fun/SqlBetweenOperator.java     |   274 -
 .../org/apache/calcite/sql/fun/SqlCase.java     |   144 -
 .../apache/calcite/sql/fun/SqlCaseOperator.java |   317 -
 .../apache/calcite/sql/fun/SqlCastFunction.java |   196 -
 .../calcite/sql/fun/SqlCoalesceFunction.java    |    87 -
 .../sql/fun/SqlCollectionTableOperator.java     |    51 -
 .../sql/fun/SqlColumnListConstructor.java       |    61 -
 .../calcite/sql/fun/SqlConvertFunction.java     |    66 -
 .../calcite/sql/fun/SqlCountAggFunction.java    |   101 -
 .../calcite/sql/fun/SqlCovarAggFunction.java    |    87 -
 .../calcite/sql/fun/SqlCurrentDateFunction.java |    60 -
 .../calcite/sql/fun/SqlCursorConstructor.java   |    76 -
 .../calcite/sql/fun/SqlDatePartFunction.java    |    81 -
 .../sql/fun/SqlDatetimeSubtractionOperator.java |    80 -
 .../calcite/sql/fun/SqlDefaultOperator.java     |    48 -
 .../calcite/sql/fun/SqlExtendOperator.java      |    63 -
 .../calcite/sql/fun/SqlExtractFunction.java     |    77 -
 .../sql/fun/SqlFirstLastValueAggFunction.java   |    77 -
 .../calcite/sql/fun/SqlFloorFunction.java       |    70 -
 .../calcite/sql/fun/SqlGroupFunction.java       |    89 -
 .../calcite/sql/fun/SqlGroupIdFunction.java     |    39 -
 .../calcite/sql/fun/SqlGroupingFunction.java    |    39 -
 .../calcite/sql/fun/SqlGroupingIdFunction.java  |    44 -
 .../sql/fun/SqlHistogramAggFunction.java        |    78 -
 .../apache/calcite/sql/fun/SqlInOperator.java   |   193 -
 .../apache/calcite/sql/fun/SqlItemOperator.java |   134 -
 .../calcite/sql/fun/SqlLeadLagAggFunction.java  |   101 -
 .../apache/calcite/sql/fun/SqlLikeOperator.java |   192 -
 .../sql/fun/SqlLiteralChainOperator.java        |   211 -
 .../calcite/sql/fun/SqlMapQueryConstructor.java |    35 -
 .../calcite/sql/fun/SqlMapValueConstructor.java |    92 -
 .../calcite/sql/fun/SqlMinMaxAggFunction.java   |   141 -
 .../sql/fun/SqlMonotonicBinaryOperator.java     |   166 -
 .../sql/fun/SqlMonotonicUnaryFunction.java      |    58 -
 .../sql/fun/SqlMultisetMemberOfOperator.java    |    91 -
 .../sql/fun/SqlMultisetQueryConstructor.java    |   137 -
 .../calcite/sql/fun/SqlMultisetSetOperator.java |    55 -
 .../sql/fun/SqlMultisetValueConstructor.java    |   123 -
 .../apache/calcite/sql/fun/SqlNewOperator.java  |    54 -
 .../calcite/sql/fun/SqlNtileAggFunction.java    |    45 -
 .../calcite/sql/fun/SqlNullifFunction.java      |    76 -
 .../calcite/sql/fun/SqlOverlapsOperator.java    |   179 -
 .../calcite/sql/fun/SqlOverlayFunction.java     |    83 -
 .../calcite/sql/fun/SqlPositionFunction.java    |   102 -
 .../apache/calcite/sql/fun/SqlRandFunction.java |    59 -
 .../calcite/sql/fun/SqlRandIntegerFunction.java |    59 -
 .../calcite/sql/fun/SqlRollupOperator.java      |    65 -
 .../apache/calcite/sql/fun/SqlRowOperator.java  |    94 -
 .../sql/fun/SqlSequenceValueOperator.java       |    69 -
 .../sql/fun/SqlSingleValueAggFunction.java      |    76 -
 .../calcite/sql/fun/SqlStdOperatorTable.java    |  2065 --
 .../sql/fun/SqlStringContextVariable.java       |    34 -
 .../calcite/sql/fun/SqlSubstringFunction.java   |   208 -
 .../calcite/sql/fun/SqlSumAggFunction.java      |    86 -
 .../sql/fun/SqlSumEmptyIsZeroAggFunction.java   |    77 -
 .../calcite/sql/fun/SqlThrowOperator.java       |    67 -
 .../sql/fun/SqlTimestampAddFunction.java        |    89 -
 .../sql/fun/SqlTimestampDiffFunction.java       |    64 -
 .../calcite/sql/fun/SqlTranslate3Function.java  |    72 -
 .../apache/calcite/sql/fun/SqlTrimFunction.java |   174 -
 .../apache/calcite/sql/fun/package-info.java    |    35 -
 .../org/apache/calcite/sql/package-info.java    |   100 -
 .../sql/parser/SqlAbstractParserImpl.java       |   701 -
 .../calcite/sql/parser/SqlParseException.java   |   175 -
 .../apache/calcite/sql/parser/SqlParser.java    |   361 -
 .../sql/parser/SqlParserImplFactory.java        |    39 -
 .../apache/calcite/sql/parser/SqlParserPos.java |   262 -
 .../calcite/sql/parser/SqlParserUtil.java       |   880 -
 .../calcite/sql/parser/impl/package-info.java   |    27 -
 .../apache/calcite/sql/parser/package-info.java |    26 -
 .../calcite/sql/pretty/SqlFormatOptions.java    |   177 -
 .../calcite/sql/pretty/SqlPrettyWriter.java     |  1188 --
 .../apache/calcite/sql/pretty/package-info.java |    26 -
 .../calcite/sql/type/AbstractSqlType.java       |    85 -
 .../apache/calcite/sql/type/ArraySqlType.java   |    67 -
 .../sql/type/AssignableOperandTypeChecker.java  |   115 -
 .../apache/calcite/sql/type/BasicSqlType.java   |   300 -
 .../sql/type/ComparableOperandTypeChecker.java  |   117 -
 .../sql/type/CompositeOperandTypeChecker.java   |   321 -
 .../type/CompositeSingleOperandTypeChecker.java |   119 -
 .../sql/type/CursorReturnTypeInference.java     |    47 -
 .../sql/type/ExplicitOperandTypeInference.java  |    57 -
 .../sql/type/ExplicitReturnTypeInference.java   |    59 -
 .../apache/calcite/sql/type/ExtraSqlTypes.java  |    47 -
 .../sql/type/FamilyOperandTypeChecker.java      |   138 -
 .../org/apache/calcite/sql/type/InferTypes.java |   135 -
 .../calcite/sql/type/IntervalSqlType.java       |   145 -
 .../sql/type/JavaToSqlTypeConversionRules.java  |   104 -
 .../sql/type/LiteralOperandTypeChecker.java     |   104 -
 .../org/apache/calcite/sql/type/MapSqlType.java |    78 -
 .../sql/type/MatchReturnTypeInference.java      |    74 -
 .../sql/type/MultisetOperandTypeChecker.java    |   100 -
 .../calcite/sql/type/MultisetSqlType.java       |    75 -
 .../apache/calcite/sql/type/ObjectSqlType.java  |    95 -
 .../apache/calcite/sql/type/OperandTypes.java   |   626 -
 .../calcite/sql/type/OperandsTypeChecking.java  |    25 -
 .../sql/type/OrdinalReturnTypeInference.java    |    44 -
 .../apache/calcite/sql/type/ReturnTypes.java    |   790 -
 .../sql/type/SameOperandTypeChecker.java        |   160 -
 ...SameOperandTypeExceptLastOperandChecker.java |   106 -
 .../sql/type/SetopOperandTypeChecker.java       |   136 -
 .../calcite/sql/type/SqlOperandCountRanges.java |    69 -
 .../calcite/sql/type/SqlOperandTypeChecker.java |    78 -
 .../sql/type/SqlOperandTypeInference.java       |    41 -
 .../sql/type/SqlReturnTypeInference.java        |    46 -
 .../sql/type/SqlReturnTypeInferenceChain.java   |    65 -
 .../sql/type/SqlSingleOperandTypeChecker.java   |    66 -
 .../sql/type/SqlTypeAssignmentRules.java        |   347 -
 .../sql/type/SqlTypeExplicitPrecedenceList.java |   189 -
 .../calcite/sql/type/SqlTypeFactoryImpl.java    |   560 -
 .../apache/calcite/sql/type/SqlTypeFamily.java  |   177 -
 .../apache/calcite/sql/type/SqlTypeName.java    |   948 -
 .../calcite/sql/type/SqlTypeTransform.java      |    47 -
 .../sql/type/SqlTypeTransformCascade.java       |    67 -
 .../calcite/sql/type/SqlTypeTransforms.java     |   202 -
 .../apache/calcite/sql/type/SqlTypeUtil.java    |  1313 --
 .../type/TableFunctionReturnTypeInference.java  |   209 -
 .../apache/calcite/sql/type/package-info.java   |    26 -
 .../sql/util/ChainedSqlOperatorTable.java       |    85 -
 .../calcite/sql/util/ListSqlOperatorTable.java  |    88 -
 .../sql/util/ReflectiveSqlOperatorTable.java    |   165 -
 .../calcite/sql/util/SqlBasicVisitor.java       |   124 -
 .../org/apache/calcite/sql/util/SqlBuilder.java |   274 -
 .../org/apache/calcite/sql/util/SqlShuttle.java |   144 -
 .../org/apache/calcite/sql/util/SqlString.java  |    85 -
 .../org/apache/calcite/sql/util/SqlVisitor.java |   103 -
 .../apache/calcite/sql/util/package-info.java   |    26 -
 .../calcite/sql/validate/AbstractNamespace.java |   223 -
 .../apache/calcite/sql/validate/AggChecker.java |   231 -
 .../apache/calcite/sql/validate/AggFinder.java  |   152 -
 .../calcite/sql/validate/AggregatingScope.java  |    53 -
 .../sql/validate/AggregatingSelectScope.java    |   287 -
 .../calcite/sql/validate/AliasNamespace.java    |   133 -
 .../calcite/sql/validate/CatalogScope.java      |    78 -
 .../calcite/sql/validate/CollectNamespace.java  |    80 -
 .../calcite/sql/validate/CollectScope.java      |    53 -
 .../sql/validate/DelegatingNamespace.java       |   122 -
 .../calcite/sql/validate/DelegatingScope.java   |   568 -
 .../DelegatingSqlValidatorCatalogReader.java    |    64 -
 .../validate/DelegatingSqlValidatorTable.java   |    57 -
 .../apache/calcite/sql/validate/EmptyScope.java |   239 -
 .../calcite/sql/validate/FieldNamespace.java    |    74 -
 .../sql/validate/IdentifierNamespace.java       |   265 -
 .../calcite/sql/validate/JoinNamespace.java     |    67 -
 .../apache/calcite/sql/validate/JoinScope.java  |    97 -
 .../apache/calcite/sql/validate/ListScope.java  |   231 -
 .../sql/validate/MatchRecognizeNamespace.java   |    47 -
 .../sql/validate/MatchRecognizeScope.java       |   100 -
 .../calcite/sql/validate/OrderByScope.java      |   129 -
 .../apache/calcite/sql/validate/OverScope.java  |    91 -
 .../sql/validate/ParameterNamespace.java        |    54 -
 .../calcite/sql/validate/ParameterScope.java    |    61 -
 .../sql/validate/ProcedureNamespace.java        |    79 -
 .../calcite/sql/validate/SchemaNamespace.java   |    60 -
 .../apache/calcite/sql/validate/ScopeChild.java |    63 -
 .../calcite/sql/validate/SelectNamespace.java   |    78 -
 .../calcite/sql/validate/SelectScope.java       |   228 -
 .../calcite/sql/validate/SetopNamespace.java    |   114 -
 .../sql/validate/SqlAbstractConformance.java    |    60 -
 .../calcite/sql/validate/SqlConformance.java    |   183 -
 .../sql/validate/SqlConformanceEnum.java        |   149 -
 .../sql/validate/SqlDelegatingConformance.java  |    61 -
 .../sql/validate/SqlIdentifierMoniker.java      |    66 -
 .../calcite/sql/validate/SqlModality.java       |    25 -
 .../apache/calcite/sql/validate/SqlMoniker.java |    65 -
 .../calcite/sql/validate/SqlMonikerImpl.java    |    89 -
 .../calcite/sql/validate/SqlMonikerType.java    |    28 -
 .../calcite/sql/validate/SqlMonotonicity.java   |   112 -
 .../calcite/sql/validate/SqlNameMatcher.java    |    62 -
 .../calcite/sql/validate/SqlNameMatchers.java   |   154 -
 .../calcite/sql/validate/SqlQualified.java      |    96 -
 .../calcite/sql/validate/SqlScopedShuttle.java  |    71 -
 .../sql/validate/SqlUserDefinedAggFunction.java |    73 -
 .../sql/validate/SqlUserDefinedFunction.java    |    82 -
 .../validate/SqlUserDefinedTableFunction.java   |    93 -
 .../sql/validate/SqlUserDefinedTableMacro.java  |   195 -
 .../calcite/sql/validate/SqlValidator.java      |   767 -
 .../sql/validate/SqlValidatorCatalogReader.java |   113 -
 .../sql/validate/SqlValidatorException.java     |    63 -
 .../calcite/sql/validate/SqlValidatorImpl.java  |  5493 -----
 .../sql/validate/SqlValidatorNamespace.java     |   207 -
 .../calcite/sql/validate/SqlValidatorScope.java |   334 -
 .../calcite/sql/validate/SqlValidatorTable.java |    62 -
 .../calcite/sql/validate/SqlValidatorUtil.java  |  1077 -
 .../sql/validate/SqlValidatorWithHints.java     |    68 -
 .../sql/validate/TableConstructorNamespace.java |    86 -
 .../calcite/sql/validate/TableNamespace.java    |   175 -
 .../apache/calcite/sql/validate/TableScope.java |    68 -
 .../calcite/sql/validate/UnnestNamespace.java   |    80 -
 .../calcite/sql/validate/WithItemNamespace.java |    76 -
 .../calcite/sql/validate/WithNamespace.java     |    68 -
 .../apache/calcite/sql/validate/WithScope.java  |    84 -
 .../calcite/sql/validate/package-info.java      |    26 -
 .../sql2rel/CorrelationReferenceFinder.java     |    74 -
 .../sql2rel/DeduplicateCorrelateVariables.java  |    98 -
 .../calcite/sql2rel/InitializerContext.java     |    28 -
 .../sql2rel/InitializerExpressionFactory.java   |    75 -
 .../NullInitializerExpressionFactory.java       |    50 -
 .../sql2rel/ReflectiveConvertletTable.java      |   209 -
 .../apache/calcite/sql2rel/RelDecorrelator.java |  2784 ---
 .../apache/calcite/sql2rel/RelFieldTrimmer.java |  1108 -
 .../sql2rel/RelStructuredTypeFlattener.java     |   880 -
 .../calcite/sql2rel/SqlNodeToRexConverter.java  |    60 -
 .../sql2rel/SqlNodeToRexConverterImpl.java      |   167 -
 .../apache/calcite/sql2rel/SqlRexContext.java   |    98 -
 .../calcite/sql2rel/SqlRexConvertlet.java       |    35 -
 .../calcite/sql2rel/SqlRexConvertletTable.java  |    33 -
 .../calcite/sql2rel/SqlToRelConverter.java      |  5326 -----
 .../sql2rel/StandardConvertletTable.java        |  1539 --
 .../calcite/sql2rel/SubQueryConverter.java      |    53 -
 .../apache/calcite/sql2rel/package-info.java    |    26 -
 .../apache/calcite/tools/FrameworkConfig.java   |   117 -
 .../org/apache/calcite/tools/Frameworks.java    |   350 -
 .../org/apache/calcite/tools/PigRelBuilder.java |   192 -
 .../java/org/apache/calcite/tools/Planner.java  |   119 -
 .../java/org/apache/calcite/tools/Program.java  |    43 -
 .../java/org/apache/calcite/tools/Programs.java |   428 -
 .../org/apache/calcite/tools/RelBuilder.java    |  1823 --
 .../apache/calcite/tools/RelBuilderFactory.java |    41 -
 .../calcite/tools/RelConversionException.java   |    41 -
 .../org/apache/calcite/tools/RelRunner.java     |    35 -
 .../org/apache/calcite/tools/RelRunners.java    |    41 -
 .../java/org/apache/calcite/tools/RuleSet.java  |    28 -
 .../java/org/apache/calcite/tools/RuleSets.java |    68 -
 .../calcite/tools/ValidationException.java      |    40 -
 .../org/apache/calcite/tools/package-info.java  |    26 -
 .../calcite/util/BarfingInvocationHandler.java  |    91 -
 .../org/apache/calcite/util/BasicDatetime.java  |    63 -
 .../java/org/apache/calcite/util/Benchmark.java |   135 -
 .../java/org/apache/calcite/util/BitSets.java   |   360 -
 .../java/org/apache/calcite/util/BitString.java |   208 -
 .../main/java/org/apache/calcite/util/Bug.java  |   216 -
 .../org/apache/calcite/util/BuiltInMethod.java  |   425 -
 .../calcite/util/CalciteParserException.java    |    28 -
 .../calcite/util/CalciteValidatorException.java |    28 -
 .../org/apache/calcite/util/CancelFlag.java     |    66 -
 .../org/apache/calcite/util/CastingList.java    |    72 -
 .../java/org/apache/calcite/util/ChunkList.java |   419 -
 .../apache/calcite/util/ClosableAllocation.java |    32 -
 .../calcite/util/ClosableAllocationOwner.java   |    35 -
 .../java/org/apache/calcite/util/Closer.java    |    50 -
 .../org/apache/calcite/util/Compatible.java     |   135 -
 .../apache/calcite/util/CompatibleGuava11.java  |   480 -
 .../org/apache/calcite/util/CompositeList.java  |   146 -
 .../org/apache/calcite/util/CompositeMap.java   |   150 -
 .../util/CompoundClosableAllocation.java        |    84 -
 .../calcite/util/ControlFlowException.java      |    32 -
 .../org/apache/calcite/util/ConversionUtil.java |   138 -
 .../util/DelegatingInvocationHandler.java       |    93 -
 .../org/apache/calcite/util/Filterator.java     |    88 -
 .../java/org/apache/calcite/util/Glossary.java  |   585 -
 .../java/org/apache/calcite/util/Holder.java    |    55 -
 .../apache/calcite/util/ImmutableBitSet.java    |  1145 --
 .../apache/calcite/util/ImmutableIntList.java   |   336 -
 .../calcite/util/ImmutableNullableList.java     |   277 -
 .../java/org/apache/calcite/util/IntList.java   |    70 -
 .../apache/calcite/util/IntegerIntervalSet.java |   156 -
 .../org/apache/calcite/util/JsonBuilder.java    |   149 -
 .../java/org/apache/calcite/util/Litmus.java    |    82 -
 .../java/org/apache/calcite/util/NameMap.java   |    83 -
 .../org/apache/calcite/util/NameMultimap.java   |   103 -
 .../java/org/apache/calcite/util/NameSet.java   |   106 -
 .../java/org/apache/calcite/util/NlsString.java |   232 -
 .../org/apache/calcite/util/NumberUtil.java     |   178 -
 .../main/java/org/apache/calcite/util/Pair.java |   444 -
 .../calcite/util/PartiallyOrderedSet.java       |   751 -
 .../org/apache/calcite/util/Permutation.java    |   551 -
 .../calcite/util/PrecedenceClimbingParser.java  |   447 -
 .../org/apache/calcite/util/ReflectUtil.java    |   593 -
 .../calcite/util/ReflectiveVisitDispatcher.java |    94 -
 .../apache/calcite/util/ReflectiveVisitor.java  |    30 -
 .../apache/calcite/util/SaffronProperties.java  |   140 -
 .../calcite/util/SerializableCharset.java       |    96 -
 .../java/org/apache/calcite/util/Source.java    |    72 -
 .../java/org/apache/calcite/util/Sources.java   |   197 -
 .../org/apache/calcite/util/StackWriter.java    |   248 -
 .../java/org/apache/calcite/util/Stacks.java    |    71 -
 .../java/org/apache/calcite/util/Static.java    |    50 -
 .../java/org/apache/calcite/util/Template.java  |   281 -
 .../org/apache/calcite/util/TryThreadLocal.java |    71 -
 .../calcite/util/UnmodifiableArrayList.java     |    59 -
 .../java/org/apache/calcite/util/Unsafe.java    |    54 -
 .../main/java/org/apache/calcite/util/Util.java |  2460 ---
 .../java/org/apache/calcite/util/XmlOutput.java |   675 -
 .../org/apache/calcite/util/ZonelessDate.java   |   135 -
 .../apache/calcite/util/ZonelessDatetime.java   |   199 -
 .../org/apache/calcite/util/ZonelessTime.java   |   175 -
 .../apache/calcite/util/ZonelessTimestamp.java  |   160 -
 .../util/graph/BreadthFirstIterator.java        |    88 -
 .../calcite/util/graph/CycleDetector.java       |    39 -
 .../util/graph/DefaultDirectedGraph.java        |   178 -
 .../apache/calcite/util/graph/DefaultEdge.java  |    51 -
 .../calcite/util/graph/DepthFirstIterator.java  |    93 -
 .../calcite/util/graph/DirectedGraph.java       |    70 -
 .../org/apache/calcite/util/graph/Graphs.java   |   182 -
 .../util/graph/TopologicalOrderIterator.java    |   101 -
 .../apache/calcite/util/graph/package-info.java |    26 -
 .../calcite/util/javac/JaninoCompiler.java      |   191 -
 .../apache/calcite/util/javac/JavaCompiler.java |    36 -
 .../calcite/util/javac/JavaCompilerArgs.java    |   162 -
 .../apache/calcite/util/javac/package-info.java |    26 -
 .../util/mapping/AbstractSourceMapping.java     |    99 -
 .../util/mapping/AbstractTargetMapping.java     |    99 -
 .../apache/calcite/util/mapping/IntPair.java    |   115 -
 .../apache/calcite/util/mapping/Mapping.java    |    83 -
 .../calcite/util/mapping/MappingType.java       |   232 -
 .../apache/calcite/util/mapping/Mappings.java   |  1741 --
 .../calcite/util/mapping/package-info.java      |    26 -
 .../org/apache/calcite/util/package-info.java   |    26 -
 .../calcite/util/trace/CalciteLogger.java       |   213 -
 .../calcite/util/trace/CalciteTimingTracer.java |    82 -
 .../apache/calcite/util/trace/CalciteTrace.java |   136 -
 .../apache/calcite/util/trace/package-info.java |    26 -
 core/src/main/protobuf/common.proto             |   275 +
 core/src/main/protobuf/requests.proto           |   168 +
 core/src/main/protobuf/responses.proto          |   135 +
 .../resources/META-INF/services/java.sql.Driver |     2 +-
 .../calcite/runtime/CalciteResource.properties  |   228 -
 .../version/org-apache-calcite-jdbc.properties  |    25 -
 core/src/test/codegen/config.fmpp               |    85 -
 .../codegen/includes/compoundIdentifier.ftl     |    34 -
 core/src/test/codegen/includes/parserImpls.ftl  |    50 -
 .../calcite/adapter/clone/ArrayTableTest.java   |   366 -
 .../calcite/adapter/generate/RangeTable.java    |   126 -
 .../calcite/avatica/AvaticaConnectionTest.java  |    60 +
 .../AvaticaResultSetConversionsTest.java        |  1100 +
 .../calcite/avatica/AvaticaStatementTest.java   |    51 +
 .../avatica/ConnectionConfigImplTest.java       |    50 +
 .../org/apache/calcite/avatica/FrameTest.java   |   211 +
 .../calcite/avatica/MetaResultSetTest.java      |   655 +
 .../apache/calcite/avatica/QueryStateTest.java  |   513 +
 .../avatica/metrics/MetricsHelperTest.java      |    42 +
 .../avatica/remote/AbstractHandlerTest.java     |   169 +
 .../AvaticaCommonsHttpClientImplTest.java       |   115 +
 .../remote/AvaticaHttpClientFactoryTest.java    |    60 +
 .../avatica/remote/AvaticaHttpClientTest.java   |    93 +
 .../avatica/remote/ErrorResponseTest.java       |    68 +
 .../avatica/remote/ExecuteBatchRequestTest.java |    79 +
 .../avatica/remote/KerberosConnectionTest.java  |   145 +
 .../avatica/remote/MetaDataOperationTest.java   |    37 +
 .../avatica/remote/ProtobufHandlerTest.java     |   138 +
 .../remote/ProtobufSerializationTest.java       |   253 +
 .../avatica/remote/ProtobufServiceTest.java     |    58 +
 .../remote/ProtobufTranslationImplTest.java     |   387 +
 .../calcite/avatica/remote/TypedValueTest.java  |   208 +
 .../test/AvaticaClientRuntimeExceptionTest.java |    53 +
 .../avatica/test/AvaticaSeverityTest.java       |    39 +
 .../avatica/test/AvaticaSqlExceptionTest.java   |    52 +
 .../calcite/avatica/test/AvaticaUtilsTest.java  |   340 +
 .../avatica/test/ConnectStringParserTest.java   |   255 +
 .../calcite/avatica/test/JsonHandlerTest.java   |   195 +
 .../calcite/avatica/test/package-info.java      |    26 +
 .../calcite/avatica/util/DateTimeUtilsTest.java |   526 +
 .../avatica/util/NumberAccessorTest.java        |    55 +
 .../avatica/util/UnsynchronizedBufferTest.java  |    41 +
 .../calcite/examples/RelBuilderExample.java     |   171 -
 .../examples/foodmart/java/JdbcExample.java     |   114 -
 .../calcite/jdbc/CalciteRemoteDriverTest.java   |   867 -
 .../calcite/plan/RelOptPlanReaderTest.java      |    92 -
 .../org/apache/calcite/plan/RelOptUtilTest.java |   206 -
 .../org/apache/calcite/plan/RelWriterTest.java  |   190 -
 .../plan/volcano/CollationConversionTest.java   |   271 -
 .../calcite/plan/volcano/ComboRuleTest.java     |   158 -
 .../calcite/plan/volcano/PlannerTests.java      |   207 -
 .../plan/volcano/TraitConversionTest.java       |   282 -
 .../plan/volcano/TraitPropagationTest.java      |   436 -
 .../plan/volcano/VolcanoPlannerTest.java        |   648 -
 .../plan/volcano/VolcanoPlannerTraitTest.java   |   759 -
 .../prepare/LookupOperatorOverloadsTest.java    |   176 -
 .../apache/calcite/rel/RelCollationTest.java    |    74 -
 .../rel/rel2sql/RelToSqlConverterTest.java      |  1028 -
 .../calcite/rel/rules/DateRangeRulesTest.java   |   241 -
 .../org/apache/calcite/rex/RexBuilderTest.java  |    85 -
 .../org/apache/calcite/rex/RexExecutorTest.java |   392 -
 .../calcite/runtime/BinarySearchTest.java       |    80 -
 .../apache/calcite/runtime/EnumerablesTest.java |   273 -
 .../calcite/sql/SqlSetOptionOperatorTest.java   |    76 -
 .../calcite/sql/parser/SqlParserTest.java       |  7690 -------
 .../calcite/sql/parser/SqlUnParserTest.java     |    36 -
 .../ExtensionSqlParserTest.java                 |    54 -
 .../parserextensiontesting/SqlCreateTable.java  |   169 -
 .../SqlUploadJarNode.java                       |    63 -
 .../calcite/sql/test/DefaultSqlTestFactory.java |   109 -
 .../sql/test/DelegatingSqlTestFactory.java      |    66 -
 .../apache/calcite/sql/test/SqlAdvisorTest.java |  1240 --
 .../calcite/sql/test/SqlOperatorBaseTest.java   |  6740 ------
 .../calcite/sql/test/SqlOperatorTest.java       |    38 -
 .../calcite/sql/test/SqlPrettyWriterTest.java   |   354 -
 .../apache/calcite/sql/test/SqlTestFactory.java |    38 -
 .../org/apache/calcite/sql/test/SqlTester.java  |   391 -
 .../apache/calcite/sql/test/SqlTesterImpl.java  |   679 -
 .../org/apache/calcite/sql/test/SqlTests.java   |   401 -
 .../calcite/sql/test/SqlTypeNameTest.java       |   369 -
 .../apache/calcite/sql/test/package-info.java   |    26 -
 .../calcite/sql/type/SqlTypeFactoryTest.java    |   104 -
 .../sql/validate/LexCaseSensitiveTest.java      |   203 -
 .../sql/validate/SqlValidatorUtilTest.java      |   114 -
 .../org/apache/calcite/test/CalciteAssert.java  |  1733 --
 .../calcite/test/CalciteResourceTest.java       |    52 -
 .../calcite/test/CalciteSqlOperatorTest.java    |    31 -
 .../org/apache/calcite/test/CalciteSuite.java   |   180 -
 .../apache/calcite/test/CollectionTypeTest.java |   439 -
 .../org/apache/calcite/test/ConnectionSpec.java |    41 -
 .../org/apache/calcite/test/DiffRepository.java |   782 -
 .../org/apache/calcite/test/DiffTestCase.java   |   523 -
 .../calcite/test/ExceptionMessageTest.java      |   149 -
 .../org/apache/calcite/test/FilteratorTest.java |   105 -
 .../test/FoodMartLatticeStatisticProvider.java  |    92 -
 .../org/apache/calcite/test/FoodmartTest.java   |   245 -
 .../org/apache/calcite/test/HepPlannerTest.java |   174 -
 .../calcite/test/InduceGroupingTypeTest.java    |   147 -
 .../apache/calcite/test/InterpreterTest.java    |   271 -
 .../apache/calcite/test/JdbcAdapterTest.java    |   863 -
 .../test/JdbcFrontJdbcBackLinqMiddleTest.java   |   277 -
 .../calcite/test/JdbcFrontJdbcBackTest.java     |   166 -
 .../calcite/test/JdbcFrontLinqBackTest.java     |   461 -
 .../java/org/apache/calcite/test/JdbcTest.java  |  7093 -------
 .../org/apache/calcite/test/LatticeTest.java    |   746 -
 .../calcite/test/LinqFrontJdbcBackTest.java     |    61 -
 .../java/org/apache/calcite/test/Matchers.java  |    84 -
 .../calcite/test/MaterializationTest.java       |  1220 --
 .../apache/calcite/test/MockCatalogReader.java  |  1578 --
 .../org/apache/calcite/test/MockRelOptCost.java |    91 -
 .../apache/calcite/test/MockRelOptPlanner.java  |   241 -
 .../calcite/test/MockSqlOperatorTable.java      |   107 -
 .../java/org/apache/calcite/test/ModelTest.java |   306 -
 .../calcite/test/MultiJdbcSchemaJoinTest.java   |   237 -
 .../org/apache/calcite/test/MutableRelTest.java |   235 -
 .../apache/calcite/test/PigRelBuilderTest.java  |   158 -
 .../org/apache/calcite/test/QuidemTest.java     |   337 -
 .../calcite/test/ReflectiveSchemaTest.java      |   920 -
 .../org/apache/calcite/test/RelBuilderTest.java |  1720 --
 .../calcite/test/RelMdColumnOriginsTest.java    |    79 -
 .../apache/calcite/test/RelMetadataTest.java    |  1593 --
 .../apache/calcite/test/RelOptRulesTest.java    |  3222 ---
 .../org/apache/calcite/test/RelOptTestBase.java |   304 -
 .../calcite/test/RexImplicationCheckerTest.java |   518 -
 .../org/apache/calcite/test/RexProgramTest.java |  1447 --
 .../apache/calcite/test/RexTransformerTest.java |   417 -
 .../apache/calcite/test/ScannableTableTest.java |   559 -
 .../apache/calcite/test/SqlFunctionsTest.java   |  1028 -
 .../org/apache/calcite/test/SqlLimitsTest.java  |   223 -
 .../org/apache/calcite/test/SqlLineTest.java    |   116 -
 .../calcite/test/SqlOperatorBindingTest.java    |   126 -
 .../org/apache/calcite/test/SqlTestGen.java     |   193 -
 .../test/SqlToRelConverterExtendedTest.java     |    94 -
 .../calcite/test/SqlToRelConverterTest.java     |  2448 ---
 .../apache/calcite/test/SqlToRelTestBase.java   |   797 -
 .../calcite/test/SqlValidatorFeatureTest.java   |   180 -
 .../apache/calcite/test/SqlValidatorTest.java   |  9654 ---------
 .../calcite/test/SqlValidatorTestCase.java      |   586 -
 .../org/apache/calcite/test/StreamTest.java     |   554 -
 .../calcite/test/TableInRootSchemaTest.java     |   185 -
 .../java/org/apache/calcite/test/UdfTest.java   |   741 -
 .../test/concurrent/ConcurrentTestCommand.java  |    94 -
 .../ConcurrentTestCommandExecutor.java          |   305 -
 .../ConcurrentTestCommandGenerator.java         |  1371 --
 .../concurrent/ConcurrentTestCommandScript.java |  2113 --
 .../test/concurrent/ConcurrentTestPlugin.java   |    75 -
 .../concurrent/ConcurrentTestPluginCommand.java |    61 -
 .../ConcurrentTestTimedCommandGenerator.java    |   148 -
 .../calcite/test/concurrent/SamplePlugin.java   |    72 -
 .../calcite/test/concurrent/package-info.java   |   322 -
 .../enumerable/EnumerableCorrelateTest.java     |    73 -
 .../calcite/test/enumerable/package-info.java   |    26 -
 .../org/apache/calcite/test/package-info.java   |    26 -
 .../apache/calcite/tools/FrameworksTest.java    |   251 -
 .../org/apache/calcite/tools/PlannerTest.java   |  1115 -
 .../org/apache/calcite/tools/TpchSchema.java    |    71 -
 .../org/apache/calcite/util/BitSetsTest.java    |   231 -
 .../org/apache/calcite/util/ChunkListTest.java  |   549 -
 .../calcite/util/ImmutableBitSetTest.java       |   532 -
 .../calcite/util/PartiallyOrderedSetTest.java   |   410 -
 .../calcite/util/PermutationTestCase.java       |   157 -
 .../util/PrecedenceClimbingParserTest.java      |   181 -
 .../apache/calcite/util/ReflectVisitorTest.java |   296 -
 .../java/org/apache/calcite/util/Smalls.java    |   875 -
 .../org/apache/calcite/util/SourceTest.java     |    45 -
 .../java/org/apache/calcite/util/TestUtil.java  |   195 -
 .../java/org/apache/calcite/util/UtilTest.java  |  2001 --
 .../calcite/util/graph/DirectedGraphTest.java   |   315 -
 .../calcite/util/mapping/MappingTest.java       |   230 -
 .../hsqldb-foodmart-lattice-model.json          |    59 -
 core/src/test/resources/hsqldb-model.json       |    55 -
 core/src/test/resources/log4j.properties        |    24 -
 .../resources/mysql-foodmart-lattice-model.json |    59 -
 .../test/resources/mysql-foodmart-model.json    |    31 -
 .../calcite/sql/test/SqlPrettyWriterTest.xml    |   249 -
 .../org/apache/calcite/test/HepPlannerTest.xml  |   219 -
 .../org/apache/calcite/test/RelOptRulesTest.xml |  7023 -------
 .../org/apache/calcite/test/SqlLimitsTest.xml   |   153 -
 .../calcite/test/SqlToRelConverterTest.xml      |  4487 ----
 core/src/test/resources/sql/agg.iq              |  1665 --
 core/src/test/resources/sql/blank.iq            |   136 -
 core/src/test/resources/sql/conditions.iq       |   261 -
 core/src/test/resources/sql/dummy.iq            |    23 -
 core/src/test/resources/sql/join.iq             |   290 -
 core/src/test/resources/sql/lateral.iq          |   111 -
 core/src/test/resources/sql/misc.iq             |  1905 --
 core/src/test/resources/sql/operator.iq         |    69 -
 core/src/test/resources/sql/outer.iq            |   367 -
 core/src/test/resources/sql/scalar.iq           |   216 -
 core/src/test/resources/sql/sequence.iq         |    79 -
 core/src/test/resources/sql/sort.iq             |   195 -
 core/src/test/resources/sql/sub-query.iq        |   630 -
 core/src/test/resources/sql/winagg.iq           |   384 -
 druid/pom.xml                                   |   166 -
 .../calcite/adapter/druid/DruidConnection.java  |    25 -
 .../adapter/druid/DruidConnectionImpl.java      |   653 -
 .../adapter/druid/DruidDateTimeUtils.java       |   294 -
 .../calcite/adapter/druid/DruidQuery.java       |  1274 --
 .../adapter/druid/DruidResultEnumerator.java    |    25 -
 .../calcite/adapter/druid/DruidRules.java       |   704 -
 .../calcite/adapter/druid/DruidSchema.java      |    82 -
 .../adapter/druid/DruidSchemaFactory.java       |    71 -
 .../calcite/adapter/druid/DruidTable.java       |   144 -
 .../adapter/druid/DruidTableFactory.java        |   116 -
 .../calcite/adapter/druid/Granularity.java      |    38 -
 .../calcite/adapter/druid/LocalInterval.java    |    98 -
 .../apache/calcite/adapter/druid/QueryType.java |    37 -
 .../calcite/adapter/druid/package-info.java     |    26 -
 .../adapter/druid/DruidQueryFilterTest.java     |   127 -
 .../org/apache/calcite/test/DruidAdapterIT.java |  1509 --
 .../calcite/test/DruidDateRangeRulesTest.java   |   172 -
 .../test/resources/druid-foodmart-model.json    |   142 -
 druid/src/test/resources/druid-wiki-model.json  |    86 -
 .../resources/druid-wiki-no-columns-model.json  |    45 -
 .../resources/druid-wiki-no-tables-model.json   |    33 -
 druid/src/test/resources/foodmart-schema.spec   |    73 -
 druid/src/test/resources/log4j.properties       |    28 -
 elasticsearch/pom.xml                           |   148 -
 .../elasticsearch/ElasticsearchEnumerator.java  |   151 -
 .../elasticsearch/ElasticsearchFilter.java      |   286 -
 .../elasticsearch/ElasticsearchMethod.java      |    50 -
 .../elasticsearch/ElasticsearchProject.java     |    95 -
 .../adapter/elasticsearch/ElasticsearchRel.java |    58 -
 .../elasticsearch/ElasticsearchRules.java       |   236 -
 .../elasticsearch/ElasticsearchSchema.java      |   126 -
 .../ElasticsearchSchemaFactory.java             |    63 -
 .../elasticsearch/ElasticsearchSort.java        |    93 -
 .../elasticsearch/ElasticsearchTable.java       |   150 -
 .../elasticsearch/ElasticsearchTableScan.java   |    88 -
 .../ElasticsearchToEnumerableConverter.java     |   124 -
 .../ElasticsearchToEnumerableConverterRule.java |    42 -
 .../adapter/elasticsearch/package-info.java     |    26 -
 .../calcite/test/ElasticsearchAdapterIT.java    |   270 -
 .../resources/elasticsearch-zips-model.json     |    50 -
 .../src/test/resources/log4j.properties         |    24 -
 example/csv/pom.xml                             |   115 -
 example/csv/sqlline                             |    46 -
 example/csv/sqlline.bat                         |    28 -
 .../calcite/adapter/csv/CsvEnumerator.java      |   386 -
 .../calcite/adapter/csv/CsvFieldType.java       |    77 -
 .../calcite/adapter/csv/CsvFilterableTable.java |    92 -
 .../adapter/csv/CsvProjectTableScanRule.java    |    73 -
 .../calcite/adapter/csv/CsvScannableTable.java  |    58 -
 .../apache/calcite/adapter/csv/CsvSchema.java   |   118 -
 .../calcite/adapter/csv/CsvSchemaFactory.java   |    66 -
 .../calcite/adapter/csv/CsvStreamReader.java    |   156 -
 .../adapter/csv/CsvStreamScannableTable.java    |    80 -
 .../adapter/csv/CsvStreamTableFactory.java      |    59 -
 .../apache/calcite/adapter/csv/CsvTable.java    |    63 -
 .../calcite/adapter/csv/CsvTableFactory.java    |    55 -
 .../calcite/adapter/csv/CsvTableScan.java       |   105 -
 .../adapter/csv/CsvTranslatableTable.java       |    89 -
 .../calcite/adapter/csv/JsonEnumerator.java     |    74 -
 .../apache/calcite/adapter/csv/JsonTable.java   |    62 -
 .../calcite/adapter/csv/package-info.java       |    30 -
 .../java/org/apache/calcite/test/CsvTest.java   |   765 -
 example/csv/src/test/resources/bug.json         |    30 -
 example/csv/src/test/resources/bug/DATE.csv     |     8 -
 .../csv/src/test/resources/bug/LONG_EMPS.csv    |     6 -
 .../test/resources/bug/WACKY_COLUMN_NAMES.csv   |     6 -
 example/csv/src/test/resources/bug/archers.json |    27 -
 .../src/test/resources/filterable-model.json    |    35 -
 .../src/test/resources/model-stream-table.json  |    39 -
 .../test/resources/model-with-custom-table.json |    36 -
 .../csv/src/test/resources/model-with-view.json |    39 -
 example/csv/src/test/resources/model.json       |    32 -
 .../src/test/resources/order-stream-table.json  |    44 -
 example/csv/src/test/resources/sales/DEPTS.csv  |     4 -
 .../csv/src/test/resources/sales/EMPS.csv.gz    |   Bin 262 -> 0 bytes
 example/csv/src/test/resources/sales/SDEPTS.csv |     7 -
 example/csv/src/test/resources/smart.json       |    40 -
 example/function/pom.xml                        |    90 -
 .../org/apache/calcite/example/maze/Maze.java   |   365 -
 .../apache/calcite/example/maze/MazeTable.java  |   116 -
 .../calcite/example/maze/package-info.java      |    26 -
 .../calcite/test/ExampleFunctionTest.java       |   105 -
 example/function/src/test/resources/model.json  |    37 -
 example/pom.xml                                 |    42 -
 file/pom.xml                                    |   112 -
 .../calcite/adapter/file/FileEnumerator.java    |    92 -
 .../calcite/adapter/file/FileFieldType.java     |    86 -
 .../apache/calcite/adapter/file/FileReader.java |   220 -
 .../adapter/file/FileReaderException.java       |    31 -
 .../calcite/adapter/file/FileRowConverter.java  |   401 -
 .../apache/calcite/adapter/file/FileSchema.java |   169 -
 .../calcite/adapter/file/FileSchemaFactory.java |    58 -
 .../apache/calcite/adapter/file/FileTable.java  |   127 -
 .../calcite/adapter/file/FileTableScan.java     |    94 -
 .../calcite/adapter/file/package-info.java      |    27 -
 .../calcite/adapter/file/FileReaderTest.java    |   187 -
 .../apache/calcite/adapter/file/FileSuite.java  |    58 -
 .../apache/calcite/adapter/file/SqlTest.java    |   222 -
 .../calcite/adapter/file/package-info.java      |    27 -
 file/src/test/resources/sales-csv.json          |    32 -
 file/src/test/resources/sales-csv/DEPTS.csv     |     4 -
 file/src/test/resources/sales-csv/EMPS.csv.gz   |   Bin 262 -> 0 bytes
 file/src/test/resources/sales-csv/EMPTY.csv     |     0
 .../test/resources/sales-csv/HEADER_ONLY.csv    |     1 -
 file/src/test/resources/sales-csv/SDEPTS.csv    |     7 -
 file/src/test/resources/sales.json              |    34 -
 file/src/test/resources/sales/DEPTS.html        |    42 -
 file/src/test/resources/sales/EMPS.html         |    56 -
 file/src/test/resources/tableNoTH.html          |    39 -
 file/src/test/resources/tableNoTheadTbody.html  |    44 -
 file/src/test/resources/tableOK.html            |    48 -
 file/src/test/resources/tableX2.html            |    69 -
 file/src/test/resources/testModel.json          |    37 -
 file/src/test/resources/webjoin.sql             |    25 -
 file/src/test/resources/wiki.json               |   128 -
 linq4j/pom.xml                                  |    85 -
 .../calcite/linq4j/AbstractEnumerable.java      |    37 -
 .../calcite/linq4j/AbstractEnumerable2.java     |    35 -
 .../calcite/linq4j/AbstractQueryable.java       |    33 -
 .../apache/calcite/linq4j/BaseQueryable.java    |    67 -
 .../linq4j/CartesianProductEnumerator.java      |    93 -
 .../calcite/linq4j/CorrelateJoinType.java       |    50 -
 .../calcite/linq4j/DefaultEnumerable.java       |   748 -
 .../apache/calcite/linq4j/DefaultQueryable.java |   514 -
 .../calcite/linq4j/DelegatingEnumerator.java    |    48 -
 .../org/apache/calcite/linq4j/Enumerable.java   |    40 -
 .../calcite/linq4j/EnumerableDefaults.java      |  3350 ---
 .../linq4j/EnumerableOrderedQueryable.java      |    64 -
 .../calcite/linq4j/EnumerableQueryable.java     |   554 -
 .../org/apache/calcite/linq4j/Enumerator.java   |   129 -
 .../calcite/linq4j/ExtendedEnumerable.java      |  1111 -
 .../linq4j/ExtendedOrderedEnumerable.java       |    75 -
 .../linq4j/ExtendedOrderedQueryable.java        |    61 -
 .../calcite/linq4j/ExtendedQueryable.java       |   702 -
 .../org/apache/calcite/linq4j/Extensions.java   |   245 -
 .../org/apache/calcite/linq4j/Grouping.java     |    32 -
 .../org/apache/calcite/linq4j/GroupingImpl.java |    80 -
 .../java/org/apache/calcite/linq4j/Linq4j.java  |   725 -
 .../java/org/apache/calcite/linq4j/Lookup.java  |    44 -
 .../org/apache/calcite/linq4j/LookupImpl.java   |   251 -
 .../java/org/apache/calcite/linq4j/OpType.java  |    26 -
 .../java/org/apache/calcite/linq4j/Ord.java     |   194 -
 .../calcite/linq4j/OrderedEnumerable.java       |    29 -
 .../apache/calcite/linq4j/OrderedQueryable.java |    28 -
 .../apache/calcite/linq4j/PackageMarker.java    |    37 -
 .../apache/calcite/linq4j/QueryProvider.java    |    92 -
 .../calcite/linq4j/QueryProviderImpl.java       |    67 -
 .../org/apache/calcite/linq4j/Queryable.java    |    30 -
 .../calcite/linq4j/QueryableDefaults.java       |  1209 --
 .../apache/calcite/linq4j/QueryableFactory.java |   809 -
 .../calcite/linq4j/QueryableRecorder.java       |  1012 -
 .../apache/calcite/linq4j/RawEnumerable.java    |    39 -
 .../org/apache/calcite/linq4j/RawQueryable.java |    50 -
 .../calcite/linq4j/TransformedEnumerator.java   |    51 -
 .../linq4j/function/BigDecimalFunction1.java    |    29 -
 .../calcite/linq4j/function/Deterministic.java  |    35 -
 .../linq4j/function/DoubleFunction1.java        |    28 -
 .../linq4j/function/EqualityComparer.java       |    30 -
 .../calcite/linq4j/function/FloatFunction1.java |    28 -
 .../calcite/linq4j/function/Function.java       |    27 -
 .../calcite/linq4j/function/Function0.java      |    28 -
 .../calcite/linq4j/function/Function1.java      |    40 -
 .../calcite/linq4j/function/Function2.java      |    30 -
 .../calcite/linq4j/function/Functions.java      |   666 -
 .../linq4j/function/IntegerFunction1.java       |    28 -
 .../calcite/linq4j/function/LongFunction1.java  |    28 -
 .../linq4j/function/NonDeterministic.java       |    36 -
 .../function/NullableBigDecimalFunction1.java   |    31 -
 .../function/NullableDoubleFunction1.java       |    28 -
 .../linq4j/function/NullableFloatFunction1.java |    28 -
 .../function/NullableIntegerFunction1.java      |    28 -
 .../linq4j/function/NullableLongFunction1.java  |    28 -
 .../calcite/linq4j/function/Parameter.java      |    86 -
 .../calcite/linq4j/function/Predicate1.java     |    50 -
 .../calcite/linq4j/function/Predicate2.java     |    51 -
 .../calcite/linq4j/function/package-info.java   |    26 -
 .../org/apache/calcite/linq4j/package-info.java |    24 -
 .../calcite/linq4j/tree/AbstractNode.java       |   103 -
 .../linq4j/tree/ArrayLengthRecordField.java     |    86 -
 .../calcite/linq4j/tree/BinaryExpression.java   |   203 -
 .../calcite/linq4j/tree/BlockBuilder.java       |   586 -
 .../calcite/linq4j/tree/BlockStatement.java     |   121 -
 .../org/apache/calcite/linq4j/tree/Blocks.java  |    81 -
 .../calcite/linq4j/tree/CallSiteBinder.java     |    26 -
 .../apache/calcite/linq4j/tree/CatchBlock.java  |    60 -
 .../calcite/linq4j/tree/ClassDeclaration.java   |   114 -
 .../linq4j/tree/ClassDeclarationFinder.java     |   296 -
 .../linq4j/tree/ConditionalExpression.java      |    87 -
 .../linq4j/tree/ConditionalStatement.java       |   100 -
 .../calcite/linq4j/tree/ConstantExpression.java |   291 -
 .../linq4j/tree/ConstantUntypedNull.java        |    48 -
 .../linq4j/tree/ConstructorDeclaration.java     |   124 -
 .../linq4j/tree/DeclarationStatement.java       |   113 -
 .../calcite/linq4j/tree/DefaultExpression.java  |    37 -
 .../linq4j/tree/DeterministicCodeOptimizer.java |   377 -
 .../calcite/linq4j/tree/DynamicExpression.java  |    37 -
 .../apache/calcite/linq4j/tree/ElementInit.java |    26 -
 .../apache/calcite/linq4j/tree/Evaluator.java   |    65 -
 .../apache/calcite/linq4j/tree/Expression.java  |    55 -
 .../calcite/linq4j/tree/ExpressionType.java     |   615 -
 .../calcite/linq4j/tree/ExpressionVisitor.java  |    31 -
 .../calcite/linq4j/tree/ExpressionWriter.java   |   225 -
 .../apache/calcite/linq4j/tree/Expressions.java |  3271 ---
 .../calcite/linq4j/tree/FieldDeclaration.java   |    93 -
 .../calcite/linq4j/tree/ForStatement.java       |   123 -
 .../calcite/linq4j/tree/FunctionExpression.java |   277 -
 .../calcite/linq4j/tree/GotoExpressionKind.java |    55 -
 .../calcite/linq4j/tree/GotoStatement.java      |   136 -
 .../calcite/linq4j/tree/IndexExpression.java    |    83 -
 .../linq4j/tree/InvocationExpression.java       |    38 -
 .../calcite/linq4j/tree/LabelStatement.java     |    70 -
 .../apache/calcite/linq4j/tree/LabelTarget.java |    53 -
 .../calcite/linq4j/tree/LambdaExpression.java   |    38 -
 .../calcite/linq4j/tree/ListInitExpression.java |    37 -
 .../calcite/linq4j/tree/MemberAssignment.java   |    25 -
 .../calcite/linq4j/tree/MemberBinding.java      |    26 -
 .../calcite/linq4j/tree/MemberDeclaration.java  |    26 -
 .../calcite/linq4j/tree/MemberExpression.java   |   108 -
 .../linq4j/tree/MemberInitExpression.java       |    38 -
 .../calcite/linq4j/tree/MemberListBinding.java  |    26 -
 .../linq4j/tree/MemberMemberBinding.java        |    25 -
 .../linq4j/tree/MethodCallExpression.java       |   151 -
 .../calcite/linq4j/tree/MethodDeclaration.java  |   117 -
 .../calcite/linq4j/tree/NewArrayExpression.java |   112 -
 .../calcite/linq4j/tree/NewExpression.java      |   109 -
 .../org/apache/calcite/linq4j/tree/Node.java    |    30 -
 .../calcite/linq4j/tree/OptimizeShuttle.java    |   422 -
 .../linq4j/tree/ParameterExpression.java        |    81 -
 .../apache/calcite/linq4j/tree/Primitive.java   |  1014 -
 .../apache/calcite/linq4j/tree/PseudoField.java |    37 -
 .../linq4j/tree/ReflectedPseudoField.java       |    75 -
 .../org/apache/calcite/linq4j/tree/Shuttle.java |   335 -
 .../apache/calcite/linq4j/tree/Statement.java   |    40 -
 .../apache/calcite/linq4j/tree/SwitchCase.java  |    25 -
 .../calcite/linq4j/tree/SwitchStatement.java    |    38 -
 .../calcite/linq4j/tree/TernaryExpression.java  |    95 -
 .../calcite/linq4j/tree/ThrowStatement.java     |    72 -
 .../calcite/linq4j/tree/TryStatement.java       |    93 -
 .../linq4j/tree/TypeBinaryExpression.java       |    84 -
 .../org/apache/calcite/linq4j/tree/Types.java   |   670 -
 .../calcite/linq4j/tree/UnaryExpression.java    |    87 -
 .../org/apache/calcite/linq4j/tree/Visitor.java |    60 -
 .../apache/calcite/linq4j/tree/VisitorImpl.java |   206 -
 .../calcite/linq4j/tree/WhileStatement.java     |    80 -
 .../calcite/linq4j/tree/package-info.java       |    33 -
 .../test/java/com/example/Linq4jExample.java    |    88 -
 .../src/test/java/com/example/package-info.java |    26 -
 .../calcite/linq4j/function/FunctionTest.java   |   134 -
 .../calcite/linq4j/function/package-info.java   |    26 -
 .../calcite/linq4j/test/BlockBuilderBase.java   |    86 -
 .../calcite/linq4j/test/BlockBuilderTest.java   |    83 -
 .../calcite/linq4j/test/CorrelateJoinTest.java  |   119 -
 .../calcite/linq4j/test/DeterministicTest.java  |   547 -
 .../calcite/linq4j/test/ExpressionTest.java     |  1253 --
 .../apache/calcite/linq4j/test/InlinerTest.java |   199 -
 .../apache/calcite/linq4j/test/Linq4jSuite.java |    45 -
 .../apache/calcite/linq4j/test/Linq4jTest.java  |  2540 ---
 .../calcite/linq4j/test/OptimizerTest.java      |   761 -
 .../calcite/linq4j/test/PrimitiveTest.java      |   292 -
 .../calcite/linq4j/test/package-info.java       |    26 -
 .../apache/calcite/linq4j/tree/TypeTest.java    |    67 -
 .../calcite/linq4j/tree/package-info.java       |    26 -
 metrics-dropwizardmetrics3/pom.xml              |   117 +
 .../metrics/dropwizard3/DropwizardCounter.java  |    51 +
 .../metrics/dropwizard3/DropwizardGauge.java    |    39 +
 .../dropwizard3/DropwizardHistogram.java        |    43 +
 .../metrics/dropwizard3/DropwizardMeter.java    |    43 +
 .../dropwizard3/DropwizardMetricsSystem.java    |    62 +
 .../DropwizardMetricsSystemConfiguration.java   |    42 +
 .../DropwizardMetricsSystemFactory.java         |    42 +
 .../metrics/dropwizard3/DropwizardTimer.java    |    54 +
 .../metrics/dropwizard3/package-info.java       |    26 +
 ...calcite.avatica.metrics.MetricsSystemFactory |     2 +
 .../dropwizard3/DropwizardCounterTest.java      |    61 +
 .../dropwizard3/DropwizardGaugeTest.java        |    60 +
 .../dropwizard3/DropwizardHistogramTest.java    |    49 +
 .../dropwizard3/DropwizardMeterTest.java        |    50 +
 .../DropwizardMetricsSystemFactoryTest.java     |    54 +
 .../DropwizardMetricsSystemTest.java            |   161 +
 .../dropwizard3/DropwizardTimerTest.java        |    56 +
 metrics/pom.xml                                 |   129 +
 .../apache/calcite/avatica/metrics/Counter.java |    49 +
 .../apache/calcite/avatica/metrics/Gauge.java   |    30 +
 .../calcite/avatica/metrics/Histogram.java      |    40 +
 .../apache/calcite/avatica/metrics/Meter.java   |    38 +
 .../apache/calcite/avatica/metrics/Metric.java  |    26 +
 .../calcite/avatica/metrics/MetricsSystem.java  |    68 +
 .../metrics/MetricsSystemConfiguration.java     |    33 +
 .../avatica/metrics/MetricsSystemFactory.java   |    32 +
 .../avatica/metrics/MetricsSystemLoader.java    |    87 +
 .../calcite/avatica/metrics/PackageMarker.java  |    37 +
 .../apache/calcite/avatica/metrics/Timer.java   |    37 +
 .../avatica/metrics/noop/NoopCounter.java       |    36 +
 .../avatica/metrics/noop/NoopHistogram.java     |    32 +
 .../calcite/avatica/metrics/noop/NoopMeter.java |    32 +
 .../avatica/metrics/noop/NoopMetricsSystem.java |    69 +
 .../noop/NoopMetricsSystemConfiguration.java    |    40 +
 .../metrics/noop/NoopMetricsSystemFactory.java  |    35 +
 .../calcite/avatica/metrics/noop/NoopTimer.java |    43 +
 .../avatica/metrics/noop/package-info.java      |    26 +
 .../calcite/avatica/metrics/package-info.java   |    24 +
 .../metrics/MetricsSystemLoaderTest.java        |   114 +
 .../noop/NoopMetricsSystemFactoryTest.java      |    37 +
 .../metrics/noop/NoopMetricsSystemTest.java     |    73 +
 metrics/src/test/resources/log4j.properties     |    24 +
 mongodb/pom.xml                                 |   145 -
 .../calcite/adapter/mongodb/MongoAggregate.java |   184 -
 .../adapter/mongodb/MongoEnumerator.java        |   148 -
 .../calcite/adapter/mongodb/MongoFilter.java    |   244 -
 .../calcite/adapter/mongodb/MongoMethod.java    |    53 -
 .../calcite/adapter/mongodb/MongoProject.java   |    87 -
 .../calcite/adapter/mongodb/MongoRel.java       |    56 -
 .../calcite/adapter/mongodb/MongoRules.java     |   741 -
 .../calcite/adapter/mongodb/MongoSchema.java    |    60 -
 .../adapter/mongodb/MongoSchemaFactory.java     |    45 -
 .../calcite/adapter/mongodb/MongoSort.java      |   104 -
 .../calcite/adapter/mongodb/MongoTable.java     |   265 -
 .../calcite/adapter/mongodb/MongoTableScan.java |    91 -
 .../mongodb/MongoToEnumerableConverter.java     |   163 -
 .../mongodb/MongoToEnumerableConverterRule.java |    43 -
 .../calcite/adapter/mongodb/package-info.java   |    26 -
 .../org/apache/calcite/test/MongoAdapterIT.java |   842 -
 mongodb/src/test/resources/log4j.properties     |    24 -
 .../test/resources/mongo-foodmart-model.json    |   221 -
 .../src/test/resources/mongo-zips-model.json    |    41 -
 noop-driver/pom.xml                             |   108 +
 .../avatica/noop/AvaticaNoopConnection.java     |   256 +
 .../noop/AvaticaNoopDatabaseMetaData.java       |   770 +
 .../calcite/avatica/noop/AvaticaNoopDriver.java |    74 +
 .../noop/AvaticaNoopParameterMetaData.java      |    85 +
 .../noop/AvaticaNoopPreparedStatement.java      |   345 +
 .../avatica/noop/AvaticaNoopResultSet.java      |   665 +
 .../noop/AvaticaNoopResultSetMetaData.java      |   133 +
 .../avatica/noop/AvaticaNoopStatement.java      |   191 +
 .../calcite/avatica/noop/PackageMarker.java     |    37 +
 .../calcite/avatica/noop/package-info.java      |    24 +
 .../resources/META-INF/services/java.sql.Driver |     1 +
 pig/pom.xml                                     |   173 -
 .../calcite/adapter/pig/PigAggFunction.java     |    51 -
 .../calcite/adapter/pig/PigAggregate.java       |   206 -
 .../apache/calcite/adapter/pig/PigDataType.java |    68 -
 .../apache/calcite/adapter/pig/PigFilter.java   |   142 -
 .../org/apache/calcite/adapter/pig/PigJoin.java |   114 -
 .../apache/calcite/adapter/pig/PigProject.java  |    58 -
 .../org/apache/calcite/adapter/pig/PigRel.java  |    91 -
 .../calcite/adapter/pig/PigRelFactories.java    |   118 -
 .../apache/calcite/adapter/pig/PigRules.java    |   144 -
 .../apache/calcite/adapter/pig/PigSchema.java   |    41 -
 .../calcite/adapter/pig/PigSchemaFactory.java   |    45 -
 .../apache/calcite/adapter/pig/PigTable.java    |    75 -
 .../calcite/adapter/pig/PigTableFactory.java    |    55 -
 .../calcite/adapter/pig/PigTableScan.java       |    92 -
 .../adapter/pig/PigToEnumerableConverter.java   |    84 -
 .../pig/PigToEnumerableConverterRule.java       |    43 -
 .../calcite/adapter/pig/package-info.java       |    27 -
 .../apache/calcite/test/AbstractPigTest.java    |    36 -
 .../org/apache/calcite/test/PigAdapterTest.java |   190 -
 .../calcite/test/PigRelBuilderStyleTest.java    |   284 -
 pig/src/test/resources/data.txt                 |     3 -
 pig/src/test/resources/data2.txt                |     2 -
 pig/src/test/resources/model.json               |    47 -
 piglet/pom.xml                                  |   168 -
 .../java/org/apache/calcite/piglet/Ast.java     |   590 -
 .../java/org/apache/calcite/piglet/Handler.java |   392 -
 .../org/apache/calcite/piglet/package-info.java |    24 -
 piglet/src/main/javacc/PigletParser.jj          |  1215 --
 .../org/apache/calcite/test/CalciteHandler.java |   105 -
 .../java/org/apache/calcite/test/Fluent.java    |   114 -
 .../org/apache/calcite/test/PigletTest.java     |   299 -
 piglet/src/test/resources/log4j.properties      |    24 -
 plus/pom.xml                                    |   132 -
 .../calcite/adapter/tpcds/TpcdsSchema.java      |   185 -
 .../adapter/tpcds/TpcdsSchemaFactory.java       |    48 -
 .../calcite/adapter/tpcds/package-info.java     |    26 -
 .../apache/calcite/adapter/tpch/TpchSchema.java |   165 -
 .../calcite/adapter/tpch/TpchSchemaFactory.java |    48 -
 .../calcite/adapter/tpch/package-info.java      |    26 -
 .../apache/calcite/adapter/tpcds/TpcdsTest.java |   297 -
 .../apache/calcite/adapter/tpch/TpchTest.java   |   956 -
 .../java/org/apache/calcite/test/PlusSuite.java |    36 -
 pom.xml                                         |   418 +-
 server/pom.xml                                  |   223 +
 .../apache/calcite/avatica/jdbc/JdbcMeta.java   |  1101 +
 .../calcite/avatica/jdbc/JdbcResultSet.java     |   215 +
 .../calcite/avatica/jdbc/StatementInfo.java     |   170 +
 .../calcite/avatica/jdbc/package-info.java      |    22 +
 .../avatica/server/AbstractAvaticaHandler.java  |    73 +
 .../calcite/avatica/server/AvaticaHandler.java  |    32 +
 .../avatica/server/AvaticaJsonHandler.java      |   157 +
 .../avatica/server/AvaticaProtobufHandler.java  |   152 +
 .../server/AvaticaServerConfiguration.java      |    97 +
 .../server/DelegatingAvaticaHandler.java        |   116 +
 .../avatica/server/DoAsRemoteUserCallback.java  |    42 +
 .../calcite/avatica/server/HandlerFactory.java  |   146 +
 .../calcite/avatica/server/HttpServer.java      |   826 +
 .../org/apache/calcite/avatica/server/Main.java |   104 +
 .../server/MetricsAwareAvaticaHandler.java      |    43 +
 .../server/PropertyBasedSpnegoLoginService.java |    50 +
 .../calcite/avatica/server/package-info.java    |    26 +
 .../calcite/avatica/AvaticaSpnegoTest.java      |   246 +
 .../apache/calcite/avatica/ConnectionSpec.java  |    55 +
 .../calcite/avatica/RemoteDriverMockTest.java   |   219 +
 .../calcite/avatica/RemoteDriverTest.java       |  2077 ++
 .../apache/calcite/avatica/SpnegoTestUtil.java  |   214 +
 .../apache/calcite/avatica/SslDriverTest.java   |   225 +
 .../calcite/avatica/jdbc/JdbcMetaTest.java      |   123 +
 .../calcite/avatica/jdbc/StatementInfoTest.java |   138 +
 .../remote/AlternatingRemoteMetaTest.java       |   398 +
 .../calcite/avatica/remote/RemoteMetaTest.java  |   774 +
 .../server/AbstractAvaticaHandlerTest.java      |   102 +
 .../avatica/server/BasicAuthHttpServerTest.java |   162 +
 .../server/DigestAuthHttpServerTest.java        |   176 +
 .../avatica/server/HandlerFactoryTest.java      |    58 +
 .../calcite/avatica/server/HttpAuthBase.java    |    80 +
 .../avatica/server/HttpServerBuilderTest.java   |   146 +
 .../server/HttpServerSpnegoWithJaasTest.java    |   229 +
 .../server/HttpServerSpnegoWithoutJaasTest.java |   220 +
 .../calcite/avatica/test/AvaticaSuite.java      |    37 +
 server/src/test/resources/auth-users.properties |    20 +
 server/src/test/resources/log4j.properties      |    28 +
 shaded/core/pom.xml                             |   108 +
 shaded/core/src/main/resources/META-INF/LICENSE |   257 +
 site/Gemfile                                    |     1 -
 site/README.md                                  |    43 +-
 site/_config.yml                                |    30 +-
 site/_data/contributors.yml                     |    21 +-
 site/_data/docs.yml                             |    25 +-
 site/_docs/adapter.md                           |   134 -
 site/_docs/algebra.md                           |   381 -
 site/_docs/api.md                               |     2 +-
 site/_docs/avatica_json_reference.md            |    26 -
 site/_docs/avatica_overview.md                  |    26 -
 site/_docs/avatica_protobuf_reference.md        |    26 -
 site/_docs/avatica_roadmap.md                   |    26 -
 site/_docs/cassandra_adapter.md                 |   112 -
 site/_docs/client_reference.md                  |   174 +
 site/_docs/compatibility.md                     |   105 +
 site/_docs/custom_client_artifacts.md           |   133 +
 site/_docs/druid_adapter.md                     |   275 -
 site/_docs/elasticsearch_adapter.md             |   136 -
 site/_docs/file_adapter.md                      |   280 -
 site/_docs/history.md                           |  3526 +---
 site/_docs/howto.md                             |   463 +-
 site/_docs/index.md                             |   235 +-
 site/_docs/json_reference.md                    |  1191 ++
 site/_docs/lattice.md                           |   136 -
 site/_docs/materialized_views.md                |    70 -
 site/_docs/model.md                             |   517 -
 site/_docs/pig_adapter.md                       |    90 -
 site/_docs/powered_by.md                        |   109 -
 site/_docs/protobuf_reference.md                |  1304 ++
 site/_docs/reference.md                         |  1506 --
 site/_docs/roadmap.md                           |    51 +
 site/_docs/security.md                          |   253 +
 site/_docs/stream.md                            |  1023 -
 site/_docs/testapi.md                           |     2 +-
 site/_docs/tutorial.md                          |   760 -
 site/_includes/docs_contents_mobile.html        |    11 +-
 site/_includes/docs_option.html                 |    20 +-
 site/_includes/docs_ul.html                     |     6 +-
 site/_includes/header.html                      |     2 +-
 site/_includes/news_contents.html               |     2 +-
 site/_includes/news_contents_mobile.html        |     6 +-
 site/_includes/news_item.html                   |    28 +-
 site/_layouts/news_item.html                    |    28 +-
 .../2014-06-27-release-0.8.0-incubating.md      |    31 -
 .../2014-08-19-release-0.9.0-incubating.md      |    30 -
 .../2014-10-02-release-0.9.1-incubating.md      |    29 -
 .../2014-11-05-release-0.9.2-incubating.md      |    32 -
 .../2015-01-31-release-1.0.0-incubating.md      |    42 -
 .../2015-03-13-release-1.1.0-incubating.md      |    41 -
 .../2015-04-07-release-1.2.0-incubating.md      |    41 -
 site/_posts/2015-04-24-new-committers.md        |    34 -
 .../2015-05-30-release-1.3.0-incubating.md      |    33 -
 site/_posts/2015-06-05-algebra-builder.md       |    87 -
 .../2015-07-31-xldb-best-lightning-talk.md      |    41 -
 .../2015-09-02-release-1.4.0-incubating.md      |    39 -
 site/_posts/2015-10-22-calcite-graduates.md     |    63 -
 site/_posts/2015-11-08-new-committers.md        |    31 -
 site/_posts/2015-11-10-release-1.5.0.md         |    33 -
 site/_posts/2016-01-22-release-1.6.0.md         |    59 -
 site/_posts/2016-02-17-elser-pmc.md             |    33 -
 site/_posts/2016-02-17-streaming-sql-talk.md    |    40 -
 site/_posts/2016-03-03-separate-project.md      |    34 +
 site/_posts/2016-03-18-release-1.7.1.md         |    87 +
 site/_posts/2016-03-22-cassandra-adapter.md     |    42 -
 site/_posts/2016-03-22-release-1.7.0.md         |    64 -
 site/_posts/2016-06-04-release-1.8.0.md         |    87 +
 site/_posts/2016-06-13-release-1.8.0.md         |    55 -
 site/_posts/2016-09-22-release-1.9.0.md         |    53 -
 site/_posts/2016-10-12-release-1.10.0.md        |    36 -
 site/_posts/2016-11-01-release-1.9.0.md         |    46 +
 site/_posts/2017-01-09-release-1.11.0.md        |    70 -
 site/_posts/2017-03-24-release-1.12.0.md        |    74 -
 .../_posts/2017-03-31-new-avatica-repository.md |    36 +
 site/_sass/_style.scss                          |    16 +-
 site/community/index.md                         |    80 +-
 site/develop/index.md                           |    13 +-
 site/doap_calcite.rdf                           |    59 -
 site/downloads/index.md                         |    49 +-
 site/favicon.ico                                |   Bin 5683 -> 0 bytes
 site/img/cake.jpg                               |   Bin 58990 -> 0 bytes
 site/img/logo.png                               |   Bin 69304 -> 27763 bytes
 site/img/pb-calcite-140.png                     |   Bin 21702 -> 0 bytes
 site/img/pb-calcite-240.png                     |   Bin 52613 -> 0 bytes
 site/img/pie-chart.png                          |   Bin 13257 -> 0 bytes
 site/img/powered-by.png                         |   Bin 100413 -> 0 bytes
 site/img/window-types.png                       |   Bin 19177 -> 0 bytes
 site/index.html                                 |    55 +-
 spark/pom.xml                                   |   159 -
 .../spark/EnumerableToSparkConverter.java       |    92 -
 .../spark/EnumerableToSparkConverterRule.java   |    46 -
 .../calcite/adapter/spark/HttpServer.java       |   192 -
 .../adapter/spark/JdbcToSparkConverter.java     |   121 -
 .../adapter/spark/JdbcToSparkConverterRule.java |    43 -
 .../calcite/adapter/spark/SparkHandlerImpl.java |   142 -
 .../calcite/adapter/spark/SparkMethod.java      |    65 -
 .../apache/calcite/adapter/spark/SparkRel.java  |    60 -
 .../calcite/adapter/spark/SparkRules.java       |   457 -
 .../calcite/adapter/spark/SparkRuntime.java     |    71 -
 .../spark/SparkToEnumerableConverter.java       |   121 -
 .../calcite/adapter/spark/package-info.java     |    26 -
 .../apache/calcite/test/SparkAdapterTest.java   |    65 -
 splunk/pom.xml                                  |   138 -
 .../calcite/adapter/splunk/SplunkDriver.java    |   127 -
 .../adapter/splunk/SplunkDriverVersion.java     |    40 -
 .../adapter/splunk/SplunkPushDownRule.java      |   445 -
 .../calcite/adapter/splunk/SplunkQuery.java     |    83 -
 .../calcite/adapter/splunk/SplunkSchema.java    |    50 -
 .../calcite/adapter/splunk/SplunkTable.java     |   100 -
 .../calcite/adapter/splunk/SplunkTableScan.java |   171 -
 .../calcite/adapter/splunk/package-info.java    |    30 -
 .../splunk/search/SearchResultListener.java     |    34 -
 .../adapter/splunk/search/SplunkConnection.java |    35 -
 .../splunk/search/SplunkConnectionImpl.java     |   442 -
 .../adapter/splunk/search/package-info.java     |    26 -
 .../adapter/splunk/util/StringUtils.java        |   159 -
 .../adapter/splunk/util/package-info.java       |    26 -
 .../apache/calcite/test/SplunkAdapterTest.java  |   308 -
 splunk/src/test/resources/log4j.properties      |    24 -
 sqlline                                         |    58 -
 sqlline.bat                                     |    28 -
 src/main/config/assemblies/source-assembly.xml  |     9 +-
 src/main/config/checkstyle/checker.xml          |     2 +-
 src/main/config/checkstyle/suppressions.xml     |     2 +-
 src/main/config/forbidden-apis/signatures.txt   |     5 +-
 standalone-server/.gitignore                    |     1 +
 standalone-server/pom.xml                       |   217 +
 .../avatica/standalone/StandaloneServer.java    |   138 +
 .../avatica/standalone/package-info.java        |    26 +
 .../src/main/resources/log4j.properties         |    24 +
 .../src/main/shaded-resources/LICENSE           |   251 +
 tck/README.md                                   |    80 +
 tck/pom.xml                                     |   224 +
 .../calcite/avatica/tck/PackageMarker.java      |    37 +
 .../apache/calcite/avatica/tck/TestRunner.java  |   274 +
 .../org/apache/calcite/avatica/tck/Unsafe.java  |    55 +
 .../calcite/avatica/tck/package-info.java       |    24 +
 .../calcite/avatica/tck/tests/BaseTckTest.java  |    56 +
 .../calcite/avatica/tck/tests/BinaryTest.java   |   105 +
 .../calcite/avatica/tck/tests/InsertTest.java   |   213 +
 .../calcite/avatica/tck/tests/MetadataTest.java |   132 +
 .../calcite/avatica/tck/tests/package-info.java |    26 +
 tck/src/main/resources/META-INF/LICENSE         |   251 +
 tck/src/main/resources/example_config.yml       |    38 +
 tck/src/main/resources/log4j.properties         |    24 +
 tck/src/main/ruby/test_runner.rb                |   125 +
 ubenchmark/pom.xml                              |   143 -
 .../benchmarks/FlightRecorderProfiler.java      |    87 -
 .../calcite/benchmarks/ParserBenchmark.java     |   121 -
 .../calcite/benchmarks/PreconditionTest.java    |    56 -
 .../calcite/benchmarks/StatementTest.java       |   264 -
 .../apache/calcite/benchmarks/package-info.java |    26 -
 2304 files changed, 106774 insertions(+), 520185 deletions(-)
----------------------------------------------------------------------