Merge "Merge branch 'gerrit/trinity' into 'master'"
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/APIFramework.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/APIFramework.java
index 9bd65a6..3da25fe 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/APIFramework.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/APIFramework.java
@@ -331,7 +331,7 @@
                 new JobEventListenerFactory(txnId, metadataProvider.isWriteTransaction());
         JobSpecification spec = compiler.createJob(ccAppContext, jobEventListenerFactory, runtimeFlags);
 
-        if (isQuery) {
+        if (isQuery || isCopy) {
             if (!compiler.skipJobCapacityAssignment()) {
                 if (requestParameters == null || !requestParameters.isSkipAdmissionPolicy()) {
                     // Sets a required capacity, only for read-only queries.
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/record/reader/hdfs/parquet/converter/ParquetConverterContext.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/record/reader/hdfs/parquet/converter/ParquetConverterContext.java
index 5fa46a3..db63adc 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/record/reader/hdfs/parquet/converter/ParquetConverterContext.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/record/reader/hdfs/parquet/converter/ParquetConverterContext.java
@@ -27,7 +27,7 @@
 import org.apache.asterix.dataflow.data.nontagged.serde.AStringSerializerDeserializer;
 import org.apache.asterix.external.input.filter.NoOpFilterValueEmbedder;
 import org.apache.asterix.external.input.filter.embedder.IExternalFilterValueEmbedder;
-import org.apache.asterix.external.input.stream.StandardUTF8ToModifiedUTF8DataOutput;
+import org.apache.asterix.external.input.stream.StandardUTF8ToModifiedUTF8OutputStream;
 import org.apache.asterix.external.parser.jackson.ParserContext;
 import org.apache.asterix.external.util.ExternalDataConstants.ParquetOptions;
 import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
@@ -91,7 +91,7 @@
      * Binary values members
      * ************************************************************************
      */
-    private final StandardUTF8ToModifiedUTF8DataOutput modifiedUTF8DataOutput;
+    private final StandardUTF8ToModifiedUTF8OutputStream modifiedUTF8DataOutput;
     private byte[] lengthBytes;
 
     /*
@@ -137,7 +137,7 @@
             List<Warning> warnings) {
         this.warnings = warnings;
         this.valueEmbedder = valueEmbedder;
-        modifiedUTF8DataOutput = new StandardUTF8ToModifiedUTF8DataOutput(
+        modifiedUTF8DataOutput = new StandardUTF8ToModifiedUTF8OutputStream(
                 new AStringSerializerDeserializer(new UTF8StringWriter(), new UTF8StringReader()));
 
         parseJson = configuration.getBoolean(ParquetOptions.HADOOP_PARSE_JSON_STRING, false);
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/stream/StandardUTF8ToModifiedUTF8DataOutput.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/stream/StandardUTF8ToModifiedUTF8OutputStream.java
similarity index 69%
rename from asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/stream/StandardUTF8ToModifiedUTF8DataOutput.java
rename to asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/stream/StandardUTF8ToModifiedUTF8OutputStream.java
index adeb80e..035ee68 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/stream/StandardUTF8ToModifiedUTF8DataOutput.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/stream/StandardUTF8ToModifiedUTF8OutputStream.java
@@ -20,16 +20,17 @@
 
 import java.io.DataOutput;
 import java.io.IOException;
+import java.io.OutputStream;
 
 import org.apache.asterix.dataflow.data.nontagged.serde.AStringSerializerDeserializer;
 import org.apache.asterix.external.util.ExternalDataConstants;
 import org.apache.hyracks.data.std.util.ByteArrayAccessibleInputStream;
 
 /**
- * Writes modified UTF-8 string format to {@link StandardUTF8ToModifiedUTF8DataOutput#out}
+ * Writes modified UTF-8 string format to {@link StandardUTF8ToModifiedUTF8OutputStream#out}
  * from standard UTF-8 string format.
  */
-public class StandardUTF8ToModifiedUTF8DataOutput implements DataOutput {
+public class StandardUTF8ToModifiedUTF8OutputStream extends OutputStream {
     private static final byte[] EMPTY = new byte[0];
     private final AStringSerializerDeserializer stringSerDer;
     private final ResettableUTF8InputStreamReader reader;
@@ -37,7 +38,7 @@
     private char[] appendBuffer;
     private DataOutput out;
 
-    public StandardUTF8ToModifiedUTF8DataOutput(AStringSerializerDeserializer stringSerDer) {
+    public StandardUTF8ToModifiedUTF8OutputStream(AStringSerializerDeserializer stringSerDer) {
         this.stringSerDer = stringSerDer;
         reader = new ResettableUTF8InputStreamReader(new ByteArrayAccessibleInputStream(EMPTY, 0, 0));
         inputBuffer = new char[ExternalDataConstants.DEFAULT_BUFFER_SIZE];
@@ -67,61 +68,6 @@
         stringSerDer.serialize(appendBuffer, 0, length, out);
     }
 
-    @Override
-    public void writeBoolean(boolean v) throws IOException {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void writeByte(int v) throws IOException {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void writeShort(int v) throws IOException {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void writeChar(int v) throws IOException {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void writeInt(int v) throws IOException {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void writeLong(long v) throws IOException {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void writeFloat(float v) throws IOException {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void writeDouble(double v) throws IOException {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void writeBytes(String s) throws IOException {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void writeChars(String s) throws IOException {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void writeUTF(String s) throws IOException {
-        throw new UnsupportedOperationException();
-    }
-
     public void setDataOutput(DataOutput out) {
         this.out = out;
     }
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/stream/builders/StandardToModifiedUTF8DataOutputFactory.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/stream/builders/StandardToModifiedUTF8OutputStreamFactory.java
similarity index 81%
rename from asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/stream/builders/StandardToModifiedUTF8DataOutputFactory.java
rename to asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/stream/builders/StandardToModifiedUTF8OutputStreamFactory.java
index 606aee2..b26cbd9 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/stream/builders/StandardToModifiedUTF8DataOutputFactory.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/stream/builders/StandardToModifiedUTF8OutputStreamFactory.java
@@ -19,18 +19,18 @@
 package org.apache.asterix.external.input.stream.builders;
 
 import org.apache.asterix.dataflow.data.nontagged.serde.AStringSerializerDeserializer;
-import org.apache.asterix.external.input.stream.StandardUTF8ToModifiedUTF8DataOutput;
+import org.apache.asterix.external.input.stream.StandardUTF8ToModifiedUTF8OutputStream;
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.asterix.om.util.container.IObjectFactory;
 import org.apache.hyracks.util.string.UTF8StringReader;
 import org.apache.hyracks.util.string.UTF8StringWriter;
 
-public class StandardToModifiedUTF8DataOutputFactory
-        implements IObjectFactory<StandardUTF8ToModifiedUTF8DataOutput, ATypeTag> {
+public class StandardToModifiedUTF8OutputStreamFactory
+        implements IObjectFactory<StandardUTF8ToModifiedUTF8OutputStream, ATypeTag> {
 
     @Override
-    public StandardUTF8ToModifiedUTF8DataOutput create(ATypeTag type) {
-        return new StandardUTF8ToModifiedUTF8DataOutput(
+    public StandardUTF8ToModifiedUTF8OutputStream create(ATypeTag type) {
+        return new StandardUTF8ToModifiedUTF8OutputStream(
                 new AStringSerializerDeserializer(new UTF8StringWriter(), new UTF8StringReader()));
     }
 
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 d6121e8..69402f5 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
@@ -16,7 +16,35 @@
  */
 package org.apache.asterix.external.library.msgpack;
 
-import static org.msgpack.core.MessagePack.Code.*;
+import static org.msgpack.core.MessagePack.Code.ARRAY16;
+import static org.msgpack.core.MessagePack.Code.ARRAY32;
+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;
+import static org.msgpack.core.MessagePack.Code.FIXSTR_PREFIX;
+import static org.msgpack.core.MessagePack.Code.FLOAT32;
+import static org.msgpack.core.MessagePack.Code.FLOAT64;
+import static org.msgpack.core.MessagePack.Code.INT16;
+import static org.msgpack.core.MessagePack.Code.INT32;
+import static org.msgpack.core.MessagePack.Code.INT64;
+import static org.msgpack.core.MessagePack.Code.INT8;
+import static org.msgpack.core.MessagePack.Code.MAP16;
+import static org.msgpack.core.MessagePack.Code.MAP32;
+import static org.msgpack.core.MessagePack.Code.NIL;
+import static org.msgpack.core.MessagePack.Code.STR16;
+import static org.msgpack.core.MessagePack.Code.STR32;
+import static org.msgpack.core.MessagePack.Code.STR8;
+import static org.msgpack.core.MessagePack.Code.TRUE;
+import static org.msgpack.core.MessagePack.Code.UINT16;
+import static org.msgpack.core.MessagePack.Code.UINT32;
+import static org.msgpack.core.MessagePack.Code.UINT64;
+import static org.msgpack.core.MessagePack.Code.UINT8;
+import static org.msgpack.core.MessagePack.Code.isFixInt;
+import static org.msgpack.core.MessagePack.Code.isFixStr;
+import static org.msgpack.core.MessagePack.Code.isFixedArray;
+import static org.msgpack.core.MessagePack.Code.isFixedMap;
+import static org.msgpack.core.MessagePack.Code.isNegFixInt;
+import static org.msgpack.core.MessagePack.Code.isPosFixInt;
 
 import java.io.DataOutput;
 import java.io.IOException;
@@ -27,9 +55,9 @@
 import org.apache.asterix.builders.AbvsBuilderFactory;
 import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.common.exceptions.ErrorCode;
-import org.apache.asterix.external.input.stream.StandardUTF8ToModifiedUTF8DataOutput;
+import org.apache.asterix.external.input.stream.StandardUTF8ToModifiedUTF8OutputStream;
 import org.apache.asterix.external.input.stream.builders.ListLikeNumericArrayFactory;
-import org.apache.asterix.external.input.stream.builders.StandardToModifiedUTF8DataOutputFactory;
+import org.apache.asterix.external.input.stream.builders.StandardToModifiedUTF8OutputStreamFactory;
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.asterix.om.util.container.IObjectPool;
 import org.apache.asterix.om.util.container.ListObjectPool;
@@ -43,8 +71,8 @@
 
     private final IObjectPool<IMutableValueStorage, ATypeTag> abvsBuilderPool =
             new ListObjectPool<>(new AbvsBuilderFactory());
-    private final IObjectPool<StandardUTF8ToModifiedUTF8DataOutput, ATypeTag> utfPool =
-            new ListObjectPool<>(new StandardToModifiedUTF8DataOutputFactory());
+    private final IObjectPool<StandardUTF8ToModifiedUTF8OutputStream, ATypeTag> utfPool =
+            new ListObjectPool<>(new StandardToModifiedUTF8OutputStreamFactory());
     private final IObjectPool<List<Long>, Long> listPool = new ListObjectPool<>(new ListLikeNumericArrayFactory<>());
 
     public MessageUnpackerToADM() {
@@ -291,7 +319,7 @@
             throw new UnsupportedOperationException("String is too long");
         }
         int len = (int) uLen;
-        StandardUTF8ToModifiedUTF8DataOutput conv = utfPool.allocate(ATypeTag.STRING);
+        StandardUTF8ToModifiedUTF8OutputStream conv = utfPool.allocate(ATypeTag.STRING);
         conv.setDataOutput(out);
         conv.write(in.array(), in.arrayOffset() + in.position(), len);
         in.position(in.position() + len);