You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@asterixdb.apache.org by AsterixDB Code Review <do...@asterix-gerrit.ics.uci.edu> on 2026/09/15 18:39:33 UTC

[M] Change in asterixdb[master]: [ASTERIXDB-3850][RT][FUN] Add binary type to PyUDF

From Ian Maxon <im...@apache.org>:

Ian Maxon has uploaded this change for review. ( https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21804?usp=email )


Change subject: [ASTERIXDB-3850][RT][FUN] Add binary type to PyUDF
......................................................................

[ASTERIXDB-3850][RT][FUN] Add binary type to PyUDF

Previously, you couldn't give binary types to UDFs as arguments,
and returning one would break the query. There are 2 ways to
solve that last part: either make it map to null, or just add
support for it. Given that AsterixDB's BINARY type and Python's
bytes type are compatible, and that msgpack also has this type,
it is easy enough to just add it in.

Generated-By: Claude Opus 5
Change-Id: I4ef8d90e3bb73e220384156b7954297176ab4d72
---
M asterixdb/asterix-app/src/test/resources/TweetSent/roundtrip.py
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-library/python_binary/python_binary.0.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-library/python_binary/python_binary.1.lib.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-library/python_binary/python_binary.2.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-library/python_binary/python_binary.3.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-library/python_binary/python_binary.4.query.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-library/python_binary/python_binary.5.ddl.sqlpp
A asterixdb/asterix-app/src/test/resources/runtimets/results/external-library/python_binary/python_binary.1.adm
A asterixdb/asterix-app/src/test/resources/runtimets/results/external-library/python_binary/python_binary.2.adm
M asterixdb/asterix-app/src/test/resources/runtimets/testsuite_it_python.xml
M asterixdb/asterix-doc/src/main/user-defined_function/udf.md
M asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/msgpack/MessageUnpackerToADM.java
M asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/msgpack/MsgPackAccessors.java
13 files changed, 231 insertions(+), 0 deletions(-)



  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/04/21804/1

diff --git a/asterixdb/asterix-app/src/test/resources/TweetSent/roundtrip.py b/asterixdb/asterix-app/src/test/resources/TweetSent/roundtrip.py
index 0d52f01..f578d63 100644
--- a/asterixdb/asterix-app/src/test/resources/TweetSent/roundtrip.py
+++ b/asterixdb/asterix-app/src/test/resources/TweetSent/roundtrip.py
@@ -33,3 +33,22 @@
 
     def env_test(self, key):
         return os.environ[key]
+
+    def binary_echo(self, arg):
+        if not isinstance(arg, bytes):
+            raise TypeError("expected bytes, got " + type(arg).__name__)
+        return arg
+
+    def binary_size(self, arg):
+        if not isinstance(arg, bytes):
+            raise TypeError("expected bytes, got " + type(arg).__name__)
+        return len(arg)
+
+    def binary_encode(self, arg):
+        return arg.encode("utf-8")
+
+    def binary_repeat(self, arg, times):
+        return arg * times
+
+    def binary_nested(self, arg):
+        return {"value": arg, "list": [arg, arg]}
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-library/python_binary/python_binary.0.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-library/python_binary/python_binary.0.ddl.sqlpp
new file mode 100644
index 0000000..fac3f9d
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-library/python_binary/python_binary.0.ddl.sqlpp
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+DROP DATAVERSE externallibtest if exists;
+CREATE DATAVERSE externallibtest;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-library/python_binary/python_binary.1.lib.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-library/python_binary/python_binary.1.lib.sqlpp
new file mode 100644
index 0000000..3250a90
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-library/python_binary/python_binary.1.lib.sqlpp
@@ -0,0 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+install externallibtest testlib python admin admin target/TweetSent.pyz
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-library/python_binary/python_binary.2.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-library/python_binary/python_binary.2.ddl.sqlpp
new file mode 100644
index 0000000..ed54063
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-library/python_binary/python_binary.2.ddl.sqlpp
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use externallibtest;
+
+create function binaryEcho(b) as "roundtrip", "Tests.binary_echo" at testlib;
+
+create function binarySize(b) as "roundtrip", "Tests.binary_size" at testlib;
+
+create function binaryEncode(s) as "roundtrip", "Tests.binary_encode" at testlib;
+
+create function binaryRepeat(b, n) as "roundtrip", "Tests.binary_repeat" at testlib;
+
+create function binaryNested(b) as "roundtrip", "Tests.binary_nested" at testlib;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-library/python_binary/python_binary.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-library/python_binary/python_binary.3.query.sqlpp
new file mode 100644
index 0000000..17f8782
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-library/python_binary/python_binary.3.query.sqlpp
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use externallibtest;
+
+select value {
+  "echo": binaryEcho(hex("ABCDEF")),
+  "echo_empty": binaryEcho(hex("")),
+  "size": binarySize(hex("ABCDEF")),
+  "encoded": binaryEncode("hello"),
+  "long_echo": binaryEcho(hex(repeat("AB", 300))) = hex(repeat("AB", 300)),
+  "long_size": binarySize(hex(repeat("AB", 300))),
+  "long_return": binaryRepeat(hex("AB"), 300) = hex(repeat("AB", 300)),
+  "nested": binaryNested(hex("0102"))
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-library/python_binary/python_binary.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-library/python_binary/python_binary.4.query.sqlpp
new file mode 100644
index 0000000..3aa6fa7
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-library/python_binary/python_binary.4.query.sqlpp
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use externallibtest;
+
+set `rewrite_attempt_batch_assign` "false";
+
+select value {
+  "echo": binaryEcho(hex("ABCDEF")),
+  "echo_empty": binaryEcho(hex("")),
+  "size": binarySize(hex("ABCDEF")),
+  "encoded": binaryEncode("hello"),
+  "long_echo": binaryEcho(hex(repeat("AB", 300))) = hex(repeat("AB", 300)),
+  "long_size": binarySize(hex(repeat("AB", 300))),
+  "long_return": binaryRepeat(hex("AB"), 300) = hex(repeat("AB", 300)),
+  "nested": binaryNested(hex("0102"))
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-library/python_binary/python_binary.5.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-library/python_binary/python_binary.5.ddl.sqlpp
new file mode 100644
index 0000000..2b27030
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/external-library/python_binary/python_binary.5.ddl.sqlpp
@@ -0,0 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+DROP DATAVERSE externallibtest;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/external-library/python_binary/python_binary.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/external-library/python_binary/python_binary.1.adm
new file mode 100644
index 0000000..6d18766
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/external-library/python_binary/python_binary.1.adm
@@ -0,0 +1 @@
+{ "long_echo": true, "long_return": true, "echo": "ABCDEF", "echo_empty": "", "size": 3, "encoded": "68656C6C6F", "long_size": 300, "nested": { "value": "0102", "list": [ "0102", "0102" ] } }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/external-library/python_binary/python_binary.2.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/external-library/python_binary/python_binary.2.adm
new file mode 100644
index 0000000..6d18766
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/external-library/python_binary/python_binary.2.adm
@@ -0,0 +1 @@
+{ "long_echo": true, "long_return": true, "echo": "ABCDEF", "echo_empty": "", "size": 3, "encoded": "68656C6C6F", "long_size": 300, "nested": { "value": "0102", "list": [ "0102", "0102" ] } }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_it_python.xml b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_it_python.xml
index f65ebf2..bb0e129 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_it_python.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_it_python.xml
@@ -50,6 +50,11 @@
         <output-dir compare="Clean-JSON">python_open_type_validation</output-dir>
       </compilation-unit>
     </test-case>
+    <test-case FilePath="external-library">
+      <compilation-unit name="python_binary">
+        <output-dir compare="Clean-JSON">python_binary</output-dir>
+      </compilation-unit>
+    </test-case>
     <test-case FilePath="external-library" check-warnings="true">
       <compilation-unit name="py_function_error">
         <output-dir compare="Clean-JSON">py_function_error</output-dir>
diff --git a/asterixdb/asterix-doc/src/main/user-defined_function/udf.md b/asterixdb/asterix-doc/src/main/user-defined_function/udf.md
index 9768c81..8ad8636 100644
--- a/asterixdb/asterix-doc/src/main/user-defined_function/udf.md
+++ b/asterixdb/asterix-doc/src/main/user-defined_function/udf.md
@@ -168,6 +168,7 @@
 - Integer types (int8,16,32,64)
 - Floating point types (float, double)
 - String
+- Binary (cast to bytes)
 - Boolean
 - Arrays, Sets (cast to lists)
 - Objects (cast to dict)
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/msgpack/MessageUnpackerToADM.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/msgpack/MessageUnpackerToADM.java
index 69402f5..5d3ed47 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/msgpack/MessageUnpackerToADM.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/msgpack/MessageUnpackerToADM.java
@@ -18,6 +18,9 @@
 
 import static org.msgpack.core.MessagePack.Code.ARRAY16;
 import static org.msgpack.core.MessagePack.Code.ARRAY32;
+import static org.msgpack.core.MessagePack.Code.BIN16;
+import static org.msgpack.core.MessagePack.Code.BIN32;
+import static org.msgpack.core.MessagePack.Code.BIN8;
 import static org.msgpack.core.MessagePack.Code.FALSE;
 import static org.msgpack.core.MessagePack.Code.FIXARRAY_PREFIX;
 import static org.msgpack.core.MessagePack.Code.FIXMAP_PREFIX;
@@ -65,6 +68,8 @@
 import org.apache.hyracks.data.std.api.IMutableValueStorage;
 import org.apache.hyracks.data.std.primitive.IntegerPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
+import org.apache.hyracks.util.annotations.AiProvenance;
+import org.apache.hyracks.util.encoding.VarLenIntEncoderDecoder;
 import org.apache.hyracks.util.string.UTF8StringUtil;
 
 public class MessageUnpackerToADM {
@@ -74,10 +79,12 @@
     private final IObjectPool<StandardUTF8ToModifiedUTF8OutputStream, ATypeTag> utfPool =
             new ListObjectPool<>(new StandardToModifiedUTF8OutputStreamFactory());
     private final IObjectPool<List<Long>, Long> listPool = new ListObjectPool<>(new ListLikeNumericArrayFactory<>());
+    private final byte[] binaryLengthBytes = new byte[5];
 
     public MessageUnpackerToADM() {
     }
 
+    @AiProvenance(agent = AiProvenance.Agent.CLAUDE_OPUS_5, tool = AiProvenance.Tool.CLAUDE_CODE_CLI, contributionKind = AiProvenance.ContributionKind.ASSISTED, notes = "Added the bin8/bin16/bin32 cases so Python bytes become ADM binary")
     public void unpack(ByteBuffer in, DataOutput out, boolean tagged) throws IOException {
         byte tag = NIL;
         if (in != null) {
@@ -141,6 +148,15 @@
                 case FLOAT64:
                     unpackDouble(in, out, tagged);
                     break;
+                case BIN8:
+                    unpackBin(in, out, Byte.toUnsignedInt(in.get()), tagged);
+                    break;
+                case BIN16:
+                    unpackBin(in, out, Short.toUnsignedInt(in.getShort()), tagged);
+                    break;
+                case BIN32:
+                    unpackBin(in, out, Integer.toUnsignedLong(in.getInt()), tagged);
+                    break;
                 case STR8:
                     unpackStr(in, out, Byte.toUnsignedInt(in.get()), tagged);
                     break;
@@ -311,6 +327,20 @@
         out.write(buildBuf.getByteArray(), buildBuf.getStartOffset(), buildBuf.getLength());
     }
 
+    @AiProvenance(agent = AiProvenance.Agent.CLAUDE_OPUS_5, tool = AiProvenance.Tool.CLAUDE_CODE_CLI, contributionKind = AiProvenance.ContributionKind.GENERATED, notes = "Writes a msgpack bin payload as ADM binary: varlen content length followed by the raw bytes")
+    public void unpackBin(ByteBuffer in, DataOutput out, long uLen, boolean tag) throws IOException {
+        if (Long.compareUnsigned(uLen, Integer.MAX_VALUE) > 0) {
+            throw new UnsupportedOperationException("Binary is too long");
+        }
+        if (tag) {
+            out.writeByte(ATypeTag.SERIALIZED_BINARY_TYPE_TAG);
+        }
+        int len = (int) uLen;
+        out.write(binaryLengthBytes, 0, VarLenIntEncoderDecoder.encode(len, binaryLengthBytes, 0));
+        out.write(in.array(), in.arrayOffset() + in.position(), len);
+        in.position(in.position() + len);
+    }
+
     public void unpackStr(ByteBuffer in, DataOutput out, long uLen, boolean tag) throws IOException {
         if (tag) {
             out.writeByte(ATypeTag.SERIALIZED_STRING_TYPE_TAG);
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/msgpack/MsgPackAccessors.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/msgpack/MsgPackAccessors.java
index 6f097d0..12f553f 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/msgpack/MsgPackAccessors.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/library/msgpack/MsgPackAccessors.java
@@ -20,6 +20,7 @@
 
 import static org.apache.hyracks.util.string.UTF8StringUtil.getUTFLength;
 import static org.msgpack.core.MessagePack.Code.ARRAY32;
+import static org.msgpack.core.MessagePack.Code.BIN32;
 import static org.msgpack.core.MessagePack.Code.FALSE;
 import static org.msgpack.core.MessagePack.Code.FLOAT32;
 import static org.msgpack.core.MessagePack.Code.FLOAT64;
@@ -39,6 +40,7 @@
 import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.common.exceptions.ErrorCode;
 import org.apache.asterix.dataflow.data.nontagged.printers.PrintTools;
+import org.apache.asterix.dataflow.data.nontagged.serde.ABinarySerializerDeserializer;
 import org.apache.asterix.dataflow.data.nontagged.serde.ABooleanSerializerDeserializer;
 import org.apache.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
 import org.apache.asterix.dataflow.data.nontagged.serde.AFloatSerializerDeserializer;
@@ -59,6 +61,7 @@
 import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.data.std.api.IPointable;
+import org.apache.hyracks.util.annotations.AiProvenance;
 import org.apache.hyracks.util.encoding.VarLenIntEncoderDecoder;
 
 public class MsgPackAccessors {
@@ -66,6 +69,7 @@
     private MsgPackAccessors() {
     }
 
+    @AiProvenance(agent = AiProvenance.Agent.CLAUDE_OPUS_5, tool = AiProvenance.Tool.CLAUDE_CODE_CLI, contributionKind = AiProvenance.ContributionKind.ASSISTED, notes = "Added the BINARY case so binary arguments reach Python as bytes")
     public static IMsgPackAccessor<IPointable, DataOutput, Void> createFlatMsgPackAccessor(ATypeTag aTypeTag)
             throws HyracksDataException {
         switch (aTypeTag) {
@@ -85,6 +89,8 @@
                 return MsgPackDoubleAccessor::apply;
             case STRING:
                 return MsgPackStringAccessor::apply;
+            case BINARY:
+                return MsgPackBinaryAccessor::apply;
             case MISSING:
             case NULL:
                 return MsgPackNullAccessor::apply;
@@ -184,6 +190,19 @@
 
     }
 
+    @AiProvenance(agent = AiProvenance.Agent.CLAUDE_OPUS_5, tool = AiProvenance.Tool.CLAUDE_CODE_CLI, contributionKind = AiProvenance.ContributionKind.GENERATED, notes = "Packs ADM binary as a msgpack bin32, which msgpack-python unpacks as bytes")
+    public static class MsgPackBinaryAccessor {
+        public static Void apply(IPointable pointable, DataOutput out) throws IOException {
+            byte[] b = pointable.getByteArray();
+            int s = pointable.getStartOffset();
+            int contentLength = ABinarySerializerDeserializer.getContentLength(b, s + 1);
+            out.writeByte(BIN32);
+            out.writeInt(contentLength);
+            out.write(b, s + 1 + ABinarySerializerDeserializer.getMetaLength(contentLength), contentLength);
+            return null;
+        }
+    }
+
     public static class MsgPackBooleanAccessor {
         public static Void apply(IPointable pointable, DataOutput out) throws IOException {
             byte[] b = pointable.getByteArray();

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21804?usp=email
To unsubscribe, or for help writing mail filters, visit https://asterix-gerrit.ics.uci.edu/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Change-Id: I4ef8d90e3bb73e220384156b7954297176ab4d72
Gerrit-Change-Number: 21804
Gerrit-PatchSet: 1
Gerrit-Owner: Ian Maxon <im...@apache.org>