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

[5/6] calcite git commit: [CALCITE-1355] Upgrade to protobuf-java 3.1.0

[CALCITE-1355] Upgrade to protobuf-java 3.1.0

We are also able to remove the HBaseZeroCopyByteString we copied
from Apache HBase in favor of using protobuf API (UnsafeByteOperations)
which is fantastic. Protobuf classes are rebuilt using 3.1.0 and
the script to generate them was updated.


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

Branch: refs/heads/master
Commit: 221d1804cb52a19a63968c718fe662ae64ea12d2
Parents: 483b9f9
Author: Josh Elser <el...@apache.org>
Authored: Sun Oct 23 15:03:08 2016 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Sun Oct 23 15:03:08 2016 -0400

----------------------------------------------------------------------
 .../protobuf/HBaseZeroCopyByteString.java       |   77 -
 .../java/com/google/protobuf/package-info.java  |   26 -
 .../apache/calcite/avatica/proto/Common.java    | 3365 +++++++++++-----
 .../apache/calcite/avatica/proto/Requests.java  | 3688 +++++++++++++-----
 .../apache/calcite/avatica/proto/Responses.java | 3011 +++++++++-----
 .../avatica/remote/ProtobufTranslationImpl.java |   10 +-
 .../apache/calcite/avatica/remote/Service.java  |    6 +-
 .../calcite/avatica/remote/TypedValue.java      |    6 +-
 .../core/src/main/scripts/generate-protobuf.sh  |    2 +-
 .../remote/ProtobufSerializationTest.java       |    4 +-
 avatica/pom.xml                                 |    2 +-
 11 files changed, 6993 insertions(+), 3204 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/calcite/blob/221d1804/avatica/core/src/main/java/com/google/protobuf/HBaseZeroCopyByteString.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/com/google/protobuf/HBaseZeroCopyByteString.java b/avatica/core/src/main/java/com/google/protobuf/HBaseZeroCopyByteString.java
deleted file mode 100644
index 62c4dd2..0000000
--- a/avatica/core/src/main/java/com/google/protobuf/HBaseZeroCopyByteString.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 com.google.protobuf;
-
-/**
- * Helper class to extract byte arrays from {@link ByteString} without copy.
- *
- * Without this protobufs would force us to copy every single byte array out
- * of the objects de-serialized from the wire (which already do one copy, on
- * top of the copies the JVM does to go from kernel buffer to C buffer and
- * from C buffer to JVM buffer).
- *
- * Graciously copied from Apache HBase.
- */
-public final class HBaseZeroCopyByteString extends LiteralByteString {
-  // Gotten from AsyncHBase code base with permission.
-  /** Private constructor so this class cannot be instantiated. */
-  private HBaseZeroCopyByteString() {
-    super(null);
-    throw new UnsupportedOperationException("Should never be here.");
-  }
-
-  /**
-   * Wraps a byte array in a {@link ByteString} without copying it.
-   *
-   * @param array The byte array to wrap
-   * @return a ByteString wrapping the <code>array</code>
-   */
-  public static ByteString wrap(final byte[] array) {
-    return new LiteralByteString(array);
-  }
-
-  /**
-   * Wraps a subset of a byte array in a {@link ByteString} without copying it.
-   *
-   * @param array The byte array to wrap
-   * @param offset the start of data in the array
-   * @param length The number of bytes of data at <code>offset</code>
-   * @return a ByteString wrapping the <code>array</code>
-   */
-  public static ByteString wrap(final byte[] array, int offset, int length) {
-    return new BoundedByteString(array, offset, length);
-  }
-
-
-  /**
-   * Extracts the byte array from the given {@link ByteString} without copy.
-   * @param buf A buffer from which to extract the array.  This buffer must be
-   * actually an instance of a {@code LiteralByteString}.
-   *
-   * @param buf <code>ByteString</code> to access
-   * @return The underlying byte array of the ByteString
-   */
-  public static byte[] zeroCopyGetBytes(final ByteString buf) {
-    if (buf instanceof LiteralByteString) {
-      return ((LiteralByteString) buf).bytes;
-    }
-    throw new UnsupportedOperationException("Need a LiteralByteString, got a "
-                                            + buf.getClass().getName());
-  }
-}
-
-// End HBaseZeroCopyByteString.java

http://git-wip-us.apache.org/repos/asf/calcite/blob/221d1804/avatica/core/src/main/java/com/google/protobuf/package-info.java
----------------------------------------------------------------------
diff --git a/avatica/core/src/main/java/com/google/protobuf/package-info.java b/avatica/core/src/main/java/com/google/protobuf/package-info.java
deleted file mode 100644
index 92f110e..0000000
--- a/avatica/core/src/main/java/com/google/protobuf/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-custom classes to access protected classes in Google Protobuf.
- */
-@PackageMarker
-package com.google.protobuf;
-
-import org.apache.calcite.avatica.util.PackageMarker;
-
-// End package-info.java