You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by ji...@apache.org on 2015/10/29 05:44:52 UTC

[01/15] incubator-asterixdb git commit: ASTERIXDB-1102: VarSize Encoding to store length of String and ByteArray

Repository: incubator-asterixdb
Updated Branches:
  refs/heads/master 1eeb3d29c -> 742aba85e


http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/AdjustDateTimeForTimeZoneDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/AdjustDateTimeForTimeZoneDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/AdjustDateTimeForTimeZoneDescriptor.java
index b964179..424d46b 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/AdjustDateTimeForTimeZoneDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/AdjustDateTimeForTimeZoneDescriptor.java
@@ -39,8 +39,10 @@ import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
+import org.apache.hyracks.util.string.UTF8StringWriter;
 
 public class AdjustDateTimeForTimeZoneDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
@@ -86,6 +88,9 @@ public class AdjustDateTimeForTimeZoneDescriptor extends AbstractScalarFunctionD
 
                     private GregorianCalendarSystem calInstance = GregorianCalendarSystem.getInstance();
 
+                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
+                    private final UTF8StringWriter utf8Writer = new UTF8StringWriter();
+
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
                         argOut0.reset();
@@ -112,7 +117,9 @@ public class AdjustDateTimeForTimeZoneDescriptor extends AbstractScalarFunctionD
                                         + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut1.getByteArray()[0]));
                             }
 
-                            int timezone = ATimeParserFactory.parseTimezonePart(argOut1.getByteArray(), 3);
+                            utf8Ptr.set(argOut1.getByteArray(), 1, argOut1.getLength() - 1);
+                            int timezone = ATimeParserFactory
+                                    .parseTimezonePart(utf8Ptr.getByteArray(), utf8Ptr.getCharStartOffset());
 
                             if (!calInstance.validateTimeZone(timezone)) {
                                 throw new AlgebricksException(FID.getName() + ": wrong format for a time zone string!");
@@ -128,8 +135,7 @@ public class AdjustDateTimeForTimeZoneDescriptor extends AbstractScalarFunctionD
                                     Fields.MILLISECOND, true);
 
                             out.writeByte(SER_STRING_TYPE_TAG);
-                            out.writeUTF(sbder.toString());
-
+                            utf8Writer.writeUTF8(sbder.toString(), out);
                         } catch (Exception e1) {
                             throw new AlgebricksException(e1);
                         }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/AdjustTimeForTimeZoneDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/AdjustTimeForTimeZoneDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/AdjustTimeForTimeZoneDescriptor.java
index 13e1c5b..32e16e4 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/AdjustTimeForTimeZoneDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/AdjustTimeForTimeZoneDescriptor.java
@@ -39,8 +39,10 @@ import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
+import org.apache.hyracks.util.string.UTF8StringWriter;
 
 public class AdjustTimeForTimeZoneDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
@@ -85,6 +87,8 @@ public class AdjustTimeForTimeZoneDescriptor extends AbstractScalarFunctionDynam
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
                     private GregorianCalendarSystem calInstance = GregorianCalendarSystem.getInstance();
+                    private final UTF8StringWriter writer = new UTF8StringWriter();
+                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
@@ -112,7 +116,9 @@ public class AdjustTimeForTimeZoneDescriptor extends AbstractScalarFunctionDynam
                                         + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut1.getByteArray()[0]));
                             }
 
-                            int timezone = ATimeParserFactory.parseTimezonePart(argOut1.getByteArray(), 3);
+                            utf8Ptr.set(argOut1.getByteArray(), 1, argOut1.getLength() - 1);
+                            int timezone = ATimeParserFactory
+                                    .parseTimezonePart(argOut1.getByteArray(), utf8Ptr.getCharStartOffset());
 
                             if (!calInstance.validateTimeZone(timezone)) {
                                 throw new AlgebricksException(FID.getName() + ": wrong format for a time zone string!");
@@ -128,7 +134,7 @@ public class AdjustTimeForTimeZoneDescriptor extends AbstractScalarFunctionDynam
                                     Fields.MILLISECOND, true);
 
                             out.writeByte(SER_STRING_TYPE_TAG);
-                            out.writeUTF(sbder.toString());
+                            writer.writeUTF8(sbder.toString(), out);
 
                         } catch (Exception e1) {
                             throw new AlgebricksException(e1);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/ParseDateDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/ParseDateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/ParseDateDescriptor.java
index 8ca047e..b1fbf7c 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/ParseDateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/ParseDateDescriptor.java
@@ -26,8 +26,8 @@ import org.apache.asterix.om.base.AMutableDate;
 import org.apache.asterix.om.base.ANull;
 import org.apache.asterix.om.base.temporal.AsterixTemporalTypeParseException;
 import org.apache.asterix.om.base.temporal.DateTimeFormatUtils;
-import org.apache.asterix.om.base.temporal.GregorianCalendarSystem;
 import org.apache.asterix.om.base.temporal.DateTimeFormatUtils.DateTimeParseMode;
+import org.apache.asterix.om.base.temporal.GregorianCalendarSystem;
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
 import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
@@ -42,13 +42,13 @@ import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 /**
  * <b>|(bar)</b> is a special separator used to separate different formatting options.
  * Multiple format strings can be used by separating them using <b>|(bar)</b>, and the parsing will be successful only when the format string has the <b>exact</b> match with the given data string. This means that a time string like <it>08:23:12 AM</it> will not be valid for the format string <it>h:m:s</it> as there is no AM/PM format character in the format string.
- * <p/>
  */
 public class ParseDateDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
@@ -91,6 +91,7 @@ public class ParseDateDescriptor extends AbstractScalarFunctionDynamicDescriptor
                             .getSerializerDeserializer(BuiltinType.ADATE);
 
                     private AMutableDate aDate = new AMutableDate(0);
+                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
@@ -115,25 +116,28 @@ public class ParseDateDescriptor extends AbstractScalarFunctionDynamicDescriptor
                                         + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut1.getByteArray()[0])
                                         + ")");
                             }
-                            int length0 = (argOut0.getByteArray()[1] & 0xff << 8)
-                                    + (argOut0.getByteArray()[2] & 0xff << 0);
-                            int length1 = (argOut1.getByteArray()[1] & 0xff << 8)
-                                    + (argOut1.getByteArray()[2] & 0xff << 0);
+                            utf8Ptr.set(argOut0.getByteArray(), 1, argOut0.getLength() - 1);
+                            int start0 = utf8Ptr.getCharStartOffset();
+                            int length0 = utf8Ptr.getUTF8Length();
+
+                            utf8Ptr.set(argOut1.getByteArray(), 1, argOut1.getLength() - 1);
+                            int start1 = utf8Ptr.getCharStartOffset();
+                            int length1 = utf8Ptr.getUTF8Length();
                             long chronon = 0;
 
-                            int formatStart = 3;
+                            int formatStart = start1;
                             int formatLength = 0;
                             boolean processSuccessfully = false;
-                            while (!processSuccessfully && formatStart < 3 + length1) {
+                            while (!processSuccessfully && formatStart < start1 + length1) {
                                 // search for "|"
                                 formatLength = 0;
-                                for (; formatStart + formatLength < 3 + length1; formatLength++) {
+                                for (; formatStart + formatLength < start1 + length1; formatLength++) {
                                     if (argOut1.getByteArray()[formatStart + formatLength] == '|') {
                                         break;
                                     }
                                 }
                                 try {
-                                    chronon = DT_UTILS.parseDateTime(argOut0.getByteArray(), 3, length0,
+                                    chronon = DT_UTILS.parseDateTime(argOut0.getByteArray(), start0, length0,
                                             argOut1.getByteArray(), formatStart, formatLength,
                                             DateTimeParseMode.DATE_ONLY);
                                 } catch (AsterixTemporalTypeParseException ex) {

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/ParseDateTimeDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/ParseDateTimeDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/ParseDateTimeDescriptor.java
index 44b4281..2a7be96 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/ParseDateTimeDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/ParseDateTimeDescriptor.java
@@ -41,6 +41,7 @@ import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -85,6 +86,7 @@ public class ParseDateTimeDescriptor extends AbstractScalarFunctionDynamicDescri
                             .getSerializerDeserializer(BuiltinType.ADATETIME);
 
                     private AMutableDateTime aDateTime = new AMutableDateTime(0);
+                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
@@ -109,25 +111,28 @@ public class ParseDateTimeDescriptor extends AbstractScalarFunctionDynamicDescri
                                         + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut1.getByteArray()[0])
                                         + ")");
                             }
-                            int length0 = (argOut0.getByteArray()[1] & 0xff << 8)
-                                    + (argOut0.getByteArray()[2] & 0xff << 0);
-                            int length1 = (argOut1.getByteArray()[1] & 0xff << 8)
-                                    + (argOut1.getByteArray()[2] & 0xff << 0);
+                            utf8Ptr.set(argOut0.getByteArray(), 1, argOut0.getLength()-1);
+                            int start0 = utf8Ptr.getCharStartOffset();
+                            int length0 = utf8Ptr.getUTF8Length();
+
+                            utf8Ptr.set(argOut1.getByteArray(), 1, argOut1.getLength()-1);
+                            int start1 = utf8Ptr.getCharStartOffset();
+                            int length1 = utf8Ptr.getUTF8Length();
                             long chronon = 0;
 
-                            int formatStart = 3;
+                            int formatStart = start1;
                             int formatLength = 0;
                             boolean processSuccessfully = false;
-                            while (!processSuccessfully && formatStart < 3 + length1) {
+                            while (!processSuccessfully && formatStart < start1 + length1) {
                                 // search for "|"
                                 formatLength = 0;
-                                for (; formatStart + formatLength < 3 + length1; formatLength++) {
+                                for (; formatStart + formatLength < start1 + length1; formatLength++) {
                                     if (argOut1.getByteArray()[formatStart + formatLength] == '|') {
                                         break;
                                     }
                                 }
                                 try {
-                                    chronon = DT_UTILS.parseDateTime(argOut0.getByteArray(), 3, length0,
+                                    chronon = DT_UTILS.parseDateTime(argOut0.getByteArray(), start0, length0,
                                             argOut1.getByteArray(), formatStart, formatLength,
                                             DateTimeParseMode.DATETIME);
                                 } catch (AsterixTemporalTypeParseException ex) {

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/ParseTimeDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/ParseTimeDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/ParseTimeDescriptor.java
index a5cec47..007ddca 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/ParseTimeDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/ParseTimeDescriptor.java
@@ -41,6 +41,7 @@ import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -85,6 +86,7 @@ public class ParseTimeDescriptor extends AbstractScalarFunctionDynamicDescriptor
                             .getSerializerDeserializer(BuiltinType.ATIME);
 
                     private AMutableTime aTime = new AMutableTime(0);
+                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
@@ -109,25 +111,28 @@ public class ParseTimeDescriptor extends AbstractScalarFunctionDynamicDescriptor
                                         + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut1.getByteArray()[0])
                                         + ")");
                             }
-                            int length0 = (argOut0.getByteArray()[1] & 0xff << 8)
-                                    + (argOut0.getByteArray()[2] & 0xff << 0);
-                            int length1 = (argOut1.getByteArray()[1] & 0xff << 8)
-                                    + (argOut1.getByteArray()[2] & 0xff << 0);
+                            utf8Ptr.set(argOut0.getByteArray(), 1, argOut0.getLength()-1);
+                            int start0 = utf8Ptr.getCharStartOffset();
+                            int length0 = utf8Ptr.getUTF8Length();
+
+                            utf8Ptr.set(argOut1.getByteArray(), 1, argOut1.getLength() -1);
+                            int start1 = utf8Ptr.getCharStartOffset();
+                            int length1 = utf8Ptr.getUTF8Length();
                             long chronon = 0;
 
-                            int formatStart = 3;
+                            int formatStart = start1;
                             int formatLength = 0;
                             boolean processSuccessfully = false;
-                            while (!processSuccessfully && formatStart < 3 + length1) {
+                            while (!processSuccessfully && formatStart < start1 + length1) {
                                 // search for "|"
                                 formatLength = 0;
-                                for (; formatStart + formatLength < 3 + length1; formatLength++) {
+                                for (; formatStart + formatLength < start1 + length1; formatLength++) {
                                     if (argOut1.getByteArray()[formatStart + formatLength] == '|') {
                                         break;
                                     }
                                 }
                                 try {
-                                    chronon = DT_UTILS.parseDateTime(argOut0.getByteArray(), 3, length0,
+                                    chronon = DT_UTILS.parseDateTime(argOut0.getByteArray(), start0, length0,
                                             argOut1.getByteArray(), formatStart, formatLength,
                                             DateTimeParseMode.TIME_ONLY);
                                 } catch (AsterixTemporalTypeParseException ex) {

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/PrintDateDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/PrintDateDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/PrintDateDescriptor.java
index c56aa8e..d731fff 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/PrintDateDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/PrintDateDescriptor.java
@@ -25,8 +25,8 @@ import org.apache.asterix.dataflow.data.nontagged.serde.ADateSerializerDeseriali
 import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.om.base.ANull;
 import org.apache.asterix.om.base.temporal.DateTimeFormatUtils;
-import org.apache.asterix.om.base.temporal.GregorianCalendarSystem;
 import org.apache.asterix.om.base.temporal.DateTimeFormatUtils.DateTimeParseMode;
+import org.apache.asterix.om.base.temporal.GregorianCalendarSystem;
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
 import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
@@ -42,6 +42,8 @@ import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
+import org.apache.hyracks.util.string.UTF8StringUtil;
+import org.apache.hyracks.util.string.UTF8StringWriter;
 
 public class PrintDateDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
@@ -82,6 +84,7 @@ public class PrintDateDescriptor extends AbstractScalarFunctionDynamicDescriptor
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
                     private StringBuilder sbder = new StringBuilder();
+                    private final UTF8StringWriter utf8Writer = new UTF8StringWriter();
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
@@ -109,14 +112,14 @@ public class PrintDateDescriptor extends AbstractScalarFunctionDynamicDescriptor
 
                             long chronon = ADateSerializerDeserializer.getChronon(argOut0.getByteArray(), 1)
                                     * GregorianCalendarSystem.CHRONON_OF_DAY;
-                            int formatLength = (argOut1.getByteArray()[1] & 0xff << 8)
-                                    + (argOut1.getByteArray()[2] & 0xff << 0);
+                            int formatLength = UTF8StringUtil.getUTFLength(argOut1.getByteArray(), 1);
+                            int offset = UTF8StringUtil.getNumBytesToStoreLength(formatLength);
                             sbder.delete(0, sbder.length());
-                            DT_UTILS.printDateTime(chronon, 0, argOut1.getByteArray(), 3, formatLength, sbder,
+                            DT_UTILS.printDateTime(chronon, 0, argOut1.getByteArray(), 1 + offset, formatLength, sbder,
                                     DateTimeParseMode.DATE_ONLY);
 
                             out.writeByte(ATypeTag.STRING.serialize());
-                            out.writeUTF(sbder.toString());
+                            utf8Writer.writeUTF8(sbder.toString(), out);
 
                         } catch (IOException ex) {
                             throw new AlgebricksException(ex);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/PrintDateTimeDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/PrintDateTimeDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/PrintDateTimeDescriptor.java
index fc53203..a31e1e5 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/PrintDateTimeDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/PrintDateTimeDescriptor.java
@@ -39,8 +39,10 @@ import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
+import org.apache.hyracks.util.string.UTF8StringWriter;
 
 public class PrintDateTimeDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
@@ -81,6 +83,8 @@ public class PrintDateTimeDescriptor extends AbstractScalarFunctionDynamicDescri
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
                     private StringBuilder sbder = new StringBuilder();
+                    private UTF8StringWriter utf8Writer = new UTF8StringWriter();
+                    private UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
@@ -106,14 +110,14 @@ public class PrintDateTimeDescriptor extends AbstractScalarFunctionDynamicDescri
                                         + ")");
                             }
                             long chronon = ADateTimeSerializerDeserializer.getChronon(argOut0.getByteArray(), 1);
-                            int formatLength = (argOut1.getByteArray()[1] & 0xff << 8)
-                                    + (argOut1.getByteArray()[2] & 0xff << 0);
+                            utf8Ptr.set(argOut1.getByteArray(), 1, argOut1.getLength() - 1);
+                            int formatLength = utf8Ptr.getUTF8Length();
                             sbder.delete(0, sbder.length());
-                            DT_UTILS.printDateTime(chronon, 0, argOut1.getByteArray(), 3, formatLength, sbder,
-                                    DateTimeParseMode.DATETIME);
+                            DT_UTILS.printDateTime(chronon, 0, utf8Ptr.getByteArray(), utf8Ptr.getCharStartOffset(),
+                                    formatLength, sbder, DateTimeParseMode.DATETIME);
 
                             out.writeByte(ATypeTag.STRING.serialize());
-                            out.writeUTF(sbder.toString());
+                            utf8Writer.writeUTF8(sbder.toString(), out);
 
                         } catch (IOException ex) {
                             throw new AlgebricksException(ex);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/PrintTimeDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/PrintTimeDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/PrintTimeDescriptor.java
index 01ff402..961c44d 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/PrintTimeDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/temporal/PrintTimeDescriptor.java
@@ -39,8 +39,10 @@ import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
+import org.apache.hyracks.util.string.UTF8StringWriter;
 
 public class PrintTimeDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
@@ -81,6 +83,8 @@ public class PrintTimeDescriptor extends AbstractScalarFunctionDynamicDescriptor
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
                     private StringBuilder sbder = new StringBuilder();
+                    private final UTF8StringWriter writer = new UTF8StringWriter();
+                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
@@ -107,14 +111,14 @@ public class PrintTimeDescriptor extends AbstractScalarFunctionDynamicDescriptor
                             }
 
                             long chronon = ATimeSerializerDeserializer.getChronon(argOut0.getByteArray(), 1);
-                            int formatLength = (argOut1.getByteArray()[1] & 0xff << 8)
-                                    + (argOut1.getByteArray()[2] & 0xff << 0);
+                            utf8Ptr.set(argOut1.getByteArray(), 1, argOut1.getLength() - 1);
+                            int formatLength = utf8Ptr.getUTF8Length();
                             sbder.delete(0, sbder.length());
-                            DT_UTILS.printDateTime(chronon, 0, argOut1.getByteArray(), 3, formatLength, sbder,
-                                    DateTimeParseMode.TIME_ONLY);
+                            DT_UTILS.printDateTime(chronon, 0, utf8Ptr.getByteArray(), utf8Ptr.getCharStartOffset(),
+                                    formatLength, sbder, DateTimeParseMode.TIME_ONLY);
 
                             out.writeByte(ATypeTag.STRING.serialize());
-                            out.writeUTF(sbder.toString());
+                            writer.writeUTF8(sbder.toString(), out);
 
                         } catch (IOException ex) {
                             throw new AlgebricksException(ex);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/formats/NonTaggedDataFormat.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/formats/NonTaggedDataFormat.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/formats/NonTaggedDataFormat.java
index d00ad3c..ef7a6c8 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/formats/NonTaggedDataFormat.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/formats/NonTaggedDataFormat.java
@@ -166,7 +166,7 @@ import org.apache.asterix.runtime.evaluators.functions.AnyCollectionMemberDescri
 import org.apache.asterix.runtime.evaluators.functions.CastListDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.CastRecordDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.CodePointToStringDescriptor;
-import org.apache.asterix.runtime.evaluators.functions.ContainsDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.StringContainsDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.CountHashedGramTokensDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.CountHashedWordTokensDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.CreateCircleDescriptor;
@@ -182,7 +182,7 @@ import org.apache.asterix.runtime.evaluators.functions.EditDistanceDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.EditDistanceListIsFilterable;
 import org.apache.asterix.runtime.evaluators.functions.EditDistanceStringIsFilterable;
 import org.apache.asterix.runtime.evaluators.functions.EmbedTypeDescriptor;
-import org.apache.asterix.runtime.evaluators.functions.EndsWithDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.StringEndsWithDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.FlowRecordDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.FuzzyEqDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.GetItemDescriptor;
@@ -193,7 +193,7 @@ import org.apache.asterix.runtime.evaluators.functions.InjectFailureDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.IsNullDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.IsSystemNullDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.LenDescriptor;
-import org.apache.asterix.runtime.evaluators.functions.LikeDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.StringLikeDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.NotDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.NotNullDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.NumericAbsDescriptor;
@@ -223,9 +223,8 @@ import org.apache.asterix.runtime.evaluators.functions.SpatialAreaDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.SpatialCellDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.SpatialDistanceDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.SpatialIntersectDescriptor;
-import org.apache.asterix.runtime.evaluators.functions.StartsWithDescriptor;
+import org.apache.asterix.runtime.evaluators.functions.StringStartsWithDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.StringConcatDescriptor;
-import org.apache.asterix.runtime.evaluators.functions.StringEndWithDescrtiptor;
 import org.apache.asterix.runtime.evaluators.functions.StringEqualDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.StringJoinDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.StringLengthDescriptor;
@@ -234,7 +233,6 @@ import org.apache.asterix.runtime.evaluators.functions.StringMatchesDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.StringMatchesWithFlagDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.StringReplaceDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.StringReplaceWithFlagsDescriptor;
-import org.apache.asterix.runtime.evaluators.functions.StringStartWithDescrtiptor;
 import org.apache.asterix.runtime.evaluators.functions.StringToCodePointDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.StringUpperCaseDescriptor;
 import org.apache.asterix.runtime.evaluators.functions.Substring2Descriptor;
@@ -402,16 +400,12 @@ public class NonTaggedDataFormat implements IDataFormat {
         List<IFunctionDescriptorFactory> temp = new ArrayList<IFunctionDescriptorFactory>();
 
         // format-independent
-        temp.add(ContainsDescriptor.FACTORY);
-        temp.add(EndsWithDescriptor.FACTORY);
-        temp.add(StartsWithDescriptor.FACTORY);
-        temp.add(SubstringDescriptor.FACTORY);
         temp.add(TidRunningAggregateDescriptor.FACTORY);
 
         // format-dependent
         temp.add(AndDescriptor.FACTORY);
         temp.add(OrDescriptor.FACTORY);
-        temp.add(LikeDescriptor.FACTORY);
+        temp.add(StringLikeDescriptor.FACTORY);
         temp.add(ScanCollectionDescriptor.FACTORY);
         temp.add(AnyCollectionMemberDescriptor.FACTORY);
         temp.add(ClosedRecordConstructorDescriptor.FACTORY);
@@ -460,9 +454,11 @@ public class NonTaggedDataFormat implements IDataFormat {
         temp.add(FindBinaryFromDescriptor.FACTORY);
 
         // String functions
+        temp.add(StringContainsDescriptor.FACTORY);
+        temp.add(StringEndsWithDescriptor.FACTORY);
+        temp.add(StringStartsWithDescriptor.FACTORY);
+        temp.add(SubstringDescriptor.FACTORY);
         temp.add(StringEqualDescriptor.FACTORY);
-        temp.add(StringStartWithDescrtiptor.FACTORY);
-        temp.add(StringEndWithDescrtiptor.FACTORY);
         temp.add(StringMatchesDescriptor.FACTORY);
         temp.add(StringLowerCaseDescriptor.FACTORY);
         temp.add(StringUpperCaseDescriptor.FACTORY);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/file/AbstractDataParser.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/file/AbstractDataParser.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/file/AbstractDataParser.java
index 062d83c..4b10560 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/file/AbstractDataParser.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/operators/file/AbstractDataParser.java
@@ -72,8 +72,8 @@ import org.apache.asterix.om.types.BuiltinType;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.dataflow.common.data.parsers.ByteArrayBase64ParserFactory;
-import org.apache.hyracks.dataflow.common.data.parsers.ByteArrayHexParserFactory;
+import org.apache.hyracks.util.bytes.Base64Parser;
+import org.apache.hyracks.util.bytes.HexParser;
 
 /**
  * Base class for data parsers. Includes the common set of definitions for
@@ -88,7 +88,7 @@ public abstract class AbstractDataParser implements IDataParser {
     protected AMutableDouble aDouble = new AMutableDouble(0);
     protected AMutableFloat aFloat = new AMutableFloat(0);
     protected AMutableString aString = new AMutableString("");
-    protected AMutableBinary aBinary = new AMutableBinary(new byte[] {}, 0, 0);
+    protected AMutableBinary aBinary = new AMutableBinary(null, 0, 0);
     protected AMutableString aStringFieldName = new AMutableString("");
     protected AMutableUUID aUUID = new AMutableUUID(0, 0);
     // For temporal and spatial data types
@@ -105,8 +105,6 @@ public abstract class AbstractDataParser implements IDataParser {
     protected AMutableLine aLine = new AMutableLine(null, null);
     protected AMutableDate aDate = new AMutableDate(0);
 
-    private final byte[] base64ParserQuadruplet = new byte[4];
-
     // Serializers
     @SuppressWarnings("unchecked")
     protected ISerializerDeserializer<ADouble> doubleSerde = AqlSerializerDeserializerProvider.INSTANCE
@@ -114,6 +112,8 @@ public abstract class AbstractDataParser implements IDataParser {
     @SuppressWarnings("unchecked")
     protected ISerializerDeserializer<AString> stringSerde = AqlSerializerDeserializerProvider.INSTANCE
             .getSerializerDeserializer(BuiltinType.ASTRING);
+    protected ISerializerDeserializer<ABinary> binarySerde = AqlSerializerDeserializerProvider.INSTANCE
+            .getSerializerDeserializer(BuiltinType.ABINARY);
     @SuppressWarnings("unchecked")
     protected ISerializerDeserializer<AFloat> floatSerde = AqlSerializerDeserializerProvider.INSTANCE
             .getSerializerDeserializer(BuiltinType.AFLOAT);
@@ -136,6 +136,9 @@ public abstract class AbstractDataParser implements IDataParser {
     protected ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
             .getSerializerDeserializer(BuiltinType.ANULL);
 
+    protected final HexParser hexParser = new HexParser();
+    protected final Base64Parser base64Parser = new Base64Parser();
+
     // For UUID, we assume that the format is the string representation of UUID
     // (xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx) when parsing the data.
     // Thus, we need to call UUID.fromStringToAMuatbleUUID() to convert it to the internal representation (two long values).
@@ -144,6 +147,7 @@ public abstract class AbstractDataParser implements IDataParser {
             .getSerializerDeserializer(BuiltinType.AUUID);
 
     // To avoid race conditions, the serdes for temporal and spatial data types needs to be one per parser
+    // ^^^^^^^^^^^^^^^^^^^^^^^^ ??? then why all these serdes are static?
     @SuppressWarnings("unchecked")
     protected static final ISerializerDeserializer<ATime> timeSerde = AqlSerializerDeserializerProvider.INSTANCE
             .getSerializerDeserializer(BuiltinType.ATIME);
@@ -177,9 +181,6 @@ public abstract class AbstractDataParser implements IDataParser {
     @SuppressWarnings("unchecked")
     protected final static ISerializerDeserializer<ALine> lineSerde = AqlSerializerDeserializerProvider.INSTANCE
             .getSerializerDeserializer(BuiltinType.ALINE);
-    @SuppressWarnings("unchecked")
-    protected final static ISerializerDeserializer<ABinary> binarySerde = AqlSerializerDeserializerProvider.INSTANCE
-            .getSerializerDeserializer(BuiltinType.ABINARY);
 
     protected String filename;
 
@@ -339,17 +340,15 @@ public abstract class AbstractDataParser implements IDataParser {
 
     protected void parseHexBinaryString(char[] input, int start, int length, DataOutput out)
             throws HyracksDataException {
-        byte[] newBytes = ByteArrayHexParserFactory.extractPointableArrayFromHexString(input, start, length,
-                aBinary.getBytes());
-        aBinary.setValue(newBytes, 0, newBytes.length);
+        hexParser.generateByteArrayFromHexString(input, start, length);
+        aBinary.setValue(hexParser.getByteArray(), 0, hexParser.getLength());
         binarySerde.serialize(aBinary, out);
     }
 
     protected void parseBase64BinaryString(char[] input, int start, int length, DataOutput out)
             throws HyracksDataException {
-        byte[] newBytes = ByteArrayBase64ParserFactory.extractPointableArrayFromBase64String(input, start, length,
-                aBinary.getBytes(), base64ParserQuadruplet);
-        aBinary.setValue(newBytes, 0, newBytes.length);
+        base64Parser.generatePureByteArrayFromBase64String(input, start, length);
+        aBinary.setValue(base64Parser.getByteArray(), 0, base64Parser.getLength());
         binarySerde.serialize(aBinary, out);
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-tools/src/main/java/org/apache/asterix/tools/external/data/ExternalFilesIndexOperatorDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-tools/src/main/java/org/apache/asterix/tools/external/data/ExternalFilesIndexOperatorDescriptor.java b/asterix-tools/src/main/java/org/apache/asterix/tools/external/data/ExternalFilesIndexOperatorDescriptor.java
index ffa99fd..f4b3392 100644
--- a/asterix-tools/src/main/java/org/apache/asterix/tools/external/data/ExternalFilesIndexOperatorDescriptor.java
+++ b/asterix-tools/src/main/java/org/apache/asterix/tools/external/data/ExternalFilesIndexOperatorDescriptor.java
@@ -66,8 +66,8 @@ public class ExternalFilesIndexOperatorDescriptor extends AbstractTreeIndexOpera
             IFileSplitProvider fileSplitProvider, IIndexDataflowHelperFactory dataflowHelperFactory,
             ILocalResourceFactoryProvider localResourceFactoryProvider, List<ExternalFile> files, boolean createNewIndex) {
         super(spec, 0, 0, null, storageManager, lifecycleManagerProvider, fileSplitProvider,
-                FilesIndexDescription.EXTERNAL_FILE_INDEX_TYPE_TRAITS,
-                FilesIndexDescription.FILES_INDEX_COMP_FACTORIES, FilesIndexDescription.BLOOM_FILTER_FIELDS,
+                new FilesIndexDescription().EXTERNAL_FILE_INDEX_TYPE_TRAITS,
+                new FilesIndexDescription().FILES_INDEX_COMP_FACTORIES, FilesIndexDescription.BLOOM_FILTER_FIELDS,
                 dataflowHelperFactory, null, false, false, null, localResourceFactoryProvider,
                 NoOpOperationCallbackFactory.INSTANCE, NoOpOperationCallbackFactory.INSTANCE);
         this.createNewIndex = createNewIndex;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 71c2b2c..9f02d63 100644
--- a/pom.xml
+++ b/pom.xml
@@ -481,11 +481,21 @@
             </dependency>
             <dependency>
                 <groupId>org.apache.hyracks</groupId>
+                <artifactId>hyracks-util</artifactId>
+                <version>${hyracks.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.hyracks</groupId>
                 <artifactId>hyracks-dataflow-std</artifactId>
                 <version>${hyracks.version}</version>
             </dependency>
             <dependency>
                 <groupId>org.apache.hyracks</groupId>
+                <artifactId>hyracks-data</artifactId>
+                <version>${hyracks.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.hyracks</groupId>
                 <artifactId>hyracks-control-cc</artifactId>
                 <version>${hyracks.version}</version>
             </dependency>



[06/15] incubator-asterixdb git commit: ASTERIXDB-1102: VarSize Encoding to store length of String and ByteArray

Posted by ji...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ABinaryBase64Printer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ABinaryBase64Printer.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ABinaryBase64Printer.java
index fd1d595..01c2202 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ABinaryBase64Printer.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ABinaryBase64Printer.java
@@ -19,133 +19,35 @@
 
 package org.apache.asterix.dataflow.data.nontagged.printers.adm;
 
-import org.apache.asterix.dataflow.data.nontagged.serde.ABinarySerializerDeserializer;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.data.IPrinter;
-
 import java.io.IOException;
 import java.io.PrintStream;
 
+import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.algebricks.data.IPrinter;
+import org.apache.hyracks.data.std.primitive.ByteArrayPointable;
+import org.apache.hyracks.util.bytes.Base64Printer;
+
 public class ABinaryBase64Printer implements IPrinter {
     private ABinaryBase64Printer() {
     }
 
     public static final ABinaryBase64Printer INSTANCE = new ABinaryBase64Printer();
 
-    @Override public void init() throws AlgebricksException {
-
+    @Override
+    public void init() throws AlgebricksException {
     }
 
-    @Override public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
-        int validLength = ABinarySerializerDeserializer.getLength(b, s + 1);
-        int start = s + 1 + ABinarySerializerDeserializer.SIZE_OF_LENGTH;
+    @Override
+    public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
+        int validLength = ByteArrayPointable.getContentLength(b, s + 1);
+        int start = s + 1 + ByteArrayPointable.getNumberBytesToStoreMeta(validLength);
         try {
             ps.print("base64(\"");
-            printBase64Binary(b, start, validLength, ps);
+            Base64Printer.printBase64Binary(b, start, validLength, ps);
             ps.print("\")");
         } catch (IOException e) {
             throw new AlgebricksException(e);
         }
     }
 
-    /**
-     * Encodes a byte array into a {@code Appendable} stream by doing base64 encoding.
-     *
-     * @return the same stream in purpose of chained process.
-     */
-    public static Appendable printBase64Binary(byte[] input, int offset, int len, Appendable appendable)
-            throws IOException {
-        // encode elements until only 1 or 2 elements are left to encode
-        int remaining = len;
-        int i;
-        for (i = offset; remaining >= 3; remaining -= 3, i += 3) {
-            appendable.append(encode(input[i] >> 2));
-            appendable.append(encode(
-                    ((input[i] & 0x3) << 4)
-                            | ((input[i + 1] >> 4) & 0xF)));
-            appendable.append(encode(
-                    ((input[i + 1] & 0xF) << 2)
-                            | ((input[i + 2] >> 6) & 0x3)));
-            appendable.append(encode(input[i + 2] & 0x3F));
-        }
-        // encode when exactly 1 element (left) to encode
-        if (remaining == 1) {
-            appendable.append(encode(input[i] >> 2));
-            appendable.append(encode(((input[i]) & 0x3) << 4));
-            appendable.append('=');
-            appendable.append('=');
-        }
-        // encode when exactly 2 elements (left) to encode
-        if (remaining == 2) {
-            appendable.append(encode(input[i] >> 2));
-            appendable.append(encode(((input[i] & 0x3) << 4)
-                    | ((input[i + 1] >> 4) & 0xF)));
-            appendable.append(encode((input[i + 1] & 0xF) << 2));
-            appendable.append('=');
-        }
-        return appendable;
-    }
-
-    /**
-     * Encodes a byte array into a char array by doing base64 encoding.
-     * The caller must supply a big enough buffer.
-     *
-     * @return the value of {@code ptr+((len+2)/3)*4}, which is the new offset
-     * in the output buffer where the further bytes should be placed.
-     */
-    public static int printBase64Binary(byte[] input, int offset, int len, char[] buf, int ptr) {
-        // encode elements until only 1 or 2 elements are left to encode
-        int remaining = len;
-        int i;
-        for (i = offset; remaining >= 3; remaining -= 3, i += 3) {
-            buf[ptr++] = encode(input[i] >> 2);
-            buf[ptr++] = encode(
-                    ((input[i] & 0x3) << 4)
-                            | ((input[i + 1] >> 4) & 0xF));
-            buf[ptr++] = encode(
-                    ((input[i + 1] & 0xF) << 2)
-                            | ((input[i + 2] >> 6) & 0x3));
-            buf[ptr++] = encode(input[i + 2] & 0x3F);
-        }
-        // encode when exactly 1 element (left) to encode
-        if (remaining == 1) {
-            buf[ptr++] = encode(input[i] >> 2);
-            buf[ptr++] = encode(((input[i]) & 0x3) << 4);
-            buf[ptr++] = '=';
-            buf[ptr++] = '=';
-        }
-        // encode when exactly 2 elements (left) to encode
-        if (remaining == 2) {
-            buf[ptr++] = encode(input[i] >> 2);
-            buf[ptr++] = encode(((input[i] & 0x3) << 4)
-                    | ((input[i + 1] >> 4) & 0xF));
-            buf[ptr++] = encode((input[i + 1] & 0xF) << 2);
-            buf[ptr++] = '=';
-        }
-        return ptr;
-    }
-
-    private static final char[] encodeMap = initEncodeMap();
-
-    private static char[] initEncodeMap() {
-        char[] map = new char[64];
-        int i;
-        for (i = 0; i < 26; i++) {
-            map[i] = (char) ('A' + i);
-        }
-        for (i = 26; i < 52; i++) {
-            map[i] = (char) ('a' + (i - 26));
-        }
-        for (i = 52; i < 62; i++) {
-            map[i] = (char) ('0' + (i - 52));
-        }
-        map[62] = '+';
-        map[63] = '/';
-
-        return map;
-    }
-
-    public static char encode(int i) {
-        return encodeMap[i & 0x3F];
-    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ABinaryHexPrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ABinaryHexPrinter.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ABinaryHexPrinter.java
index b9f9750..a997be4 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ABinaryHexPrinter.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/ABinaryHexPrinter.java
@@ -19,33 +19,35 @@
 
 package org.apache.asterix.dataflow.data.nontagged.printers.adm;
 
-import org.apache.asterix.dataflow.data.nontagged.printers.PrintTools;
-import org.apache.asterix.dataflow.data.nontagged.serde.ABinarySerializerDeserializer;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.data.IPrinter;
-
 import java.io.IOException;
 import java.io.PrintStream;
 
+import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.algebricks.data.IPrinter;
+import org.apache.hyracks.data.std.primitive.ByteArrayPointable;
+import org.apache.hyracks.util.bytes.HexPrinter;
+
 public class ABinaryHexPrinter implements IPrinter {
     private ABinaryHexPrinter() {
     }
 
     public static final ABinaryHexPrinter INSTANCE = new ABinaryHexPrinter();
 
-    @Override public void init() throws AlgebricksException {
-
+    @Override
+    public void init() throws AlgebricksException {
     }
 
-    @Override public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
-        int validLength = ABinarySerializerDeserializer.getLength(b, s + 1);
-        int start = s + 1 + ABinarySerializerDeserializer.SIZE_OF_LENGTH;
+    @Override
+    public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
+        int validLength = ByteArrayPointable.getContentLength(b, s + 1);
+        int start = s + 1 + ByteArrayPointable.getNumberBytesToStoreMeta(validLength);
         try {
             ps.print("hex(\"");
-            PrintTools.printHexString(b, start, validLength, ps);
+            HexPrinter.printHexString(b, start, validLength, ps);
             ps.print("\")");
         } catch (IOException e) {
             throw new AlgebricksException(e);
         }
     }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AInt16Printer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AInt16Printer.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AInt16Printer.java
index 9076750..6ac3dd1 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AInt16Printer.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AInt16Printer.java
@@ -32,20 +32,6 @@ import org.apache.hyracks.data.std.util.ByteArrayAccessibleOutputStream;
 public class AInt16Printer implements IPrinter {
 
     private static final String SUFFIX_STRING = "i16";
-    private static byte[] _suffix;
-    private static int _suffix_count;
-    static {
-        ByteArrayAccessibleOutputStream interm = new ByteArrayAccessibleOutputStream();
-        DataOutput dout = new DataOutputStream(interm);
-        try {
-            dout.writeUTF(SUFFIX_STRING);
-            interm.close();
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-        _suffix = interm.getByteArray();
-        _suffix_count = interm.size();
-    }
 
     public static final AInt16Printer INSTANCE = new AInt16Printer();
 
@@ -59,7 +45,7 @@ public class AInt16Printer implements IPrinter {
         short i = AInt16SerializerDeserializer.getShort(b, s + 1);
         try {
             WriteValueTools.writeInt(i, ps);
-            WriteValueTools.writeUTF8StringNoQuotes(_suffix, 0, _suffix_count, ps);
+            WriteValueTools.writeUTF8StringNoQuotes(SUFFIX_STRING, ps);
         } catch (IOException e) {
             throw new AlgebricksException(e);
         }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AInt32Printer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AInt32Printer.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AInt32Printer.java
index 036d16d..240f68c 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AInt32Printer.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AInt32Printer.java
@@ -32,20 +32,6 @@ import org.apache.hyracks.data.std.util.ByteArrayAccessibleOutputStream;
 public class AInt32Printer implements IPrinter {
 
     private static final String SUFFIX_STRING = "i32";
-    private static byte[] _suffix;
-    private static int _suffix_count;
-    static {
-        ByteArrayAccessibleOutputStream interm = new ByteArrayAccessibleOutputStream();
-        DataOutput dout = new DataOutputStream(interm);
-        try {
-            dout.writeUTF(SUFFIX_STRING);
-            interm.close();
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-        _suffix = interm.getByteArray();
-        _suffix_count = interm.size();
-    }
 
     public static final AInt32Printer INSTANCE = new AInt32Printer();
 
@@ -58,7 +44,7 @@ public class AInt32Printer implements IPrinter {
         int d = AInt32SerializerDeserializer.getInt(b, s + 1);
         try {
             WriteValueTools.writeInt(d, ps);
-            WriteValueTools.writeUTF8StringNoQuotes(_suffix, 0, _suffix_count, ps);
+            WriteValueTools.writeUTF8StringNoQuotes(SUFFIX_STRING, ps);
         } catch (IOException e) {
             throw new AlgebricksException(e);
         }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AInt8Printer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AInt8Printer.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AInt8Printer.java
index 38eb91e..b74a177 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AInt8Printer.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/adm/AInt8Printer.java
@@ -32,20 +32,6 @@ import org.apache.hyracks.data.std.util.ByteArrayAccessibleOutputStream;
 public class AInt8Printer implements IPrinter {
 
     private static final String SUFFIX_STRING = "i8";
-    private static byte[] _suffix;
-    private static int _suffix_count;
-    static {
-        ByteArrayAccessibleOutputStream interm = new ByteArrayAccessibleOutputStream();
-        DataOutput dout = new DataOutputStream(interm);
-        try {
-            dout.writeUTF(SUFFIX_STRING);
-            interm.close();
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-        _suffix = interm.getByteArray();
-        _suffix_count = interm.size();
-    }
 
     public static final AInt8Printer INSTANCE = new AInt8Printer();
 
@@ -59,7 +45,7 @@ public class AInt8Printer implements IPrinter {
         byte o = AInt8SerializerDeserializer.getByte(b, s + 1);
         try {
             WriteValueTools.writeInt(o, ps);
-            WriteValueTools.writeUTF8StringNoQuotes(_suffix, 0, _suffix_count, ps);
+            WriteValueTools.writeUTF8StringNoQuotes(SUFFIX_STRING, ps);
         } catch (IOException e) {
             throw new AlgebricksException(e);
         }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ABinaryHexPrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ABinaryHexPrinter.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ABinaryHexPrinter.java
index 8cf5e3e..f298af6 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ABinaryHexPrinter.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/csv/ABinaryHexPrinter.java
@@ -23,6 +23,8 @@ import org.apache.asterix.dataflow.data.nontagged.printers.PrintTools;
 import org.apache.asterix.dataflow.data.nontagged.serde.ABinarySerializerDeserializer;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.data.IPrinter;
+import org.apache.hyracks.data.std.primitive.ByteArrayPointable;
+import org.apache.hyracks.util.bytes.HexPrinter;
 
 import java.io.IOException;
 import java.io.PrintStream;
@@ -38,10 +40,10 @@ public class ABinaryHexPrinter implements IPrinter {
     }
 
     @Override public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
-        int validLength = ABinarySerializerDeserializer.getLength(b, s + 1);
-        int start = s + 1 + ABinarySerializerDeserializer.SIZE_OF_LENGTH;
+        int validLength = ByteArrayPointable.getContentLength(b, s + 1);
+        int start = s + 1 + ByteArrayPointable.getNumberBytesToStoreMeta(validLength);
         try {
-            PrintTools.printHexString(b, start, validLength, ps);
+            HexPrinter.printHexString(b, start, validLength, ps);
         } catch (IOException e) {
             throw new AlgebricksException(e);
         }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ABinaryHexPrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ABinaryHexPrinter.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ABinaryHexPrinter.java
index 97f5203..01647c6 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ABinaryHexPrinter.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/clean/ABinaryHexPrinter.java
@@ -23,6 +23,8 @@ import org.apache.asterix.dataflow.data.nontagged.printers.PrintTools;
 import org.apache.asterix.dataflow.data.nontagged.serde.ABinarySerializerDeserializer;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.data.IPrinter;
+import org.apache.hyracks.data.std.primitive.ByteArrayPointable;
+import org.apache.hyracks.util.bytes.HexPrinter;
 
 import java.io.IOException;
 import java.io.PrintStream;
@@ -38,11 +40,12 @@ public class ABinaryHexPrinter implements IPrinter {
     }
 
     @Override public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
-        int validLength = ABinarySerializerDeserializer.getLength(b, s + 1);
-        int start = s + 1 + ABinarySerializerDeserializer.SIZE_OF_LENGTH;
+
+        int validLength = ByteArrayPointable.getContentLength(b, s + 1);
+        int start = s + 1 + ByteArrayPointable.getNumberBytesToStoreMeta(validLength);
         try {
             ps.print("\"");
-            PrintTools.printHexString(b, start, validLength, ps);
+            HexPrinter.printHexString(b, start, validLength, ps);
             ps.print("\"");
         } catch (IOException e) {
             throw new AlgebricksException(e);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/lossless/ABinaryHexPrinter.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/lossless/ABinaryHexPrinter.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/lossless/ABinaryHexPrinter.java
index af84be7..4698c49 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/lossless/ABinaryHexPrinter.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/json/lossless/ABinaryHexPrinter.java
@@ -23,6 +23,8 @@ import org.apache.asterix.dataflow.data.nontagged.printers.PrintTools;
 import org.apache.asterix.dataflow.data.nontagged.serde.ABinarySerializerDeserializer;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.data.IPrinter;
+import org.apache.hyracks.data.std.primitive.ByteArrayPointable;
+import org.apache.hyracks.util.bytes.HexPrinter;
 
 import java.io.IOException;
 import java.io.PrintStream;
@@ -38,11 +40,11 @@ public class ABinaryHexPrinter implements IPrinter {
     }
 
     @Override public void print(byte[] b, int s, int l, PrintStream ps) throws AlgebricksException {
-        int validLength = ABinarySerializerDeserializer.getLength(b, s + 1);
-        int start = s + 1 + ABinarySerializerDeserializer.SIZE_OF_LENGTH;
+        int validLength = ByteArrayPointable.getContentLength(b, s + 1);
+        int start = s + 1 + ByteArrayPointable.getNumberBytesToStoreMeta(validLength);
         try {
             ps.print("\"");
-            PrintTools.printHexString(b, start, validLength, ps);
+            HexPrinter.printHexString(b, start, validLength, ps);
             ps.print("\"");
         } catch (IOException e) {
             throw new AlgebricksException(e);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ABinarySerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ABinarySerializerDeserializer.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ABinarySerializerDeserializer.java
index 4014b6e..3bde3b3 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ABinarySerializerDeserializer.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ABinarySerializerDeserializer.java
@@ -19,41 +19,30 @@
 
 package org.apache.asterix.dataflow.data.nontagged.serde;
 
+import java.io.DataInput;
+import java.io.DataOutput;
+
 import org.apache.asterix.om.base.ABinary;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.primitive.ByteArrayPointable;
 import org.apache.hyracks.dataflow.common.data.marshalling.ByteArraySerializerDeserializer;
 
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-public class ABinarySerializerDeserializer implements ISerializerDeserializer<ABinary>{
+public class ABinarySerializerDeserializer implements ISerializerDeserializer<ABinary> {
 
     private static final long serialVersionUID = 1L;
-    public static final int SIZE_OF_LENGTH = ByteArrayPointable.SIZE_OF_LENGTH;
 
-    public static final ABinarySerializerDeserializer INSTANCE = new ABinarySerializerDeserializer();
+    public ABinarySerializerDeserializer() {}
 
-    private ABinarySerializerDeserializer(){}
+    private ByteArraySerializerDeserializer byteArrayPtrSerDer = new ByteArraySerializerDeserializer();
 
     @Override
     public ABinary deserialize(DataInput in) throws HyracksDataException {
-        return new ABinary(ByteArraySerializerDeserializer.INSTANCE.deserialize(in));
+        return new ABinary(byteArrayPtrSerDer.deserialize(in));
     }
 
     @Override
     public void serialize(ABinary binary, DataOutput out) throws HyracksDataException {
-        ByteArraySerializerDeserializer.INSTANCE.serialize(binary.getBytes(), binary.getStart(),
-                binary.getLength() , out);
-    }
-
-    public static int getLength(byte [] bytes, int offset){
-        return ByteArrayPointable.getLength(bytes,offset);
+        byteArrayPtrSerDer.serialize(binary.getBytes(), binary.getStart(), binary.getLength(), out);
     }
 
-    public static void putLength(int length, byte [] bytes, int offset){
-        ByteArrayPointable.putLength(length, bytes, offset);
-    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AObjectSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AObjectSerializerDeserializer.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AObjectSerializerDeserializer.java
index 80ac99c..ca2557a 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AObjectSerializerDeserializer.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AObjectSerializerDeserializer.java
@@ -57,9 +57,18 @@ public class AObjectSerializerDeserializer implements ISerializerDeserializer<IA
 
     private static final long serialVersionUID = 1L;
 
-    public static final AObjectSerializerDeserializer INSTANCE = new AObjectSerializerDeserializer();
+    private final AStringSerializerDeserializer aStringSerDer = new AStringSerializerDeserializer();
+    private final ABinarySerializerDeserializer aBinarySerDer = new ABinarySerializerDeserializer();
+    private ARecordSerializerDeserializer aRecordSerDer = null;
 
-    private AObjectSerializerDeserializer() {
+    private ARecordSerializerDeserializer getRecordSerDer() {
+        if (aRecordSerDer == null) {
+            aRecordSerDer = ARecordSerializerDeserializer.CREATE_SCHEMALESS_INSTANCE();
+        }
+        return aRecordSerDer;
+    }
+
+    public AObjectSerializerDeserializer() {
     }
 
     @Override
@@ -91,10 +100,10 @@ public class AObjectSerializerDeserializer implements ISerializerDeserializer<IA
                 return ADoubleSerializerDeserializer.INSTANCE.deserialize(in);
             }
             case STRING: {
-                return AStringSerializerDeserializer.INSTANCE.deserialize(in);
+                return aStringSerDer.deserialize(in);
             }
             case BINARY: {
-                return ABinarySerializerDeserializer.INSTANCE.deserialize(in);
+                return aBinarySerDer.deserialize(in);
             }
             case DATE: {
                 return ADateSerializerDeserializer.INSTANCE.deserialize(in);
@@ -136,7 +145,7 @@ public class AObjectSerializerDeserializer implements ISerializerDeserializer<IA
                 return ACircleSerializerDeserializer.INSTANCE.deserialize(in);
             }
             case RECORD: {
-                return ARecordSerializerDeserializer.SCHEMALESS_INSTANCE.deserialize(in);
+                return getRecordSerDer().deserialize(in);
             }
             case ORDEREDLIST: {
                 return AOrderedListSerializerDeserializer.SCHEMALESS_INSTANCE.deserialize(in);
@@ -196,11 +205,11 @@ public class AObjectSerializerDeserializer implements ISerializerDeserializer<IA
                 break;
             }
             case STRING: {
-                AStringSerializerDeserializer.INSTANCE.serialize((AString) instance, out);
+                aStringSerDer.serialize((AString) instance, out);
                 break;
             }
             case BINARY: {
-                ABinarySerializerDeserializer.INSTANCE.serialize((ABinary) instance, out);
+                aBinarySerDer.serialize((ABinary) instance, out);
             }
             case DATE: {
                 ADateSerializerDeserializer.INSTANCE.serialize((ADate) instance, out);
@@ -247,7 +256,7 @@ public class AObjectSerializerDeserializer implements ISerializerDeserializer<IA
                 break;
             }
             case RECORD: {
-                ARecordSerializerDeserializer.SCHEMALESS_INSTANCE.serialize((ARecord) instance, out);
+                getRecordSerDer().serialize((ARecord) instance, out);
                 break;
             }
             case ORDEREDLIST: {

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ARecordSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ARecordSerializerDeserializer.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ARecordSerializerDeserializer.java
index a0de782..801907c 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ARecordSerializerDeserializer.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/ARecordSerializerDeserializer.java
@@ -42,13 +42,24 @@ import org.apache.hyracks.api.dataflow.value.IBinaryComparator;
 import org.apache.hyracks.api.dataflow.value.IBinaryHashFunction;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
+import org.apache.hyracks.util.string.UTF8StringUtil;
 
 public class ARecordSerializerDeserializer implements ISerializerDeserializer<ARecord> {
     private static final long serialVersionUID = 1L;
 
-    public static final ARecordSerializerDeserializer SCHEMALESS_INSTANCE = new ARecordSerializerDeserializer();
+    public static final ARecordSerializerDeserializer CREATE_SCHEMALESS_INSTANCE() {
+        return new ARecordSerializerDeserializer();
+    }
+
+    private final AStringSerializerDeserializer aStringSerDer = new AStringSerializerDeserializer();
+    private AObjectSerializerDeserializer aObjSerDer = null;
+    private AObjectSerializerDeserializer getObjSerDer() {
+        if (aObjSerDer == null){
+            aObjSerDer = new AObjectSerializerDeserializer();
+        }
+        return aObjSerDer;
+    }
 
     private ARecordType recordType;
     private int numberOfSchemaFields = 0;
@@ -139,8 +150,8 @@ public class ARecordSerializerDeserializer implements ISerializerDeserializer<AR
                     in.readInt();
                 }
                 for (int i = 0; i < numberOfOpenFields; i++) {
-                    fieldNames[i] = AStringSerializerDeserializer.INSTANCE.deserialize(in).getStringValue();
-                    openFields[i] = AObjectSerializerDeserializer.INSTANCE.deserialize(in);
+                    fieldNames[i] = aStringSerDer.deserialize(in).getStringValue();
+                    openFields[i] = getObjSerDer().deserialize(in);
                     fieldTypes[i] = openFields[i].getType();
                 }
                 ARecordType openPartRecType = new ARecordType(null, fieldNames, fieldTypes, true);
@@ -288,7 +299,8 @@ public class ARecordSerializerDeserializer implements ISerializerDeserializer<AR
             return -1; // this record does not have an open part
 
         int numberOfOpenField = AInt32SerializerDeserializer.getInt(serRecord, openPartOffset);
-        int utflength = UTF8StringPointable.getUTFLength(fieldName, 1);
+        int fieldUtflength = UTF8StringUtil.getUTFLength(fieldName, 1);
+        int fieldUtfMetaLen = UTF8StringUtil.getNumBytesToStoreLength(fieldUtflength);
 
         IBinaryHashFunction utf8HashFunction = AqlBinaryHashFunctionFactoryProvider.UTF8STRING_POINTABLE_INSTANCE
                 .createBinaryHashFunction();
@@ -296,34 +308,33 @@ public class ARecordSerializerDeserializer implements ISerializerDeserializer<AR
         IBinaryComparator utf8BinaryComparator = AqlBinaryComparatorFactoryProvider.UTF8STRING_POINTABLE_INSTANCE
                 .createBinaryComparator();
 
-        int fieldNameHashCode = utf8HashFunction.hash(fieldName, 1, utflength);
+        int fieldNameHashCode = utf8HashFunction.hash(fieldName, 1, fieldUtflength + fieldUtfMetaLen);
 
         int offset = openPartOffset + 4;
         int fieldOffset = -1;
-        short recordFieldNameLength = 0;
         int mid = 0;
         int high = numberOfOpenField - 1;
         int low = 0;
         while (low <= high) {
             mid = (high + low) / 2;
-            // 8 = hash code (4) + offset to the (name + tag + value ) of the
-            // field (4).
+            // 8 = hash code (4) + offset to the (name + tag + value ) of the field (4).
             int h = AInt32SerializerDeserializer.getInt(serRecord, offset + (8 * mid));
             if (h == fieldNameHashCode) {
                 fieldOffset = AInt32SerializerDeserializer.getInt(serRecord, offset + (8 * mid) + 4);
-                recordFieldNameLength = AInt16SerializerDeserializer.getShort(serRecord, fieldOffset);
+                // the utf8 comparator do not require to put the precise length, we can just pass a estimated limit.
                 if (utf8BinaryComparator
-                        .compare(serRecord, fieldOffset, recordFieldNameLength, fieldName, 1, utflength) == 0)
-                    return fieldOffset + 2 + utflength;
+                        .compare(serRecord, fieldOffset, serRecord.length,
+                                fieldName, 1, fieldUtflength + fieldUtfMetaLen) == 0)
+                    // since they are equal, we can directly use the meta length and the utf length.
+                    return fieldOffset + fieldUtfMetaLen + fieldUtflength;
                 else { // this else part has not been tested yet
                     for (int j = mid + 1; j < numberOfOpenField; j++) {
                         h = AInt32SerializerDeserializer.getInt(serRecord, offset + (8 * j));
                         if (h == fieldNameHashCode) {
                             fieldOffset = AInt32SerializerDeserializer.getInt(serRecord, offset + (8 * j) + 4);
-                            recordFieldNameLength = AInt16SerializerDeserializer.getShort(serRecord, fieldOffset);
-                            if (utf8BinaryComparator.compare(serRecord, fieldOffset, recordFieldNameLength, fieldName,
-                                    1, utflength) == 0)
-                                return fieldOffset + 2 + utflength;
+                            if (utf8BinaryComparator.compare(serRecord, fieldOffset, serRecord.length, fieldName,
+                                    1, fieldUtflength) == 0)
+                                return fieldOffset + fieldUtfMetaLen + fieldUtflength;
                         } else
                             break;
                     }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AStringSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AStringSerializerDeserializer.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AStringSerializerDeserializer.java
index 53b3f28..272b36f 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AStringSerializerDeserializer.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AStringSerializerDeserializer.java
@@ -31,15 +31,14 @@ public class AStringSerializerDeserializer implements ISerializerDeserializer<AS
 
     private static final long serialVersionUID = 1L;
 
-    public static final AStringSerializerDeserializer INSTANCE = new AStringSerializerDeserializer();
+    private final UTF8StringSerializerDeserializer utf8SerDer = new UTF8StringSerializerDeserializer();
 
-    private AStringSerializerDeserializer() {
-    }
+    public AStringSerializerDeserializer() {}
 
     @Override
     public AString deserialize(DataInput in) throws HyracksDataException {
         try {
-            return new AString(UTF8StringSerializerDeserializer.INSTANCE.deserialize(in));
+            return new AString(utf8SerDer.deserialize(in));
         } catch (IOException e) {
             throw new HyracksDataException(e);
         }
@@ -48,7 +47,7 @@ public class AStringSerializerDeserializer implements ISerializerDeserializer<AS
     @Override
     public void serialize(AString instance, DataOutput out) throws HyracksDataException {
         try {
-            UTF8StringSerializerDeserializer.INSTANCE.serialize(instance.getStringValue(), out);
+            utf8SerDer.serialize(instance.getStringValue(), out);
         } catch (IOException e) {
             throw new HyracksDataException(e);
         }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AUUIDStringSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AUUIDStringSerializerDeserializer.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AUUIDStringSerializerDeserializer.java
index 3c4df08..63c29a8 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AUUIDStringSerializerDeserializer.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/serde/AUUIDStringSerializerDeserializer.java
@@ -42,7 +42,7 @@ public class AUUIDStringSerializerDeserializer implements ISerializerDeserialize
     @Override
     public AUUID deserialize(DataInput in) throws HyracksDataException {
         try {
-            return AUUID.fromString(new String(UTF8StringSerializerDeserializer.INSTANCE.deserialize(in)));
+            return AUUID.fromString(new String(new UTF8StringSerializerDeserializer().deserialize(in)));
         } catch (IOException e) {
             throw new HyracksDataException(e);
         }
@@ -52,7 +52,7 @@ public class AUUIDStringSerializerDeserializer implements ISerializerDeserialize
     @Override
     public void serialize(AUUID instance, DataOutput out) throws HyracksDataException {
         try {
-            UTF8StringSerializerDeserializer.INSTANCE.serialize(instance.toStringLiteralOnly(), out);
+            new UTF8StringSerializerDeserializer().serialize(instance.toStringLiteralOnly(), out);
         } catch (IOException e) {
             throw new HyracksDataException(e);
         }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryComparatorFactoryProvider.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryComparatorFactoryProvider.java b/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryComparatorFactoryProvider.java
index 8e1b2b3..8f43a17 100644
--- a/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryComparatorFactoryProvider.java
+++ b/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryComparatorFactoryProvider.java
@@ -49,6 +49,7 @@ import org.apache.hyracks.data.std.primitive.IntegerPointable;
 import org.apache.hyracks.data.std.primitive.LongPointable;
 import org.apache.hyracks.data.std.primitive.RawUTF8StringPointable;
 import org.apache.hyracks.data.std.primitive.ShortPointable;
+import org.apache.hyracks.data.std.primitive.UTF8StringLowercasePointable;
 
 public class AqlBinaryComparatorFactoryProvider implements IBinaryComparatorFactoryProvider, Serializable {
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryHashFunctionFactoryProvider.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryHashFunctionFactoryProvider.java b/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryHashFunctionFactoryProvider.java
index 054047c..8cfe51e 100644
--- a/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryHashFunctionFactoryProvider.java
+++ b/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryHashFunctionFactoryProvider.java
@@ -29,6 +29,7 @@ import org.apache.hyracks.data.std.primitive.DoublePointable;
 import org.apache.hyracks.data.std.primitive.FloatPointable;
 import org.apache.hyracks.data.std.primitive.IntegerPointable;
 import org.apache.hyracks.data.std.primitive.RawUTF8StringPointable;
+import org.apache.hyracks.data.std.primitive.UTF8StringLowercasePointable;
 
 public class AqlBinaryHashFunctionFactoryProvider implements IBinaryHashFunctionFactoryProvider, Serializable {
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryTokenizerFactoryProvider.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryTokenizerFactoryProvider.java b/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryTokenizerFactoryProvider.java
index 60e9101..e73f769 100644
--- a/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryTokenizerFactoryProvider.java
+++ b/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlBinaryTokenizerFactoryProvider.java
@@ -26,6 +26,7 @@ import org.apache.asterix.om.types.ATypeTag;
 import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.DelimitedUTF8StringBinaryTokenizerFactory;
 import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.HashedUTF8WordTokenFactory;
 import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.IBinaryTokenizerFactory;
+import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.NGramUTF8StringBinaryTokenizerFactory;
 import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.UTF8NGramTokenFactory;
 import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.UTF8WordTokenFactory;
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlSerializerDeserializerProvider.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlSerializerDeserializerProvider.java b/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlSerializerDeserializerProvider.java
index c3996b4..910f633 100644
--- a/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlSerializerDeserializerProvider.java
+++ b/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/AqlSerializerDeserializerProvider.java
@@ -84,7 +84,7 @@ public class AqlSerializerDeserializerProvider implements ISerializerDeserialize
         switch (aqlType.getTypeTag()) {
             case ANY:
             case UNION: { // we could do smth better for nullable fields
-                return AObjectSerializerDeserializer.INSTANCE;
+                return new AObjectSerializerDeserializer();
             }
             default: {
                 return addTag(getNonTaggedSerializerDeserializer(aqlType), aqlType.getTypeTag());
@@ -132,10 +132,10 @@ public class AqlSerializerDeserializerProvider implements ISerializerDeserialize
                 return ANullSerializerDeserializer.INSTANCE;
             }
             case STRING: {
-                return AStringSerializerDeserializer.INSTANCE;
+                return new AStringSerializerDeserializer();
             }
             case BINARY: {
-                return ABinarySerializerDeserializer.INSTANCE;
+                return new ABinarySerializerDeserializer();
             }
             case TIME: {
                 return ATimeSerializerDeserializer.INSTANCE;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/NGramUTF8StringBinaryTokenizerFactory.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/NGramUTF8StringBinaryTokenizerFactory.java b/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/NGramUTF8StringBinaryTokenizerFactory.java
deleted file mode 100644
index 968ff1b..0000000
--- a/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/NGramUTF8StringBinaryTokenizerFactory.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.asterix.formats.nontagged;
-
-import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.IBinaryTokenizer;
-import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.IBinaryTokenizerFactory;
-import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.ITokenFactory;
-import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.NGramUTF8StringBinaryTokenizer;
-
-// TODO: Should be moved into Hyracks with the rest of the tokenizer code.
-public class NGramUTF8StringBinaryTokenizerFactory implements IBinaryTokenizerFactory {
-
-    private static final long serialVersionUID = 1L;
-    private final int gramLength;
-    private final boolean usePrePost;
-    private final boolean ignoreTokenCount;
-    private final boolean sourceHasTypeTag;
-    private final ITokenFactory tokenFactory;
-
-    public NGramUTF8StringBinaryTokenizerFactory(int gramLength, boolean usePrePost, boolean ignoreTokenCount,
-            boolean sourceHasTypeTag, ITokenFactory tokenFactory) {
-        this.gramLength = gramLength;
-        this.usePrePost = usePrePost;
-        this.ignoreTokenCount = ignoreTokenCount;
-        this.sourceHasTypeTag = sourceHasTypeTag;
-        this.tokenFactory = tokenFactory;
-    }
-
-    @Override
-    public IBinaryTokenizer createTokenizer() {
-        return new NGramUTF8StringBinaryTokenizer(gramLength, usePrePost, ignoreTokenCount, sourceHasTypeTag,
-                tokenFactory);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/UTF8StringLowercasePointable.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/UTF8StringLowercasePointable.java b/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/UTF8StringLowercasePointable.java
deleted file mode 100644
index fa84f99..0000000
--- a/asterix-om/src/main/java/org/apache/asterix/formats/nontagged/UTF8StringLowercasePointable.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.asterix.formats.nontagged;
-
-import org.apache.hyracks.api.dataflow.value.ITypeTraits;
-import org.apache.hyracks.data.std.api.AbstractPointable;
-import org.apache.hyracks.data.std.api.IComparable;
-import org.apache.hyracks.data.std.api.IHashable;
-import org.apache.hyracks.data.std.api.IPointable;
-import org.apache.hyracks.data.std.api.IPointableFactory;
-import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
-
-// TODO: Perhaps this class should go into hyracks.
-public final class UTF8StringLowercasePointable extends AbstractPointable implements IHashable, IComparable {
-    public static final ITypeTraits TYPE_TRAITS = new ITypeTraits() {
-        private static final long serialVersionUID = 1L;
-
-        @Override
-        public boolean isFixedLength() {
-            return false;
-        }
-
-        @Override
-        public int getFixedLength() {
-            return 0;
-        }
-    };
-
-    public static final IPointableFactory FACTORY = new IPointableFactory() {
-        private static final long serialVersionUID = 1L;
-
-        @Override
-        public IPointable createPointable() {
-            return new UTF8StringLowercasePointable();
-        }
-
-        @Override
-        public ITypeTraits getTypeTraits() {
-            return TYPE_TRAITS;
-        }
-    };
-
-    public static int getUTFLen(byte[] b, int s) {
-        return ((b[s] & 0xff) << 8) + ((b[s + 1] & 0xff) << 0);
-    }
-
-    @Override
-    public int compareTo(IPointable pointer) {
-        return compareTo(pointer.getByteArray(), pointer.getStartOffset(), pointer.getLength());
-    }
-
-    @Override
-    public int compareTo(byte[] bytes, int start, int length) {
-        int utflen1 = getUTFLen(this.bytes, this.start);
-        int utflen2 = getUTFLen(bytes, start);
-
-        int c1 = 0;
-        int c2 = 0;
-
-        int s1Start = this.start + 2;
-        int s2Start = start + 2;
-
-        while (c1 < utflen1 && c2 < utflen2) {
-            char ch1 = Character.toLowerCase(UTF8StringPointable.charAt(this.bytes, s1Start + c1));
-            char ch2 = Character.toLowerCase(UTF8StringPointable.charAt(bytes, s2Start + c2));
-
-            if (ch1 != ch2) {
-                return ch1 - ch2;
-            }
-            c1 += UTF8StringPointable.charSize(this.bytes, s1Start + c1);
-            c2 += UTF8StringPointable.charSize(bytes, s2Start + c2);
-        }
-        return utflen1 - utflen2;
-    }
-
-    @Override
-    public int hash() {
-        int h = 0;
-        int utflen = getUTFLen(bytes, start);
-        int sStart = start + 2;
-        int c = 0;
-
-        while (c < utflen) {
-            char ch = Character.toLowerCase(UTF8StringPointable.charAt(bytes, sStart + c));
-            h = 31 * h + ch;
-            c += UTF8StringPointable.charSize(bytes, sStart + c);
-        }
-        return h;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-om/src/main/java/org/apache/asterix/om/base/ABinary.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/om/base/ABinary.java b/asterix-om/src/main/java/org/apache/asterix/om/base/ABinary.java
index f3e3864..b3ee50e 100644
--- a/asterix-om/src/main/java/org/apache/asterix/om/base/ABinary.java
+++ b/asterix-om/src/main/java/org/apache/asterix/om/base/ABinary.java
@@ -19,11 +19,9 @@
 package org.apache.asterix.om.base;
 
 import org.apache.asterix.common.exceptions.AsterixException;
-import org.apache.asterix.dataflow.data.nontagged.serde.ABinarySerializerDeserializer;
 import org.apache.asterix.om.types.BuiltinType;
 import org.apache.asterix.om.types.IAType;
 import org.apache.asterix.om.visitors.IOMVisitor;
-import org.apache.hyracks.data.std.primitive.ByteArrayPointable;
 import org.json.JSONArray;
 import org.json.JSONException;
 import org.json.JSONObject;
@@ -57,15 +55,9 @@ public class ABinary implements IAObject {
     }
 
     public int getLength() {
-        return getByteArrayContentLength() + SIZE_OF_LEADING_LENGTH_FIELD;
+        return length;
     }
 
-    public int getByteArrayContentLength() {
-        return ABinarySerializerDeserializer.getLength(bytes, start);
-    }
-
-    public static final int SIZE_OF_LEADING_LENGTH_FIELD = ByteArrayPointable.SIZE_OF_LENGTH;
-
     @Override
     public void accept(IOMVisitor visitor) throws AsterixException {
         visitor.visitABinary(this);
@@ -98,7 +90,7 @@ public class ABinary implements IAObject {
 
     @Override
     public int hash() {
-        int m = HASH_PREFIX <= getLength() ? HASH_PREFIX : getLength();
+        int m = Math.min(HASH_PREFIX, getLength());
         int h = 0;
         for (int i = 0; i < m; i++) {
             h += 31 * h + bytes[start + i];
@@ -109,10 +101,9 @@ public class ABinary implements IAObject {
     @Override
     public String toString() {
         StringBuilder sb = new StringBuilder();
-        int validLength = getByteArrayContentLength();
-        int start = getStart() + SIZE_OF_LEADING_LENGTH_FIELD;
+        int start = getStart();
         sb.append("ABinary: [ ");
-        for (int i = 0; i < validLength; i++) {
+        for (int i = 0; i < getLength(); i++) {
             if (i > 0) {
                 sb.append(", ");
             }
@@ -127,10 +118,9 @@ public class ABinary implements IAObject {
     public JSONObject toJSON() throws JSONException {
         JSONObject json = new JSONObject();
 
-        int validLength = getByteArrayContentLength();
-        int start = getStart() + SIZE_OF_LEADING_LENGTH_FIELD;
+        int start = getStart();
         JSONArray byteArray = new JSONArray();
-        for (int i = 0; i < validLength; i++) {
+        for (int i = 0; i < getLength(); i++) {
             byteArray.put(bytes[start + i]);
         }
         json.put("ABinary", byteArray);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-om/src/main/java/org/apache/asterix/om/functions/AsterixBuiltinFunctions.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/om/functions/AsterixBuiltinFunctions.java b/asterix-om/src/main/java/org/apache/asterix/om/functions/AsterixBuiltinFunctions.java
index 5f257e0..fdf22c1 100644
--- a/asterix-om/src/main/java/org/apache/asterix/om/functions/AsterixBuiltinFunctions.java
+++ b/asterix-om/src/main/java/org/apache/asterix/om/functions/AsterixBuiltinFunctions.java
@@ -24,8 +24,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.commons.lang3.mutable.Mutable;
-
 import org.apache.asterix.common.functions.FunctionConstants;
 import org.apache.asterix.common.functions.FunctionSignature;
 import org.apache.asterix.om.typecomputer.base.IResultTypeComputer;
@@ -112,6 +110,7 @@ import org.apache.asterix.om.typecomputer.impl.UnaryStringInt64OrNullTypeCompute
 import org.apache.asterix.om.typecomputer.impl.UnaryStringOrNullTypeComputer;
 import org.apache.asterix.om.typecomputer.impl.UnorderedListConstructorResultType;
 import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
+import org.apache.commons.lang3.mutable.Mutable;
 import org.apache.hyracks.algebricks.core.algebra.base.ILogicalExpression;
 import org.apache.hyracks.algebricks.core.algebra.expressions.AggregateFunctionCallExpression;
 import org.apache.hyracks.algebricks.core.algebra.functions.AlgebricksBuiltinFunctions;
@@ -238,10 +237,6 @@ public class AsterixBuiltinFunctions {
     // String funcitons
     public final static FunctionIdentifier STRING_EQUAL = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
             "string-equal", 2);
-    public final static FunctionIdentifier STRING_START_WITH = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
-            "start-with", 2);
-    public final static FunctionIdentifier STRING_END_WITH = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
-            "end-with", 2);
     public final static FunctionIdentifier STRING_MATCHES = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
             "matches", 2);
     public final static FunctionIdentifier STRING_MATCHES_WITH_FLAG = new FunctionIdentifier(
@@ -256,6 +251,17 @@ public class AsterixBuiltinFunctions {
             FunctionConstants.ASTERIX_NS, "replace", 4);
     public final static FunctionIdentifier STRING_LENGTH = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
             "string-length", 1);
+    public final static FunctionIdentifier STRING_LIKE = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "like",
+            2);
+    public final static FunctionIdentifier STRING_CONTAINS = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+            "contains",
+            2);
+    public final static FunctionIdentifier STRING_STARTS_WITH = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+            "starts-with", 2);
+    public final static FunctionIdentifier STRING_ENDS_WITH = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+            "ends-with", 2);
+    public final static FunctionIdentifier SUBSTRING = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
+            "substring", 3);
     public final static FunctionIdentifier SUBSTRING2 = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
             "substring", 2);
     public final static FunctionIdentifier SUBSTRING_BEFORE = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
@@ -287,16 +293,6 @@ public class AsterixBuiltinFunctions {
     public final static FunctionIdentifier MAKE_FIELD_NAME_HANDLE = new FunctionIdentifier(
             FunctionConstants.ASTERIX_NS, "make-field-name-handle", 1);
 
-    public final static FunctionIdentifier SUBSTRING = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
-            "substring", 3);
-    public final static FunctionIdentifier LIKE = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "like", 2);
-    public final static FunctionIdentifier CONTAINS = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "contains",
-            2);
-    public final static FunctionIdentifier STARTS_WITH = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
-            "starts-with", 2);
-    public final static FunctionIdentifier ENDS_WITH = new FunctionIdentifier(FunctionConstants.ASTERIX_NS,
-            "ends-with", 2);
-
     public final static FunctionIdentifier AVG = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "agg-avg", 1);
     public final static FunctionIdentifier COUNT = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "agg-count", 1);
     public final static FunctionIdentifier SUM = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "agg-sum", 1);
@@ -755,7 +751,6 @@ public class AsterixBuiltinFunctions {
         addFunction(CIRCLE_CONSTRUCTOR, OptionalACircleTypeComputer.INSTANCE, true);
         addPrivateFunction(CONCAT_NON_NULL, ConcatNonNullTypeComputer.INSTANCE, true);
 
-        addFunction(CONTAINS, ABooleanTypeComputer.INSTANCE, true);
         addFunction(COUNT, AInt64TypeComputer.INSTANCE, true);
         addPrivateFunction(COUNTHASHED_GRAM_TOKENS, OrderedListOfAInt32TypeComputer.INSTANCE, true);
         addPrivateFunction(COUNTHASHED_WORD_TOKENS, OrderedListOfAInt32TypeComputer.INSTANCE, true);
@@ -780,7 +775,6 @@ public class AsterixBuiltinFunctions {
         addPrivateFunction(EDIT_DISTANCE_LIST_IS_FILTERABLE, ABooleanTypeComputer.INSTANCE, true);
         addPrivateFunction(EMBED_TYPE, AnyTypeComputer.INSTANCE, true);
         addPrivateFunction(EMPTY_STREAM, ABooleanTypeComputer.INSTANCE, true);
-        addFunction(ENDS_WITH, ABooleanTypeComputer.INSTANCE, true);
         // add(FIELD_ACCESS, NonTaggedFieldAccessByNameResultType.INSTANCE);
 
         addFunction(FLOAT_CONSTRUCTOR, OptionalAFloatTypeComputer.INSTANCE, true);
@@ -798,7 +792,6 @@ public class AsterixBuiltinFunctions {
         addFunction(INT32_CONSTRUCTOR, OptionalAInt32TypeComputer.INSTANCE, true);
         addFunction(INT64_CONSTRUCTOR, OptionalAInt64TypeComputer.INSTANCE, true);
         addFunction(LEN, OptionalAInt64TypeComputer.INSTANCE, true);
-        addFunction(LIKE, BinaryBooleanOrNullFunctionTypeComputer.INSTANCE, true);
         addFunction(LINE_CONSTRUCTOR, OptionalALineTypeComputer.INSTANCE, true);
         addPrivateFunction(LISTIFY, OrderedListConstructorResultType.INSTANCE, true);
         addPrivateFunction(LOCAL_AVG, NonTaggedLocalAvgTypeComputer.INSTANCE, true);
@@ -833,6 +826,8 @@ public class AsterixBuiltinFunctions {
         addFunction(FIND_BINARY, OptionalAInt64TypeComputer.INSTANCE, true);
         addFunction(FIND_BINARY_FROM, OptionalAInt64TypeComputer.INSTANCE, true);
 
+        addFunction(STRING_LIKE, BinaryBooleanOrNullFunctionTypeComputer.INSTANCE, true);
+        addFunction(STRING_CONTAINS, ABooleanTypeComputer.INSTANCE, true);
         addFunction(STRING_TO_CODEPOINT, OrderedListOfAInt64TypeComputer.INSTANCE, true);
         addFunction(CODEPOINT_TO_STRING, AStringTypeComputer.INSTANCE, true);
         addFunction(STRING_CONCAT, OptionalAStringTypeComputer.INSTANCE, true);
@@ -840,8 +835,8 @@ public class AsterixBuiltinFunctions {
         addFunction(STRING_LENGTH, UnaryStringInt64OrNullTypeComputer.INSTANCE, true);
         addFunction(STRING_LOWERCASE, UnaryStringOrNullTypeComputer.INSTANCE, true);
         addFunction(STRING_UPPERCASE, UnaryStringOrNullTypeComputer.INSTANCE, true);
-        addFunction(STRING_START_WITH, BinaryStringBoolOrNullTypeComputer.INSTANCE, true);
-        addFunction(STRING_END_WITH, BinaryStringBoolOrNullTypeComputer.INSTANCE, true);
+        addFunction(STRING_STARTS_WITH, BinaryStringBoolOrNullTypeComputer.INSTANCE, true);
+        addFunction(STRING_ENDS_WITH, BinaryStringBoolOrNullTypeComputer.INSTANCE, true);
         addFunction(STRING_MATCHES, BinaryStringBoolOrNullTypeComputer.INSTANCE, true);
         addFunction(STRING_MATCHES_WITH_FLAG, TripleStringBoolOrNullTypeComputer.INSTANCE, true);
         addFunction(STRING_REPLACE, TripleStringStringOrNullTypeComputer.INSTANCE, true);
@@ -917,7 +912,6 @@ public class AsterixBuiltinFunctions {
         addFunction(GET_CIRCLE_RADIUS_ACCESSOR, ADoubleTypeComputer.INSTANCE, true);
         addFunction(GET_CIRCLE_CENTER_ACCESSOR, APointTypeComputer.INSTANCE, true);
         addFunction(GET_POINTS_LINE_RECTANGLE_POLYGON_ACCESSOR, OrderedListOfAPointTypeComputer.INSTANCE, true);
-        addFunction(STARTS_WITH, ABooleanTypeComputer.INSTANCE, true);
         addFunction(STRING_CONSTRUCTOR, OptionalAStringTypeComputer.INSTANCE, true);
         addFunction(BINARY_HEX_CONSTRUCTOR, OptionalABinaryTypeComputer.INSTANCE, true);
         addFunction(BINARY_BASE64_CONSTRUCTOR, OptionalABinaryTypeComputer.INSTANCE, true);
@@ -1229,7 +1223,8 @@ public class AsterixBuiltinFunctions {
                 || (includePrivateFunctions && builtinPrivateFunctionsSet.keySet().contains(finfo))) {
             return true;
         }
-        fi = new FunctionIdentifier(AlgebricksBuiltinFunctions.ALGEBRICKS_NS, signature.getName(), signature.getArity());
+        fi = new FunctionIdentifier(AlgebricksBuiltinFunctions.ALGEBRICKS_NS, signature.getName(),
+                signature.getArity());
         finfo = getAsterixFunctionInfo(fi);
         if (builtinPublicFunctionsSet.keySet().contains(finfo)
                 || (includePrivateFunctions && builtinPrivateFunctionsSet.keySet().contains(finfo))) {
@@ -1342,7 +1337,8 @@ public class AsterixBuiltinFunctions {
         registeredFunctionsDomain.put(functionInfo, funcDomain);
     }
 
-    public static void addPrivateFunction(FunctionIdentifier fi, IResultTypeComputer typeComputer, boolean isFunctional) {
+    public static void addPrivateFunction(FunctionIdentifier fi, IResultTypeComputer typeComputer,
+            boolean isFunctional) {
         IFunctionInfo functionInfo = new AsterixFunctionInfo(fi, isFunctional);
         builtinPrivateFunctionsSet.put(functionInfo, functionInfo);
         funTypeComputer.put(functionInfo, typeComputer);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-om/src/main/java/org/apache/asterix/om/pointables/ARecordVisitablePointable.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/om/pointables/ARecordVisitablePointable.java b/asterix-om/src/main/java/org/apache/asterix/om/pointables/ARecordVisitablePointable.java
index 5759c72..823ea3e 100644
--- a/asterix-om/src/main/java/org/apache/asterix/om/pointables/ARecordVisitablePointable.java
+++ b/asterix-om/src/main/java/org/apache/asterix/om/pointables/ARecordVisitablePointable.java
@@ -38,6 +38,7 @@ import org.apache.asterix.om.util.NonTaggedFormatUtil;
 import org.apache.asterix.om.util.ResettableByteArrayOutputStream;
 import org.apache.asterix.om.util.container.IObjectFactory;
 import org.apache.hyracks.api.dataflow.value.INullWriter;
+import org.apache.hyracks.util.string.UTF8StringWriter;
 
 /**
  * This class interprets the binary data representation of a record. One can
@@ -66,6 +67,7 @@ public class ARecordVisitablePointable extends AbstractVisitablePointable {
 
     private final ResettableByteArrayOutputStream typeBos = new ResettableByteArrayOutputStream();
     private final DataOutputStream typeDos = new DataOutputStream(typeBos);
+    private final UTF8StringWriter utf8Writer = new UTF8StringWriter();
 
     private final ResettableByteArrayOutputStream dataBos = new ResettableByteArrayOutputStream();
     private final DataOutputStream dataDos = new DataOutputStream(dataBos);
@@ -82,7 +84,7 @@ public class ARecordVisitablePointable extends AbstractVisitablePointable {
 
     /**
      * private constructor, to prevent constructing it arbitrarily
-     * 
+     *
      * @param inputType
      */
     public ARecordVisitablePointable(ARecordType inputType) {
@@ -113,7 +115,7 @@ public class ARecordVisitablePointable extends AbstractVisitablePointable {
                 // add type name Reference (including a astring type tag)
                 int nameStart = typeBos.size();
                 typeDos.writeByte(ATypeTag.STRING.serialize());
-                typeDos.writeUTF(fieldNameStrs[i]);
+                utf8Writer.writeUTF8(fieldNameStrs[i], typeDos);
                 int nameEnd = typeBos.size();
                 IVisitablePointable typeNameReference = AFlatValuePointable.FACTORY.create(null);
                 typeNameReference.set(typeBos.getByteArray(), nameStart, nameEnd - nameStart);
@@ -183,7 +185,7 @@ public class ARecordVisitablePointable extends AbstractVisitablePointable {
                     nullBitMapOffset = s;
                     offsetArrayOffset = s
                             + (this.numberOfSchemaFields % 8 == 0 ? numberOfSchemaFields / 8
-                                    : numberOfSchemaFields / 8 + 1);
+                            : numberOfSchemaFields / 8 + 1);
                 } else {
                     offsetArrayOffset = s;
                 }
@@ -280,7 +282,7 @@ public class ARecordVisitablePointable extends AbstractVisitablePointable {
     public ARecordType getInputRecordType() {
         return inputRecType;
     }
-    
+
     @Override
     public <R, T> R accept(IVisitablePointableVisitor<R, T> vistor, T tag) throws AsterixException {
         return vistor.visit(this, tag);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-om/src/main/java/org/apache/asterix/om/pointables/cast/ARecordCaster.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/om/pointables/cast/ARecordCaster.java b/asterix-om/src/main/java/org/apache/asterix/om/pointables/cast/ARecordCaster.java
index ab80f4f..7e41f3b 100644
--- a/asterix-om/src/main/java/org/apache/asterix/om/pointables/cast/ARecordCaster.java
+++ b/asterix-om/src/main/java/org/apache/asterix/om/pointables/cast/ARecordCaster.java
@@ -53,6 +53,7 @@ import org.apache.hyracks.data.std.accessors.PointableBinaryComparatorFactory;
 import org.apache.hyracks.data.std.api.IValueReference;
 import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ByteArrayAccessibleOutputStream;
+import org.apache.hyracks.util.string.UTF8StringWriter;
 
 /**
  * This class is to do the runtime type cast for a record. It is ONLY visible to
@@ -95,6 +96,8 @@ class ARecordCaster {
     private int[] fieldNamesSortedIndex;
     private int[] reqFieldNamesSortedIndex;
 
+    private final UTF8StringWriter utf8Writer = new UTF8StringWriter();
+
     public ARecordCaster() {
         try {
             bos.reset();
@@ -182,7 +185,7 @@ class ARecordCaster {
             // add type name pointable (including a string type tag)
             int nameStart = bos.size();
             dos.write(ATypeTag.STRING.serialize());
-            dos.writeUTF(fname);
+            utf8Writer.writeUTF8(fname, dos);
             int nameEnd = bos.size();
             IVisitablePointable typeNamePointable = allocator.allocateEmpty();
             typeNamePointable.set(bos.getByteArray(), nameStart, nameEnd - nameStart);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-om/src/main/java/org/apache/asterix/om/pointables/nonvisitor/ARecordPointable.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/om/pointables/nonvisitor/ARecordPointable.java b/asterix-om/src/main/java/org/apache/asterix/om/pointables/nonvisitor/ARecordPointable.java
index 59c3195..ee91aab 100644
--- a/asterix-om/src/main/java/org/apache/asterix/om/pointables/nonvisitor/ARecordPointable.java
+++ b/asterix-om/src/main/java/org/apache/asterix/om/pointables/nonvisitor/ARecordPointable.java
@@ -38,7 +38,8 @@ import org.apache.hyracks.data.std.api.IPointableFactory;
 import org.apache.hyracks.data.std.primitive.BooleanPointable;
 import org.apache.hyracks.data.std.primitive.BytePointable;
 import org.apache.hyracks.data.std.primitive.IntegerPointable;
-import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+import org.apache.hyracks.util.string.UTF8StringUtil;
+import org.apache.hyracks.util.string.UTF8StringWriter;
 
 /*
  * This class interprets the binary data representation of a record.
@@ -115,12 +116,12 @@ public class ARecordPointable extends AbstractPointable {
     private static final int OPEN_FIELD_OFFSET_SIZE = 4;
     private static final int OPEN_FIELD_HEADER = OPEN_FIELD_HASH_SIZE + OPEN_FIELD_OFFSET_SIZE;
 
-    private static final int STRING_LENGTH_SIZE = 2;
-
     private static boolean isOpen(ARecordType recordType) {
         return recordType == null || recordType.isOpen();
     }
 
+    private final UTF8StringWriter utf8Writer = new UTF8StringWriter();
+
     public int getSchemeFieldCount(ARecordType recordType) {
         return recordType.getFieldNames().length;
     }
@@ -231,7 +232,7 @@ public class ARecordPointable extends AbstractPointable {
 
     public void getClosedFieldName(ARecordType recordType, int fieldId, DataOutput dOut) throws IOException {
         dOut.writeByte(ATypeTag.STRING.serialize());
-        dOut.writeUTF(getClosedFieldName(recordType, fieldId));
+        utf8Writer.writeUTF8(getClosedFieldName(recordType, fieldId), dOut);
     }
 
     public byte getClosedFieldTag(ARecordType recordType, int fieldId) {
@@ -301,8 +302,8 @@ public class ARecordPointable extends AbstractPointable {
     }
 
     public int getOpenFieldNameSize(ARecordType recordType, int fieldId) {
-        return UTF8StringPointable.getUTFLength(bytes, getOpenFieldNameOffset(recordType, fieldId))
-                + STRING_LENGTH_SIZE;
+        int utfleng = UTF8StringUtil.getUTFLength(bytes, getOpenFieldNameOffset(recordType, fieldId));
+        return utfleng + UTF8StringUtil.getNumBytesToStoreLength(utfleng);
     }
 
     public int getOpenFieldNameOffset(ARecordType recordType, int fieldId) {

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-om/src/main/java/org/apache/asterix/om/types/ARecordType.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/om/types/ARecordType.java b/asterix-om/src/main/java/org/apache/asterix/om/types/ARecordType.java
index d7f231b..a1e0739 100644
--- a/asterix-om/src/main/java/org/apache/asterix/om/types/ARecordType.java
+++ b/asterix-om/src/main/java/org/apache/asterix/om/types/ARecordType.java
@@ -26,6 +26,8 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
+import org.apache.hyracks.util.string.UTF8StringUtil;
+import org.apache.hyracks.util.string.UTF8StringWriter;
 import org.json.JSONArray;
 import org.json.JSONException;
 import org.json.JSONObject;
@@ -61,6 +63,8 @@ public class ARecordType extends AbstractComplexType {
     private final int serializedFieldNameOffsets[];
     private final long hashCodeIndexPairs[];
 
+    private final UTF8StringSerializerDeserializer utf8SerDer = new UTF8StringSerializerDeserializer();
+
     /**
      * @param typeName
      *            the name of the type
@@ -88,6 +92,7 @@ public class ARecordType extends AbstractComplexType {
                 .createBinaryHashFunction();
         ByteArrayAccessibleOutputStream baaos = new ByteArrayAccessibleOutputStream();
         DataOutputStream dos = new DataOutputStream(baaos);
+        UTF8StringWriter writer = new UTF8StringWriter();
         serializedFieldNameOffsets = new int[fieldNames.length];
         hashCodeIndexPairs = new long[fieldNames.length];
 
@@ -95,7 +100,7 @@ public class ARecordType extends AbstractComplexType {
         for (int i = 0; i < fieldNames.length; i++) {
             serializedFieldNameOffsets[i] = baaos.size();
             try {
-                dos.writeUTF(fieldNames[i]);
+                writer.writeUTF8(fieldNames[i], dos);
             } catch (IOException e) {
                 throw new AsterixException(e);
             }
@@ -116,7 +121,7 @@ public class ARecordType extends AbstractComplexType {
         int j;
         for (int i = 0; i < fieldNames.length; i++) {
             j = findFieldPosition(serializedFieldNames, serializedFieldNameOffsets[i],
-                    UTF8StringPointable.getStringLength(serializedFieldNames, serializedFieldNameOffsets[i]));
+                    UTF8StringUtil.getStringLength(serializedFieldNames, serializedFieldNameOffsets[i]));
             if (j != i) {
                 throw new AsterixException("Closed fields " + j + " and " + i + " have the same field name \""
                         + fieldNames[i] + "\"");
@@ -156,7 +161,7 @@ public class ARecordType extends AbstractComplexType {
 
         while (i < hashCodeIndexPairs.length && (int) (hashCodeIndexPairs[i] >>> 32) == probeFieldHash) {
             fIndex = (int) hashCodeIndexPairs[i];
-            int cFieldLength = UTF8StringPointable.getStringLength(serializedFieldNames,
+            int cFieldLength = UTF8StringUtil.getStringLength(serializedFieldNames,
                     serializedFieldNameOffsets[fIndex]);
             if (fieldNameComparator.compare(serializedFieldNames, serializedFieldNameOffsets[fIndex], cFieldLength,
                     bytes, start, length) == 0) {
@@ -221,7 +226,7 @@ public class ARecordType extends AbstractComplexType {
     public int findFieldPosition(String fieldName) throws IOException {
         ByteArrayAccessibleOutputStream baaos = new ByteArrayAccessibleOutputStream();
         DataOutputStream dos = new DataOutputStream(baaos);
-        UTF8StringSerializerDeserializer.INSTANCE.serialize(fieldName, dos);
+        utf8SerDer.serialize(fieldName, dos);
         return findFieldPosition(baaos.getByteArray(), 0, baaos.getByteArray().length);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-om/src/main/java/org/apache/asterix/om/util/NonTaggedFormatUtil.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/om/util/NonTaggedFormatUtil.java b/asterix-om/src/main/java/org/apache/asterix/om/util/NonTaggedFormatUtil.java
index 9c8f883..6377bcc 100644
--- a/asterix-om/src/main/java/org/apache/asterix/om/util/NonTaggedFormatUtil.java
+++ b/asterix-om/src/main/java/org/apache/asterix/om/util/NonTaggedFormatUtil.java
@@ -40,7 +40,9 @@ import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.common.exceptions.NotImplementedException;
 import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory;
 import org.apache.hyracks.api.dataflow.value.ITypeTraits;
+import org.apache.hyracks.data.std.primitive.ByteArrayPointable;
 import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.IBinaryTokenizerFactory;
+import org.apache.hyracks.util.string.UTF8StringUtil;
 
 public final class NonTaggedFormatUtil {
 
@@ -141,11 +143,21 @@ public final class NonTaggedFormatUtil {
                 else
                     return AInt16SerializerDeserializer.getShort(serNonTaggedAObject, offset) * 16 + 2;
             case STRING:
+                if (tagged) {
+                    int len = UTF8StringUtil.getUTFLength(serNonTaggedAObject, offset + 1);
+                    return len + UTF8StringUtil.getNumBytesToStoreLength(len);
+                } else {
+                    int len = UTF8StringUtil.getUTFLength(serNonTaggedAObject, offset);
+                    return len + UTF8StringUtil.getNumBytesToStoreLength(len);
+                }
             case BINARY:
-                if (tagged)
-                    return AInt16SerializerDeserializer.getUnsignedShort(serNonTaggedAObject, offset + 1) + 2;
-                else
-                    return AInt16SerializerDeserializer.getUnsignedShort(serNonTaggedAObject, offset) + 2;
+                if (tagged) {
+                    int len = ByteArrayPointable.getContentLength(serNonTaggedAObject, offset + 1);
+                    return len + ByteArrayPointable.getNumberBytesToStoreMeta(len);
+                } else {
+                    int len = ByteArrayPointable.getContentLength(serNonTaggedAObject, offset);
+                    return len + ByteArrayPointable.getNumberBytesToStoreMeta(len);
+                }
             case RECORD:
                 if (tagged)
                     return ARecordSerializerDeserializer.getRecordLength(serNonTaggedAObject, offset + 1) - 1;
@@ -158,11 +170,13 @@ public final class NonTaggedFormatUtil {
                     return AOrderedListSerializerDeserializer.getOrderedListLength(serNonTaggedAObject, offset) - 1;
             case UNORDEREDLIST:
                 if (tagged)
-                    return AUnorderedListSerializerDeserializer.getUnorderedListLength(serNonTaggedAObject, offset + 1) - 1;
+                    return AUnorderedListSerializerDeserializer.getUnorderedListLength(serNonTaggedAObject, offset + 1)
+                            - 1;
                 else
                     return AUnorderedListSerializerDeserializer.getUnorderedListLength(serNonTaggedAObject, offset) - 1;
             default:
-                throw new NotImplementedException("No getLength implemented for a value of this type " + typeTag + " .");
+                throw new NotImplementedException(
+                        "No getLength implemented for a value of this type " + typeTag + " .");
         }
     }
 
@@ -177,7 +191,8 @@ public final class NonTaggedFormatUtil {
             case POINT3D:
                 return 3;
             default:
-                throw new NotImplementedException("getNumDimensions is not implemented for this type " + typeTag + " .");
+                throw new NotImplementedException(
+                        "getNumDimensions is not implemented for this type " + typeTag + " .");
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-om/src/test/java/org/apache/asterix/dataflow/data/nontagged/printers/ABinaryPrinterTest.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/test/java/org/apache/asterix/dataflow/data/nontagged/printers/ABinaryPrinterTest.java b/asterix-om/src/test/java/org/apache/asterix/dataflow/data/nontagged/printers/ABinaryPrinterTest.java
index f43890c..881ad50 100644
--- a/asterix-om/src/test/java/org/apache/asterix/dataflow/data/nontagged/printers/ABinaryPrinterTest.java
+++ b/asterix-om/src/test/java/org/apache/asterix/dataflow/data/nontagged/printers/ABinaryPrinterTest.java
@@ -19,25 +19,27 @@
 
 package org.apache.asterix.dataflow.data.nontagged.printers;
 
-import org.apache.asterix.dataflow.data.nontagged.printers.adm.ABinaryHexPrinter;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.data.std.primitive.ByteArrayPointable;
-import org.junit.Test;
+import static org.junit.Assert.assertTrue;
 
-import javax.xml.bind.DatatypeConverter;
 import java.io.ByteArrayOutputStream;
 import java.io.PrintStream;
 import java.util.Arrays;
 
-import static org.junit.Assert.*;
+import javax.xml.bind.DatatypeConverter;
+
+import org.apache.asterix.dataflow.data.nontagged.printers.adm.ABinaryHexPrinter;
+import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.data.std.primitive.ByteArrayPointable;
+import org.junit.Test;
 
 public class ABinaryPrinterTest {
 
-    public static byte[] generateABinaryBytesByStringContent(String content){
-        String padding = "000000" + content;
-        byte [] bytes = DatatypeConverter.parseHexBinary(padding);
-        ByteArrayPointable.putLength(content.length() / 2, bytes, 1);
-        return bytes;
+    public static byte[] generateABinaryBytesByStringContent(String content) {
+        byte[] bytes = DatatypeConverter.parseHexBinary(content);
+        ByteArrayPointable ptr = ByteArrayPointable.generatePointableFromPureBytes(bytes);
+        byte[] ret = new byte[ptr.getLength() + 1];
+        System.arraycopy(ptr.getByteArray(), ptr.getStartOffset(), ret, 1, ptr.getLength());
+        return ret;
     }
 
     public static void testOneInputString(String input) throws AlgebricksException {
@@ -45,13 +47,13 @@ public class ABinaryPrinterTest {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         PrintStream ps = new PrintStream(baos);
 
-        byte [] bytes = generateABinaryBytesByStringContent(input);
+        byte[] bytes = generateABinaryBytesByStringContent(input);
         ABinaryHexPrinter.INSTANCE.print(bytes, 0, bytes.length, ps);
 
         String pureHex = baos.toString();
         assertTrue(pureHex.startsWith("hex("));
         assertTrue(pureHex.endsWith("\")"));
-        assertTrue(pureHex.substring(5,pureHex.length()-2).equalsIgnoreCase(input));
+        assertTrue(pureHex.substring(5, pureHex.length() - 2).equalsIgnoreCase(input));
     }
 
     @Test
@@ -62,10 +64,11 @@ public class ABinaryPrinterTest {
     }
 
     @Test
-    public void testSpecialString() throws Exception{
+    public void testLongString() throws Exception {
         testOneInputString("");
-        char [] chars = new char[(ByteArrayPointable.MAX_LENGTH ) * 2];
-        Arrays.fill(chars, 'F');
-        testOneInputString(new String(chars));
+        int aVeryLongLength = 65540;
+        char[] aVeryLongHexString = new char[aVeryLongLength * 2];
+        Arrays.fill(aVeryLongHexString, 'F');
+        testOneInputString(new String(aVeryLongHexString));
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalYearAccessor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalYearAccessor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalYearAccessor.java
index 9b932ec..0358751 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalYearAccessor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/accessors/TemporalYearAccessor.java
@@ -44,6 +44,7 @@ import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
 import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
+import org.apache.hyracks.data.std.util.UTF8StringCharacterIterator;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class TemporalYearAccessor extends AbstractScalarFunctionDynamicDescriptor {
@@ -86,6 +87,9 @@ public class TemporalYearAccessor extends AbstractScalarFunctionDynamicDescripto
 
                     private final GregorianCalendarSystem calSystem = GregorianCalendarSystem.getInstance();
 
+                    private final UTF8StringPointable strExprPtr = new UTF8StringPointable();
+                    private final UTF8StringCharacterIterator strIter = new UTF8StringCharacterIterator();
+
                     // for output: type integer
                     @SuppressWarnings("unchecked")
                     private final ISerializerDeserializer<AInt64> intSerde = AqlSerializerDeserializerProvider.INSTANCE
@@ -129,18 +133,20 @@ public class TemporalYearAccessor extends AbstractScalarFunctionDynamicDescripto
                                 return;
                             } else if (bytes[0] == SER_STRING_TYPE_TAG) {
                                 int year;
-                                if (UTF8StringPointable.charAt(bytes, 3) == '-') {
+                                strExprPtr.set(bytes, 1, bytes.length);
+                                strIter.reset(strExprPtr);
+                                char firstChar = strIter.next();
+                                if (firstChar == '-') {
                                     // in case of a negative year
                                     year = -1
-                                            * ((UTF8StringPointable.charAt(bytes, 4) - '0') * 1000
-                                                    + (UTF8StringPointable.charAt(bytes, 5) - '0') * 100
-                                                    + (UTF8StringPointable.charAt(bytes, 6) - '0') * 10 + (UTF8StringPointable
-                                                    .charAt(bytes, 7) - '0'));
+                                            * ((strIter.next() - '0') * 1000
+                                            + (strIter.next() - '0') * 100
+                                            + (strIter.next() - '0') * 10 + (strIter.next() - '0'));
                                 } else {
-                                    year = (UTF8StringPointable.charAt(bytes, 3) - '0') * 1000
-                                            + (UTF8StringPointable.charAt(bytes, 4) - '0') * 100
-                                            + (UTF8StringPointable.charAt(bytes, 5) - '0') * 10
-                                            + (UTF8StringPointable.charAt(bytes, 6) - '0');
+                                    year = (firstChar - '0') * 1000
+                                            + (strIter.next() - '0') * 100
+                                            + (strIter.next() - '0') * 10
+                                            + (strIter.next() - '0');
                                 }
                                 aMutableInt64.setValue(year);
                                 intSerde.serialize(aMutableInt64, out);


[15/15] incubator-asterixdb git commit: ASTERIXDB-1102: VarSize Encoding to store length of String and ByteArray

Posted by ji...@apache.org.
ASTERIXDB-1102: VarSize Encoding to store length of String and ByteArray

This patch is to change the encoding format that stores the length value
of
the variable length type (e.g. String, ByteArray) from fix-size encoding
(2bytes) to variable-size encoding ( 1 to 5bytes)
It will solve the issue 1102 to enable us to store a String that longer
than 64K. Also for the common case of storing the short string ( <=
127), it will save one byte per string.

Some important changes include:
1. The UTF8StringSerDer and ByteArraySerDer is not Singleton instance
any more. I need some state to speedup the serialization and avoid the
object creatation. Luckily, 99% percent of Serializer were used as
factory way. The other 1% has been fixed.

A separate Test support, the ExcutionTest now can produce the only.xml
which stores the previous failed runtime test.xml. It can speedup the
debug process.

Change-Id: I41fff780f5c071742ef10129d83c8f945d5886d7
Reviewed-on: https://asterix-gerrit.ics.uci.edu/450
Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
Reviewed-by: Jianfeng Jia <ji...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/commit/742aba85
Tree: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/tree/742aba85
Diff: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/diff/742aba85

Branch: refs/heads/master
Commit: 742aba85e00033d4561e194358d0bcd53c775b3f
Parents: 1eeb3d2
Author: JavierJia <ji...@gmail.com>
Authored: Wed Oct 28 18:21:50 2015 -0700
Committer: Jianfeng Jia <ji...@gmail.com>
Committed: Wed Oct 28 21:41:21 2015 -0700

----------------------------------------------------------------------
 .../optimizer/rules/am/AccessMethodUtils.java   |    2 +-
 .../rules/am/InvertedIndexAccessMethod.java     |    8 +-
 .../data/big-object/order.tbl.verylong.big      | 1500 ++++++
 .../file/ExternalIndexingOperations.java        |   11 +-
 .../asterix/test/runtime/ExecutionTest.java     |   45 +-
 .../src/test/resources/runtimets/only.xml       |   10 +-
 .../big_object_groupby.3.query.aql              |    2 +-
 .../big_object_load/big_object_load.1.ddl.aql   |   84 +
 .../big_object_load.2.update.aql                |   25 +
 .../big_object_load/big_object_load.3.query.aql |   34 +
 .../queries/binary/find/find.3.query.aql        |    2 +-
 .../binary/subbinary/subbinary_01.3.query.aql   |    2 +-
 .../queries/boolean/and_01/and_01.3.query.aql   |    4 +-
 ...e-from-loaded-dataset-with-index.5.query.aql |    1 +
 ...nto-loaded-dataset-with-index_02.5.query.aql |    1 +
 .../string/end-with1/end-with1.1.ddl.aql        |   21 -
 .../string/end-with1/end-with1.2.update.aql     |   18 -
 .../string/end-with1/end-with1.3.query.aql      |   22 -
 .../string/end-with2/end-with2.1.ddl.aql        |   21 -
 .../string/end-with2/end-with2.2.update.aql     |   18 -
 .../string/end-with2/end-with2.3.query.aql      |   22 -
 .../string/end-with3/end-with3.1.ddl.aql        |   21 -
 .../string/end-with3/end-with3.2.update.aql     |   18 -
 .../string/end-with3/end-with3.3.query.aql      |   22 -
 .../string/end-with4/end-with4.1.ddl.aql        |   21 -
 .../string/end-with4/end-with4.2.update.aql     |   18 -
 .../string/end-with4/end-with4.3.query.aql      |   22 -
 .../string/end-with5/end-with5.1.ddl.aql        |   21 -
 .../string/end-with5/end-with5.2.update.aql     |   18 -
 .../string/end-with5/end-with5.3.query.aql      |   28 -
 .../string/ends-with1/ends-with1.1.ddl.aql      |   21 +
 .../string/ends-with1/ends-with1.2.update.aql   |   18 +
 .../string/ends-with1/ends-with1.3.query.aql    |   22 +
 .../string/ends-with2/ends-with2.1.ddl.aql      |   21 +
 .../string/ends-with2/ends-with2.2.update.aql   |   18 +
 .../string/ends-with2/ends-with2.3.query.aql    |   22 +
 .../string/ends-with3/ends-with3.1.ddl.aql      |   21 +
 .../string/ends-with3/ends-with3.2.update.aql   |   18 +
 .../string/ends-with3/ends-with3.3.query.aql    |   22 +
 .../string/ends-with4/ends-with4.1.ddl.aql      |   21 +
 .../string/ends-with4/ends-with4.2.update.aql   |   18 +
 .../string/ends-with4/ends-with4.3.query.aql    |   22 +
 .../string/ends-with5/ends-with5.1.ddl.aql      |   21 +
 .../string/ends-with5/ends-with5.2.update.aql   |   18 +
 .../string/ends-with5/ends-with5.3.query.aql    |   28 +
 .../string/ends-with6/ends-with6.1.ddl.aql      |   21 +
 .../string/ends-with6/ends-with6.2.update.aql   |   18 +
 .../string/ends-with6/ends-with6.3.query.aql    |   23 +
 .../string/ends-with7/ends-with7.1.ddl.aql      |   25 +
 .../string/ends-with7/ends-with7.2.update.aql   |   25 +
 .../string/ends-with7/ends-with7.3.query.aql    |   33 +
 .../string/ends-with8/ends-with8.1.ddl.aql      |   37 +
 .../string/ends-with8/ends-with8.2.update.aql   |   36 +
 .../string/ends-with8/ends-with8.3.query.aql    |   34 +
 .../string/ends-with_01/ends-with_01.1.ddl.aql  |   21 -
 .../ends-with_01/ends-with_01.2.update.aql      |   18 -
 .../ends-with_01/ends-with_01.3.query.aql       |   23 -
 .../string/endwith02/endwith02.1.ddl.aql        |   25 -
 .../string/endwith02/endwith02.2.update.aql     |   25 -
 .../string/endwith02/endwith02.3.query.aql      |   33 -
 .../string/endwith03/endwith03.1.ddl.aql        |   37 -
 .../string/endwith03/endwith03.2.update.aql     |   36 -
 .../string/endwith03/endwith03.3.query.aql      |   34 -
 .../string/matches11/matches11.3.query.aql      |    4 +-
 .../string/start-with1/start-with1.1.ddl.aql    |   21 -
 .../string/start-with1/start-with1.2.update.aql |   18 -
 .../string/start-with1/start-with1.3.query.aql  |   22 -
 .../string/start-with2/start-with2.1.ddl.aql    |   21 -
 .../string/start-with2/start-with2.2.update.aql |   18 -
 .../string/start-with2/start-with2.3.query.aql  |   22 -
 .../string/start-with3/start-with3.1.ddl.aql    |   21 -
 .../string/start-with3/start-with3.2.update.aql |   18 -
 .../string/start-with3/start-with3.3.query.aql  |   22 -
 .../string/start-with4/start-with4.1.ddl.aql    |   21 -
 .../string/start-with4/start-with4.2.update.aql |   18 -
 .../string/start-with4/start-with4.3.query.aql  |   28 -
 .../string/start-with5/start-with5.1.ddl.aql    |   21 -
 .../string/start-with5/start-with5.2.update.aql |   18 -
 .../string/start-with5/start-with5.3.query.aql  |   22 -
 .../string/starts-with1/starts-with1.1.ddl.aql  |   21 +
 .../starts-with1/starts-with1.2.update.aql      |   18 +
 .../starts-with1/starts-with1.3.query.aql       |   22 +
 .../string/starts-with2/starts-with2.1.ddl.aql  |   21 +
 .../starts-with2/starts-with2.2.update.aql      |   18 +
 .../starts-with2/starts-with2.3.query.aql       |   22 +
 .../string/starts-with3/starts-with3.1.ddl.aql  |   21 +
 .../starts-with3/starts-with3.2.update.aql      |   18 +
 .../starts-with3/starts-with3.3.query.aql       |   22 +
 .../string/starts-with4/starts-with4.1.ddl.aql  |   21 +
 .../starts-with4/starts-with4.2.update.aql      |   18 +
 .../starts-with4/starts-with4.3.query.aql       |   28 +
 .../string/starts-with5/starts-with5.1.ddl.aql  |   21 +
 .../starts-with5/starts-with5.2.update.aql      |   18 +
 .../starts-with5/starts-with5.3.query.aql       |   22 +
 .../string/starts-with6/starts-with6.1.ddl.aql  |   21 +
 .../starts-with6/starts-with6.2.update.aql      |   18 +
 .../starts-with6/starts-with6.3.query.aql       |   23 +
 .../string/starts-with7/starts-with7.1.ddl.aql  |   26 +
 .../starts-with7/starts-with7.2.update.aql      |   25 +
 .../starts-with7/starts-with7.3.query.aql       |   44 +
 .../string/starts-with8/starts-with8.1.ddl.aql  |   38 +
 .../starts-with8/starts-with8.2.update.aql      |   37 +
 .../starts-with8/starts-with8.3.query.aql       |   35 +
 .../starts-with_01/starts-with_01.1.ddl.aql     |   21 -
 .../starts-with_01/starts-with_01.2.update.aql  |   18 -
 .../starts-with_01/starts-with_01.3.query.aql   |   23 -
 .../string/startwith02/startwith02.1.ddl.aql    |   26 -
 .../string/startwith02/startwith02.2.update.aql |   25 -
 .../string/startwith02/startwith02.3.query.aql  |   42 -
 .../string/startwith03/startwith03.1.ddl.aql    |   38 -
 .../string/startwith03/startwith03.2.update.aql |   37 -
 .../string/startwith03/startwith03.3.query.aql  |   35 -
 .../varlen-encoding/varlen-encoding.1.ddl.aql   |   18 +
 .../varlen-encoding.2.update.aql                |   18 +
 .../varlen-encoding/varlen-encoding.3.query.aql |   35 +
 .../big_object_groupby-2/groupby.1.adm          | 4906 +++++++++---------
 .../big-object/big_object_load/load.1.adm       | 1501 ++++++
 .../runtimets/results/binary/find/find.1.adm    |    2 +-
 .../results/binary/subbinary/subbinary.1.adm    |    2 +-
 .../delete-from-loaded-dataset-with-index.1.adm |    4 +-
 ...sert-into-loaded-dataset-with-index_02.1.adm |    2 +-
 .../results/string/end-with1/end-with1.1.adm    |    2 -
 .../results/string/end-with2/end-with2.1.adm    |    2 -
 .../results/string/end-with3/end-with3.1.adm    |    2 -
 .../results/string/end-with4/end-with4.1.adm    |    2 -
 .../results/string/end-with5/end-with5.1.adm    |    2 -
 .../results/string/ends-with1/ends-with1.1.adm  |    2 +
 .../results/string/ends-with2/ends-with2.1.adm  |    2 +
 .../results/string/ends-with3/ends-with3.1.adm  |    2 +
 .../results/string/ends-with4/ends-with4.1.adm  |    2 +
 .../results/string/ends-with5/ends-with5.1.adm  |    2 +
 .../results/string/ends-with6/ends-with6.1.adm  |    2 +
 .../results/string/ends-with7/ends-with7.1.adm  |    7 +
 .../results/string/ends-with8/ends-with8.1.adm  |    5 +
 .../string/ends-with_01/ends-with_01.1.adm      |    2 -
 .../results/string/endwith02/endwith02.1.adm    |    7 -
 .../results/string/endwith03/endwith03.1.adm    |    5 -
 .../results/string/matches11/matches11.1.adm    |    5 +-
 .../string/matchesnull/matchesnull.1.adm        |    2 +-
 .../string/start-with1/start-with1.1.adm        |    2 -
 .../string/start-with2/start-with2.1.adm        |    2 -
 .../string/start-with3/start-with3.1.adm        |    2 -
 .../string/start-with4/start-with4.1.adm        |    2 -
 .../string/start-with5/start-with5.1.adm        |    2 -
 .../string/starts-with1/starts-with1.1.adm      |    2 +
 .../string/starts-with2/starts-with2.1.adm      |    2 +
 .../string/starts-with3/starts-with3.1.adm      |    2 +
 .../string/starts-with4/starts-with4.1.adm      |    2 +
 .../string/starts-with5/starts-with5.1.adm      |    2 +
 .../string/starts-with6/starts-with6.1.adm      |    2 +
 .../string/starts-with7/starts-with7.1.adm      |   16 +
 .../string/starts-with8/starts-with8.1.adm      |    6 +
 .../string/starts-with_01/starts-with_01.1.adm  |    2 -
 .../string/startwith02/startwith02.1.adm        |   15 -
 .../string/startwith03/startwith03.1.adm        |    6 -
 .../string/string-equal4/string-equal4.1.adm    |    2 +-
 .../varlen-encoding/varlen-encoding.1.adm       |    2 +
 .../src/test/resources/runtimets/testsuite.xml  |   78 +-
 .../asterix/common/utils/UTF8CharSequence.java  |   93 -
 .../org/apache/asterix/test/aql/TestsUtils.java |   33 +-
 .../dataflow/FileIndexTupleTranslator.java      |    7 +-
 .../indexing/dataflow/HiveObjectParser.java     |    4 +-
 ...rnalIndexBulkModifyOperatorNodePushable.java |    5 +-
 .../external/library/java/JObjectAccessors.java |   36 +-
 .../external/library/java/JObjectUtil.java      |    2 +-
 .../asterix/external/library/java/JObjects.java |    8 +-
 asterix-fuzzyjoin/pom.xml                       |    8 +
 .../SimilarityMetricEditDistance.java           |   72 +-
 .../AbstractUTF8StringBinaryTokenizer.java      |   77 -
 .../fuzzyjoin/tokenizer/AbstractUTF8Token.java  |  103 -
 .../tokenizer/AbstractUTF8TokenFactory.java     |   36 -
 .../DelimitedUTF8StringBinaryTokenizer.java     |   79 -
 ...limitedUTF8StringBinaryTokenizerFactory.java |   40 -
 .../tokenizer/HashedUTF8NGramToken.java         |   62 -
 .../tokenizer/HashedUTF8NGramTokenFactory.java  |   38 -
 .../tokenizer/HashedUTF8WordToken.java          |   84 -
 .../tokenizer/HashedUTF8WordTokenFactory.java   |   38 -
 .../fuzzyjoin/tokenizer/IBinaryTokenizer.java   |   30 -
 .../tokenizer/IBinaryTokenizerFactory.java      |   26 -
 .../fuzzyjoin/tokenizer/INGramToken.java        |   28 -
 .../asterix/fuzzyjoin/tokenizer/IToken.java     |   39 -
 .../fuzzyjoin/tokenizer/ITokenFactory.java      |   26 -
 .../NGramUTF8StringBinaryTokenizer.java         |  116 -
 .../fuzzyjoin/tokenizer/StringUtils.java        |  216 -
 .../fuzzyjoin/tokenizer/UTF8NGramToken.java     |   83 -
 .../tokenizer/UTF8NGramTokenFactory.java        |   39 -
 .../fuzzyjoin/tokenizer/UTF8WordToken.java      |   44 -
 .../tokenizer/UTF8WordTokenFactory.java         |   39 -
 .../fuzzyjoin/tests/NGramTokenizerTest.java     |  239 -
 .../fuzzyjoin/tests/WordTokenizerTest.java      |  214 -
 .../external/ExternalFileIndexAccessor.java     |    3 +-
 .../ExternalLoopkupOperatorDiscriptor.java      |    5 +-
 .../external/FilesIndexDescription.java         |   76 +-
 .../DatasetNameValueExtractor.java              |    5 +-
 .../DatatypeNameValueExtractor.java             |    3 +-
 .../NestedDatatypeNameValueExtractor.java       |    5 +-
 .../apache/asterix/builders/RecordBuilder.java  |    6 +-
 .../dataflow/data/common/AListElementToken.java |   20 +-
 .../common/AOrderedListBinaryTokenizer.java     |    3 +-
 .../ListItemBinaryComparatorFactory.java        |    2 +-
 .../hash/ListItemBinaryHashFunctionFactory.java |    2 +-
 .../data/nontagged/printers/PrintTools.java     |   45 +-
 .../printers/adm/ABinaryBase64Printer.java      |  122 +-
 .../printers/adm/ABinaryHexPrinter.java         |   24 +-
 .../nontagged/printers/adm/AInt16Printer.java   |   16 +-
 .../nontagged/printers/adm/AInt32Printer.java   |   16 +-
 .../nontagged/printers/adm/AInt8Printer.java    |   16 +-
 .../printers/csv/ABinaryHexPrinter.java         |    8 +-
 .../printers/json/clean/ABinaryHexPrinter.java  |    9 +-
 .../json/lossless/ABinaryHexPrinter.java        |    8 +-
 .../serde/ABinarySerializerDeserializer.java    |   27 +-
 .../serde/AObjectSerializerDeserializer.java    |   25 +-
 .../serde/ARecordSerializerDeserializer.java    |   43 +-
 .../serde/AStringSerializerDeserializer.java    |    9 +-
 .../AUUIDStringSerializerDeserializer.java      |    4 +-
 .../AqlBinaryComparatorFactoryProvider.java     |    1 +
 .../AqlBinaryHashFunctionFactoryProvider.java   |    1 +
 .../AqlBinaryTokenizerFactoryProvider.java      |    1 +
 .../AqlSerializerDeserializerProvider.java      |    6 +-
 .../NGramUTF8StringBinaryTokenizerFactory.java  |   51 -
 .../nontagged/UTF8StringLowercasePointable.java |  106 -
 .../org/apache/asterix/om/base/ABinary.java     |   22 +-
 .../om/functions/AsterixBuiltinFunctions.java   |   44 +-
 .../pointables/ARecordVisitablePointable.java   |   10 +-
 .../om/pointables/cast/ARecordCaster.java       |    5 +-
 .../pointables/nonvisitor/ARecordPointable.java |   13 +-
 .../apache/asterix/om/types/ARecordType.java    |   13 +-
 .../asterix/om/util/NonTaggedFormatUtil.java    |   29 +-
 .../nontagged/printers/ABinaryPrinterTest.java  |   37 +-
 .../accessors/TemporalYearAccessor.java         |   24 +-
 .../common/EditDistanceEvaluator.java           |   24 +-
 .../common/SimilarityFiltersCache.java          |    3 +-
 .../ABinaryHexStringConstructorDescriptor.java  |   26 +-
 .../ABooleanConstructorDescriptor.java          |   10 +-
 .../ACircleConstructorDescriptor.java           |    6 +-
 .../ADateConstructorDescriptor.java             |   10 +-
 .../ADateTimeConstructorDescriptor.java         |   20 +-
 .../ADayTimeDurationConstructorDescriptor.java  |    8 +-
 .../ADoubleConstructorDescriptor.java           |   20 +-
 .../ADurationConstructorDescriptor.java         |   10 +-
 .../AFloatConstructorDescriptor.java            |   20 +-
 .../AInt16ConstructorDescriptor.java            |    5 +-
 .../AInt32ConstructorDescriptor.java            |    5 +-
 .../AInt64ConstructorDescriptor.java            |    5 +-
 .../AInt8ConstructorDescriptor.java             |    5 +-
 .../AIntervalFromDateConstructorDescriptor.java |   20 +-
 ...tervalFromDateTimeConstructorDescriptor.java |   39 +-
 .../AIntervalFromTimeConstructorDescriptor.java |   20 +-
 ...ervalStartFromDateConstructorDescriptor.java |   24 +-
 ...lStartFromDateTimeConstructorDescriptor.java |   30 +-
 ...ervalStartFromTimeConstructorDescriptor.java |   23 +-
 .../ALineConstructorDescriptor.java             |    5 +-
 .../ANullConstructorDescriptor.java             |    5 +-
 .../APoint3DConstructorDescriptor.java          |    5 +-
 .../APointConstructorDescriptor.java            |    5 +-
 .../APolygonConstructorDescriptor.java          |    5 +-
 .../ARectangleConstructorDescriptor.java        |    5 +-
 .../AStringConstructorDescriptor.java           |  190 +-
 .../ATimeConstructorDescriptor.java             |    8 +-
 .../AUUIDFromStringConstructorDescriptor.java   |    9 +-
 ...AYearMonthDurationConstructorDescriptor.java |   11 +-
 .../functions/AbstractBinaryStringBoolEval.java |   58 +-
 .../functions/AbstractQuadStringStringEval.java |   56 +-
 .../functions/AbstractStringContainsEval.java   |  103 -
 .../functions/AbstractTripleStringBoolEval.java |   61 +-
 .../AbstractTripleStringStringEval.java         |   80 +-
 .../functions/CodePointToStringDescriptor.java  |   47 +-
 .../evaluators/functions/CodepointIterator.java |  105 -
 .../functions/ContainsDescriptor.java           |   99 -
 .../EditDistanceStringIsFilterable.java         |   13 +-
 .../functions/EndsWithDescriptor.java           |   95 -
 .../evaluators/functions/IsNullDescriptor.java  |    3 +-
 .../functions/IsSystemNullDescriptor.java       |    3 +-
 .../evaluators/functions/LikeDescriptor.java    |  204 -
 .../evaluators/functions/RegExpDescriptor.java  |    7 +-
 .../functions/SpatialIntersectDescriptor.java   |    3 +-
 .../functions/StartsWithDescriptor.java         |   88 -
 .../functions/StringConcatDescriptor.java       |   20 +-
 .../functions/StringContainsDescriptor.java     |   71 +
 .../functions/StringEndWithDescrtiptor.java     |   92 -
 .../functions/StringEndsWithDescriptor.java     |   73 +
 .../functions/StringEqualDescriptor.java        |   21 +-
 .../functions/StringEvaluatorUtils.java         |   48 +-
 .../functions/StringJoinDescriptor.java         |   21 +-
 .../functions/StringLengthDescriptor.java       |    3 +-
 .../functions/StringLikeDescriptor.java         |  106 +
 .../functions/StringLowerCaseDescriptor.java    |   28 +-
 .../functions/StringMatchesDescriptor.java      |   74 +-
 .../StringMatchesWithFlagDescriptor.java        |   98 +-
 .../functions/StringReplaceDescriptor.java      |  108 +-
 .../StringReplaceWithFlagsDescriptor.java       |  148 +-
 .../functions/StringStartWithDescrtiptor.java   |   87 -
 .../functions/StringStartsWithDescriptor.java   |   72 +
 .../functions/StringToCodePointDescriptor.java  |   46 +-
 .../functions/StringUpperCaseDescriptor.java    |   22 +-
 .../functions/Substring2Descriptor.java         |   35 +-
 .../functions/SubstringAfterDescriptor.java     |   50 +-
 .../functions/SubstringBeforeDescriptor.java    |   39 +-
 .../functions/SubstringDescriptor.java          |   48 +-
 .../functions/binary/AbstractCopyEvaluator.java |    4 +-
 .../binary/BinaryConcatDescriptor.java          |   35 +-
 .../binary/BinaryLengthDescriptor.java          |    2 +-
 .../functions/binary/FindBinaryDescriptor.java  |   31 +-
 .../functions/binary/ParseBinaryDescriptor.java |   65 +-
 .../functions/binary/PrintBinaryDescriptor.java |   51 +-
 .../binary/SubBinaryFromDescriptor.java         |    2 +-
 .../binary/SubBinaryFromToDescriptor.java       |   28 +-
 .../records/GetRecordFieldValueEvalFactory.java |    6 +-
 .../records/GetRecordFieldsEvalFactory.java     |    8 +-
 .../functions/records/RecordFieldsUtil.java     |    5 +-
 .../records/RecordMergeDescriptor.java          |    3 +-
 .../AdjustDateTimeForTimeZoneDescriptor.java    |   12 +-
 .../AdjustTimeForTimeZoneDescriptor.java        |   10 +-
 .../functions/temporal/ParseDateDescriptor.java |   24 +-
 .../temporal/ParseDateTimeDescriptor.java       |   21 +-
 .../functions/temporal/ParseTimeDescriptor.java |   21 +-
 .../functions/temporal/PrintDateDescriptor.java |   13 +-
 .../temporal/PrintDateTimeDescriptor.java       |   14 +-
 .../functions/temporal/PrintTimeDescriptor.java |   14 +-
 .../runtime/formats/NonTaggedDataFormat.java    |   22 +-
 .../operators/file/AbstractDataParser.java      |   27 +-
 .../ExternalFilesIndexOperatorDescriptor.java   |    4 +-
 pom.xml                                         |   10 +
 323 files changed, 8685 insertions(+), 8199 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AccessMethodUtils.java
----------------------------------------------------------------------
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AccessMethodUtils.java b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AccessMethodUtils.java
index 831b3f7..b2c26a8 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AccessMethodUtils.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AccessMethodUtils.java
@@ -137,7 +137,7 @@ public class AccessMethodUtils {
         }
         if (arg2.getExpressionTag() == LogicalExpressionTag.VARIABLE) {
             // The arguments of contains() function are asymmetrical, we can only use index if it is on the first argument
-            if (funcExpr.getFunctionIdentifier() == AsterixBuiltinFunctions.CONTAINS) {
+            if (funcExpr.getFunctionIdentifier() == AsterixBuiltinFunctions.STRING_CONTAINS) {
                 return false;
             }
             IAType expressionType = constantRuntimeResultType(arg1, context, typeEnvironment);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/InvertedIndexAccessMethod.java
----------------------------------------------------------------------
diff --git a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/InvertedIndexAccessMethod.java b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/InvertedIndexAccessMethod.java
index ca70189..f3e3574 100644
--- a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/InvertedIndexAccessMethod.java
+++ b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/InvertedIndexAccessMethod.java
@@ -100,7 +100,7 @@ public class InvertedIndexAccessMethod implements IAccessMethod {
 
     private static List<FunctionIdentifier> funcIdents = new ArrayList<FunctionIdentifier>();
     static {
-        funcIdents.add(AsterixBuiltinFunctions.CONTAINS);
+        funcIdents.add(AsterixBuiltinFunctions.STRING_CONTAINS);
         // For matching similarity-check functions. For example, similarity-jaccard-check returns a list of two items,
         // and the select condition will get the first list-item and check whether it evaluates to true.
         funcIdents.add(AsterixBuiltinFunctions.GET_ITEM);
@@ -127,7 +127,7 @@ public class InvertedIndexAccessMethod implements IAccessMethod {
             List<AbstractLogicalOperator> assignsAndUnnests, AccessMethodAnalysisContext analysisCtx,
             IOptimizationContext context, IVariableTypeEnvironment typeEnvironment) throws AlgebricksException {
 
-        if (funcExpr.getFunctionIdentifier() == AsterixBuiltinFunctions.CONTAINS) {
+        if (funcExpr.getFunctionIdentifier() == AsterixBuiltinFunctions.STRING_CONTAINS) {
             boolean matches = AccessMethodUtils.analyzeFuncExprArgsForOneConstAndVar(funcExpr, analysisCtx, context,
                     typeEnvironment);
             if (!matches) {
@@ -807,7 +807,7 @@ public class InvertedIndexAccessMethod implements IAccessMethod {
     }
 
     private void addFunctionSpecificArgs(IOptimizableFuncExpr optFuncExpr, InvertedIndexJobGenParams jobGenParams) {
-        if (optFuncExpr.getFuncExpr().getFunctionIdentifier() == AsterixBuiltinFunctions.CONTAINS) {
+        if (optFuncExpr.getFuncExpr().getFunctionIdentifier() == AsterixBuiltinFunctions.STRING_CONTAINS) {
             jobGenParams.setSearchModifierType(SearchModifierType.CONJUNCTIVE);
             jobGenParams.setSimilarityThreshold(new AsterixConstantValue(ANull.NULL));
         }
@@ -857,7 +857,7 @@ public class InvertedIndexAccessMethod implements IAccessMethod {
             return isJaccardFuncOptimizable(index, optFuncExpr);
         }
 
-        if (optFuncExpr.getFuncExpr().getFunctionIdentifier() == AsterixBuiltinFunctions.CONTAINS) {
+        if (optFuncExpr.getFuncExpr().getFunctionIdentifier() == AsterixBuiltinFunctions.STRING_CONTAINS) {
             return isContainsFuncOptimizable(index, optFuncExpr);
         }
 


[02/15] incubator-asterixdb git commit: ASTERIXDB-1102: VarSize Encoding to store length of String and ByteArray

Posted by ji...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringReplaceWithFlagsDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringReplaceWithFlagsDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringReplaceWithFlagsDescriptor.java
index 597e9c0..1511d0d 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringReplaceWithFlagsDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringReplaceWithFlagsDescriptor.java
@@ -18,31 +18,22 @@
  */
 package org.apache.asterix.runtime.evaluators.functions;
 
-import java.io.ByteArrayInputStream;
-import java.io.DataInputStream;
 import java.io.DataOutput;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-import org.apache.asterix.common.utils.UTF8CharSequence;
-import org.apache.asterix.formats.nontagged.AqlBinaryComparatorFactoryProvider;
-import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
-import org.apache.asterix.om.base.AString;
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
 import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
-import org.apache.asterix.om.types.BuiltinType;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.api.dataflow.value.IBinaryComparator;
-import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ByteArrayAccessibleOutputStream;
+import org.apache.hyracks.data.std.util.UTF8CharSequence;
 
 public class StringReplaceWithFlagsDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
@@ -67,105 +58,58 @@ public class StringReplaceWithFlagsDescriptor extends AbstractScalarFunctionDyna
 
                 return new AbstractQuadStringStringEval(dout, args[0], args[1], args[2], args[3],
                         AsterixBuiltinFunctions.STRING_REPLACE_WITH_FLAG) {
-
                     private Pattern pattern = null;
                     private Matcher matcher = null;
-                    private String strPattern = "";
-                    private String replace = "";
-                    private int flags = 0;
+                    private String replaceStr;
+                    private String flagStr;
                     private StringBuffer resultBuf = new StringBuffer();
-                    private ByteArrayAccessibleOutputStream lastPattern = new ByteArrayAccessibleOutputStream();
-                    private ByteArrayAccessibleOutputStream lastFlags = new ByteArrayAccessibleOutputStream();
-                    private ByteArrayAccessibleOutputStream lastReplace = new ByteArrayAccessibleOutputStream();
-                    private IBinaryComparator strComp = AqlBinaryComparatorFactoryProvider.INSTANCE
-                            .getBinaryComparatorFactory(BuiltinType.ASTRING, true).createBinaryComparator();
+                    private ByteArrayAccessibleOutputStream lastPatternStorage = new ByteArrayAccessibleOutputStream();
+                    private ByteArrayAccessibleOutputStream lastReplaceStorage = new ByteArrayAccessibleOutputStream();
+                    private ByteArrayAccessibleOutputStream lastFlagStorage = new ByteArrayAccessibleOutputStream();
+                    private UTF8StringPointable lastPatternPtr = new UTF8StringPointable();
+                    private UTF8StringPointable lastReplacePtr = new UTF8StringPointable();
+                    private UTF8StringPointable lastFlagPtr = new UTF8StringPointable();
                     private UTF8CharSequence carSeq = new UTF8CharSequence();
-                    @SuppressWarnings("unchecked")
-                    private ISerializerDeserializer<AString> stringSerde = AqlSerializerDeserializerProvider.INSTANCE
-                            .getSerializerDeserializer(BuiltinType.ASTRING);
 
                     @Override
-                    protected String compute(byte[] b0, int l0, int s0, byte[] b1, int l1, int s1, byte[] b2, int l2,
-                            int s2, byte[] b3, int l3, int s3, ArrayBackedValueStorage array0,
-                            ArrayBackedValueStorage array1) throws AlgebricksException {
-                        try {
-                            boolean newPattern = false;
-                            boolean newFlags = false;
-                            boolean newReplace = false;
-
-                            AString astrPattern;
-                            AString astrFlags;
-
-                            if (pattern == null) {
-                                newPattern = true;
-                                newFlags = true;
-                            } else {
-                                int c = strComp.compare(b1, s1, l1, lastPattern.getByteArray(), 0, lastPattern.size());
-                                if (c != 0) {
-                                    newPattern = true;
-                                }
-
-                                c = strComp.compare(b3, s3, l3, lastFlags.getByteArray(), 0, lastFlags.size());
-                                if (c != 0) {
-                                    newFlags = true;
-                                }
-                            }
-
-                            if (replace == null) {
-                                newReplace = true;
-                            } else {
-                                int c = strComp.compare(b2, s2, l2, lastReplace.getByteArray(), 0, lastReplace.size());
-                                if (c != 0) {
-                                    newReplace = true;
-                                }
-                            }
-
-                            if (newPattern) {
-                                lastPattern.reset();
-                                lastPattern.write(b1, s1, l1);
-                                // ! object creation !
-                                DataInputStream di = new DataInputStream(new ByteArrayInputStream(
-                                        lastPattern.getByteArray()));
-                                astrPattern = (AString) stringSerde.deserialize(di);
-                                // strPattern = toRegex(astrPattern);
-                                strPattern = astrPattern.getStringValue();
-                            }
-                            if (newReplace) {
-                                lastReplace.reset();
-                                lastReplace.write(b2, s2, l2);
-                                // ! object creation !
-                                DataInputStream di = new DataInputStream(new ByteArrayInputStream(
-                                        lastReplace.getByteArray()));
-                                replace = ((AString) stringSerde.deserialize(di)).getStringValue();
-                            }
-                            if (newFlags) {
-                                lastFlags.reset();
-                                lastFlags.write(b3, s3, l3);
-                                // ! object creation !
-                                DataInputStream di = new DataInputStream(new ByteArrayInputStream(
-                                        lastFlags.getByteArray()));
-                                astrFlags = (AString) stringSerde.deserialize(di);
-                                flags = StringEvaluatorUtils.toFlag(astrFlags);
-                            }
-
-                            if (newPattern || newFlags)
-                                pattern = Pattern.compile(strPattern, flags);
-                            resultBuf.setLength(0);
-                            carSeq.reset(array0, 1);
-                            if (newPattern) {
-                                matcher = pattern.matcher(carSeq);
-                            } else {
-                                matcher.reset(carSeq);
-                            }
-                            while (matcher.find()) {
-                                matcher.appendReplacement(resultBuf, replace);
-                            }
-                            matcher.appendTail(resultBuf);
-                            return resultBuf.toString();
-                        } catch (HyracksDataException e) {
-                            throw new AlgebricksException(e);
+                    protected String compute(UTF8StringPointable srcPtr, UTF8StringPointable patternPtr,
+                            UTF8StringPointable replacePtr, UTF8StringPointable flagPtr) throws AlgebricksException {
+                        resultBuf.setLength(0);
+                        final boolean newPattern = (pattern == null || lastPatternPtr.compareTo(patternPtr) != 0);
+                        final boolean newReplace = (pattern == null || lastReplacePtr.compareTo(replacePtr) != 0);
+                        final boolean newFlag = (pattern == null || lastFlagPtr.compareTo(flagPtr) != 0);
+
+                        if (newFlag) {
+                            StringEvaluatorUtils.copyResetUTF8Pointable(flagPtr, lastFlagStorage, lastFlagPtr);
+                            flagStr = lastFlagPtr.toString();
+                        }
+                        if (newPattern) {
+                            StringEvaluatorUtils.copyResetUTF8Pointable(patternPtr, lastPatternStorage, lastPatternPtr);
+                        }
+
+                        if (newPattern || newFlag) {
+                            pattern = Pattern.compile(lastPatternPtr.toString(), StringEvaluatorUtils.toFlag(flagStr));
+                        }
+
+                        if (newReplace) {
+                            StringEvaluatorUtils.copyResetUTF8Pointable(replacePtr, lastReplaceStorage, lastReplacePtr);
+                            replaceStr = replacePtr.toString();
                         }
+
+                        carSeq.reset(srcPtr);
+                        if (newPattern || newFlag) {
+                            matcher = pattern.matcher(carSeq);
+                        } else {
+                            matcher.reset(carSeq);
+                        }
+
+                        while (matcher.find()) {
+                            matcher.appendReplacement(resultBuf, replaceStr);
+                        }
+                        matcher.appendTail(resultBuf);
+                        return resultBuf.toString();
                     }
+
                 };
             }
         };

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringStartWithDescrtiptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringStartWithDescrtiptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringStartWithDescrtiptor.java
deleted file mode 100644
index 4920443..0000000
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringStartWithDescrtiptor.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.asterix.runtime.evaluators.functions;
-
-import java.io.DataOutput;
-
-import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
-import org.apache.asterix.om.functions.IFunctionDescriptor;
-import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
-import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
-import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
-
-public class StringStartWithDescrtiptor extends AbstractScalarFunctionDynamicDescriptor {
-    private static final long serialVersionUID = 1L;
-
-    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
-        public IFunctionDescriptor createFunctionDescriptor() {
-            return new StringStartWithDescrtiptor();
-        }
-    };
-
-    @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-
-        return new ICopyEvaluatorFactory() {
-            private static final long serialVersionUID = 1L;
-
-            @Override
-            public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
-
-                DataOutput dout = output.getDataOutput();
-
-                return new AbstractBinaryStringBoolEval(dout, args[0], args[1],
-                        AsterixBuiltinFunctions.STRING_START_WITH) {
-
-                    @Override
-                    protected boolean compute(byte[] lBytes, int lLen, int lStart, byte[] rBytes, int rLen, int rStart,
-                            ArrayBackedValueStorage array0, ArrayBackedValueStorage array1) {
-                        int patternLength = UTF8StringPointable.getUTFLength(rBytes, 1);
-                        if (patternLength > UTF8StringPointable.getUTFLength(lBytes, 1))
-                            return false;
-
-                        int pos = 3;
-                        while (pos < patternLength + 3) {
-                            char c1 = UTF8StringPointable.charAt(lBytes, pos);
-                            char c2 = UTF8StringPointable.charAt(rBytes, pos);
-                            if (c1 != c2)
-                                return false;
-
-                            pos += UTF8StringPointable.charSize(lBytes, pos);
-                        }
-
-                        return true;
-                    }
-
-                };
-            }
-        };
-    }
-
-    @Override
-    public FunctionIdentifier getIdentifier() {
-        return AsterixBuiltinFunctions.STRING_START_WITH;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringStartsWithDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringStartsWithDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringStartsWithDescriptor.java
new file mode 100644
index 0000000..8fcca3c
--- /dev/null
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringStartsWithDescriptor.java
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.asterix.runtime.evaluators.functions;
+
+import java.io.DataOutput;
+
+import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptor;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+
+public class StringStartsWithDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+
+    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        public IFunctionDescriptor createFunctionDescriptor() {
+            return new StringStartsWithDescriptor();
+        }
+    };
+
+    @Override
+    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+
+        return new ICopyEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
+
+                DataOutput dout = output.getDataOutput();
+
+                return new AbstractBinaryStringBoolEval(dout, args[0], args[1],
+                        AsterixBuiltinFunctions.STRING_STARTS_WITH) {
+
+                    @Override
+                    protected boolean compute(UTF8StringPointable left, UTF8StringPointable right)
+                            throws AlgebricksException {
+                        return UTF8StringPointable.startsWith(left, right, false);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return AsterixBuiltinFunctions.STRING_STARTS_WITH;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringToCodePointDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringToCodePointDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringToCodePointDescriptor.java
index 3bf0dc5..654e0b6 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringToCodePointDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringToCodePointDescriptor.java
@@ -39,9 +39,9 @@ import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
-import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
+import org.apache.hyracks.util.string.UTF8StringUtil;
 
 public class StringToCodePointDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
@@ -62,7 +62,8 @@ public class StringToCodePointDescriptor extends AbstractScalarFunctionDynamicDe
             @Override
             public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
                 return new ICopyEvaluator() {
-                    protected final DataOutput out = output.getDataOutput();;
+                    protected final DataOutput out = output.getDataOutput();
+                    ;
                     protected final ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
                     protected final ICopyEvaluator stringEval = args[0].createEvaluator(argOut);
                     protected final AOrderedListType intListType = new AOrderedListType(BuiltinType.AINT64, null);
@@ -75,36 +76,6 @@ public class StringToCodePointDescriptor extends AbstractScalarFunctionDynamicDe
                             .getSerializerDeserializer(BuiltinType.AINT64);
                     private final AMutableInt64 aInt64 = new AMutableInt64(0);
 
-                    int UTF8ToCodePoint(byte[] b, int s) {
-                        if (b[s] >> 7 == 0) {
-                            // 1 byte
-                            return b[s];
-                        } else if ((b[s] & 0xe0) == 0xc0) { /*0xe0 = 0b1110000*/
-                            // 2 bytes
-                            return ((int) (b[s] & 0x1f)) << 6 | /*0x3f = 0b00111111*/
-                            ((int) (b[s + 1] & 0x3f));
-                        } else if ((b[s] & 0xf0) == 0xe0) {
-                            // 3bytes
-                            return ((int) (b[s] & 0xf)) << 12 | ((int) (b[s + 1] & 0x3f)) << 6
-                                    | ((int) (b[s + 2] & 0x3f));
-                        } else if ((b[s] & 0xf8) == 0xf0) {
-                            // 4bytes
-                            return ((int) (b[s] & 0x7)) << 18 | ((int) (b[s + 1] & 0x3f)) << 12
-                                    | ((int) (b[s + 2] & 0x3f)) << 6 | ((int) (b[s + 3] & 0x3f));
-                        } else if ((b[s] & 0xfc) == 0xf8) {
-                            // 5bytes
-                            return ((int) (b[s] & 0x3)) << 24 | ((int) (b[s + 1] & 0x3f)) << 18
-                                    | ((int) (b[s + 2] & 0x3f)) << 12 | ((int) (b[s + 3] & 0x3f)) << 6
-                                    | ((int) (b[s + 4] & 0x3f));
-                        } else if ((b[s] & 0xfe) == 0xfc) {
-                            // 6bytes
-                            return ((int) (b[s] & 0x1)) << 30 | ((int) (b[s + 1] & 0x3f)) << 24
-                                    | ((int) (b[s + 2] & 0x3f)) << 18 | ((int) (b[s + 3] & 0x3f)) << 12
-                                    | ((int) (b[s + 4] & 0x3f)) << 6 | ((int) (b[s + 5] & 0x3f));
-                        }
-                        return 0;
-                    }
-
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
                         try {
@@ -114,13 +85,14 @@ public class StringToCodePointDescriptor extends AbstractScalarFunctionDynamicDe
 
                             if (serString[0] == SER_STRING_TYPE_TAG) {
                                 byte[] bytes = argOut.getByteArray();
-                                int len = UTF8StringPointable.getUTFLength(bytes, 1);
+                                int len = UTF8StringUtil.getUTFLength(bytes, 1);
 
-                                int pos = 3;
+                                int start = 1 + UTF8StringUtil.getNumBytesToStoreLength(len);
+                                int pos = 0;
                                 listBuilder.reset(intListType);
-                                while (pos < len + 3) {
-                                    int codePoint = UTF8ToCodePoint(bytes, pos);
-                                    pos += UTF8StringPointable.charSize(bytes, pos);
+                                while (pos < len) {
+                                    int codePoint = UTF8StringUtil.UTF8ToCodePoint(bytes, start + pos);
+                                    pos += UTF8StringUtil.charSize(bytes, start + pos);
 
                                     inputVal.reset();
                                     aInt64.setValue(codePoint);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringUpperCaseDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringUpperCaseDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringUpperCaseDescriptor.java
index 3a13670..fc32dfd 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringUpperCaseDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringUpperCaseDescriptor.java
@@ -38,8 +38,9 @@ import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
 import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
+import org.apache.hyracks.data.std.util.GrowableArray;
+import org.apache.hyracks.data.std.util.UTF8StringBuilder;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
-import org.apache.hyracks.dataflow.common.data.util.StringUtils;
 
 public class StringUpperCaseDescriptor extends AbstractScalarFunctionDynamicDescriptor {
     private static final long serialVersionUID = 1L;
@@ -67,6 +68,10 @@ public class StringUpperCaseDescriptor extends AbstractScalarFunctionDynamicDesc
 
                     private final byte stt = ATypeTag.STRING.serialize();
 
+                    private final GrowableArray array = new GrowableArray();
+                    private final UTF8StringBuilder builder = new UTF8StringBuilder();
+                    private final UTF8StringPointable string = new UTF8StringPointable();
+
                     @SuppressWarnings("unchecked")
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
@@ -80,19 +85,12 @@ public class StringUpperCaseDescriptor extends AbstractScalarFunctionDynamicDesc
                             byte[] serString = outInput.getByteArray();
 
                             if (serString[0] == SER_STRING_TYPE_TAG) {
-                                byte[] bytes = outInput.getByteArray();
-                                int len = UTF8StringPointable.getUTFLength(bytes, 1);
+                                string.set(serString, 1, serString.length);
+                                array.reset();
+                                UTF8StringPointable.uppercase(string, builder, array);
 
                                 out.writeByte(stt);
-                                StringUtils.writeUTF8Len(len, out);
-
-                                int pos = 3;
-                                while (pos < len + 3) {
-                                    char c1 = UTF8StringPointable.charAt(bytes, pos);
-                                    c1 = Character.toUpperCase(c1);
-                                    pos += UTF8StringPointable.charSize(bytes, pos);
-                                    StringUtils.writeCharAsModifiedUTF8(c1, out);
-                                }
+                                out.write(array.getByteArray(), 0, array.getLength());
                             } else if (serString[0] == SER_NULL_TYPE_TAG)
                                 nullSerde.serialize(ANull.NULL, out);
                             else

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/Substring2Descriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/Substring2Descriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/Substring2Descriptor.java
index 0a4d270..f843051 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/Substring2Descriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/Substring2Descriptor.java
@@ -36,6 +36,8 @@ import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
 import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
+import org.apache.hyracks.data.std.util.GrowableArray;
+import org.apache.hyracks.data.std.util.UTF8StringBuilder;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class Substring2Descriptor extends AbstractScalarFunctionDynamicDescriptor {
@@ -66,6 +68,10 @@ public class Substring2Descriptor extends AbstractScalarFunctionDynamicDescripto
                     private ICopyEvaluator evalStart = args[1].createEvaluator(argOut);
                     private final byte stt = ATypeTag.STRING.serialize();
 
+                    private final GrowableArray array = new GrowableArray();
+                    private final UTF8StringBuilder builder = new UTF8StringBuilder();
+                    private final UTF8StringPointable string = new UTF8StringPointable();
+
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
                         argOut.reset();
@@ -86,29 +92,20 @@ public class Substring2Descriptor extends AbstractScalarFunctionDynamicDescripto
                                     + ": expects type STRING for the first argument but got "
                                     + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[0]));
                         }
-                        int utflen = UTF8StringPointable.getUTFLength(bytes, 1);
-                        int sStart = 3;
-                        int c = 0;
-                        int idxPos1 = 0;
-
-                        // skip to start
-                        while (idxPos1 < start && c < utflen) {
-                            c += UTF8StringPointable.charSize(bytes, sStart + c);
-                            ++idxPos1;
-                        }
-                        int startSubstr = c;
-
-                        while (c < utflen) {
-                            c += UTF8StringPointable.charSize(bytes, sStart + c);
+                        string.set(bytes, 1, bytes.length);
+                        array.reset();
+                        try {
+                            UTF8StringPointable.substr(string, start, Integer.MAX_VALUE, builder, array);
+                        } catch (StringIndexOutOfBoundsException e) {
+                            throw new AlgebricksException(AsterixBuiltinFunctions.SUBSTRING.getName() + ": start="
+                                    + start + "\tgoing past the input length.");
+                        } catch (IOException e) {
+                            throw new AlgebricksException(e);
                         }
 
-                        int substrByteLen = c - startSubstr;
                         try {
                             out.writeByte(stt);
-                            out.writeByte((byte) ((substrByteLen >>> 8) & 0xFF));
-                            out.writeByte((byte) ((substrByteLen >>> 0) & 0xFF));
-                            out.write(bytes, sStart + startSubstr, substrByteLen);
-
+                            out.write(array.getByteArray(), 0, array.getLength());
                         } catch (IOException e) {
                             throw new AlgebricksException(e);
                         }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SubstringAfterDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SubstringAfterDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SubstringAfterDescriptor.java
index f2439ab..ff84986 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SubstringAfterDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SubstringAfterDescriptor.java
@@ -34,6 +34,8 @@ import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
 import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
+import org.apache.hyracks.data.std.util.GrowableArray;
+import org.apache.hyracks.data.std.util.UTF8StringBuilder;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class SubstringAfterDescriptor extends AbstractScalarFunctionDynamicDescriptor {
@@ -66,6 +68,11 @@ public class SubstringAfterDescriptor extends AbstractScalarFunctionDynamicDescr
                     private ICopyEvaluator evalPattern = args[1].createEvaluator(array1);
                     private final byte stt = ATypeTag.STRING.serialize();
 
+                    private final GrowableArray array = new GrowableArray();
+                    private final UTF8StringBuilder builder = new UTF8StringBuilder();
+                    private final UTF8StringPointable stringPtr = new UTF8StringPointable();
+                    private final UTF8StringPointable patternPtr = new UTF8StringPointable();
+
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
                         array0.reset();
@@ -84,44 +91,25 @@ public class SubstringAfterDescriptor extends AbstractScalarFunctionDynamicDescr
                                     + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(pattern[0]) + ").");
                         }
 
-                        int srcLen = UTF8StringPointable.getUTFLength(src, 1);
-                        int patternLen = UTF8StringPointable.getUTFLength(pattern, 1);
-                        int posSrc = 3;
-                        int posPattern = 3;
-
-                        int offset = 0;
-                        // boolean found = false;
-                        while (posSrc - 3 < srcLen - patternLen) {
-                            offset = 0;
-                            while (posPattern + offset - 3 < patternLen && posSrc + offset - 3 < srcLen) {
-                                char c1 = UTF8StringPointable.charAt(src, posSrc + offset);
-                                char c2 = UTF8StringPointable.charAt(pattern, posPattern + offset);
-                                if (c1 != c2)
-                                    break;
-                                offset++;
-                            }
-                            if (offset == patternLen) {
-                                // found = true;
-                                break;
-                            }
-                            posSrc += UTF8StringPointable.charSize(src, posSrc);
-                        }
-
-                        posSrc += patternLen;
-                        int substrByteLen = srcLen - posSrc + 3;
+                        stringPtr.set(src, 1, src.length);
+                        patternPtr.set(pattern, 1, pattern.length);
+                        array.reset();
                         try {
+                            UTF8StringPointable.substrAfter(stringPtr, patternPtr, builder, array);
                             out.writeByte(stt);
-                            out.writeByte((byte) ((substrByteLen >>> 8) & 0xFF));
-                            out.writeByte((byte) ((substrByteLen >>> 0) & 0xFF));
-                            out.write(src, posSrc, substrByteLen);
-
+                            out.write(array.getByteArray(), 0, array.getLength());
                         } catch (IOException e) {
                             throw new AlgebricksException(e);
                         }
+
                     }
-                };
+                }
+
+                        ;
             }
-        };
+        }
+
+                ;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SubstringBeforeDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SubstringBeforeDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SubstringBeforeDescriptor.java
index 9f6de3e..3871ed7 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SubstringBeforeDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SubstringBeforeDescriptor.java
@@ -34,6 +34,8 @@ import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
 import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
+import org.apache.hyracks.data.std.util.GrowableArray;
+import org.apache.hyracks.data.std.util.UTF8StringBuilder;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class SubstringBeforeDescriptor extends AbstractScalarFunctionDynamicDescriptor {
@@ -66,6 +68,11 @@ public class SubstringBeforeDescriptor extends AbstractScalarFunctionDynamicDesc
                     private ICopyEvaluator evalPattern = args[1].createEvaluator(array1);
                     private final byte stt = ATypeTag.STRING.serialize();
 
+                    private final GrowableArray array = new GrowableArray();
+                    private final UTF8StringBuilder builder = new UTF8StringBuilder();
+                    private final UTF8StringPointable stringPtr = new UTF8StringPointable();
+                    private final UTF8StringPointable patternPtr = new UTF8StringPointable();
+
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
                         array0.reset();
@@ -84,37 +91,17 @@ public class SubstringBeforeDescriptor extends AbstractScalarFunctionDynamicDesc
                                     + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(pattern[0]) + ").");
                         }
 
-                        int srcLen = UTF8StringPointable.getUTFLength(src, 1);
-                        int patternLen = UTF8StringPointable.getUTFLength(pattern, 1);
-                        int posSrc = 3;
-                        int posPattern = 3;
-
-                        int offset = 0;
-                        while (posSrc - 3 < srcLen - patternLen) {
-                            while (posPattern + offset - 3 < patternLen && posSrc + offset - 3 < srcLen) {
-                                char c1 = UTF8StringPointable.charAt(src, posSrc + offset);
-                                char c2 = UTF8StringPointable.charAt(pattern, posPattern + offset);
-                                if (c1 != c2)
-                                    break;
-                                offset++;
-                            }
-                            if (offset == patternLen) {
-                                break;
-                            }
-                            posSrc += UTF8StringPointable.charSize(src, posSrc);
-                        }
-                        int startSubstr = 3;
-
-                        int substrByteLen = posSrc - startSubstr;
+                        stringPtr.set(src, 1, src.length);
+                        patternPtr.set(pattern, 1, pattern.length);
+                        array.reset();
                         try {
+                            UTF8StringPointable.substrBefore(stringPtr, patternPtr, builder, array);
                             out.writeByte(stt);
-                            out.writeByte((byte) ((substrByteLen >>> 8) & 0xFF));
-                            out.writeByte((byte) ((substrByteLen >>> 0) & 0xFF));
-                            out.write(src, startSubstr, substrByteLen);
-
+                            out.write(array.getByteArray(), 0, array.getLength());
                         } catch (IOException e) {
                             throw new AlgebricksException(e);
                         }
+
                     }
                 };
             }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SubstringDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SubstringDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SubstringDescriptor.java
index 921bdce..42d64b3 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SubstringDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SubstringDescriptor.java
@@ -38,6 +38,8 @@ import org.apache.hyracks.data.std.primitive.LongPointable;
 import org.apache.hyracks.data.std.primitive.ShortPointable;
 import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
+import org.apache.hyracks.data.std.util.GrowableArray;
+import org.apache.hyracks.data.std.util.UTF8StringBuilder;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class SubstringDescriptor extends AbstractScalarFunctionDynamicDescriptor {
@@ -59,13 +61,17 @@ public class SubstringDescriptor extends AbstractScalarFunctionDynamicDescriptor
             public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
                 return new ICopyEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
-                    private ICopyEvaluator evalString = args[0].createEvaluator(argOut);
-                    private ICopyEvaluator evalStart = args[1].createEvaluator(argOut);
-                    private ICopyEvaluator evalLen = args[2].createEvaluator(argOut);
+                    private final DataOutput out = output.getDataOutput();
+                    private final ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
+                    private final ICopyEvaluator evalString = args[0].createEvaluator(argOut);
+                    private final ICopyEvaluator evalStart = args[1].createEvaluator(argOut);
+                    private final ICopyEvaluator evalLen = args[2].createEvaluator(argOut);
                     private final byte stt = ATypeTag.STRING.serialize();
 
+                    private final GrowableArray array = new GrowableArray();
+                    private final UTF8StringBuilder builder = new UTF8StringBuilder();
+                    private final UTF8StringPointable string = new UTF8StringPointable();
+
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
                         argOut.reset();
@@ -140,35 +146,21 @@ public class SubstringDescriptor extends AbstractScalarFunctionDynamicDescriptor
                             throw new AlgebricksException(AsterixBuiltinFunctions.SUBSTRING.getName()
                                     + ": expects type STRING for the first argument but got " + argOutTypeTag);
                         }
-                        int utflen = UTF8StringPointable.getUTFLength(bytes, 1);
-                        int sStart = 3;
-                        int c = 0;
-                        int idxPos1 = 0;
-                        // skip to start
-                        while (idxPos1 < start && c < utflen) {
-                            c += UTF8StringPointable.charSize(bytes, sStart + c);
-                            ++idxPos1;
-                        }
-                        int startSubstr = c;
-                        int idxPos2 = 0;
-                        while (idxPos2 < len && c < utflen) {
-                            c += UTF8StringPointable.charSize(bytes, sStart + c);
-                            ++idxPos2;
-                        }
 
-                        if (idxPos2 < len) {
+                        string.set(bytes, 1, bytes.length);
+                        array.reset();
+                        try {
+                            UTF8StringPointable.substr(string, start, len, builder, array);
+                        } catch (StringIndexOutOfBoundsException e) {
                             throw new AlgebricksException(AsterixBuiltinFunctions.SUBSTRING.getName() + ": start="
-                                    + start + "\tlen=" + len + "\tgoing past the input length=" + (idxPos1 + idxPos2)
-                                    + ".");
+                                    + start + "\tgoing past the input length.");
+                        } catch (IOException e) {
+                            throw new AlgebricksException(e);
                         }
 
-                        int substrByteLen = c - startSubstr;
                         try {
                             out.writeByte(stt);
-                            out.writeByte((byte) ((substrByteLen >>> 8) & 0xFF));
-                            out.writeByte((byte) ((substrByteLen >>> 0) & 0xFF));
-                            out.write(bytes, sStart + startSubstr, substrByteLen);
-
+                            out.write(array.getByteArray(), 0, array.getLength());
                         } catch (IOException e) {
                             throw new AlgebricksException(e);
                         }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/AbstractCopyEvaluator.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/AbstractCopyEvaluator.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/AbstractCopyEvaluator.java
index e90d3a0..6de63a2 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/AbstractCopyEvaluator.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/AbstractCopyEvaluator.java
@@ -76,7 +76,7 @@ public abstract class AbstractCopyEvaluator implements ICopyEvaluator {
     private static final String THIRD = "3rd";
     private static final String TH = "th";
 
-    public static String idToString(int i) {
+    public static String rankToString(int i) {
         String prefix = "";
         if (i >= 10) {
             prefix = String.valueOf(i / 10);
@@ -99,7 +99,7 @@ public abstract class AbstractCopyEvaluator implements ICopyEvaluator {
             if (expected[i] != actual[i]) {
                 if (!ATypeHierarchy.canPromote(actual[i], expected[i])
                         && !ATypeHierarchy.canPromote(expected[i], actual[i])) {
-                    throw new AlgebricksException(title + ": expects " + expected[i] + " at " + idToString(i + 1)
+                    throw new AlgebricksException(title + ": expects " + expected[i] + " at " + rankToString(i + 1)
                             + " argument, but got " + actual[i]);
                 }
             }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/BinaryConcatDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/BinaryConcatDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/BinaryConcatDescriptor.java
index 4a9c143..a6d9b57 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/BinaryConcatDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/BinaryConcatDescriptor.java
@@ -19,6 +19,8 @@
 
 package org.apache.asterix.runtime.evaluators.functions.binary;
 
+import java.io.IOException;
+
 import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
 import org.apache.asterix.om.functions.IFunctionDescriptor;
@@ -34,31 +36,36 @@ import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
 import org.apache.hyracks.data.std.primitive.ByteArrayPointable;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
-
-import java.io.IOException;
+import org.apache.hyracks.util.encoding.VarLenIntEncoderDecoder;
 
 public class BinaryConcatDescriptor extends AbstractScalarFunctionDynamicDescriptor {
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
-        @Override public IFunctionDescriptor createFunctionDescriptor() {
+        @Override
+        public IFunctionDescriptor createFunctionDescriptor() {
             return new BinaryConcatDescriptor();
         }
     };
 
-    @Override public FunctionIdentifier getIdentifier() {
+    @Override
+    public FunctionIdentifier getIdentifier() {
         return AsterixBuiltinFunctions.BINARY_CONCAT;
     }
 
-    @Override public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args)
+    @Override
+    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args)
             throws AlgebricksException {
         return new ICopyEvaluatorFactory() {
-            @Override public ICopyEvaluator createEvaluator(final IDataOutputProvider output)
+            @Override
+            public ICopyEvaluator createEvaluator(final IDataOutputProvider output)
                     throws AlgebricksException {
                 return new AbstractCopyEvaluator(output, args) {
 
                     private final AsterixListAccessor listAccessor = new AsterixListAccessor();
                     private final byte SER_BINARY_TYPE = ATypeTag.BINARY.serialize();
+                    private final byte[] metaBuffer = new byte[5];
 
-                    @Override public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    @Override
+                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
                         ATypeTag typeTag = evaluateTuple(tuple, 0);
                         if (typeTag != ATypeTag.UNORDEREDLIST && typeTag != ATypeTag.ORDEREDLIST) {
                             throw new AlgebricksException(getIdentifier().getName()
@@ -79,19 +86,19 @@ public class BinaryConcatDescriptor extends AbstractScalarFunctionDynamicDescrip
                                     throw new AlgebricksException(getIdentifier().getName()
                                             + ": expects type STRING/NULL for the list item but got " + itemType);
                                 }
-                                concatLength += ByteArrayPointable.getLength(storages[0].getByteArray(), itemOffset);
-                            }
-                            if (concatLength > ByteArrayPointable.MAX_LENGTH) {
-                                throw new AlgebricksException("the concatenated binary is too long.");
+                                concatLength += ByteArrayPointable.getContentLength(storages[0].getByteArray(),
+                                        itemOffset);
                             }
                             dataOutput.writeByte(SER_BINARY_TYPE);
-                            dataOutput.writeShort(concatLength);
+                            int metaLen = VarLenIntEncoderDecoder.encode(concatLength, metaBuffer, 0);
+                            dataOutput.write(metaBuffer, 0, metaLen);
 
                             for (int i = 0; i < listAccessor.size(); i++) {
                                 int itemOffset = listAccessor.getItemOffset(i);
-                                int length = ByteArrayPointable.getLength(storages[0].getByteArray(), itemOffset);
+                                int length = ByteArrayPointable.getContentLength(storages[0].getByteArray(),
+                                        itemOffset);
                                 dataOutput.write(storages[0].getByteArray(),
-                                        itemOffset + ByteArrayPointable.SIZE_OF_LENGTH, length);
+                                        itemOffset + ByteArrayPointable.getNumberBytesToStoreMeta(length), length);
                             }
                         } catch (HyracksDataException e) {
                             throw new AlgebricksException(e);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/BinaryLengthDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/BinaryLengthDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/BinaryLengthDescriptor.java
index 9b40fa5..c42e054 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/BinaryLengthDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/BinaryLengthDescriptor.java
@@ -67,7 +67,7 @@ public class BinaryLengthDescriptor extends AbstractScalarFunctionDynamicDescrip
                                 return;
                             }
                             checkTypeMachingThrowsIfNot(getIdentifier().getName(), EXPECTED_TAGS, tag);
-                            int len = ByteArrayPointable.getLength(storages[0].getByteArray(), 1);
+                            int len = ByteArrayPointable.getContentLength(storages[0].getByteArray(), 1);
                             result.setValue(len);
                             intSerde.serialize(result, dataOutput);
                         } catch (HyracksDataException e) {

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/FindBinaryDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/FindBinaryDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/FindBinaryDescriptor.java
index 602c548..af0aaba 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/FindBinaryDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/FindBinaryDescriptor.java
@@ -41,24 +41,29 @@ import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 public class FindBinaryDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
-        @Override public IFunctionDescriptor createFunctionDescriptor() {
+        @Override
+        public IFunctionDescriptor createFunctionDescriptor() {
             return new FindBinaryDescriptor();
         }
     };
 
-    @Override public FunctionIdentifier getIdentifier() {
+    @Override
+    public FunctionIdentifier getIdentifier() {
         return AsterixBuiltinFunctions.FIND_BINARY;
     }
 
     private static final ATypeTag[] EXPECTED_INPUT_TAG = { ATypeTag.BINARY, ATypeTag.BINARY };
 
-    @Override public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args)
+    @Override
+    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args)
             throws AlgebricksException {
         return new ICopyEvaluatorFactory() {
-            @Override public ICopyEvaluator createEvaluator(final IDataOutputProvider output)
+            @Override
+            public ICopyEvaluator createEvaluator(final IDataOutputProvider output)
                     throws AlgebricksException {
                 return new AbstractFindBinaryCopyEvaluator(output, args, getIdentifier().getName()) {
-                    @Override protected int getFromOffset(IFrameTupleReference tuple) throws AlgebricksException {
+                    @Override
+                    protected int getFromOffset(IFrameTupleReference tuple) throws AlgebricksException {
                         return 0;
                     }
                 };
@@ -76,12 +81,15 @@ public class FindBinaryDescriptor extends AbstractScalarFunctionDynamicDescripto
 
         protected String functionName;
         protected AMutableInt64 result = new AMutableInt64(-1);
+        protected final ByteArrayPointable textPtr = new ByteArrayPointable();
+        protected final ByteArrayPointable wordPtr = new ByteArrayPointable();
 
         @SuppressWarnings("unchecked")
         protected ISerializerDeserializer<AInt64> intSerde = AqlSerializerDeserializerProvider.INSTANCE
                 .getSerializerDeserializer(BuiltinType.AINT64);
 
-        @Override public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+        @Override
+        public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
             ATypeTag textTag = evaluateTuple(tuple, 0);
             ATypeTag wordTag = evaluateTuple(tuple, 1);
             int fromOffset = getFromOffset(tuple);
@@ -93,11 +101,12 @@ public class FindBinaryDescriptor extends AbstractScalarFunctionDynamicDescripto
                 checkTypeMachingThrowsIfNot(functionName, EXPECTED_INPUT_TAG, textTag,
                         wordTag);
 
-                byte[] textBytes = storages[0].getByteArray();
-                byte[] wordBytes = storages[1].getByteArray();
-                int textLength = ByteArrayPointable.getLength(textBytes, 1);
-                int wordLength = ByteArrayPointable.getLength(wordBytes, 1);
-                result.setValue(1 + indexOf(textBytes, 3, textLength, wordBytes, 3, wordLength, fromOffset));
+                textPtr.set(storages[0].getByteArray(), 1, storages[0].getLength() - 1);
+                wordPtr.set(storages[1].getByteArray(), 1, storages[1].getLength() - 1);
+                result.setValue(
+                        1 + indexOf(textPtr.getByteArray(), textPtr.getContentStartOffset(), textPtr.getContentLength(),
+                                wordPtr.getByteArray(), wordPtr.getContentStartOffset(), wordPtr.getContentLength(),
+                                fromOffset));
                 intSerde.serialize(result, dataOutput);
             } catch (HyracksDataException e) {
                 throw new AlgebricksException(e);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/ParseBinaryDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/ParseBinaryDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/ParseBinaryDescriptor.java
index df23e6e..ffe2c9a 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/ParseBinaryDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/ParseBinaryDescriptor.java
@@ -37,28 +37,13 @@ import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
 import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
-import org.apache.hyracks.dataflow.common.data.parsers.ByteArrayBase64ParserFactory;
-import org.apache.hyracks.dataflow.common.data.parsers.ByteArrayHexParserFactory;
+import org.apache.hyracks.util.bytes.Base64Parser;
+import org.apache.hyracks.util.bytes.HexParser;
 
 public class ParseBinaryDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
-    static final String HEX_FORMAT = "hex";
-    static final String BASE64_FORMAT = "base64";
-
-    static boolean isCaseIgnoreEqual(String expectedLowerCaseString, byte[] bytes, int start,
-            int length) {
-        int pos = start;
-        int index = 0;
-        while (pos < start + length) {
-            char c1 = UTF8StringPointable.charAt(bytes, pos);
-            c1 = Character.toLowerCase(c1);
-            if (expectedLowerCaseString.charAt(index++) != c1) {
-                return false;
-            }
-            pos += UTF8StringPointable.charSize(bytes, pos);
-        }
-        return index == expectedLowerCaseString.length();
-    }
+    static final UTF8StringPointable HEX_FORMAT = UTF8StringPointable.generateUTF8Pointable("hex");
+    static final UTF8StringPointable BASE64_FORMAT = UTF8StringPointable.generateUTF8Pointable("base64");
 
     public final static IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
         @Override
@@ -69,14 +54,17 @@ public class ParseBinaryDescriptor extends AbstractScalarFunctionDynamicDescript
 
     public static final ATypeTag[] EXPECTED_INPUT_TAGS = { ATypeTag.STRING, ATypeTag.STRING };
 
-    @Override public FunctionIdentifier getIdentifier() {
+    @Override
+    public FunctionIdentifier getIdentifier() {
         return AsterixBuiltinFunctions.PARSE_BINARY;
     }
 
-    @Override public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args)
+    @Override
+    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args)
             throws AlgebricksException {
         return new ICopyEvaluatorFactory() {
-            @Override public ICopyEvaluator createEvaluator(final IDataOutputProvider output)
+            @Override
+            public ICopyEvaluator createEvaluator(final IDataOutputProvider output)
                     throws AlgebricksException {
                 return new AbstractCopyEvaluator(output, args) {
 
@@ -85,9 +73,14 @@ public class ParseBinaryDescriptor extends AbstractScalarFunctionDynamicDescript
                             .getSerializerDeserializer(BuiltinType.ABINARY);
 
                     private AMutableBinary aBinary = new AMutableBinary(new byte[0], 0, 0);
-                    private final byte[] quadruplet = new byte[4];
+                    private final UTF8StringPointable stringPointable = new UTF8StringPointable();
+                    private final UTF8StringPointable formatPointable = new UTF8StringPointable();
+
+                    private final HexParser hexParser = new HexParser();
+                    private final Base64Parser base64Parser = new Base64Parser();
 
-                    @Override public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    @Override
+                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
                         ATypeTag binaryTag = evaluateTuple(tuple, 0);
                         ATypeTag formatTag = evaluateTuple(tuple, 1);
 
@@ -97,22 +90,22 @@ public class ParseBinaryDescriptor extends AbstractScalarFunctionDynamicDescript
                             }
                             checkTypeMachingThrowsIfNot(getIdentifier().getName(), EXPECTED_INPUT_TAGS, binaryTag,
                                     formatTag);
-                            int lengthString = UTF8StringPointable.getUTFLength(storages[0].getByteArray(), 1);
-                            int lengthFormat = UTF8StringPointable.getUTFLength(storages[1].getByteArray(), 1);
-                            byte[] buffer;
-                            if (isCaseIgnoreEqual(HEX_FORMAT, storages[1].getByteArray(), 3, lengthFormat)) {
-                                buffer = ByteArrayHexParserFactory
-                                        .extractPointableArrayFromHexString(storages[0].getByteArray(), 3,
-                                                lengthString, aBinary.getBytes());
-                            } else if (isCaseIgnoreEqual(BASE64_FORMAT, storages[1].getByteArray(), 3, lengthFormat)) {
-                                buffer = ByteArrayBase64ParserFactory
-                                        .extractPointableArrayFromBase64String(storages[0].getByteArray(), 3
-                                                , lengthString, aBinary.getBytes(), quadruplet);
+                            stringPointable.set(storages[0].getByteArray(), 1, storages[0].getLength());
+                            formatPointable.set(storages[1].getByteArray(), 1, storages[1].getLength());
+                            if (HEX_FORMAT.ignoreCaseCompareTo(formatPointable) == 0) {
+                                hexParser.generateByteArrayFromHexString(stringPointable.getByteArray(),
+                                        stringPointable.getCharStartOffset(), stringPointable.getUTF8Length());
+
+                                aBinary.setValue(hexParser.getByteArray(), 0, hexParser.getLength());
+                            } else if (BASE64_FORMAT.ignoreCaseCompareTo(formatPointable) == 0) {
+                                base64Parser.generatePureByteArrayFromBase64String(stringPointable.getByteArray(),
+                                        stringPointable.getCharStartOffset(), stringPointable.getUTF8Length());
+
+                                aBinary.setValue(base64Parser.getByteArray(), 0, base64Parser.getLength());
                             } else {
                                 throw new AlgebricksException(getIdentifier().getName()
                                         + ": expects format indicator of \"hex\" or \"base64\" in the 2nd argument");
                             }
-                            aBinary.setValue(buffer, 0, buffer.length);
                             binarySerde.serialize(aBinary, dataOutput);
                         } catch (HyracksDataException e) {
                             e.printStackTrace();

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/PrintBinaryDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/PrintBinaryDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/PrintBinaryDescriptor.java
index 8f52441..75bb628 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/PrintBinaryDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/PrintBinaryDescriptor.java
@@ -19,8 +19,11 @@
 
 package org.apache.asterix.runtime.evaluators.functions.binary;
 
-import org.apache.asterix.dataflow.data.nontagged.printers.PrintTools;
-import org.apache.asterix.dataflow.data.nontagged.printers.adm.ABinaryBase64Printer;
+import static org.apache.asterix.runtime.evaluators.functions.binary.ParseBinaryDescriptor.BASE64_FORMAT;
+import static org.apache.asterix.runtime.evaluators.functions.binary.ParseBinaryDescriptor.HEX_FORMAT;
+
+import java.io.IOException;
+
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
 import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
@@ -35,16 +38,16 @@ import org.apache.hyracks.data.std.api.IDataOutputProvider;
 import org.apache.hyracks.data.std.primitive.ByteArrayPointable;
 import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
-
-import java.io.IOException;
-
-import static org.apache.asterix.runtime.evaluators.functions.binary.ParseBinaryDescriptor.*;
+import org.apache.hyracks.util.bytes.Base64Printer;
+import org.apache.hyracks.util.bytes.HexPrinter;
+import org.apache.hyracks.util.string.UTF8StringWriter;
 
 public class PrintBinaryDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
     private static final byte SER_STRING_BYTE = ATypeTag.STRING.serialize();
 
-    @Override public FunctionIdentifier getIdentifier() {
+    @Override
+    public FunctionIdentifier getIdentifier() {
         return AsterixBuiltinFunctions.PRINT_BINARY;
     }
 
@@ -57,16 +60,22 @@ public class PrintBinaryDescriptor extends AbstractScalarFunctionDynamicDescript
 
     public final static ATypeTag[] EXPECTED_INPUT_TAGS = { ATypeTag.BINARY, ATypeTag.STRING };
 
-    @Override public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args)
+    @Override
+    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args)
             throws AlgebricksException {
         return new ICopyEvaluatorFactory() {
-            @Override public ICopyEvaluator createEvaluator(final IDataOutputProvider output)
+            @Override
+            public ICopyEvaluator createEvaluator(final IDataOutputProvider output)
                     throws AlgebricksException {
                 return new AbstractCopyEvaluator(output, args) {
 
                     private StringBuilder stringBuilder = new StringBuilder();
+                    private final ByteArrayPointable byteArrayPtr = new ByteArrayPointable();
+                    private final UTF8StringPointable formatPointable = new UTF8StringPointable();
+                    private final UTF8StringWriter writer = new UTF8StringWriter();
 
-                    @Override public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                    @Override
+                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
                         ATypeTag arg0Tag = evaluateTuple(tuple, 0);
                         ATypeTag arg1Tag = evaluateTuple(tuple, 1);
 
@@ -77,25 +86,23 @@ public class PrintBinaryDescriptor extends AbstractScalarFunctionDynamicDescript
                             checkTypeMachingThrowsIfNot(getIdentifier().getName(), EXPECTED_INPUT_TAGS, arg0Tag,
                                     arg1Tag);
 
-                            byte[] binaryBytes = storages[0].getByteArray();
-                            byte[] formatBytes = storages[1].getByteArray();
+                            byteArrayPtr.set(storages[0].getByteArray(), 1, storages[0].getLength());
+                            formatPointable.set(storages[1].getByteArray(), 1, storages[1].getLength());
 
-                            int lengthBinary = ByteArrayPointable.getLength(binaryBytes, 1);
-                            int lengthFormat = UTF8StringPointable.getUTFLength(formatBytes, 1);
+                            int lengthBinary = byteArrayPtr.getContentLength();
                             stringBuilder.setLength(0);
-                            if (isCaseIgnoreEqual(HEX_FORMAT, formatBytes, 3, lengthFormat)) {
-                                PrintTools
-                                        .printHexString(binaryBytes, 3, lengthBinary, stringBuilder);
-
-                            } else if (isCaseIgnoreEqual(BASE64_FORMAT, formatBytes, 3, lengthFormat)) {
-                                ABinaryBase64Printer
-                                        .printBase64Binary(binaryBytes, 3, lengthBinary, stringBuilder);
+                            if (HEX_FORMAT.ignoreCaseCompareTo(formatPointable) == 0) {
+                                HexPrinter.printHexString(byteArrayPtr.getByteArray(),
+                                        byteArrayPtr.getContentStartOffset(), lengthBinary, stringBuilder);
+                            } else if (BASE64_FORMAT.ignoreCaseCompareTo(formatPointable) == 0) {
+                                Base64Printer.printBase64Binary(byteArrayPtr.getByteArray(),
+                                        byteArrayPtr.getContentStartOffset(), lengthBinary, stringBuilder);
                             } else {
                                 throw new AlgebricksException(getIdentifier().getName()
                                         + ": expects format indicator of \"hex\" or \"base64\" in the 2nd argument");
                             }
                             dataOutput.writeByte(SER_STRING_BYTE);
-                            dataOutput.writeUTF(stringBuilder.toString());
+                            writer.writeUTF8(stringBuilder.toString(), dataOutput);
                         } catch (HyracksDataException e) {
                             throw new AlgebricksException(e);
                         } catch (IOException e) {

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/SubBinaryFromDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/SubBinaryFromDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/SubBinaryFromDescriptor.java
index bfd2a38..a5b5e99 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/SubBinaryFromDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/SubBinaryFromDescriptor.java
@@ -51,7 +51,7 @@ public class SubBinaryFromDescriptor extends AbstractScalarFunctionDynamicDescri
                 return new SubBinaryFromToDescriptor.AbstractSubBinaryCopyEvaluator(output, args,
                         getIdentifier().getName()) {
                     @Override protected int getSubLength(IFrameTupleReference tuple) throws AlgebricksException {
-                        return ByteArrayPointable.MAX_LENGTH;
+                        return Integer.MAX_VALUE;
                     }
                 };
             }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/SubBinaryFromToDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/SubBinaryFromToDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/SubBinaryFromToDescriptor.java
index 70b380a..4f35de8 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/SubBinaryFromToDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/binary/SubBinaryFromToDescriptor.java
@@ -35,6 +35,7 @@ import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
 import org.apache.hyracks.data.std.primitive.ByteArrayPointable;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
+import org.apache.hyracks.util.encoding.VarLenIntEncoderDecoder;
 
 public class SubBinaryFromToDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
@@ -80,6 +81,8 @@ public class SubBinaryFromToDescriptor extends AbstractScalarFunctionDynamicDesc
             this.functionName = functionName;
         }
 
+        private ByteArrayPointable byteArrayPointable = new ByteArrayPointable();
+        private byte[] metaBuffer = new byte[5];
         protected final String functionName;
 
         static final ATypeTag[] EXPECTED_INPUT_TAGS = { ATypeTag.BINARY, ATypeTag.INT32 };
@@ -96,30 +99,33 @@ public class SubBinaryFromToDescriptor extends AbstractScalarFunctionDynamicDesc
                 }
                 checkTypeMachingThrowsIfNot(functionName, EXPECTED_INPUT_TAGS, argTag0, argTag1);
 
-                byte[] binaryBytes = storages[0].getByteArray();
+                byteArrayPointable.set(storages[0].getByteArray(), 1, storages[0].getLength() - 1);
                 byte[] startBytes = storages[1].getByteArray();
 
-                int start = 0;
+                int subStart = 0;
 
                 // strange SQL index convention
-                start = ATypeHierarchy.getIntegerValue(startBytes, 0) - 1;
+                subStart = ATypeHierarchy.getIntegerValue(startBytes, 0) - 1;
 
-                int totalLength = ByteArrayPointable.getLength(binaryBytes, 1);
+                int totalLength = byteArrayPointable.getContentLength();
                 int subLength = getSubLength(tuple);
 
-                if (start < 0) {
-                    start = 0;
+                if (subStart < 0) {
+                    subStart = 0;
                 }
 
-                if (start >= totalLength || subLength < 0) {
+                if (subStart >= totalLength || subLength < 0) {
                     subLength = 0;
-                } else if (start + subLength > totalLength) {
-                    subLength = totalLength - start;
+                } else if (subLength > totalLength // for the IntMax case
+                        || subStart + subLength > totalLength) {
+                    subLength = totalLength - subStart;
                 }
 
                 dataOutput.write(ATypeTag.BINARY.serialize());
-                dataOutput.writeShort(subLength);
-                dataOutput.write(binaryBytes, 1 + ByteArrayPointable.SIZE_OF_LENGTH + start, subLength);
+                int metaLength = VarLenIntEncoderDecoder.encode(subLength, metaBuffer, 0);
+                dataOutput.write(metaBuffer, 0, metaLength);
+                dataOutput.write(byteArrayPointable.getByteArray(),
+                        byteArrayPointable.getContentStartOffset() + subStart, subLength);
             } catch (HyracksDataException e) {
                 throw new AlgebricksException(e);
             } catch (IOException e) {

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/GetRecordFieldValueEvalFactory.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/GetRecordFieldValueEvalFactory.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/GetRecordFieldValueEvalFactory.java
index 0ca24c6..05e7292 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/GetRecordFieldValueEvalFactory.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/GetRecordFieldValueEvalFactory.java
@@ -41,7 +41,7 @@ public class GetRecordFieldValueEvalFactory implements ICopyEvaluatorFactory {
 
     private ICopyEvaluatorFactory recordEvalFactory;
     private ICopyEvaluatorFactory fldNameEvalFactory;
-    private ARecordType recordType;
+    private final ARecordType recordType;
 
     private final static byte SER_STRING_TYPE_TAG = ATypeTag.STRING.serialize();
 
@@ -72,10 +72,10 @@ public class GetRecordFieldValueEvalFactory implements ICopyEvaluatorFactory {
             private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                     .getSerializerDeserializer(BuiltinType.ANULL);
 
+            private ARecordType mRecordType = recordType.deepCopy(recordType);
             {
                 abvsFields[0] = new ArrayBackedValueStorage();
                 doFields[0] = abvsFields[0].getDataOutput();
-                recordType = recordType.deepCopy(recordType);
             }
 
             @Override
@@ -92,7 +92,7 @@ public class GetRecordFieldValueEvalFactory implements ICopyEvaluatorFactory {
                     abvsFields[0].reset();
                     doFields[0].write(serFldName);
 
-                    FieldAccessUtil.evaluate(tuple, out, eval0, abvsFields, outInput0, subRecordTmpStream, recordType);
+                    FieldAccessUtil.evaluate(tuple, out, eval0, abvsFields, outInput0, subRecordTmpStream, mRecordType);
                 } catch (IOException e) {
                     throw new AlgebricksException(e);
                 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/GetRecordFieldsEvalFactory.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/GetRecordFieldsEvalFactory.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/GetRecordFieldsEvalFactory.java
index 804f91b..3fc5db1 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/GetRecordFieldsEvalFactory.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/GetRecordFieldsEvalFactory.java
@@ -43,7 +43,7 @@ public class GetRecordFieldsEvalFactory implements ICopyEvaluatorFactory {
     private static final long serialVersionUID = 1L;
 
     private ICopyEvaluatorFactory recordEvalFactory;
-    private ARecordType recordType;
+    private final ARecordType recordType;
 
     private final byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
     private final byte SER_RECORD_TYPE_TAG = ATypeTag.RECORD.serialize();
@@ -69,9 +69,7 @@ public class GetRecordFieldsEvalFactory implements ICopyEvaluatorFactory {
             private DataOutput out = output.getDataOutput();
             private RecordFieldsUtil rfu = new RecordFieldsUtil();
 
-            {
-                recordType = recordType.deepCopy(recordType);
-            }
+            protected ARecordType mRecordType = recordType.deepCopy(recordType);
 
             public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
                 outInput0.reset();
@@ -93,7 +91,7 @@ public class GetRecordFieldsEvalFactory implements ICopyEvaluatorFactory {
                 recordPointable.set(outInput0.getByteArray(), outInput0.getStartOffset(), outInput0.getLength());
 
                 try {
-                    rfu.processRecord(recordPointable, recordType, out, 0);
+                    rfu.processRecord(recordPointable, mRecordType, out, 0);
                 } catch (IOException e) {
                     e.printStackTrace();
                 } catch (AsterixException e) {

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordFieldsUtil.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordFieldsUtil.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordFieldsUtil.java
index 08bc8bf..76716b1 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordFieldsUtil.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordFieldsUtil.java
@@ -76,11 +76,12 @@ public class RecordFieldsUtil {
             AListPointable.ALLOCATOR);
 
     private final static AOrderedListType listType = new AOrderedListType(BuiltinType.ANY, "fields");
+    //Better not be a static object.
     @SuppressWarnings("unchecked")
-    protected final static ISerializerDeserializer<AString> stringSerde = AqlSerializerDeserializerProvider.INSTANCE
+    protected final ISerializerDeserializer<AString> stringSerde = AqlSerializerDeserializerProvider.INSTANCE
             .getSerializerDeserializer(BuiltinType.ASTRING);
     @SuppressWarnings("unchecked")
-    protected final static ISerializerDeserializer<ABoolean> booleanSerde = AqlSerializerDeserializerProvider.INSTANCE
+    protected final ISerializerDeserializer<ABoolean> booleanSerde = AqlSerializerDeserializerProvider.INSTANCE
             .getSerializerDeserializer(BuiltinType.ABOOLEAN);
 
     private final static ARecordType openType = DefaultOpenFieldType.NESTED_OPEN_RECORD_TYPE;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordMergeDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordMergeDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordMergeDescriptor.java
index 02a2666..df52f90 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordMergeDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/records/RecordMergeDescriptor.java
@@ -90,6 +90,7 @@ public class RecordMergeDescriptor extends AbstractScalarFunctionDynamicDescript
             @SuppressWarnings("unchecked")
             private final ISerializerDeserializer<ANull> nullSerDe = AqlSerializerDeserializerProvider.INSTANCE
                     .getSerializerDeserializer(BuiltinType.ANULL);
+            private final AStringSerializerDeserializer aStringSerDer = new AStringSerializerDeserializer();
 
             @Override
             public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
@@ -220,7 +221,7 @@ public class RecordMergeDescriptor extends AbstractScalarFunctionDynamicDescript
                         nameOutputStream.write(fieldNamePointable.getByteArray(),
                                 fieldNamePointable.getStartOffset() + 1, fieldNamePointable.getLength());
                         namedis.reset();
-                        String fieldName = AStringSerializerDeserializer.INSTANCE.deserialize(namedis).getStringValue();
+                        String fieldName = aStringSerDer.deserialize(namedis).getStringValue();
 
                         //Add the merged field
                         if (combinedType.isClosedField(fieldName)) {



[10/15] incubator-asterixdb git commit: ASTERIXDB-1102: VarSize Encoding to store length of String and ByteArray

Posted by ji...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/results/big-object/big_object_groupby-2/groupby.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/big-object/big_object_groupby-2/groupby.1.adm b/asterix-app/src/test/resources/runtimets/results/big-object/big_object_groupby-2/groupby.1.adm
index 5d4a27e..a9d1c78 100644
--- a/asterix-app/src/test/resources/runtimets/results/big-object/big_object_groupby-2/groupby.1.adm
+++ b/asterix-app/src/test/resources/runtimets/results/big-object/big_object_groupby-2/groupby.1.adm
@@ -1,1344 +1,1344 @@
-[ { "id": 1i32, "length": 32768, "comment": "egular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular co
 urts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts abo
 ve theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theeg
 ular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular cou
 rts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts abov
 e theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegu
 lar courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular cour
 ts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above
  theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegul
 ar courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular court
 s above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above 
 theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegula
 r courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts
  above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above t
 heegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular
  courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts 
 above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above th
 eegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular 
 courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts a
 bove theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above the
 egular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular c
 ourts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts ab
 ove theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above thee
 gular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular co
 urts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts abo
 ve theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theeg
 ular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular cou
 rts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts abov
 e theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegu
 lar courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular cour
 ts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above
  theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegul
 ar courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts ab" }
-, { "id": 1i32, "length": 34, "comment": "ly final dependencies: slyly bold " }
-, { "id": 1i32, "length": 17, "comment": "arefully slyly ex" }
-, { "id": 1i32, "length": 29, "comment": "riously. regular, express dep" }
-, { "id": 1i32, "length": 24, "comment": " pending foxes. slyly re" }
+[ { "id": 1i32, "length": 17, "comment": "arefully slyly ex" }
 , { "id": 1i32, "length": 23, "comment": "lites. fluffily even de" }
+, { "id": 1i32, "length": 24, "comment": " pending foxes. slyly re" }
+, { "id": 1i32, "length": 29, "comment": "riously. regular, express dep" }
+, { "id": 1i32, "length": 34, "comment": "ly final dependencies: slyly bold " }
+, { "id": 1i32, "length": 32768, "comment": "egular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular co
 urts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts abo
 ve theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theeg
 ular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular cou
 rts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts abov
 e theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegu
 lar courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular cour
 ts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above
  theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegul
 ar courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular court
 s above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above 
 theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegula
 r courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts
  above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above t
 heegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular
  courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts 
 above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above th
 eegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular 
 courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts a
 bove theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above the
 egular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular c
 ourts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts ab
 ove theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above thee
 gular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular co
 urts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts abo
 ve theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theeg
 ular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular cou
 rts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts abov
 e theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegu
 lar courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular cour
 ts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above
  theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegul
 ar courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts above theegular courts ab" }
 , { "id": 2i32, "length": 31, "comment": "ven requests. deposits breach a" }
-, { "id": 3i32, "length": 22, "comment": " unusual accounts. eve" }
+, { "id": 3i32, "length": 16, "comment": "nal foxes wake. " }
 , { "id": 3i32, "length": 21, "comment": "y. fluffily pending d" }
+, { "id": 3i32, "length": 22, "comment": " unusual accounts. eve" }
 , { "id": 3i32, "length": 22, "comment": "ages nag slyly pending" }
 , { "id": 3i32, "length": 25, "comment": "ges sleep after the caref" }
-, { "id": 3i32, "length": 16, "comment": "nal foxes wake. " }
 , { "id": 3i32, "length": 35, "comment": "ongside of the furiously brave acco" }
 , { "id": 4i32, "length": 38, "comment": "- quickly regular packages sleep. idly" }
-, { "id": 5i32, "length": 37, "comment": "sts use slyly quickly special instruc" }
 , { "id": 5i32, "length": 18, "comment": "ts wake furiously " }
 , { "id": 5i32, "length": 27, "comment": "eodolites. fluffily unusual" }
+, { "id": 5i32, "length": 37, "comment": "sts use slyly quickly special instruc" }
 , { "id": 6i32, "length": 25, "comment": "p furiously special foxes" }
-, { "id": 7i32, "length": 30, "comment": ". slyly special requests haggl" }
-, { "id": 7i32, "length": 16, "comment": "es. instructions" }
-, { "id": 7i32, "length": 39, "comment": "ns haggle carefully ironic deposits. bl" }
 , { "id": 7i32, "length": 13, "comment": "ithely regula" }
 , { "id": 7i32, "length": 15, "comment": " unusual reques" }
-, { "id": 7i32, "length": 42, "comment": "jole. excuses wake carefully alongside of " }
+, { "id": 7i32, "length": 16, "comment": "es. instructions" }
+, { "id": 7i32, "length": 30, "comment": ". slyly special requests haggl" }
 , { "id": 7i32, "length": 30, "comment": "ss pinto beans wake against th" }
-, { "id": 32i32, "length": 24, "comment": " gifts cajole carefully." }
+, { "id": 7i32, "length": 39, "comment": "ns haggle carefully ironic deposits. bl" }
+, { "id": 7i32, "length": 42, "comment": "jole. excuses wake carefully alongside of " }
 , { "id": 32i32, "length": 17, "comment": "e slyly final pac" }
-, { "id": 32i32, "length": 42, "comment": "symptotes nag according to the ironic depo" }
-, { "id": 32i32, "length": 39, "comment": " express accounts wake according to the" }
-, { "id": 32i32, "length": 35, "comment": "lithely regular deposits. fluffily " }
 , { "id": 32i32, "length": 18, "comment": "sleep quickly. req" }
+, { "id": 32i32, "length": 24, "comment": " gifts cajole carefully." }
+, { "id": 32i32, "length": 35, "comment": "lithely regular deposits. fluffily " }
+, { "id": 32i32, "length": 39, "comment": " express accounts wake according to the" }
+, { "id": 32i32, "length": 42, "comment": "symptotes nag according to the ironic depo" }
+, { "id": 33i32, "length": 17, "comment": "gular theodolites" }
+, { "id": 33i32, "length": 21, "comment": ". stealthily bold exc" }
 , { "id": 33i32, "length": 28, "comment": "unusual packages doubt caref" }
 , { "id": 33i32, "length": 34, "comment": "ng to the furiously ironic package" }
-, { "id": 33i32, "length": 21, "comment": ". stealthily bold exc" }
-, { "id": 33i32, "length": 17, "comment": "gular theodolites" }
-, { "id": 34i32, "length": 15, "comment": "ar foxes sleep " }
 , { "id": 34i32, "length": 13, "comment": "thely slyly p" }
+, { "id": 34i32, "length": 15, "comment": "ar foxes sleep " }
 , { "id": 34i32, "length": 31, "comment": "nic accounts. deposits are alon" }
 , { "id": 35i32, "length": 13, "comment": " quickly unti" }
 , { "id": 35i32, "length": 15, "comment": ", regular tithe" }
-, { "id": 35i32, "length": 32, "comment": ". silent, unusual deposits boost" }
 , { "id": 35i32, "length": 16, "comment": "ly alongside of " }
-, { "id": 35i32, "length": 29, "comment": "s are carefully against the f" }
 , { "id": 35i32, "length": 23, "comment": " the carefully regular " }
+, { "id": 35i32, "length": 29, "comment": "s are carefully against the f" }
+, { "id": 35i32, "length": 32, "comment": ". silent, unusual deposits boost" }
 , { "id": 36i32, "length": 25, "comment": " careful courts. special " }
 , { "id": 37i32, "length": 10, "comment": "iously ste" }
-, { "id": 37i32, "length": 42, "comment": "luffily regular requests. slyly final acco" }
 , { "id": 37i32, "length": 22, "comment": "the final requests. ca" }
+, { "id": 37i32, "length": 42, "comment": "luffily regular requests. slyly final acco" }
 , { "id": 38i32, "length": 34, "comment": "s. blithely unusual theodolites am" }
+, { "id": 39i32, "length": 13, "comment": "yly regular i" }
+, { "id": 39i32, "length": 14, "comment": "he carefully e" }
 , { "id": 39i32, "length": 18, "comment": "eodolites. careful" }
 , { "id": 39i32, "length": 18, "comment": "quickly ironic fox" }
-, { "id": 39i32, "length": 13, "comment": "yly regular i" }
 , { "id": 39i32, "length": 30, "comment": "ckages across the slyly silent" }
-, { "id": 39i32, "length": 14, "comment": "he carefully e" }
 , { "id": 39i32, "length": 43, "comment": "heodolites sleep silently pending foxes. ac" }
 , { "id": 64i32, "length": 31, "comment": "ch slyly final, thin platelets." }
 , { "id": 65i32, "length": 18, "comment": " ideas. special, r" }
 , { "id": 65i32, "length": 38, "comment": "pending deposits nag even packages. ca" }
 , { "id": 65i32, "length": 43, "comment": "bove the even packages. accounts nag carefu" }
-, { "id": 66i32, "length": 39, "comment": "ut the unusual accounts sleep at the bo" }
 , { "id": 66i32, "length": 11, "comment": " regular de" }
-, { "id": 67i32, "length": 21, "comment": " cajole thinly expres" }
-, { "id": 67i32, "length": 18, "comment": "ly regular deposit" }
-, { "id": 67i32, "length": 41, "comment": "se quickly above the even, express reques" }
+, { "id": 66i32, "length": 39, "comment": "ut the unusual accounts sleep at the bo" }
 , { "id": 67i32, "length": 11, "comment": "ultipliers " }
-, { "id": 67i32, "length": 32, "comment": "y unusual packages thrash pinto " }
+, { "id": 67i32, "length": 18, "comment": "ly regular deposit" }
+, { "id": 67i32, "length": 21, "comment": " cajole thinly expres" }
 , { "id": 67i32, "length": 21, "comment": " even packages cajole" }
-, { "id": 68i32, "length": 42, "comment": "fully special instructions cajole. furious" }
-, { "id": 68i32, "length": 43, "comment": "egular dependencies affix ironically along " }
-, { "id": 68i32, "length": 35, "comment": "eposits nag special ideas. furiousl" }
+, { "id": 67i32, "length": 32, "comment": "y unusual packages thrash pinto " }
+, { "id": 67i32, "length": 41, "comment": "se quickly above the even, express reques" }
+, { "id": 68i32, "length": 27, "comment": "oxes are slyly blithely fin" }
 , { "id": 68i32, "length": 28, "comment": " excuses integrate fluffily " }
-, { "id": 68i32, "length": 37, "comment": " requests are unusual, regular pinto " }
 , { "id": 68i32, "length": 32, "comment": "ccounts. deposits use. furiously" }
-, { "id": 68i32, "length": 27, "comment": "oxes are slyly blithely fin" }
-, { "id": 69i32, "length": 20, "comment": "final, pending instr" }
-, { "id": 69i32, "length": 17, "comment": "nding accounts ca" }
-, { "id": 69i32, "length": 42, "comment": "regular epitaphs. carefully even ideas hag" }
+, { "id": 68i32, "length": 35, "comment": "eposits nag special ideas. furiousl" }
+, { "id": 68i32, "length": 37, "comment": " requests are unusual, regular pinto " }
+, { "id": 68i32, "length": 42, "comment": "fully special instructions cajole. furious" }
+, { "id": 68i32, "length": 43, "comment": "egular dependencies affix ironically along " }
 , { "id": 69i32, "length": 17, "comment": " blithely final d" }
-, { "id": 69i32, "length": 24, "comment": "s sleep carefully bold, " }
+, { "id": 69i32, "length": 17, "comment": "nding accounts ca" }
 , { "id": 69i32, "length": 19, "comment": "tect regular, speci" }
-, { "id": 70i32, "length": 33, "comment": "ggle. carefully pending dependenc" }
-, { "id": 70i32, "length": 19, "comment": "lyly special packag" }
+, { "id": 69i32, "length": 20, "comment": "final, pending instr" }
+, { "id": 69i32, "length": 24, "comment": "s sleep carefully bold, " }
+, { "id": 69i32, "length": 42, "comment": "regular epitaphs. carefully even ideas hag" }
 , { "id": 70i32, "length": 17, "comment": "n accounts are. q" }
+, { "id": 70i32, "length": 19, "comment": "lyly special packag" }
+, { "id": 70i32, "length": 30, "comment": "alongside of the deposits. fur" }
 , { "id": 70i32, "length": 32, "comment": " packages wake pending accounts." }
+, { "id": 70i32, "length": 33, "comment": "ggle. carefully pending dependenc" }
 , { "id": 70i32, "length": 39, "comment": "quickly. fluffily unusual theodolites c" }
-, { "id": 70i32, "length": 30, "comment": "alongside of the deposits. fur" }
-, { "id": 71i32, "length": 35, "comment": " ironic packages believe blithely a" }
 , { "id": 71i32, "length": 10, "comment": "s cajole. " }
 , { "id": 71i32, "length": 11, "comment": "ckly. slyly" }
+, { "id": 71i32, "length": 31, "comment": "y. pinto beans haggle after the" }
 , { "id": 71i32, "length": 32, "comment": "l accounts sleep across the pack" }
+, { "id": 71i32, "length": 35, "comment": " ironic packages believe blithely a" }
 , { "id": 71i32, "length": 35, "comment": " serve quickly fluffily bold deposi" }
-, { "id": 71i32, "length": 31, "comment": "y. pinto beans haggle after the" }
-, { "id": 96i32, "length": 28, "comment": "e quickly even ideas. furiou" }
 , { "id": 96i32, "length": 18, "comment": "ep-- carefully reg" }
-, { "id": 97i32, "length": 41, "comment": "gifts. furiously ironic packages cajole. " }
-, { "id": 97i32, "length": 34, "comment": "ayers cajole against the furiously" }
+, { "id": 96i32, "length": 28, "comment": "e quickly even ideas. furiou" }
 , { "id": 97i32, "length": 32, "comment": "ic requests boost carefully quic" }
+, { "id": 97i32, "length": 34, "comment": "ayers cajole against the furiously" }
+, { "id": 97i32, "length": 41, "comment": "gifts. furiously ironic packages cajole. " }
 , { "id": 98i32, "length": 28, "comment": " pending, regular accounts s" }
 , { "id": 98i32, "length": 30, "comment": ". unusual instructions against" }
 , { "id": 98i32, "length": 41, "comment": " cajole furiously. blithely ironic ideas " }
 , { "id": 98i32, "length": 32768, "comment": " carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly iro
 nic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic i
 deas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas 
 carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas caref
 ully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully.
  quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quic
 kly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly i
 ronic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic
  ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic idea
 s carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas car
 efully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefull
 y. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. qu
 ickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. quickly ironic ideas carefully. q

<TRUNCATED>


[12/15] incubator-asterixdb git commit: ASTERIXDB-1102: VarSize Encoding to store length of String and ByteArray

Posted by ji...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/endwith02/endwith02.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/endwith02/endwith02.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/string/endwith02/endwith02.3.query.aql
deleted file mode 100644
index 68e88ae..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/endwith02/endwith02.3.query.aql
+++ /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.
- */
-/*
- * Testcase Name : endwith02.aql
- * Description   : Positive tests
- * Success       : Yes
- * Date          : 20th April 2012
- */
-
-
-for $a in [end-with("aBCDEFghIa",codepoint-to-string([0041])),
-end-with("AbCDEFghIA",codepoint-to-string([0041])),
-end-with("AbCdEfGhIjKlMnOpQrStUvWxYz","xYz"),
-end-with("abcdef",lowercase("ABCDEf")),
-end-with("abcdef","abcdef"),
-end-with("abcdef123","ef123")]
-return $a

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/endwith03/endwith03.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/endwith03/endwith03.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/string/endwith03/endwith03.1.ddl.aql
deleted file mode 100644
index 28a3cfb..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/endwith03/endwith03.1.ddl.aql
+++ /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.
- */
-/*
- * Testcase Name : endwith03.aql
- * Description   : Positive tests
- * Success       : Yes
- * Date          : 20th April 2012
- */
-
-// create internal dataset, insert string data into string field and pass the string filed as input to end-with function
-
-drop dataverse test if exists;
-create dataverse test;
-
-use dataverse test;
-
-create type TestType as {
-name:string
-}
-
-create dataset testds(TestType) primary key name;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/endwith03/endwith03.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/endwith03/endwith03.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/string/endwith03/endwith03.2.update.aql
deleted file mode 100644
index a42c36d..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/endwith03/endwith03.2.update.aql
+++ /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.
- */
-/*
- * Testcase Name : endwith03.aql
- * Description   : Positive tests
- * Success       : Yes
- * Date          : 20th April 2012
- */
-
-// create internal dataset, insert string data into string field and pass the string filed as input to end-with function
-
-use dataverse test;
-
-insert into dataset testds({"name":"Jim Jones"});
-insert into dataset testds({"name":"Ravi Kumar"});
-insert into dataset testds({"name":"Bruce Li"});
-insert into dataset testds({"name":"Marian Jones"});
-insert into dataset testds({"name":"Phil Jones"});
-insert into dataset testds({"name":"I am Jones"});
-

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/endwith03/endwith03.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/endwith03/endwith03.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/string/endwith03/endwith03.3.query.aql
deleted file mode 100644
index ee4cac4..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/endwith03/endwith03.3.query.aql
+++ /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.
- */
-/*
- * Testcase Name : endwith03.aql
- * Description   : Positive tests
- * Success       : Yes
- * Date          : 20th April 2012
- */
-
-// create internal dataset, insert string data into string field and pass the string filed as input to end-with function
-
-use dataverse test;
-
-for $l in dataset('testds')
-order by $l.name
-where end-with($l.name,"Jones")
-return $l
-

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/matches11/matches11.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/matches11/matches11.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/string/matches11/matches11.3.query.aql
index f944f7b..c817596 100644
--- a/asterix-app/src/test/resources/runtimets/queries/string/matches11/matches11.3.query.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/string/matches11/matches11.3.query.aql
@@ -23,7 +23,9 @@
  * Date           :  20th April 2012
  */
 
-for $a in [matches("hello",null),
+for $a in [
+null,
+matches("hello",null),
 matches("hello","helllo"),
 matches("hello"," "),
 matches(null,"hello"),

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/start-with1/start-with1.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/start-with1/start-with1.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/string/start-with1/start-with1.1.ddl.aql
deleted file mode 100644
index d17ea60..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/start-with1/start-with1.1.ddl.aql
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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 test if exists;
-create dataverse test;
-

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/start-with1/start-with1.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/start-with1/start-with1.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/string/start-with1/start-with1.2.update.aql
deleted file mode 100644
index 042f3ce..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/start-with1/start-with1.2.update.aql
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/start-with1/start-with1.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/start-with1/start-with1.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/string/start-with1/start-with1.3.query.aql
deleted file mode 100644
index 027efe6..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/start-with1/start-with1.3.query.aql
+++ /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.
- */
-use dataverse test;
-
-let $c1 := start-with("start","st")
-return {"result1": $c1}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/start-with2/start-with2.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/start-with2/start-with2.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/string/start-with2/start-with2.1.ddl.aql
deleted file mode 100644
index d17ea60..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/start-with2/start-with2.1.ddl.aql
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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 test if exists;
-create dataverse test;
-

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/start-with2/start-with2.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/start-with2/start-with2.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/string/start-with2/start-with2.2.update.aql
deleted file mode 100644
index 042f3ce..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/start-with2/start-with2.2.update.aql
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/start-with2/start-with2.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/start-with2/start-with2.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/string/start-with2/start-with2.3.query.aql
deleted file mode 100644
index d541061..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/start-with2/start-with2.3.query.aql
+++ /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.
- */
-use dataverse test;
-
-let $c1 := start-with("start","t")
-return {"result1": $c1}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/start-with3/start-with3.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/start-with3/start-with3.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/string/start-with3/start-with3.1.ddl.aql
deleted file mode 100644
index d17ea60..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/start-with3/start-with3.1.ddl.aql
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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 test if exists;
-create dataverse test;
-

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/start-with3/start-with3.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/start-with3/start-with3.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/string/start-with3/start-with3.2.update.aql
deleted file mode 100644
index 042f3ce..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/start-with3/start-with3.2.update.aql
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/start-with3/start-with3.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/start-with3/start-with3.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/string/start-with3/start-with3.3.query.aql
deleted file mode 100644
index 0af8cf7..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/start-with3/start-with3.3.query.aql
+++ /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.
- */
-use dataverse test;
-
-let $c1 := start-with("start","start")
-return {"result1": $c1}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/start-with4/start-with4.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/start-with4/start-with4.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/string/start-with4/start-with4.1.ddl.aql
deleted file mode 100644
index d17ea60..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/start-with4/start-with4.1.ddl.aql
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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 test if exists;
-create dataverse test;
-

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/start-with4/start-with4.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/start-with4/start-with4.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/string/start-with4/start-with4.2.update.aql
deleted file mode 100644
index 042f3ce..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/start-with4/start-with4.2.update.aql
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/start-with4/start-with4.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/start-with4/start-with4.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/string/start-with4/start-with4.3.query.aql
deleted file mode 100644
index 12d9523..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/start-with4/start-with4.3.query.aql
+++ /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.
- */
-use dataverse test;
-
-let $c1 := start-with("start","")
-let $c2 := start-with("start",null)
-let $c3 := start-with(null,null)
-let $c4 := start-with("",null)
-let $c5 := start-with("","")
-let $c6 := start-with(null,"")
-
-return {"f1": $c1, "f2": $c2, "f3": $c3, "f4": $c4, "f5": $c5, "f6": $c6}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/start-with5/start-with5.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/start-with5/start-with5.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/string/start-with5/start-with5.1.ddl.aql
deleted file mode 100644
index d17ea60..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/start-with5/start-with5.1.ddl.aql
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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 test if exists;
-create dataverse test;
-

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/start-with5/start-with5.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/start-with5/start-with5.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/string/start-with5/start-with5.2.update.aql
deleted file mode 100644
index 042f3ce..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/start-with5/start-with5.2.update.aql
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/start-with5/start-with5.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/start-with5/start-with5.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/string/start-with5/start-with5.3.query.aql
deleted file mode 100644
index a3c0a7e..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/start-with5/start-with5.3.query.aql
+++ /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.
- */
-use dataverse test;
-
-let $c1 := start-with("","s")
-return {"result1": $c1}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/starts-with1/starts-with1.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/starts-with1/starts-with1.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/string/starts-with1/starts-with1.1.ddl.aql
new file mode 100644
index 0000000..d17ea60
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/starts-with1/starts-with1.1.ddl.aql
@@ -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 test if exists;
+create dataverse test;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/starts-with1/starts-with1.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/starts-with1/starts-with1.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/string/starts-with1/starts-with1.2.update.aql
new file mode 100644
index 0000000..042f3ce
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/starts-with1/starts-with1.2.update.aql
@@ -0,0 +1,18 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/starts-with1/starts-with1.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/starts-with1/starts-with1.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/string/starts-with1/starts-with1.3.query.aql
new file mode 100644
index 0000000..ae5f4c2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/starts-with1/starts-with1.3.query.aql
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 dataverse test;
+
+let $c1 := starts-with("start","st")
+return {"result1": $c1}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/starts-with2/starts-with2.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/starts-with2/starts-with2.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/string/starts-with2/starts-with2.1.ddl.aql
new file mode 100644
index 0000000..d17ea60
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/starts-with2/starts-with2.1.ddl.aql
@@ -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 test if exists;
+create dataverse test;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/starts-with2/starts-with2.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/starts-with2/starts-with2.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/string/starts-with2/starts-with2.2.update.aql
new file mode 100644
index 0000000..042f3ce
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/starts-with2/starts-with2.2.update.aql
@@ -0,0 +1,18 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/starts-with2/starts-with2.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/starts-with2/starts-with2.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/string/starts-with2/starts-with2.3.query.aql
new file mode 100644
index 0000000..ad381d4
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/starts-with2/starts-with2.3.query.aql
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 dataverse test;
+
+let $c1 := starts-with("start","t")
+return {"result1": $c1}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/starts-with3/starts-with3.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/starts-with3/starts-with3.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/string/starts-with3/starts-with3.1.ddl.aql
new file mode 100644
index 0000000..d17ea60
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/starts-with3/starts-with3.1.ddl.aql
@@ -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 test if exists;
+create dataverse test;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/starts-with3/starts-with3.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/starts-with3/starts-with3.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/string/starts-with3/starts-with3.2.update.aql
new file mode 100644
index 0000000..042f3ce
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/starts-with3/starts-with3.2.update.aql
@@ -0,0 +1,18 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/starts-with3/starts-with3.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/starts-with3/starts-with3.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/string/starts-with3/starts-with3.3.query.aql
new file mode 100644
index 0000000..397b4fe
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/starts-with3/starts-with3.3.query.aql
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 dataverse test;
+
+let $c1 := starts-with("start","start")
+return {"result1": $c1}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/starts-with4/starts-with4.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/starts-with4/starts-with4.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/string/starts-with4/starts-with4.1.ddl.aql
new file mode 100644
index 0000000..d17ea60
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/starts-with4/starts-with4.1.ddl.aql
@@ -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 test if exists;
+create dataverse test;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/starts-with4/starts-with4.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/starts-with4/starts-with4.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/string/starts-with4/starts-with4.2.update.aql
new file mode 100644
index 0000000..042f3ce
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/starts-with4/starts-with4.2.update.aql
@@ -0,0 +1,18 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/starts-with4/starts-with4.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/starts-with4/starts-with4.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/string/starts-with4/starts-with4.3.query.aql
new file mode 100644
index 0000000..e3c8cab
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/starts-with4/starts-with4.3.query.aql
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 dataverse test;
+
+let $c1 := starts-with("start","")
+let $c2 := starts-with("start",null)
+let $c3 := starts-with(null,null)
+let $c4 := starts-with("",null)
+let $c5 := starts-with("","")
+let $c6 := starts-with(null,"")
+
+return {"f1": $c1, "f2": $c2, "f3": $c3, "f4": $c4, "f5": $c5, "f6": $c6}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/starts-with5/starts-with5.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/starts-with5/starts-with5.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/string/starts-with5/starts-with5.1.ddl.aql
new file mode 100644
index 0000000..d17ea60
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/starts-with5/starts-with5.1.ddl.aql
@@ -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 test if exists;
+create dataverse test;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/starts-with5/starts-with5.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/starts-with5/starts-with5.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/string/starts-with5/starts-with5.2.update.aql
new file mode 100644
index 0000000..042f3ce
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/starts-with5/starts-with5.2.update.aql
@@ -0,0 +1,18 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/starts-with5/starts-with5.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/starts-with5/starts-with5.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/string/starts-with5/starts-with5.3.query.aql
new file mode 100644
index 0000000..51e787b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/starts-with5/starts-with5.3.query.aql
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 dataverse test;
+
+let $c1 := starts-with("","s")
+return {"result1": $c1}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/starts-with6/starts-with6.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/starts-with6/starts-with6.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/string/starts-with6/starts-with6.1.ddl.aql
new file mode 100644
index 0000000..d17ea60
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/starts-with6/starts-with6.1.ddl.aql
@@ -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 test if exists;
+create dataverse test;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/starts-with6/starts-with6.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/starts-with6/starts-with6.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/string/starts-with6/starts-with6.2.update.aql
new file mode 100644
index 0000000..042f3ce
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/starts-with6/starts-with6.2.update.aql
@@ -0,0 +1,18 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/starts-with6/starts-with6.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/starts-with6/starts-with6.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/string/starts-with6/starts-with6.3.query.aql
new file mode 100644
index 0000000..01f0fb2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/starts-with6/starts-with6.3.query.aql
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 dataverse test;
+
+for $x in ["foofoo"]
+for $y in ["barbar"]
+return [starts-with($x, "ba"), starts-with($y, "ba")]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/starts-with7/starts-with7.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/starts-with7/starts-with7.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/string/starts-with7/starts-with7.1.ddl.aql
new file mode 100644
index 0000000..67f1799
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/starts-with7/starts-with7.1.ddl.aql
@@ -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.
+ */
+/*
+ * Testcase Name : startwith02.aql
+ * Description   : Positive tests
+ * Success       : Yes
+ * Date          : 19th April 2012
+ */
+
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/starts-with7/starts-with7.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/starts-with7/starts-with7.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/string/starts-with7/starts-with7.2.update.aql
new file mode 100644
index 0000000..f088376
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/starts-with7/starts-with7.2.update.aql
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Testcase Name : startwith02.aql
+ * Description   : Positive tests
+ * Success       : Yes
+ * Date          : 19th April 2012
+ */
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/starts-with7/starts-with7.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/starts-with7/starts-with7.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/string/starts-with7/starts-with7.3.query.aql
new file mode 100644
index 0000000..26acc7b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/starts-with7/starts-with7.3.query.aql
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Testcase Name : startwith02.aql
+ * Description   : Positive tests
+ * Success       : Yes
+ * Date          : 19th April 2012
+ */
+
+for $a in [
+null,
+starts-with("Hello","H"),
+starts-with("Hello",lowercase("He")),
+starts-with("Hello",""),
+starts-with("Hello"," "),
+starts-with("Hello",null),
+starts-with("abcdef",lowercase("ABCDEf")),
+starts-with("abcdef","abcdef"),
+starts-with("abcdef","abc "),
+starts-with("abc\\tdef","abc\\t"),
+starts-with(" abcdef","abc"),
+starts-with("0x1FF","0"),
+starts-with("<ID>","<"),
+starts-with("aBCDEFghI",codepoint-to-string([0041])),
+starts-with("AbCDEFghI",codepoint-to-string([0041]))]
+return $a
+
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/starts-with8/starts-with8.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/starts-with8/starts-with8.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/string/starts-with8/starts-with8.1.ddl.aql
new file mode 100644
index 0000000..7372823
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/starts-with8/starts-with8.1.ddl.aql
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Testcase Name : startwith02.aql
+ * Description   : Positive tests
+ * Success       : Yes
+ * Date          : 19th April 2012
+ */
+
+// Create internal dataset, insert string data into string field and pass the string field as first input to start-with function
+
+drop dataverse test if exists;
+create dataverse test;
+
+use dataverse test;
+
+create type TestType as {
+name:string
+}
+
+create dataset testds(TestType) primary key name;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/starts-with8/starts-with8.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/starts-with8/starts-with8.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/string/starts-with8/starts-with8.2.update.aql
new file mode 100644
index 0000000..257f6ae
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/starts-with8/starts-with8.2.update.aql
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Testcase Name : startwith02.aql
+ * Description   : Positive tests
+ * Success       : Yes
+ * Date          : 19th April 2012
+ */
+
+// Create internal dataset, insert string data into string field and pass the string field as first input to start-with function
+
+use dataverse test;
+
+insert into dataset testds({"name":"John Smith"});
+insert into dataset testds({"name":"John Doe"});
+insert into dataset testds({"name":"John Wayne"});
+insert into dataset testds({"name":"Johnson Ben"});
+insert into dataset testds({"name":"Johnny Walker"});
+insert into dataset testds({"name":"David Smith"});
+insert into dataset testds({"name":"Not a Name"});
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/starts-with8/starts-with8.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/starts-with8/starts-with8.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/string/starts-with8/starts-with8.3.query.aql
new file mode 100644
index 0000000..e6f3a63
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/starts-with8/starts-with8.3.query.aql
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Testcase Name : startwith02.aql
+ * Description   : Positive tests
+ * Success       : Yes
+ * Date          : 19th April 2012
+ */
+
+// Create internal dataset, insert string data into string field and pass the string field as first input to starts-with function
+
+use dataverse test;
+
+// Return all names that start with John
+
+for $l in dataset('testds')
+order by $l.name
+where starts-with($l.name,"John")
+return $l

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/starts-with_01/starts-with_01.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/starts-with_01/starts-with_01.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/string/starts-with_01/starts-with_01.1.ddl.aql
deleted file mode 100644
index d17ea60..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/starts-with_01/starts-with_01.1.ddl.aql
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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 test if exists;
-create dataverse test;
-

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/starts-with_01/starts-with_01.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/starts-with_01/starts-with_01.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/string/starts-with_01/starts-with_01.2.update.aql
deleted file mode 100644
index 042f3ce..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/starts-with_01/starts-with_01.2.update.aql
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/starts-with_01/starts-with_01.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/starts-with_01/starts-with_01.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/string/starts-with_01/starts-with_01.3.query.aql
deleted file mode 100644
index 01f0fb2..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/starts-with_01/starts-with_01.3.query.aql
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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 dataverse test;
-
-for $x in ["foofoo"]
-for $y in ["barbar"]
-return [starts-with($x, "ba"), starts-with($y, "ba")]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/startwith02/startwith02.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/startwith02/startwith02.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/string/startwith02/startwith02.1.ddl.aql
deleted file mode 100644
index 67f1799..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/startwith02/startwith02.1.ddl.aql
+++ /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.
- */
-/*
- * Testcase Name : startwith02.aql
- * Description   : Positive tests
- * Success       : Yes
- * Date          : 19th April 2012
- */
-
-

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/startwith02/startwith02.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/startwith02/startwith02.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/string/startwith02/startwith02.2.update.aql
deleted file mode 100644
index f088376..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/startwith02/startwith02.2.update.aql
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-/*
- * Testcase Name : startwith02.aql
- * Description   : Positive tests
- * Success       : Yes
- * Date          : 19th April 2012
- */
-

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/startwith02/startwith02.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/startwith02/startwith02.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/string/startwith02/startwith02.3.query.aql
deleted file mode 100644
index 61fb313..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/startwith02/startwith02.3.query.aql
+++ /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.
- */
-/*
- * Testcase Name : startwith02.aql
- * Description   : Positive tests
- * Success       : Yes
- * Date          : 19th April 2012
- */
-
-for $a in [start-with("Hello","H"),
-start-with("Hello",lowercase("He")),
-start-with("Hello",""),
-start-with("Hello"," "),
-start-with("Hello",null),
-start-with("abcdef",lowercase("ABCDEf")),
-start-with("abcdef","abcdef"),
-start-with("abcdef","abc "),
-start-with("abc\\tdef","abc\\t"),
-start-with(" abcdef","abc"),
-start-with("0x1FF","0"),
-start-with("<ID>","<"),
-start-with("aBCDEFghI",codepoint-to-string([0041])),
-start-with("AbCDEFghI",codepoint-to-string([0041]))]
-return $a
-
-

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/startwith03/startwith03.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/startwith03/startwith03.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/string/startwith03/startwith03.1.ddl.aql
deleted file mode 100644
index 7372823..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/startwith03/startwith03.1.ddl.aql
+++ /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.
- */
-/*
- * Testcase Name : startwith02.aql
- * Description   : Positive tests
- * Success       : Yes
- * Date          : 19th April 2012
- */
-
-// Create internal dataset, insert string data into string field and pass the string field as first input to start-with function
-
-drop dataverse test if exists;
-create dataverse test;
-
-use dataverse test;
-
-create type TestType as {
-name:string
-}
-
-create dataset testds(TestType) primary key name;
-

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/startwith03/startwith03.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/startwith03/startwith03.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/string/startwith03/startwith03.2.update.aql
deleted file mode 100644
index 257f6ae..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/startwith03/startwith03.2.update.aql
+++ /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.
- */
-/*
- * Testcase Name : startwith02.aql
- * Description   : Positive tests
- * Success       : Yes
- * Date          : 19th April 2012
- */
-
-// Create internal dataset, insert string data into string field and pass the string field as first input to start-with function
-
-use dataverse test;
-
-insert into dataset testds({"name":"John Smith"});
-insert into dataset testds({"name":"John Doe"});
-insert into dataset testds({"name":"John Wayne"});
-insert into dataset testds({"name":"Johnson Ben"});
-insert into dataset testds({"name":"Johnny Walker"});
-insert into dataset testds({"name":"David Smith"});
-insert into dataset testds({"name":"Not a Name"});
-

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/startwith03/startwith03.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/startwith03/startwith03.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/string/startwith03/startwith03.3.query.aql
deleted file mode 100644
index c005c48..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/startwith03/startwith03.3.query.aql
+++ /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.
- */
-/*
- * Testcase Name : startwith02.aql
- * Description   : Positive tests
- * Success       : Yes
- * Date          : 19th April 2012
- */
-
-// Create internal dataset, insert string data into string field and pass the string field as first input to start-with function
-
-use dataverse test;
-
-// Return all names that start with John
-
-for $l in dataset('testds')
-order by $l.name
-where start-with($l.name,"John")
-return $l

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/varlen-encoding/varlen-encoding.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/varlen-encoding/varlen-encoding.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/string/varlen-encoding/varlen-encoding.1.ddl.aql
new file mode 100644
index 0000000..042f3ce
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/varlen-encoding/varlen-encoding.1.ddl.aql
@@ -0,0 +1,18 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/varlen-encoding/varlen-encoding.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/varlen-encoding/varlen-encoding.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/string/varlen-encoding/varlen-encoding.2.update.aql
new file mode 100644
index 0000000..042f3ce
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/varlen-encoding/varlen-encoding.2.update.aql
@@ -0,0 +1,18 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */


[14/15] incubator-asterixdb git commit: ASTERIXDB-1102: VarSize Encoding to store length of String and ByteArray

Posted by ji...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/data/big-object/order.tbl.verylong.big
----------------------------------------------------------------------
diff --git a/asterix-app/data/big-object/order.tbl.verylong.big b/asterix-app/data/big-object/order.tbl.verylong.big
new file mode 100644
index 0000000..72535f4
--- /dev/null
+++ b/asterix-app/data/big-object/order.tbl.verylong.big
@@ -0,0 +1,1500 @@
+1|37|O|131251.81|1996-01-02|5-LOW|Clerk#000000951|0|nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously
  among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstr
 uctions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sle
 ep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiousl
 y among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nst
 ructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sl
 eep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furious
 ly among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among ns
 tructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions s
 leep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiou
 sly among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among n
 structions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions 
 sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furio
 usly among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among 
 nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions
  sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furi
 ously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among
  nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstruction
 s sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep fur
 iously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously amon
 g nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructio
 ns sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep fu
 riously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously amo
 ng nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructi
 ons sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep f
 uriously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously am
 ong nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstruct
 ions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep 
 furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously a
 mong nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstruc
 tions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep
  furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously 
 among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiouslnstructions sleep furiously among nstructions sleep furiously among nstructions s
 leep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiou
 sly among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among n
 structions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions 
 sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furio
 usly among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among 
 nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions
  sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furi
 ously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among
  nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstruction
 s sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep fur
 iously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously amon
 g nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructio
 ns sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep fu
 riously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously amo
 ng nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructi
 ons sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep f
 uriously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously am
 ong nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstruct
 ions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep 
 furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously a
 mong nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstruc
 tions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep
  furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously 
 among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstru
 ctions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions slee
 p furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously
  among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstr
 uctions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sle
 ep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiousl
 y among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nst
 ructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sl
 eep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furious
 ly among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiouslnstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstruction
 s sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep fur
 iously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously amon
 g nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructio
 ns sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep fu
 riously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously amo
 ng nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructi
 ons sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep f
 uriously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously am
 ong nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstruct
 ions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep 
 furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously a
 mong nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstruc
 tions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep
  furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously 
 among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstru
 ctions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions slee
 p furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously
  among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstr
 uctions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sle
 ep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiousl
 y among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nst
 ructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sl
 eep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furious
 ly among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously among nstructions sleep furiously

<TRUNCATED>


[11/15] incubator-asterixdb git commit: ASTERIXDB-1102: VarSize Encoding to store length of String and ByteArray

Posted by ji...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/varlen-encoding/varlen-encoding.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/varlen-encoding/varlen-encoding.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/string/varlen-encoding/varlen-encoding.3.query.aql
new file mode 100644
index 0000000..d374536
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/varlen-encoding/varlen-encoding.3.query.aql
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+let $str127 := "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
+let $str128 := string-concat([ "y", $str127 ])
+let $str256 := string-concat([ $str128, $str128 ])
+let $str1024 := string-concat([ $str256, $str256, $str256, $str256 ])
+let $str4096 := string-concat([ $str1024, $str1024, $str1024, $str1024])
+let $str16384 := string-concat([ $str4096, $str4096, $str4096, $str4096])                   // 16k
+let $str65536 := string-concat([ $str16384, $str16384, $str16384, $str16384])               // 64k
+let $str262144 := string-concat([ $str65536, $str65536, $str65536, $str65536])              // 256k
+let $str1048576 := string-concat([ $str262144, $str262144, $str262144, $str262144])         // 1M
+let $str4194304 := string-concat([ $str1048576, $str1048576, $str1048576, $str1048576])     // 4M
+let $str16777216 := string-concat([ $str4194304, $str4194304 , $str4194304, $str4194304])   // 16M
+
+return [ string-length($str127), string-length($str128), string-length($str256), 
+string-length($str1024), string-length($str4096), string-length($str16384),
+string-length($str65536), string-length($str262144), string-length($str1048576),
+string-length($str4194304), string-length($str16777216) ]


[09/15] incubator-asterixdb git commit: ASTERIXDB-1102: VarSize Encoding to store length of String and ByteArray

Posted by ji...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/results/big-object/big_object_load/load.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/big-object/big_object_load/load.1.adm b/asterix-app/src/test/resources/runtimets/results/big-object/big_object_load/load.1.adm
new file mode 100644
index 0000000..90e4448
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/big-object/big_object_load/load.1.adm
@@ -0,0 +1,1501 @@
+[ { "custkey": 37i32, "orderkey": 1i32, "len-comment": 2621440 }
+, { "custkey": 79i32, "orderkey": 2i32, "len-comment": 4480 }
+, { "custkey": 124i32, "orderkey": 3i32, "len-comment": 5840 }
+, { "custkey": 137i32, "orderkey": 4i32, "len-comment": 5600 }
+, { "custkey": 46i32, "orderkey": 5i32, "len-comment": 4320 }
+, { "custkey": 56i32, "orderkey": 6i32, "len-comment": 4960 }
+, { "custkey": 40i32, "orderkey": 7i32, "len-comment": 1600 }
+, { "custkey": 131i32, "orderkey": 32i32, "len-comment": 4480 }
+, { "custkey": 67i32, "orderkey": 33i32, "len-comment": 2640 }
+, { "custkey": 62i32, "orderkey": 34i32, "len-comment": 5360 }
+, { "custkey": 128i32, "orderkey": 35i32, "len-comment": 3440 }
+, { "custkey": 116i32, "orderkey": 36i32, "len-comment": 4720 }
+, { "custkey": 88i32, "orderkey": 37i32, "len-comment": 4960 }
+, { "custkey": 125i32, "orderkey": 38i32, "len-comment": 6160 }
+, { "custkey": 82i32, "orderkey": 39i32, "len-comment": 2560 }
+, { "custkey": 34i32, "orderkey": 64i32, "len-comment": 4880 }
+, { "custkey": 17i32, "orderkey": 65i32, "len-comment": 6160 }
+, { "custkey": 130i32, "orderkey": 66i32, "len-comment": 2240 }
+, { "custkey": 58i32, "orderkey": 67i32, "len-comment": 3840 }
+, { "custkey": 29i32, "orderkey": 68i32, "len-comment": 6080 }
+, { "custkey": 85i32, "orderkey": 69i32, "len-comment": 6080 }
+, { "custkey": 65i32, "orderkey": 70i32, "len-comment": 2000 }
+, { "custkey": 4i32, "orderkey": 71i32, "len-comment": 3360 }
+, { "custkey": 109i32, "orderkey": 96i32, "len-comment": 1680 }
+, { "custkey": 22i32, "orderkey": 97i32, "len-comment": 5760 }
+, { "custkey": 106i32, "orderkey": 98i32, "len-comment": 4800 }
+, { "custkey": 89i32, "orderkey": 99i32, "len-comment": 2880 }
+, { "custkey": 148i32, "orderkey": 100i32, "len-comment": 3520 }
+, { "custkey": 28i32, "orderkey": 101i32, "len-comment": 3600 }
+, { "custkey": 1i32, "orderkey": 102i32, "len-comment": 6240 }
+, { "custkey": 31i32, "orderkey": 103i32, "len-comment": 4800 }
+, { "custkey": 74i32, "orderkey": 128i32, "len-comment": 6240 }
+, { "custkey": 73i32, "orderkey": 129i32, "len-comment": 5760 }
+, { "custkey": 37i32, "orderkey": 130i32, "len-comment": 4480 }
+, { "custkey": 94i32, "orderkey": 131i32, "len-comment": 3520 }
+, { "custkey": 28i32, "orderkey": 132i32, "len-comment": 5840 }
+, { "custkey": 44i32, "orderkey": 133i32, "len-comment": 1760 }
+, { "custkey": 7i32, "orderkey": 134i32, "len-comment": 1600 }
+, { "custkey": 61i32, "orderkey": 135i32, "len-comment": 2160 }
+, { "custkey": 83i32, "orderkey": 160i32, "len-comment": 3120 }
+, { "custkey": 17i32, "orderkey": 161i32, "len-comment": 2800 }
+, { "custkey": 16i32, "orderkey": 162i32, "len-comment": 5280 }
+, { "custkey": 88i32, "orderkey": 163i32, "len-comment": 4160 }
+, { "custkey": 1i32, "orderkey": 164i32, "len-comment": 6240 }
+, { "custkey": 28i32, "orderkey": 165i32, "len-comment": 3360 }
+, { "custkey": 109i32, "orderkey": 166i32, "len-comment": 2880 }
+, { "custkey": 121i32, "orderkey": 167i32, "len-comment": 3440 }
+, { "custkey": 83i32, "orderkey": 192i32, "len-comment": 4960 }
+, { "custkey": 80i32, "orderkey": 193i32, "len-comment": 1840 }
+, { "custkey": 62i32, "orderkey": 194i32, "len-comment": 5440 }
+, { "custkey": 136i32, "orderkey": 195i32, "len-comment": 3360 }
+, { "custkey": 65i32, "orderkey": 196i32, "len-comment": 3040 }
+, { "custkey": 34i32, "orderkey": 197i32, "len-comment": 5920 }
+, { "custkey": 112i32, "orderkey": 198i32, "len-comment": 4720 }
+, { "custkey": 53i32, "orderkey": 199i32, "len-comment": 2320 }
+, { "custkey": 4i32, "orderkey": 224i32, "len-comment": 2880 }
+, { "custkey": 34i32, "orderkey": 225i32, "len-comment": 4880 }
+, { "custkey": 128i32, "orderkey": 226i32, "len-comment": 3360 }
+, { "custkey": 10i32, "orderkey": 227i32, "len-comment": 2720 }
+, { "custkey": 46i32, "orderkey": 228i32, "len-comment": 5200 }
+, { "custkey": 112i32, "orderkey": 229i32, "len-comment": 3360 }
+, { "custkey": 103i32, "orderkey": 230i32, "len-comment": 2400 }
+, { "custkey": 91i32, "orderkey": 231i32, "len-comment": 4640 }
+, { "custkey": 125i32, "orderkey": 256i32, "len-comment": 4880 }
+, { "custkey": 124i32, "orderkey": 257i32, "len-comment": 4000 }
+, { "custkey": 43i32, "orderkey": 258i32, "len-comment": 5280 }
+, { "custkey": 44i32, "orderkey": 259i32, "len-comment": 6240 }
+, { "custkey": 106i32, "orderkey": 260i32, "len-comment": 4000 }
+, { "custkey": 47i32, "orderkey": 261i32, "len-comment": 3360 }
+, { "custkey": 31i32, "orderkey": 262i32, "len-comment": 3920 }
+, { "custkey": 118i32, "orderkey": 263i32, "len-comment": 2720 }
+, { "custkey": 8i32, "orderkey": 288i32, "len-comment": 3680 }
+, { "custkey": 104i32, "orderkey": 289i32, "len-comment": 2080 }
+, { "custkey": 118i32, "orderkey": 290i32, "len-comment": 2400 }
+, { "custkey": 142i32, "orderkey": 291i32, "len-comment": 3520 }
+, { "custkey": 23i32, "orderkey": 292i32, "len-comment": 2720 }
+, { "custkey": 31i32, "orderkey": 293i32, "len-comment": 2960 }
+, { "custkey": 52i32, "orderkey": 294i32, "len-comment": 4560 }
+, { "custkey": 19i32, "orderkey": 295i32, "len-comment": 3760 }
+, { "custkey": 1i32, "orderkey": 320i32, "len-comment": 1680 }
+, { "custkey": 124i32, "orderkey": 321i32, "len-comment": 5600 }
+, { "custkey": 134i32, "orderkey": 322i32, "len-comment": 6080 }
+, { "custkey": 40i32, "orderkey": 323i32, "len-comment": 4720 }
+, { "custkey": 106i32, "orderkey": 324i32, "len-comment": 5440 }
+, { "custkey": 41i32, "orderkey": 325i32, "len-comment": 1840 }
+, { "custkey": 76i32, "orderkey": 326i32, "len-comment": 6000 }
+, { "custkey": 145i32, "orderkey": 327i32, "len-comment": 4160 }
+, { "custkey": 107i32, "orderkey": 352i32, "len-comment": 5440 }
+, { "custkey": 2i32, "orderkey": 353i32, "len-comment": 5120 }
+, { "custkey": 139i32, "orderkey": 354i32, "len-comment": 5840 }
+, { "custkey": 71i32, "orderkey": 355i32, "len-comment": 5200 }
+, { "custkey": 148i32, "orderkey": 356i32, "len-comment": 3120 }
+, { "custkey": 61i32, "orderkey": 357i32, "len-comment": 4160 }
+, { "custkey": 4i32, "orderkey": 358i32, "len-comment": 4000 }
+, { "custkey": 79i32, "orderkey": 359i32, "len-comment": 5280 }
+, { "custkey": 115i32, "orderkey": 384i32, "len-comment": 4480 }
+, { "custkey": 34i32, "orderkey": 385i32, "len-comment": 2480 }
+, { "custkey": 61i32, "orderkey": 386i32, "len-comment": 6240 }
+, { "custkey": 4i32, "orderkey": 387i32, "len-comment": 5440 }
+, { "custkey": 46i32, "orderkey": 388i32, "len-comment": 5280 }
+, { "custkey": 127i32, "orderkey": 389i32, "len-comment": 2621440 }
+, { "custkey": 103i32, "orderkey": 390i32, "len-comment": 4320 }
+, { "custkey": 112i32, "orderkey": 391i32, "len-comment": 1600 }
+, { "custkey": 41i32, "orderkey": 416i32, "len-comment": 2640 }
+, { "custkey": 55i32, "orderkey": 417i32, "len-comment": 6160 }
+, { "custkey": 95i32, "orderkey": 418i32, "len-comment": 2080 }
+, { "custkey": 118i32, "orderkey": 419i32, "len-comment": 4080 }
+, { "custkey": 91i32, "orderkey": 420i32, "len-comment": 6240 }
+, { "custkey": 40i32, "orderkey": 421i32, "len-comment": 3840 }
+, { "custkey": 74i32, "orderkey": 422i32, "len-comment": 5120 }
+, { "custkey": 104i32, "orderkey": 423i32, "len-comment": 5200 }
+, { "custkey": 149i32, "orderkey": 448i32, "len-comment": 3360 }
+, { "custkey": 97i32, "orderkey": 449i32, "len-comment": 3760 }
+, { "custkey": 49i32, "orderkey": 450i32, "len-comment": 3760 }
+, { "custkey": 100i32, "orderkey": 451i32, "len-comment": 3680 }
+, { "custkey": 61i32, "orderkey": 452i32, "len-comment": 4160 }
+, { "custkey": 46i32, "orderkey": 453i32, "len-comment": 4320 }
+, { "custkey": 49i32, "orderkey": 454i32, "len-comment": 5120 }
+, { "custkey": 13i32, "orderkey": 455i32, "len-comment": 2880 }
+, { "custkey": 73i32, "orderkey": 480i32, "len-comment": 6160 }
+, { "custkey": 31i32, "orderkey": 481i32, "len-comment": 3200 }
+, { "custkey": 127i32, "orderkey": 482i32, "len-comment": 2320 }
+, { "custkey": 35i32, "orderkey": 483i32, "len-comment": 2160 }
+, { "custkey": 55i32, "orderkey": 484i32, "len-comment": 5600 }
+, { "custkey": 101i32, "orderkey": 485i32, "len-comment": 2960 }
+, { "custkey": 52i32, "orderkey": 486i32, "len-comment": 3040 }
+, { "custkey": 109i32, "orderkey": 487i32, "len-comment": 2640 }
+, { "custkey": 64i32, "orderkey": 512i32, "len-comment": 5200 }
+, { "custkey": 61i32, "orderkey": 513i32, "len-comment": 5040 }
+, { "custkey": 76i32, "orderkey": 514i32, "len-comment": 5920 }
+, { "custkey": 142i32, "orderkey": 515i32, "len-comment": 5120 }
+, { "custkey": 44i32, "orderkey": 516i32, "len-comment": 6160 }
+, { "custkey": 10i32, "orderkey": 517i32, "len-comment": 4320 }
+, { "custkey": 145i32, "orderkey": 518i32, "len-comment": 4560 }
+, { "custkey": 64i32, "orderkey": 519i32, "len-comment": 2640 }
+, { "custkey": 94i32, "orderkey": 544i32, "len-comment": 3520 }
+, { "custkey": 64i32, "orderkey": 545i32, "len-comment": 3360 }
+, { "custkey": 145i32, "orderkey": 546i32, "len-comment": 3760 }
+, { "custkey": 100i32, "orderkey": 547i32, "len-comment": 3280 }
+, { "custkey": 124i32, "orderkey": 548i32, "len-comment": 1840 }
+, { "custkey": 110i32, "orderkey": 549i32, "len-comment": 1520 }
+, { "custkey": 25i32, "orderkey": 550i32, "len-comment": 1680 }
+, { "custkey": 91i32, "orderkey": 551i32, "len-comment": 2080 }
+, { "custkey": 31i32, "orderkey": 576i32, "len-comment": 3840 }
+, { "custkey": 56i32, "orderkey": 577i32, "len-comment": 2080 }
+, { "custkey": 94i32, "orderkey": 578i32, "len-comment": 4240 }
+, { "custkey": 68i32, "orderkey": 579i32, "len-comment": 3040 }
+, { "custkey": 61i32, "orderkey": 580i32, "len-comment": 2400 }
+, { "custkey": 70i32, "orderkey": 581i32, "len-comment": 4160 }
+, { "custkey": 50i32, "orderkey": 582i32, "len-comment": 1680 }
+, { "custkey": 49i32, "orderkey": 583i32, "len-comment": 2080 }
+, { "custkey": 26i32, "orderkey": 608i32, "len-comment": 2640 }
+, { "custkey": 127i32, "orderkey": 609i32, "len-comment": 2800 }
+, { "custkey": 52i32, "orderkey": 610i32, "len-comment": 2320 }
+, { "custkey": 106i32, "orderkey": 611i32, "len-comment": 2000 }
+, { "custkey": 82i32, "orderkey": 612i32, "len-comment": 5200 }
+, { "custkey": 139i32, "orderkey": 613i32, "len-comment": 4080 }
+, { "custkey": 134i32, "orderkey": 614i32, "len-comment": 2480 }
+, { "custkey": 67i32, "orderkey": 615i32, "len-comment": 5200 }
+, { "custkey": 97i32, "orderkey": 640i32, "len-comment": 5360 }
+, { "custkey": 133i32, "orderkey": 641i32, "len-comment": 4000 }
+, { "custkey": 40i32, "orderkey": 642i32, "len-comment": 3680 }
+, { "custkey": 58i32, "orderkey": 643i32, "len-comment": 2640 }
+, { "custkey": 8i32, "orderkey": 644i32, "len-comment": 5760 }
+, { "custkey": 115i32, "orderkey": 645i32, "len-comment": 3360 }
+, { "custkey": 52i32, "orderkey": 646i32, "len-comment": 2080 }
+, { "custkey": 143i32, "orderkey": 647i32, "len-comment": 4880 }
+, { "custkey": 109i32, "orderkey": 672i32, "len-comment": 3440 }
+, { "custkey": 80i32, "orderkey": 673i32, "len-comment": 4400 }
+, { "custkey": 34i32, "orderkey": 674i32, "len-comment": 6080 }
+, { "custkey": 13i32, "orderkey": 675i32, "len-comment": 2000 }
+, { "custkey": 38i32, "orderkey": 676i32, "len-comment": 2880 }
+, { "custkey": 124i32, "orderkey": 677i32, "len-comment": 3920 }
+, { "custkey": 131i32, "orderkey": 678i32, "len-comment": 2560 }
+, { "custkey": 49i32, "orderkey": 679i32, "len-comment": 6240 }
+, { "custkey": 85i32, "orderkey": 704i32, "len-comment": 4800 }
+, { "custkey": 43i32, "orderkey": 705i32, "len-comment": 5840 }
+, { "custkey": 148i32, "orderkey": 706i32, "len-comment": 2240 }
+, { "custkey": 118i32, "orderkey": 707i32, "len-comment": 4080 }
+, { "custkey": 32i32, "orderkey": 708i32, "len-comment": 1680 }
+, { "custkey": 37i32, "orderkey": 709i32, "len-comment": 3600 }
+, { "custkey": 133i32, "orderkey": 710i32, "len-comment": 3600 }
+, { "custkey": 64i32, "orderkey": 711i32, "len-comment": 2880 }
+, { "custkey": 47i32, "orderkey": 736i32, "len-comment": 1840 }
+, { "custkey": 121i32, "orderkey": 737i32, "len-comment": 5600 }
+, { "custkey": 22i32, "orderkey": 738i32, "len-comment": 4080 }
+, { "custkey": 1i32, "orderkey": 739i32, "len-comment": 4080 }
+, { "custkey": 44i32, "orderkey": 740i32, "len-comment": 3760 }
+, { "custkey": 106i32, "orderkey": 741i32, "len-comment": 3840 }
+, { "custkey": 103i32, "orderkey": 742i32, "len-comment": 5200 }
+, { "custkey": 79i32, "orderkey": 743i32, "len-comment": 4880 }
+, { "custkey": 98i32, "orderkey": 768i32, "len-comment": 3440 }
+, { "custkey": 80i32, "orderkey": 769i32, "len-comment": 5440 }
+, { "custkey": 32i32, "orderkey": 770i32, "len-comment": 4160 }
+, { "custkey": 46i32, "orderkey": 771i32, "len-comment": 4000 }
+, { "custkey": 97i32, "orderkey": 772i32, "len-comment": 4400 }
+, { "custkey": 133i32, "orderkey": 773i32, "len-comment": 5840 }
+, { "custkey": 80i32, "orderkey": 774i32, "len-comment": 1680 }
+, { "custkey": 134i32, "orderkey": 775i32, "len-comment": 4960 }
+, { "custkey": 56i32, "orderkey": 800i32, "len-comment": 5760 }
+, { "custkey": 118i32, "orderkey": 801i32, "len-comment": 2621440 }
+, { "custkey": 137i32, "orderkey": 802i32, "len-comment": 4240 }
+, { "custkey": 16i32, "orderkey": 803i32, "len-comment": 6080 }
+, { "custkey": 50i32, "orderkey": 804i32, "len-comment": 3520 }
+, { "custkey": 127i32, "orderkey": 805i32, "len-comment": 2240 }
+, { "custkey": 131i32, "orderkey": 806i32, "len-comment": 3200 }
+, { "custkey": 145i32, "orderkey": 807i32, "len-comment": 3760 }
+, { "custkey": 29i32, "orderkey": 832i32, "len-comment": 5040 }
+, { "custkey": 56i32, "orderkey": 833i32, "len-comment": 2640 }
+, { "custkey": 43i32, "orderkey": 834i32, "len-comment": 5680 }
+, { "custkey": 65i32, "orderkey": 835i32, "len-comment": 4800 }
+, { "custkey": 70i32, "orderkey": 836i32, "len-comment": 5840 }
+, { "custkey": 116i32, "orderkey": 837i32, "len-comment": 3840 }
+, { "custkey": 17i32, "orderkey": 838i32, "len-comment": 2240 }
+, { "custkey": 28i32, "orderkey": 839i32, "len-comment": 4000 }
+, { "custkey": 139i32, "orderkey": 864i32, "len-comment": 5680 }
+, { "custkey": 4i32, "orderkey": 865i32, "len-comment": 6080 }
+, { "custkey": 40i32, "orderkey": 866i32, "len-comment": 3600 }
+, { "custkey": 26i32, "orderkey": 867i32, "len-comment": 2000 }
+, { "custkey": 104i32, "orderkey": 868i32, "len-comment": 3840 }
+, { "custkey": 136i32, "orderkey": 869i32, "len-comment": 5920 }
+, { "custkey": 34i32, "orderkey": 870i32, "len-comment": 2640 }
+, { "custkey": 16i32, "orderkey": 871i32, "len-comment": 2160 }
+, { "custkey": 2i32, "orderkey": 896i32, "len-comment": 5840 }
+, { "custkey": 49i32, "orderkey": 897i32, "len-comment": 1760 }
+, { "custkey": 55i32, "orderkey": 898i32, "len-comment": 3520 }
+, { "custkey": 109i32, "orderkey": 899i32, "len-comment": 3120 }
+, { "custkey": 46i32, "orderkey": 900i32, "len-comment": 3120 }
+, { "custkey": 13i32, "orderkey": 901i32, "len-comment": 5840 }
+, { "custkey": 10i32, "orderkey": 902i32, "len-comment": 3520 }
+, { "custkey": 11i32, "orderkey": 903i32, "len-comment": 2080 }
+, { "custkey": 67i32, "orderkey": 928i32, "len-comment": 2240 }
+, { "custkey": 83i32, "orderkey": 929i32, "len-comment": 6240 }
+, { "custkey": 131i32, "orderkey": 930i32, "len-comment": 4560 }
+, { "custkey": 103i32, "orderkey": 931i32, "len-comment": 5040 }
+, { "custkey": 41i32, "orderkey": 932i32, "len-comment": 3440 }
+, { "custkey": 97i32, "orderkey": 933i32, "len-comment": 5840 }
+, { "custkey": 52i32, "orderkey": 934i32, "len-comment": 3840 }
+, { "custkey": 50i32, "orderkey": 935i32, "len-comment": 4240 }
+, { "custkey": 35i32, "orderkey": 960i32, "len-comment": 2080 }
+, { "custkey": 56i32, "orderkey": 961i32, "len-comment": 2720 }
+, { "custkey": 37i32, "orderkey": 962i32, "len-comment": 2960 }
+, { "custkey": 26i32, "orderkey": 963i32, "len-comment": 5440 }
+, { "custkey": 76i32, "orderkey": 964i32, "len-comment": 3200 }
+, { "custkey": 70i32, "orderkey": 965i32, "len-comment": 4960 }
+, { "custkey": 14i32, "orderkey": 966i32, "len-comment": 2000 }
+, { "custkey": 110i32, "orderkey": 967i32, "len-comment": 2480 }
+, { "custkey": 55i32, "orderkey": 992i32, "len-comment": 3440 }
+, { "custkey": 80i32, "orderkey": 993i32, "len-comment": 3840 }
+, { "custkey": 2i32, "orderkey": 994i32, "len-comment": 2640 }
+, { "custkey": 116i32, "orderkey": 995i32, "len-comment": 5760 }
+, { "custkey": 71i32, "orderkey": 996i32, "len-comment": 5120 }
+, { "custkey": 109i32, "orderkey": 997i32, "len-comment": 5440 }
+, { "custkey": 32i32, "orderkey": 998i32, "len-comment": 4720 }
+, { "custkey": 61i32, "orderkey": 999i32, "len-comment": 3040 }
+, { "custkey": 4i32, "orderkey": 1024i32, "len-comment": 4480 }
+, { "custkey": 103i32, "orderkey": 1025i32, "len-comment": 1840 }
+, { "custkey": 73i32, "orderkey": 1026i32, "len-comment": 2320 }
+, { "custkey": 128i32, "orderkey": 1027i32, "len-comment": 3040 }
+, { "custkey": 70i32, "orderkey": 1028i32, "len-comment": 3760 }
+, { "custkey": 130i32, "orderkey": 1029i32, "len-comment": 5280 }
+, { "custkey": 134i32, "orderkey": 1030i32, "len-comment": 6240 }
+, { "custkey": 4i32, "orderkey": 1031i32, "len-comment": 3520 }
+, { "custkey": 28i32, "orderkey": 1056i32, "len-comment": 3760 }
+, { "custkey": 76i32, "orderkey": 1057i32, "len-comment": 5760 }
+, { "custkey": 53i32, "orderkey": 1058i32, "len-comment": 5920 }
+, { "custkey": 127i32, "orderkey": 1059i32, "len-comment": 5440 }
+, { "custkey": 140i32, "orderkey": 1060i32, "len-comment": 4800 }
+, { "custkey": 103i32, "orderkey": 1061i32, "len-comment": 2560 }
+, { "custkey": 106i32, "orderkey": 1062i32, "len-comment": 1680 }
+, { "custkey": 37i32, "orderkey": 1063i32, "len-comment": 3600 }
+, { "custkey": 148i32, "orderkey": 1088i32, "len-comment": 3840 }
+, { "custkey": 49i32, "orderkey": 1089i32, "len-comment": 4160 }
+, { "custkey": 19i32, "orderkey": 1090i32, "len-comment": 5360 }
+, { "custkey": 83i32, "orderkey": 1091i32, "len-comment": 4240 }
+, { "custkey": 124i32, "orderkey": 1092i32, "len-comment": 2160 }
+, { "custkey": 101i32, "orderkey": 1093i32, "len-comment": 6080 }
+, { "custkey": 145i32, "orderkey": 1094i32, "len-comment": 5520 }
+, { "custkey": 145i32, "orderkey": 1095i32, "len-comment": 3760 }
+, { "custkey": 140i32, "orderkey": 1120i32, "len-comment": 5600 }
+, { "custkey": 29i32, "orderkey": 1121i32, "len-comment": 4640 }
+, { "custkey": 121i32, "orderkey": 1122i32, "len-comment": 5440 }
+, { "custkey": 73i32, "orderkey": 1123i32, "len-comment": 4160 }
+, { "custkey": 80i32, "orderkey": 1124i32, "len-comment": 4320 }
+, { "custkey": 25i32, "orderkey": 1125i32, "len-comment": 1920 }
+, { "custkey": 145i32, "orderkey": 1126i32, "len-comment": 5920 }
+, { "custkey": 58i32, "orderkey": 1127i32, "len-comment": 5120 }
+, { "custkey": 49i32, "orderkey": 1152i32, "len-comment": 1600 }
+, { "custkey": 121i32, "orderkey": 1153i32, "len-comment": 2080 }
+, { "custkey": 37i32, "orderkey": 1154i32, "len-comment": 6000 }
+, { "custkey": 149i32, "orderkey": 1155i32, "len-comment": 6160 }
+, { "custkey": 133i32, "orderkey": 1156i32, "len-comment": 3360 }
+, { "custkey": 97i32, "orderkey": 1157i32, "len-comment": 4560 }
+, { "custkey": 142i32, "orderkey": 1158i32, "len-comment": 3200 }
+, { "custkey": 70i32, "orderkey": 1159i32, "len-comment": 3120 }
+, { "custkey": 89i32, "orderkey": 1184i32, "len-comment": 3280 }
+, { "custkey": 74i32, "orderkey": 1185i32, "len-comment": 2240 }
+, { "custkey": 59i32, "orderkey": 1186i32, "len-comment": 2880 }
+, { "custkey": 134i32, "orderkey": 1187i32, "len-comment": 4640 }
+, { "custkey": 20i32, "orderkey": 1188i32, "len-comment": 2080 }
+, { "custkey": 46i32, "orderkey": 1189i32, "len-comment": 2621440 }
+, { "custkey": 13i32, "orderkey": 1190i32, "len-comment": 4320 }
+, { "custkey": 112i32, "orderkey": 1191i32, "len-comment": 3520 }
+, { "custkey": 122i32, "orderkey": 1216i32, "len-comment": 1760 }
+, { "custkey": 7i32, "orderkey": 1217i32, "len-comment": 4480 }
+, { "custkey": 10i32, "orderkey": 1218i32, "len-comment": 3920 }
+, { "custkey": 28i32, "orderkey": 1219i32, "len-comment": 4720 }
+, { "custkey": 49i32, "orderkey": 1220i32, "len-comment": 4400 }
+, { "custkey": 14i32, "orderkey": 1221i32, "len-comment": 4720 }
+, { "custkey": 10i32, "orderkey": 1222i32, "len-comment": 4960 }
+, { "custkey": 10i32, "orderkey": 1223i32, "len-comment": 1760 }
+, { "custkey": 49i32, "orderkey": 1248i32, "len-comment": 2720 }
+, { "custkey": 149i32, "orderkey": 1249i32, "len-comment": 2880 }
+, { "custkey": 37i32, "orderkey": 1250i32, "len-comment": 5120 }
+, { "custkey": 38i32, "orderkey": 1251i32, "len-comment": 3440 }
+, { "custkey": 149i32, "orderkey": 1252i32, "len-comment": 5520 }
+, { "custkey": 115i32, "orderkey": 1253i32, "len-comment": 4240 }
+, { "custkey": 70i32, "orderkey": 1254i32, "len-comment": 3120 }
+, { "custkey": 122i32, "orderkey": 1255i32, "len-comment": 2560 }
+, { "custkey": 97i32, "orderkey": 1280i32, "len-comment": 4640 }
+, { "custkey": 62i32, "orderkey": 1281i32, "len-comment": 3120 }
+, { "custkey": 116i32, "orderkey": 1282i32, "len-comment": 3760 }
+, { "custkey": 118i32, "orderkey": 1283i32, "len-comment": 2160 }
+, { "custkey": 134i32, "orderkey": 1284i32, "len-comment": 2320 }
+, { "custkey": 11i32, "orderkey": 1285i32, "len-comment": 3920 }
+, { "custkey": 109i32, "orderkey": 1286i32, "len-comment": 4320 }
+, { "custkey": 19i32, "orderkey": 1287i32, "len-comment": 5360 }
+, { "custkey": 112i32, "orderkey": 1312i32, "len-comment": 2960 }
+, { "custkey": 148i32, "orderkey": 1313i32, "len-comment": 6080 }
+, { "custkey": 143i32, "orderkey": 1314i32, "len-comment": 6000 }
+, { "custkey": 22i32, "orderkey": 1315i32, "len-comment": 3280 }
+, { "custkey": 16i32, "orderkey": 1316i32, "len-comment": 3200 }
+, { "custkey": 100i32, "orderkey": 1317i32, "len-comment": 3200 }
+, { "custkey": 128i32, "orderkey": 1318i32, "len-comment": 2640 }
+, { "custkey": 32i32, "orderkey": 1319i32, "len-comment": 3680 }
+, { "custkey": 17i32, "orderkey": 1344i32, "len-comment": 5120 }
+, { "custkey": 95i32, "orderkey": 1345i32, "len-comment": 2720 }
+, { "custkey": 76i32, "orderkey": 1346i32, "len-comment": 2320 }
+, { "custkey": 41i32, "orderkey": 1347i32, "len-comment": 3920 }
+, { "custkey": 19i32, "orderkey": 1348i32, "len-comment": 1920 }
+, { "custkey": 64i32, "orderkey": 1349i32, "len-comment": 4320 }
+, { "custkey": 52i32, "orderkey": 1350i32, "len-comment": 2800 }
+, { "custkey": 106i32, "orderkey": 1351i32, "len-comment": 2240 }
+, { "custkey": 47i32, "orderkey": 1376i32, "len-comment": 3360 }
+, { "custkey": 20i32, "orderkey": 1377i32, "len-comment": 6160 }
+, { "custkey": 20i32, "orderkey": 1378i32, "len-comment": 4080 }
+, { "custkey": 65i32, "orderkey": 1379i32, "len-comment": 1600 }
+, { "custkey": 137i32, "orderkey": 1380i32, "len-comment": 5120 }
+, { "custkey": 127i32, "orderkey": 1381i32, "len-comment": 5440 }
+, { "custkey": 133i32, "orderkey": 1382i32, "len-comment": 1840 }
+, { "custkey": 121i32, "orderkey": 1383i32, "len-comment": 2720 }
+, { "custkey": 55i32, "orderkey": 1408i32, "len-comment": 3120 }
+, { "custkey": 143i32, "orderkey": 1409i32, "len-comment": 5840 }
+, { "custkey": 113i32, "orderkey": 1410i32, "len-comment": 5920 }
+, { "custkey": 95i32, "orderkey": 1411i32, "len-comment": 5520 }
+, { "custkey": 53i32, "orderkey": 1412i32, "len-comment": 1840 }
+, { "custkey": 91i32, "orderkey": 1413i32, "len-comment": 4240 }
+, { "custkey": 77i32, "orderkey": 1414i32, "len-comment": 2560 }
+, { "custkey": 79i32, "orderkey": 1415i32, "len-comment": 3120 }
+, { "custkey": 98i32, "orderkey": 1440i32, "len-comment": 2240 }
+, { "custkey": 122i32, "orderkey": 1441i32, "len-comment": 3040 }
+, { "custkey": 112i32, "orderkey": 1442i32, "len-comment": 3280 }
+, { "custkey": 44i32, "orderkey": 1443i32, "len-comment": 6240 }
+, { "custkey": 134i32, "orderkey": 1444i32, "len-comment": 3440 }
+, { "custkey": 115i32, "orderkey": 1445i32, "len-comment": 2240 }
+, { "custkey": 41i32, "orderkey": 1446i32, "len-comment": 4960 }
+, { "custkey": 91i32, "orderkey": 1447i32, "len-comment": 4320 }
+, { "custkey": 149i32, "orderkey": 1472i32, "len-comment": 4720 }
+, { "custkey": 94i32, "orderkey": 1473i32, "len-comment": 1760 }
+, { "custkey": 70i32, "orderkey": 1474i32, "len-comment": 3200 }
+, { "custkey": 5i32, "orderkey": 1475i32, "len-comment": 3920 }
+, { "custkey": 145i32, "orderkey": 1476i32, "len-comment": 5440 }
+, { "custkey": 76i32, "orderkey": 1477i32, "len-comment": 2960 }
+, { "custkey": 50i32, "orderkey": 1478i32, "len-comment": 2000 }
+, { "custkey": 16i32, "orderkey": 1479i32, "len-comment": 3600 }
+, { "custkey": 2i32, "orderkey": 1504i32, "len-comment": 2000 }
+, { "custkey": 37i32, "orderkey": 1505i32, "len-comment": 5360 }
+, { "custkey": 148i32, "orderkey": 1506i32, "len-comment": 6240 }
+, { "custkey": 121i32, "orderkey": 1507i32, "len-comment": 1520 }
+, { "custkey": 103i32, "orderkey": 1508i32, "len-comment": 5200 }
+, { "custkey": 64i32, "orderkey": 1509i32, "len-comment": 1920 }
+, { "custkey": 53i32, "orderkey": 1510i32, "len-comment": 4560 }
+, { "custkey": 79i32, "orderkey": 1511i32, "len-comment": 1520 }
+, { "custkey": 94i32, "orderkey": 1536i32, "len-comment": 3600 }
+, { "custkey": 109i32, "orderkey": 1537i32, "len-comment": 3760 }
+, { "custkey": 29i32, "orderkey": 1538i32, "len-comment": 2240 }
+, { "custkey": 112i32, "orderkey": 1539i32, "len-comment": 1600 }
+, { "custkey": 16i32, "orderkey": 1540i32, "len-comment": 1680 }
+, { "custkey": 94i32, "orderkey": 1541i32, "len-comment": 4160 }
+, { "custkey": 143i32, "orderkey": 1542i32, "len-comment": 3120 }
+, { "custkey": 52i32, "orderkey": 1543i32, "len-comment": 1600 }
+, { "custkey": 17i32, "orderkey": 1568i32, "len-comment": 1760 }
+, { "custkey": 104i32, "orderkey": 1569i32, "len-comment": 6240 }
+, { "custkey": 124i32, "orderkey": 1570i32, "len-comment": 2160 }
+, { "custkey": 103i32, "orderkey": 1571i32, "len-comment": 5600 }
+, { "custkey": 11i32, "orderkey": 1572i32, "len-comment": 6160 }
+, { "custkey": 148i32, "orderkey": 1573i32, "len-comment": 3280 }
+, { "custkey": 134i32, "orderkey": 1574i32, "len-comment": 3360 }
+, { "custkey": 145i32, "orderkey": 1575i32, "len-comment": 1840 }
+, { "custkey": 94i32, "orderkey": 1600i32, "len-comment": 5280 }
+, { "custkey": 53i32, "orderkey": 1601i32, "len-comment": 2621440 }
+, { "custkey": 1i32, "orderkey": 1602i32, "len-comment": 4640 }
+, { "custkey": 2i32, "orderkey": 1603i32, "len-comment": 2240 }
+, { "custkey": 113i32, "orderkey": 1604i32, "len-comment": 4720 }
+, { "custkey": 58i32, "orderkey": 1605i32, "len-comment": 3520 }
+, { "custkey": 53i32, "orderkey": 1606i32, "len-comment": 5040 }
+, { "custkey": 149i32, "orderkey": 1607i32, "len-comment": 3360 }
+, { "custkey": 67i32, "orderkey": 1632i32, "len-comment": 2720 }
+, { "custkey": 16i32, "orderkey": 1633i32, "len-comment": 1600 }
+, { "custkey": 70i32, "orderkey": 1634i32, "len-comment": 5680 }
+, { "custkey": 4i32, "orderkey": 1635i32, "len-comment": 2960 }
+, { "custkey": 79i32, "orderkey": 1636i32, "len-comment": 3680 }
+, { "custkey": 73i32, "orderkey": 1637i32, "len-comment": 5840 }
+, { "custkey": 139i32, "orderkey": 1638i32, "len-comment": 2000 }
+, { "custkey": 5i32, "orderkey": 1639i32, "len-comment": 3760 }
+, { "custkey": 64i32, "orderkey": 1664i32, "len-comment": 5760 }
+, { "custkey": 76i32, "orderkey": 1665i32, "len-comment": 4720 }
+, { "custkey": 95i32, "orderkey": 1666i32, "len-comment": 5280 }
+, { "custkey": 5i32, "orderkey": 1667i32, "len-comment": 3600 }
+, { "custkey": 142i32, "orderkey": 1668i32, "len-comment": 3600 }
+, { "custkey": 2i32, "orderkey": 1669i32, "len-comment": 3760 }
+, { "custkey": 25i32, "orderkey": 1670i32, "len-comment": 4320 }
+, { "custkey": 35i32, "orderkey": 1671i32, "len-comment": 3280 }
+, { "custkey": 4i32, "orderkey": 1696i32, "len-comment": 3520 }
+, { "custkey": 76i32, "orderkey": 1697i32, "len-comment": 1600 }
+, { "custkey": 40i32, "orderkey": 1698i32, "len-comment": 2560 }
+, { "custkey": 85i32, "orderkey": 1699i32, "len-comment": 2160 }
+, { "custkey": 65i32, "orderkey": 1700i32, "len-comment": 5840 }
+, { "custkey": 130i32, "orderkey": 1701i32, "len-comment": 2720 }
+, { "custkey": 67i32, "orderkey": 1702i32, "len-comment": 5680 }
+, { "custkey": 134i32, "orderkey": 1703i32, "len-comment": 5360 }
+, { "custkey": 64i32, "orderkey": 1728i32, "len-comment": 4880 }
+, { "custkey": 133i32, "orderkey": 1729i32, "len-comment": 2240 }
+, { "custkey": 124i32, "orderkey": 1730i32, "len-comment": 5520 }
+, { "custkey": 128i32, "orderkey": 1731i32, "len-comment": 5680 }
+, { "custkey": 146i32, "orderkey": 1732i32, "len-comment": 2320 }
+, { "custkey": 148i32, "orderkey": 1733i32, "len-comment": 6000 }
+, { "custkey": 7i32, "orderkey": 1734i32, "len-comment": 5440 }
+, { "custkey": 22i32, "orderkey": 1735i32, "len-comment": 2080 }
+, { "custkey": 115i32, "orderkey": 1760i32, "len-comment": 6080 }
+, { "custkey": 106i32, "orderkey": 1761i32, "len-comment": 3280 }
+, { "custkey": 77i32, "orderkey": 1762i32, "len-comment": 1920 }
+, { "custkey": 121i32, "orderkey": 1763i32, "len-comment": 3600 }
+, { "custkey": 29i32, "orderkey": 1764i32, "len-comment": 3760 }
+, { "custkey": 73i32, "orderkey": 1765i32, "len-comment": 2160 }
+, { "custkey": 139i32, "orderkey": 1766i32, "len-comment": 4240 }
+, { "custkey": 25i32, "orderkey": 1767i32, "len-comment": 6240 }
+, { "custkey": 49i32, "orderkey": 1792i32, "len-comment": 4720 }
+, { "custkey": 19i32, "orderkey": 1793i32, "len-comment": 6000 }
+, { "custkey": 140i32, "orderkey": 1794i32, "len-comment": 3200 }
+, { "custkey": 94i32, "orderkey": 1795i32, "len-comment": 4080 }
+, { "custkey": 47i32, "orderkey": 1796i32, "len-comment": 2240 }
+, { "custkey": 125i32, "orderkey": 1797i32, "len-comment": 4560 }
+, { "custkey": 52i32, "orderkey": 1798i32, "len-comment": 1520 }
+, { "custkey": 61i32, "orderkey": 1799i32, "len-comment": 5120 }
+, { "custkey": 49i32, "orderkey": 1824i32, "len-comment": 1520 }
+, { "custkey": 148i32, "orderkey": 1825i32, "len-comment": 1520 }
+, { "custkey": 82i32, "orderkey": 1826i32, "len-comment": 5760 }
+, { "custkey": 106i32, "orderkey": 1827i32, "len-comment": 2560 }
+, { "custkey": 32i32, "orderkey": 1828i32, "len-comment": 1680 }
+, { "custkey": 112i32, "orderkey": 1829i32, "len-comment": 5440 }
+, { "custkey": 133i32, "orderkey": 1830i32, "len-comment": 1760 }
+, { "custkey": 71i32, "orderkey": 1831i32, "len-comment": 5920 }
+, { "custkey": 106i32, "orderkey": 1856i32, "len-comment": 2320 }
+, { "custkey": 133i32, "orderkey": 1857i32, "len-comment": 1680 }
+, { "custkey": 143i32, "orderkey": 1858i32, "len-comment": 2640 }
+, { "custkey": 61i32, "orderkey": 1859i32, "len-comment": 4720 }
+, { "custkey": 10i32, "orderkey": 1860i32, "len-comment": 3360 }
+, { "custkey": 70i32, "orderkey": 1861i32, "len-comment": 2960 }
+, { "custkey": 34i32, "orderkey": 1862i32, "len-comment": 2000 }
+, { "custkey": 74i32, "orderkey": 1863i32, "len-comment": 2000 }
+, { "custkey": 121i32, "orderkey": 1888i32, "len-comment": 5200 }
+, { "custkey": 25i32, "orderkey": 1889i32, "len-comment": 3760 }
+, { "custkey": 10i32, "orderkey": 1890i32, "len-comment": 3440 }
+, { "custkey": 61i32, "orderkey": 1891i32, "len-comment": 5040 }
+, { "custkey": 25i32, "orderkey": 1892i32, "len-comment": 4400 }
+, { "custkey": 125i32, "orderkey": 1893i32, "len-comment": 6160 }
+, { "custkey": 76i32, "orderkey": 1894i32, "len-comment": 6080 }
+, { "custkey": 7i32, "orderkey": 1895i32, "len-comment": 5760 }
+, { "custkey": 110i32, "orderkey": 1920i32, "len-comment": 2480 }
+, { "custkey": 88i32, "orderkey": 1921i32, "len-comment": 5680 }
+, { "custkey": 56i32, "orderkey": 1922i32, "len-comment": 2320 }
+, { "custkey": 136i32, "orderkey": 1923i32, "len-comment": 1520 }
+, { "custkey": 76i32, "orderkey": 1924i32, "len-comment": 4640 }
+, { "custkey": 17i32, "orderkey": 1925i32, "len-comment": 2880 }
+, { "custkey": 94i32, "orderkey": 1926i32, "len-comment": 3200 }
+, { "custkey": 140i32, "orderkey": 1927i32, "len-comment": 6080 }
+, { "custkey": 67i32, "orderkey": 1952i32, "len-comment": 1840 }
+, { "custkey": 149i32, "orderkey": 1953i32, "len-comment": 3440 }
+, { "custkey": 56i32, "orderkey": 1954i32, "len-comment": 5600 }
+, { "custkey": 13i32, "orderkey": 1955i32, "len-comment": 2720 }
+, { "custkey": 127i32, "orderkey": 1956i32, "len-comment": 5920 }
+, { "custkey": 31i32, "orderkey": 1957i32, "len-comment": 1920 }
+, { "custkey": 53i32, "orderkey": 1958i32, "len-comment": 1680 }
+, { "custkey": 43i32, "orderkey": 1959i32, "len-comment": 5200 }
+, { "custkey": 52i32, "orderkey": 1984i32, "len-comment": 6240 }
+, { "custkey": 7i32, "orderkey": 1985i32, "len-comment": 2640 }
+, { "custkey": 149i32, "orderkey": 1986i32, "len-comment": 2320 }
+, { "custkey": 100i32, "orderkey": 1987i32, "len-comment": 2080 }
+, { "custkey": 109i32, "orderkey": 1988i32, "len-comment": 4000 }
+, { "custkey": 118i32, "orderkey": 1989i32, "len-comment": 2621440 }
+, { "custkey": 119i32, "orderkey": 1990i32, "len-comment": 2320 }
+, { "custkey": 19i32, "orderkey": 1991i32, "len-comment": 5920 }
+, { "custkey": 8i32, "orderkey": 2016i32, "len-comment": 3840 }
+, { "custkey": 101i32, "orderkey": 2017i32, "len-comment": 1680 }
+, { "custkey": 19i32, "orderkey": 2018i32, "len-comment": 1840 }
+, { "custkey": 136i32, "orderkey": 2019i32, "len-comment": 2960 }
+, { "custkey": 73i32, "orderkey": 2020i32, "len-comment": 6080 }
+, { "custkey": 70i32, "orderkey": 2021i32, "len-comment": 5840 }
+, { "custkey": 62i32, "orderkey": 2022i32, "len-comment": 5280 }
+, { "custkey": 118i32, "orderkey": 2023i32, "len-comment": 2800 }
+, { "custkey": 17i32, "orderkey": 2048i32, "len-comment": 3600 }
+, { "custkey": 31i32, "orderkey": 2049i32, "len-comment": 5920 }
+, { "custkey": 28i32, "orderkey": 2050i32, "len-comment": 4560 }
+, { "custkey": 40i32, "orderkey": 2051i32, "len-comment": 2880 }
+, { "custkey": 91i32, "orderkey": 2052i32, "len-comment": 6240 }
+, { "custkey": 142i32, "orderkey": 2053i32, "len-comment": 4720 }
+, { "custkey": 41i32, "orderkey": 2054i32, "len-comment": 4320 }
+, { "custkey": 97i32, "orderkey": 2055i32, "len-comment": 4640 }
+, { "custkey": 95i32, "orderkey": 2080i32, "len-comment": 6240 }
+, { "custkey": 121i32, "orderkey": 2081i32, "len-comment": 1600 }
+, { "custkey": 49i32, "orderkey": 2082i32, "len-comment": 5760 }
+, { "custkey": 101i32, "orderkey": 2083i32, "len-comment": 5600 }
+, { "custkey": 80i32, "orderkey": 2084i32, "len-comment": 4880 }
+, { "custkey": 49i32, "orderkey": 2085i32, "len-comment": 2080 }
+, { "custkey": 142i32, "orderkey": 2086i32, "len-comment": 1600 }
+, { "custkey": 50i32, "orderkey": 2087i32, "len-comment": 4480 }
+, { "custkey": 64i32, "orderkey": 2112i32, "len-comment": 2000 }
+, { "custkey": 32i32, "orderkey": 2113i32, "len-comment": 1760 }
+, { "custkey": 79i32, "orderkey": 2114i32, "len-comment": 5120 }
+, { "custkey": 106i32, "orderkey": 2115i32, "len-comment": 5840 }
+, { "custkey": 23i32, "orderkey": 2116i32, "len-comment": 3280 }
+, { "custkey": 22i32, "orderkey": 2117i32, "len-comment": 4000 }
+, { "custkey": 134i32, "orderkey": 2118i32, "len-comment": 3760 }
+, { "custkey": 64i32, "orderkey": 2119i32, "len-comment": 2960 }
+, { "custkey": 136i32, "orderkey": 2144i32, "len-comment": 4560 }
+, { "custkey": 134i32, "orderkey": 2145i32, "len-comment": 3280 }
+, { "custkey": 118i32, "orderkey": 2146i32, "len-comment": 2880 }
+, { "custkey": 100i32, "orderkey": 2147i32, "len-comment": 6160 }
+, { "custkey": 130i32, "orderkey": 2148i32, "len-comment": 4160 }
+, { "custkey": 101i32, "orderkey": 2149i32, "len-comment": 3520 }
+, { "custkey": 82i32, "orderkey": 2150i32, "len-comment": 6240 }
+, { "custkey": 58i32, "orderkey": 2151i32, "len-comment": 5680 }
+, { "custkey": 104i32, "orderkey": 2176i32, "len-comment": 1920 }
+, { "custkey": 136i32, "orderkey": 2177i32, "len-comment": 6000 }
+, { "custkey": 8i32, "orderkey": 2178i32, "len-comment": 3520 }
+, { "custkey": 41i32, "orderkey": 2179i32, "len-comment": 4240 }
+, { "custkey": 76i32, "orderkey": 2180i32, "len-comment": 3520 }
+, { "custkey": 76i32, "orderkey": 2181i32, "len-comment": 2080 }
+, { "custkey": 23i32, "orderkey": 2182i32, "len-comment": 4160 }
+, { "custkey": 113i32, "orderkey": 2183i32, "len-comment": 5440 }
+, { "custkey": 68i32, "orderkey": 2208i32, "len-comment": 3760 }
+, { "custkey": 91i32, "orderkey": 2209i32, "len-comment": 3920 }
+, { "custkey": 32i32, "orderkey": 2210i32, "len-comment": 4320 }
+, { "custkey": 92i32, "orderkey": 2211i32, "len-comment": 1520 }
+, { "custkey": 118i32, "orderkey": 2212i32, "len-comment": 3600 }
+, { "custkey": 122i32, "orderkey": 2213i32, "len-comment": 1840 }
+, { "custkey": 115i32, "orderkey": 2214i32, "len-comment": 5760 }
+, { "custkey": 40i32, "orderkey": 2215i32, "len-comment": 5280 }
+, { "custkey": 56i32, "orderkey": 2240i32, "len-comment": 5520 }
+, { "custkey": 103i32, "orderkey": 2241i32, "len-comment": 5680 }
+, { "custkey": 82i32, "orderkey": 2242i32, "len-comment": 4880 }
+, { "custkey": 49i32, "orderkey": 2243i32, "len-comment": 2720 }
+, { "custkey": 127i32, "orderkey": 2244i32, "len-comment": 5200 }
+, { "custkey": 58i32, "orderkey": 2245i32, "len-comment": 3520 }
+, { "custkey": 113i32, "orderkey": 2246i32, "len-comment": 1520 }
+, { "custkey": 95i32, "orderkey": 2247i32, "len-comment": 3040 }
+, { "custkey": 139i32, "orderkey": 2272i32, "len-comment": 3920 }
+, { "custkey": 136i32, "orderkey": 2273i32, "len-comment": 3440 }
+, { "custkey": 104i32, "orderkey": 2274i32, "len-comment": 1760 }
+, { "custkey": 149i32, "orderkey": 2275i32, "len-comment": 3760 }
+, { "custkey": 43i32, "orderkey": 2276i32, "len-comment": 1520 }
+, { "custkey": 89i32, "orderkey": 2277i32, "len-comment": 1840 }
+, { "custkey": 142i32, "orderkey": 2278i32, "len-comment": 5040 }
+, { "custkey": 80i32, "orderkey": 2279i32, "len-comment": 2880 }
+, { "custkey": 46i32, "orderkey": 2304i32, "len-comment": 5920 }
+, { "custkey": 43i32, "orderkey": 2305i32, "len-comment": 2160 }
+, { "custkey": 28i32, "orderkey": 2306i32, "len-comment": 5600 }
+, { "custkey": 106i32, "orderkey": 2307i32, "len-comment": 4240 }
+, { "custkey": 25i32, "orderkey": 2308i32, "len-comment": 1600 }
+, { "custkey": 100i32, "orderkey": 2309i32, "len-comment": 5680 }
+, { "custkey": 31i32, "orderkey": 2310i32, "len-comment": 5040 }
+, { "custkey": 73i32, "orderkey": 2311i32, "len-comment": 3520 }
+, { "custkey": 142i32, "orderkey": 2336i32, "len-comment": 4960 }
+, { "custkey": 142i32, "orderkey": 2337i32, "len-comment": 4240 }
+, { "custkey": 140i32, "orderkey": 2338i32, "len-comment": 5520 }
+, { "custkey": 109i32, "orderkey": 2339i32, "len-comment": 1680 }
+, { "custkey": 65i32, "orderkey": 2340i32, "len-comment": 5920 }
+, { "custkey": 82i32, "orderkey": 2341i32, "len-comment": 6000 }
+, { "custkey": 37i32, "orderkey": 2342i32, "len-comment": 4800 }
+, { "custkey": 73i32, "orderkey": 2343i32, "len-comment": 3840 }
+, { "custkey": 13i32, "orderkey": 2368i32, "len-comment": 3440 }
+, { "custkey": 110i32, "orderkey": 2369i32, "len-comment": 3280 }
+, { "custkey": 142i32, "orderkey": 2370i32, "len-comment": 3920 }
+, { "custkey": 19i32, "orderkey": 2371i32, "len-comment": 1520 }
+, { "custkey": 31i32, "orderkey": 2372i32, "len-comment": 3920 }
+, { "custkey": 28i32, "orderkey": 2373i32, "len-comment": 3520 }
+, { "custkey": 4i32, "orderkey": 2374i32, "len-comment": 3440 }
+, { "custkey": 5i32, "orderkey": 2375i32, "len-comment": 3680 }
+, { "custkey": 37i32, "orderkey": 2400i32, "len-comment": 4400 }
+, { "custkey": 148i32, "orderkey": 2401i32, "len-comment": 2621440 }
+, { "custkey": 67i32, "orderkey": 2402i32, "len-comment": 2720 }
+, { "custkey": 55i32, "orderkey": 2403i32, "len-comment": 5920 }
+, { "custkey": 77i32, "orderkey": 2404i32, "len-comment": 5440 }
+, { "custkey": 73i32, "orderkey": 2405i32, "len-comment": 1680 }
+, { "custkey": 7i32, "orderkey": 2406i32, "len-comment": 2160 }
+, { "custkey": 55i32, "orderkey": 2407i32, "len-comment": 3760 }
+, { "custkey": 103i32, "orderkey": 2432i32, "len-comment": 2560 }
+, { "custkey": 31i32, "orderkey": 2433i32, "len-comment": 3680 }
+, { "custkey": 25i32, "orderkey": 2434i32, "len-comment": 4640 }
+, { "custkey": 73i32, "orderkey": 2435i32, "len-comment": 4720 }
+, { "custkey": 125i32, "orderkey": 2436i32, "len-comment": 6160 }
+, { "custkey": 85i32, "orderkey": 2437i32, "len-comment": 6080 }
+, { "custkey": 13i32, "orderkey": 2438i32, "len-comment": 3200 }
+, { "custkey": 55i32, "orderkey": 2439i32, "len-comment": 1680 }
+, { "custkey": 145i32, "orderkey": 2464i32, "len-comment": 4240 }
+, { "custkey": 34i32, "orderkey": 2465i32, "len-comment": 3920 }
+, { "custkey": 19i32, "orderkey": 2466i32, "len-comment": 6160 }
+, { "custkey": 35i32, "orderkey": 2467i32, "len-comment": 4400 }
+, { "custkey": 112i32, "orderkey": 2468i32, "len-comment": 5520 }
+, { "custkey": 124i32, "orderkey": 2469i32, "len-comment": 5040 }
+, { "custkey": 58i32, "orderkey": 2470i32, "len-comment": 2800 }
+, { "custkey": 89i32, "orderkey": 2471i32, "len-comment": 2400 }
+, { "custkey": 136i32, "orderkey": 2496i32, "len-comment": 3120 }
+, { "custkey": 47i32, "orderkey": 2497i32, "len-comment": 5120 }
+, { "custkey": 97i32, "orderkey": 2498i32, "len-comment": 2640 }
+, { "custkey": 121i32, "orderkey": 2499i32, "len-comment": 3200 }
+, { "custkey": 133i32, "orderkey": 2500i32, "len-comment": 5760 }
+, { "custkey": 67i32, "orderkey": 2501i32, "len-comment": 1920 }
+, { "custkey": 70i32, "orderkey": 2502i32, "len-comment": 3280 }
+, { "custkey": 7i32, "orderkey": 2503i32, "len-comment": 6080 }
+, { "custkey": 55i32, "orderkey": 2528i32, "len-comment": 4960 }
+, { "custkey": 136i32, "orderkey": 2529i32, "len-comment": 4720 }
+, { "custkey": 128i32, "orderkey": 2530i32, "len-comment": 2560 }
+, { "custkey": 44i32, "orderkey": 2531i32, "len-comment": 5680 }
+, { "custkey": 94i32, "orderkey": 2532i32, "len-comment": 5200 }
+, { "custkey": 50i32, "orderkey": 2533i32, "len-comment": 1920 }
+, { "custkey": 76i32, "orderkey": 2534i32, "len-comment": 4000 }
+, { "custkey": 121i32, "orderkey": 2535i32, "len-comment": 4400 }
+, { "custkey": 131i32, "orderkey": 2560i32, "len-comment": 2320 }
+, { "custkey": 58i32, "orderkey": 2561i32, "len-comment": 6080 }
+, { "custkey": 10i32, "orderkey": 2562i32, "len-comment": 3280 }
+, { "custkey": 62i32, "orderkey": 2563i32, "len-comment": 2640 }
+, { "custkey": 77i32, "orderkey": 2564i32, "len-comment": 4480 }
+, { "custkey": 56i32, "orderkey": 2565i32, "len-comment": 1600 }
+, { "custkey": 86i32, "orderkey": 2566i32, "len-comment": 5360 }
+, { "custkey": 70i32, "orderkey": 2567i32, "len-comment": 2640 }
+, { "custkey": 101i32, "orderkey": 2592i32, "len-comment": 3520 }
+, { "custkey": 92i32, "orderkey": 2593i32, "len-comment": 1680 }
+, { "custkey": 79i32, "orderkey": 2594i32, "len-comment": 5040 }
+, { "custkey": 74i32, "orderkey": 2595i32, "len-comment": 3680 }
+, { "custkey": 43i32, "orderkey": 2596i32, "len-comment": 3040 }
+, { "custkey": 104i32, "orderkey": 2597i32, "len-comment": 1520 }
+, { "custkey": 112i32, "orderkey": 2598i32, "len-comment": 5200 }
+, { "custkey": 149i32, "orderkey": 2599i32, "len-comment": 3040 }
+, { "custkey": 52i32, "orderkey": 2624i32, "len-comment": 1600 }
+, { "custkey": 40i32, "orderkey": 2625i32, "len-comment": 3120 }
+, { "custkey": 139i32, "orderkey": 2626i32, "len-comment": 6240 }
+, { "custkey": 149i32, "orderkey": 2627i32, "len-comment": 2240 }
+, { "custkey": 56i32, "orderkey": 2628i32, "len-comment": 5680 }
+, { "custkey": 139i32, "orderkey": 2629i32, "len-comment": 3840 }
+, { "custkey": 85i32, "orderkey": 2630i32, "len-comment": 3120 }
+, { "custkey": 37i32, "orderkey": 2631i32, "len-comment": 3120 }
+, { "custkey": 77i32, "orderkey": 2656i32, "len-comment": 1920 }
+, { "custkey": 25i32, "orderkey": 2657i32, "len-comment": 5040 }
+, { "custkey": 14i32, "orderkey": 2658i32, "len-comment": 3280 }
+, { "custkey": 83i32, "orderkey": 2659i32, "len-comment": 2880 }
+, { "custkey": 127i32, "orderkey": 2660i32, "len-comment": 4320 }
+, { "custkey": 74i32, "orderkey": 2661i32, "len-comment": 4960 }
+, { "custkey": 37i32, "orderkey": 2662i32, "len-comment": 6160 }
+, { "custkey": 95i32, "orderkey": 2663i32, "len-comment": 4800 }
+, { "custkey": 98i32, "orderkey": 2688i32, "len-comment": 4240 }
+, { "custkey": 103i32, "orderkey": 2689i32, "len-comment": 4480 }
+, { "custkey": 94i32, "orderkey": 2690i32, "len-comment": 1920 }
+, { "custkey": 7i32, "orderkey": 2691i32, "len-comment": 5280 }
+, { "custkey": 62i32, "orderkey": 2692i32, "len-comment": 2960 }
+, { "custkey": 19i32, "orderkey": 2693i32, "len-comment": 5920 }
+, { "custkey": 121i32, "orderkey": 2694i32, "len-comment": 3360 }
+, { "custkey": 58i32, "orderkey": 2695i32, "len-comment": 3600 }
+, { "custkey": 31i32, "orderkey": 2720i32, "len-comment": 3680 }
+, { "custkey": 79i32, "orderkey": 2721i32, "len-comment": 4560 }
+, { "custkey": 35i32, "orderkey": 2722i32, "len-comment": 3360 }
+, { "custkey": 61i32, "orderkey": 2723i32, "len-comment": 1680 }
+, { "custkey": 137i32, "orderkey": 2724i32, "len-comment": 2480 }
+, { "custkey": 89i32, "orderkey": 2725i32, "len-comment": 1520 }
+, { "custkey": 7i32, "orderkey": 2726i32, "len-comment": 2480 }
+, { "custkey": 74i32, "orderkey": 2727i32, "len-comment": 4640 }
+, { "custkey": 59i32, "orderkey": 2752i32, "len-comment": 3440 }
+, { "custkey": 16i32, "orderkey": 2753i32, "len-comment": 2960 }
+, { "custkey": 145i32, "orderkey": 2754i32, "len-comment": 1520 }
+, { "custkey": 118i32, "orderkey": 2755i32, "len-comment": 4880 }
+, { "custkey": 118i32, "orderkey": 2756i32, "len-comment": 1760 }
+, { "custkey": 76i32, "orderkey": 2757i32, "len-comment": 1760 }
+, { "custkey": 43i32, "orderkey": 2758i32, "len-comment": 3520 }
+, { "custkey": 116i32, "orderkey": 2759i32, "len-comment": 3280 }
+, { "custkey": 95i32, "orderkey": 2784i32, "len-comment": 3600 }
+, { "custkey": 148i32, "orderkey": 2785i32, "len-comment": 5440 }
+, { "custkey": 79i32, "orderkey": 2786i32, "len-comment": 4400 }
+, { "custkey": 103i32, "orderkey": 2787i32, "len-comment": 1520 }
+, { "custkey": 124i32, "orderkey": 2788i32, "len-comment": 3200 }
+, { "custkey": 37i32, "orderkey": 2789i32, "len-comment": 2621440 }
+, { "custkey": 25i32, "orderkey": 2790i32, "len-comment": 3520 }
+, { "custkey": 121i32, "orderkey": 2791i32, "len-comment": 3440 }
+, { "custkey": 58i32, "orderkey": 2816i32, "len-comment": 4640 }
+, { "custkey": 40i32, "orderkey": 2817i32, "len-comment": 4560 }
+, { "custkey": 49i32, "orderkey": 2818i32, "len-comment": 2960 }
+, { "custkey": 103i32, "orderkey": 2819i32, "len-comment": 3600 }
+, { "custkey": 19i32, "orderkey": 2820i32, "len-comment": 2320 }
+, { "custkey": 118i32, "orderkey": 2821i32, "len-comment": 5440 }
+, { "custkey": 79i32, "orderkey": 2822i32, "len-comment": 4160 }
+, { "custkey": 79i32, "orderkey": 2823i32, "len-comment": 2800 }
+, { "custkey": 70i32, "orderkey": 2848i32, "len-comment": 4240 }
+, { "custkey": 46i32, "orderkey": 2849i32, "len-comment": 5360 }
+, { "custkey": 100i32, "orderkey": 2850i32, "len-comment": 6000 }
+, { "custkey": 145i32, "orderkey": 2851i32, "len-comment": 2720 }
+, { "custkey": 91i32, "orderkey": 2852i32, "len-comment": 5040 }
+, { "custkey": 94i32, "orderkey": 2853i32, "len-comment": 2240 }
+, { "custkey": 139i32, "orderkey": 2854i32, "len-comment": 3120 }
+, { "custkey": 49i32, "orderkey": 2855i32, "len-comment": 2560 }
+, { "custkey": 8i32, "orderkey": 2880i32, "len-comment": 2080 }
+, { "custkey": 100i32, "orderkey": 2881i32, "len-comment": 4800 }
+, { "custkey": 121i32, "orderkey": 2882i32, "len-comment": 2480 }
+, { "custkey": 121i32, "orderkey": 2883i32, "len-comment": 3520 }
+, { "custkey": 92i32, "orderkey": 2884i32, "len-comment": 3280 }
+, { "custkey": 7i32, "orderkey": 2885i32, "len-comment": 3920 }
+, { "custkey": 109i32, "orderkey": 2886i32, "len-comment": 2240 }
+, { "custkey": 109i32, "orderkey": 2887i32, "len-comment": 5360 }
+, { "custkey": 94i32, "orderkey": 2912i32, "len-comment": 6240 }
+, { "custkey": 43i32, "orderkey": 2913i32, "len-comment": 2720 }
+, { "custkey": 109i32, "orderkey": 2914i32, "len-comment": 3760 }
+, { "custkey": 94i32, "orderkey": 2915i32, "len-comment": 5360 }
+, { "custkey": 8i32, "orderkey": 2916i32, "len-comment": 3120 }
+, { "custkey": 91i32, "orderkey": 2917i32, "len-comment": 3280 }
+, { "custkey": 118i32, "orderkey": 2918i32, "len-comment": 1840 }
+, { "custkey": 53i32, "orderkey": 2919i32, "len-comment": 4080 }
+, { "custkey": 14i32, "orderkey": 2944i32, "len-comment": 4080 }
+, { "custkey": 29i32, "orderkey": 2945i32, "len-comment": 4960 }
+, { "custkey": 125i32, "orderkey": 2946i32, "len-comment": 5680 }
+, { "custkey": 70i32, "orderkey": 2947i32, "len-comment": 3200 }
+, { "custkey": 44i32, "orderkey": 2948i32, "len-comment": 3520 }
+, { "custkey": 137i32, "orderkey": 2949i32, "len-comment": 3440 }
+, { "custkey": 136i32, "orderkey": 2950i32, "len-comment": 2480 }
+, { "custkey": 74i32, "orderkey": 2951i32, "len-comment": 5680 }
+, { "custkey": 29i32, "orderkey": 2976i32, "len-comment": 5280 }
+, { "custkey": 73i32, "orderkey": 2977i32, "len-comment": 2800 }
+, { "custkey": 44i32, "orderkey": 2978i32, "len-comment": 4560 }
+, { "custkey": 133i32, "orderkey": 2979i32, "len-comment": 2400 }
+, { "custkey": 4i32, "orderkey": 2980i32, "len-comment": 2720 }
+, { "custkey": 49i32, "orderkey": 2981i32, "len-comment": 6080 }
+, { "custkey": 85i32, "orderkey": 2982i32, "len-comment": 4720 }
+, { "custkey": 62i32, "orderkey": 2983i32, "len-comment": 4480 }
+, { "custkey": 40i32, "orderkey": 3008i32, "len-comment": 5600 }
+, { "custkey": 55i32, "orderkey": 3009i32, "len-comment": 1680 }
+, { "custkey": 8i32, "orderkey": 3010i32, "len-comment": 4080 }
+, { "custkey": 91i32, "orderkey": 3011i32, "len-comment": 5040 }
+, { "custkey": 32i32, "orderkey": 3012i32, "len-comment": 4080 }
+, { "custkey": 143i32, "orderkey": 3013i32, "len-comment": 1600 }
+, { "custkey": 29i32, "orderkey": 3014i32, "len-comment": 2720 }
+, { "custkey": 103i32, "orderkey": 3015i32, "len-comment": 3840 }
+, { "custkey": 112i32, "orderkey": 3040i32, "len-comment": 2720 }
+, { "custkey": 113i32, "orderkey": 3041i32, "len-comment": 4480 }
+, { "custkey": 20i32, "orderkey": 3042i32, "len-comment": 1760 }
+, { "custkey": 44i32, "orderkey": 3043i32, "len-comment": 2400 }
+, { "custkey": 53i32, "orderkey": 3044i32, "len-comment": 5040 }
+, { "custkey": 50i32, "orderkey": 3045i32, "len-comment": 4000 }
+, { "custkey": 32i32, "orderkey": 3046i32, "len-comment": 2400 }
+, { "custkey": 25i32, "orderkey": 3047i32, "len-comment": 4480 }
+, { "custkey": 23i32, "orderkey": 3072i32, "len-comment": 3760 }
+, { "custkey": 136i32, "orderkey": 3073i32, "len-comment": 5760 }
+, { "custkey": 67i32, "orderkey": 3074i32, "len-comment": 5040 }
+, { "custkey": 127i32, "orderkey": 3075i32, "len-comment": 2640 }
+, { "custkey": 92i32, "orderkey": 3076i32, "len-comment": 4400 }
+, { "custkey": 121i32, "orderkey": 3077i32, "len-comment": 2960 }
+, { "custkey": 49i32, "orderkey": 3078i32, "len-comment": 2560 }
+, { "custkey": 100i32, "orderkey": 3079i32, "len-comment": 1520 }
+, { "custkey": 70i32, "orderkey": 3104i32, "len-comment": 3280 }
+, { "custkey": 137i32, "orderkey": 3105i32, "len-comment": 1680 }
+, { "custkey": 145i32, "orderkey": 3106i32, "len-comment": 4960 }
+, { "custkey": 26i32, "orderkey": 3107i32, "len-comment": 1840 }
+, { "custkey": 85i32, "orderkey": 3108i32, "len-comment": 2400 }
+, { "custkey": 124i32, "orderkey": 3109i32, "len-comment": 4480 }
+, { "custkey": 88i32, "orderkey": 3110i32, "len-comment": 4960 }
+, { "custkey": 133i32, "orderkey": 3111i32, "len-comment": 6080 }
+, { "custkey": 23i32, "orderkey": 3136i32, "len-comment": 2640 }
+, { "custkey": 136i32, "orderkey": 3137i32, "len-comment": 2480 }
+, { "custkey": 139i32, "orderkey": 3138i32, "len-comment": 5840 }
+, { "custkey": 17i32, "orderkey": 3139i32, "len-comment": 3600 }
+, { "custkey": 145i32, "orderkey": 3140i32, "len-comment": 3680 }
+, { "custkey": 26i32, "orderkey": 3141i32, "len-comment": 4720 }
+, { "custkey": 8i32, "orderkey": 3142i32, "len-comment": 6160 }
+, { "custkey": 107i32, "orderkey": 3143i32, "len-comment": 2880 }
+, { "custkey": 136i32, "orderkey": 3168i32, "len-comment": 5360 }
+, { "custkey": 19i32, "orderkey": 3169i32, "len-comment": 4320 }
+, { "custkey": 5i32, "orderkey": 3170i32, "len-comment": 1920 }
+, { "custkey": 47i32, "orderkey": 3171i32, "len-comment": 1520 }
+, { "custkey": 89i32, "orderkey": 3172i32, "len-comment": 2400 }
+, { "custkey": 148i32, "orderkey": 3173i32, "len-comment": 2000 }
+, { "custkey": 127i32, "orderkey": 3174i32, "len-comment": 5760 }
+, { "custkey": 44i32, "orderkey": 3175i32, "len-comment": 5040 }
+, { "custkey": 13i32, "orderkey": 3200i32, "len-comment": 4800 }
+, { "custkey": 97i32, "orderkey": 3201i32, "len-comment": 2621440 }
+, { "custkey": 88i32, "orderkey": 3202i32, "len-comment": 4080 }
+, { "custkey": 127i32, "orderkey": 3203i32, "len-comment": 4800 }
+, { "custkey": 10i32, "orderkey": 3204i32, "len-comment": 3760 }
+, { "custkey": 148i32, "orderkey": 3205i32, "len-comment": 4720 }
+, { "custkey": 122i32, "orderkey": 3206i32, "len-comment": 2720 }
+, { "custkey": 22i32, "orderkey": 3207i32, "len-comment": 2320 }
+, { "custkey": 82i32, "orderkey": 3232i32, "len-comment": 2800 }
+, { "custkey": 140i32, "orderkey": 3233i32, "len-comment": 6000 }
+, { "custkey": 14i32, "orderkey": 3234i32, "len-comment": 5680 }
+, { "custkey": 46i32, "orderkey": 3235i32, "len-comment": 2160 }
+, { "custkey": 142i32, "orderkey": 3236i32, "len-comment": 1920 }
+, { "custkey": 19i32, "orderkey": 3237i32, "len-comment": 4960 }
+, { "custkey": 61i32, "orderkey": 3238i32, "len-comment": 6160 }
+, { "custkey": 35i32, "orderkey": 3239i32, "len-comment": 4480 }
+, { "custkey": 94i32, "orderkey": 3264i32, "len-comment": 1920 }
+, { "custkey": 53i32, "orderkey": 3265i32, "len-comment": 1680 }
+, { "custkey": 4i32, "orderkey": 3266i32, "len-comment": 3440 }
+, { "custkey": 112i32, "orderkey": 3267i32, "len-comment": 5200 }
+, { "custkey": 142i32, "orderkey": 3268i32, "len-comment": 3360 }
+, { "custkey": 17i32, "orderkey": 3269i32, "len-comment": 5840 }
+, { "custkey": 38i32, "orderkey": 3270i32, "len-comment": 1920 }
+, { "custkey": 34i32, "orderkey": 3271i32, "len-comment": 2320 }
+, { "custkey": 148i32, "orderkey": 3296i32, "len-comment": 3920 }
+, { "custkey": 139i32, "orderkey": 3297i32, "len-comment": 5120 }
+, { "custkey": 116i32, "orderkey": 3298i32, "len-comment": 1600 }
+, { "custkey": 91i32, "orderkey": 3299i32, "len-comment": 3680 }
+, { "custkey": 118i32, "orderkey": 3300i32, "len-comment": 5840 }
+, { "custkey": 133i32, "orderkey": 3301i32, "len-comment": 5920 }
+, { "custkey": 34i32, "orderkey": 3302i32, "len-comment": 4960 }
+, { "custkey": 145i32, "orderkey": 3303i32, "len-comment": 4240 }
+, { "custkey": 7i32, "orderkey": 3328i32, "len-comment": 5680 }
+, { "custkey": 4i32, "orderkey": 3329i32, "len-comment": 3680 }
+, { "custkey": 7i32, "orderkey": 3330i32, "len-comment": 4880 }
+, { "custkey": 91i32, "orderkey": 3331i32, "len-comment": 3440 }
+, { "custkey": 143i32, "orderkey": 3332i32, "len-comment": 4880 }
+, { "custkey": 92i32, "orderkey": 3333i32, "len-comment": 4480 }
+, { "custkey": 76i32, "orderkey": 3334i32, "len-comment": 3920 }
+, { "custkey": 49i32, "orderkey": 3335i32, "len-comment": 4400 }
+, { "custkey": 103i32, "orderkey": 3360i32, "len-comment": 4080 }
+, { "custkey": 49i32, "orderkey": 3361i32, "len-comment": 3760 }
+, { "custkey": 140i32, "orderkey": 3362i32, "len-comment": 3200 }
+, { "custkey": 52i32, "orderkey": 3363i32, "len-comment": 4720 }
+, { "custkey": 46i32, "orderkey": 3364i32, "len-comment": 2160 }
+, { "custkey": 82i32, "orderkey": 3365i32, "len-comment": 4480 }
+, { "custkey": 52i32, "orderkey": 3366i32, "len-comment": 2880 }
+, { "custkey": 73i32, "orderkey": 3367i32, "len-comment": 4160 }
+, { "custkey": 74i32, "orderkey": 3392i32, "len-comment": 4000 }
+, { "custkey": 98i32, "orderkey": 3393i32, "len-comment": 4080 }
+, { "custkey": 149i32, "orderkey": 3394i32, "len-comment": 5280 }
+, { "custkey": 149i32, "orderkey": 3395i32, "len-comment": 2080 }
+, { "custkey": 149i32, "orderkey": 3396i32, "len-comment": 1840 }
+, { "custkey": 130i32, "orderkey": 3397i32, "len-comment": 2080 }
+, { "custkey": 67i32, "orderkey": 3398i32, "len-comment": 4640 }
+, { "custkey": 122i32, "orderkey": 3399i32, "len-comment": 4720 }
+, { "custkey": 103i32, "orderkey": 3424i32, "len-comment": 5520 }
+, { "custkey": 115i32, "orderkey": 3425i32, "len-comment": 4480 }
+, { "custkey": 53i32, "orderkey": 3426i32, "len-comment": 1760 }
+, { "custkey": 4i32, "orderkey": 3427i32, "len-comment": 3920 }
+, { "custkey": 10i32, "orderkey": 3428i32, "len-comment": 3280 }
+, { "custkey": 146i32, "orderkey": 3429i32, "len-comment": 6160 }
+, { "custkey": 113i32, "orderkey": 3430i32, "len-comment": 6080 }
+, { "custkey": 47i32, "orderkey": 3431i32, "len-comment": 2320 }
+, { "custkey": 46i32, "orderkey": 3456i32, "len-comment": 2160 }
+, { "custkey": 25i32, "orderkey": 3457i32, "len-comment": 3600 }
+, { "custkey": 95i32, "orderkey": 3458i32, "len-comment": 2000 }
+, { "custkey": 119i32, "orderkey": 3459i32, "len-comment": 5520 }
+, { "custkey": 82i32, "orderkey": 3460i32, "len-comment": 1600 }
+, { "custkey": 100i32, "orderkey": 3461i32, "len-comment": 5920 }
+, { "custkey": 133i32, "orderkey": 3462i32, "len-comment": 1920 }
+, { "custkey": 89i32, "orderkey": 3463i32, "len-comment": 2960 }
+, { "custkey": 148i32, "orderkey": 3488i32, "len-comment": 3600 }
+, { "custkey": 109i32, "orderkey": 3489i32, "len-comment": 3920 }
+, { "custkey": 91i32, "orderkey": 3490i32, "len-comment": 5920 }
+, { "custkey": 83i32, "orderkey": 3491i32, "len-comment": 3200 }
+, { "custkey": 103i32, "orderkey": 3492i32, "len-comment": 4400 }
+, { "custkey": 82i32, "orderkey": 3493i32, "len-comment": 4720 }
+, { "custkey": 49i32, "orderkey": 3494i32, "len-comment": 5760 }
+, { "custkey": 31i32, "orderkey": 3495i32, "len-comment": 2320 }
+, { "custkey": 125i32, "orderkey": 3520i32, "len-comment": 2400 }
+, { "custkey": 7i32, "orderkey": 3521i32, "len-comment": 4000 }
+, { "custkey": 26i32, "orderkey": 3522i32, "len-comment": 3680 }
+, { "custkey": 149i32, "orderkey": 3523i32, "len-comment": 2400 }
+, { "custkey": 94i32, "orderkey": 3524i32, "len-comment": 6160 }
+, { "custkey": 109i32, "orderkey": 3525i32, "len-comment": 2080 }
+, { "custkey": 56i32, "orderkey": 3526i32, "len-comment": 3360 }
+, { "custkey": 56i32, "orderkey": 3527i32, "len-comment": 3520 }
+, { "custkey": 35i32, "orderkey": 3552i32, "len-comment": 2560 }
+, { "custkey": 91i32, "orderkey": 3553i32, "len-comment": 2400 }
+, { "custkey": 44i32, "orderkey": 3554i32, "len-comment": 2080 }
+, { "custkey": 46i32, "orderkey": 3555i32, "len-comment": 3040 }
+, { "custkey": 16i32, "orderkey": 3556i32, "len-comment": 2960 }
+, { "custkey": 121i32, "orderkey": 3557i32, "len-comment": 1520 }
+, { "custkey": 28i32, "orderkey": 3558i32, "len-comment": 3360 }
+, { "custkey": 106i32, "orderkey": 3559i32, "len-comment": 3920 }
+, { "custkey": 13i32, "orderkey": 3584i32, "len-comment": 6000 }
+, { "custkey": 139i32, "orderkey": 3585i32, "len-comment": 5360 }
+, { "custkey": 121i32, "orderkey": 3586i32, "len-comment": 4960 }
+, { "custkey": 79i32, "orderkey": 3587i32, "len-comment": 1680 }
+, { "custkey": 119i32, "orderkey": 3588i32, "len-comment": 2400 }
+, { "custkey": 31i32, "orderkey": 3589i32, "len-comment": 2621440 }
+, { "custkey": 149i32, "orderkey": 3590i32, "len-comment": 1600 }
+, { "custkey": 136i32, "orderkey": 3591i32, "len-comment": 2640 }
+, { "custkey": 128i32, "orderkey": 3616i32, "len-comment": 6080 }
+, { "custkey": 40i32, "orderkey": 3617i32, "len-comment": 2720 }
+, { "custkey": 10i32, "orderkey": 3618i32, "len-comment": 2960 }
+, { "custkey": 149i32, "orderkey": 3619i32, "len-comment": 4960 }
+, { "custkey": 44i32, "orderkey": 3620i32, "len-comment": 5600 }
+, { "custkey": 142i32, "orderkey": 3621i32, "len-comment": 1920 }
+, { "custkey": 91i32, "orderkey": 3622i32, "len-comment": 4240 }
+, { "custkey": 4i32, "orderkey": 3623i32, "len-comment": 3200 }
+, { "custkey": 125i32, "orderkey": 3648i32, "len-comment": 5760 }
+, { "custkey": 40i32, "orderkey": 3649i32, "len-comment": 2320 }
+, { "custkey": 46i32, "orderkey": 3650i32, "len-comment": 2080 }
+, { "custkey": 100i32, "orderkey": 3651i32, "len-comment": 4080 }
+, { "custkey": 107i32, "orderkey": 3652i32, "len-comment": 2240 }
+, { "custkey": 40i32, "orderkey": 3653i32, "len-comment": 3520 }
+, { "custkey": 7i32, "orderkey": 3654i32, "len-comment": 5200 }
+, { "custkey": 49i32, "orderkey": 3655i32, "len-comment": 4800 }
+, { "custkey": 127i32, "orderkey": 3680i32, "len-comment": 4880 }
+, { "custkey": 52i32, "orderkey": 3681i32, "len-comment": 5440 }
+, { "custkey": 32i32, "orderkey": 3682i32, "len-comment": 2560 }
+, { "custkey": 88i32, "orderkey": 3683i32, "len-comment": 4080 }
+, { "custkey": 23i32, "orderkey": 3684i32, "len-comment": 4080 }
+, { "custkey": 16i32, "orderkey": 3685i32, "len-comment": 2160 }
+, { "custkey": 40i32, "orderkey": 3686i32, "len-comment": 4240 }
+, { "custkey": 43i32, "orderkey": 3687i32, "len-comment": 4800 }
+, { "custkey": 64i32, "orderkey": 3712i32, "len-comment": 1520 }
+, { "custkey": 149i32, "orderkey": 3713i32, "len-comment": 3200 }
+, { "custkey": 40i32, "orderkey": 3714i32, "len-comment": 5040 }
+, { "custkey": 65i32, "orderkey": 3715i32, "len-comment": 5520 }
+, { "custkey": 43i32, "orderkey": 3716i32, "len-comment": 2400 }
+, { "custkey": 28i32, "orderkey": 3717i32, "len-comment": 2640 }
+, { "custkey": 31i32, "orderkey": 3718i32, "len-comment": 6240 }
+, { "custkey": 118i32, "orderkey": 3719i32, "len-comment": 6160 }
+, { "custkey": 65i32, "orderkey": 3744i32, "len-comment": 5120 }
+, { "custkey": 112i32, "orderkey": 3745i32, "len-comment": 4800 }
+, { "custkey": 74i32, "orderkey": 3746i32, "len-comment": 2880 }
+, { "custkey": 149i32, "orderkey": 3747i32, "len-comment": 5360 }
+, { "custkey": 53i32, "orderkey": 3748i32, "len-comment": 1760 }
+, { "custkey": 38i32, "orderkey": 3749i32, "len-comment": 2960 }
+, { "custkey": 97i32, "orderkey": 3750i32, "len-comment": 3520 }
+, { "custkey": 10i32, "orderkey": 3751i32, "len-comment": 2160 }
+, { "custkey": 85i32, "orderkey": 3776i32, "len-comment": 2080 }
+, { "custkey": 28i32, "orderkey": 3777i32, "len-comment": 3760 }
+, { "custkey": 106i32, "orderkey": 3778i32, "len-comment": 5440 }
+, { "custkey": 74i32, "orderkey": 3779i32, "len-comment": 5360 }
+, { "custkey": 41i32, "orderkey": 3780i32, "len-comment": 2000 }
+, { "custkey": 139i32, "orderkey": 3781i32, "len-comment": 6240 }
+, { "custkey": 65i32, "orderkey": 3782i32, "len-comment": 2640 }
+, { "custkey": 44i32, "orderkey": 3783i32, "len-comment": 4640 }
+, { "custkey": 79i32, "orderkey": 3808i32, "len-comment": 2400 }
+, { "custkey": 148i32, "orderkey": 3809i32, "len-comment": 4960 }
+, { "custkey": 100i32, "orderkey": 3810i32, "len-comment": 3040 }
+, { "custkey": 80i32, "orderkey": 3811i32, "len-comment": 1520 }
+, { "custkey": 41i32, "orderkey": 3812i32, "len-comment": 2000 }
+, { "custkey": 146i32, "orderkey": 3813i32, "len-comment": 2880 }
+, { "custkey": 118i32, "orderkey": 3814i32, "len-comment": 2320 }
+, { "custkey": 104i32, "orderkey": 3815i32, "len-comment": 2160 }
+, { "custkey": 100i32, "orderkey": 3840i32, "len-comment": 2640 }
+, { "custkey": 58i32, "orderkey": 3841i32, "len-comment": 6160 }
+, { "custkey": 28i32, "orderkey": 3842i32, "len-comment": 6240 }
+, { "custkey": 10i32, "orderkey": 3843i32, "len-comment": 3600 }
+, { "custkey": 79i32, "orderkey": 3844i32, "len-comment": 3120 }
+, { "custkey": 89i32, "orderkey": 3845i32, "len-comment": 5600 }
+, { "custkey": 49i32, "orderkey": 3846i32, "len-comment": 1840 }
+, { "custkey": 34i32, "orderkey": 3847i32, "len-comment": 2880 }
+, { "custkey": 134i32, "orderkey": 3872i32, "len-comment": 4800 }
+, { "custkey": 55i32, "orderkey": 3873i32, "len-comment": 2400 }
+, { "custkey": 119i32, "orderkey": 3874i32, "len-comment": 4160 }
+, { "custkey": 118i32, "orderkey": 3875i32, "len-comment": 2480 }
+, { "custkey": 29i32, "orderkey": 3876i32, "len-comment": 1600 }
+, { "custkey": 17i32, "orderkey": 3877i32, "len-comment": 2000 }
+, { "custkey": 88i32, "orderkey": 3878i32, "len-comment": 5200 }
+, { "custkey": 142i32, "orderkey": 3879i32, "len-comment": 5680 }
+, { "custkey": 149i32, "orderkey": 3904i32, "len-comment": 4560 }
+, { "custkey": 22i32, "orderkey": 3905i32, "len-comment": 4560 }
+, { "custkey": 46i32, "orderkey": 3906i32, "len-comment": 4240 }
+, { "custkey": 67i32, "orderkey": 3907i32, "len-comment": 2000 }
+, { "custkey": 43i32, "orderkey": 3908i32, "len-comment": 1840 }
+, { "custkey": 22i32, "orderkey": 3909i32, "len-comment": 4160 }
+, { "custkey": 64i32, "orderkey": 3910i32, "len-comment": 2320 }
+, { "custkey": 10i32, "orderkey": 3911i32, "len-comment": 5040 }
+, { "custkey": 32i32, "orderkey": 3936i32, "len-comment": 3280 }
+, { "custkey": 94i32, "orderkey": 3937i32, "len-comment": 2640 }
+, { "custkey": 31i32, "orderkey": 3938i32, "len-comment": 2320 }
+, { "custkey": 70i32, "orderkey": 3939i32, "len-comment": 6000 }
+, { "custkey": 149i32, "orderkey": 3940i32, "len-comment": 5280 }
+, { "custkey": 136i32, "orderkey": 3941i32, "len-comment": 2880 }
+, { "custkey": 76i32, "orderkey": 3942i32, "len-comment": 4080 }
+, { "custkey": 40i32, "orderkey": 3943i32, "len-comment": 6000 }
+, { "custkey": 25i32, "orderkey": 3968i32, "len-comment": 2320 }
+, { "custkey": 52i32, "orderkey": 3969i32, "len-comment": 2560 }
+, { "custkey": 76i32, "orderkey": 3970i32, "len-comment": 6160 }
+, { "custkey": 104i32, "orderkey": 3971i32, "len-comment": 3440 }
+, { "custkey": 124i32, "orderkey": 3972i32, "len-comment": 4480 }
+, { "custkey": 103i32, "orderkey": 3973i32, "len-comment": 4480 }
+, { "custkey": 94i32, "orderkey": 3974i32, "len-comment": 2960 }
+, { "custkey": 118i32, "orderkey": 3975i32, "len-comment": 4080 }
+, { "custkey": 70i32, "orderkey": 4000i32, "len-comment": 5760 }
+, { "custkey": 115i32, "orderkey": 4001i32, "len-comment": 2621440 }
+, { "custkey": 104i32, "orderkey": 4002i32, "len-comment": 4080 }
+, { "custkey": 112i32, "orderkey": 4003i32, "len-comment": 4720 }
+, { "custkey": 70i32, "orderkey": 4004i32, "len-comment": 3760 }
+, { "custkey": 140i32, "orderkey": 4005i32, "len-comment": 2480 }
+, { "custkey": 35i32, "orderkey": 4006i32, "len-comment": 4800 }
+, { "custkey": 8i32, "orderkey": 4007i32, "len-comment": 3920 }
+, { "custkey": 10i32, "orderkey": 4032i32, "len-comment": 4000 }
+, { "custkey": 83i32, "orderkey": 4033i32, "len-comment": 4400 }
+, { "custkey": 94i32, "orderkey": 4034i32, "len-comment": 6080 }
+, { "custkey": 118i32, "orderkey": 4035i32, "len-comment": 2400 }
+, { "custkey": 47i32, "orderkey": 4036i32, "len-comment": 5200 }
+, { "custkey": 121i32, "orderkey": 4037i32, "len-comment": 2640 }
+, { "custkey": 94i32, "orderkey": 4038i32, "len-comment": 5600 }
+, { "custkey": 29i32, "orderkey": 4039i32, "len-comment": 2640 }
+, { "custkey": 130i32, "orderkey": 4064i32, "len-comment": 4720 }
+, { "custkey": 80i32, "orderkey": 4065i32, "len-comment": 2960 }
+, { "custkey": 32i32, "orderkey": 4066i32, "len-comment": 4960 }
+, { "custkey": 16i32, "orderkey": 4067i32, "len-comment": 5840 }
+, { "custkey": 125i32, "orderkey": 4068i32, "len-comment": 5440 }
+, { "custkey": 73i32, "orderkey": 4069i32, "len-comment": 3680 }
+, { "custkey": 29i32, "orderkey": 4070i32, "len-comment": 1680 }
+, { "custkey": 148i32, "orderkey": 4071i32, "len-comment": 2560 }
+, { "custkey": 139i32, "orderkey": 4096i32, "len-comment": 3120 }
+, { "custkey": 10i32, "orderkey": 4097i32, "len-comment": 5760 }
+, { "custkey": 23i32, "orderkey": 4098i32, "len-comment": 5360 }
+, { "custkey": 17i32, "orderkey": 4099i32, "len-comment": 5120 }
+, { "custkey": 4i32, "orderkey": 4100i32, "len-comment": 5440 }
+, { "custkey": 142i32, "orderkey": 4101i32, "len-comment": 5760 }
+, { "custkey": 22i32, "orderkey": 4102i32, "len-comment": 3280 }
+, { "custkey": 106i32, "orderkey": 4103i32, "len-comment": 2080 }
+, { "custkey": 139i32, "orderkey": 4128i32, "len-comment": 5200 }
+, { "custkey": 32i32, "orderkey": 4129i32, "len-comment": 4400 }
+, { "custkey": 104i32, "orderkey": 4130i32, "len-comment": 4240 }
+, { "custkey": 44i32, "orderkey": 4131i32, "len-comment": 1760 }
+, { "custkey": 19i32, "orderkey": 4132i32, "len-comment": 5840 }
+, { "custkey": 101i32, "orderkey": 4133i32, "len-comment": 5120 }
+, { "custkey": 97i32, "orderkey": 4134i32, "len-comment": 2480 }
+, { "custkey": 37i32, "orderkey": 4135i32, "len-comment": 3760 }
+, { "custkey": 55i32, "orderkey": 4160i32, "len-comment": 5120 }
+, { "custkey": 118i32, "orderkey": 4161i32, "len-comment": 4720 }
+, { "custkey": 22i32, "orderkey": 4162i32, "len-comment": 5920 }
+, { "custkey": 64i32, "orderkey": 4163i32, "len-comment": 3360 }
+, { "custkey": 94i32, "orderkey": 4164i32, "len-comment": 6160 }
+, { "custkey": 4i32, "orderkey": 4165i32, "len-comment": 5120 }
+, { "custkey": 43i32, "orderkey": 4166i32, "len-comment": 5440 }
+, { "custkey": 28i32, "orderkey": 4167i32, "len-comment": 2560 }
+, { "custkey": 146i32, "orderkey": 4192i32, "len-comment": 3840 }
+, { "custkey": 4i32, "orderkey": 4193i32, "len-comment": 4880 }
+, { "custkey": 106i32, "orderkey": 4194i32, "len-comment": 6240 }
+, { "custkey": 104i32, "orderkey": 4195i32, "len-comment": 5680 }
+, { "custkey": 106i32, "orderkey": 4196i32, "len-comment": 3200 }
+, { "custkey": 92i32, "orderkey": 4197i32, "len-comment": 1760 }
+, { "custkey": 143i32, "orderkey": 4198i32, "len-comment": 2640 }
+, { "custkey": 5i32, "orderkey": 4199i32, "len-comment": 5520 }
+, { "custkey": 70i32, "orderkey": 4224i32, "len-comment": 5680 }
+, { "custkey": 128i32, "orderkey": 4225i32, "len-comment": 5200 }
+, { "custkey": 92i32, "orderkey": 4226i32, "len-comment": 4480 }
+, { "custkey": 133i32, "orderkey": 4227i32, "len-comment": 4880 }
+, { "custkey": 110i32, "orderkey": 4228i32, "len-comment": 1520 }
+, { "custkey": 14i32, "orderkey": 4229i32, "len-comment": 2480 }
+, { "custkey": 140i32, "orderkey": 4230i32, "len-comment": 4160 }
+, { "custkey": 86i32, "orderkey": 4231i32, "len-comment": 5760 }
+, { "custkey": 118i32, "orderkey": 4256i32, "len-comment": 2480 }
+, { "custkey": 17i32, "orderkey": 4257i32, "len-comment": 3840 }
+, { "custkey": 92i32, "orderkey": 4258i32, "len-comment": 3040 }
+, { "custkey": 104i32, "orderkey": 4259i32, "len-comment": 4800 }
+, { "custkey": 142i32, "orderkey": 4260i32, "len-comment": 2800 }
+, { "custkey": 118i32, "orderkey": 4261i32, "len-comment": 4800 }
+, { "custkey": 88i32, "orderkey": 4262i32, "len-comment": 4320 }
+, { "custkey": 4i32, "orderkey": 4263i32, "len-comment": 4640 }
+, { "custkey": 34i32, "orderkey": 4288i32, "len-comment": 4000 }
+, { "custkey": 125i32, "orderkey": 4289i32, "len-comment": 4160 }
+, { "custkey": 41i32, "orderkey": 4290i32, "len-comment": 5600 }
+, { "custkey": 89i32, "orderkey": 4291i32, "len-comment": 3760 }
+, { "custkey": 25i32, "orderkey": 4292i32, "len-comment": 1680 }
+, { "custkey": 103i32, "orderkey": 4293i32, "len-comment": 3840 }
+, { "custkey": 49i32, "orderkey": 4294i32, "len-comment": 3840 }
+, { "custkey": 5i32, "orderkey": 4295i32, "len-comment": 2080 }
+, { "custkey": 115i32, "orderkey": 4320i32, "len-comment": 2880 }
+, { "custkey": 16i32, "orderkey": 4321i32, "len-comment": 4240 }
+, { "custkey": 142i32, "orderkey": 4322i32, "len-comment": 5920 }
+, { "custkey": 104i32, "orderkey": 4323i32, "len-comment": 4800 }
+, { "custkey": 73i32, "orderkey": 4324i32, "len-comment": 3600 }
+, { "custkey": 130i32, "orderkey": 4325i32, "len-comment": 1760 }
+, { "custkey": 29i32, "orderkey": 4326i32, "len-comment": 2800 }
+, { "custkey": 146i32, "orderkey": 4327i32, "len-comment": 3040 }
+, { "custkey": 14i32, "orderkey": 4352i32, "len-comment": 3840 }
+, { "custkey": 73i32, "orderkey": 4353i32, "len-comment": 1920 }
+, { "custkey": 145i32, "orderkey": 4354i32, "len-comment": 2640 }
+, { "custkey": 4i32, "orderkey": 4355i32, "len-comment": 3360 }
+, { "custkey": 97i32, "orderkey": 4356i32, "len-comment": 4800 }
+, { "custkey": 47i32, "orderkey": 4357i32, "len-comment": 1600 }
+, { "custkey": 25i32, "orderkey": 4358i32, "len-comment": 3600 }
+, { "custkey": 16i32, "orderkey": 4359i32, "len-comment": 4400 }
+, { "custkey": 25i32, "orderkey": 4384i32, "len-comment": 5840 }
+, { "custkey": 122i32, "orderkey": 4385i32, "len-comment": 4880 }
+, { "custkey": 61i32, "orderkey": 4386i32, "len-comment": 2880 }
+, { "custkey": 110i32, "orderkey": 4387i32, "len-comment": 5680 }
+, { "custkey": 10i32, "orderkey": 4388i32, "len-comment": 3920 }
+, { "custkey": 55i32, "orderkey": 4389i32, "len-comment": 2621440 }
+, { "custkey": 7i32, "orderkey": 4390i32, "len-comment": 1680 }
+, { "custkey": 38i32, "orderkey": 4391i32, "len-comment": 2160 }
+, { "custkey": 149i32, "orderkey": 4416i32, "len-comment": 3600 }
+, { "custkey": 67i32, "orderkey": 4417i32, "len-comment": 3760 }
+, { "custkey": 61i32, "orderkey": 4418i32, "len-comment": 3360 }
+, { "custkey": 104i32, "orderkey": 4419i32, "len-comment": 3200 }
+, { "custkey": 109i32, "orderkey": 4420i32, "len-comment": 6240 }
+, { "custkey": 10i32, "orderkey": 4421i32, "len-comment": 3280 }
+, { "custkey": 70i32, "orderkey": 4422i32, "len-comment": 5280 }
+, { "custkey": 64i32, "orderkey": 4423i32, "len-comment": 1600 }
+, { "custkey": 70i32, "orderkey": 4448i32, "len-comment": 5440 }
+, { "custkey": 10i32, "orderkey": 4449i32, "len-comment": 3440 }
+, { "custkey": 106i32, "orderkey": 4450i32, "len-comment": 5280 }
+, { "custkey": 4i32, "orderkey": 4451i32, "len-comment": 4080 }
+, { "custkey": 13i32, "orderkey": 4452i32, "len-comment": 6160 }
+, { "custkey": 65i32, "orderkey": 4453i32, "len-comment": 5680 }
+, { "custkey": 142i32, "orderkey": 4454i32, "len-comment": 1680 }
+, { "custkey": 19i32, "orderkey": 4455i32, "len-comment": 5760 }
+, { "custkey": 85i32, "orderkey": 4480i32, "len-comment": 2480 }
+, { "custkey": 148i32, "orderkey": 4481i32, "len-comment": 2080 }
+, { "custkey": 82i32, "orderkey": 4482i32, "len-comment": 5680 }
+, { "custkey": 52i32, "orderkey": 4483i32, "len-comment": 5840 }
+, { "custkey": 131i32, "orderkey": 4484i32, "len-comment": 5440 }
+, { "custkey": 53i32, "orderkey": 4485i32, "len-comment": 5760 }
+, { "custkey": 37i32, "orderkey": 4486i32, "len-comment": 3520 }
+, { "custkey": 46i32, "orderkey": 4487i32, "len-comment": 6240 }
+, { "custkey": 70i32, "orderkey": 4512i32, "len-comment": 2480 }
+, { "custkey": 85i32, "orderkey": 4513i32, "len-comment": 1920 }
+, { "custkey": 97i32, "orderkey": 4514i32, "len-comment": 2720 }
+, { "custkey": 140i32, "orderkey": 4515i32, "len-comment": 4640 }
+, { "custkey": 130i32, "orderkey": 4516i32, "len-comment": 3520 }
+, { "custkey": 113i32, "orderkey": 4517i32, "len-comment": 4160 }
+, { "custkey": 125i32, "orderkey": 4518i32, "len-comment": 1920 }
+, { "custkey": 136i32, "orderkey": 4519i32, "len-comment": 1760 }
+, { "custkey": 112i32, "orderkey": 4544i32, "len-comment": 3840 }
+, { "custkey": 59i32, "orderkey": 4545i32, "len-comment": 1600 }
+, { "custkey": 43i32, "orderkey": 4546i32, "len-comment": 3760 }
+, { "custkey": 109i32, "orderkey": 4547i32, "len-comment": 5200 }
+, { "custkey": 127i32, "orderkey": 4548i32, "len-comment": 4720 }
+, { "custkey": 64i32, "orderkey": 4549i32, "len-comment": 5600 }
+, { "custkey": 118i32, "orderkey": 4550i32, "len-comment": 1840 }
+, { "custkey": 109i32, "orderkey": 4551i32, "len-comment": 2080 }
+, { "custkey": 139i32, "orderkey": 4576i32, "len-comment": 1600 }
+, { "custkey": 79i32, "orderkey": 4577i32, "len-comment": 2320 }
+, { "custkey": 91i32, "orderkey": 4578i32, "len-comment": 3600 }
+, { "custkey": 106i32, "orderkey": 4579i32, "len-comment": 2560 }
+, { "custkey": 82i32, "orderkey": 4580i32, "len-comment": 3680 }
+, { "custkey": 79i32, "orderkey": 4581i32, "len-comment": 3920 }
+, { "custkey": 19i32, "orderkey": 4582i32, "len-comment": 2160 }
+, { "custkey": 22i32, "orderkey": 4583i32, "len-comment": 2960 }
+, { "custkey": 80i32, "orderkey": 4608i32, "len-comment": 5200 }
+, { "custkey": 133i32, "orderkey": 4609i32, "len-comment": 1760 }
+, { "custkey": 26i32, "orderkey": 4610i32, "len-comment": 2000 }
+, { "custkey": 29i32, "orderkey": 4611i32, "len-comment": 5680 }
+, { "custkey": 61i32, "orderkey": 4612i32, "len-comment": 5840 }
+, { "custkey": 133i32, "orderkey": 4613i32, "len-comment": 2800 }
+, { "custkey": 61i32, "orderkey": 4614i32, "len-comment": 3520 }
+, { "custkey": 29i32, "orderkey": 4615i32, "len-comment": 5440 }
+, { "custkey": 97i32, "orderkey": 4640i32, "len-comment": 4160 }
+, { "custkey": 134i32, "orderkey": 4641i32, "len-comment": 3600 }
+, { "custkey": 148i32, "orderkey": 4642i32, "len-comment": 5440 }
+, { "custkey": 67i32, "orderkey": 4643i32, "len-comment": 3760 }
+, { "custkey": 94i32, "orderkey": 4644i32, "len-comment": 2560 }
+, { "custkey": 44i32, "orderkey": 4645i32, "len-comment": 5680 }
+, { "custkey": 83i32, "orderkey": 4646i32, "len-comment": 2080 }
+, { "custkey": 28i32, "orderkey": 4647i32, "len-comment": 4960 }
+, { "custkey": 79i32, "orderkey": 4672i32, "len-comment": 2160 }
+, { "custkey": 82i32, "orderkey": 4673i32, "len-comment": 5840 }
+, { "custkey": 37i32, "orderkey": 4674i32, "len-comment": 4320 }
+, { "custkey": 86i32, "orderkey": 4675i32, "len-comment": 2400 }
+, { "custkey": 14i32, "orderkey": 4676i32, "len-comment": 3680 }
+, { "custkey": 40i32, "orderkey": 4677i32, "len-comment": 6080 }
+, { "custkey": 88i32, "orderkey": 4678i32, "len-comment": 4560 }
+, { "custkey": 88i32, "orderkey": 4679i32, "len-comment": 5760 }
+, { "custkey": 2i32, "orderkey": 4704i32, "len-comment": 4000 }
+, { "custkey": 98i32, "orderkey": 4705i32, "len-comment": 2000 }
+, { "custkey": 25i32, "orderkey": 4706i32, "len-comment": 5360 }
+, { "custkey": 91i32, "orderkey": 4707i32, "len-comment": 3280 }
+, { "custkey": 85i32, "orderkey": 4708i32, "len-comment": 2400 }
+, { "custkey": 26i32, "orderkey": 4709i32, "len-comment": 5200 }
+, { "custkey": 100i32, "orderkey": 4710i32, "len-comment": 4000 }
+, { "custkey": 142i32, "orderkey": 4711i32, "len-comment": 3520 }
+, { "custkey": 139i32, "orderkey": 4736i32, "len-comment": 6000 }
+, { "custkey": 79i32, "orderkey": 4737i32, "len-comment": 5360 }
+, { "custkey": 5i32, "orderkey": 4738i32, "len-comment": 1520 }
+, { "custkey": 148i32, "orderkey": 4739i32, "len-comment": 4480 }
+, { "custkey": 68i32, "orderkey": 4740i32, "len-comment": 2400 }
+, { "custkey": 127i32, "orderkey": 4741i32, "len-comment": 3040 }
+, { "custkey": 64i32, "orderkey": 4742i32, "len-comment": 3920 }
+, { "custkey": 97i32, "orderkey": 4743i32, "len-comment": 2960 }
+, { "custkey": 136i32, "orderkey": 4768i32, "len-comment": 4400 }
+, { "custkey": 121i32, "orderkey": 4769i32, "len-comment": 3120 }
+, { "custkey": 59i32, "orderkey": 4770i32, "len-comment": 2960 }
+, { "custkey": 95i32, "orderkey": 4771i32, "len-comment": 3840 }
+, { "custkey": 28i32, "orderkey": 4772i32, "len-comment": 4000 }
+, { "custkey": 122i32, "orderkey": 4773i32, "len-comment": 2080 }
+, { "custkey": 52i32, "orderkey": 4774i32, "len-comment": 5840 }
+, { "custkey": 128i32, "orderkey": 4775i32, "len-comment": 5040 }
+, { "custkey": 37i32, "orderkey": 4800i32, "len-comment": 5600 }
+, { "custkey": 88i32, "orderkey": 4801i32, "len-comment": 2621440 }
+, { "custkey": 130i32, "orderkey": 4802i32, "len-comment": 5280 }
+, { "custkey": 124i32, "orderkey": 4803i32, "len-comment": 2320 }
+, { "custkey": 37i32, "orderkey": 4804i32, "len-comment": 3680 }
+, { "custkey": 16i32, "orderkey": 4805i32, "len-comment": 4640 }
+, { "custkey": 7i32, "orderkey": 4806i32, "len-comment": 2720 }
+, { "custkey": 53i32, "orderkey": 4807i32, "len-comment": 2160 }
+, { "custkey": 34i32, "orderkey": 4832i32, "len-comment": 2960 }
+, { "custkey": 133i32, "orderkey": 4833i32, "len-comment": 3760 }
+, { "custkey": 19i32, "orderkey": 4834i32, "len-comment": 4240 }
+, { "custkey": 146i32, "orderkey": 4835i32, "len-comment": 2800 }
+, { "custkey": 65i32, "orderkey": 4836i32, "len-comment": 4560 }
+, { "custkey": 130i32, "orderkey": 4837i32, "len-comment": 5440 }
+, { "custkey": 44i32, "orderkey": 4838i32, "len-comment": 5280 }
+, { "custkey": 25i32, "orderkey": 4839i32, "len-comment": 5040 }
+, { "custkey": 88i32, "orderkey": 4864i32, "len-comment": 4240 }
+, { "custkey": 85i32, "orderkey": 4865i32, "len-comment": 2720 }
+, { "custkey": 53i32, "orderkey": 4866i32, "len-comment": 3280 }
+, { "custkey": 10i32, "orderkey": 4867i32, "len-comment": 6000 }
+, { "custkey": 76i32, "orderkey": 4868i32, "len-comment": 4560 }
+, { "custkey": 58i32, "orderkey": 4869i32, "len-comment": 2000 }
+, { "custkey": 103i32, "orderkey": 4870i32, "len-comment": 3040 }
+, { "custkey": 46i32, "orderkey": 4871i32, "len-comment": 2720 }
+, { "custkey": 85i32, "orderkey": 4896i32, "len-comment": 4960 }
+, { "custkey": 80i32, "orderkey": 4897i32, "len-comment": 4160 }
+, { "custkey": 14i32, "orderkey": 4898i32, "len-comment": 5920 }
+, { "custkey": 61i32, "orderkey": 4899i32, "len-comment": 4640 }
+, { "custkey": 137i32, "orderkey": 4900i32, "len-comment": 1760 }
+, { "custkey": 79i32, "orderkey": 4901i32, "len-comment": 5200 }
+, { "custkey": 139i32, "orderkey": 4902i32, "len-comment": 2320 }
+, { "custkey": 92i32, "orderkey": 4903i32, "len-comment": 2400 }
+, { "custkey": 4i32, "orderkey": 4928i32, "len-comment": 5840 }
+, { "custkey": 149i32, "orderkey": 4929i32, "len-comment": 3680 }
+, { "custkey": 149i32, "orderkey": 4930i32, "len-comment": 4880 }
+, { "custkey": 50i32, "orderkey": 4931i32, "len-comment": 4720 }
+, { "custkey": 122i32, "orderkey": 4932i32, "len-comment": 2080 }
+, { "custkey": 94i32, "orderkey": 4933i32, "len-comment": 2080 }
+, { "custkey": 40i32, "orderkey": 4934i32, "len-comment": 5680 }
+, { "custkey": 40i32, "orderkey": 4935i32, "len-comment": 1920 }
+, { "custkey": 124i32, "orderkey": 4960i32, "len-comment": 6240 }
+, { "custkey": 58i32, "orderkey": 4961i32, "len-comment": 2880 }
+, { "custkey": 104i32, "orderkey": 4962i32, "len-comment": 1680 }
+, { "custkey": 34i32, "orderkey": 4963i32, "len-comment": 2160 }
+, { "custkey": 101i32, "orderkey": 4964i32, "len-comment": 3120 }
+, { "custkey": 52i32, "orderkey": 4965i32, "len-comment": 2880 }
+, { "custkey": 70i32, "orderkey": 4966i32, "len-comment": 5040 }
+, { "custkey": 98i32, "orderkey": 4967i32, "len-comment": 2080 }
+, { "custkey": 62i32, "orderkey": 4992i32, "len-comment": 1840 }
+, { "custkey": 13i32, "orderkey": 4993i32, "len-comment": 2720 }
+, { "custkey": 43i32, "orderkey": 4994i32, "len-comment": 4320 }
+, { "custkey": 40i32, "orderkey": 4995i32, "len-comment": 5840 }
+, { "custkey": 133i32, "orderkey": 4996i32, "len-comment": 4400 }
+, { "custkey": 47i32, "orderkey": 4997i32, "len-comment": 4880 }
+, { "custkey": 32i32, "orderkey": 4998i32, "len-comment": 4080 }
+, { "custkey": 85i32, "orderkey": 4999i32, "len-comment": 3200 }
+, { "custkey": 124i32, "orderkey": 5024i32, "len-comment": 6160 }
+, { "custkey": 121i32, "orderkey": 5025i32, "len-comment": 2880 }
+, { "custkey": 28i32, "orderkey": 5026i32, "len-comment": 1520 }
+, { "custkey": 148i32, "orderkey": 5027i32, "len-comment": 2800 }
+, { "custkey": 13i32, "orderkey": 5028i32, "len-comment": 2720 }
+, { "custkey": 11i32, "orderkey": 5029i32, "len-comment": 3040 }
+, { "custkey": 106i32, "orderkey": 5030i32, "len-comment": 4640 }
+, { "custkey": 139i32, "orderkey": 5031i32, "len-comment": 5840 }
+, { "custkey": 52i32, "orderkey": 5056i32, "len-comment": 5920 }
+, { "custkey": 64i32, "orderkey": 5057i32, "len-comment": 5360 }
+, { "custkey": 119i32, "orderkey": 5058i32, "len-comment": 4000 }
+, { "custkey": 43i32, "orderkey": 5059i32, "len-comment": 5840 }
+, { "custkey": 112i32, "orderkey": 5060i32, "len-comment": 3360 }
+, { "custkey": 101i32, "orderkey": 5061i32, "len-comment": 5680 }
+, { "custkey": 61i32, "orderkey": 5062i32, "len-comment": 5920 }
+, { "custkey": 23i32, "orderkey": 5063i32, "len-comment": 5200 }
+, { "custkey": 130i32, "orderkey": 5088i32, "len-comment": 2960 }
+, { "custkey": 130i32, "orderkey": 5089i32, "len-comment": 4640 }
+, { "custkey": 89i32, "orderkey": 5090i32, "len-comment": 5280 }
+, { "custkey": 148i32, "orderkey": 5091i32, "len-comment": 3360 }
+, { "custkey": 22i32, "orderkey": 5092i32, "len-comment": 2080 }
+, { "custkey": 79i32, "orderkey": 5093i32, "len-comment": 6080 }
+, { "custkey": 106i32, "orderkey": 5094i32, "len-comment": 3360 }
+, { "custkey": 97i32, "orderkey": 5095i32, "len-comment": 4480 }
+, { "custkey": 16i32, "orderkey": 5120i32, "len-comment": 3520 }
+, { "custkey": 133i32, "orderkey": 5121i32, "len-comment": 6000 }
+, { "custkey": 70i32, "orderkey": 5122i32, "len-comment": 3680 }
+, { "custkey": 10i32, "orderkey": 5123i32, "len-comment": 5920 }
+, { "custkey": 25i32, "orderkey": 5124i32, "len-comment": 3040 }
+, { "custkey": 28i32, "orderkey": 5125i32, "len-comment": 3920 }
+, { "custkey": 112i32, "orderkey": 5126i32, "len-comment": 1600 }
+, { "custkey": 73i32, "orderkey": 5127i32, "len-comment": 6240 }
+, { "custkey": 44i32, "orderkey": 5152i32, "len-comment": 1680 }
+, { "custkey": 113i32, "orderkey": 5153i32, "len-comment": 6000 }
+, { "custkey": 8i32, "orderkey": 5154i32, "len-comment": 5600 }
+, { "custkey": 77i32, "orderkey": 5155i32, "len-comment": 2000 }
+, { "custkey": 125i32, "orderkey": 5156i32, "len-comment": 4160 }
+, { "custkey": 142i32, "orderkey": 5157i32, "len-comment": 3600 }
+, { "custkey": 76i32, "orderkey": 5158i32, "len-comment": 3280 }
+, { "custkey": 106i32, "orderkey": 5159i32, "len-comment": 4320 }
+, { "custkey": 85i32, "orderkey": 5184i32, "len-comment": 2640 }
+, { "custkey": 148i32, "orderkey": 5185i32, "len-comment": 2560 }
+, { "custkey": 52i32, "orderkey": 5186i32, "len-comment": 2560 }
+, { "custkey": 55i32, "orderkey": 5187i32, "len-comment": 1520 }
+, { "custkey": 140i32, "orderkey": 5188i32, "len-comment": 2720 }
+, { "custkey": 71i32, "orderkey": 5189i32, "len-comment": 2621440 }
+, { "custkey": 58i32, "orderkey": 5190i32, "len-comment": 1760 }
+, { "custkey": 77i32, "orderkey": 5191i32, "len-comment": 5840 }
+, { "custkey": 59i32, "orderkey": 5216i32, "len-comment": 4160 }
+, { "custkey": 35i32, "orderkey": 5217i32, "len-comment": 3040 }
+, { "custkey": 82i32, "orderkey": 5218i32, "len-comment": 4560 }
+, { "custkey": 88i32, "orderkey": 5219i32, "len-comment": 3680 }
+, { "custkey": 10i32, "orderkey": 5220i32, "len-comment": 3360 }
+, { "custkey": 13i32, "orderkey": 5221i32, "len-comment": 2000 }
+, { "custkey": 80i32, "orderkey": 5222i32, "len-comment": 3840 }
+, { "custkey": 149i32, "orderkey": 5223i32, "len-comment": 6080 }
+, { "custkey": 70i32, "orderkey": 5248i32, "len-comment": 6240 }
+, { "custkey": 103i32, "orderkey": 5249i32, "len-comment": 1760 }
+, { "custkey": 97i32, "orderkey": 5250i32, "len-comment": 5680 }
+, { "custkey": 34i32, "orderkey": 5251i32, "len-comment": 2320 }
+, { "custkey": 91i32, "orderkey": 5252i32, "len-comment": 3040 }
+, { "custkey": 148i32, "orderkey": 5253i32, "len-comment": 4560 }
+, { "custkey": 112i32, "orderkey": 5254i32, "len-comment": 4400 }
+, { "custkey": 64i32, "orderkey": 5255i32, "len-comment": 4560 }
+, { "custkey": 34i32, "orderkey": 5280i32, "len-comment": 6160 }
+, { "custkey": 124i32, "orderkey": 5281i32, "len-comment": 1760 }
+, { "custkey": 50i32, "orderkey": 5282i32, "len-comment": 4560 }
+, { "custkey": 131i32, "orderkey": 5283i32, "len-comment": 3040 }
+, { "custkey": 61i32, "orderkey": 5284i32, "len-comment": 2320 }
+, { "custkey": 70i32, "orderkey": 5285i32, "len-comment": 3120 }
+, { "custkey": 116i32, "orderkey": 5286i32, "len-comment": 5040 }
+, { "custkey": 25i32, "orderkey": 5287i32, "len-comment": 5360 }
+, { "custkey": 65i32, "orderkey": 5312i32, "len-comment": 1840 }
+, { "custkey": 13i32, "orderkey": 5313i32, "len-comment": 4080 }
+, { "custkey": 34i32, "orderkey": 5314i32, "len-comment": 2640 }
+, { "custkey": 139i32, "orderkey": 5315i32, "len-comment": 3600 }
+, { "custkey": 100i32, "orderkey": 5316i32, "len-comment": 6160 }
+, { "custkey": 37i32, "orderkey": 5317i32, "len-comment": 2400 }
+, { "custkey": 59i32, "orderkey": 5318i32, "len-comment": 5520 }
+, { "custkey": 98i32, "orderkey": 5319i32, "len-comment": 2000 }
+, { "custkey": 109i32, "orderkey": 5344i32, "len-comment": 2800 }
+, { "custkey": 31i32, "orderkey": 5345i32, "len-comment": 4000 }
+, { "custkey": 37i32, "orderkey": 5346i32, "len-comment": 6000 }
+, { "custkey": 49i32, "orderkey": 5347i32, "len-comment": 2400 }
+, { "custkey": 53i32, "orderkey": 5348i32, "len-comment": 2800 }
+, { "custkey": 67i32, "orderkey": 5349i32, "len-comment": 4880 }
+, { "custkey": 76i32, "orderkey": 5350i32, "len-comment": 4240 }
+, { "custkey": 122i32, "orderkey": 5351i32, "len-comment": 3920 }
+, { "custkey": 149i32, "orderkey": 5376i32, "len-comment": 3280 }
+, { "custkey": 64i32, "orderkey": 537

<TRUNCATED>


[07/15] incubator-asterixdb git commit: ASTERIXDB-1102: VarSize Encoding to store length of String and ByteArray

Posted by ji...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/HashedUTF8NGramTokenFactory.java
----------------------------------------------------------------------
diff --git a/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/HashedUTF8NGramTokenFactory.java b/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/HashedUTF8NGramTokenFactory.java
deleted file mode 100644
index 6472b68..0000000
--- a/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/HashedUTF8NGramTokenFactory.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.asterix.fuzzyjoin.tokenizer;
-
-public class HashedUTF8NGramTokenFactory extends AbstractUTF8TokenFactory {
-
-    private static final long serialVersionUID = 1L;
-
-    public HashedUTF8NGramTokenFactory() {
-        super();
-    }
-
-    public HashedUTF8NGramTokenFactory(byte tokenTypeTag, byte countTypeTag) {
-        super(tokenTypeTag, countTypeTag);
-    }
-
-    @Override
-    public IToken createToken() {
-        return new HashedUTF8NGramToken(tokenTypeTag, countTypeTag);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/HashedUTF8WordToken.java
----------------------------------------------------------------------
diff --git a/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/HashedUTF8WordToken.java b/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/HashedUTF8WordToken.java
deleted file mode 100644
index 6911b25..0000000
--- a/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/HashedUTF8WordToken.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.asterix.fuzzyjoin.tokenizer;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-public class HashedUTF8WordToken extends UTF8WordToken {
-
-    private int hash = 0;
-
-    public HashedUTF8WordToken(byte tokenTypeTag, byte countTypeTag) {
-        super(tokenTypeTag, countTypeTag);
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (o == null) {
-            return false;
-        }
-        if (!(o instanceof IToken)) {
-            return false;
-        }
-        IToken t = (IToken) o;
-        if (t.getTokenLength() != tokenLength) {
-            return false;
-        }
-        int offset = 0;
-        for (int i = 0; i < tokenLength; i++) {
-            if (StringUtils.charAt(t.getData(), t.getStart() + offset) != StringUtils.charAt(data, start + offset)) {
-                return false;
-            }
-            offset += StringUtils.charSize(data, start + offset);
-        }
-        return true;
-    }
-
-    @Override
-    public int hashCode() {
-        return hash;
-    }
-
-    @Override
-    public void reset(byte[] data, int start, int length, int tokenLength, int tokenCount) {
-        super.reset(data, start, length, tokenLength, tokenCount);
-
-        // pre-compute hash value using JAQL-like string hashing
-        int pos = start;
-        hash = GOLDEN_RATIO_32;
-        for (int i = 0; i < tokenLength; i++) {
-            hash ^= StringUtils.toLowerCase(StringUtils.charAt(data, pos));
-            hash *= GOLDEN_RATIO_32;
-            pos += StringUtils.charSize(data, pos);
-        }
-        hash += tokenCount;
-    }
-
-    @Override
-    public void serializeToken(DataOutput dos) throws IOException {
-        if (tokenTypeTag > 0) {
-            dos.write(tokenTypeTag);
-        }
-
-        // serialize hash value
-        dos.writeInt(hash);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/HashedUTF8WordTokenFactory.java
----------------------------------------------------------------------
diff --git a/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/HashedUTF8WordTokenFactory.java b/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/HashedUTF8WordTokenFactory.java
deleted file mode 100644
index 50bc67c..0000000
--- a/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/HashedUTF8WordTokenFactory.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.asterix.fuzzyjoin.tokenizer;
-
-public class HashedUTF8WordTokenFactory extends AbstractUTF8TokenFactory {
-
-    private static final long serialVersionUID = 1L;
-
-    public HashedUTF8WordTokenFactory() {
-        super();
-    }
-
-    public HashedUTF8WordTokenFactory(byte tokenTypeTag, byte countTypeTag) {
-        super(tokenTypeTag, countTypeTag);
-    }
-
-    @Override
-    public IToken createToken() {
-        return new HashedUTF8WordToken(tokenTypeTag, countTypeTag);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/IBinaryTokenizer.java
----------------------------------------------------------------------
diff --git a/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/IBinaryTokenizer.java b/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/IBinaryTokenizer.java
deleted file mode 100644
index 86359e1..0000000
--- a/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/IBinaryTokenizer.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.asterix.fuzzyjoin.tokenizer;
-
-public interface IBinaryTokenizer {
-    public IToken getToken();
-
-    public boolean hasNext();
-
-    public void next();
-
-    public void reset(byte[] data, int start, int length);
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/IBinaryTokenizerFactory.java
----------------------------------------------------------------------
diff --git a/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/IBinaryTokenizerFactory.java b/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/IBinaryTokenizerFactory.java
deleted file mode 100644
index f7cf4d5..0000000
--- a/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/IBinaryTokenizerFactory.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.asterix.fuzzyjoin.tokenizer;
-
-import java.io.Serializable;
-
-public interface IBinaryTokenizerFactory extends Serializable {
-    public IBinaryTokenizer createTokenizer();
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/INGramToken.java
----------------------------------------------------------------------
diff --git a/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/INGramToken.java b/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/INGramToken.java
deleted file mode 100644
index 81f7b44..0000000
--- a/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/INGramToken.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.asterix.fuzzyjoin.tokenizer;
-
-public interface INGramToken {
-    public int getNumPostChars();
-
-    public int getNumPreChars();
-
-    public void setNumPrePostChars(int numPreChars, int numPostChars);
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/IToken.java
----------------------------------------------------------------------
diff --git a/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/IToken.java b/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/IToken.java
deleted file mode 100644
index 6d7b05d..0000000
--- a/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/IToken.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.asterix.fuzzyjoin.tokenizer;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-public interface IToken {
-    public byte[] getData();
-
-    public int getLength();
-
-    public int getStart();
-
-    public int getTokenLength();
-
-    public void reset(byte[] data, int start, int length, int tokenLength, int tokenCount);
-
-    public void serializeToken(DataOutput dos) throws IOException;
-
-    public void serializeTokenCount(DataOutput dos) throws IOException;
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/ITokenFactory.java
----------------------------------------------------------------------
diff --git a/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/ITokenFactory.java b/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/ITokenFactory.java
deleted file mode 100644
index 245530f..0000000
--- a/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/ITokenFactory.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.asterix.fuzzyjoin.tokenizer;
-
-import java.io.Serializable;
-
-public interface ITokenFactory extends Serializable {
-    public IToken createToken();
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/NGramUTF8StringBinaryTokenizer.java
----------------------------------------------------------------------
diff --git a/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/NGramUTF8StringBinaryTokenizer.java b/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/NGramUTF8StringBinaryTokenizer.java
deleted file mode 100644
index 88c58b2..0000000
--- a/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/NGramUTF8StringBinaryTokenizer.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.asterix.fuzzyjoin.tokenizer;
-
-public class NGramUTF8StringBinaryTokenizer extends AbstractUTF8StringBinaryTokenizer {
-
-    private int gramLength;
-    private boolean usePrePost;
-
-    private int gramNum;
-    private int totalGrams;
-
-    private final INGramToken concreteToken;
-
-    public NGramUTF8StringBinaryTokenizer(int gramLength, boolean usePrePost, boolean ignoreTokenCount,
-            boolean sourceHasTypeTag, ITokenFactory tokenFactory) {
-        super(ignoreTokenCount, sourceHasTypeTag, tokenFactory);
-        this.gramLength = gramLength;
-        this.usePrePost = usePrePost;
-        concreteToken = (INGramToken) token;
-    }
-
-    @Override
-    public boolean hasNext() {
-        if (gramNum < totalGrams) {
-            return true;
-        } else {
-            return false;
-        }
-    }
-
-    @Override
-    public void next() {
-        int currentTokenStart = index;
-        int tokenCount = 1;
-        int numPreChars = 0;
-        int numPostChars = 0;
-        if (usePrePost) {
-            numPreChars = Math.max(gramLength - gramNum - 1, 0);
-            numPostChars = (gramNum > totalGrams - gramLength) ? gramLength - totalGrams + gramNum : 0;
-        }
-        gramNum++;
-
-        concreteToken.setNumPrePostChars(numPreChars, numPostChars);
-        if (numPreChars == 0) {
-            index += StringUtils.charSize(data, index);
-        }
-
-        // compute token count
-        // ignore pre and post grams for duplicate detection
-        if (!ignoreTokenCount && numPreChars == 0 && numPostChars == 0) {
-            int tmpIndex = start;
-            while (tmpIndex < currentTokenStart) {
-                tokenCount++; // assume found
-                int offset = 0;
-                for (int j = 0; j < gramLength; j++) {
-                    if (StringUtils.toLowerCase(StringUtils.charAt(data, currentTokenStart + offset)) != StringUtils
-                            .toLowerCase(StringUtils.charAt(data, tmpIndex + offset))) {
-                        tokenCount--;
-                        break;
-                    }
-                    offset += StringUtils.charSize(data, tmpIndex + offset);
-                }
-                tmpIndex += StringUtils.charSize(data, tmpIndex);
-            }
-        }
-
-        // set token
-        token.reset(data, currentTokenStart, length, gramLength, tokenCount);
-    }
-
-    @Override
-    public void reset(byte[] data, int start, int length) {
-        super.reset(data, start, length);
-        gramNum = 0;
-
-        int numChars = 0;
-        int pos = index;
-        int end = pos + utf8Length;
-        while (pos < end) {
-            numChars++;
-            pos += StringUtils.charSize(data, pos);
-        }
-
-        if (usePrePost) {
-            totalGrams = numChars + gramLength - 1;
-        } else {
-            totalGrams = numChars - gramLength + 1;
-        }
-    }
-
-    public void setGramlength(int gramLength) {
-        this.gramLength = gramLength;
-    }
-
-    public void setPrePost(boolean usePrePost) {
-        this.usePrePost = usePrePost;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/StringUtils.java
----------------------------------------------------------------------
diff --git a/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/StringUtils.java b/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/StringUtils.java
deleted file mode 100644
index d3afd80..0000000
--- a/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/StringUtils.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.asterix.fuzzyjoin.tokenizer;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-public class StringUtils {
-    public static char charAt(byte[] b, int s) {
-        int c = b[s] & 0xff;
-        switch (c >> 4) {
-            case 0:
-            case 1:
-            case 2:
-            case 3:
-            case 4:
-            case 5:
-            case 6:
-            case 7:
-                return (char) c;
-
-            case 12:
-            case 13:
-                return (char) (((c & 0x1F) << 6) | ((b[s + 1]) & 0x3F));
-
-            case 14:
-                return (char) (((c & 0x0F) << 12) | (((b[s + 1]) & 0x3F) << 6) | (((b[s + 2]) & 0x3F) << 0));
-
-            default:
-                throw new IllegalArgumentException();
-        }
-    }
-
-    public static int charSize(byte[] b, int s) {
-        int c = b[s] & 0xff;
-        switch (c >> 4) {
-            case 0:
-            case 1:
-            case 2:
-            case 3:
-            case 4:
-            case 5:
-            case 6:
-            case 7:
-                return 1;
-
-            case 12:
-            case 13:
-                return 2;
-
-            case 14:
-                return 3;
-        }
-        throw new IllegalStateException();
-    }
-
-    public static int getModifiedUTF8Len(char c) {
-        if (c >= 0x0000 && c <= 0x007F) {
-            return 1;
-        } else if (c <= 0x07FF) {
-            return 2;
-        } else {
-            return 3;
-        }
-    }
-
-    public static int getStrLen(byte[] b, int s) {
-        int pos = s + 2;
-        int end = pos + getUTFLen(b, s);
-        int charCount = 0;
-        while (pos < end) {
-            charCount++;
-            pos += charSize(b, pos);
-        }
-        return charCount;
-    }
-
-    public static int getUTFLen(byte[] b, int s) {
-        return ((b[s] & 0xff) << 8) + ((b[s + 1] & 0xff) << 0);
-    }
-
-    public static char toLowerCase(char c) {
-        switch (c) {
-            case 'A':
-                return 'a';
-            case 'B':
-                return 'b';
-            case 'C':
-                return 'c';
-            case 'D':
-                return 'd';
-            case 'E':
-                return 'e';
-            case 'F':
-                return 'f';
-            case 'G':
-                return 'g';
-            case 'H':
-                return 'h';
-            case 'I':
-                return 'i';
-            case 'J':
-                return 'j';
-            case 'K':
-                return 'k';
-            case 'L':
-                return 'l';
-            case 'M':
-                return 'm';
-            case 'N':
-                return 'n';
-            case 'O':
-                return 'o';
-            case 'P':
-                return 'p';
-            case 'Q':
-                return 'q';
-            case 'R':
-                return 'r';
-            case 'S':
-                return 's';
-            case 'T':
-                return 't';
-            case 'U':
-                return 'u';
-            case 'V':
-                return 'v';
-            case 'W':
-                return 'w';
-            case 'X':
-                return 'x';
-            case 'Y':
-                return 'y';
-            case 'Z':
-                return 'z';
-            case 'Ä':
-                return 'ä';
-            case 'Ǟ':
-                return 'ǟ';
-            case 'Ë':
-                return 'ë';
-            case 'Ḧ':
-                return 'ḧ';
-            case 'Ï':
-                return 'ï';
-            case 'Ḯ':
-                return 'ḯ';
-            case 'Ö':
-                return 'ö';
-            case 'Ȫ':
-                return 'ȫ';
-            case 'Ṏ':
-                return 'ṏ';
-            case 'Ü':
-                return 'ü';
-            case 'Ǖ':
-                return 'ǖ';
-            case 'Ǘ':
-                return 'ǘ';
-            case 'Ǚ':
-                return 'ǚ';
-            case 'Ǜ':
-                return 'ǜ';
-            case 'Ṳ':
-                return 'ṳ';
-            case 'Ṻ':
-                return 'ṻ';
-            case 'Ẅ':
-                return 'ẅ';
-            case 'Ẍ':
-                return 'ẍ';
-            case 'Ÿ':
-                return 'ÿ';
-            default:
-                // since I probably missed some chars above
-                // use Java to convert to lower case to be safe
-                return Character.toLowerCase(c);
-        }
-    }
-
-    public static void writeCharAsModifiedUTF8(char c, DataOutput dos) throws IOException {
-
-        if (c >= 0x0000 && c <= 0x007F) {
-            dos.writeByte(c);
-        } else if (c <= 0x07FF) {
-            dos.writeByte((byte) (0xC0 | ((c >> 6) & 0x3F)));
-            dos.writeByte((byte) (0x80 | (c & 0x3F)));
-        } else {
-            dos.writeByte((byte) (0xE0 | ((c >> 12) & 0x0F)));
-            dos.writeByte((byte) (0x80 | ((c >> 6) & 0x3F)));
-            dos.writeByte((byte) (0x80 | (c & 0x3F)));
-        }
-    }
-
-    public static void writeUTF8Len(int len, DataOutput dos) throws IOException {
-        dos.write((len >>> 8) & 0xFF);
-        dos.write((len >>> 0) & 0xFF);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/UTF8NGramToken.java
----------------------------------------------------------------------
diff --git a/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/UTF8NGramToken.java b/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/UTF8NGramToken.java
deleted file mode 100644
index a3326c4..0000000
--- a/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/UTF8NGramToken.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.asterix.fuzzyjoin.tokenizer;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-public class UTF8NGramToken extends AbstractUTF8Token implements INGramToken {
-
-    public final static char PRECHAR = '#';
-
-    public final static char POSTCHAR = '$';
-
-    protected int numPreChars;
-    protected int numPostChars;
-
-    public UTF8NGramToken(byte tokenTypeTag, byte countTypeTag) {
-        super(tokenTypeTag, countTypeTag);
-    }
-
-    @Override
-    public int getNumPostChars() {
-        return numPreChars;
-    }
-
-    @Override
-    public int getNumPreChars() {
-        return numPostChars;
-    }
-
-    @Override
-    public void serializeToken(DataOutput dos) throws IOException {
-        handleTokenTypeTag(dos);
-
-        // regular chars
-        int numRegChars = tokenLength - numPreChars - numPostChars;
-
-        // assuming pre and post char need 1-byte each in utf8
-        int tokenUTF8Len = getLowerCaseUTF8Len(numRegChars) + numPreChars + numPostChars;
-
-        // write utf8 length indicator
-        StringUtils.writeUTF8Len(tokenUTF8Len, dos);
-
-        // pre chars
-        for (int i = 0; i < numPreChars; i++) {
-            StringUtils.writeCharAsModifiedUTF8(PRECHAR, dos);
-        }
-
-        int pos = start;
-        for (int i = 0; i < numRegChars; i++) {
-            char c = StringUtils.toLowerCase(StringUtils.charAt(data, pos));
-            StringUtils.writeCharAsModifiedUTF8(c, dos);
-            pos += StringUtils.charSize(data, pos);
-        }
-
-        // post chars
-        for (int i = 0; i < numPostChars; i++) {
-            StringUtils.writeCharAsModifiedUTF8(POSTCHAR, dos);
-        }
-    }
-
-    public void setNumPrePostChars(int numPreChars, int numPostChars) {
-        this.numPreChars = numPreChars;
-        this.numPostChars = numPostChars;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/UTF8NGramTokenFactory.java
----------------------------------------------------------------------
diff --git a/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/UTF8NGramTokenFactory.java b/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/UTF8NGramTokenFactory.java
deleted file mode 100644
index 520aa66..0000000
--- a/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/UTF8NGramTokenFactory.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.asterix.fuzzyjoin.tokenizer;
-
-public class UTF8NGramTokenFactory extends AbstractUTF8TokenFactory {
-
-    private static final long serialVersionUID = 1L;
-
-    public UTF8NGramTokenFactory() {
-        super();
-    }
-
-    public UTF8NGramTokenFactory(byte tokenTypeTag, byte countTypeTag) {
-        super(tokenTypeTag, countTypeTag);
-    }
-
-    @Override
-    public IToken createToken() {
-        return new UTF8NGramToken(tokenTypeTag, countTypeTag);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/UTF8WordToken.java
----------------------------------------------------------------------
diff --git a/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/UTF8WordToken.java b/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/UTF8WordToken.java
deleted file mode 100644
index 41a8105..0000000
--- a/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/UTF8WordToken.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.asterix.fuzzyjoin.tokenizer;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-public class UTF8WordToken extends AbstractUTF8Token {
-
-    public UTF8WordToken(byte tokenTypeTag, byte countTypeTag) {
-        super(tokenTypeTag, countTypeTag);
-    }
-
-    @Override
-    public void serializeToken(DataOutput dos) throws IOException {
-        handleTokenTypeTag(dos);
-
-        int tokenUTF8Len = getLowerCaseUTF8Len(tokenLength);
-        StringUtils.writeUTF8Len(tokenUTF8Len, dos);
-        int pos = start;
-        for (int i = 0; i < tokenLength; i++) {
-            char c = StringUtils.toLowerCase(StringUtils.charAt(data, pos));
-            StringUtils.writeCharAsModifiedUTF8(c, dos);
-            pos += StringUtils.charSize(data, pos);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/UTF8WordTokenFactory.java
----------------------------------------------------------------------
diff --git a/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/UTF8WordTokenFactory.java b/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/UTF8WordTokenFactory.java
deleted file mode 100644
index 9d15db9..0000000
--- a/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/UTF8WordTokenFactory.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.asterix.fuzzyjoin.tokenizer;
-
-public class UTF8WordTokenFactory extends AbstractUTF8TokenFactory {
-
-    private static final long serialVersionUID = 1L;
-
-    public UTF8WordTokenFactory() {
-        super();
-    }
-
-    public UTF8WordTokenFactory(byte tokenTypeTag, byte countTypeTag) {
-        super(tokenTypeTag, countTypeTag);
-    }
-
-    @Override
-    public IToken createToken() {
-        return new UTF8WordToken(tokenTypeTag, countTypeTag);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-fuzzyjoin/src/test/java/org/apache/asterix/fuzzyjoin/tests/NGramTokenizerTest.java
----------------------------------------------------------------------
diff --git a/asterix-fuzzyjoin/src/test/java/org/apache/asterix/fuzzyjoin/tests/NGramTokenizerTest.java b/asterix-fuzzyjoin/src/test/java/org/apache/asterix/fuzzyjoin/tests/NGramTokenizerTest.java
deleted file mode 100644
index d10aefb..0000000
--- a/asterix-fuzzyjoin/src/test/java/org/apache/asterix/fuzzyjoin/tests/NGramTokenizerTest.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.asterix.fuzzyjoin.tests;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.DataInput;
-import java.io.DataInputStream;
-import java.io.DataOutput;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import org.apache.asterix.fuzzyjoin.tokenizer.AbstractUTF8Token;
-import org.apache.asterix.fuzzyjoin.tokenizer.HashedUTF8NGramTokenFactory;
-import org.apache.asterix.fuzzyjoin.tokenizer.IToken;
-import org.apache.asterix.fuzzyjoin.tokenizer.NGramUTF8StringBinaryTokenizer;
-import org.apache.asterix.fuzzyjoin.tokenizer.UTF8NGramTokenFactory;
-
-public class NGramTokenizerTest {
-
-    private char PRECHAR = '#';
-    private char POSTCHAR = '$';
-
-    private String str = "Jürgen S. Generic's Car";
-    private byte[] inputBuffer;
-
-    private int gramLength = 3;
-
-    private void getExpectedGrams(String s, int gramLength, ArrayList<String> grams, boolean prePost) {
-
-        String tmp = s.toLowerCase();
-        if (prePost) {
-            StringBuilder preBuilder = new StringBuilder();
-            for (int i = 0; i < gramLength - 1; i++) {
-                preBuilder.append(PRECHAR);
-            }
-            String pre = preBuilder.toString();
-
-            StringBuilder postBuilder = new StringBuilder();
-            for (int i = 0; i < gramLength - 1; i++) {
-                postBuilder.append(POSTCHAR);
-            }
-            String post = postBuilder.toString();
-
-            tmp = pre + s.toLowerCase() + post;
-        }
-
-        for (int i = 0; i < tmp.length() - gramLength + 1; i++) {
-            String gram = tmp.substring(i, i + gramLength);
-            grams.add(gram);
-        }
-    }
-
-    @Before
-    public void init() throws Exception {
-        // serialize string into bytes
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        DataOutput dos = new DataOutputStream(baos);
-        dos.writeUTF(str);
-        inputBuffer = baos.toByteArray();
-    }
-
-    void runTestNGramTokenizerWithCountedHashedUTF8Tokens(boolean prePost) throws IOException {
-        HashedUTF8NGramTokenFactory tokenFactory = new HashedUTF8NGramTokenFactory();
-        NGramUTF8StringBinaryTokenizer tokenizer = new NGramUTF8StringBinaryTokenizer(gramLength, prePost, false,
-                false, tokenFactory);
-        tokenizer.reset(inputBuffer, 0, inputBuffer.length);
-
-        ArrayList<String> expectedGrams = new ArrayList<String>();
-        getExpectedGrams(str, gramLength, expectedGrams, prePost);
-        ArrayList<Integer> expectedHashedGrams = new ArrayList<Integer>();
-        HashMap<String, Integer> gramCounts = new HashMap<String, Integer>();
-        for (String s : expectedGrams) {
-            Integer count = gramCounts.get(s);
-            if (count == null) {
-                count = 1;
-                gramCounts.put(s, count);
-            } else {
-                count++;
-            }
-
-            int hash = tokenHash(s, count);
-            expectedHashedGrams.add(hash);
-        }
-
-        int tokenCount = 0;
-
-        while (tokenizer.hasNext()) {
-            tokenizer.next();
-
-            // serialize hashed token
-            ByteArrayOutputStream tokenBaos = new ByteArrayOutputStream();
-            DataOutput tokenDos = new DataOutputStream(tokenBaos);
-
-            IToken token = tokenizer.getToken();
-            token.serializeToken(tokenDos);
-
-            // deserialize token
-            ByteArrayInputStream bais = new ByteArrayInputStream(tokenBaos.toByteArray());
-            DataInput in = new DataInputStream(bais);
-
-            Integer hashedGram = in.readInt();
-
-            // System.out.println(hashedGram);
-
-            Assert.assertEquals(expectedHashedGrams.get(tokenCount), hashedGram);
-
-            tokenCount++;
-        }
-        // System.out.println("---------");
-    }
-
-    void runTestNGramTokenizerWithHashedUTF8Tokens(boolean prePost) throws IOException {
-        HashedUTF8NGramTokenFactory tokenFactory = new HashedUTF8NGramTokenFactory();
-        NGramUTF8StringBinaryTokenizer tokenizer = new NGramUTF8StringBinaryTokenizer(gramLength, prePost, true, false,
-                tokenFactory);
-        tokenizer.reset(inputBuffer, 0, inputBuffer.length);
-
-        ArrayList<String> expectedGrams = new ArrayList<String>();
-        getExpectedGrams(str, gramLength, expectedGrams, prePost);
-        ArrayList<Integer> expectedHashedGrams = new ArrayList<Integer>();
-        for (String s : expectedGrams) {
-            int hash = tokenHash(s, 1);
-            expectedHashedGrams.add(hash);
-        }
-
-        int tokenCount = 0;
-
-        while (tokenizer.hasNext()) {
-            tokenizer.next();
-
-            // serialize hashed token
-            ByteArrayOutputStream tokenBaos = new ByteArrayOutputStream();
-            DataOutput tokenDos = new DataOutputStream(tokenBaos);
-
-            IToken token = tokenizer.getToken();
-            token.serializeToken(tokenDos);
-
-            // deserialize token
-            ByteArrayInputStream bais = new ByteArrayInputStream(tokenBaos.toByteArray());
-            DataInput in = new DataInputStream(bais);
-
-            Integer hashedGram = in.readInt();
-
-            // System.out.println(hashedGram);
-
-            Assert.assertEquals(expectedHashedGrams.get(tokenCount), hashedGram);
-
-            tokenCount++;
-        }
-        // System.out.println("---------");
-    }
-
-    void runTestNGramTokenizerWithUTF8Tokens(boolean prePost) throws IOException {
-        UTF8NGramTokenFactory tokenFactory = new UTF8NGramTokenFactory();
-        NGramUTF8StringBinaryTokenizer tokenizer = new NGramUTF8StringBinaryTokenizer(gramLength, prePost, true, false,
-                tokenFactory);
-        tokenizer.reset(inputBuffer, 0, inputBuffer.length);
-
-        ArrayList<String> expectedGrams = new ArrayList<String>();
-        getExpectedGrams(str, gramLength, expectedGrams, prePost);
-
-        int tokenCount = 0;
-
-        while (tokenizer.hasNext()) {
-            tokenizer.next();
-
-            // serialize hashed token
-            ByteArrayOutputStream tokenBaos = new ByteArrayOutputStream();
-            DataOutput tokenDos = new DataOutputStream(tokenBaos);
-
-            IToken token = tokenizer.getToken();
-            token.serializeToken(tokenDos);
-
-            // deserialize token
-            ByteArrayInputStream bais = new ByteArrayInputStream(tokenBaos.toByteArray());
-            DataInput in = new DataInputStream(bais);
-
-            String strGram = in.readUTF();
-
-            // System.out.println("\"" + strGram + "\"");
-
-            Assert.assertEquals(expectedGrams.get(tokenCount), strGram);
-
-            tokenCount++;
-        }
-        // System.out.println("---------");
-    }
-
-    @Test
-    public void testNGramTokenizerWithCountedHashedUTF8Tokens() throws Exception {
-        runTestNGramTokenizerWithCountedHashedUTF8Tokens(false);
-        runTestNGramTokenizerWithCountedHashedUTF8Tokens(true);
-    }
-
-    @Test
-    public void testNGramTokenizerWithHashedUTF8Tokens() throws Exception {
-        runTestNGramTokenizerWithHashedUTF8Tokens(false);
-        runTestNGramTokenizerWithHashedUTF8Tokens(true);
-    }
-
-    @Test
-    public void testNGramTokenizerWithUTF8Tokens() throws IOException {
-        runTestNGramTokenizerWithUTF8Tokens(false);
-        runTestNGramTokenizerWithUTF8Tokens(true);
-    }
-
-    public int tokenHash(String token, int tokenCount) {
-        int h = AbstractUTF8Token.GOLDEN_RATIO_32;
-        for (int i = 0; i < token.length(); i++) {
-            h ^= token.charAt(i);
-            h *= AbstractUTF8Token.GOLDEN_RATIO_32;
-        }
-        return h + tokenCount;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-fuzzyjoin/src/test/java/org/apache/asterix/fuzzyjoin/tests/WordTokenizerTest.java
----------------------------------------------------------------------
diff --git a/asterix-fuzzyjoin/src/test/java/org/apache/asterix/fuzzyjoin/tests/WordTokenizerTest.java b/asterix-fuzzyjoin/src/test/java/org/apache/asterix/fuzzyjoin/tests/WordTokenizerTest.java
deleted file mode 100644
index a4afe0c..0000000
--- a/asterix-fuzzyjoin/src/test/java/org/apache/asterix/fuzzyjoin/tests/WordTokenizerTest.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.asterix.fuzzyjoin.tests;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.DataInput;
-import java.io.DataInputStream;
-import java.io.DataOutput;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-
-import junit.framework.Assert;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import org.apache.asterix.fuzzyjoin.tokenizer.AbstractUTF8Token;
-import org.apache.asterix.fuzzyjoin.tokenizer.DelimitedUTF8StringBinaryTokenizer;
-import org.apache.asterix.fuzzyjoin.tokenizer.HashedUTF8WordTokenFactory;
-import org.apache.asterix.fuzzyjoin.tokenizer.IToken;
-import org.apache.asterix.fuzzyjoin.tokenizer.UTF8WordTokenFactory;
-
-public class WordTokenizerTest {
-
-    private String text = "Hello World, I would like to inform you of the importance of Foo Bar. Yes, Foo Bar. Jürgen.";
-    private byte[] inputBuffer;
-
-    private ArrayList<String> expectedUTF8Tokens = new ArrayList<String>();
-    private ArrayList<Integer> expectedHashedUTF8Tokens = new ArrayList<Integer>();
-    private ArrayList<Integer> expectedCountedHashedUTF8Tokens = new ArrayList<Integer>();
-
-    @Before
-    public void init() throws IOException {
-        // serialize text into bytes
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        DataOutput dos = new DataOutputStream(baos);
-        dos.writeUTF(text);
-        inputBuffer = baos.toByteArray();
-
-        // init expected string tokens
-        expectedUTF8Tokens.add("hello");
-        expectedUTF8Tokens.add("world");
-        expectedUTF8Tokens.add("i");
-        expectedUTF8Tokens.add("would");
-        expectedUTF8Tokens.add("like");
-        expectedUTF8Tokens.add("to");
-        expectedUTF8Tokens.add("inform");
-        expectedUTF8Tokens.add("you");
-        expectedUTF8Tokens.add("of");
-        expectedUTF8Tokens.add("the");
-        expectedUTF8Tokens.add("importance");
-        expectedUTF8Tokens.add("of");
-        expectedUTF8Tokens.add("foo");
-        expectedUTF8Tokens.add("bar");
-        expectedUTF8Tokens.add("yes");
-        expectedUTF8Tokens.add("foo");
-        expectedUTF8Tokens.add("bar");
-        expectedUTF8Tokens.add("jürgen");
-
-        // hashed tokens ignoring token count
-        for (int i = 0; i < expectedUTF8Tokens.size(); i++) {
-            int hash = tokenHash(expectedUTF8Tokens.get(i), 1);
-            expectedHashedUTF8Tokens.add(hash);
-        }
-
-        // hashed tokens using token count
-        HashMap<String, Integer> tokenCounts = new HashMap<String, Integer>();
-        for (int i = 0; i < expectedUTF8Tokens.size(); i++) {
-            Integer count = tokenCounts.get(expectedUTF8Tokens.get(i));
-            if (count == null) {
-                count = 1;
-                tokenCounts.put(expectedUTF8Tokens.get(i), count);
-            } else {
-                count++;
-            }
-
-            int hash = tokenHash(expectedUTF8Tokens.get(i), count);
-            expectedCountedHashedUTF8Tokens.add(hash);
-        }
-    }
-
-    @Test
-    public void testWordTokenizerWithCountedHashedUTF8Tokens() throws IOException {
-
-        HashedUTF8WordTokenFactory tokenFactory = new HashedUTF8WordTokenFactory();
-        DelimitedUTF8StringBinaryTokenizer tokenizer = new DelimitedUTF8StringBinaryTokenizer(false, false,
-                tokenFactory);
-
-        tokenizer.reset(inputBuffer, 0, inputBuffer.length);
-
-        int tokenCount = 0;
-
-        while (tokenizer.hasNext()) {
-            tokenizer.next();
-
-            // serialize token
-            ByteArrayOutputStream tokenBaos = new ByteArrayOutputStream();
-            DataOutput tokenDos = new DataOutputStream(tokenBaos);
-
-            IToken token = tokenizer.getToken();
-            token.serializeToken(tokenDos);
-
-            // deserialize token
-            ByteArrayInputStream bais = new ByteArrayInputStream(tokenBaos.toByteArray());
-            DataInput in = new DataInputStream(bais);
-
-            Integer hashedToken = in.readInt();
-
-            // System.out.println(hashedToken);
-
-            Assert.assertEquals(hashedToken, expectedCountedHashedUTF8Tokens.get(tokenCount));
-
-            tokenCount++;
-        }
-    }
-
-    @Test
-    public void testWordTokenizerWithHashedUTF8Tokens() throws IOException {
-
-        HashedUTF8WordTokenFactory tokenFactory = new HashedUTF8WordTokenFactory();
-        DelimitedUTF8StringBinaryTokenizer tokenizer = new DelimitedUTF8StringBinaryTokenizer(true, false, tokenFactory);
-
-        tokenizer.reset(inputBuffer, 0, inputBuffer.length);
-
-        int tokenCount = 0;
-
-        while (tokenizer.hasNext()) {
-            tokenizer.next();
-
-            // serialize token
-            ByteArrayOutputStream tokenBaos = new ByteArrayOutputStream();
-            DataOutput tokenDos = new DataOutputStream(tokenBaos);
-
-            IToken token = tokenizer.getToken();
-            token.serializeToken(tokenDos);
-
-            // deserialize token
-            ByteArrayInputStream bais = new ByteArrayInputStream(tokenBaos.toByteArray());
-            DataInput in = new DataInputStream(bais);
-
-            Integer hashedToken = in.readInt();
-
-            // System.out.println(hashedToken);
-
-            Assert.assertEquals(expectedHashedUTF8Tokens.get(tokenCount), hashedToken);
-
-            tokenCount++;
-        }
-    }
-
-    @Test
-    public void testWordTokenizerWithUTF8Tokens() throws IOException {
-
-        UTF8WordTokenFactory tokenFactory = new UTF8WordTokenFactory();
-        DelimitedUTF8StringBinaryTokenizer tokenizer = new DelimitedUTF8StringBinaryTokenizer(true, false, tokenFactory);
-
-        tokenizer.reset(inputBuffer, 0, inputBuffer.length);
-
-        int tokenCount = 0;
-
-        while (tokenizer.hasNext()) {
-            tokenizer.next();
-
-            // serialize hashed token
-            ByteArrayOutputStream tokenBaos = new ByteArrayOutputStream();
-            DataOutput tokenDos = new DataOutputStream(tokenBaos);
-
-            IToken token = tokenizer.getToken();
-            token.serializeToken(tokenDos);
-
-            // deserialize token
-            ByteArrayInputStream bais = new ByteArrayInputStream(tokenBaos.toByteArray());
-            DataInput in = new DataInputStream(bais);
-
-            String strToken = in.readUTF();
-
-            // System.out.println(strToken);
-
-            Assert.assertEquals(expectedUTF8Tokens.get(tokenCount), strToken);
-
-            tokenCount++;
-        }
-    }
-
-    // JAQL
-    public int tokenHash(String token, int tokenCount) {
-        int h = AbstractUTF8Token.GOLDEN_RATIO_32;
-        for (int i = 0; i < token.length(); i++) {
-            h ^= token.charAt(i);
-            h *= AbstractUTF8Token.GOLDEN_RATIO_32;
-        }
-        return h + tokenCount;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-metadata/src/main/java/org/apache/asterix/metadata/external/ExternalFileIndexAccessor.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/external/ExternalFileIndexAccessor.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/external/ExternalFileIndexAccessor.java
index b88ed3a..ac975c4 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/external/ExternalFileIndexAccessor.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/external/ExternalFileIndexAccessor.java
@@ -54,6 +54,7 @@ import org.apache.hyracks.storage.am.lsm.common.api.ILSMIndexAccessorInternal;
 @SuppressWarnings({ "rawtypes", "unchecked" })
 public class ExternalFileIndexAccessor implements Serializable {
 
+    private final FilesIndexDescription filesIndexDescription = new FilesIndexDescription();
     private static final long serialVersionUID = 1L;
     private ExternalBTreeDataflowHelper indexDataflowHelper;
     private ExternalLoopkupOperatorDiscriptor opDesc;
@@ -119,7 +120,7 @@ public class ExternalFileIndexAccessor implements Serializable {
             int recordLength = tuple.getFieldLength(FilesIndexDescription.FILE_PAYLOAD_INDEX);
             ByteArrayInputStream stream = new ByteArrayInputStream(serRecord, recordStartOffset, recordLength);
             DataInput in = new DataInputStream(stream);
-            ARecord externalFileRecord = (ARecord) FilesIndexDescription.EXTERNAL_FILE_RECORD_SERDE.deserialize(in);
+            ARecord externalFileRecord = (ARecord) filesIndexDescription.EXTERNAL_FILE_RECORD_SERDE.deserialize(in);
             setExternalFileFromARecord(externalFileRecord, file);
         } else {
             // This should never happen

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-metadata/src/main/java/org/apache/asterix/metadata/external/ExternalLoopkupOperatorDiscriptor.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/external/ExternalLoopkupOperatorDiscriptor.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/external/ExternalLoopkupOperatorDiscriptor.java
index 07c8e5f..a7844ce 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/external/ExternalLoopkupOperatorDiscriptor.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/external/ExternalLoopkupOperatorDiscriptor.java
@@ -40,7 +40,6 @@ import org.apache.hyracks.storage.common.IStorageManagerInterface;
  * This operator is intended for using record ids to access data in external sources
  */
 public class ExternalLoopkupOperatorDiscriptor extends AbstractTreeIndexOperatorDescriptor {
-
     private static final long serialVersionUID = 1L;
     private final IControlledAdapterFactory adapterFactory;
     private final INullWriterFactory iNullWriterFactory;
@@ -53,8 +52,8 @@ public class ExternalLoopkupOperatorDiscriptor extends AbstractTreeIndexOperator
             ISearchOperationCallbackFactory searchOpCallbackFactory, boolean retainNull,
             INullWriterFactory iNullWriterFactory) {
         super(spec, 1, 1, outRecDesc, storageManager, lcManagerProvider, fileSplitProvider,
-                FilesIndexDescription.EXTERNAL_FILE_INDEX_TYPE_TRAITS,
-                FilesIndexDescription.FILES_INDEX_COMP_FACTORIES, FilesIndexDescription.BLOOM_FILTER_FIELDS,
+                new FilesIndexDescription().EXTERNAL_FILE_INDEX_TYPE_TRAITS,
+                new FilesIndexDescription().FILES_INDEX_COMP_FACTORIES, FilesIndexDescription.BLOOM_FILTER_FIELDS,
                 externalFilesIndexDataFlowHelperFactory, null, propagateInput, retainNull, iNullWriterFactory, null,
                 searchOpCallbackFactory, null);
         this.adapterFactory = adapterFactory;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-metadata/src/main/java/org/apache/asterix/metadata/external/FilesIndexDescription.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/external/FilesIndexDescription.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/external/FilesIndexDescription.java
index 0474ae5..cb4c0d2 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/external/FilesIndexDescription.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/external/FilesIndexDescription.java
@@ -41,58 +41,64 @@ public class FilesIndexDescription {
     public final static int FILE_KEY_INDEX = 0;
     public final static int FILE_KEY_SIZE = 1;
     public final static int FILE_PAYLOAD_INDEX = 1;
-    public static RecordDescriptor FILE_INDEX_RECORD_DESCRIPTOR;
-    public static RecordDescriptor FILE_BUDDY_BTREE_RECORD_DESCRIPTOR;
     public final static String[] payloadFieldNames = { "FileName", "FileSize", "FileModDate" };
     public final static IAType[] payloadFieldTypes = { BuiltinType.ASTRING, BuiltinType.AINT64, BuiltinType.ADATETIME };
-    public static ARecordType EXTERNAL_FILE_RECORD_TYPE;
-    public static ISerializerDeserializer EXTERNAL_FILE_RECORD_SERDE;
-    public static final ISerializerDeserializer[] EXTERNAL_FILE_BUDDY_BTREE_FIELDS = new ISerializerDeserializer[1];
-    public static final ITypeTraits[] EXTERNAL_FILE_BUDDY_BTREE_TYPE_TRAITS = new ITypeTraits[1];
-    public static final ISerializerDeserializer[] EXTERNAL_FILE_TUPLE_FIELDS = new ISerializerDeserializer[FILE_INDEX_TUPLE_SIZE];
-    public static final ITypeTraits[] EXTERNAL_FILE_INDEX_TYPE_TRAITS = new ITypeTraits[FILE_INDEX_TUPLE_SIZE];
-    public static final IBinaryComparatorFactory[] FILES_INDEX_COMP_FACTORIES = new IBinaryComparatorFactory[] { AqlBinaryComparatorFactoryProvider.INSTANCE
-            .getBinaryComparatorFactory(BuiltinType.AINT32, true) };
+
     public static final int[] BLOOM_FILTER_FIELDS = { 0 };
     public static final int EXTERNAL_FILE_NAME_FIELD_INDEX = 0;
     public static final int EXTERNAL_FILE_SIZE_FIELD_INDEX = 1;
     public static final int EXTERNAL_FILE_MOD_DATE_FIELD_INDEX = 2;
-    static {
-        try {
-            EXTERNAL_FILE_RECORD_TYPE = new ARecordType("ExternalFileRecordType", payloadFieldNames, payloadFieldTypes,
-                    true);
-            EXTERNAL_FILE_RECORD_SERDE = AqlSerializerDeserializerProvider.INSTANCE
-                    .getSerializerDeserializer(EXTERNAL_FILE_RECORD_TYPE);
 
-            EXTERNAL_FILE_TUPLE_FIELDS[FILE_KEY_INDEX] = AqlSerializerDeserializerProvider.INSTANCE
-                    .getSerializerDeserializer(IndexingConstants.FILE_NUMBER_FIELD_TYPE);
-            EXTERNAL_FILE_TUPLE_FIELDS[FILE_PAYLOAD_INDEX] = EXTERNAL_FILE_RECORD_SERDE;
-            EXTERNAL_FILE_BUDDY_BTREE_FIELDS[FILE_KEY_INDEX] = AqlSerializerDeserializerProvider.INSTANCE
-                    .getSerializerDeserializer(IndexingConstants.FILE_NUMBER_FIELD_TYPE);
+    public final ARecordType EXTERNAL_FILE_RECORD_TYPE;
+    public final ITypeTraits[] EXTERNAL_FILE_BUDDY_BTREE_TYPE_TRAITS = new ITypeTraits[1];
+    public final ITypeTraits[] EXTERNAL_FILE_INDEX_TYPE_TRAITS = new ITypeTraits[FILE_INDEX_TUPLE_SIZE];
 
-            EXTERNAL_FILE_INDEX_TYPE_TRAITS[FILE_KEY_INDEX] = AqlTypeTraitProvider.INSTANCE
-                    .getTypeTrait(IndexingConstants.FILE_NUMBER_FIELD_TYPE);
-            EXTERNAL_FILE_INDEX_TYPE_TRAITS[FILE_PAYLOAD_INDEX] = AqlTypeTraitProvider.INSTANCE
-                    .getTypeTrait(EXTERNAL_FILE_RECORD_TYPE);
-            EXTERNAL_FILE_BUDDY_BTREE_TYPE_TRAITS[FILE_KEY_INDEX] = AqlTypeTraitProvider.INSTANCE
-                    .getTypeTrait(IndexingConstants.FILE_NUMBER_FIELD_TYPE);
+    public final ISerializerDeserializer EXTERNAL_FILE_RECORD_SERDE;
+    public final RecordDescriptor FILE_INDEX_RECORD_DESCRIPTOR;
+    public final RecordDescriptor FILE_BUDDY_BTREE_RECORD_DESCRIPTOR;
+    public final ISerializerDeserializer[] EXTERNAL_FILE_BUDDY_BTREE_FIELDS = new ISerializerDeserializer[1];
+    public final ISerializerDeserializer[] EXTERNAL_FILE_TUPLE_FIELDS = new ISerializerDeserializer[FILE_INDEX_TUPLE_SIZE];
+    public final IBinaryComparatorFactory[] FILES_INDEX_COMP_FACTORIES = new IBinaryComparatorFactory[] {
+            AqlBinaryComparatorFactoryProvider.INSTANCE.getBinaryComparatorFactory(BuiltinType.AINT32, true) };
 
-            FILE_INDEX_RECORD_DESCRIPTOR = new RecordDescriptor(EXTERNAL_FILE_TUPLE_FIELDS,
-                    EXTERNAL_FILE_INDEX_TYPE_TRAITS);
-
-            FILE_BUDDY_BTREE_RECORD_DESCRIPTOR = new RecordDescriptor(EXTERNAL_FILE_BUDDY_BTREE_FIELDS,
-                    EXTERNAL_FILE_BUDDY_BTREE_TYPE_TRAITS);
+    public FilesIndexDescription() {
+        ARecordType type;
+        try {
+            type = new ARecordType("ExternalFileRecordType", payloadFieldNames,
+                    payloadFieldTypes, true);
         } catch (Exception e) {
             e.printStackTrace();
-            System.exit(1);
+            throw new RuntimeException(e);
         }
+        EXTERNAL_FILE_RECORD_TYPE = type;
+        EXTERNAL_FILE_INDEX_TYPE_TRAITS[FILE_KEY_INDEX] = AqlTypeTraitProvider.INSTANCE
+                .getTypeTrait(IndexingConstants.FILE_NUMBER_FIELD_TYPE);
+        EXTERNAL_FILE_INDEX_TYPE_TRAITS[FILE_PAYLOAD_INDEX] = AqlTypeTraitProvider.INSTANCE
+                .getTypeTrait(EXTERNAL_FILE_RECORD_TYPE);
+        EXTERNAL_FILE_BUDDY_BTREE_TYPE_TRAITS[FILE_KEY_INDEX] = AqlTypeTraitProvider.INSTANCE
+                .getTypeTrait(IndexingConstants.FILE_NUMBER_FIELD_TYPE);
+
+        EXTERNAL_FILE_RECORD_SERDE = AqlSerializerDeserializerProvider.INSTANCE
+                .getSerializerDeserializer(EXTERNAL_FILE_RECORD_TYPE);
+
+        EXTERNAL_FILE_TUPLE_FIELDS[FILE_KEY_INDEX] = AqlSerializerDeserializerProvider.INSTANCE
+                .getSerializerDeserializer(IndexingConstants.FILE_NUMBER_FIELD_TYPE);
+        EXTERNAL_FILE_TUPLE_FIELDS[FILE_PAYLOAD_INDEX] = EXTERNAL_FILE_RECORD_SERDE;
+        EXTERNAL_FILE_BUDDY_BTREE_FIELDS[FILE_KEY_INDEX] = AqlSerializerDeserializerProvider.INSTANCE
+                .getSerializerDeserializer(IndexingConstants.FILE_NUMBER_FIELD_TYPE);
+
+        FILE_INDEX_RECORD_DESCRIPTOR = new RecordDescriptor(EXTERNAL_FILE_TUPLE_FIELDS,
+                EXTERNAL_FILE_INDEX_TYPE_TRAITS);
+
+        FILE_BUDDY_BTREE_RECORD_DESCRIPTOR = new RecordDescriptor(EXTERNAL_FILE_BUDDY_BTREE_FIELDS,
+                EXTERNAL_FILE_BUDDY_BTREE_TYPE_TRAITS);
     }
 
     @SuppressWarnings("unchecked")
-    public static void getBuddyBTreeTupleFromFileNumber(ArrayTupleReference tuple, ArrayTupleBuilder tupleBuilder,
+    public void getBuddyBTreeTupleFromFileNumber(ArrayTupleReference tuple, ArrayTupleBuilder tupleBuilder,
             AMutableInt32 aInt32) throws IOException, AsterixException {
         tupleBuilder.reset();
-        FilesIndexDescription.FILE_BUDDY_BTREE_RECORD_DESCRIPTOR.getFields()[0].serialize(aInt32,
+        FILE_BUDDY_BTREE_RECORD_DESCRIPTOR.getFields()[0].serialize(aInt32,
                 tupleBuilder.getDataOutput());
         tupleBuilder.addFieldEndOffset();
         tuple.reset(tupleBuilder.getFieldEndOffsets(), tupleBuilder.getByteArray());

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/DatasetNameValueExtractor.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/DatasetNameValueExtractor.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/DatasetNameValueExtractor.java
index a1a5b5c..e79fe1c 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/DatasetNameValueExtractor.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/DatasetNameValueExtractor.java
@@ -25,6 +25,7 @@ import java.io.DataInputStream;
 
 import org.apache.asterix.common.transactions.JobId;
 import org.apache.asterix.dataflow.data.nontagged.serde.AObjectSerializerDeserializer;
+import org.apache.asterix.dataflow.data.nontagged.serde.AStringSerializerDeserializer;
 import org.apache.asterix.metadata.MetadataException;
 import org.apache.asterix.metadata.api.IValueExtractor;
 import org.apache.asterix.om.base.AString;
@@ -36,6 +37,8 @@ import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference;
  * contains a serialized representation of a Dataset metadata entity.
  */
 public class DatasetNameValueExtractor implements IValueExtractor<String> {
+    private final AObjectSerializerDeserializer aObjSerDer = new AObjectSerializerDeserializer();
+
     @Override
     public String getValue(JobId jobId, ITupleReference tuple) throws MetadataException, HyracksDataException {
         byte[] serRecord = tuple.getFieldData(2);
@@ -43,6 +46,6 @@ public class DatasetNameValueExtractor implements IValueExtractor<String> {
         int recordLength = tuple.getFieldLength(2);
         ByteArrayInputStream stream = new ByteArrayInputStream(serRecord, recordStartOffset, recordLength);
         DataInput in = new DataInputStream(stream);
-        return (((AString) AObjectSerializerDeserializer.INSTANCE.deserialize(in)).getStringValue());
+        return (((AString) aObjSerDer.deserialize(in)).getStringValue());
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/DatatypeNameValueExtractor.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/DatatypeNameValueExtractor.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/DatatypeNameValueExtractor.java
index 9d5e8b1..9a50a31 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/DatatypeNameValueExtractor.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/DatatypeNameValueExtractor.java
@@ -40,6 +40,7 @@ import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference;
 public class DatatypeNameValueExtractor implements IValueExtractor<String> {
     private final String dataverseName;
     private final MetadataNode metadataNode;
+    private final AObjectSerializerDeserializer aObjSerDer = new AObjectSerializerDeserializer();
 
     public DatatypeNameValueExtractor(String dataverseName, MetadataNode metadataNode) {
         this.dataverseName = dataverseName;
@@ -53,7 +54,7 @@ public class DatatypeNameValueExtractor implements IValueExtractor<String> {
         int recordLength = tuple.getFieldLength(2);
         ByteArrayInputStream stream = new ByteArrayInputStream(serRecord, recordStartOffset, recordLength);
         DataInput in = new DataInputStream(stream);
-        String typeName = ((AString) AObjectSerializerDeserializer.INSTANCE.deserialize(in)).getStringValue();
+        String typeName = ((AString) aObjSerDer.deserialize(in)).getStringValue();
         try {
             if (metadataNode.getDatatype(jobId, dataverseName, typeName).getIsAnonymous()) {
                 // Get index 0 because it is anonymous type, and it is used in

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/NestedDatatypeNameValueExtractor.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/NestedDatatypeNameValueExtractor.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/NestedDatatypeNameValueExtractor.java
index d046650..41d92c9 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/NestedDatatypeNameValueExtractor.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/valueextractors/NestedDatatypeNameValueExtractor.java
@@ -43,6 +43,7 @@ public class NestedDatatypeNameValueExtractor implements IValueExtractor<String>
     public NestedDatatypeNameValueExtractor(String datatypeName) {
         this.datatypeName = datatypeName;
     }
+    private final AObjectSerializerDeserializer aObjSerDer = new AObjectSerializerDeserializer();
 
     @Override
     public String getValue(JobId jobId, ITupleReference tuple) throws MetadataException, HyracksDataException {
@@ -51,13 +52,13 @@ public class NestedDatatypeNameValueExtractor implements IValueExtractor<String>
         int recordLength = tuple.getFieldLength(2);
         ByteArrayInputStream stream = new ByteArrayInputStream(serRecord, recordStartOffset, recordLength);
         DataInput in = new DataInputStream(stream);
-        String nestedType = ((AString) AObjectSerializerDeserializer.INSTANCE.deserialize(in)).getStringValue();
+        String nestedType = ((AString) aObjSerDer.deserialize(in)).getStringValue();
         if (nestedType.equals(datatypeName)) {
             recordStartOffset = tuple.getFieldStart(1);
             recordLength = tuple.getFieldLength(1);
             stream = new ByteArrayInputStream(serRecord, recordStartOffset, recordLength);
             in = new DataInputStream(stream);
-            return ((AString) AObjectSerializerDeserializer.INSTANCE.deserialize(in)).getStringValue();
+            return ((AString) aObjSerDer.deserialize(in)).getStringValue();
         }
         return null;
     }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-om/src/main/java/org/apache/asterix/builders/RecordBuilder.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/builders/RecordBuilder.java b/asterix-om/src/main/java/org/apache/asterix/builders/RecordBuilder.java
index d664e12..55ff32f 100644
--- a/asterix-om/src/main/java/org/apache/asterix/builders/RecordBuilder.java
+++ b/asterix-om/src/main/java/org/apache/asterix/builders/RecordBuilder.java
@@ -45,6 +45,7 @@ public class RecordBuilder implements IARecordBuilder {
     private final static int DEFAULT_NUM_OPEN_FIELDS = 10;
     private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
     private final static byte RECORD_TYPE_TAG = ATypeTag.RECORD.serialize();
+    private final UTF8StringSerializerDeserializer utf8SerDer = new UTF8StringSerializerDeserializer();
 
     private int openPartOffsetArraySize;
     private byte[] openPartOffsetArray;
@@ -226,9 +227,8 @@ public class RecordBuilder implements IARecordBuilder {
                 for (int i = 1; i < numberOfOpenFields; i++) {
                     if (utf8Comparator.compare(openBytes, (int) openPartOffsets[i - 1], openFieldNameLengths[i - 1],
                             openBytes, (int) openPartOffsets[i], openFieldNameLengths[i]) == 0) {
-                        String field = UTF8StringSerializerDeserializer.INSTANCE
-                                .deserialize(new DataInputStream(new ByteArrayInputStream(openBytes,
-                                        (int) openPartOffsets[i], openFieldNameLengths[i])));
+                        String field = utf8SerDer.deserialize(new DataInputStream(new ByteArrayInputStream(openBytes,
+                                (int) openPartOffsets[i], openFieldNameLengths[i])));
                         throw new AsterixException("Open fields " + (i - 1) + " and " + i
                                 + " have the same field name \"" + field + "\"");
                     }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-om/src/main/java/org/apache/asterix/dataflow/data/common/AListElementToken.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/common/AListElementToken.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/common/AListElementToken.java
index f019f10..a3bff52 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/common/AListElementToken.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/common/AListElementToken.java
@@ -26,8 +26,8 @@ import org.apache.hyracks.storage.am.lsm.invertedindex.tokenizers.IToken;
 public class AListElementToken implements IToken {
 
     protected byte[] data;
-    protected int start;
-    protected int length;
+    protected int startOffset;
+    protected int endOffset;
     protected int tokenLength;
     protected int typeTag;
 
@@ -37,13 +37,13 @@ public class AListElementToken implements IToken {
     }
 
     @Override
-    public int getLength() {
-        return length;
+    public int getEndOffset() {
+        return endOffset;
     }
 
     @Override
-    public int getStart() {
-        return start;
+    public int getStartOffset() {
+        return startOffset;
     }
 
     @Override
@@ -52,10 +52,10 @@ public class AListElementToken implements IToken {
     }
 
     @Override
-    public void reset(byte[] data, int start, int length, int tokenLength, int tokenCount) {
+    public void reset(byte[] data, int startOffset, int endOffset, int tokenLength, int tokenCount) {
         this.data = data;
-        this.start = start;
-        this.length = length;
+        this.startOffset = startOffset;
+        this.endOffset = endOffset;
         this.tokenLength = tokenLength;
         // We abuse the last param, tokenCount, to pass the type tag.
         typeTag = tokenCount;
@@ -64,7 +64,7 @@ public class AListElementToken implements IToken {
     @Override
     public void serializeToken(GrowableArray out) throws IOException {
         out.getDataOutput().writeByte(typeTag);
-        out.getDataOutput().write(data, start, length);
+        out.getDataOutput().write(data, startOffset, endOffset - startOffset);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-om/src/main/java/org/apache/asterix/dataflow/data/common/AOrderedListBinaryTokenizer.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/common/AOrderedListBinaryTokenizer.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/common/AOrderedListBinaryTokenizer.java
index 5f6e0b8..32207d3 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/common/AOrderedListBinaryTokenizer.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/common/AOrderedListBinaryTokenizer.java
@@ -59,9 +59,10 @@ public class AOrderedListBinaryTokenizer implements IBinaryTokenizer {
             itemOffset = getItemOffset(data, start, itemIndex);
             // Assuming homogeneous list.
             ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(data[start + 1]);
+            // ? Can we handle the non-string type ?
             length = NonTaggedFormatUtil.getFieldValueLength(data, itemOffset, typeTag, false);
             // Last param is a hack to pass the type tag.
-            token.reset(data, itemOffset, length, length, data[start + 1]);
+            token.reset(data, itemOffset, itemOffset + length, length, data[start + 1]);
         } catch (AsterixException e) {
             throw new IllegalStateException(e);
         }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/ListItemBinaryComparatorFactory.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/ListItemBinaryComparatorFactory.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/ListItemBinaryComparatorFactory.java
index 64b5610..767a343 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/ListItemBinaryComparatorFactory.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/comparators/ListItemBinaryComparatorFactory.java
@@ -19,7 +19,6 @@
 
 package org.apache.asterix.dataflow.data.nontagged.comparators;
 
-import org.apache.asterix.formats.nontagged.UTF8StringLowercasePointable;
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.asterix.om.types.EnumDeserializer;
 import org.apache.hyracks.api.dataflow.value.IBinaryComparator;
@@ -31,6 +30,7 @@ import org.apache.hyracks.data.std.primitive.DoublePointable;
 import org.apache.hyracks.data.std.primitive.FloatPointable;
 import org.apache.hyracks.data.std.primitive.IntegerPointable;
 import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+import org.apache.hyracks.data.std.primitive.UTF8StringLowercasePointable;
 
 public class ListItemBinaryComparatorFactory implements IBinaryComparatorFactory {
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/hash/ListItemBinaryHashFunctionFactory.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/hash/ListItemBinaryHashFunctionFactory.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/hash/ListItemBinaryHashFunctionFactory.java
index 6935f24..493833b 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/hash/ListItemBinaryHashFunctionFactory.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/hash/ListItemBinaryHashFunctionFactory.java
@@ -21,7 +21,6 @@ package org.apache.asterix.dataflow.data.nontagged.hash;
 
 import java.io.IOException;
 
-import org.apache.asterix.formats.nontagged.UTF8StringLowercasePointable;
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.asterix.om.types.EnumDeserializer;
 import org.apache.hyracks.api.dataflow.value.IBinaryHashFunction;
@@ -29,6 +28,7 @@ import org.apache.hyracks.api.dataflow.value.IBinaryHashFunctionFactory;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.data.std.accessors.MurmurHash3BinaryHashFunctionFamily;
 import org.apache.hyracks.data.std.accessors.PointableBinaryHashFunctionFactory;
+import org.apache.hyracks.data.std.primitive.UTF8StringLowercasePointable;
 import org.apache.hyracks.data.std.util.GrowableArray;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/PrintTools.java
----------------------------------------------------------------------
diff --git a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/PrintTools.java b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/PrintTools.java
index 596e168..7d88a90 100644
--- a/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/PrintTools.java
+++ b/asterix-om/src/main/java/org/apache/asterix/dataflow/data/nontagged/printers/PrintTools.java
@@ -29,8 +29,13 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.io.PrintStream;
 
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+import org.apache.hyracks.util.bytes.HexPrinter;
+import org.apache.hyracks.util.string.UTF8StringUtil;
+
 public class PrintTools {
 
+
     private static final GregorianCalendarSystem gCalInstance = GregorianCalendarSystem.getInstance();
     private static long CHRONON_OF_DAY = 24 * 60 * 60 * 1000;
 
@@ -185,13 +190,13 @@ public class PrintTools {
     }
 
     public static void writeUTF8StringAsCSV(byte[] b, int s, int l, OutputStream os) throws IOException {
-        int stringLength = UTF8StringPointable.getUTFLength(b, s);
-        int position = s + 2; // skip 2 bytes containing string size
+        int stringLength = UTF8StringUtil.getUTFLength(b, s);
+        int position = s + UTF8StringUtil.getNumBytesToStoreLength(stringLength);
         int maxPosition = position + stringLength;
         os.write('"');
         while (position < maxPosition) {
-            char c = UTF8StringPointable.charAt(b, position);
-            int sz = UTF8StringPointable.charSize(b, position);
+            char c = UTF8StringUtil.charAt(b, position);
+            int sz = UTF8StringUtil.charSize(b, position);
             if (c == '"') {
                 os.write('"');
             }
@@ -202,13 +207,13 @@ public class PrintTools {
     }
 
     public static void writeUTF8StringAsJSON(byte[] b, int s, int l, OutputStream os) throws IOException {
-        int stringLength = UTF8StringPointable.getUTFLength(b, s);
-        int position = s + 2; // skip 2 bytes containing string size
-        int maxPosition = position + stringLength;
+        int utfLength = UTF8StringUtil.getUTFLength(b, s);
+        int position = s + UTF8StringUtil.getNumBytesToStoreLength(utfLength); // skip 2 bytes containing string size
+        int maxPosition = position + utfLength;
         os.write('"');
         while (position < maxPosition) {
-            char c = UTF8StringPointable.charAt(b, position);
-            int sz = UTF8StringPointable.charSize(b, position);
+            char c = UTF8StringUtil.charAt(b, position);
+            int sz = UTF8StringUtil.charSize(b, position);
             switch (c) {
                 // escape
                 case '\b':
@@ -296,27 +301,9 @@ public class PrintTools {
         os.write('u');
         os.write('0');
         os.write('0');
-        os.write(hex((c >>> 4) & 0x0f, CASE.LOWER_CASE));
-        os.write(hex(c & 0x0f, CASE.LOWER_CASE));
+        os.write(HexPrinter.hex((c >>> 4) & 0x0f, HexPrinter.CASE.LOWER_CASE));
+        os.write(HexPrinter.hex(c & 0x0f, HexPrinter.CASE.LOWER_CASE));
     }
 
-    public static Appendable printHexString(byte[] bytes, int start, int length, Appendable appendable)
-            throws IOException {
-        for (int i = 0; i < length; ++i) {
-            appendable.append((char) hex((bytes[start + i] >>> 4) & 0x0f, CASE.UPPER_CASE));
-            appendable.append((char) hex((bytes[start + i] & 0x0f), CASE.UPPER_CASE));
-        }
-        return appendable;
-    }
-
-    public static byte hex(int i, CASE c) {
-        switch (c) {
-            case LOWER_CASE:
-                return (byte) (i < 10 ? i + '0' : i + ('a' - 10));
-            case UPPER_CASE:
-                return (byte) (i < 10 ? i + '0' : i + ('A' - 10));
-        }
-        return Byte.parseByte(null);
-    }
 
 }


[08/15] incubator-asterixdb git commit: ASTERIXDB-1102: VarSize Encoding to store length of String and ByteArray

Posted by ji...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/results/binary/find/find.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/binary/find/find.1.adm b/asterix-app/src/test/resources/runtimets/results/binary/find/find.1.adm
index 9e639d6..4f811a2 100644
--- a/asterix-app/src/test/resources/runtimets/results/binary/find/find.1.adm
+++ b/asterix-app/src/test/resources/runtimets/results/binary/find/find.1.adm
@@ -1,2 +1,2 @@
-[ [ true, null, null, null ]
+[ [ true, true, true, true, true, true, true, null, null, null ]
  ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/results/binary/subbinary/subbinary.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/binary/subbinary/subbinary.1.adm b/asterix-app/src/test/resources/runtimets/results/binary/subbinary/subbinary.1.adm
index 975a5f0..d1a46d0 100644
--- a/asterix-app/src/test/resources/runtimets/results/binary/subbinary/subbinary.1.adm
+++ b/asterix-app/src/test/resources/runtimets/results/binary/subbinary/subbinary.1.adm
@@ -1,2 +1,2 @@
-[ true
+[ [ true, true, true, true, true, true, true, true, true, true, true, true, true, true ]
  ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/results/nested-index-dml/delete-from-loaded-dataset-with-index/delete-from-loaded-dataset-with-index.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/nested-index-dml/delete-from-loaded-dataset-with-index/delete-from-loaded-dataset-with-index.1.adm b/asterix-app/src/test/resources/runtimets/results/nested-index-dml/delete-from-loaded-dataset-with-index/delete-from-loaded-dataset-with-index.1.adm
index 8429702..9b7d762 100644
--- a/asterix-app/src/test/resources/runtimets/results/nested-index-dml/delete-from-loaded-dataset-with-index/delete-from-loaded-dataset-with-index.1.adm
+++ b/asterix-app/src/test/resources/runtimets/results/nested-index-dml/delete-from-loaded-dataset-with-index/delete-from-loaded-dataset-with-index.1.adm
@@ -1,5 +1,5 @@
 [ { "tweetid": "10", "user": { "screen-name": "ColineGeyer@63", "lang": "en", "friends_count": 121, "statuses_count": 362, "name": "Coline Geyer", "followers_count": 17159 }, "sender-location": point("29.15,76.53"), "send-time": datetime("2008-01-26T10:10:00.000Z"), "referred-topics": {{ "verizon", "voice-clarity" }}, "message-text": " hate verizon its voice-clarity is OMG:(" }
-, { "tweetid": "6", "user": { "screen-name": "ColineGeyer@63", "lang": "en", "friends_count": 121, "statuses_count": 362, "name": "Coline Geyer", "followers_count": 17159 }, "sender-location": point("47.51,83.99"), "send-time": datetime("2010-05-07T10:10:00.000Z"), "referred-topics": {{ "iphone", "voice-clarity" }}, "message-text": " like iphone the voice-clarity is good:)" }
 , { "tweetid": "11", "user": { "screen-name": "NilaMilliron_tw", "lang": "en", "friends_count": 445, "statuses_count": 164, "name": "Nila Milliron", "followers_count": 22649 }, "sender-location": point("37.59,68.42"), "send-time": datetime("2008-03-09T10:10:00.000Z"), "referred-topics": {{ "iphone", "platform" }}, "message-text": " can't stand iphone its platform is terrible" }
-, { "tweetid": "2", "user": { "screen-name": "ColineGeyer@63", "lang": "en", "friends_count": 121, "statuses_count": 362, "name": "Coline Geyer", "followers_count": 17159 }, "sender-location": point("32.84,67.14"), "send-time": datetime("2010-05-13T10:10:00.000Z"), "referred-topics": {{ "verizon", "shortcut-menu" }}, "message-text": " like verizon its shortcut-menu is awesome:)" }
+, { "tweetid": "2", "user": { "screen-name": "ColineGeyer@63", "lang": "en", "friends_count": 121, "statuses_count": 362, "name": "Coline Geyer", "followers_count": 17159 }, "sender-location": point("32.84,67.14"), "send-time": datetime("2010-05-13T10:10:00.000Z"), "referred-topics": {{ "verizon", "shortcut-menu" }}, "message-text": " like verizon its shortcut-menu is awesome:)" } 
+, { "tweetid": "6", "user": { "screen-name": "ColineGeyer@63", "lang": "en", "friends_count": 121, "statuses_count": 362, "name": "Coline Geyer", "followers_count": 17159 }, "sender-location": point("47.51,83.99"), "send-time": datetime("2010-05-07T10:10:00.000Z"), "referred-topics": {{ "iphone", "voice-clarity" }}, "message-text": " like iphone the voice-clarity is good:)" }
  ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/results/nested-index-dml/insert-into-loaded-dataset-with-index_02/insert-into-loaded-dataset-with-index_02.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/nested-index-dml/insert-into-loaded-dataset-with-index_02/insert-into-loaded-dataset-with-index_02.1.adm b/asterix-app/src/test/resources/runtimets/results/nested-index-dml/insert-into-loaded-dataset-with-index_02/insert-into-loaded-dataset-with-index_02.1.adm
index 12c16d1..22b519d 100644
--- a/asterix-app/src/test/resources/runtimets/results/nested-index-dml/insert-into-loaded-dataset-with-index_02/insert-into-loaded-dataset-with-index_02.1.adm
+++ b/asterix-app/src/test/resources/runtimets/results/nested-index-dml/insert-into-loaded-dataset-with-index_02/insert-into-loaded-dataset-with-index_02.1.adm
@@ -1,5 +1,5 @@
 [ { "tweetid": "10", "user": { "screen-name": "ColineGeyer@63", "lang": "en", "friends_count": 121, "statuses_count": 362, "name": "Coline Geyer", "followers_count": 17159 }, "sender-location": point("29.15,76.53"), "send-time": datetime("2008-01-26T10:10:00.000Z"), "referred-topics": {{ "verizon", "voice-clarity" }}, "message-text": " hate verizon its voice-clarity is OMG:(" }
+, { "tweetid": "2", "user": { "screen-name": "ColineGeyer@63", "lang": "en", "friends_count": 121, "statuses_count": 362, "name": "Coline Geyer", "followers_count": 17159 }, "sender-location": point("32.84,67.14"), "send-time": datetime("2010-05-13T10:10:00.000Z"), "referred-topics": {{ "verizon", "shortcut-menu" }}, "message-text": " like verizon its shortcut-menu is awesome:)" }
 , { "tweetid": "6", "user": { "screen-name": "ColineGeyer@63", "lang": "en", "friends_count": 121, "statuses_count": 362, "name": "Coline Geyer", "followers_count": 17159 }, "sender-location": point("47.51,83.99"), "send-time": datetime("2010-05-07T10:10:00.000Z"), "referred-topics": {{ "iphone", "voice-clarity" }}, "message-text": " like iphone the voice-clarity is good:)" }
 , { "tweetid": "7", "user": { "screen-name": "ChangEwing_573", "lang": "en", "friends_count": 182, "statuses_count": 394, "name": "Chang Ewing", "followers_count": 32136 }, "sender-location": point("36.21,72.6"), "send-time": datetime("2011-08-25T10:10:00.000Z"), "referred-topics": {{ "samsung", "platform" }}, "message-text": " like samsung the platform is good" }
-, { "tweetid": "2", "user": { "screen-name": "ColineGeyer@63", "lang": "en", "friends_count": 121, "statuses_count": 362, "name": "Coline Geyer", "followers_count": 17159 }, "sender-location": point("32.84,67.14"), "send-time": datetime("2010-05-13T10:10:00.000Z"), "referred-topics": {{ "verizon", "shortcut-menu" }}, "message-text": " like verizon its shortcut-menu is awesome:)" }
  ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/results/string/end-with1/end-with1.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/string/end-with1/end-with1.1.adm b/asterix-app/src/test/resources/runtimets/results/string/end-with1/end-with1.1.adm
deleted file mode 100644
index e452ee2..0000000
--- a/asterix-app/src/test/resources/runtimets/results/string/end-with1/end-with1.1.adm
+++ /dev/null
@@ -1,2 +0,0 @@
-[ { "result1": false }
- ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/results/string/end-with2/end-with2.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/string/end-with2/end-with2.1.adm b/asterix-app/src/test/resources/runtimets/results/string/end-with2/end-with2.1.adm
deleted file mode 100644
index 792013a..0000000
--- a/asterix-app/src/test/resources/runtimets/results/string/end-with2/end-with2.1.adm
+++ /dev/null
@@ -1,2 +0,0 @@
-[ { "result1": true }
- ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/results/string/end-with3/end-with3.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/string/end-with3/end-with3.1.adm b/asterix-app/src/test/resources/runtimets/results/string/end-with3/end-with3.1.adm
deleted file mode 100644
index 792013a..0000000
--- a/asterix-app/src/test/resources/runtimets/results/string/end-with3/end-with3.1.adm
+++ /dev/null
@@ -1,2 +0,0 @@
-[ { "result1": true }
- ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/results/string/end-with4/end-with4.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/string/end-with4/end-with4.1.adm b/asterix-app/src/test/resources/runtimets/results/string/end-with4/end-with4.1.adm
deleted file mode 100644
index e452ee2..0000000
--- a/asterix-app/src/test/resources/runtimets/results/string/end-with4/end-with4.1.adm
+++ /dev/null
@@ -1,2 +0,0 @@
-[ { "result1": false }
- ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/results/string/end-with5/end-with5.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/string/end-with5/end-with5.1.adm b/asterix-app/src/test/resources/runtimets/results/string/end-with5/end-with5.1.adm
deleted file mode 100644
index 3d1cf35..0000000
--- a/asterix-app/src/test/resources/runtimets/results/string/end-with5/end-with5.1.adm
+++ /dev/null
@@ -1,2 +0,0 @@
-[ { "f1": true, "f2": false, "f3": true, "f4": false, "f5": true, "f6": false }
- ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/results/string/ends-with1/ends-with1.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/string/ends-with1/ends-with1.1.adm b/asterix-app/src/test/resources/runtimets/results/string/ends-with1/ends-with1.1.adm
new file mode 100644
index 0000000..e452ee2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/string/ends-with1/ends-with1.1.adm
@@ -0,0 +1,2 @@
+[ { "result1": false }
+ ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/results/string/ends-with2/ends-with2.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/string/ends-with2/ends-with2.1.adm b/asterix-app/src/test/resources/runtimets/results/string/ends-with2/ends-with2.1.adm
new file mode 100644
index 0000000..792013a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/string/ends-with2/ends-with2.1.adm
@@ -0,0 +1,2 @@
+[ { "result1": true }
+ ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/results/string/ends-with3/ends-with3.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/string/ends-with3/ends-with3.1.adm b/asterix-app/src/test/resources/runtimets/results/string/ends-with3/ends-with3.1.adm
new file mode 100644
index 0000000..792013a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/string/ends-with3/ends-with3.1.adm
@@ -0,0 +1,2 @@
+[ { "result1": true }
+ ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/results/string/ends-with4/ends-with4.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/string/ends-with4/ends-with4.1.adm b/asterix-app/src/test/resources/runtimets/results/string/ends-with4/ends-with4.1.adm
new file mode 100644
index 0000000..e452ee2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/string/ends-with4/ends-with4.1.adm
@@ -0,0 +1,2 @@
+[ { "result1": false }
+ ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/results/string/ends-with5/ends-with5.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/string/ends-with5/ends-with5.1.adm b/asterix-app/src/test/resources/runtimets/results/string/ends-with5/ends-with5.1.adm
new file mode 100644
index 0000000..7ef4d67
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/string/ends-with5/ends-with5.1.adm
@@ -0,0 +1,2 @@
+[ { "f1": true, "f2": null, "f3": null, "f4": null, "f5": true, "f6": null }
+ ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/results/string/ends-with6/ends-with6.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/string/ends-with6/ends-with6.1.adm b/asterix-app/src/test/resources/runtimets/results/string/ends-with6/ends-with6.1.adm
new file mode 100644
index 0000000..9a8b5dc
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/string/ends-with6/ends-with6.1.adm
@@ -0,0 +1,2 @@
+[ [ false, true ]
+ ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/results/string/ends-with7/ends-with7.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/string/ends-with7/ends-with7.1.adm b/asterix-app/src/test/resources/runtimets/results/string/ends-with7/ends-with7.1.adm
new file mode 100644
index 0000000..f6ec4a3
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/string/ends-with7/ends-with7.1.adm
@@ -0,0 +1,7 @@
+[ false
+, false
+, true
+, true
+, true
+, true
+ ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/results/string/ends-with8/ends-with8.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/string/ends-with8/ends-with8.1.adm b/asterix-app/src/test/resources/runtimets/results/string/ends-with8/ends-with8.1.adm
new file mode 100644
index 0000000..f696fc1
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/string/ends-with8/ends-with8.1.adm
@@ -0,0 +1,5 @@
+[ { "name": "I am Jones" }
+, { "name": "Jim Jones" }
+, { "name": "Marian Jones" }
+, { "name": "Phil Jones" }
+ ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/results/string/ends-with_01/ends-with_01.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/string/ends-with_01/ends-with_01.1.adm b/asterix-app/src/test/resources/runtimets/results/string/ends-with_01/ends-with_01.1.adm
deleted file mode 100644
index 9a8b5dc..0000000
--- a/asterix-app/src/test/resources/runtimets/results/string/ends-with_01/ends-with_01.1.adm
+++ /dev/null
@@ -1,2 +0,0 @@
-[ [ false, true ]
- ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/results/string/endwith02/endwith02.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/string/endwith02/endwith02.1.adm b/asterix-app/src/test/resources/runtimets/results/string/endwith02/endwith02.1.adm
deleted file mode 100644
index f6ec4a3..0000000
--- a/asterix-app/src/test/resources/runtimets/results/string/endwith02/endwith02.1.adm
+++ /dev/null
@@ -1,7 +0,0 @@
-[ false
-, false
-, true
-, true
-, true
-, true
- ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/results/string/endwith03/endwith03.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/string/endwith03/endwith03.1.adm b/asterix-app/src/test/resources/runtimets/results/string/endwith03/endwith03.1.adm
deleted file mode 100644
index f696fc1..0000000
--- a/asterix-app/src/test/resources/runtimets/results/string/endwith03/endwith03.1.adm
+++ /dev/null
@@ -1,5 +0,0 @@
-[ { "name": "I am Jones" }
-, { "name": "Jim Jones" }
-, { "name": "Marian Jones" }
-, { "name": "Phil Jones" }
- ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/results/string/matches11/matches11.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/string/matches11/matches11.1.adm b/asterix-app/src/test/resources/runtimets/results/string/matches11/matches11.1.adm
index 51bc6cf..36fc447 100644
--- a/asterix-app/src/test/resources/runtimets/results/string/matches11/matches11.1.adm
+++ b/asterix-app/src/test/resources/runtimets/results/string/matches11/matches11.1.adm
@@ -1,6 +1,7 @@
-[ false
-, false
+[ null
+, null
 , false
 , false
+, null
 , false
  ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/results/string/matchesnull/matchesnull.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/string/matchesnull/matchesnull.1.adm b/asterix-app/src/test/resources/runtimets/results/string/matchesnull/matchesnull.1.adm
index 5721c80..3e9f513 100644
--- a/asterix-app/src/test/resources/runtimets/results/string/matchesnull/matchesnull.1.adm
+++ b/asterix-app/src/test/resources/runtimets/results/string/matchesnull/matchesnull.1.adm
@@ -1,2 +1,2 @@
-[ { "result1": false, "result2": false, "result3": true, "result4": false, "result5": false, "result6": true }
+[ { "result1": null, "result2": null, "result3": null, "result4": null, "result5": null, "result6": null }
  ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/results/string/start-with1/start-with1.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/string/start-with1/start-with1.1.adm b/asterix-app/src/test/resources/runtimets/results/string/start-with1/start-with1.1.adm
deleted file mode 100644
index 792013a..0000000
--- a/asterix-app/src/test/resources/runtimets/results/string/start-with1/start-with1.1.adm
+++ /dev/null
@@ -1,2 +0,0 @@
-[ { "result1": true }
- ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/results/string/start-with2/start-with2.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/string/start-with2/start-with2.1.adm b/asterix-app/src/test/resources/runtimets/results/string/start-with2/start-with2.1.adm
deleted file mode 100644
index e452ee2..0000000
--- a/asterix-app/src/test/resources/runtimets/results/string/start-with2/start-with2.1.adm
+++ /dev/null
@@ -1,2 +0,0 @@
-[ { "result1": false }
- ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/results/string/start-with3/start-with3.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/string/start-with3/start-with3.1.adm b/asterix-app/src/test/resources/runtimets/results/string/start-with3/start-with3.1.adm
deleted file mode 100644
index 792013a..0000000
--- a/asterix-app/src/test/resources/runtimets/results/string/start-with3/start-with3.1.adm
+++ /dev/null
@@ -1,2 +0,0 @@
-[ { "result1": true }
- ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/results/string/start-with4/start-with4.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/string/start-with4/start-with4.1.adm b/asterix-app/src/test/resources/runtimets/results/string/start-with4/start-with4.1.adm
deleted file mode 100644
index 3d1cf35..0000000
--- a/asterix-app/src/test/resources/runtimets/results/string/start-with4/start-with4.1.adm
+++ /dev/null
@@ -1,2 +0,0 @@
-[ { "f1": true, "f2": false, "f3": true, "f4": false, "f5": true, "f6": false }
- ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/results/string/start-with5/start-with5.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/string/start-with5/start-with5.1.adm b/asterix-app/src/test/resources/runtimets/results/string/start-with5/start-with5.1.adm
deleted file mode 100644
index e452ee2..0000000
--- a/asterix-app/src/test/resources/runtimets/results/string/start-with5/start-with5.1.adm
+++ /dev/null
@@ -1,2 +0,0 @@
-[ { "result1": false }
- ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/results/string/starts-with1/starts-with1.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/string/starts-with1/starts-with1.1.adm b/asterix-app/src/test/resources/runtimets/results/string/starts-with1/starts-with1.1.adm
new file mode 100644
index 0000000..792013a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/string/starts-with1/starts-with1.1.adm
@@ -0,0 +1,2 @@
+[ { "result1": true }
+ ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/results/string/starts-with2/starts-with2.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/string/starts-with2/starts-with2.1.adm b/asterix-app/src/test/resources/runtimets/results/string/starts-with2/starts-with2.1.adm
new file mode 100644
index 0000000..e452ee2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/string/starts-with2/starts-with2.1.adm
@@ -0,0 +1,2 @@
+[ { "result1": false }
+ ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/results/string/starts-with3/starts-with3.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/string/starts-with3/starts-with3.1.adm b/asterix-app/src/test/resources/runtimets/results/string/starts-with3/starts-with3.1.adm
new file mode 100644
index 0000000..792013a
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/string/starts-with3/starts-with3.1.adm
@@ -0,0 +1,2 @@
+[ { "result1": true }
+ ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/results/string/starts-with4/starts-with4.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/string/starts-with4/starts-with4.1.adm b/asterix-app/src/test/resources/runtimets/results/string/starts-with4/starts-with4.1.adm
new file mode 100644
index 0000000..7ef4d67
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/string/starts-with4/starts-with4.1.adm
@@ -0,0 +1,2 @@
+[ { "f1": true, "f2": null, "f3": null, "f4": null, "f5": true, "f6": null }
+ ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/results/string/starts-with5/starts-with5.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/string/starts-with5/starts-with5.1.adm b/asterix-app/src/test/resources/runtimets/results/string/starts-with5/starts-with5.1.adm
new file mode 100644
index 0000000..e452ee2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/string/starts-with5/starts-with5.1.adm
@@ -0,0 +1,2 @@
+[ { "result1": false }
+ ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/results/string/starts-with6/starts-with6.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/string/starts-with6/starts-with6.1.adm b/asterix-app/src/test/resources/runtimets/results/string/starts-with6/starts-with6.1.adm
new file mode 100644
index 0000000..9a8b5dc
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/string/starts-with6/starts-with6.1.adm
@@ -0,0 +1,2 @@
+[ [ false, true ]
+ ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/results/string/starts-with7/starts-with7.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/string/starts-with7/starts-with7.1.adm b/asterix-app/src/test/resources/runtimets/results/string/starts-with7/starts-with7.1.adm
new file mode 100644
index 0000000..eae1439
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/string/starts-with7/starts-with7.1.adm
@@ -0,0 +1,16 @@
+[ null
+, true
+, false
+, true
+, false
+, null 
+, true
+, true
+, false
+, true
+, false
+, true
+, true
+, false
+, false
+ ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/results/string/starts-with8/starts-with8.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/string/starts-with8/starts-with8.1.adm b/asterix-app/src/test/resources/runtimets/results/string/starts-with8/starts-with8.1.adm
new file mode 100644
index 0000000..3ff35f7
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/string/starts-with8/starts-with8.1.adm
@@ -0,0 +1,6 @@
+[ { "name": "John Doe" }
+, { "name": "John Smith" }
+, { "name": "John Wayne" }
+, { "name": "Johnny Walker" }
+, { "name": "Johnson Ben" }
+ ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/results/string/starts-with_01/starts-with_01.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/string/starts-with_01/starts-with_01.1.adm b/asterix-app/src/test/resources/runtimets/results/string/starts-with_01/starts-with_01.1.adm
deleted file mode 100644
index 9a8b5dc..0000000
--- a/asterix-app/src/test/resources/runtimets/results/string/starts-with_01/starts-with_01.1.adm
+++ /dev/null
@@ -1,2 +0,0 @@
-[ [ false, true ]
- ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/results/string/startwith02/startwith02.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/string/startwith02/startwith02.1.adm b/asterix-app/src/test/resources/runtimets/results/string/startwith02/startwith02.1.adm
deleted file mode 100644
index 933ea38..0000000
--- a/asterix-app/src/test/resources/runtimets/results/string/startwith02/startwith02.1.adm
+++ /dev/null
@@ -1,15 +0,0 @@
-[ true
-, false
-, true
-, false
-, false
-, true
-, true
-, false
-, true
-, false
-, true
-, true
-, false
-, false
- ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/results/string/startwith03/startwith03.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/string/startwith03/startwith03.1.adm b/asterix-app/src/test/resources/runtimets/results/string/startwith03/startwith03.1.adm
deleted file mode 100644
index 3ff35f7..0000000
--- a/asterix-app/src/test/resources/runtimets/results/string/startwith03/startwith03.1.adm
+++ /dev/null
@@ -1,6 +0,0 @@
-[ { "name": "John Doe" }
-, { "name": "John Smith" }
-, { "name": "John Wayne" }
-, { "name": "Johnny Walker" }
-, { "name": "Johnson Ben" }
- ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/results/string/string-equal4/string-equal4.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/string/string-equal4/string-equal4.1.adm b/asterix-app/src/test/resources/runtimets/results/string/string-equal4/string-equal4.1.adm
index 84836dc..07187b3 100644
--- a/asterix-app/src/test/resources/runtimets/results/string/string-equal4/string-equal4.1.adm
+++ b/asterix-app/src/test/resources/runtimets/results/string/string-equal4/string-equal4.1.adm
@@ -1,2 +1,2 @@
-[ { "result1": true, "result3": false, "result4": false, "result5": true }
+[ { "result1": true, "result3": null, "result4": null, "result5": null }
  ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/results/string/varlen-encoding/varlen-encoding.1.adm
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/results/string/varlen-encoding/varlen-encoding.1.adm b/asterix-app/src/test/resources/runtimets/results/string/varlen-encoding/varlen-encoding.1.adm
new file mode 100644
index 0000000..12b6cef
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/string/varlen-encoding/varlen-encoding.1.adm
@@ -0,0 +1,2 @@
+[ [ 127, 128, 256, 1024, 4096, 16384, 65536, 262144, 1048576, 4194304, 16777216 ]
+ ]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/testsuite.xml
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/testsuite.xml b/asterix-app/src/test/resources/runtimets/testsuite.xml
index b6417bc..097805e 100644
--- a/asterix-app/src/test/resources/runtimets/testsuite.xml
+++ b/asterix-app/src/test/resources/runtimets/testsuite.xml
@@ -18,9 +18,9 @@
  !-->
 <!DOCTYPE test-suite [
 
-<!ENTITY RecordsQueries SYSTEM "queries/records/RecordsQueries.xml">
+        <!ENTITY RecordsQueries SYSTEM "queries/records/RecordsQueries.xml">
 
-]>
+        ]>
 <test-suite
         xmlns="urn:xml.testframework.asterix.apache.org"
         ResultOffsetPath="results"
@@ -4810,43 +4810,43 @@
             </compilation-unit>
         </test-case>
         <test-case FilePath="string">
-            <compilation-unit name="end-with1">
-                <output-dir compare="Text">end-with1</output-dir>
+            <compilation-unit name="ends-with1">
+                <output-dir compare="Text">ends-with1</output-dir>
             </compilation-unit>
         </test-case>
         <test-case FilePath="string">
-            <compilation-unit name="end-with2">
-                <output-dir compare="Text">end-with2</output-dir>
+            <compilation-unit name="ends-with2">
+                <output-dir compare="Text">ends-with2</output-dir>
             </compilation-unit>
         </test-case>
         <test-case FilePath="string">
-            <compilation-unit name="end-with3">
-                <output-dir compare="Text">end-with3</output-dir>
+            <compilation-unit name="ends-with3">
+                <output-dir compare="Text">ends-with3</output-dir>
             </compilation-unit>
         </test-case>
         <test-case FilePath="string">
-            <compilation-unit name="end-with4">
-                <output-dir compare="Text">end-with4</output-dir>
+            <compilation-unit name="ends-with4">
+                <output-dir compare="Text">ends-with4</output-dir>
             </compilation-unit>
         </test-case>
         <test-case FilePath="string">
-            <compilation-unit name="end-with5">
-                <output-dir compare="Text">end-with5</output-dir>
+            <compilation-unit name="ends-with5">
+                <output-dir compare="Text">ends-with5</output-dir>
             </compilation-unit>
         </test-case>
         <test-case FilePath="string">
-            <compilation-unit name="ends-with_01">
-                <output-dir compare="Text">ends-with_01</output-dir>
+            <compilation-unit name="ends-with6">
+                <output-dir compare="Text">ends-with6</output-dir>
             </compilation-unit>
         </test-case>
         <test-case FilePath="string">
-            <compilation-unit name="endwith02">
-                <output-dir compare="Text">endwith02</output-dir>
+            <compilation-unit name="ends-with7">
+                <output-dir compare="Text">ends-with7</output-dir>
             </compilation-unit>
         </test-case>
         <test-case FilePath="string">
-            <compilation-unit name="endwith03">
-                <output-dir compare="Text">endwith03</output-dir>
+            <compilation-unit name="ends-with8">
+                <output-dir compare="Text">ends-with8</output-dir>
             </compilation-unit>
         </test-case>
         <test-case FilePath="string">
@@ -4975,44 +4975,44 @@
             </compilation-unit>
         </test-case>
         <test-case FilePath="string">
-            <compilation-unit name="start-with1">
-                <output-dir compare="Text">start-with1</output-dir>
+            <compilation-unit name="starts-with1">
+                <output-dir compare="Text">starts-with1</output-dir>
             </compilation-unit>
         </test-case>
         <test-case FilePath="string">
-            <compilation-unit name="start-with2">
-                <output-dir compare="Text">start-with2</output-dir>
+            <compilation-unit name="starts-with2">
+                <output-dir compare="Text">starts-with2</output-dir>
             </compilation-unit>
         </test-case>
         <test-case FilePath="string">
-            <compilation-unit name="start-with3">
-                <output-dir compare="Text">start-with3</output-dir>
+            <compilation-unit name="starts-with3">
+                <output-dir compare="Text">starts-with3</output-dir>
             </compilation-unit>
         </test-case>
         <test-case FilePath="string">
-            <compilation-unit name="start-with4">
-                <output-dir compare="Text">start-with4</output-dir>
+            <compilation-unit name="starts-with4">
+                <output-dir compare="Text">starts-with4</output-dir>
             </compilation-unit>
         </test-case>
         <test-case FilePath="string">
-            <compilation-unit name="start-with5">
-                <output-dir compare="Text">start-with5</output-dir>
+            <compilation-unit name="starts-with5">
+                <output-dir compare="Text">starts-with5</output-dir>
             </compilation-unit>
         </test-case>
         <test-case FilePath="string">
-            <compilation-unit name="starts-with_01">
-                <output-dir compare="Text">starts-with_01</output-dir>
+            <compilation-unit name="starts-with6">
+                <output-dir compare="Text">starts-with6</output-dir>
             </compilation-unit>
         </test-case>
         <test-case FilePath="string">
-            <compilation-unit name="startwith02">
-                <output-dir compare="Text">startwith02</output-dir>
+            <compilation-unit name="starts-with7">
+                <output-dir compare="Text">starts-with7</output-dir>
             </compilation-unit>
         </test-case>
         <!--
         <test-case FilePath="string">
-          <compilation-unit name="startwith03">
-            <output-dir compare="Text">startwith03</output-dir>
+          <compilation-unit name="starts-with8">
+            <output-dir compare="Text">starts-with8</output-dir>
           </compilation-unit>
         </test-case>
         -->
@@ -5196,6 +5196,11 @@
                 <output-dir compare="Text">uppercase</output-dir>
             </compilation-unit>
         </test-case>
+        <test-case FilePath="string">
+            <compilation-unit name="varlen-encoding">
+                <output-dir compare="Text">varlen-encoding</output-dir>
+            </compilation-unit>
+        </test-case>
     </test-group>
     <test-group name="subset-collection">
         <test-case FilePath="subset-collection">
@@ -6206,6 +6211,11 @@
                 <output-dir compare="Text">big_object_join</output-dir>
             </compilation-unit>
         </test-case>
+        <test-case FilePath="big-object">
+            <compilation-unit name="big_object_load">
+                <output-dir compare="Text">big_object_load</output-dir>
+            </compilation-unit>
+        </test-case>
     </test-group>
     <test-group name="external-indexing">
         <test-case FilePath="external-indexing">

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-common/src/main/java/org/apache/asterix/common/utils/UTF8CharSequence.java
----------------------------------------------------------------------
diff --git a/asterix-common/src/main/java/org/apache/asterix/common/utils/UTF8CharSequence.java b/asterix-common/src/main/java/org/apache/asterix/common/utils/UTF8CharSequence.java
deleted file mode 100644
index 468aca8..0000000
--- a/asterix-common/src/main/java/org/apache/asterix/common/utils/UTF8CharSequence.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.asterix.common.utils;
-
-import org.apache.hyracks.data.std.api.IValueReference;
-import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
-
-public class UTF8CharSequence implements CharSequence {
-
-    private int start;
-    private int len;
-    private char[] buf;
-
-    public UTF8CharSequence(IValueReference valueRef, int start) {
-        reset(valueRef, start);
-    }
-
-    public UTF8CharSequence() {
-    }
-
-    @Override
-    public char charAt(int index) {
-        if (index >= len || index < 0) {
-            throw new IndexOutOfBoundsException("No index " + index + " for string of length " + len);
-        }
-        return buf[index];
-    }
-
-    @Override
-    public int length() {
-        return len;
-    }
-
-    @Override
-    public CharSequence subSequence(int start, int end) {
-        UTF8CharSequence carSeq = new UTF8CharSequence();
-        carSeq.len = end - start;
-        if (end != start) {
-            carSeq.buf = new char[carSeq.len];
-            System.arraycopy(buf, start, carSeq.buf, 0, carSeq.len);
-        }
-        return carSeq;
-    }
-
-    public void reset(IValueReference valueRef, int start) {
-        this.start = start;
-        resetLength(valueRef);
-        if (buf == null || buf.length < len) {
-            buf = new char[len];
-        }
-        int sStart = start + 2;
-        int c = 0;
-        int i = 0;
-        byte[] bytes = valueRef.getByteArray();
-        while (c < len) {
-            buf[i++] = UTF8StringPointable.charAt(bytes, sStart + c);
-            c += UTF8StringPointable.charSize(bytes, sStart + c);
-        }
-
-    }
-
-    private void resetLength(IValueReference valueRef) {
-        this.len = UTF8StringPointable.getUTFLength(valueRef.getByteArray(), start);
-    }
-
-    @Override
-    public String toString() {
-        StringBuffer bf = new StringBuffer();
-        if (buf != null) {
-            for (int i = 0; i < buf.length; i++) {
-                bf.append(buf[i]);
-            }
-        }
-        return new String(bf);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-common/src/test/java/org/apache/asterix/test/aql/TestsUtils.java
----------------------------------------------------------------------
diff --git a/asterix-common/src/test/java/org/apache/asterix/test/aql/TestsUtils.java b/asterix-common/src/test/java/org/apache/asterix/test/aql/TestsUtils.java
index 8ff524e..6cc7abb 100644
--- a/asterix-common/src/test/java/org/apache/asterix/test/aql/TestsUtils.java
+++ b/asterix-common/src/test/java/org/apache/asterix/test/aql/TestsUtils.java
@@ -35,7 +35,18 @@ import java.util.Set;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import org.apache.commons.httpclient.*;
+import org.apache.asterix.common.config.GlobalConfig;
+import org.apache.asterix.testframework.context.TestCaseContext;
+import org.apache.asterix.testframework.context.TestCaseContext.OutputFormat;
+import org.apache.asterix.testframework.context.TestFileContext;
+import org.apache.asterix.testframework.xml.TestCase.CompilationUnit;
+import org.apache.asterix.testframework.xml.TestGroup;
+import org.apache.commons.httpclient.DefaultHttpMethodRetryHandler;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.httpclient.HttpMethodBase;
+import org.apache.commons.httpclient.HttpStatus;
+import org.apache.commons.httpclient.NameValuePair;
 import org.apache.commons.httpclient.methods.GetMethod;
 import org.apache.commons.httpclient.methods.PostMethod;
 import org.apache.commons.httpclient.methods.StringRequestEntity;
@@ -43,12 +54,6 @@ import org.apache.commons.httpclient.params.HttpMethodParams;
 import org.apache.commons.io.IOUtils;
 import org.json.JSONObject;
 
-import org.apache.asterix.common.config.GlobalConfig;
-import org.apache.asterix.testframework.context.TestCaseContext;
-import org.apache.asterix.testframework.context.TestCaseContext.OutputFormat;
-import org.apache.asterix.testframework.context.TestFileContext;
-import org.apache.asterix.testframework.xml.TestCase.CompilationUnit;
-
 public class TestsUtils {
 
     private static final Logger LOGGER = Logger.getLogger(TestsUtils.class.getName());
@@ -383,6 +388,11 @@ public class TestsUtils {
 
     public static void executeTest(String actualPath, TestCaseContext testCaseCtx, ProcessBuilder pb,
             boolean isDmlRecoveryTest) throws Exception {
+        executeTest(actualPath, testCaseCtx, pb, isDmlRecoveryTest, null);
+    }
+
+    public static void executeTest(String actualPath, TestCaseContext testCaseCtx, ProcessBuilder pb,
+            boolean isDmlRecoveryTest, TestGroup failedGroup) throws Exception {
 
         File testFile;
         File expectedResultFile;
@@ -395,7 +405,8 @@ public class TestsUtils {
 
         List<CompilationUnit> cUnits = testCaseCtx.getTestCase().getCompilationUnit();
         for (CompilationUnit cUnit : cUnits) {
-            LOGGER.info("Starting [TEST]: " + testCaseCtx.getTestCase().getFilePath() + "/" + cUnit.getName() + " ... ");
+            LOGGER.info(
+                    "Starting [TEST]: " + testCaseCtx.getTestCase().getFilePath() + "/" + cUnit.getName() + " ... ");
             testFileCtxs = testCaseCtx.getTestFiles(cUnit);
             expectedResultFileCtxs = testCaseCtx.getExpectedResultFiles(cUnit);
             for (TestFileContext ctx : testFileCtxs) {
@@ -524,16 +535,22 @@ public class TestsUtils {
                     }
 
                 } catch (Exception e) {
+
                     System.err.println("testFile " + testFile.toString() + " raised an exception:");
+
                     e.printStackTrace();
                     if (cUnit.getExpectedError().isEmpty()) {
                         System.err.println("...Unexpected!");
+                        if (failedGroup != null) {
+                            failedGroup.getTestCase().add(testCaseCtx.getTestCase());
+                        }
                         throw new Exception("Test \"" + testFile + "\" FAILED!", e);
                     } else {
                         LOGGER.info("[TEST]: " + testCaseCtx.getTestCase().getFilePath() + "/" + cUnit.getName()
                                 + " failed as expected: " + e.getMessage());
                         System.err.println("...but that was expected.");
                     }
+
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-external-data/src/main/java/org/apache/asterix/external/indexing/dataflow/FileIndexTupleTranslator.java
----------------------------------------------------------------------
diff --git a/asterix-external-data/src/main/java/org/apache/asterix/external/indexing/dataflow/FileIndexTupleTranslator.java b/asterix-external-data/src/main/java/org/apache/asterix/external/indexing/dataflow/FileIndexTupleTranslator.java
index 8029b8f..ebba65b 100644
--- a/asterix-external-data/src/main/java/org/apache/asterix/external/indexing/dataflow/FileIndexTupleTranslator.java
+++ b/asterix-external-data/src/main/java/org/apache/asterix/external/indexing/dataflow/FileIndexTupleTranslator.java
@@ -41,7 +41,8 @@ import org.apache.hyracks.dataflow.common.data.accessors.ITupleReference;
 
 @SuppressWarnings("unchecked")
 public class FileIndexTupleTranslator {
-    private ArrayTupleBuilder tupleBuilder = new ArrayTupleBuilder(FilesIndexDescription.FILE_INDEX_RECORD_DESCRIPTOR.getFieldCount());
+    private final FilesIndexDescription filesIndexDescription = new FilesIndexDescription();
+    private ArrayTupleBuilder tupleBuilder = new ArrayTupleBuilder(filesIndexDescription.FILE_INDEX_RECORD_DESCRIPTOR.getFieldCount());
     private RecordBuilder recordBuilder = new RecordBuilder();
     private ArrayBackedValueStorage fieldValue = new ArrayBackedValueStorage();
     private AMutableInt32 aInt32 = new AMutableInt32(0);
@@ -57,11 +58,11 @@ public class FileIndexTupleTranslator {
         tupleBuilder.reset();
         //File Number
         aInt32.setValue(file.getFileNumber());
-        FilesIndexDescription.FILE_INDEX_RECORD_DESCRIPTOR.getFields()[0].serialize(aInt32, tupleBuilder.getDataOutput());
+        filesIndexDescription.FILE_INDEX_RECORD_DESCRIPTOR.getFields()[0].serialize(aInt32, tupleBuilder.getDataOutput());
         tupleBuilder.addFieldEndOffset();
         
         //File Record
-        recordBuilder.reset(FilesIndexDescription.EXTERNAL_FILE_RECORD_TYPE);
+        recordBuilder.reset(filesIndexDescription.EXTERNAL_FILE_RECORD_TYPE);
         // write field 0 (File Name)
         fieldValue.reset();
         aString.setValue(file.getFileName());

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-external-data/src/main/java/org/apache/asterix/external/indexing/dataflow/HiveObjectParser.java
----------------------------------------------------------------------
diff --git a/asterix-external-data/src/main/java/org/apache/asterix/external/indexing/dataflow/HiveObjectParser.java b/asterix-external-data/src/main/java/org/apache/asterix/external/indexing/dataflow/HiveObjectParser.java
index e80247f..d7fa4f2 100644
--- a/asterix-external-data/src/main/java/org/apache/asterix/external/indexing/dataflow/HiveObjectParser.java
+++ b/asterix-external-data/src/main/java/org/apache/asterix/external/indexing/dataflow/HiveObjectParser.java
@@ -58,6 +58,7 @@ import org.apache.asterix.om.util.NonTaggedFormatUtil;
 import org.apache.hyracks.algebricks.common.exceptions.NotImplementedException;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
+import org.apache.hyracks.util.string.UTF8StringWriter;
 
 @SuppressWarnings("deprecation")
 public class HiveObjectParser implements IAsterixHDFSRecordParser {
@@ -75,6 +76,7 @@ public class HiveObjectParser implements IAsterixHDFSRecordParser {
     private UnorderedListBuilder unorderedListBuilder;
     private boolean initialized = false;
     private List<StructField> fieldRefs;
+    private UTF8StringWriter utf8Writer = new UTF8StringWriter();
 
     @SuppressWarnings({ "unchecked" })
     @Override
@@ -308,7 +310,7 @@ public class HiveObjectParser implements IAsterixHDFSRecordParser {
     }
 
     private void parseString(Object obj, StringObjectInspector foi, DataOutput dataOutput) throws IOException {
-        dataOutput.writeUTF(foi.getPrimitiveJavaObject(obj));
+        utf8Writer.writeUTF8(foi.getPrimitiveJavaObject(obj), dataOutput);
     }
 
     private void parseTime(Object obj, TimestampObjectInspector foi, DataOutput dataOutput) throws IOException {

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-external-data/src/main/java/org/apache/asterix/external/indexing/operators/ExternalIndexBulkModifyOperatorNodePushable.java
----------------------------------------------------------------------
diff --git a/asterix-external-data/src/main/java/org/apache/asterix/external/indexing/operators/ExternalIndexBulkModifyOperatorNodePushable.java b/asterix-external-data/src/main/java/org/apache/asterix/external/indexing/operators/ExternalIndexBulkModifyOperatorNodePushable.java
index 0aa761c..d8865b4 100644
--- a/asterix-external-data/src/main/java/org/apache/asterix/external/indexing/operators/ExternalIndexBulkModifyOperatorNodePushable.java
+++ b/asterix-external-data/src/main/java/org/apache/asterix/external/indexing/operators/ExternalIndexBulkModifyOperatorNodePushable.java
@@ -36,9 +36,10 @@ import org.apache.hyracks.storage.am.lsm.common.api.ITwoPCIndex;
 
 public class ExternalIndexBulkModifyOperatorNodePushable extends IndexBulkLoadOperatorNodePushable {
 
+    private final FilesIndexDescription filesIndexDescription = new FilesIndexDescription();
     private final int[] deletedFiles;
     private ArrayTupleBuilder buddyBTreeTupleBuilder = new ArrayTupleBuilder(
-            FilesIndexDescription.FILE_BUDDY_BTREE_RECORD_DESCRIPTOR.getFieldCount());
+            filesIndexDescription.FILE_BUDDY_BTREE_RECORD_DESCRIPTOR.getFieldCount());
     private AMutableInt32 fileNumber = new AMutableInt32(0);
     private ArrayTupleReference deleteTuple = new ArrayTupleReference();
 
@@ -65,7 +66,7 @@ public class ExternalIndexBulkModifyOperatorNodePushable extends IndexBulkLoadOp
             // Delete files
             for (int i = 0; i < deletedFiles.length; i++) {
                 fileNumber.setValue(deletedFiles[i]);
-                FilesIndexDescription.getBuddyBTreeTupleFromFileNumber(deleteTuple, buddyBTreeTupleBuilder, fileNumber);
+                filesIndexDescription.getBuddyBTreeTupleFromFileNumber(deleteTuple, buddyBTreeTupleBuilder, fileNumber);
                 ((ITwoPCIndexBulkLoader) bulkLoader).delete(deleteTuple);
             }
         } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/JObjectAccessors.java
----------------------------------------------------------------------
diff --git a/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/JObjectAccessors.java b/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/JObjectAccessors.java
index 84e3d38..6010e54 100644
--- a/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/JObjectAccessors.java
+++ b/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/JObjectAccessors.java
@@ -226,27 +226,22 @@ public class JObjectAccessors {
     }
 
     public static class JStringAccessor implements IJObjectAccessor {
-        private final ByteArrayAccessibleOutputStream baaos = new ByteArrayAccessibleOutputStream();
+        private final AStringSerializerDeserializer aStringSerDer = new AStringSerializerDeserializer();
 
         @Override
         public IJObject access(IVisitablePointable pointable, IObjectPool<IJObject, IAType> objectPool)
                 throws HyracksDataException {
-            IJObject jObject = objectPool.allocate(BuiltinType.ASTRING);
+            byte[] b = pointable.getByteArray();
+            int s = pointable.getStartOffset();
+            int l = pointable.getLength();
 
-            try {
-                byte byteArray[] = pointable.getByteArray();
-                int len = pointable.getLength()-3;
-                int off = pointable.getStartOffset()+3;
-                baaos.reset();
-                if(off >= 0 && off <= byteArray.length && len >= 0 && off + len - byteArray.length <= 0) {
-                    baaos.write(byteArray, off, len);
-                    ((JString) jObject).setValue(JObjectUtil.getNormalizedString(baaos.toString("UTF-8")));
-                } else {
-                    ((JString) jObject).setValue("");
-                }
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
+            String v = null;
+            v = aStringSerDer.deserialize(
+                    new DataInputStream(new ByteArrayInputStream(b, s + 1, l - 1))).getStringValue();
+            JObjectUtil.getNormalizedString(v);
+
+            IJObject jObject = objectPool.allocate(BuiltinType.ASTRING);
+            ((JString) jObject).setValue(JObjectUtil.getNormalizedString(v));
             return jObject;
         }
     }
@@ -449,6 +444,7 @@ public class JObjectAccessors {
         private final JRecord jRecord;
         private final IJObject[] jObjects;
         private final LinkedHashMap<String, IJObject> openFields;
+        private final AStringSerializerDeserializer aStringSerDer = new AStringSerializerDeserializer();
 
         public JRecordAccessor(ARecordType recordType, IObjectPool<IJObject, IAType> objectPool) {
             this.typeInfo = new TypeInfo(objectPool, null, null);
@@ -491,7 +487,8 @@ public class JObjectAccessors {
                                 // value is null
                                 fieldObject = null;
                             } else {
-                                fieldObject = pointableVisitor.visit((AListVisitablePointable) fieldPointable, typeInfo);
+                                fieldObject = pointableVisitor
+                                        .visit((AListVisitablePointable) fieldPointable, typeInfo);
                             }
                             break;
                         case ANY:
@@ -505,7 +502,7 @@ public class JObjectAccessors {
                         byte[] b = fieldName.getByteArray();
                         int s = fieldName.getStartOffset();
                         int l = fieldName.getLength();
-                        String v = AStringSerializerDeserializer.INSTANCE.deserialize(
+                        String v = aStringSerDer.deserialize(
                                 new DataInputStream(new ByteArrayInputStream(b, s + 1, l - 1))).getStringValue();
                         openFields.put(v, fieldObject);
                     }
@@ -540,7 +537,8 @@ public class JObjectAccessors {
         }
 
         @Override
-        public IJObject access(AListVisitablePointable pointable, IObjectPool<IJObject, IAType> objectPool, IAType listType,
+        public IJObject access(AListVisitablePointable pointable, IObjectPool<IJObject, IAType> objectPool,
+                IAType listType,
                 JObjectPointableVisitor pointableVisitor) throws HyracksDataException {
             List<IVisitablePointable> items = pointable.getItems();
             List<IVisitablePointable> itemTags = pointable.getItemTags();

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/JObjectUtil.java
----------------------------------------------------------------------
diff --git a/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/JObjectUtil.java b/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/JObjectUtil.java
index 5bf87bc..a0710ff 100644
--- a/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/JObjectUtil.java
+++ b/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/JObjectUtil.java
@@ -392,7 +392,7 @@ public class JObjectUtil {
                         dis.readInt();
                     }
                     for (int i = 0; i < numberOfOpenFields; i++) {
-                        fieldNames[i] = AStringSerializerDeserializer.INSTANCE.deserialize(dis).getStringValue();
+                        fieldNames[i] = new AStringSerializerDeserializer().deserialize(dis).getStringValue();
                         ATypeTag openFieldTypeTag = SerializerDeserializerUtil.deserializeTag(dis);
                         openFields[i] = getJType(openFieldTypeTag, null, dis, objectPool);
                         fieldTypes[i] = openFields[i].getIAObject().getType();

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/JObjects.java
----------------------------------------------------------------------
diff --git a/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/JObjects.java b/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/JObjects.java
index c3843e1..02f7b4b 100644
--- a/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/JObjects.java
+++ b/asterix-external-data/src/main/java/org/apache/asterix/external/library/java/JObjects.java
@@ -367,6 +367,8 @@ public class JObjects {
 
     public static final class JString extends JObject {
 
+        private final AStringSerializerDeserializer aStringSerDer = new AStringSerializerDeserializer();
+
         public JString(String v) {
             super(new AMutableString(v));
         }
@@ -388,7 +390,7 @@ public class JObjects {
                     throw new HyracksDataException(e);
                 }
             }
-            AStringSerializerDeserializer.INSTANCE.serialize((AString) value, dataOutput);
+            aStringSerDer.serialize((AString) value, dataOutput);
         }
 
         @Override
@@ -976,6 +978,8 @@ public class JObjects {
         private ARecordType recordType;
         private IJObject[] fields;
         private Map<String, IJObject> openFields;
+        private final AStringSerializerDeserializer aStringSerDer = new AStringSerializerDeserializer();
+
 
         public JRecord(ARecordType recordType, IJObject[] fields) {
             this.recordType = recordType;
@@ -1104,7 +1108,7 @@ public class JObjects {
                         openFieldValue.reset();
                         nameValue.setValue(entry.getKey());
                         openFieldName.getDataOutput().write(ATypeTag.STRING.serialize());
-                        AStringSerializerDeserializer.INSTANCE.serialize(nameValue, openFieldName.getDataOutput());
+                        aStringSerDer.serialize(nameValue, openFieldName.getDataOutput());
                         entry.getValue().serialize(openFieldValue.getDataOutput(), true);
                         recordBuilder.addField(openFieldName, openFieldValue);
                     }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-fuzzyjoin/pom.xml
----------------------------------------------------------------------
diff --git a/asterix-fuzzyjoin/pom.xml b/asterix-fuzzyjoin/pom.xml
index a96c926..f95bcc1 100644
--- a/asterix-fuzzyjoin/pom.xml
+++ b/asterix-fuzzyjoin/pom.xml
@@ -66,6 +66,14 @@
         <groupId>org.apache.hyracks</groupId>
         <artifactId>hyracks-api</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.apache.hyracks</groupId>
+      <artifactId>hyracks-util</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.hyracks</groupId>
+      <artifactId>hyracks-storage-am-lsm-invertedindex</artifactId>
+    </dependency>
   </dependencies>
 
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/similarity/SimilarityMetricEditDistance.java
----------------------------------------------------------------------
diff --git a/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/similarity/SimilarityMetricEditDistance.java b/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/similarity/SimilarityMetricEditDistance.java
index 8b6b23d..ea57fd2 100644
--- a/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/similarity/SimilarityMetricEditDistance.java
+++ b/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/similarity/SimilarityMetricEditDistance.java
@@ -21,13 +21,11 @@ package org.apache.asterix.fuzzyjoin.similarity;
 
 import java.util.Arrays;
 
-import org.apache.asterix.fuzzyjoin.tokenizer.StringUtils;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.util.string.UTF8StringUtil;
 
 public class SimilarityMetricEditDistance implements IGenericSimilarityMetric {
 
-    private final int utf8SizeIndicatorSize = 2;
-
     // dp implementation only needs 2 rows
     private final int rows = 2;
     private int cols;
@@ -159,8 +157,13 @@ public class SimilarityMetricEditDistance implements IGenericSimilarityMetric {
     // faster implementation for common case of string edit distance
     public int UTF8StringEditDistance(byte[] bytes, int fsStart, int ssStart) {
 
-        int fsLen = StringUtils.getStrLen(bytes, fsStart);
-        int ssLen = StringUtils.getStrLen(bytes, ssStart);
+        int fsLen = UTF8StringUtil.getStringLength(bytes, fsStart);
+        int ssLen = UTF8StringUtil.getStringLength(bytes, ssStart);
+
+        int fsUtfLen = UTF8StringUtil.getUTFLength(bytes, fsStart);
+        int ssUtfLen = UTF8StringUtil.getUTFLength(bytes, ssStart);
+        int fsMetaLen = UTF8StringUtil.getNumBytesToStoreLength(fsUtfLen);
+        int ssMetaLen = UTF8StringUtil.getNumBytesToStoreLength(ssUtfLen);
 
         // reuse existing matrix if possible
         if (ssLen >= cols) {
@@ -168,8 +171,8 @@ public class SimilarityMetricEditDistance implements IGenericSimilarityMetric {
             matrix = new int[rows][cols];
         }
 
-        int fsDataStart = fsStart + utf8SizeIndicatorSize;
-        int ssDataStart = ssStart + utf8SizeIndicatorSize;
+        int fsDataStart = fsStart + fsMetaLen;
+        int ssDataStart = ssStart + ssMetaLen;
 
         // init matrix
         for (int i = 0; i <= ssLen; i++) {
@@ -183,19 +186,19 @@ public class SimilarityMetricEditDistance implements IGenericSimilarityMetric {
         int fsPos = fsDataStart;
         for (int i = 1; i <= fsLen; i++) {
             matrix[currRow][0] = i;
-            char fsChar = StringUtils.toLowerCase(StringUtils.charAt(bytes, fsPos));
+            char fsChar = Character.toLowerCase(UTF8StringUtil.charAt(bytes, fsPos));
 
             int ssPos = ssDataStart;
             for (int j = 1; j <= ssLen; j++) {
-                char ssChar = StringUtils.toLowerCase(StringUtils.charAt(bytes, ssPos));
+                char ssChar = Character.toLowerCase(UTF8StringUtil.charAt(bytes, ssPos));
 
                 matrix[currRow][j] = Math.min(Math.min(matrix[prevRow][j] + 1, matrix[currRow][j - 1] + 1),
                         matrix[prevRow][j - 1] + (fsChar == ssChar ? 0 : 1));
 
-                ssPos += StringUtils.charSize(bytes, ssPos);
+                ssPos += UTF8StringUtil.charSize(bytes, ssPos);
             }
 
-            fsPos += StringUtils.charSize(bytes, fsPos);
+            fsPos += UTF8StringUtil.charSize(bytes, fsPos);
 
             int tmp = currRow;
             currRow = prevRow;
@@ -207,8 +210,13 @@ public class SimilarityMetricEditDistance implements IGenericSimilarityMetric {
 
     public int UTF8StringEditDistance(byte[] bytes, int fsStart, int ssStart, int edThresh) {
 
-        int fsStrLen = StringUtils.getStrLen(bytes, fsStart);
-        int ssStrLen = StringUtils.getStrLen(bytes, ssStart);
+        int fsStrLen = UTF8StringUtil.getStringLength(bytes, fsStart);
+        int ssStrLen = UTF8StringUtil.getStringLength(bytes, ssStart);
+
+        int fsUtfLen = UTF8StringUtil.getUTFLength(bytes, fsStart);
+        int ssUtfLen = UTF8StringUtil.getUTFLength(bytes, ssStart);
+        int fsMetaLen = UTF8StringUtil.getNumBytesToStoreLength(fsUtfLen);
+        int ssMetaLen = UTF8StringUtil.getNumBytesToStoreLength(ssUtfLen);
 
         // length filter
         if (Math.abs(fsStrLen - ssStrLen) > edThresh) {
@@ -220,25 +228,25 @@ public class SimilarityMetricEditDistance implements IGenericSimilarityMetric {
         Arrays.fill(ssLcCount, 0);
 
         // compute letter counts for first string
-        int fsPos = fsStart + utf8SizeIndicatorSize;
-        int fsEnd = fsPos + StringUtils.getUTFLen(bytes, fsStart);;
+        int fsPos = fsStart + fsMetaLen;
+        int fsEnd = fsPos + fsUtfLen;;
         while (fsPos < fsEnd) {
-            char c = StringUtils.toLowerCase(StringUtils.charAt(bytes, fsPos));
+            char c = Character.toLowerCase(UTF8StringUtil.charAt(bytes, fsPos));
             if (c < 128) {
                 fsLcCount[c]++;
             }
-            fsPos += StringUtils.charSize(bytes, fsPos);
+            fsPos += UTF8StringUtil.charSize(bytes, fsPos);
         }
 
         // compute letter counts for second string
-        int ssPos = ssStart + utf8SizeIndicatorSize;
-        int ssEnd = ssPos + StringUtils.getUTFLen(bytes, ssStart);
+        int ssPos = ssStart + ssMetaLen;
+        int ssEnd = ssPos + ssUtfLen;
         while (ssPos < ssEnd) {
-            char c = StringUtils.toLowerCase(StringUtils.charAt(bytes, ssPos));
+            char c = Character.toLowerCase(UTF8StringUtil.charAt(bytes, ssPos));
             if (c < 128) {
                 ssLcCount[c]++;
             }
-            ssPos += StringUtils.charSize(bytes, ssPos);
+            ssPos += UTF8StringUtil.charSize(bytes, ssPos);
         }
 
         // apply filter
@@ -269,8 +277,14 @@ public class SimilarityMetricEditDistance implements IGenericSimilarityMetric {
     // checks whether the first string contains a similar string to the second string
     public int UTF8StringEditDistanceContains(byte[] bytes, int stringStart, int patternStart, int edThresh) {
 
-        int stringLen = StringUtils.getStrLen(bytes, stringStart);
-        int patternLen = StringUtils.getStrLen(bytes, patternStart);
+        int stringLen = UTF8StringUtil.getStringLength(bytes, stringStart);
+        int patternLen = UTF8StringUtil.getStringLength(bytes, patternStart);
+
+        int stringUTFLen = UTF8StringUtil.getUTFLength(bytes, stringStart);
+        int stringMetaLen = UTF8StringUtil.getNumBytesToStoreLength(stringUTFLen);
+
+        int patternUTFLen = UTF8StringUtil.getUTFLength(bytes, patternStart);
+        int patternMetaLen = UTF8StringUtil.getNumBytesToStoreLength(patternUTFLen);
 
         // reuse existing matrix if possible
         if (patternLen >= cols) {
@@ -278,8 +292,8 @@ public class SimilarityMetricEditDistance implements IGenericSimilarityMetric {
             matrix = new int[rows][cols];
         }
 
-        int stringDataStart = stringStart + utf8SizeIndicatorSize;
-        int patternDataStart = patternStart + utf8SizeIndicatorSize;
+        int stringDataStart = stringStart +  stringMetaLen;
+        int patternDataStart = patternStart + patternMetaLen;
 
         // init matrix
         for (int i = 0; i <= patternLen; i++) {
@@ -293,23 +307,23 @@ public class SimilarityMetricEditDistance implements IGenericSimilarityMetric {
         int stringPos = stringDataStart;
         for (int i = 1; i <= stringLen; i++) {
             matrix[currRow][0] = 0;
-            char stringChar = StringUtils.toLowerCase(StringUtils.charAt(bytes, stringPos));
+            char stringChar = Character.toLowerCase(UTF8StringUtil.charAt(bytes, stringPos));
 
             int patternPos = patternDataStart;
             for (int j = 1; j <= patternLen; j++) {
-                char patternChar = StringUtils.toLowerCase(StringUtils.charAt(bytes, patternPos));
+                char patternChar = Character.toLowerCase(UTF8StringUtil.charAt(bytes, patternPos));
 
                 matrix[currRow][j] = Math.min(Math.min(matrix[prevRow][j] + 1, matrix[currRow][j - 1] + 1),
                         matrix[prevRow][j - 1] + (stringChar == patternChar ? 0 : 1));
 
-                patternPos += StringUtils.charSize(bytes, patternPos);
+                patternPos += UTF8StringUtil.charSize(bytes, patternPos);
 
                 if (j == patternLen && matrix[currRow][patternLen] < minEd) {
                     minEd = matrix[currRow][patternLen];
                 }
             }
 
-            stringPos += StringUtils.charSize(bytes, stringPos);
+            stringPos += UTF8StringUtil.charSize(bytes, stringPos);
 
             int tmp = currRow;
             currRow = prevRow;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/AbstractUTF8StringBinaryTokenizer.java
----------------------------------------------------------------------
diff --git a/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/AbstractUTF8StringBinaryTokenizer.java b/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/AbstractUTF8StringBinaryTokenizer.java
deleted file mode 100644
index fe90e05..0000000
--- a/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/AbstractUTF8StringBinaryTokenizer.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.asterix.fuzzyjoin.tokenizer;
-
-import org.apache.asterix.fuzzyjoin.IntArray;
-
-public abstract class AbstractUTF8StringBinaryTokenizer implements IBinaryTokenizer {
-
-    protected byte[] data;
-    protected int start;
-    protected int length;
-    protected int tokenLength;
-    protected int index;
-    protected int utf8Length;
-
-    protected final IntArray tokensStart;
-    protected final IntArray tokensLength;
-    protected final IToken token;
-
-    protected final boolean ignoreTokenCount;
-    protected final boolean sourceHasTypeTag;
-
-    public AbstractUTF8StringBinaryTokenizer(boolean ignoreTokenCount, boolean sourceHasTypeTag,
-            ITokenFactory tokenFactory) {
-        this.ignoreTokenCount = ignoreTokenCount;
-        this.sourceHasTypeTag = sourceHasTypeTag;
-        if (!ignoreTokenCount) {
-            tokensStart = new IntArray();
-            tokensLength = new IntArray();
-        } else {
-            tokensStart = null;
-            tokensLength = null;
-        }
-        token = tokenFactory.createToken();
-    }
-
-    @Override
-    public IToken getToken() {
-        return token;
-    }
-
-    @Override
-    public void reset(byte[] data, int start, int length) {
-        this.start = start;
-        index = this.start;
-        if (sourceHasTypeTag) {
-            index++; // skip type tag
-        }
-        utf8Length = StringUtils.getUTFLen(data, index);
-        index += 2; // skip utf8 length indicator
-        this.data = data;
-        this.length = length + start;
-
-        tokenLength = 0;
-        if (!ignoreTokenCount) {
-            tokensStart.reset();
-            tokensLength.reset();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/AbstractUTF8Token.java
----------------------------------------------------------------------
diff --git a/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/AbstractUTF8Token.java b/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/AbstractUTF8Token.java
deleted file mode 100644
index 835d591..0000000
--- a/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/AbstractUTF8Token.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.asterix.fuzzyjoin.tokenizer;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-public abstract class AbstractUTF8Token implements IToken {
-    public static final int GOLDEN_RATIO_32 = 0x09e3779b9;
-
-    protected int length;
-    protected int tokenLength;
-    protected int start;
-    protected int tokenCount;
-    protected byte[] data;
-    protected final byte tokenTypeTag;
-    protected final byte countTypeTag;
-
-    public AbstractUTF8Token() {
-        tokenTypeTag = -1;
-        countTypeTag = -1;
-    }
-
-    public AbstractUTF8Token(byte tokenTypeTag, byte countTypeTag) {
-        this.tokenTypeTag = tokenTypeTag;
-        this.countTypeTag = countTypeTag;
-    }
-
-    @Override
-    public byte[] getData() {
-        return data;
-    }
-
-    @Override
-    public int getLength() {
-        return length;
-    }
-
-    public int getLowerCaseUTF8Len(int size) {
-        int lowerCaseUTF8Len = 0;
-        int pos = start;
-        for (int i = 0; i < size; i++) {
-            char c = StringUtils.toLowerCase(StringUtils.charAt(data, pos));
-            lowerCaseUTF8Len += StringUtils.getModifiedUTF8Len(c);
-            pos += StringUtils.charSize(data, pos);
-        }
-        return lowerCaseUTF8Len;
-    }
-
-    @Override
-    public int getStart() {
-        return start;
-    }
-
-    @Override
-    public int getTokenLength() {
-        return tokenLength;
-    }
-
-    public void handleCountTypeTag(DataOutput dos) throws IOException {
-        if (countTypeTag > 0) {
-            dos.write(countTypeTag);
-        }
-    }
-
-    public void handleTokenTypeTag(DataOutput dos) throws IOException {
-        if (tokenTypeTag > 0) {
-            dos.write(tokenTypeTag);
-        }
-    }
-
-    @Override
-    public void reset(byte[] data, int start, int length, int tokenLength, int tokenCount) {
-        this.data = data;
-        this.start = start;
-        this.length = length;
-        this.tokenLength = tokenLength;
-        this.tokenCount = tokenCount;
-    }
-
-    @Override
-    public void serializeTokenCount(DataOutput dos) throws IOException {
-        handleCountTypeTag(dos);
-        dos.writeInt(tokenCount);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/AbstractUTF8TokenFactory.java
----------------------------------------------------------------------
diff --git a/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/AbstractUTF8TokenFactory.java b/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/AbstractUTF8TokenFactory.java
deleted file mode 100644
index 849bfd1..0000000
--- a/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/AbstractUTF8TokenFactory.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.asterix.fuzzyjoin.tokenizer;
-
-public abstract class AbstractUTF8TokenFactory implements ITokenFactory {
-    private static final long serialVersionUID = 1L;
-    protected final byte tokenTypeTag;
-    protected final byte countTypeTag;
-
-    public AbstractUTF8TokenFactory() {
-        tokenTypeTag = -1;
-        countTypeTag = -1;
-    }
-
-    public AbstractUTF8TokenFactory(byte tokenTypeTag, byte countTypeTag) {
-        this.tokenTypeTag = tokenTypeTag;
-        this.countTypeTag = countTypeTag;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/DelimitedUTF8StringBinaryTokenizer.java
----------------------------------------------------------------------
diff --git a/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/DelimitedUTF8StringBinaryTokenizer.java b/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/DelimitedUTF8StringBinaryTokenizer.java
deleted file mode 100644
index 4b11026..0000000
--- a/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/DelimitedUTF8StringBinaryTokenizer.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.asterix.fuzzyjoin.tokenizer;
-
-public class DelimitedUTF8StringBinaryTokenizer extends AbstractUTF8StringBinaryTokenizer {
-
-    public DelimitedUTF8StringBinaryTokenizer(boolean ignoreTokenCount, boolean sourceHasTypeTag,
-            ITokenFactory tokenFactory) {
-        super(ignoreTokenCount, sourceHasTypeTag, tokenFactory);
-    }
-
-    @Override
-    public boolean hasNext() {
-        // skip delimiters
-        while (index < length && isSeparator(StringUtils.charAt(data, index))) {
-            index += StringUtils.charSize(data, index);
-        }
-        return index < length;
-    }
-
-    private boolean isSeparator(char c) {
-        return !(Character.isLetterOrDigit(c) || Character.getType(c) == Character.OTHER_LETTER || Character.getType(c) == Character.OTHER_NUMBER);
-    }
-
-    @Override
-    public void next() {
-        tokenLength = 0;
-        int currentTokenStart = index;
-        while (index < length && !isSeparator(StringUtils.charAt(data, index))) {
-            index += StringUtils.charSize(data, index);
-            tokenLength++;
-        }
-        int tokenCount = 1;
-        if (tokenLength > 0 && !ignoreTokenCount) {
-            // search if we got the same token before
-            for (int i = 0; i < tokensStart.length(); ++i) {
-                if (tokenLength == tokensLength.get(i)) {
-                    int tokenStart = tokensStart.get(i);
-                    tokenCount++; // assume we found it
-                    int offset = 0;
-                    int currLength = 0;
-                    while (currLength < tokenLength) {
-                        // case insensitive comparison
-                        if (StringUtils.toLowerCase(StringUtils.charAt(data, currentTokenStart + offset)) != StringUtils
-                                .toLowerCase(StringUtils.charAt(data, tokenStart + offset))) {
-                            tokenCount--;
-                            break;
-                        }
-                        offset += StringUtils.charSize(data, currentTokenStart + offset);
-                        currLength++;
-                    }
-                }
-            }
-            // add the new token to the list of seen tokens
-            tokensStart.add(currentTokenStart);
-            tokensLength.add(tokenLength);
-        }
-
-        // set token
-        token.reset(data, currentTokenStart, index, tokenLength, tokenCount);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/DelimitedUTF8StringBinaryTokenizerFactory.java
----------------------------------------------------------------------
diff --git a/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/DelimitedUTF8StringBinaryTokenizerFactory.java b/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/DelimitedUTF8StringBinaryTokenizerFactory.java
deleted file mode 100644
index ba49e5c..0000000
--- a/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/DelimitedUTF8StringBinaryTokenizerFactory.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.asterix.fuzzyjoin.tokenizer;
-
-public class DelimitedUTF8StringBinaryTokenizerFactory implements IBinaryTokenizerFactory {
-
-    private static final long serialVersionUID = 1L;
-    private final boolean ignoreTokenCount;
-    private final boolean sourceHasTypeTag;
-    private final ITokenFactory tokenFactory;
-
-    public DelimitedUTF8StringBinaryTokenizerFactory(boolean ignoreTokenCount, boolean sourceHasTypeTag,
-            ITokenFactory tokenFactory) {
-        this.ignoreTokenCount = ignoreTokenCount;
-        this.sourceHasTypeTag = sourceHasTypeTag;
-        this.tokenFactory = tokenFactory;
-    }
-
-    @Override
-    public IBinaryTokenizer createTokenizer() {
-        return new DelimitedUTF8StringBinaryTokenizer(ignoreTokenCount, sourceHasTypeTag, tokenFactory);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/HashedUTF8NGramToken.java
----------------------------------------------------------------------
diff --git a/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/HashedUTF8NGramToken.java b/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/HashedUTF8NGramToken.java
deleted file mode 100644
index 786d07b..0000000
--- a/asterix-fuzzyjoin/src/main/java/org/apache/asterix/fuzzyjoin/tokenizer/HashedUTF8NGramToken.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.asterix.fuzzyjoin.tokenizer;
-
-import java.io.DataOutput;
-import java.io.IOException;
-
-public class HashedUTF8NGramToken extends UTF8NGramToken {
-    public HashedUTF8NGramToken(byte tokenTypeTag, byte countTypeTag) {
-        super(tokenTypeTag, countTypeTag);
-    }
-
-    @Override
-    public void serializeToken(DataOutput dos) throws IOException {
-        handleTokenTypeTag(dos);
-
-        int hash = GOLDEN_RATIO_32;
-
-        // pre chars
-        for (int i = 0; i < numPreChars; i++) {
-            hash ^= PRECHAR;
-            hash *= GOLDEN_RATIO_32;
-        }
-
-        // regular chars
-        int numRegGrams = tokenLength - numPreChars - numPostChars;
-        int pos = start;
-        for (int i = 0; i < numRegGrams; i++) {
-            hash ^= StringUtils.toLowerCase(StringUtils.charAt(data, pos));
-            hash *= GOLDEN_RATIO_32;
-            pos += StringUtils.charSize(data, pos);
-        }
-
-        // post chars
-        for (int i = 0; i < numPostChars; i++) {
-            hash ^= POSTCHAR;
-            hash *= GOLDEN_RATIO_32;
-        }
-
-        // token count
-        hash += tokenCount;
-
-        dos.writeInt(hash);
-    }
-}



[03/15] incubator-asterixdb git commit: ASTERIXDB-1102: VarSize Encoding to store length of String and ByteArray

Posted by ji...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/LikeDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/LikeDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/LikeDescriptor.java
deleted file mode 100644
index 2ab66fc..0000000
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/LikeDescriptor.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.asterix.runtime.evaluators.functions;
-
-import java.io.ByteArrayInputStream;
-import java.io.DataInputStream;
-import java.io.DataOutput;
-import java.util.Arrays;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.asterix.common.utils.UTF8CharSequence;
-import org.apache.asterix.formats.nontagged.AqlBinaryComparatorFactoryProvider;
-import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
-import org.apache.asterix.om.base.ABoolean;
-import org.apache.asterix.om.base.ANull;
-import org.apache.asterix.om.base.AString;
-import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
-import org.apache.asterix.om.functions.IFunctionDescriptor;
-import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
-import org.apache.asterix.om.types.ATypeTag;
-import org.apache.asterix.om.types.BuiltinType;
-import org.apache.asterix.om.types.EnumDeserializer;
-import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.api.dataflow.value.IBinaryComparator;
-import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
-import org.apache.hyracks.data.std.util.ByteArrayAccessibleOutputStream;
-import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
-
-/**
- * Creates new Matcher and Pattern objects each time the value of the pattern
- * argument (the second argument) changes.
- */
-
-public class LikeDescriptor extends AbstractScalarFunctionDynamicDescriptor {
-
-    private static final long serialVersionUID = 1L;
-
-    // allowed input types
-    private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
-    private final static byte SER_STRING_TYPE_TAG = ATypeTag.STRING.serialize();
-
-    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
-        public IFunctionDescriptor createFunctionDescriptor() {
-            return new LikeDescriptor();
-        }
-    };
-
-    @Override
-    public FunctionIdentifier getIdentifier() {
-        return AsterixBuiltinFunctions.LIKE;
-    }
-
-    @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-
-        return new ICopyEvaluatorFactory() {
-            private static final long serialVersionUID = 1L;
-
-            @Override
-            public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
-
-                final DataOutput dout = output.getDataOutput();
-
-                return new ICopyEvaluator() {
-
-                    private boolean first = true;
-                    private ArrayBackedValueStorage array0 = new ArrayBackedValueStorage();
-                    private ICopyEvaluator evalString = args[0].createEvaluator(array0);
-                    private ICopyEvaluator evalPattern = args[1].createEvaluator(array0);
-                    private ByteArrayAccessibleOutputStream lastPattern = new ByteArrayAccessibleOutputStream();
-                    private UTF8CharSequence carSeq = new UTF8CharSequence();
-                    private IBinaryComparator strComp = AqlBinaryComparatorFactoryProvider.INSTANCE
-                            .getBinaryComparatorFactory(BuiltinType.ASTRING, true).createBinaryComparator();
-                    @SuppressWarnings("unchecked")
-                    private ISerializerDeserializer<AString> stringSerde = AqlSerializerDeserializerProvider.INSTANCE
-                            .getSerializerDeserializer(BuiltinType.ASTRING);
-                    @SuppressWarnings("unchecked")
-                    private ISerializerDeserializer<ABoolean> booleanSerde = AqlSerializerDeserializerProvider.INSTANCE
-                            .getSerializerDeserializer(BuiltinType.ABOOLEAN);
-                    @SuppressWarnings("unchecked")
-                    private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
-                            .getSerializerDeserializer(BuiltinType.ANULL);
-                    private Matcher matcher;
-                    private Pattern pattern;
-
-                    @Override
-                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                        // evaluate the pattern first
-                        try {
-                            array0.reset();
-                            evalPattern.evaluate(tuple);
-                            if (array0.getByteArray()[0] == SER_NULL_TYPE_TAG) {
-                                nullSerde.serialize(ANull.NULL, dout);
-                                return;
-                            }
-                            if (array0.getByteArray()[0] != SER_STRING_TYPE_TAG) {
-                                throw new AlgebricksException(AsterixBuiltinFunctions.LIKE
-                                        + ": expects input type STRING/NULL for the first argument but got "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(array0.getByteArray()[0])
-                                        + ".");
-                            }
-                            boolean newPattern = false;
-                            if (first) {
-                                first = false;
-                                newPattern = true;
-                            } else {
-                                int c = strComp.compare(array0.getByteArray(), array0.getStartOffset(),
-                                        array0.getLength(), lastPattern.getByteArray(), 0, lastPattern.size());
-                                if (c != 0) {
-                                    newPattern = true;
-                                }
-                            }
-                            if (newPattern) {
-                                lastPattern.reset();
-                                lastPattern.write(array0.getByteArray(), array0.getStartOffset(), array0.getLength());
-                                // ! object creation !
-                                DataInputStream di = new DataInputStream(new ByteArrayInputStream(
-                                        lastPattern.getByteArray()));
-                                AString strPattern = (AString) stringSerde.deserialize(di);
-                                pattern = Pattern.compile(toRegex(strPattern));
-
-                            }
-                            array0.reset();
-                            evalString.evaluate(tuple);
-                            if (array0.getByteArray()[0] == SER_NULL_TYPE_TAG) {
-                                nullSerde.serialize(ANull.NULL, dout);
-                                return;
-                            }
-                            if (array0.getByteArray()[0] != SER_STRING_TYPE_TAG) {
-                                throw new AlgebricksException(AsterixBuiltinFunctions.LIKE
-                                        + ": expects input type (STRING/NULL, STRING/NULL) but got (STRING, "
-                                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(array0.getByteArray()[0])
-                                        + ").");
-                            }
-                            carSeq.reset(array0, 1);
-                            if (newPattern) {
-                                matcher = pattern.matcher(carSeq);
-                            } else {
-                                matcher.reset(carSeq);
-                            }
-                            ABoolean res = (matcher.matches()) ? ABoolean.TRUE : ABoolean.FALSE;
-
-                            booleanSerde.serialize(res, dout);
-                        } catch (HyracksDataException e) {
-                            throw new AlgebricksException(e);
-                        }
-                    }
-
-                    private String toRegex(AString pattern) {
-                        StringBuilder sb = new StringBuilder();
-                        String str = pattern.getStringValue();
-                        for (int i = 0; i < str.length(); i++) {
-                            char c = str.charAt(i);
-                            if (c == '\\' && (i < str.length() - 1)
-                                    && (str.charAt(i + 1) == '_' || str.charAt(i + 1) == '%')) {
-                                sb.append(str.charAt(i + 1));
-                                ++i;
-                            } else if (c == '%') {
-                                sb.append(".*");
-                            } else if (c == '_') {
-                                sb.append(".");
-                            } else {
-                                if (Arrays.binarySearch(reservedRegexChars, c) >= 0) {
-                                    sb.append('\\');
-                                }
-                                sb.append(c);
-                            }
-                        }
-                        return sb.toString();
-                    }
-                };
-            }
-        };
-    }
-
-    private static char[] reservedRegexChars = new char[] { '\\', '(', ')', '[', ']', '{', '}', '.', '^', '$', '*', '|' };
-    static {
-        Arrays.sort(reservedRegexChars);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/RegExpDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/RegExpDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/RegExpDescriptor.java
index 197db97..1271465 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/RegExpDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/RegExpDescriptor.java
@@ -24,7 +24,6 @@ import java.io.DataOutput;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-import org.apache.asterix.common.utils.UTF8CharSequence;
 import org.apache.asterix.formats.nontagged.AqlBinaryComparatorFactoryProvider;
 import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.om.base.ABoolean;
@@ -45,8 +44,10 @@ import org.apache.hyracks.api.dataflow.value.IBinaryComparator;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.data.std.util.ByteArrayAccessibleOutputStream;
+import org.apache.hyracks.data.std.util.UTF8CharSequence;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 /**
@@ -92,6 +93,7 @@ public class RegExpDescriptor extends AbstractScalarFunctionDynamicDescriptor {
                     private ICopyEvaluator evalPattern = args[1].createEvaluator(array0);
                     private ByteArrayAccessibleOutputStream lastPattern = new ByteArrayAccessibleOutputStream();
                     private UTF8CharSequence carSeq = new UTF8CharSequence();
+                    private UTF8StringPointable utf8Ptr = new UTF8StringPointable();
                     private IBinaryComparator strComp = AqlBinaryComparatorFactoryProvider.INSTANCE
                             .getBinaryComparatorFactory(BuiltinType.ASTRING, true).createBinaryComparator();
                     @SuppressWarnings("unchecked")
@@ -153,7 +155,8 @@ public class RegExpDescriptor extends AbstractScalarFunctionDynamicDescriptor {
                                         + ": expects type STRING/NULL for the second input argument but got "
                                         + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(array0.getByteArray()[0]));
                             }
-                            carSeq.reset(array0, 1);
+                            utf8Ptr.set(array0.getByteArray(), 1, array0.getLength() - 1);
+                            carSeq.reset(utf8Ptr);
                             if (newPattern) {
                                 matcher = pattern.matcher(carSeq);
                             } else {

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialIntersectDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialIntersectDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialIntersectDescriptor.java
index ec192af..aebf186 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialIntersectDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialIntersectDescriptor.java
@@ -84,6 +84,7 @@ public class SpatialIntersectDescriptor extends AbstractScalarFunctionDynamicDes
                     private final DoubleArray trianglesY0 = new DoubleArray();
                     private final DoubleArray trianglesX1 = new DoubleArray();
                     private final DoubleArray trianglesY1 = new DoubleArray();
+                    private final AObjectSerializerDeserializer aObjSerDer = new AObjectSerializerDeserializer();
 
                     private boolean pointOnLine(double pX, double pY, double startX, double startY, double endX,
                             double endY) throws HyracksDataException {
@@ -1095,7 +1096,7 @@ public class SpatialIntersectDescriptor extends AbstractScalarFunctionDynamicDes
                             }
 
                             ABoolean aResult = res ? (ABoolean.TRUE) : (ABoolean.FALSE);
-                            AObjectSerializerDeserializer.INSTANCE.serialize(aResult, out);
+                            aObjSerDer.serialize(aResult, out);
                         } catch (HyracksDataException hde) {
                             throw new AlgebricksException(hde);
                         }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StartsWithDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StartsWithDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StartsWithDescriptor.java
deleted file mode 100644
index f11779b..0000000
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StartsWithDescriptor.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.asterix.runtime.evaluators.functions;
-
-import java.io.DataOutput;
-
-import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
-import org.apache.asterix.om.functions.IFunctionDescriptor;
-import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
-import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
-import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
-
-public class StartsWithDescriptor extends AbstractScalarFunctionDynamicDescriptor {
-    private static final long serialVersionUID = 1L;
-
-    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
-        public IFunctionDescriptor createFunctionDescriptor() {
-            return new StartsWithDescriptor();
-        }
-    };
-
-    @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-
-        return new ICopyEvaluatorFactory() {
-            private static final long serialVersionUID = 1L;
-
-            @Override
-            public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
-
-                DataOutput dout = output.getDataOutput();
-
-                return new AbstractStringContainsEval(dout, args[0], args[1], AsterixBuiltinFunctions.STARTS_WITH) {
-
-                    @Override
-                    protected boolean findMatch(byte[] strBytes, byte[] patternBytes) {
-                        int utflen1 = UTF8StringPointable.getUTFLength(strBytes, 1);
-                        int utflen2 = UTF8StringPointable.getUTFLength(patternBytes, 1);
-
-                        int s1Start = 3;
-                        int s2Start = 3;
-
-                        int c1 = 0;
-                        int c2 = 0;
-                        while (c1 < utflen1 && c2 < utflen2) {
-                            char ch1 = UTF8StringPointable.charAt(strBytes, s1Start + c1);
-                            char ch2 = UTF8StringPointable.charAt(patternBytes, s2Start + c2);
-                            if (ch1 != ch2) {
-                                break;
-                            }
-                            c1 += UTF8StringPointable.charSize(strBytes, s1Start + c1);
-                            c2 += UTF8StringPointable.charSize(patternBytes, s2Start + c2);
-                        }
-                        return (c2 == utflen2);
-                    }
-
-                };
-            }
-        };
-    }
-
-    @Override
-    public FunctionIdentifier getIdentifier() {
-        return AsterixBuiltinFunctions.STARTS_WITH;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringConcatDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringConcatDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringConcatDescriptor.java
index 0337704..b3feba7 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringConcatDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringConcatDescriptor.java
@@ -38,10 +38,9 @@ import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
-import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
-import org.apache.hyracks.dataflow.common.data.util.StringUtils;
+import org.apache.hyracks.util.string.UTF8StringUtil;
 
 public class StringConcatDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
@@ -74,6 +73,7 @@ public class StringConcatDescriptor extends AbstractScalarFunctionDynamicDescrip
                     @SuppressWarnings("unchecked")
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
+                    private final byte[] tempLengthArray = new byte[5];
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
@@ -81,7 +81,8 @@ public class StringConcatDescriptor extends AbstractScalarFunctionDynamicDescrip
                             outInputList.reset();
                             evalList.evaluate(tuple);
                             byte[] listBytes = outInputList.getByteArray();
-                            if (listBytes[0] != SER_ORDEREDLIST_TYPE_TAG && listBytes[0] != SER_UNORDEREDLIST_TYPE_TAG) {
+                            if (listBytes[0] != SER_ORDEREDLIST_TYPE_TAG
+                                    && listBytes[0] != SER_UNORDEREDLIST_TYPE_TAG) {
                                 throw new AlgebricksException(AsterixBuiltinFunctions.STRING_CONCAT.getName()
                                         + ": expects input type ORDEREDLIST/UNORDEREDLIST, but got "
                                         + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(listBytes[0]));
@@ -110,19 +111,20 @@ public class StringConcatDescriptor extends AbstractScalarFunctionDynamicDescrip
                                         throw new AlgebricksException(AsterixBuiltinFunctions.STRING_CONCAT.getName()
                                                 + ": expects type STRING/NULL for the list item but got " + itemType);
                                     }
-                                    utf8Len += UTF8StringPointable.getUTFLength(listBytes, itemOffset);
+                                    utf8Len += UTF8StringUtil.getUTFLength(listBytes, itemOffset);
                                 }
                                 out.writeByte(ATypeTag.STRING.serialize());
-                                StringUtils.writeUTF8Len(utf8Len, out);
+                                int cbytes = UTF8StringUtil.encodeUTF8Length(utf8Len, tempLengthArray, 0);
+                                out.write(tempLengthArray, 0, cbytes);
+
                                 for (int i = 0; i < listAccessor.size(); i++) {
                                     int itemOffset = listAccessor.getItemOffset(i);
                                     if (listAccessor.itemsAreSelfDescribing()) {
                                         itemOffset += 1;
                                     }
-                                    utf8Len = UTF8StringPointable.getUTFLength(listBytes, itemOffset);
-                                    for (int j = 0; j < utf8Len; j++) {
-                                        out.writeByte(listBytes[2 + itemOffset + j]);
-                                    }
+                                    utf8Len = UTF8StringUtil.getUTFLength(listBytes, itemOffset);
+                                    out.write(listBytes, UTF8StringUtil.getNumBytesToStoreLength(utf8Len) + itemOffset,
+                                            utf8Len);
                                 }
                             } catch (AsterixException ex) {
                                 throw new AlgebricksException(ex);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringContainsDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringContainsDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringContainsDescriptor.java
new file mode 100644
index 0000000..2825630
--- /dev/null
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringContainsDescriptor.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.asterix.runtime.evaluators.functions;
+
+import java.io.DataOutput;
+
+import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptor;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+
+public class StringContainsDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+
+    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        public IFunctionDescriptor createFunctionDescriptor() {
+            return new StringContainsDescriptor();
+        }
+    };
+
+    @Override
+    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+
+        return new ICopyEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
+
+                DataOutput dout = output.getDataOutput();
+
+                return new AbstractBinaryStringBoolEval(dout, args[0], args[1],
+                        AsterixBuiltinFunctions.STRING_CONTAINS) {
+                    @Override
+                    protected boolean compute(UTF8StringPointable left, UTF8StringPointable right)
+                            throws AlgebricksException {
+                        return UTF8StringPointable.contains(left, right, false);
+                    }
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return AsterixBuiltinFunctions.STRING_CONTAINS;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringEndWithDescrtiptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringEndWithDescrtiptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringEndWithDescrtiptor.java
deleted file mode 100644
index 4c281fa..0000000
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringEndWithDescrtiptor.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.apache.asterix.runtime.evaluators.functions;
-
-import java.io.DataOutput;
-
-import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
-import org.apache.asterix.om.functions.IFunctionDescriptor;
-import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
-import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
-import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
-
-public class StringEndWithDescrtiptor extends AbstractScalarFunctionDynamicDescriptor {
-    private static final long serialVersionUID = 1L;
-
-    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
-        public IFunctionDescriptor createFunctionDescriptor() {
-            return new StringEndWithDescrtiptor();
-        }
-    };
-
-    @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-
-        return new ICopyEvaluatorFactory() {
-            private static final long serialVersionUID = 1L;
-
-            @Override
-            public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
-
-                DataOutput dout = output.getDataOutput();
-
-                return new AbstractBinaryStringBoolEval(dout, args[0], args[1], AsterixBuiltinFunctions.STRING_END_WITH) {
-
-                    @Override
-                    protected boolean compute(byte[] lBytes, int lLen, int lStart, byte[] rBytes, int rLen, int rStart,
-                            ArrayBackedValueStorage array0, ArrayBackedValueStorage array1) {
-                        int len1 = UTF8StringPointable.getUTFLength(lBytes, 1);
-                        int len2 = UTF8StringPointable.getUTFLength(rBytes, 1);
-                        if (len2 > len1)
-                            return false;
-
-                        int pos = 3;
-                        int delta = len1 - len2;
-                        while (pos < len2 + 3) {
-                            char c1 = UTF8StringPointable.charAt(lBytes, pos + delta);
-                            char c2 = UTF8StringPointable.charAt(rBytes, pos);
-                            if (c1 != c2)
-                                return false;
-
-                            pos += UTF8StringPointable.charSize(lBytes, pos);
-                        }
-
-                        return true;
-                    }
-
-                };
-            }
-        };
-    }
-
-    @Override
-    public FunctionIdentifier getIdentifier() {
-        return AsterixBuiltinFunctions.STRING_END_WITH;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringEndsWithDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringEndsWithDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringEndsWithDescriptor.java
new file mode 100644
index 0000000..673ba0f
--- /dev/null
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringEndsWithDescriptor.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.asterix.runtime.evaluators.functions;
+
+import java.io.DataOutput;
+
+import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptor;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+
+public class StringEndsWithDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+    private static final long serialVersionUID = 1L;
+
+    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        public IFunctionDescriptor createFunctionDescriptor() {
+            return new StringEndsWithDescriptor();
+        }
+    };
+
+    @Override
+    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+
+        return new ICopyEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
+
+                DataOutput dout = output.getDataOutput();
+
+                return new AbstractBinaryStringBoolEval(dout, args[0], args[1],
+                        AsterixBuiltinFunctions.STRING_ENDS_WITH) {
+
+                    @Override
+                    protected boolean compute(UTF8StringPointable left, UTF8StringPointable right)
+                            throws AlgebricksException {
+                        return UTF8StringPointable.endsWith(left, right, false);
+                    }
+
+                };
+            }
+        };
+    }
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return AsterixBuiltinFunctions.STRING_ENDS_WITH;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringEqualDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringEqualDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringEqualDescriptor.java
index 0df3e4d..312d28e 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringEqualDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringEqualDescriptor.java
@@ -55,24 +55,9 @@ public class StringEqualDescriptor extends AbstractScalarFunctionDynamicDescript
                 return new AbstractBinaryStringBoolEval(dout, args[0], args[1], AsterixBuiltinFunctions.STRING_EQUAL) {
 
                     @Override
-                    protected boolean compute(byte[] lBytes, int lLen, int lStart, byte[] rBytes, int rLen, int rStart,
-                            ArrayBackedValueStorage array0, ArrayBackedValueStorage array1) {
-                        int len = UTF8StringPointable.getUTFLength(lBytes, 1);
-
-                        if (len != UTF8StringPointable.getUTFLength(rBytes, 1))
-                            return false;
-
-                        int pos = 3;
-                        while (pos < len + 3) {
-                            char c1 = UTF8StringPointable.charAt(lBytes, pos);
-                            char c2 = UTF8StringPointable.charAt(rBytes, pos);
-                            if (c1 != c2)
-                                return false;
-
-                            pos += UTF8StringPointable.charSize(lBytes, pos);
-                        }
-
-                        return true;
+                    protected boolean compute(UTF8StringPointable left, UTF8StringPointable right)
+                            throws AlgebricksException {
+                        return left.compareTo(right) == 0;
                     }
 
                 };

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringEvaluatorUtils.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringEvaluatorUtils.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringEvaluatorUtils.java
index 2d364c2..7abc721 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringEvaluatorUtils.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringEvaluatorUtils.java
@@ -18,17 +18,18 @@
  */
 package org.apache.asterix.runtime.evaluators.functions;
 
+import java.util.Arrays;
 import java.util.regex.Pattern;
 
-import org.apache.asterix.om.base.AString;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+import org.apache.hyracks.data.std.util.ByteArrayAccessibleOutputStream;
 
 public class StringEvaluatorUtils {
 
-    public static int toFlag(AString pattern) {
-        String str = pattern.getStringValue();
+    public static int toFlag(String pattern) {
         int flag = 0;
-        for (int i = 0; i < str.length(); i++) {
-            char c = str.charAt(i);
+        for (int i = 0; i < pattern.length(); i++) {
+            char c = pattern.charAt(i);
             switch (c) {
                 case 's':
                     flag |= Pattern.DOTALL;
@@ -47,7 +48,40 @@ public class StringEvaluatorUtils {
         return flag;
     }
 
-    public final static char[] reservedRegexChars = new char[] { '$', '(', ')', '*', '.', '[', '\\', ']', '^', '{',
-            '|', '}' };
+    public static UTF8StringPointable copyResetUTF8Pointable(UTF8StringPointable srcString,
+            ByteArrayAccessibleOutputStream destCopyStorage, UTF8StringPointable destString) {
+        destCopyStorage.reset();
+        destCopyStorage.write(srcString.getByteArray(), srcString.getStartOffset(),
+                srcString.getMetaDataLength() + srcString.getUTF8Length());
+        destString.set(destCopyStorage.getByteArray(), 0, destCopyStorage.size());
+        return destString;
+    }
+
+    static char[] reservedRegexChars = new char[] { '\\', '(', ')', '[', ']', '{', '}', '.', '^', '$', '*', '|' };
+
+    static {
+        Arrays.sort(reservedRegexChars);
+    }
 
+    public static String toRegex(String pattern) {
+        StringBuilder sb = new StringBuilder();
+        for (int i = 0; i < pattern.length(); i++) {
+            char c = pattern.charAt(i);
+            if (c == '\\' && (i < pattern.length() - 1)
+                    && (pattern.charAt(i + 1) == '_' || pattern.charAt(i + 1) == '%')) {
+                sb.append(pattern.charAt(i + 1));
+                ++i;
+            } else if (c == '%') {
+                sb.append(".*");
+            } else if (c == '_') {
+                sb.append(".");
+            } else {
+                if (Arrays.binarySearch(reservedRegexChars, c) >= 0) {
+                    sb.append('\\');
+                }
+                sb.append(c);
+            }
+        }
+        return sb.toString();
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringJoinDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringJoinDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringJoinDescriptor.java
index 31e61ff..650beb0 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringJoinDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringJoinDescriptor.java
@@ -34,10 +34,9 @@ import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
-import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
-import org.apache.hyracks.dataflow.common.data.util.StringUtils;
+import org.apache.hyracks.util.string.UTF8StringUtil;
 
 public class StringJoinDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
@@ -68,6 +67,7 @@ public class StringJoinDescriptor extends AbstractScalarFunctionDynamicDescripto
                     private ArrayBackedValueStorage outInputSep = new ArrayBackedValueStorage();
                     private ICopyEvaluator evalList = listEvalFactory.createEvaluator(outInputList);
                     private ICopyEvaluator evalSep = sepEvalFactory.createEvaluator(outInputSep);
+                    private final byte[] tempLengthArray = new byte[5];
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
@@ -96,31 +96,32 @@ public class StringJoinDescriptor extends AbstractScalarFunctionDynamicDescripto
                             try {
                                 // calculate length first
                                 int utf_8_len = 0;
-                                int sep_len = UTF8StringPointable.getUTFLength(serSep, 1);
+                                int sep_len = UTF8StringUtil.getUTFLength(serSep, 1);
+                                int sep_meta_len = UTF8StringUtil.getNumBytesToStoreLength(sep_len);
 
                                 for (int i = 0; i < size; i++) {
                                     int itemOffset = AOrderedListSerializerDeserializer
                                             .getItemOffset(serOrderedList, i);
 
-                                    int currentSize = UTF8StringPointable.getUTFLength(serOrderedList, itemOffset);
+                                    int currentSize = UTF8StringUtil.getUTFLength(serOrderedList, itemOffset);
                                     if (i != size - 1 && currentSize != 0) {
                                         utf_8_len += sep_len;
                                     }
                                     utf_8_len += currentSize;
                                 }
                                 out.writeByte(stringTypeTag);
-                                StringUtils.writeUTF8Len(utf_8_len, out);
+                                int length = UTF8StringUtil.encodeUTF8Length(utf_8_len, tempLengthArray, 0);
+                                out.write(tempLengthArray, 0, length);
                                 for (int i = 0; i < size; i++) {
                                     int itemOffset = AOrderedListSerializerDeserializer
                                             .getItemOffset(serOrderedList, i);
-                                    utf_8_len = UTF8StringPointable.getUTFLength(serOrderedList, itemOffset);
-                                    for (int j = 0; j < utf_8_len; j++) {
-                                        out.writeByte(serOrderedList[2 + itemOffset + j]);
-                                    }
+                                    utf_8_len = UTF8StringUtil.getUTFLength(serOrderedList, itemOffset);
+                                    out.write(serOrderedList,
+                                            itemOffset + UTF8StringUtil.getNumBytesToStoreLength(utf_8_len), utf_8_len);
                                     if (i == size - 1 || utf_8_len == 0)
                                         continue;
                                     for (int j = 0; j < sep_len; j++) {
-                                        out.writeByte(serSep[3 + j]);
+                                        out.writeByte(serSep[1 + sep_meta_len + j]);
                                     }
                                 }
                             } catch (AsterixException ex) {

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringLengthDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringLengthDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringLengthDescriptor.java
index 68c5af9..4f53a53 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringLengthDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringLengthDescriptor.java
@@ -41,6 +41,7 @@ import org.apache.hyracks.data.std.api.IDataOutputProvider;
 import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
+import org.apache.hyracks.util.string.UTF8StringUtil;
 
 public class StringLengthDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
@@ -80,7 +81,7 @@ public class StringLengthDescriptor extends AbstractScalarFunctionDynamicDescrip
                             eval.evaluate(tuple);
                             byte[] serString = outInput.getByteArray();
                             if (serString[0] == SER_STRING_TYPE_TAG) {
-                                int len = UTF8StringPointable.getUTFLength(outInput.getByteArray(), 1);
+                                int len = UTF8StringUtil.getUTFLength(outInput.getByteArray(), 1);
                                 result.setValue((long) len);
                                 int64Serde.serialize(result, out);
                             } else if (serString[0] == SER_NULL_TYPE_TAG)

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringLikeDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringLikeDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringLikeDescriptor.java
new file mode 100644
index 0000000..3ccba1c
--- /dev/null
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringLikeDescriptor.java
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.asterix.runtime.evaluators.functions;
+
+import java.io.DataOutput;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
+import org.apache.asterix.om.functions.IFunctionDescriptor;
+import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
+import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
+import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
+import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
+import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
+import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
+import org.apache.hyracks.data.std.util.ByteArrayAccessibleOutputStream;
+import org.apache.hyracks.data.std.util.UTF8CharSequence;
+
+/**
+ * Creates new Matcher and Pattern objects each time the value of the pattern
+ * argument (the second argument) changes.
+ */
+
+public class StringLikeDescriptor extends AbstractScalarFunctionDynamicDescriptor {
+
+    private static final long serialVersionUID = 1L;
+
+    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
+        public IFunctionDescriptor createFunctionDescriptor() {
+            return new StringLikeDescriptor();
+        }
+    };
+
+    @Override
+    public FunctionIdentifier getIdentifier() {
+        return AsterixBuiltinFunctions.STRING_LIKE;
+    }
+
+    @Override
+    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
+
+        return new ICopyEvaluatorFactory() {
+            private static final long serialVersionUID = 1L;
+
+            @Override
+            public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
+
+                final DataOutput dout = output.getDataOutput();
+
+                return new AbstractBinaryStringBoolEval(dout, args[0], args[1],
+                        AsterixBuiltinFunctions.STRING_MATCHES) {
+
+                    private Pattern pattern = null;
+                    private Matcher matcher = null;
+                    private ByteArrayAccessibleOutputStream lastPatternStorage = new ByteArrayAccessibleOutputStream();
+                    private UTF8StringPointable lastPatternPtr = new UTF8StringPointable();
+                    private UTF8CharSequence carSeq = new UTF8CharSequence();
+
+                    @Override
+                    protected boolean compute(UTF8StringPointable srcPtr, UTF8StringPointable patternPtr)
+                            throws AlgebricksException {
+                        boolean newPattern = false;
+                        if (pattern == null || lastPatternPtr.compareTo(patternPtr) != 0) {
+                            newPattern = true;
+                        }
+                        if (newPattern) {
+                            StringEvaluatorUtils.copyResetUTF8Pointable(patternPtr, lastPatternStorage, lastPatternPtr);
+                            // ! object creation !
+                            pattern = Pattern.compile(StringEvaluatorUtils.toRegex(lastPatternPtr.toString()));
+                        }
+
+                        carSeq.reset(srcPtr);
+                        if (newPattern) {
+                            matcher = pattern.matcher(carSeq);
+                        } else {
+                            matcher.reset(carSeq);
+                        }
+                        return matcher.find();
+                    }
+
+                };
+            }
+        };
+    }
+
+};
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringLowerCaseDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringLowerCaseDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringLowerCaseDescriptor.java
index 0d4148b..66212f7 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringLowerCaseDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringLowerCaseDescriptor.java
@@ -38,8 +38,9 @@ import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
 import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
+import org.apache.hyracks.data.std.util.GrowableArray;
+import org.apache.hyracks.data.std.util.UTF8StringBuilder;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
-import org.apache.hyracks.dataflow.common.data.util.StringUtils;
 
 public class StringLowerCaseDescriptor extends AbstractScalarFunctionDynamicDescriptor {
     private static final long serialVersionUID = 1L;
@@ -61,9 +62,13 @@ public class StringLowerCaseDescriptor extends AbstractScalarFunctionDynamicDesc
             public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
                 return new ICopyEvaluator() {
 
-                    private DataOutput out = output.getDataOutput();
-                    private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
-                    private ICopyEvaluator eval = args[0].createEvaluator(outInput);
+                    private final DataOutput out = output.getDataOutput();
+                    private final ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
+                    private final ICopyEvaluator eval = args[0].createEvaluator(outInput);
+
+                    private final GrowableArray array = new GrowableArray();
+                    private final UTF8StringBuilder builder = new UTF8StringBuilder();
+                    private final UTF8StringPointable string = new UTF8StringPointable();
 
                     private final byte stt = ATypeTag.STRING.serialize();
 
@@ -80,19 +85,12 @@ public class StringLowerCaseDescriptor extends AbstractScalarFunctionDynamicDesc
                             byte[] serString = outInput.getByteArray();
 
                             if (serString[0] == SER_STRING_TYPE_TAG) {
-                                byte[] bytes = outInput.getByteArray();
-                                int len = UTF8StringPointable.getUTFLength(bytes, 1);
+                                string.set(serString, 1, serString.length);
+                                array.reset();
+                                UTF8StringPointable.lowercase(string, builder, array);
 
                                 out.writeByte(stt);
-                                StringUtils.writeUTF8Len(len, out);
-
-                                int pos = 3;
-                                while (pos < len + 3) {
-                                    char c1 = UTF8StringPointable.charAt(bytes, pos);
-                                    c1 = Character.toLowerCase(c1);
-                                    pos += UTF8StringPointable.charSize(bytes, pos);
-                                    StringUtils.writeCharAsModifiedUTF8(c1, out);
-                                }
+                                out.write(array.getByteArray(), 0, array.getLength());
                             } else if (serString[0] == SER_NULL_TYPE_TAG)
                                 nullSerde.serialize(ANull.NULL, out);
                             else

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringMatchesDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringMatchesDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringMatchesDescriptor.java
index 43a6d59..0b8477c 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringMatchesDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringMatchesDescriptor.java
@@ -18,31 +18,22 @@
  */
 package org.apache.asterix.runtime.evaluators.functions;
 
-import java.io.ByteArrayInputStream;
-import java.io.DataInputStream;
 import java.io.DataOutput;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-import org.apache.asterix.common.utils.UTF8CharSequence;
-import org.apache.asterix.formats.nontagged.AqlBinaryComparatorFactoryProvider;
-import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
-import org.apache.asterix.om.base.AString;
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
 import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
-import org.apache.asterix.om.types.BuiltinType;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.api.dataflow.value.IBinaryComparator;
-import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ByteArrayAccessibleOutputStream;
+import org.apache.hyracks.data.std.util.UTF8CharSequence;
 
 public class StringMatchesDescriptor extends AbstractScalarFunctionDynamicDescriptor {
     private static final long serialVersionUID = 1L;
@@ -64,54 +55,35 @@ public class StringMatchesDescriptor extends AbstractScalarFunctionDynamicDescri
 
                 DataOutput dout = output.getDataOutput();
 
-                return new AbstractBinaryStringBoolEval(dout, args[0], args[1], AsterixBuiltinFunctions.STRING_MATCHES) {
+                return new AbstractBinaryStringBoolEval(dout, args[0], args[1],
+                        AsterixBuiltinFunctions.STRING_MATCHES) {
 
                     private Pattern pattern = null;
                     private Matcher matcher = null;
-                    private ByteArrayAccessibleOutputStream lastPattern = new ByteArrayAccessibleOutputStream();
-                    private IBinaryComparator strComp = AqlBinaryComparatorFactoryProvider.INSTANCE
-                            .getBinaryComparatorFactory(BuiltinType.ASTRING, true).createBinaryComparator();
+                    private ByteArrayAccessibleOutputStream lastPatternStorage = new ByteArrayAccessibleOutputStream();
+                    private UTF8StringPointable lastPatternPtr = new UTF8StringPointable();
                     private UTF8CharSequence carSeq = new UTF8CharSequence();
 
-                    @SuppressWarnings("unchecked")
-                    private ISerializerDeserializer<AString> stringSerde = AqlSerializerDeserializerProvider.INSTANCE
-                            .getSerializerDeserializer(BuiltinType.ASTRING);
-
                     @Override
-                    protected boolean compute(byte[] lBytes, int lLen, int lStart, byte[] rBytes, int rLen, int rStart,
-                            ArrayBackedValueStorage array0, ArrayBackedValueStorage array1) throws AlgebricksException {
-                        try {
-                            boolean newPattern = false;
-                            if (pattern == null) {
-                                newPattern = true;
-                            } else {
-                                int c = strComp.compare(rBytes, rStart, rLen, lastPattern.getByteArray(), 0,
-                                        lastPattern.size());
-                                if (c != 0) {
-                                    newPattern = true;
-                                }
-                            }
-                            if (newPattern) {
-                                lastPattern.reset();
-                                lastPattern.write(rBytes, rStart, rLen);
-                                // ! object creation !
-                                DataInputStream di = new DataInputStream(new ByteArrayInputStream(
-                                        lastPattern.getByteArray()));
-                                AString strPattern = (AString) stringSerde.deserialize(di);
-                                // pattern = Pattern.compile(toRegex(strPattern));
-                                pattern = Pattern.compile(strPattern.getStringValue());
-                            }
+                    protected boolean compute(UTF8StringPointable srcPtr, UTF8StringPointable patternPtr)
+                            throws AlgebricksException {
+                        boolean newPattern = false;
+                        if (pattern == null || lastPatternPtr.compareTo(patternPtr) != 0) {
+                            newPattern = true;
+                        }
+                        if (newPattern) {
+                            StringEvaluatorUtils.copyResetUTF8Pointable(patternPtr, lastPatternStorage, lastPatternPtr);
+                            // ! object creation !
+                            pattern = Pattern.compile(lastPatternPtr.toString());
+                        }
 
-                            carSeq.reset(array0, 1);
-                            if (newPattern) {
-                                matcher = pattern.matcher(carSeq);
-                            } else {
-                                matcher.reset(carSeq);
-                            }
-                            return matcher.find();
-                        } catch (HyracksDataException e) {
-                            throw new AlgebricksException(e);
+                        carSeq.reset(srcPtr);
+                        if (newPattern) {
+                            matcher = pattern.matcher(carSeq);
+                        } else {
+                            matcher.reset(carSeq);
                         }
+                        return matcher.find();
                     }
 
                 };

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringMatchesWithFlagDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringMatchesWithFlagDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringMatchesWithFlagDescriptor.java
index 74089b1..e4129a3 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringMatchesWithFlagDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringMatchesWithFlagDescriptor.java
@@ -22,31 +22,22 @@
  */
 package org.apache.asterix.runtime.evaluators.functions;
 
-import java.io.ByteArrayInputStream;
-import java.io.DataInputStream;
 import java.io.DataOutput;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-import org.apache.asterix.common.utils.UTF8CharSequence;
-import org.apache.asterix.formats.nontagged.AqlBinaryComparatorFactoryProvider;
-import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
-import org.apache.asterix.om.base.AString;
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
 import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
-import org.apache.asterix.om.types.BuiltinType;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.api.dataflow.value.IBinaryComparator;
-import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ByteArrayAccessibleOutputStream;
+import org.apache.hyracks.data.std.util.UTF8CharSequence;
 
 public class StringMatchesWithFlagDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
@@ -71,76 +62,39 @@ public class StringMatchesWithFlagDescriptor extends AbstractScalarFunctionDynam
 
                 return new AbstractTripleStringBoolEval(dout, args[0], args[1], args[2],
                         AsterixBuiltinFunctions.STRING_MATCHES_WITH_FLAG) {
-
                     private Pattern pattern = null;
                     private Matcher matcher = null;
-                    private String strPattern = "";
-                    private int flags = 0;
-                    private ByteArrayAccessibleOutputStream lastPattern = new ByteArrayAccessibleOutputStream();
-                    private ByteArrayAccessibleOutputStream lastFlags = new ByteArrayAccessibleOutputStream();
-                    private IBinaryComparator strComp = AqlBinaryComparatorFactoryProvider.INSTANCE
-                            .getBinaryComparatorFactory(BuiltinType.ASTRING, true).createBinaryComparator();
+                    private ByteArrayAccessibleOutputStream lastPatternStorage = new ByteArrayAccessibleOutputStream();
+                    private ByteArrayAccessibleOutputStream lastFlagsStorage = new ByteArrayAccessibleOutputStream();
+                    private UTF8StringPointable lastPatternPtr = new UTF8StringPointable();
+                    private UTF8StringPointable lastFlagPtr = new UTF8StringPointable();
                     private UTF8CharSequence carSeq = new UTF8CharSequence();
-                    @SuppressWarnings("unchecked")
-                    private ISerializerDeserializer<AString> stringSerde = AqlSerializerDeserializerProvider.INSTANCE
-                            .getSerializerDeserializer(BuiltinType.ASTRING);
 
                     @Override
-                    protected boolean compute(byte[] b0, int l0, int s0, byte[] b1, int l1, int s1, byte[] b2, int l2,
-                            int s2, ArrayBackedValueStorage array0, ArrayBackedValueStorage array1)
-                            throws AlgebricksException {
-                        try {
-                            boolean newPattern = false;
-                            boolean newFlags = false;
-
-                            AString astrPattern;
-                            AString astrFlags;
+                    protected boolean compute(UTF8StringPointable strSrc, UTF8StringPointable strPattern,
+                            UTF8StringPointable strFlag) throws AlgebricksException {
+                        final boolean newPattern = (pattern == null || lastPatternPtr.compareTo(strPattern) != 0);
+                        final boolean newFlag = (pattern == null || lastFlagPtr.compareTo(strFlag) != 0);
 
-                            if (pattern == null) {
-                                newPattern = true;
-                                newFlags = true;
-                            } else {
-                                int c = strComp.compare(b1, s1, l1, lastPattern.getByteArray(), 0, lastPattern.size());
-                                if (c != 0) {
-                                    newPattern = true;
-                                }
+                        if (newPattern) {
+                            StringEvaluatorUtils.copyResetUTF8Pointable(strPattern, lastPatternStorage, lastPatternPtr);
+                        }
 
-                                c = strComp.compare(b2, s2, l2, lastFlags.getByteArray(), 0, lastFlags.size());
-                                if (c != 0) {
-                                    newFlags = true;
-                                }
-                            }
-                            if (newPattern) {
-                                lastPattern.reset();
-                                lastPattern.write(b1, s1, l1);
-                                // ! object creation !
-                                DataInputStream di = new DataInputStream(new ByteArrayInputStream(
-                                        lastPattern.getByteArray()));
-                                astrPattern = (AString) stringSerde.deserialize(di);
-                                // strPattern = toRegex(astrPattern);
-                                strPattern = astrPattern.getStringValue();
-                            }
-                            if (newFlags) {
-                                lastFlags.reset();
-                                lastFlags.write(b2, s2, l2);
-                                // ! object creation !
-                                DataInputStream di = new DataInputStream(new ByteArrayInputStream(
-                                        lastFlags.getByteArray()));
-                                astrFlags = (AString) stringSerde.deserialize(di);
-                                flags = StringEvaluatorUtils.toFlag(astrFlags);
-                            }
+                        if (newFlag) {
+                            StringEvaluatorUtils.copyResetUTF8Pointable(strFlag, lastFlagsStorage, lastFlagPtr);
+                        }
 
-                            pattern = Pattern.compile(strPattern, flags);
-                            carSeq.reset(array0, 1);
-                            if (newPattern) {
-                                matcher = pattern.matcher(carSeq);
-                            } else {
-                                matcher.reset(carSeq);
-                            }
-                            return matcher.find();
-                        } catch (HyracksDataException e) {
-                            throw new AlgebricksException(e);
+                        if (newPattern || newFlag) {
+                            pattern = Pattern.compile(lastPatternPtr.toString(),
+                                    StringEvaluatorUtils.toFlag(lastFlagPtr.toString()));
+                        }
+                        carSeq.reset(strSrc);
+                        if (newPattern || newFlag) {
+                            matcher = pattern.matcher(carSeq);
+                        } else {
+                            matcher.reset(carSeq);
                         }
+                        return matcher.find();
                     }
                 };
             }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringReplaceDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringReplaceDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringReplaceDescriptor.java
index e0628e2..a43f1a4 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringReplaceDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/StringReplaceDescriptor.java
@@ -18,31 +18,22 @@
  */
 package org.apache.asterix.runtime.evaluators.functions;
 
-import java.io.ByteArrayInputStream;
-import java.io.DataInputStream;
 import java.io.DataOutput;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-import org.apache.asterix.common.utils.UTF8CharSequence;
-import org.apache.asterix.formats.nontagged.AqlBinaryComparatorFactoryProvider;
-import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
-import org.apache.asterix.om.base.AString;
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
 import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
-import org.apache.asterix.om.types.BuiltinType;
 import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.api.dataflow.value.IBinaryComparator;
-import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ByteArrayAccessibleOutputStream;
+import org.apache.hyracks.data.std.util.UTF8CharSequence;
 
 public class StringReplaceDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
@@ -70,79 +61,42 @@ public class StringReplaceDescriptor extends AbstractScalarFunctionDynamicDescri
 
                     private Pattern pattern = null;
                     private Matcher matcher = null;
-                    private String replace;
-                    private String strPattern = "";
+                    private String replaceStr;
                     private StringBuffer resultBuf = new StringBuffer();
-                    private ByteArrayAccessibleOutputStream lastPattern = new ByteArrayAccessibleOutputStream();
-                    private ByteArrayAccessibleOutputStream lastReplace = new ByteArrayAccessibleOutputStream();
-                    private IBinaryComparator strComp = AqlBinaryComparatorFactoryProvider.INSTANCE
-                            .getBinaryComparatorFactory(BuiltinType.ASTRING, true).createBinaryComparator();
+                    private ByteArrayAccessibleOutputStream lastPatternStorage = new ByteArrayAccessibleOutputStream();
+                    private UTF8StringPointable lastPatternPtr = new UTF8StringPointable();
+                    private ByteArrayAccessibleOutputStream lastReplaceStorage = new ByteArrayAccessibleOutputStream();
+                    private UTF8StringPointable lastReplacePtr = new UTF8StringPointable();
                     private UTF8CharSequence carSeq = new UTF8CharSequence();
-                    @SuppressWarnings("unchecked")
-                    private ISerializerDeserializer<AString> stringSerde = AqlSerializerDeserializerProvider.INSTANCE
-                            .getSerializerDeserializer(BuiltinType.ASTRING);
 
                     @Override
-                    protected String compute(byte[] b0, int l0, int s0, byte[] b1, int l1, int s1, byte[] b2, int l2,
-                            int s2, ArrayBackedValueStorage array0, ArrayBackedValueStorage array1)
-                            throws AlgebricksException {
-                        try {
-                            boolean newPattern = false;
-                            boolean newReplace = false;
-
-                            AString astrPattern;
-                            AString astrReplace;
+                    protected String compute(UTF8StringPointable srcPtr, UTF8StringPointable patternPtr,
+                            UTF8StringPointable replacePtr) throws AlgebricksException {
+                        resultBuf.setLength(0);
+                        final boolean newPattern = (pattern == null || lastPatternPtr.compareTo(patternPtr) != 0);
+                        final boolean newReplace = (pattern == null || lastReplacePtr.compareTo(replacePtr) != 0);
+                        if (newPattern) {
+                            StringEvaluatorUtils.copyResetUTF8Pointable(patternPtr, lastPatternStorage, lastPatternPtr);
+                            // ! object creation !
+                            pattern = Pattern.compile(lastPatternPtr.toString());
+                        }
+                        if (newReplace) {
+                            StringEvaluatorUtils.copyResetUTF8Pointable(replacePtr, lastReplaceStorage, lastReplacePtr);
+                            replaceStr = replacePtr.toString();
+                        }
 
-                            if (pattern == null) {
-                                newPattern = true;
-                                newReplace = true;
-                            } else {
-                                int c = strComp.compare(b1, s1, l1, lastPattern.getByteArray(), 0, lastPattern.size());
-                                if (c != 0) {
-                                    newPattern = true;
-                                }
+                        carSeq.reset(srcPtr);
+                        if (newPattern) {
+                            matcher = pattern.matcher(carSeq);
+                        } else {
+                            matcher.reset(carSeq);
+                        }
 
-                                c = strComp.compare(b2, s2, l2, lastReplace.getByteArray(), 0, lastReplace.size());
-                                if (c != 0) {
-                                    newReplace = true;
-                                }
-                            }
-                            if (newPattern) {
-                                lastPattern.reset();
-                                lastPattern.write(b1, s1, l1);
-                                // ! object creation !
-                                DataInputStream di = new DataInputStream(new ByteArrayInputStream(
-                                        lastPattern.getByteArray()));
-                                astrPattern = (AString) stringSerde.deserialize(di);
-                                // strPattern = toRegex(astrPattern);
-                                strPattern = astrPattern.getStringValue();
-                            }
-                            if (newReplace) {
-                                lastReplace.reset();
-                                lastReplace.write(b2, s2, l2);
-                                // ! object creation !
-                                DataInputStream di = new DataInputStream(new ByteArrayInputStream(
-                                        lastReplace.getByteArray()));
-                                astrReplace = (AString) stringSerde.deserialize(di);
-                                replace = astrReplace.getStringValue();
-                            }
-                            if (newPattern) {
-                                pattern = Pattern.compile(strPattern);
-                            }
-                            carSeq.reset(array0, 1);
-                            if (newPattern) {
-                                matcher = pattern.matcher(carSeq);
-                            } else {
-                                matcher.reset(carSeq);
-                            }
-                            while (matcher.find()) {
-                                matcher.appendReplacement(resultBuf, replace);
-                            }
-                            matcher.appendTail(resultBuf);
-                            return resultBuf.toString();
-                        } catch (HyracksDataException e) {
-                            throw new AlgebricksException(e);
+                        while (matcher.find()) {
+                            matcher.appendReplacement(resultBuf, replaceStr);
                         }
+                        matcher.appendTail(resultBuf);
+                        return resultBuf.toString();
                     }
                 };
             }


[05/15] incubator-asterixdb git commit: ASTERIXDB-1102: VarSize Encoding to store length of String and ByteArray

Posted by ji...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/EditDistanceEvaluator.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/EditDistanceEvaluator.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/EditDistanceEvaluator.java
index 881e01a..2f588c7 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/EditDistanceEvaluator.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/EditDistanceEvaluator.java
@@ -79,14 +79,6 @@ public class EditDistanceEvaluator implements ICopyEvaluator {
         if (!checkArgTypes(firstTypeTag, secondTypeTag))
             return;
 
-        itemTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[firstStart + 1]);
-        if (itemTypeTag == ATypeTag.ANY)
-            throw new AlgebricksException("\n Edit Distance can only be called on homogenous lists");
-
-        itemTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[secondStart + 1]);
-        if (itemTypeTag == ATypeTag.ANY)
-            throw new AlgebricksException("\n Edit Distance can only be called on homogenous lists");
-
         try {
             editDistance = computeResult(argOut.getByteArray(), firstStart, secondStart, firstTypeTag);
         } catch (HyracksDataException e1) {
@@ -155,6 +147,22 @@ public class EditDistanceEvaluator implements ICopyEvaluator {
                     + typeTag2);
         }
 
+        // Since they are equal, check one tag is enough.
+        if (typeTag1 != ATypeTag.STRING && typeTag1 != ATypeTag.ORDEREDLIST) { // could be an list
+            throw new AlgebricksException(
+                    "Only String or OrderedList type are allowed in edit distance, but given : " + typeTag1);
+        }
+
+        if (typeTag1 == ATypeTag.ORDEREDLIST) {
+            itemTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[firstStart + 1]);
+            if (itemTypeTag == ATypeTag.ANY)
+                throw new AlgebricksException("\n Edit Distance can only be called on homogenous lists");
+
+            itemTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(argOut.getByteArray()[secondStart + 1]);
+            if (itemTypeTag == ATypeTag.ANY)
+                throw new AlgebricksException("\n Edit Distance can only be called on homogenous lists");
+        }
+
         return true;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SimilarityFiltersCache.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SimilarityFiltersCache.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SimilarityFiltersCache.java
index 663bca9..7180df0 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SimilarityFiltersCache.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/common/SimilarityFiltersCache.java
@@ -30,6 +30,7 @@ import org.apache.hyracks.dataflow.common.comm.util.ByteBufferInputStream;
 import org.apache.hyracks.dataflow.common.data.marshalling.UTF8StringSerializerDeserializer;
 
 public class SimilarityFiltersCache {
+    private final UTF8StringSerializerDeserializer utf8SerDer = new UTF8StringSerializerDeserializer();
 
     private final ByteBufferInputStream bbis = new ByteBufferInputStream();
     private final DataInputStream dis = new DataInputStream(bbis);
@@ -44,7 +45,7 @@ public class SimilarityFiltersCache {
             bbis.setByteBuffer(ByteBuffer.wrap(similarityNameBytes), 1);
             String similarityName;
             try {
-                similarityName = UTF8StringSerializerDeserializer.INSTANCE.deserialize(dis);
+                similarityName = utf8SerDer.deserialize(dis);
             } catch (HyracksDataException e) {
                 throw new AlgebricksException(e);
             }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryHexStringConstructorDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryHexStringConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryHexStringConstructorDescriptor.java
index 4304e97..ef54caf 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryHexStringConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABinaryHexStringConstructorDescriptor.java
@@ -19,6 +19,9 @@
 
 package org.apache.asterix.runtime.evaluators.constructors;
 
+import java.io.DataOutput;
+import java.io.IOException;
+
 import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.om.base.ANull;
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
@@ -33,15 +36,13 @@ import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 import org.apache.hyracks.dataflow.common.data.parsers.ByteArrayHexParserFactory;
 import org.apache.hyracks.dataflow.common.data.parsers.IValueParser;
 import org.apache.hyracks.dataflow.common.data.parsers.IValueParserFactory;
 
-import java.io.DataOutput;
-import java.io.IOException;
-
 public class ABinaryHexStringConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
     private static final long serialVersionUID = 1L;
     public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
@@ -50,17 +51,20 @@ public class ABinaryHexStringConstructorDescriptor extends AbstractScalarFunctio
         }
     };
 
-    @Override public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args)
+    @Override
+    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args)
             throws AlgebricksException {
         return new ICopyEvaluatorFactory() {
-            @Override public ICopyEvaluator createEvaluator(final IDataOutputProvider output)
+            @Override
+            public ICopyEvaluator createEvaluator(final IDataOutputProvider output)
                     throws AlgebricksException {
                 return new ABinaryConstructorEvaluator(output, args[0], ByteArrayHexParserFactory.INSTANCE);
             }
         };
     }
 
-    @Override public FunctionIdentifier getIdentifier() {
+    @Override
+    public FunctionIdentifier getIdentifier() {
         return AsterixBuiltinFunctions.BINARY_HEX_CONSTRUCTOR;
     }
 
@@ -69,6 +73,7 @@ public class ABinaryHexStringConstructorDescriptor extends AbstractScalarFunctio
         private ArrayBackedValueStorage outInput;
         private ICopyEvaluator eval;
         private IValueParser byteArrayParser;
+        private UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
         @SuppressWarnings("unchecked")
         private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
@@ -83,7 +88,8 @@ public class ABinaryHexStringConstructorDescriptor extends AbstractScalarFunctio
             byteArrayParser = valueParserFactory.createValueParser();
         }
 
-        @Override public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+        @Override
+        public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
 
             try {
                 outInput.reset();
@@ -96,9 +102,9 @@ public class ABinaryHexStringConstructorDescriptor extends AbstractScalarFunctio
                 } else if (tt == ATypeTag.BINARY) {
                     out.write(outInput.getByteArray(), outInput.getStartOffset(), outInput.getLength());
                 } else if (tt == ATypeTag.STRING) {
-                    String string = new String(outInput.getByteArray(), 3, outInput.getLength() - 3,
-                            "UTF-8");
-                    char[] buffer = string.toCharArray();
+                    utf8Ptr.set(outInput.getByteArray(), 1, outInput.getLength() - 1);
+
+                    char[] buffer = utf8Ptr.toString().toCharArray();
                     out.write(ATypeTag.BINARY.serialize());
                     byteArrayParser.parse(buffer, 0, buffer.length, out);
                 } else {

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABooleanConstructorDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABooleanConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABooleanConstructorDescriptor.java
index 8ea464d..d865e3e 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABooleanConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ABooleanConstructorDescriptor.java
@@ -40,6 +40,7 @@ import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
+import org.apache.hyracks.util.string.UTF8StringUtil;
 
 public class ABooleanConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
@@ -65,8 +66,8 @@ public class ABooleanConstructorDescriptor extends AbstractScalarFunctionDynamic
                     private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
                     private ICopyEvaluator eval = args[0].createEvaluator(outInput);
                     private String errorMessage = "This can not be an instance of boolean";
-                    private final byte[] TRUE = { 0, 4, 't', 'r', 'u', 'e' };
-                    private final byte[] FALSE = { 0, 5, 'f', 'a', 'l', 's', 'e' };
+                    private final byte[] TRUE = UTF8StringUtil.writeStringToBytes("true");
+                    private final byte[] FALSE = UTF8StringUtil.writeStringToBytes("false");
                     IBinaryComparator utf8BinaryComparator = AqlBinaryComparatorFactoryProvider.UTF8STRING_POINTABLE_INSTANCE
                             .createBinaryComparator();
                     @SuppressWarnings("unchecked")
@@ -84,11 +85,12 @@ public class ABooleanConstructorDescriptor extends AbstractScalarFunctionDynamic
                             eval.evaluate(tuple);
                             byte[] serString = outInput.getByteArray();
                             if (serString[0] == SER_STRING_TYPE_TAG) {
-                                if (utf8BinaryComparator.compare(serString, 1, outInput.getLength(), TRUE, 0, 6) == 0) {
+                                if (utf8BinaryComparator
+                                        .compare(serString, 1, outInput.getLength(), TRUE, 0, TRUE.length) == 0) {
                                     booleanSerde.serialize(ABoolean.TRUE, out);
                                     return;
                                 } else if (utf8BinaryComparator
-                                        .compare(serString, 1, outInput.getLength(), FALSE, 0, 7) == 0) {
+                                        .compare(serString, 1, outInput.getLength(), FALSE, 0, FALSE.length) == 0) {
                                     booleanSerde.serialize(ABoolean.FALSE, out);
                                     return;
                                 } else

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ACircleConstructorDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ACircleConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ACircleConstructorDescriptor.java
index ff4c792..e4a33f5 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ACircleConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ACircleConstructorDescriptor.java
@@ -38,6 +38,7 @@ import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -75,6 +76,8 @@ public class ACircleConstructorDescriptor extends AbstractScalarFunctionDynamicD
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
+                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
+
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
 
@@ -83,7 +86,8 @@ public class ACircleConstructorDescriptor extends AbstractScalarFunctionDynamicD
                             eval.evaluate(tuple);
                             byte[] serString = outInput.getByteArray();
                             if (serString[0] == SER_STRING_TYPE_TAG) {
-                                String s = new String(serString, 3, outInput.getLength() - 3, "UTF-8");
+                                utf8Ptr.set(serString, 1, outInput.getLength()-1);
+                                String s = utf8Ptr.toString();
                                 int commaIndex = s.indexOf(',');
                                 int spaceIndex = s.indexOf(' ', commaIndex + 1);
                                 aPoint.setValue(Double.parseDouble(s.substring(0, commaIndex)),

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateConstructorDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateConstructorDescriptor.java
index 41fa315..a73dec6 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateConstructorDescriptor.java
@@ -39,6 +39,7 @@ import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -76,6 +77,8 @@ public class ADateConstructorDescriptor extends AbstractScalarFunctionDynamicDes
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
+                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
+
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
 
@@ -85,7 +88,8 @@ public class ADateConstructorDescriptor extends AbstractScalarFunctionDynamicDes
                             byte[] serString = outInput.getByteArray();
                             if (serString[0] == SER_STRING_TYPE_TAG) {
 
-                                int stringLength = (serString[1] & 0xff << 8) + (serString[2] & 0xff << 0);
+                                utf8Ptr.set(serString, 1, outInput.getLength()-1);
+                                int stringLength = utf8Ptr.getUTF8Length();
 
                                 // the string to be parsed should be at least 8 characters: YYYYMMDD
                                 if (stringLength < 8) {
@@ -94,11 +98,11 @@ public class ADateConstructorDescriptor extends AbstractScalarFunctionDynamicDes
                                             + stringLength);
                                 }
 
-                                int startOffset = 3;
+                                int startOffset = utf8Ptr.getCharStartOffset();
                                 while (serString[startOffset] == ' ') {
                                     startOffset++;
                                 }
-                                int endOffset = stringLength - 1 + 3;
+                                int endOffset = startOffset + stringLength - 1 ;
                                 while (serString[endOffset] == ' ') {
                                     endOffset--;
                                 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeConstructorDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeConstructorDescriptor.java
index fc01831..0775e80 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADateTimeConstructorDescriptor.java
@@ -39,6 +39,7 @@ import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -75,6 +76,7 @@ public class ADateTimeConstructorDescriptor extends AbstractScalarFunctionDynami
                     @SuppressWarnings("unchecked")
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
+                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
@@ -85,7 +87,9 @@ public class ADateTimeConstructorDescriptor extends AbstractScalarFunctionDynami
                             byte[] serString = outInput.getByteArray();
                             if (serString[0] == SER_STRING_TYPE_TAG) {
 
-                                int stringLength = (serString[1] & 0xff << 8) + (serString[2] & 0xff << 0);
+                                utf8Ptr.set(serString, 1, outInput.getLength() - 1);
+                                int stringLength = utf8Ptr.getUTF8Length();
+                                int startOffset = utf8Ptr.getCharStartOffset();
                                 // the string to be parsed should be at least 14 characters: YYYYMMDDhhmmss
                                 if (stringLength < 14) {
                                     throw new AlgebricksException(errorMessage
@@ -93,21 +97,23 @@ public class ADateTimeConstructorDescriptor extends AbstractScalarFunctionDynami
                                             + stringLength);
                                 }
                                 // +1 if it is negative (-)
-                                short timeOffset = (short) ((serString[3] == '-') ? 1 : 0);
+                                short timeOffset = (short) ((serString[startOffset] == '-') ? 1 : 0);
 
                                 timeOffset += 8;
 
-                                if (serString[3 + timeOffset] != 'T') {
+                                if (serString[startOffset + timeOffset] != 'T') {
                                     timeOffset += 2;
-                                    if (serString[3 + timeOffset] != 'T') {
+                                    if (serString[startOffset + timeOffset] != 'T') {
                                         throw new AlgebricksException(errorMessage + ": missing T");
                                     }
                                 }
 
-                                long chrononTimeInMs = ADateParserFactory.parseDatePart(serString, 3, timeOffset);
+                                long chrononTimeInMs = ADateParserFactory
+                                        .parseDatePart(serString, startOffset, timeOffset);
 
-                                chrononTimeInMs += ATimeParserFactory.parseTimePart(serString, 3 + timeOffset + 1,
-                                        stringLength - timeOffset - 1);
+                                chrononTimeInMs += ATimeParserFactory
+                                        .parseTimePart(serString, startOffset + timeOffset + 1,
+                                                stringLength - timeOffset - 1);
 
                                 aDateTime.setValue(chrononTimeInMs);
                                 datetimeSerde.serialize(aDateTime, out);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADayTimeDurationConstructorDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADayTimeDurationConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADayTimeDurationConstructorDescriptor.java
index 916c5f3..67cd3d5 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADayTimeDurationConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADayTimeDurationConstructorDescriptor.java
@@ -38,6 +38,7 @@ import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -76,6 +77,7 @@ public class ADayTimeDurationConstructorDescriptor extends AbstractScalarFunctio
                     @SuppressWarnings("unchecked")
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
+                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
@@ -86,9 +88,11 @@ public class ADayTimeDurationConstructorDescriptor extends AbstractScalarFunctio
 
                             if (serString[0] == SER_STRING_TYPE_TAG) {
 
-                                int stringLength = (serString[1] & 0xff << 8) + (serString[2] & 0xff << 0);
+                                utf8Ptr.set(serString, 1, outInput.getLength() -1);
+                                int stringLength = utf8Ptr.getUTF8Length();
+                                int startOffset = utf8Ptr.getCharStartOffset();
 
-                                ADurationParserFactory.parseDuration(serString, 3, stringLength, aDayTimeDuration,
+                                ADurationParserFactory.parseDuration(serString, startOffset, stringLength, aDayTimeDuration,
                                         ADurationParseOption.DAY_TIME);
 
                                 dayTimeDurationSerde.serialize(aDayTimeDuration, out);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADoubleConstructorDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADoubleConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADoubleConstructorDescriptor.java
index 39b7a16..2ad883a 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADoubleConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADoubleConstructorDescriptor.java
@@ -39,8 +39,10 @@ import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.api.dataflow.value.IBinaryComparator;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
+import org.apache.hyracks.util.string.UTF8StringUtil;
 
 public class ADoubleConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
@@ -67,9 +69,9 @@ public class ADoubleConstructorDescriptor extends AbstractScalarFunctionDynamicD
                     private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
                     private ICopyEvaluator eval = args[0].createEvaluator(outInput);
                     private String errorMessage = "This can not be an instance of double";
-                    private final byte[] POSITIVE_INF = { 0, 3, 'I', 'N', 'F' };
-                    private final byte[] NEGATIVE_INF = { 0, 4, '-', 'I', 'N', 'F' };
-                    private final byte[] NAN = { 0, 3, 'N', 'a', 'N' };
+                    private final byte[] POSITIVE_INF = UTF8StringUtil.writeStringToBytes("INF");
+                    private final byte[] NEGATIVE_INF = UTF8StringUtil.writeStringToBytes("-INF");
+                    private final byte[] NAN = UTF8StringUtil.writeStringToBytes("NaN");
                     // private int offset = 3, value = 0, integerPart = 0,
                     // fractionPart = 0, exponentPart = 0,
                     // pointIndex = 0, eIndex = 1;
@@ -87,6 +89,8 @@ public class ADoubleConstructorDescriptor extends AbstractScalarFunctionDynamicD
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
 
+                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
+
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
 
@@ -102,12 +106,14 @@ public class ADoubleConstructorDescriptor extends AbstractScalarFunctionDynamicD
                                 } else if (utf8BinaryComparator.compare(serString, 1, outInput.getLength(),
                                         NEGATIVE_INF, 0, 6) == 0) {
                                     aDouble.setValue(Double.NEGATIVE_INFINITY);
-                                } else if (utf8BinaryComparator.compare(serString, 1, outInput.getLength(), NAN, 0, 5) == 0) {
+                                } else if (utf8BinaryComparator.compare(serString, 1, outInput.getLength(), NAN, 0, 5)
+                                        == 0) {
                                     aDouble.setValue(Double.NaN);
-                                } else
+                                } else {
                                     // out.writeDouble(parseDouble(serString));
-                                    aDouble.setValue(Double.parseDouble(new String(serString, 3,
-                                            outInput.getLength() - 3, "UTF-8")));
+                                    utf8Ptr.set(serString, 1, outInput.getLength() - 1);
+                                    aDouble.setValue(Double.parseDouble(utf8Ptr.toString()));
+                                }
                                 doubleSerde.serialize(aDouble, out);
                             } else if (serString[0] == SER_NULL_TYPE_TAG)
                                 nullSerde.serialize(ANull.NULL, out);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADurationConstructorDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADurationConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADurationConstructorDescriptor.java
index 3d8c4e9..c51c5f2 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADurationConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ADurationConstructorDescriptor.java
@@ -38,6 +38,7 @@ import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -74,6 +75,7 @@ public class ADurationConstructorDescriptor extends AbstractScalarFunctionDynami
                     @SuppressWarnings("unchecked")
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
+                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
@@ -85,10 +87,12 @@ public class ADurationConstructorDescriptor extends AbstractScalarFunctionDynami
 
                             if (serString[0] == SER_STRING_TYPE_TAG) {
 
-                                int stringLength = (serString[1] & 0xff << 8) + (serString[2] & 0xff << 0);
+                                utf8Ptr.set(serString, 1, outInput.getLength() - 1);
+                                int stringLength = utf8Ptr.getUTF8Length();
 
-                                ADurationParserFactory.parseDuration(serString, 3, stringLength, aDuration,
-                                        ADurationParseOption.All);
+                                ADurationParserFactory
+                                        .parseDuration(serString, utf8Ptr.getCharStartOffset(), stringLength, aDuration,
+                                                ADurationParseOption.All);
 
                                 durationSerde.serialize(aDuration, out);
                             } else if (serString[0] == SER_NULL_TYPE_TAG) {

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AFloatConstructorDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AFloatConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AFloatConstructorDescriptor.java
index b274419..3de5265 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AFloatConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AFloatConstructorDescriptor.java
@@ -39,8 +39,10 @@ import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.api.dataflow.value.IBinaryComparator;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
+import org.apache.hyracks.util.string.UTF8StringUtil;
 
 public class AFloatConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
@@ -66,9 +68,10 @@ public class AFloatConstructorDescriptor extends AbstractScalarFunctionDynamicDe
                     private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
                     private ICopyEvaluator eval = args[0].createEvaluator(outInput);
                     private String errorMessage = "This can not be an instance of float";
-                    private final byte[] POSITIVE_INF = { 0, 3, 'I', 'N', 'F' };
-                    private final byte[] NEGATIVE_INF = { 0, 4, '-', 'I', 'N', 'F' };
-                    private final byte[] NAN = { 0, 3, 'N', 'a', 'N' };
+                    private final byte[] POSITIVE_INF = UTF8StringUtil.writeStringToBytes("INF");
+                    private final byte[] NEGATIVE_INF = UTF8StringUtil.writeStringToBytes("-INF");
+                    private final byte[] NAN = UTF8StringUtil.writeStringToBytes("NaN");
+
                     // private int offset = 3, value = 0, pointIndex = 0, eIndex
                     // = 1;
                     // private int integerPart = 0, fractionPart = 0,
@@ -86,6 +89,7 @@ public class AFloatConstructorDescriptor extends AbstractScalarFunctionDynamicDe
                     @SuppressWarnings("unchecked")
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
+                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
@@ -101,11 +105,13 @@ public class AFloatConstructorDescriptor extends AbstractScalarFunctionDynamicDe
                                 } else if (utf8BinaryComparator.compare(serString, 1, outInput.getLength(),
                                         NEGATIVE_INF, 0, 6) == 0) {
                                     aFloat.setValue(Float.NEGATIVE_INFINITY);
-                                } else if (utf8BinaryComparator.compare(serString, 1, outInput.getLength(), NAN, 0, 5) == 0) {
+                                } else if (utf8BinaryComparator.compare(serString, 1, outInput.getLength(), NAN, 0, 5)
+                                        == 0) {
                                     aFloat.setValue(Float.NaN);
-                                } else
-                                    aFloat.setValue(Float.parseFloat(new String(serString, 3, outInput.getLength() - 3,
-                                            "UTF-8")));
+                                } else {
+                                    utf8Ptr.set(serString, 1, outInput.getLength() -1);
+                                    aFloat.setValue(Float.parseFloat(utf8Ptr.toString()));
+                                }
                                 floatSerde.serialize(aFloat, out);
 
                             } else if (serString[0] == SER_NULL_TYPE_TAG)

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt16ConstructorDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt16ConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt16ConstructorDescriptor.java
index 838e3c0..c498217 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt16ConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt16ConstructorDescriptor.java
@@ -37,6 +37,7 @@ import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -75,6 +76,7 @@ public class AInt16ConstructorDescriptor extends AbstractScalarFunctionDynamicDe
                     @SuppressWarnings("unchecked")
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
+                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
@@ -84,7 +86,8 @@ public class AInt16ConstructorDescriptor extends AbstractScalarFunctionDynamicDe
                             eval.evaluate(tuple);
                             byte[] serString = outInput.getByteArray();
                             if (serString[0] == SER_STRING_TYPE_TAG) {
-                                offset = 3;
+                                utf8Ptr.set(serString, 1, outInput.getLength()-1);
+                                offset = utf8Ptr.getCharStartOffset();
                                 value = 0;
                                 positive = true;
                                 if (serString[offset] == '+')

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt32ConstructorDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt32ConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt32ConstructorDescriptor.java
index ddc78c8..f08972f 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt32ConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt32ConstructorDescriptor.java
@@ -37,6 +37,7 @@ import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -74,6 +75,7 @@ public class AInt32ConstructorDescriptor extends AbstractScalarFunctionDynamicDe
                     @SuppressWarnings("unchecked")
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
+                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
@@ -83,7 +85,8 @@ public class AInt32ConstructorDescriptor extends AbstractScalarFunctionDynamicDe
                             eval.evaluate(tuple);
                             byte[] serString = outInput.getByteArray();
                             if (serString[0] == SER_STRING_TYPE_TAG) {
-                                offset = 3;
+                                utf8Ptr.set(serString, 1, outInput.getLength()-1);
+                                offset = utf8Ptr.getCharStartOffset();
                                 value = 0;
                                 positive = true;
                                 if (serString[offset] == '+')

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt64ConstructorDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt64ConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt64ConstructorDescriptor.java
index f766c82..eb43c5d 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt64ConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt64ConstructorDescriptor.java
@@ -37,6 +37,7 @@ import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -75,6 +76,7 @@ public class AInt64ConstructorDescriptor extends AbstractScalarFunctionDynamicDe
                     @SuppressWarnings("unchecked")
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
+                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
@@ -84,7 +86,8 @@ public class AInt64ConstructorDescriptor extends AbstractScalarFunctionDynamicDe
                             eval.evaluate(tuple);
                             byte[] serString = outInput.getByteArray();
                             if (serString[0] == SER_STRING_TYPE_TAG) {
-                                offset = 3;
+                                utf8Ptr.set(serString, 1, outInput.getLength()-1);
+                                offset = utf8Ptr.getCharStartOffset();
                                 value = 0;
                                 positive = true;
                                 if (serString[offset] == '+')

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt8ConstructorDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt8ConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt8ConstructorDescriptor.java
index d77c424..2c8010b 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt8ConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AInt8ConstructorDescriptor.java
@@ -37,6 +37,7 @@ import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -75,6 +76,7 @@ public class AInt8ConstructorDescriptor extends AbstractScalarFunctionDynamicDes
                     @SuppressWarnings("unchecked")
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
+                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
@@ -84,7 +86,8 @@ public class AInt8ConstructorDescriptor extends AbstractScalarFunctionDynamicDes
                             eval.evaluate(tuple);
                             byte[] serString = outInput.getByteArray();
                             if (serString[0] == SER_STRING_TYPE_TAG) {
-                                offset = 3;
+                                utf8Ptr.set(serString, 1, outInput.getLength()-1);
+                                offset = utf8Ptr.getCharStartOffset();
                                 value = 0;
                                 positive = true;
                                 if (serString[offset] == '+')

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalFromDateConstructorDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalFromDateConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalFromDateConstructorDescriptor.java
index 0684018..d238938 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalFromDateConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalFromDateConstructorDescriptor.java
@@ -41,6 +41,7 @@ import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -82,6 +83,7 @@ public class AIntervalFromDateConstructorDescriptor extends AbstractScalarFuncti
                     @SuppressWarnings("unchecked")
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
+                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
@@ -104,10 +106,11 @@ public class AIntervalFromDateConstructorDescriptor extends AbstractScalarFuncti
                             if (argOut0.getByteArray()[0] == SER_DATE_TYPE_TAG) {
                                 intervalStart = ADateSerializerDeserializer.getChronon(argOut0.getByteArray(), 1);
                             } else if (argOut0.getByteArray()[0] == SER_STRING_TYPE_TAG) {
-                                int stringLength = (argOut0.getByteArray()[1] & 0xff << 8)
-                                        + (argOut0.getByteArray()[2] & 0xff << 0);
-                                intervalStart = ADateParserFactory.parseDatePart(argOut0.getByteArray(), 3,
-                                        stringLength) / GregorianCalendarSystem.CHRONON_OF_DAY;
+                                utf8Ptr.set(argOut0.getByteArray(), 1, argOut0.getLength() - 1);
+                                int stringLength = utf8Ptr.getUTF8Length();
+                                intervalStart = ADateParserFactory
+                                        .parseDatePart(utf8Ptr.getByteArray(), utf8Ptr.getCharStartOffset(),
+                                                stringLength) / GregorianCalendarSystem.CHRONON_OF_DAY;
                             } else {
                                 throw new AlgebricksException(FID.getName()
                                         + ": expects NULL/STRING/DATE for the first argument, but got "
@@ -117,10 +120,11 @@ public class AIntervalFromDateConstructorDescriptor extends AbstractScalarFuncti
                             if (argOut1.getByteArray()[0] == SER_DATE_TYPE_TAG) {
                                 intervalEnd = ADateSerializerDeserializer.getChronon(argOut1.getByteArray(), 1);
                             } else if (argOut1.getByteArray()[0] == SER_STRING_TYPE_TAG) {
-                                int stringLength = (argOut1.getByteArray()[1] & 0xff << 8)
-                                        + (argOut1.getByteArray()[2] & 0xff << 0);
-                                intervalEnd = ADateParserFactory.parseDatePart(argOut1.getByteArray(), 3, stringLength)
-                                        / GregorianCalendarSystem.CHRONON_OF_DAY;
+                                utf8Ptr.set(argOut1.getByteArray(), 1, argOut1.getLength() - 1);
+                                int stringLength = utf8Ptr.getUTF8Length();
+                                intervalEnd = ADateParserFactory
+                                        .parseDatePart(utf8Ptr.getByteArray(), utf8Ptr.getCharStartOffset(),
+                                                stringLength) / GregorianCalendarSystem.CHRONON_OF_DAY;
                             } else {
                                 throw new AlgebricksException(FID.getName()
                                         + ": expects NULL/STRING/DATE for the second argument, but got "

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalFromDateTimeConstructorDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalFromDateTimeConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalFromDateTimeConstructorDescriptor.java
index 7f731d4..939485e 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalFromDateTimeConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalFromDateTimeConstructorDescriptor.java
@@ -21,7 +21,6 @@ package org.apache.asterix.runtime.evaluators.constructors;
 import java.io.DataOutput;
 import java.io.IOException;
 
-import org.apache.asterix.common.functions.FunctionConstants;
 import org.apache.asterix.dataflow.data.nontagged.serde.ADateTimeSerializerDeserializer;
 import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.om.base.AInterval;
@@ -42,6 +41,7 @@ import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -83,6 +83,7 @@ public class AIntervalFromDateTimeConstructorDescriptor extends AbstractScalarFu
                     @SuppressWarnings("unchecked")
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
+                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
@@ -106,20 +107,24 @@ public class AIntervalFromDateTimeConstructorDescriptor extends AbstractScalarFu
                                 intervalStart = ADateTimeSerializerDeserializer.getChronon(argOut0.getByteArray(), 1);
                             } else if (argOut0.getByteArray()[0] == SER_STRING_TYPE_TAG) {
                                 // start datetime
-                                int stringLength = (argOut0.getByteArray()[1] & 0xff << 8)
-                                        + (argOut0.getByteArray()[2] & 0xff << 0);
+                                utf8Ptr.set(argOut0.getByteArray(), 1, argOut0.getLength() - 1);
+
+                                int stringLength = utf8Ptr.getUTF8Length();
                                 // get offset for time part: +1 if it is negative (-)
-                                short timeOffset = (short) ((argOut0.getByteArray()[3] == '-') ? 1 : 0);
+                                int startOffset = utf8Ptr.getCharStartOffset();
+                                short timeOffset = (short) ((argOut0.getByteArray()[startOffset] == '-') ? 1 : 0);
                                 timeOffset += 8;
-                                if (argOut0.getByteArray()[3 + timeOffset] != 'T') {
+                                if (argOut0.getByteArray()[startOffset + timeOffset] != 'T') {
                                     timeOffset += 2;
-                                    if (argOut0.getByteArray()[3 + timeOffset] != 'T') {
+                                    if (argOut0.getByteArray()[startOffset + timeOffset] != 'T') {
                                         throw new AlgebricksException(errorMessage + ": missing T");
                                     }
                                 }
-                                intervalStart = ADateParserFactory.parseDatePart(argOut0.getByteArray(), 3, timeOffset);
-                                intervalStart += ATimeParserFactory.parseTimePart(argOut0.getByteArray(),
-                                        3 + timeOffset + 1, stringLength - timeOffset - 1);
+                                intervalStart = ADateParserFactory
+                                        .parseDatePart(argOut0.getByteArray(), startOffset, timeOffset);
+                                intervalStart += ATimeParserFactory
+                                        .parseTimePart(argOut0.getByteArray(), startOffset + timeOffset + 1,
+                                                stringLength - timeOffset - 1);
                             } else {
                                 throw new AlgebricksException(FID.getName()
                                         + ": expects NULL/STRING/DATETIME for the first argument, but got "
@@ -130,20 +135,22 @@ public class AIntervalFromDateTimeConstructorDescriptor extends AbstractScalarFu
                                 intervalEnd = ADateTimeSerializerDeserializer.getChronon(argOut1.getByteArray(), 1);
                             } else if (argOut1.getByteArray()[0] == SER_STRING_TYPE_TAG) {
                                 // start datetime
-                                int stringLength = (argOut1.getByteArray()[1] & 0xff << 8)
-                                        + (argOut1.getByteArray()[2] & 0xff << 0);
+                                utf8Ptr.set(argOut1.getByteArray(), 1, argOut1.getLength() - 1);
+                                int stringLength = utf8Ptr.getUTF8Length();
                                 // get offset for time part: +1 if it is negative (-)
-                                short timeOffset = (short) ((argOut1.getByteArray()[3] == '-') ? 1 : 0);
+                                int startOffset = utf8Ptr.getCharStartOffset();
+                                short timeOffset = (short) ((argOut1.getByteArray()[startOffset] == '-') ? 1 : 0);
                                 timeOffset += 8;
-                                if (argOut1.getByteArray()[3 + timeOffset] != 'T') {
+                                if (argOut1.getByteArray()[startOffset + timeOffset] != 'T') {
                                     timeOffset += 2;
-                                    if (argOut1.getByteArray()[3 + timeOffset] != 'T') {
+                                    if (argOut1.getByteArray()[startOffset + timeOffset] != 'T') {
                                         throw new AlgebricksException(errorMessage + ": missing T");
                                     }
                                 }
-                                intervalEnd = ADateParserFactory.parseDatePart(argOut1.getByteArray(), 3, timeOffset);
+                                intervalEnd = ADateParserFactory
+                                        .parseDatePart(argOut1.getByteArray(), startOffset, timeOffset);
                                 intervalEnd += ATimeParserFactory.parseTimePart(argOut1.getByteArray(),
-                                        3 + timeOffset + 1, stringLength - timeOffset - 1);
+                                        startOffset + timeOffset + 1, stringLength - timeOffset - 1);
                             } else {
                                 throw new AlgebricksException(FID.getName()
                                         + ": expects NULL/STRING/DATETIME for the second argument, but got "

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalFromTimeConstructorDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalFromTimeConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalFromTimeConstructorDescriptor.java
index 3075ab9..dbb05e5 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalFromTimeConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalFromTimeConstructorDescriptor.java
@@ -21,7 +21,6 @@ package org.apache.asterix.runtime.evaluators.constructors;
 import java.io.DataOutput;
 import java.io.IOException;
 
-import org.apache.asterix.common.functions.FunctionConstants;
 import org.apache.asterix.dataflow.data.nontagged.serde.ATimeSerializerDeserializer;
 import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.om.base.AInterval;
@@ -42,6 +41,7 @@ import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -83,6 +83,7 @@ public class AIntervalFromTimeConstructorDescriptor extends AbstractScalarFuncti
                     @SuppressWarnings("unchecked")
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
+                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
@@ -105,12 +106,13 @@ public class AIntervalFromTimeConstructorDescriptor extends AbstractScalarFuncti
                             if (argOut0.getByteArray()[0] == SER_TIME_TYPE_TAG) {
                                 intervalStart = ATimeSerializerDeserializer.getChronon(argOut0.getByteArray(), 1);
                             } else if (argOut0.getByteArray()[0] == SER_STRING_TYPE_TAG) {
+                                utf8Ptr.set(argOut0.getByteArray(), 1, argOut0.getLength() - 1);
                                 // start date
-                                int stringLength = (argOut0.getByteArray()[1] & 0xff << 8)
-                                        + (argOut0.getByteArray()[2] & 0xff << 0);
+                                int stringLength = utf8Ptr.getUTF8Length();
 
-                                intervalStart = ATimeParserFactory.parseTimePart(argOut0.getByteArray(), 3,
-                                        stringLength);
+                                intervalStart = ATimeParserFactory
+                                        .parseTimePart(utf8Ptr.getByteArray(), utf8Ptr.getCharStartOffset(),
+                                                stringLength);
                             } else {
                                 throw new AlgebricksException(FID.getName()
                                         + ": expects NULL/STRING/TIME for the first argument, but got "
@@ -124,11 +126,13 @@ public class AIntervalFromTimeConstructorDescriptor extends AbstractScalarFuncti
                             if (argOut1.getByteArray()[0] == SER_TIME_TYPE_TAG) {
                                 intervalEnd = ATimeSerializerDeserializer.getChronon(argOut1.getByteArray(), 1);
                             } else if (argOut1.getByteArray()[0] == SER_STRING_TYPE_TAG) {
+                                utf8Ptr.set(argOut1.getByteArray(), 1, argOut1.getLength() - 1);
                                 // start date
-                                int stringLength = (argOut1.getByteArray()[1] & 0xff << 8)
-                                        + (argOut1.getByteArray()[2] & 0xff << 0);
+                                int stringLength = utf8Ptr.getUTF8Length();
 
-                                intervalEnd = ATimeParserFactory.parseTimePart(argOut1.getByteArray(), 3, stringLength);
+                                intervalEnd = ATimeParserFactory
+                                        .parseTimePart(argOut1.getByteArray(), utf8Ptr.getCharStartOffset(),
+                                                stringLength);
 
                             } else {
                                 throw new AlgebricksException(FID.getName()

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalStartFromDateConstructorDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalStartFromDateConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalStartFromDateConstructorDescriptor.java
index 4462b8e..b82dcac 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalStartFromDateConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalStartFromDateConstructorDescriptor.java
@@ -48,6 +48,7 @@ import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -93,6 +94,7 @@ public class AIntervalStartFromDateConstructorDescriptor extends AbstractScalarF
                     @SuppressWarnings("unchecked")
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
+                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
@@ -116,10 +118,11 @@ public class AIntervalStartFromDateConstructorDescriptor extends AbstractScalarF
                                 intervalStart = ADateSerializerDeserializer.getChronon(argOut0.getByteArray(), 1)
                                         * GregorianCalendarSystem.CHRONON_OF_DAY;
                             } else if (argOut0.getByteArray()[0] == SER_STRING_TYPE_TAG) {
+                                utf8Ptr.set(argOut0.getByteArray(), 1, argOut0.getLength() - 1);
                                 // start date
-                                int stringLength = (argOut0.getByteArray()[1] & 0xff << 8)
-                                        + (argOut0.getByteArray()[2] & 0xff << 0);
-                                intervalStart = ADateParserFactory.parseDatePart(argOut0.getByteArray(), 3,
+                                int stringLength = utf8Ptr.getUTF8Length();
+                                int startOffset = utf8Ptr.getCharStartOffset();
+                                intervalStart = ADateParserFactory.parseDatePart(argOut0.getByteArray(), startOffset,
                                         stringLength);
                             } else {
                                 throw new AlgebricksException(FID.getName()
@@ -134,18 +137,21 @@ public class AIntervalStartFromDateConstructorDescriptor extends AbstractScalarF
                             } else if (argOut1.getByteArray()[0] == SER_DAY_TIME_DURATION_TYPE_TAG) {
                                 intervalEnd = DurationArithmeticOperations.addDuration(intervalStart,
                                         0,
-                                        ADayTimeDurationSerializerDeserializer.getDayTime(argOut1.getByteArray(), 1), false);
+                                        ADayTimeDurationSerializerDeserializer.getDayTime(argOut1.getByteArray(), 1),
+                                        false);
                             } else if (argOut1.getByteArray()[0] == SER_YEAR_MONTH_DURATION_TYPE_TAG) {
                                 intervalEnd = DurationArithmeticOperations.addDuration(intervalStart,
-                                        AYearMonthDurationSerializerDeserializer.getYearMonth(argOut1.getByteArray(), 1),
+                                        AYearMonthDurationSerializerDeserializer
+                                                .getYearMonth(argOut1.getByteArray(), 1),
                                         0, false);
                             } else if (argOut1.getByteArray()[0] == SER_STRING_TYPE_TAG) {
                                 // duration
-                                int stringLength = (argOut1.getByteArray()[1] & 0xff << 8)
-                                        + (argOut1.getByteArray()[2] & 0xff << 0);
+                                utf8Ptr.set(argOut1.getByteArray(), 1, argOut1.getLength() - 1);
+                                int stringLength = utf8Ptr.getUTF8Length();
 
-                                ADurationParserFactory.parseDuration(argOut1.getByteArray(), 3, stringLength,
-                                        aDuration, ADurationParseOption.All);
+                                ADurationParserFactory
+                                        .parseDuration(argOut1.getByteArray(), utf8Ptr.getCharStartOffset(),
+                                                stringLength, aDuration, ADurationParseOption.All);
                                 intervalEnd = DurationArithmeticOperations.addDuration(intervalStart,
                                         aDuration.getMonths(), aDuration.getMilliseconds(), false);
                             } else {

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalStartFromDateTimeConstructorDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalStartFromDateTimeConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalStartFromDateTimeConstructorDescriptor.java
index 826e3f8..3ad1cc3 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalStartFromDateTimeConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalStartFromDateTimeConstructorDescriptor.java
@@ -32,10 +32,10 @@ import org.apache.asterix.om.base.AMutableInterval;
 import org.apache.asterix.om.base.ANull;
 import org.apache.asterix.om.base.temporal.ADateParserFactory;
 import org.apache.asterix.om.base.temporal.ADurationParserFactory;
+import org.apache.asterix.om.base.temporal.ADurationParserFactory.ADurationParseOption;
 import org.apache.asterix.om.base.temporal.ATimeParserFactory;
 import org.apache.asterix.om.base.temporal.DurationArithmeticOperations;
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
-import org.apache.asterix.om.base.temporal.ADurationParserFactory.ADurationParseOption;
 import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
 import org.apache.asterix.om.types.ATypeTag;
@@ -48,6 +48,7 @@ import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -93,6 +94,7 @@ public class AIntervalStartFromDateTimeConstructorDescriptor extends AbstractSca
                     @SuppressWarnings("unchecked")
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
+                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
@@ -115,24 +117,27 @@ public class AIntervalStartFromDateTimeConstructorDescriptor extends AbstractSca
                             if (argOut0.getByteArray()[0] == SER_DATETIME_TYPE_TAG) {
                                 intervalStart = ADateTimeSerializerDeserializer.getChronon(argOut0.getByteArray(), 1);
                             } else if (argOut0.getByteArray()[0] == SER_STRING_TYPE_TAG) {
-                                int stringLength = (argOut0.getByteArray()[1] & 0xff << 8)
-                                        + (argOut0.getByteArray()[2] & 0xff << 0);
+                                utf8Ptr.set(argOut0.getByteArray(), 1, argOut0.getLength() - 1);
+
+                                int stringLength = utf8Ptr.getUTF8Length();
+                                int startOffset = utf8Ptr.getCharStartOffset();
 
                                 // get offset for time part: +1 if it is negative (-)
-                                short timeOffset = (short) ((argOut0.getByteArray()[3] == '-') ? 1 : 0);
+                                short timeOffset = (short) ((argOut0.getByteArray()[startOffset] == '-') ? 1 : 0);
 
                                 timeOffset += 8;
 
-                                if (argOut0.getByteArray()[3 + timeOffset] != 'T') {
+                                if (argOut0.getByteArray()[startOffset + timeOffset] != 'T') {
                                     timeOffset += 2;
-                                    if (argOut0.getByteArray()[3 + timeOffset] != 'T') {
+                                    if (argOut0.getByteArray()[startOffset + timeOffset] != 'T') {
                                         throw new AlgebricksException(errorMessage + ": missing T");
                                     }
                                 }
 
-                                intervalStart = ADateParserFactory.parseDatePart(argOut0.getByteArray(), 3, timeOffset);
+                                intervalStart = ADateParserFactory
+                                        .parseDatePart(argOut0.getByteArray(), startOffset, timeOffset);
                                 intervalStart += ATimeParserFactory.parseTimePart(argOut0.getByteArray(),
-                                        3 + timeOffset + 1, stringLength - timeOffset - 1);
+                                        startOffset + timeOffset + 1, stringLength - timeOffset - 1);
                             } else {
                                 throw new AlgebricksException(FID.getName()
                                         + ": expects NULL/STRING/DATETIME for the first argument but got "
@@ -156,11 +161,12 @@ public class AIntervalStartFromDateTimeConstructorDescriptor extends AbstractSca
                             } else if (argOut1.getByteArray()[0] == SER_STRING_TYPE_TAG) {
 
                                 // duration
-                                int stringLength = (argOut1.getByteArray()[1] & 0xff << 8)
-                                        + (argOut1.getByteArray()[2] & 0xff << 0);
+                                utf8Ptr.set(argOut1.getByteArray(), 1, argOut1.getLength() - 1);
+                                int stringLength = utf8Ptr.getUTF8Length();
 
-                                ADurationParserFactory.parseDuration(argOut1.getByteArray(), 3, stringLength,
-                                        aDuration, ADurationParseOption.All);
+                                ADurationParserFactory
+                                        .parseDuration(argOut1.getByteArray(), utf8Ptr.getCharStartOffset(),
+                                                stringLength, aDuration, ADurationParseOption.All);
 
                                 intervalEnd = DurationArithmeticOperations.addDuration(intervalStart,
                                         aDuration.getMonths(), aDuration.getMilliseconds(), false);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalStartFromTimeConstructorDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalStartFromTimeConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalStartFromTimeConstructorDescriptor.java
index 9ecc8bd..3474ed6 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalStartFromTimeConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AIntervalStartFromTimeConstructorDescriptor.java
@@ -30,11 +30,11 @@ import org.apache.asterix.om.base.AMutableDuration;
 import org.apache.asterix.om.base.AMutableInterval;
 import org.apache.asterix.om.base.ANull;
 import org.apache.asterix.om.base.temporal.ADurationParserFactory;
+import org.apache.asterix.om.base.temporal.ADurationParserFactory.ADurationParseOption;
 import org.apache.asterix.om.base.temporal.ATimeParserFactory;
 import org.apache.asterix.om.base.temporal.DurationArithmeticOperations;
 import org.apache.asterix.om.base.temporal.GregorianCalendarSystem;
 import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
-import org.apache.asterix.om.base.temporal.ADurationParserFactory.ADurationParseOption;
 import org.apache.asterix.om.functions.IFunctionDescriptor;
 import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
 import org.apache.asterix.om.types.ATypeTag;
@@ -47,6 +47,7 @@ import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -91,6 +92,7 @@ public class AIntervalStartFromTimeConstructorDescriptor extends AbstractScalarF
                     @SuppressWarnings("unchecked")
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
+                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
@@ -113,11 +115,13 @@ public class AIntervalStartFromTimeConstructorDescriptor extends AbstractScalarF
                             if (argOut0.getByteArray()[0] == SER_TIME_TYPE_TAG) {
                                 intervalStart = ATimeSerializerDeserializer.getChronon(argOut0.getByteArray(), 1);
                             } else if (argOut0.getByteArray()[0] == SER_STRING_TYPE_TAG) {
-                                int stringLength = (argOut0.getByteArray()[1] & 0xff << 8)
-                                        + (argOut0.getByteArray()[2] & 0xff << 0);
+                                utf8Ptr.set(argOut0.getByteArray(), 1, argOut0.getLength() - 1);
+
+                                int stringLength = utf8Ptr.getUTF8Length();
 
-                                intervalStart = ATimeParserFactory.parseTimePart(argOut0.getByteArray(), 3,
-                                        stringLength);
+                                intervalStart = ATimeParserFactory
+                                        .parseTimePart(argOut0.getByteArray(), utf8Ptr.getCharStartOffset(),
+                                                stringLength);
                             } else {
                                 throw new AlgebricksException(FID.getName()
                                         + ": expects NULL/STRING/TIME for the first argument, but got "
@@ -147,11 +151,12 @@ public class AIntervalStartFromTimeConstructorDescriptor extends AbstractScalarF
                             } else if (argOut1.getByteArray()[0] == SER_STRING_TYPE_TAG) {
                                 // duration
 
-                                int stringLength = (argOut1.getByteArray()[1] & 0xff << 8)
-                                        + (argOut1.getByteArray()[2] & 0xff << 0);
+                                utf8Ptr.set(argOut1.getByteArray(), 1, argOut1.getLength() - 1);
+                                int stringLength = utf8Ptr.getUTF8Length();
 
-                                ADurationParserFactory.parseDuration(argOut1.getByteArray(), 3, stringLength,
-                                        aDuration, ADurationParseOption.All);
+                                ADurationParserFactory
+                                        .parseDuration(argOut1.getByteArray(), utf8Ptr.getCharStartOffset(),
+                                                stringLength, aDuration, ADurationParseOption.All);
 
                                 if (aDuration.getMonths() != 0) {
                                     throw new AlgebricksException(FID.getName()

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ALineConstructorDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ALineConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ALineConstructorDescriptor.java
index afb1e1a..bafb778 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ALineConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ALineConstructorDescriptor.java
@@ -38,6 +38,7 @@ import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -74,6 +75,7 @@ public class ALineConstructorDescriptor extends AbstractScalarFunctionDynamicDes
                     @SuppressWarnings("unchecked")
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
+                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
@@ -83,7 +85,8 @@ public class ALineConstructorDescriptor extends AbstractScalarFunctionDynamicDes
                             eval.evaluate(tuple);
                             byte[] serString = outInput.getByteArray();
                             if (serString[0] == SER_STRING_TYPE_TAG) {
-                                String s = new String(serString, 3, outInput.getLength() - 3, "UTF-8");
+                                utf8Ptr.set(serString, 1, outInput.getLength()-1);
+                                String s = utf8Ptr.toString();
                                 int commaIndex = s.indexOf(',');
                                 int spaceIndex = s.indexOf(' ', commaIndex + 1);
                                 aPoint[0].setValue(Double.parseDouble(s.substring(0, commaIndex)),

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ANullConstructorDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ANullConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ANullConstructorDescriptor.java
index 26c9a40..4b204f4 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ANullConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ANullConstructorDescriptor.java
@@ -39,6 +39,7 @@ import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
+import org.apache.hyracks.util.string.UTF8StringUtil;
 
 public class ANullConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
@@ -63,7 +64,7 @@ public class ANullConstructorDescriptor extends AbstractScalarFunctionDynamicDes
                     private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
                     private ICopyEvaluator eval = args[0].createEvaluator(outInput);
                     private String errorMessage = "This can not be an instance of null";
-                    private final byte[] NULL = { 0, 4, 'n', 'u', 'l', 'l' };
+                    private final byte[] NULL = UTF8StringUtil.writeStringToBytes("null");
                     IBinaryComparator utf8BinaryComparator = AqlBinaryComparatorFactoryProvider.UTF8STRING_POINTABLE_INSTANCE
                             .createBinaryComparator();
                     @SuppressWarnings("unchecked")
@@ -78,7 +79,7 @@ public class ANullConstructorDescriptor extends AbstractScalarFunctionDynamicDes
                             eval.evaluate(tuple);
                             byte[] serString = outInput.getByteArray();
                             if (serString[0] == SER_STRING_TYPE_TAG) {
-                                if (utf8BinaryComparator.compare(serString, 1, outInput.getLength(), NULL, 0, 6) == 0) {
+                                if (utf8BinaryComparator.compare(serString, 1, outInput.getLength(), NULL, 0, NULL.length) == 0) {
                                     nullSerde.serialize(ANull.NULL, out);
                                     return;
                                 } else


[13/15] incubator-asterixdb git commit: ASTERIXDB-1102: VarSize Encoding to store length of String and ByteArray

Posted by ji...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/main/java/org/apache/asterix/file/ExternalIndexingOperations.java
----------------------------------------------------------------------
diff --git a/asterix-app/src/main/java/org/apache/asterix/file/ExternalIndexingOperations.java b/asterix-app/src/main/java/org/apache/asterix/file/ExternalIndexingOperations.java
index b9b5527..1b7bd1e 100644
--- a/asterix-app/src/main/java/org/apache/asterix/file/ExternalIndexingOperations.java
+++ b/asterix-app/src/main/java/org/apache/asterix/file/ExternalIndexingOperations.java
@@ -235,9 +235,10 @@ public class ExternalIndexingOperations {
                 .splitProviderAndPartitionConstraintsForFilesIndex(dataset.getDataverseName(),
                         dataset.getDatasetName(), getFilesIndexName(dataset.getDatasetName()), true);
         IFileSplitProvider secondaryFileSplitProvider = secondarySplitsAndConstraint.first;
+        FilesIndexDescription filesIndexDescription = new FilesIndexDescription();
         ILocalResourceMetadata localResourceMetadata = new ExternalBTreeLocalResourceMetadata(
-                FilesIndexDescription.EXTERNAL_FILE_INDEX_TYPE_TRAITS,
-                FilesIndexDescription.FILES_INDEX_COMP_FACTORIES, new int[] { 0 }, false, dataset.getDatasetId(),
+                filesIndexDescription.EXTERNAL_FILE_INDEX_TYPE_TRAITS,
+                filesIndexDescription.FILES_INDEX_COMP_FACTORIES, new int[] { 0 }, false, dataset.getDatasetId(),
                 mergePolicyFactory, mergePolicyFactoryProperties);
         PersistentLocalResourceFactoryProvider localResourceFactoryProvider = new PersistentLocalResourceFactoryProvider(
                 localResourceMetadata, LocalResource.ExternalBTreeResource);
@@ -263,7 +264,6 @@ public class ExternalIndexingOperations {
      * @param jobSpec
      * @param itemType
      * @param dataset
-     * @param format
      * @param files
      * @param indexerDesc
      * @return
@@ -751,10 +751,11 @@ public class ExternalIndexingOperations {
                         dataset.getDatasetId()), AsterixRuntimeComponentsProvider.RUNTIME_PROVIDER,
                 LSMBTreeIOOperationCallbackFactory.INSTANCE, storageProperties.getBloomFilterFalsePositiveRate(),
                 ExternalDatasetsRegistry.INSTANCE.getDatasetVersion(dataset), true);
+        FilesIndexDescription filesIndexDescription = new FilesIndexDescription();
         LSMTreeIndexCompactOperatorDescriptor compactOp = new LSMTreeIndexCompactOperatorDescriptor(spec,
                 AsterixRuntimeComponentsProvider.RUNTIME_PROVIDER, AsterixRuntimeComponentsProvider.RUNTIME_PROVIDER,
-                secondaryFileSplitProvider, FilesIndexDescription.EXTERNAL_FILE_INDEX_TYPE_TRAITS,
-                FilesIndexDescription.FILES_INDEX_COMP_FACTORIES, new int[] { 0 }, indexDataflowHelperFactory,
+                secondaryFileSplitProvider, filesIndexDescription.EXTERNAL_FILE_INDEX_TYPE_TRAITS,
+                filesIndexDescription.FILES_INDEX_COMP_FACTORIES, new int[] { 0 }, indexDataflowHelperFactory,
                 NoOpOperationCallbackFactory.INSTANCE);
         spec.addRoot(compactOp);
         AlgebricksPartitionConstraintHelper.setPartitionConstraintInJobSpec(spec, compactOp,

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/java/org/apache/asterix/test/runtime/ExecutionTest.java
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/java/org/apache/asterix/test/runtime/ExecutionTest.java b/asterix-app/src/test/java/org/apache/asterix/test/runtime/ExecutionTest.java
index 579a41f..9524e0d 100644
--- a/asterix-app/src/test/java/org/apache/asterix/test/runtime/ExecutionTest.java
+++ b/asterix-app/src/test/java/org/apache/asterix/test/runtime/ExecutionTest.java
@@ -19,20 +19,12 @@
 package org.apache.asterix.test.runtime;
 
 import java.io.File;
+import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang3.StringUtils;
-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 org.apache.asterix.api.common.AsterixHyracksIntegrationUtil;
 import org.apache.asterix.common.config.AsterixPropertiesAccessor;
 import org.apache.asterix.common.config.AsterixTransactionProperties;
@@ -41,6 +33,16 @@ import org.apache.asterix.external.dataset.adapter.FileSystemBasedAdapter;
 import org.apache.asterix.external.util.IdentitiyResolverFactory;
 import org.apache.asterix.test.aql.TestsUtils;
 import org.apache.asterix.testframework.context.TestCaseContext;
+import org.apache.asterix.testframework.xml.TestGroup;
+import org.apache.asterix.testframework.xml.TestSuite;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.StringUtils;
+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;
 
 /**
  * Runs the runtime test cases under 'asterix-app/src/test/resources/runtimets'.
@@ -58,6 +60,8 @@ public class ExecutionTest {
 
     protected static AsterixTransactionProperties txnProperties;
 
+    protected static TestGroup FailedGroup;
+
     @BeforeClass
     public static void setUp() throws Exception {
         System.out.println("Starting setup");
@@ -88,6 +92,9 @@ public class ExecutionTest {
         // to be node controller ids; a valid assumption in test environment.
         System.setProperty(FileSystemBasedAdapter.NODE_RESOLVER_FACTORY_PROPERTY,
                 IdentitiyResolverFactory.class.getName());
+
+        FailedGroup = new TestGroup();
+        FailedGroup.setName("failed");
     }
 
     @AfterClass
@@ -103,6 +110,24 @@ public class ExecutionTest {
             TestsUtils.deleteRec(new File(d));
         }
         HDFSCluster.getInstance().cleanup();
+
+        if (FailedGroup != null && FailedGroup.getTestCase().size() > 0) {
+            File temp = File.createTempFile("failed", ".xml");
+            javax.xml.bind.JAXBContext jaxbCtx = null;
+            jaxbCtx = javax.xml.bind.JAXBContext.newInstance(TestSuite.class.getPackage().getName());
+            javax.xml.bind.Marshaller marshaller = null;
+            marshaller = jaxbCtx.createMarshaller();
+            marshaller.setProperty(javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
+            TestSuite failedSuite = new TestSuite();
+            failedSuite.setResultOffsetPath("results");
+            failedSuite.setQueryOffsetPath("queries");
+            failedSuite.getTestGroup().add(FailedGroup);
+            marshaller.marshal(failedSuite, temp);
+            System.err.println("The failed.xml is written to :" + temp.getAbsolutePath() +
+                    ". You can copy it to only.xml by the following cmd:" +
+                    "\rcp " + temp.getAbsolutePath() + " " +
+                    Paths.get("./src/test/resources/runtimets/only.xml").toAbsolutePath());
+        }
     }
 
     private static void deleteTransactionLogs() throws Exception {
@@ -141,6 +166,6 @@ public class ExecutionTest {
 
     @Test
     public void test() throws Exception {
-            TestsUtils.executeTest(PATH_ACTUAL, tcCtx, null, false);
+        TestsUtils.executeTest(PATH_ACTUAL, tcCtx, null, false, FailedGroup);
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/only.xml
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/only.xml b/asterix-app/src/test/resources/runtimets/only.xml
index f1a0a2f..245401b 100644
--- a/asterix-app/src/test/resources/runtimets/only.xml
+++ b/asterix-app/src/test/resources/runtimets/only.xml
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <!--
  ! Licensed to the Apache Software Foundation (ASF) under one
  ! or more contributor license agreements.  See the NOTICE file
@@ -16,12 +17,7 @@
  ! specific language governing permissions and limitations
  ! under the License.
  !-->
-<test-suite
-    xmlns="urn:xml.testframework.asterix.apache.org"
-    ResultOffsetPath="results"
-    QueryOffsetPath="queries"
-    QueryFileExtension=".aql">
-    <test-group name="debug">
-
+<test-suite xmlns="urn:xml.testframework.asterix.apache.org" ResultOffsetPath="results" QueryOffsetPath="queries">
+    <test-group name="failed">
     </test-group>
 </test-suite>

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/big-object/big_object_groupby-2/big_object_groupby.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/big-object/big_object_groupby-2/big_object_groupby.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/big-object/big_object_groupby-2/big_object_groupby.3.query.aql
index 9aaf591..8afb57e 100644
--- a/asterix-app/src/test/resources/runtimets/queries/big-object/big_object_groupby-2/big_object_groupby.3.query.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/big-object/big_object_groupby-2/big_object_groupby.3.query.aql
@@ -27,7 +27,7 @@ use dataverse test;
 
 for $i in dataset('Line')
 group by $comment := $i.l_comment, $id := $i.l_orderkey with $i
-order by $id
+order by $id, string-length($comment), $comment
 return {
     "id": $id,
     "length": string-length($comment),

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/big-object/big_object_load/big_object_load.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/big-object/big_object_load/big_object_load.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/big-object/big_object_load/big_object_load.1.ddl.aql
new file mode 100644
index 0000000..14ae072
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/big-object/big_object_load/big_object_load.1.ddl.aql
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+* Description  : Create an external dataset that contains long comments fields, 10% of the records have a 32K size comments.
+                 This will trigger into the VSizeFrame path
+* Expected Res : Success
+* Date         : Jun 16 2015
+*/
+drop dataverse test if exists;
+create dataverse test;
+
+use dataverse test;
+
+create type LineType as closed {
+  l_orderkey: int32,
+  l_partkey: int32,
+  l_suppkey: int32,
+  l_linenumber: int32,
+  l_quantity: double,
+  l_extendedprice: double,
+  l_discount: double,
+  l_tax: double,
+  l_returnflag: string,
+  l_linestatus: string,
+  l_shipdate: string,
+  l_commitdate: string,
+  l_receiptdate: string,
+  l_shipinstruct: string,
+  l_shipmode: string,
+  l_comment: string
+}
+
+create type OrderType as closed {
+  o_orderkey: int32,
+  o_custkey: int32,
+  o_orderstatus: string,
+  o_totalprice: double,
+  o_orderdate: string,
+  o_orderpriority: string,
+  o_clerk: string,
+  o_shippriority: int32,
+  o_comment: string
+}
+
+create type CustomerType as closed {
+  c_custkey: int32,
+  c_name: string,
+  c_address: string,
+  c_nationkey: int32,
+  c_phone: string,
+  c_acctbal: double,
+  c_mktsegment: string,
+  c_comment: string
+}
+
+
+create external dataset Line(LineType)
+using localfs
+(("path"="nc1://data/big-object/lineitem.tbl.big"),("input-format"="text-input-format"),("format"="delimited-text"),("delimiter"="|"));
+
+create external dataset Order(OrderType)
+using localfs
+(("path"="nc1://data/big-object/order.tbl.verylong.big"),("input-format"="text-input-format"),("format"="delimited-text"),("delimiter"="|"));
+
+create external dataset Customer(CustomerType)
+using localfs
+(("path"="nc1://data/big-object/customer.tbl.big"),("input-format"="text-input-format"),("format"="delimited-text"),("delimiter"="|"));
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/big-object/big_object_load/big_object_load.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/big-object/big_object_load/big_object_load.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/big-object/big_object_load/big_object_load.2.update.aql
new file mode 100644
index 0000000..538b48c
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/big-object/big_object_load/big_object_load.2.update.aql
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+* Description  : Create an external dataset that contains long comments fields, 10% of the records have a 32K size comments.
+                 This will trigger into the VSizeFrame path
+* Expected Res : Success
+* Date         : Jun 16 2015
+*/
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/big-object/big_object_load/big_object_load.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/big-object/big_object_load/big_object_load.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/big-object/big_object_load/big_object_load.3.query.aql
new file mode 100644
index 0000000..9ae41eb
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/big-object/big_object_load/big_object_load.3.query.aql
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+* Description  : Create an external dataset that contains long comments fields, 10% of the records have a 32K size comments.
+                 This will trigger into the VSizeFrame path
+* Expected Res : Success
+* Date         : Jun 16 2015
+*/
+
+use dataverse test;
+
+for $o in dataset('Order')
+return {
+    "custkey": $o.o_custkey,
+    "orderkey": $o.o_orderkey,
+    "len-comment": string-length($o.o_comment)
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/binary/find/find.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/binary/find/find.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/binary/find/find.3.query.aql
index ff22348..58f6a96 100644
--- a/asterix-app/src/test/resources/runtimets/queries/binary/find/find.3.query.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/binary/find/find.3.query.aql
@@ -30,4 +30,4 @@ let $r7 := find-binary($x, hex('ccddaabb')) = 0
 let $r8 := find-binary($x, null)
 let $r9 := find-binary(null, null)
 let $r0 := find-binary(null, $x)
-return [ $r1 and $r2 and $r3 and $r4 and $r5 and $r6 and $r7, $r8, $r9 , $r0]
+return [ $r1 , $r2 , $r3 , $r4 , $r5 , $r6 , $r7, $r8, $r9 , $r0]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/binary/subbinary/subbinary_01.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/binary/subbinary/subbinary_01.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/binary/subbinary/subbinary_01.3.query.aql
index f3046f9..d4dce94 100644
--- a/asterix-app/src/test/resources/runtimets/queries/binary/subbinary/subbinary_01.3.query.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/binary/subbinary/subbinary_01.3.query.aql
@@ -37,5 +37,5 @@ let $r12 := sub-binary($x, 1, 256) = $x
 let $r13 := sub-binary($x, 2, 256) = hex('bbccdd')
 let $r14 := sub-binary($x, 2, -1) = hex('')
 
-return  $r1 and $r2 and $r3 and $r4 and $r5 and $r6 and $r7 and $r8 and $r9 and $r10 and $r11 and $r12 and $r13 and $r14 
+return  [ $r1 ,$r2 ,$r3 ,$r4 ,$r5 , $r6 , $r7 , $r8 , $r9 , $r10 , $r11 , $r12 , $r13 , $r14 ]
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/boolean/and_01/and_01.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/boolean/and_01/and_01.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/boolean/and_01/and_01.3.query.aql
index 7fbaac5..eee9bf4 100644
--- a/asterix-app/src/test/resources/runtimets/queries/boolean/and_01/and_01.3.query.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/boolean/and_01/and_01.3.query.aql
@@ -18,6 +18,6 @@
  */
 use dataverse test;
 
-for $x in ["true"]
-for $y in ["false"]
+let $x := boolean("true")
+let $y := boolean("false")
 return $x and $y

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/nested-index-dml/delete-from-loaded-dataset-with-index/delete-from-loaded-dataset-with-index.5.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-index-dml/delete-from-loaded-dataset-with-index/delete-from-loaded-dataset-with-index.5.query.aql b/asterix-app/src/test/resources/runtimets/queries/nested-index-dml/delete-from-loaded-dataset-with-index/delete-from-loaded-dataset-with-index.5.query.aql
index 952f64b..1190479 100644
--- a/asterix-app/src/test/resources/runtimets/queries/nested-index-dml/delete-from-loaded-dataset-with-index/delete-from-loaded-dataset-with-index.5.query.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-index-dml/delete-from-loaded-dataset-with-index/delete-from-loaded-dataset-with-index.5.query.aql
@@ -21,4 +21,5 @@ use dataverse TinySocial;
 
 for $c in dataset('TweetMessages')
 where $c.user.statuses_count<473
+order by $c.tweetid
 return $c

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/nested-index-dml/insert-into-loaded-dataset-with-index_02/insert-into-loaded-dataset-with-index_02.5.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/nested-index-dml/insert-into-loaded-dataset-with-index_02/insert-into-loaded-dataset-with-index_02.5.query.aql b/asterix-app/src/test/resources/runtimets/queries/nested-index-dml/insert-into-loaded-dataset-with-index_02/insert-into-loaded-dataset-with-index_02.5.query.aql
index 0d5e63b..45f38e9 100644
--- a/asterix-app/src/test/resources/runtimets/queries/nested-index-dml/insert-into-loaded-dataset-with-index_02/insert-into-loaded-dataset-with-index_02.5.query.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/nested-index-dml/insert-into-loaded-dataset-with-index_02/insert-into-loaded-dataset-with-index_02.5.query.aql
@@ -21,5 +21,6 @@ use dataverse TinySocial;
 
 for $c in dataset('TweetMessages')
 where $c.user.name < "Nathan Giesen" and $c.user.statuses_count < 473
+order by $c.tweetid
 return $c
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/end-with1/end-with1.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/end-with1/end-with1.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/string/end-with1/end-with1.1.ddl.aql
deleted file mode 100644
index d17ea60..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/end-with1/end-with1.1.ddl.aql
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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 test if exists;
-create dataverse test;
-

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/end-with1/end-with1.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/end-with1/end-with1.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/string/end-with1/end-with1.2.update.aql
deleted file mode 100644
index 042f3ce..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/end-with1/end-with1.2.update.aql
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/end-with1/end-with1.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/end-with1/end-with1.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/string/end-with1/end-with1.3.query.aql
deleted file mode 100644
index e4d6370..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/end-with1/end-with1.3.query.aql
+++ /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.
- */
-use dataverse test;
-
-let $c1 := end-with("hello world","werld")
-return {"result1": $c1}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/end-with2/end-with2.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/end-with2/end-with2.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/string/end-with2/end-with2.1.ddl.aql
deleted file mode 100644
index d17ea60..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/end-with2/end-with2.1.ddl.aql
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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 test if exists;
-create dataverse test;
-

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/end-with2/end-with2.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/end-with2/end-with2.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/string/end-with2/end-with2.2.update.aql
deleted file mode 100644
index 042f3ce..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/end-with2/end-with2.2.update.aql
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/end-with2/end-with2.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/end-with2/end-with2.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/string/end-with2/end-with2.3.query.aql
deleted file mode 100644
index 9250512..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/end-with2/end-with2.3.query.aql
+++ /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.
- */
-use dataverse test;
-
-let $c1 := end-with("hello world"," world")
-return {"result1": $c1}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/end-with3/end-with3.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/end-with3/end-with3.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/string/end-with3/end-with3.1.ddl.aql
deleted file mode 100644
index d17ea60..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/end-with3/end-with3.1.ddl.aql
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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 test if exists;
-create dataverse test;
-

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/end-with3/end-with3.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/end-with3/end-with3.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/string/end-with3/end-with3.2.update.aql
deleted file mode 100644
index 042f3ce..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/end-with3/end-with3.2.update.aql
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/end-with3/end-with3.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/end-with3/end-with3.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/string/end-with3/end-with3.3.query.aql
deleted file mode 100644
index ca80dd0..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/end-with3/end-with3.3.query.aql
+++ /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.
- */
-use dataverse test;
-
-let $c1 := end-with("ends","")
-return {"result1": $c1}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/end-with4/end-with4.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/end-with4/end-with4.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/string/end-with4/end-with4.1.ddl.aql
deleted file mode 100644
index d17ea60..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/end-with4/end-with4.1.ddl.aql
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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 test if exists;
-create dataverse test;
-

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/end-with4/end-with4.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/end-with4/end-with4.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/string/end-with4/end-with4.2.update.aql
deleted file mode 100644
index 042f3ce..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/end-with4/end-with4.2.update.aql
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/end-with4/end-with4.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/end-with4/end-with4.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/string/end-with4/end-with4.3.query.aql
deleted file mode 100644
index 4784297..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/end-with4/end-with4.3.query.aql
+++ /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.
- */
-use dataverse test;
-
-let $c1 := end-with("ends","ss")
-return {"result1": $c1}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/end-with5/end-with5.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/end-with5/end-with5.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/string/end-with5/end-with5.1.ddl.aql
deleted file mode 100644
index d17ea60..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/end-with5/end-with5.1.ddl.aql
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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 test if exists;
-create dataverse test;
-

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/end-with5/end-with5.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/end-with5/end-with5.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/string/end-with5/end-with5.2.update.aql
deleted file mode 100644
index 042f3ce..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/end-with5/end-with5.2.update.aql
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/end-with5/end-with5.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/end-with5/end-with5.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/string/end-with5/end-with5.3.query.aql
deleted file mode 100644
index ff4d0df..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/end-with5/end-with5.3.query.aql
+++ /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.
- */
-use dataverse test;
-
-let $c1 := end-with("ends","s")
-let $c2 := end-with("start",null)
-let $c3 := end-with(null,null)
-let $c4 := end-with("",null)
-let $c5 := end-with("","")
-let $c6 := end-with(null,"")
-
-return {"f1": $c1, "f2": $c2, "f3": $c3, "f4": $c4, "f5": $c5, "f6": $c6}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/ends-with1/ends-with1.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/ends-with1/ends-with1.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/string/ends-with1/ends-with1.1.ddl.aql
new file mode 100644
index 0000000..d17ea60
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/ends-with1/ends-with1.1.ddl.aql
@@ -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 test if exists;
+create dataverse test;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/ends-with1/ends-with1.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/ends-with1/ends-with1.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/string/ends-with1/ends-with1.2.update.aql
new file mode 100644
index 0000000..042f3ce
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/ends-with1/ends-with1.2.update.aql
@@ -0,0 +1,18 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/ends-with1/ends-with1.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/ends-with1/ends-with1.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/string/ends-with1/ends-with1.3.query.aql
new file mode 100644
index 0000000..0dea842
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/ends-with1/ends-with1.3.query.aql
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 dataverse test;
+
+let $c1 := ends-with("hello world","werld")
+return {"result1": $c1}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/ends-with2/ends-with2.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/ends-with2/ends-with2.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/string/ends-with2/ends-with2.1.ddl.aql
new file mode 100644
index 0000000..d17ea60
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/ends-with2/ends-with2.1.ddl.aql
@@ -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 test if exists;
+create dataverse test;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/ends-with2/ends-with2.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/ends-with2/ends-with2.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/string/ends-with2/ends-with2.2.update.aql
new file mode 100644
index 0000000..042f3ce
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/ends-with2/ends-with2.2.update.aql
@@ -0,0 +1,18 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/ends-with2/ends-with2.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/ends-with2/ends-with2.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/string/ends-with2/ends-with2.3.query.aql
new file mode 100644
index 0000000..035d757
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/ends-with2/ends-with2.3.query.aql
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 dataverse test;
+
+let $c1 := ends-with("hello world"," world")
+return {"result1": $c1}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/ends-with3/ends-with3.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/ends-with3/ends-with3.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/string/ends-with3/ends-with3.1.ddl.aql
new file mode 100644
index 0000000..d17ea60
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/ends-with3/ends-with3.1.ddl.aql
@@ -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 test if exists;
+create dataverse test;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/ends-with3/ends-with3.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/ends-with3/ends-with3.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/string/ends-with3/ends-with3.2.update.aql
new file mode 100644
index 0000000..042f3ce
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/ends-with3/ends-with3.2.update.aql
@@ -0,0 +1,18 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/ends-with3/ends-with3.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/ends-with3/ends-with3.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/string/ends-with3/ends-with3.3.query.aql
new file mode 100644
index 0000000..477138b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/ends-with3/ends-with3.3.query.aql
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 dataverse test;
+
+let $c1 := ends-with("ends","")
+return {"result1": $c1}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/ends-with4/ends-with4.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/ends-with4/ends-with4.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/string/ends-with4/ends-with4.1.ddl.aql
new file mode 100644
index 0000000..d17ea60
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/ends-with4/ends-with4.1.ddl.aql
@@ -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 test if exists;
+create dataverse test;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/ends-with4/ends-with4.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/ends-with4/ends-with4.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/string/ends-with4/ends-with4.2.update.aql
new file mode 100644
index 0000000..042f3ce
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/ends-with4/ends-with4.2.update.aql
@@ -0,0 +1,18 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/ends-with4/ends-with4.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/ends-with4/ends-with4.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/string/ends-with4/ends-with4.3.query.aql
new file mode 100644
index 0000000..9bf1f5b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/ends-with4/ends-with4.3.query.aql
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 dataverse test;
+
+let $c1 := ends-with("ends","ss")
+return {"result1": $c1}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/ends-with5/ends-with5.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/ends-with5/ends-with5.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/string/ends-with5/ends-with5.1.ddl.aql
new file mode 100644
index 0000000..d17ea60
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/ends-with5/ends-with5.1.ddl.aql
@@ -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 test if exists;
+create dataverse test;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/ends-with5/ends-with5.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/ends-with5/ends-with5.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/string/ends-with5/ends-with5.2.update.aql
new file mode 100644
index 0000000..042f3ce
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/ends-with5/ends-with5.2.update.aql
@@ -0,0 +1,18 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/ends-with5/ends-with5.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/ends-with5/ends-with5.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/string/ends-with5/ends-with5.3.query.aql
new file mode 100644
index 0000000..8a04dd8
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/ends-with5/ends-with5.3.query.aql
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 dataverse test;
+
+let $c1 := ends-with("ends","s")
+let $c2 := ends-with("start",null)
+let $c3 := ends-with(null,null)
+let $c4 := ends-with("",null)
+let $c5 := ends-with("","")
+let $c6 := ends-with(null,"")
+
+return {"f1": $c1, "f2": $c2, "f3": $c3, "f4": $c4, "f5": $c5, "f6": $c6}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/ends-with6/ends-with6.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/ends-with6/ends-with6.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/string/ends-with6/ends-with6.1.ddl.aql
new file mode 100644
index 0000000..d17ea60
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/ends-with6/ends-with6.1.ddl.aql
@@ -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 test if exists;
+create dataverse test;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/ends-with6/ends-with6.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/ends-with6/ends-with6.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/string/ends-with6/ends-with6.2.update.aql
new file mode 100644
index 0000000..042f3ce
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/ends-with6/ends-with6.2.update.aql
@@ -0,0 +1,18 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/ends-with6/ends-with6.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/ends-with6/ends-with6.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/string/ends-with6/ends-with6.3.query.aql
new file mode 100644
index 0000000..9802279
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/ends-with6/ends-with6.3.query.aql
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 dataverse test;
+
+for $x in ["foofoo"]
+for $y in ["barbar"]
+return [ends-with($x, "ar"), ends-with($y, "ar")]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/ends-with7/ends-with7.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/ends-with7/ends-with7.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/string/ends-with7/ends-with7.1.ddl.aql
new file mode 100644
index 0000000..a8f38a9
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/ends-with7/ends-with7.1.ddl.aql
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Testcase Name : endwith02.aql
+ * Description   : Positive tests
+ * Success       : Yes
+ * Date          : 20th April 2012
+ */
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/ends-with7/ends-with7.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/ends-with7/ends-with7.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/string/ends-with7/ends-with7.2.update.aql
new file mode 100644
index 0000000..a8f38a9
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/ends-with7/ends-with7.2.update.aql
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Testcase Name : endwith02.aql
+ * Description   : Positive tests
+ * Success       : Yes
+ * Date          : 20th April 2012
+ */
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/ends-with7/ends-with7.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/ends-with7/ends-with7.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/string/ends-with7/ends-with7.3.query.aql
new file mode 100644
index 0000000..9e5a72e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/ends-with7/ends-with7.3.query.aql
@@ -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.
+ */
+/*
+ * Testcase Name : endwith02.aql
+ * Description   : Positive tests
+ * Success       : Yes
+ * Date          : 20th April 2012
+ */
+
+
+for $a in [ends-with("aBCDEFghIa",codepoint-to-string([0041])),
+ends-with("AbCDEFghIA",codepoint-to-string([0041])),
+ends-with("AbCdEfGhIjKlMnOpQrStUvWxYz","xYz"),
+ends-with("abcdef",lowercase("ABCDEf")),
+ends-with("abcdef","abcdef"),
+ends-with("abcdef123","ef123")]
+return $a

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/ends-with8/ends-with8.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/ends-with8/ends-with8.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/string/ends-with8/ends-with8.1.ddl.aql
new file mode 100644
index 0000000..28a3cfb
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/ends-with8/ends-with8.1.ddl.aql
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Testcase Name : endwith03.aql
+ * Description   : Positive tests
+ * Success       : Yes
+ * Date          : 20th April 2012
+ */
+
+// create internal dataset, insert string data into string field and pass the string filed as input to end-with function
+
+drop dataverse test if exists;
+create dataverse test;
+
+use dataverse test;
+
+create type TestType as {
+name:string
+}
+
+create dataset testds(TestType) primary key name;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/ends-with8/ends-with8.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/ends-with8/ends-with8.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/string/ends-with8/ends-with8.2.update.aql
new file mode 100644
index 0000000..a42c36d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/ends-with8/ends-with8.2.update.aql
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Testcase Name : endwith03.aql
+ * Description   : Positive tests
+ * Success       : Yes
+ * Date          : 20th April 2012
+ */
+
+// create internal dataset, insert string data into string field and pass the string filed as input to end-with function
+
+use dataverse test;
+
+insert into dataset testds({"name":"Jim Jones"});
+insert into dataset testds({"name":"Ravi Kumar"});
+insert into dataset testds({"name":"Bruce Li"});
+insert into dataset testds({"name":"Marian Jones"});
+insert into dataset testds({"name":"Phil Jones"});
+insert into dataset testds({"name":"I am Jones"});
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/ends-with8/ends-with8.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/ends-with8/ends-with8.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/string/ends-with8/ends-with8.3.query.aql
new file mode 100644
index 0000000..c1894ba
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/string/ends-with8/ends-with8.3.query.aql
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*
+ * Testcase Name : endwith03.aql
+ * Description   : Positive tests
+ * Success       : Yes
+ * Date          : 20th April 2012
+ */
+
+// create internal dataset, insert string data into string field and pass the string filed as input to ends-with function
+
+use dataverse test;
+
+for $l in dataset('testds')
+order by $l.name
+where ends-with($l.name,"Jones")
+return $l
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/ends-with_01/ends-with_01.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/ends-with_01/ends-with_01.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/string/ends-with_01/ends-with_01.1.ddl.aql
deleted file mode 100644
index d17ea60..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/ends-with_01/ends-with_01.1.ddl.aql
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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 test if exists;
-create dataverse test;
-

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/ends-with_01/ends-with_01.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/ends-with_01/ends-with_01.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/string/ends-with_01/ends-with_01.2.update.aql
deleted file mode 100644
index 042f3ce..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/ends-with_01/ends-with_01.2.update.aql
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/ends-with_01/ends-with_01.3.query.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/ends-with_01/ends-with_01.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/string/ends-with_01/ends-with_01.3.query.aql
deleted file mode 100644
index 9802279..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/ends-with_01/ends-with_01.3.query.aql
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT 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 dataverse test;
-
-for $x in ["foofoo"]
-for $y in ["barbar"]
-return [ends-with($x, "ar"), ends-with($y, "ar")]

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/endwith02/endwith02.1.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/endwith02/endwith02.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/string/endwith02/endwith02.1.ddl.aql
deleted file mode 100644
index a8f38a9..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/endwith02/endwith02.1.ddl.aql
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-/*
- * Testcase Name : endwith02.aql
- * Description   : Positive tests
- * Success       : Yes
- * Date          : 20th April 2012
- */
-

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-app/src/test/resources/runtimets/queries/string/endwith02/endwith02.2.update.aql
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/resources/runtimets/queries/string/endwith02/endwith02.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/string/endwith02/endwith02.2.update.aql
deleted file mode 100644
index a8f38a9..0000000
--- a/asterix-app/src/test/resources/runtimets/queries/string/endwith02/endwith02.2.update.aql
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-/*
- * Testcase Name : endwith02.aql
- * Description   : Positive tests
- * Success       : Yes
- * Date          : 20th April 2012
- */
-



[04/15] incubator-asterixdb git commit: ASTERIXDB-1102: VarSize Encoding to store length of String and ByteArray

Posted by ji...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/APoint3DConstructorDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/APoint3DConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/APoint3DConstructorDescriptor.java
index d951415..97bcd02 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/APoint3DConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/APoint3DConstructorDescriptor.java
@@ -37,6 +37,7 @@ import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -72,6 +73,7 @@ public class APoint3DConstructorDescriptor extends AbstractScalarFunctionDynamic
                     @SuppressWarnings("unchecked")
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
+                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
@@ -81,7 +83,8 @@ public class APoint3DConstructorDescriptor extends AbstractScalarFunctionDynamic
                             eval.evaluate(tuple);
                             byte[] serString = outInput.getByteArray();
                             if (serString[0] == SER_STRING_TYPE_TAG) {
-                                String s = new String(serString, 3, outInput.getLength() - 3, "UTF-8");
+                                utf8Ptr.set(serString, 1, outInput.getLength()-1);
+                                String s = utf8Ptr.toString();
                                 int firstCommaIndex = s.indexOf(',');
                                 int secondCommaIndex = s.indexOf(',', firstCommaIndex + 1);
                                 aPoint3D.setValue(Double.parseDouble(s.substring(0, firstCommaIndex)),

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/APointConstructorDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/APointConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/APointConstructorDescriptor.java
index a7b47f3..49781d5 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/APointConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/APointConstructorDescriptor.java
@@ -37,6 +37,7 @@ import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -72,6 +73,7 @@ public class APointConstructorDescriptor extends AbstractScalarFunctionDynamicDe
                     @SuppressWarnings("unchecked")
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
+                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
@@ -81,7 +83,8 @@ public class APointConstructorDescriptor extends AbstractScalarFunctionDynamicDe
                             eval.evaluate(tuple);
                             byte[] serString = outInput.getByteArray();
                             if (serString[0] == SER_STRING_TYPE_TAG) {
-                                String s = new String(serString, 3, outInput.getLength() - 3, "UTF-8");
+                                utf8Ptr.set(serString, 1, outInput.getLength()-1);
+                                String s = utf8Ptr.toString();
                                 aPoint.setValue(Double.parseDouble(s.substring(0, s.indexOf(','))),
                                         Double.parseDouble(s.substring(s.indexOf(',') + 1, s.length())));
                                 pointSerde.serialize(aPoint, out);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/APolygonConstructorDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/APolygonConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/APolygonConstructorDescriptor.java
index 1eb1e9d..4fb24a5 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/APolygonConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/APolygonConstructorDescriptor.java
@@ -36,6 +36,7 @@ import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -68,6 +69,7 @@ public class APolygonConstructorDescriptor extends AbstractScalarFunctionDynamic
                     @SuppressWarnings("unchecked")
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
+                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
@@ -77,7 +79,8 @@ public class APolygonConstructorDescriptor extends AbstractScalarFunctionDynamic
                             eval.evaluate(tuple);
                             byte[] serString = outInput.getByteArray();
                             if (serString[0] == SER_STRING_TYPE_TAG) {
-                                String s = new String(serString, 3, outInput.getLength() - 3, "UTF-8");
+                                utf8Ptr.set(serString, 1, outInput.getLength()-1);
+                                String s = utf8Ptr.toString();
                                 String[] points = s.split(" ");
                                 if (points.length <= 2)
                                     throw new AlgebricksException(errorMessage);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ARectangleConstructorDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ARectangleConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ARectangleConstructorDescriptor.java
index 98aaff5..cefa031 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ARectangleConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ARectangleConstructorDescriptor.java
@@ -38,6 +38,7 @@ import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -74,6 +75,7 @@ public class ARectangleConstructorDescriptor extends AbstractScalarFunctionDynam
                     @SuppressWarnings("unchecked")
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
+                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
@@ -83,7 +85,8 @@ public class ARectangleConstructorDescriptor extends AbstractScalarFunctionDynam
                             eval.evaluate(tuple);
                             byte[] serString = outInput.getByteArray();
                             if (serString[0] == SER_STRING_TYPE_TAG) {
-                                String s = new String(serString, 3, outInput.getLength() - 3, "UTF-8");
+                                utf8Ptr.set(serString, 1, outInput.getLength() -1);
+                                String s = utf8Ptr.toString();
                                 int commaIndex = s.indexOf(',');
                                 int spaceIndex = s.indexOf(' ', commaIndex + 1);
                                 aPoint[0].setValue(Double.parseDouble(s.substring(0, commaIndex)),

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AStringConstructorDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AStringConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AStringConstructorDescriptor.java
index 290bbda..daa8ac0 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AStringConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AStringConstructorDescriptor.java
@@ -20,8 +20,6 @@ package org.apache.asterix.runtime.evaluators.constructors;
 
 import java.io.DataOutput;
 import java.io.IOException;
-import java.io.PrintStream;
-import java.io.UnsupportedEncodingException;
 
 import org.apache.asterix.dataflow.data.nontagged.serde.ABooleanSerializerDeserializer;
 import org.apache.asterix.dataflow.data.nontagged.serde.ADoubleSerializerDeserializer;
@@ -45,7 +43,8 @@ import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
-import org.apache.hyracks.data.std.util.ByteArrayAccessibleOutputStream;
+import org.apache.hyracks.data.std.util.GrowableArray;
+import org.apache.hyracks.data.std.util.UTF8StringBuilder;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public class AStringConstructorDescriptor extends AbstractScalarFunctionDynamicDescriptor {
@@ -64,110 +63,101 @@ public class AStringConstructorDescriptor extends AbstractScalarFunctionDynamicD
 
             @Override
             public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
-                try {
-                    return new ICopyEvaluator() {
+                return new ICopyEvaluator() {
 
-                        private DataOutput out = output.getDataOutput();
-                        private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
-                        private ByteArrayAccessibleOutputStream baaos = new ByteArrayAccessibleOutputStream();
-                        private PrintStream ps = new PrintStream(baaos, false, "UTF-8");
-                        private ICopyEvaluator eval = args[0].createEvaluator(outInput);
-                        @SuppressWarnings("unchecked")
-                        private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
-                                .getSerializerDeserializer(BuiltinType.ANULL);
+                    private DataOutput out = output.getDataOutput();
+                    private ArrayBackedValueStorage outInput = new ArrayBackedValueStorage();
+                    private ICopyEvaluator eval = args[0].createEvaluator(outInput);
+                    @SuppressWarnings("unchecked")
+                    private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
+                            .getSerializerDeserializer(BuiltinType.ANULL);
+                    private UTF8StringBuilder builder = new UTF8StringBuilder();
+                    private GrowableArray baaos = new GrowableArray();
 
-                        @Override
-                        public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-                            try {
-                                outInput.reset();
-                                baaos.reset();
-                                eval.evaluate(tuple);
-                                byte[] serString = outInput.getByteArray();
+                    @Override
+                    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
+                        try {
+                            outInput.reset();
+                            baaos.reset();
+                            eval.evaluate(tuple);
+                            byte[] serString = outInput.getByteArray();
 
-                                ATypeTag tt = ATypeTag.VALUE_TYPE_MAPPING[serString[0]];
-                                if (tt == ATypeTag.NULL) {
-                                    nullSerde.serialize(ANull.NULL, out);
-                                } else if (tt == ATypeTag.STRING) {
-                                    out.write(outInput.getByteArray(), outInput.getStartOffset(), outInput.getLength());
-                                } else {
-                                    baaos.write(0);
-                                    baaos.write(0);
-                                    switch (tt) {
-                                        case INT8: {
-                                            int i = AInt8SerializerDeserializer.getByte(outInput.getByteArray(), 1);
-                                            ps.print(i);
-                                            break;
-                                        }
-                                        case INT16: {
-                                            int i = AInt16SerializerDeserializer.getShort(outInput.getByteArray(), 1);
-                                            ps.print(i);
-                                            break;
-                                        }
-                                        case INT32: {
-                                            int i = AInt32SerializerDeserializer.getInt(outInput.getByteArray(), 1);
-                                            ps.print(i);
-                                            break;
-                                        }
-                                        case INT64: {
-                                            long l = AInt64SerializerDeserializer.getLong(outInput.getByteArray(), 1);
-                                            ps.print(l);
-                                            break;
-                                        }
-                                        case DOUBLE: {
-                                            double d = ADoubleSerializerDeserializer.getDouble(outInput.getByteArray(),
-                                                    1);
-                                            ps.print(d);
-                                            break;
-                                        }
-                                        case FLOAT: {
-                                            float f = AFloatSerializerDeserializer.getFloat(outInput.getByteArray(), 1);
-                                            ps.print(f);
-                                            break;
-                                        }
-                                        case BOOLEAN: {
-                                            boolean b = ABooleanSerializerDeserializer.getBoolean(
-                                                    outInput.getByteArray(), 1);
-                                            ps.print(b);
-                                            break;
-                                        }
-
-                                        // NotYetImplemented
-                                        case CIRCLE:
-                                        case DATE:
-                                        case DATETIME:
-                                        case LINE:
-                                        case TIME:
-                                        case DURATION:
-                                        case YEARMONTHDURATION:
-                                        case DAYTIMEDURATION:
-                                        case INTERVAL:
-                                        case ORDEREDLIST:
-                                        case POINT:
-                                        case POINT3D:
-                                        case RECTANGLE:
-                                        case POLYGON:
-                                        case RECORD:
-                                        case UNORDEREDLIST:
-                                        case UUID:
-                                        default:
-                                            throw new AlgebricksException("string of " + tt + " not supported");
+                            ATypeTag tt = ATypeTag.VALUE_TYPE_MAPPING[serString[0]];
+                            if (tt == ATypeTag.NULL) {
+                                nullSerde.serialize(ANull.NULL, out);
+                            } else if (tt == ATypeTag.STRING) {
+                                out.write(outInput.getByteArray(), outInput.getStartOffset(), outInput.getLength());
+                            } else {
+                                builder.reset(baaos, outInput.getLength());
+                                switch (tt) {
+                                    case INT8: {
+                                        int i = AInt8SerializerDeserializer.getByte(outInput.getByteArray(), 1);
+                                        builder.appendString(String.valueOf(i));
+                                        break;
+                                    }
+                                    case INT16: {
+                                        int i = AInt16SerializerDeserializer.getShort(outInput.getByteArray(), 1);
+                                        builder.appendString(String.valueOf(i));
+                                        break;
+                                    }
+                                    case INT32: {
+                                        int i = AInt32SerializerDeserializer.getInt(outInput.getByteArray(), 1);
+                                        builder.appendString(String.valueOf(i));
+                                        break;
+                                    }
+                                    case INT64: {
+                                        long l = AInt64SerializerDeserializer.getLong(outInput.getByteArray(), 1);
+                                        builder.appendString(String.valueOf(l));
+                                        break;
                                     }
-                                    ps.flush();
-                                    byte[] tmpStrBytes = baaos.getByteArray();
-                                    int utfLen = baaos.size() - 2;
-                                    tmpStrBytes[0] = (byte) ((utfLen >>> 8) & 0xFF);
-                                    tmpStrBytes[1] = (byte) ((utfLen >>> 0) & 0xFF);
-                                    out.write(ATypeTag.STRING.serialize());
-                                    out.write(tmpStrBytes);
+                                    case DOUBLE: {
+                                        double d = ADoubleSerializerDeserializer.getDouble(outInput.getByteArray(),
+                                                1);
+                                        builder.appendString(String.valueOf(d));
+                                        break;
+                                    }
+                                    case FLOAT: {
+                                        float f = AFloatSerializerDeserializer.getFloat(outInput.getByteArray(), 1);
+                                        builder.appendString(String.valueOf(f));
+                                        break;
+                                    }
+                                    case BOOLEAN: {
+                                        boolean b = ABooleanSerializerDeserializer.getBoolean(
+                                                outInput.getByteArray(), 1);
+                                        builder.appendString(String.valueOf(b));
+                                        break;
+                                    }
+
+                                    // NotYetImplemented
+                                    case CIRCLE:
+                                    case DATE:
+                                    case DATETIME:
+                                    case LINE:
+                                    case TIME:
+                                    case DURATION:
+                                    case YEARMONTHDURATION:
+                                    case DAYTIMEDURATION:
+                                    case INTERVAL:
+                                    case ORDEREDLIST:
+                                    case POINT:
+                                    case POINT3D:
+                                    case RECTANGLE:
+                                    case POLYGON:
+                                    case RECORD:
+                                    case UNORDEREDLIST:
+                                    case UUID:
+                                    default:
+                                        throw new AlgebricksException("string of " + tt + " not supported");
                                 }
-                            } catch (IOException e) {
-                                throw new AlgebricksException(e);
+                                builder.finish();
+                                out.write(ATypeTag.STRING.serialize());
+                                out.write(baaos.getByteArray(), 0, baaos.getLength());
                             }
+                        } catch (IOException e) {
+                            throw new AlgebricksException(e);
                         }
-                    };
-                } catch (UnsupportedEncodingException e) {
-                    throw new AlgebricksException(e);
-                }
+                    }
+                };
             }
         };
     }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeConstructorDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeConstructorDescriptor.java
index fa287ce..db8f854 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/ATimeConstructorDescriptor.java
@@ -39,6 +39,7 @@ import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -75,6 +76,7 @@ public class ATimeConstructorDescriptor extends AbstractScalarFunctionDynamicDes
                     @SuppressWarnings("unchecked")
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
+                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
@@ -85,7 +87,9 @@ public class ATimeConstructorDescriptor extends AbstractScalarFunctionDynamicDes
                             byte[] serString = outInput.getByteArray();
                             if (serString[0] == SER_STRING_TYPE_TAG) {
 
-                                int stringLength = (serString[1] & 0xff << 8) + (serString[2] & 0xff << 0);
+                                utf8Ptr.set(serString, 1, outInput.getLength()-1);
+                                int stringLength = utf8Ptr.getUTF8Length();
+                                int startOffset = utf8Ptr.getCharStartOffset();
 
                                 // the string to be parsed should be at least 6 characters: hhmmss
                                 if (stringLength < 6) {
@@ -94,7 +98,7 @@ public class ATimeConstructorDescriptor extends AbstractScalarFunctionDynamicDes
                                             + stringLength);
                                 }
 
-                                int chrononTimeInMs = ATimeParserFactory.parseTimePart(serString, 3, stringLength);
+                                int chrononTimeInMs = ATimeParserFactory.parseTimePart(serString, startOffset, stringLength);
 
                                 if (chrononTimeInMs < 0) {
                                     chrononTimeInMs += GregorianCalendarSystem.CHRONON_OF_DAY;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AUUIDFromStringConstructorDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AUUIDFromStringConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AUUIDFromStringConstructorDescriptor.java
index 16e913e..6edd393 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AUUIDFromStringConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AUUIDFromStringConstructorDescriptor.java
@@ -37,6 +37,7 @@ import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -81,6 +82,8 @@ public class AUUIDFromStringConstructorDescriptor extends AbstractScalarFunction
                     private long lsb = 0;
                     private long tmpLongValue = 0;
 
+                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
+
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
                         try {
@@ -88,14 +91,14 @@ public class AUUIDFromStringConstructorDescriptor extends AbstractScalarFunction
                             eval.evaluate(tuple);
                             byte[] serString = outInput.getByteArray();
                             if (serString[0] == SER_STRING_TYPE_TAG) {
+                                utf8Ptr.set(serString, 1, outInput.getLength()-1);
                                 msb = 0;
                                 lsb = 0;
                                 tmpLongValue = 0;
 
-                                // first byte: tag, next two bytes: length, so
-                                // we add 3 bytes.
+                                // first byte: tag, next x bytes: length
+                                int offset = utf8Ptr.getCharStartOffset();
                                 // First part - 8 bytes
-                                int offset = 3;
                                 msb = calculateLongFromHex(serString, offset, 8);
                                 msb <<= 16;
                                 offset += 8;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AYearMonthDurationConstructorDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AYearMonthDurationConstructorDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AYearMonthDurationConstructorDescriptor.java
index 1265d19..3b9c006 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AYearMonthDurationConstructorDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/constructors/AYearMonthDurationConstructorDescriptor.java
@@ -38,6 +38,7 @@ import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -76,6 +77,7 @@ public class AYearMonthDurationConstructorDescriptor extends AbstractScalarFunct
                     @SuppressWarnings("unchecked")
                     private ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
                             .getSerializerDeserializer(BuiltinType.ANULL);
+                    private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
@@ -85,11 +87,12 @@ public class AYearMonthDurationConstructorDescriptor extends AbstractScalarFunct
                             byte[] serString = outInput.getByteArray();
 
                             if (serString[0] == SER_STRING_TYPE_TAG) {
+                                utf8Ptr.set(serString, 1, outInput.getLength() - 1);
+                                int stringLength = utf8Ptr.getUTF8Length();
 
-                                int stringLength = (serString[1] & 0xff << 8) + (serString[2] & 0xff << 0);
-
-                                ADurationParserFactory.parseDuration(serString, 3, stringLength, aYearMonthDuration,
-                                        ADurationParseOption.YEAR_MONTH);
+                                ADurationParserFactory
+                                        .parseDuration(serString, utf8Ptr.getCharStartOffset(), stringLength,
+                                                aYearMonthDuration, ADurationParseOption.YEAR_MONTH);
 
                                 yearMonthDurationSerde.serialize(aYearMonthDuration, out);
                             } else if (serString[0] == SER_NULL_TYPE_TAG) {

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractBinaryStringBoolEval.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractBinaryStringBoolEval.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractBinaryStringBoolEval.java
index c8ee3eb..c40cb95 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractBinaryStringBoolEval.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractBinaryStringBoolEval.java
@@ -23,6 +23,7 @@ import java.util.Arrays;
 
 import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.om.base.ABoolean;
+import org.apache.asterix.om.base.ANull;
 import org.apache.asterix.om.base.AString;
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.asterix.om.types.BuiltinType;
@@ -33,6 +34,7 @@ import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -49,9 +51,16 @@ public abstract class AbstractBinaryStringBoolEval implements ICopyEvaluator {
     private ICopyEvaluator evalLeft;
     private ICopyEvaluator evalRight;
     private final FunctionIdentifier funcID;
+
+    private final UTF8StringPointable leftPtr = new UTF8StringPointable();
+    private final UTF8StringPointable rightPtr = new UTF8StringPointable();
+
     @SuppressWarnings({ "rawtypes" })
     private ISerializerDeserializer boolSerde = AqlSerializerDeserializerProvider.INSTANCE
             .getSerializerDeserializer(BuiltinType.ABOOLEAN);
+    @SuppressWarnings("unchecked")
+    private final ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
+            .getSerializerDeserializer(BuiltinType.ANULL);
 
     public AbstractBinaryStringBoolEval(DataOutput dout, ICopyEvaluatorFactory evalLeftFactory,
             ICopyEvaluatorFactory evalRightFactory, FunctionIdentifier funcID) throws AlgebricksException {
@@ -70,12 +79,8 @@ public abstract class AbstractBinaryStringBoolEval implements ICopyEvaluator {
         evalRight.evaluate(tuple);
 
         try {
-            if (array0.getByteArray()[0] == SER_NULL_TYPE_TAG && array1.getByteArray()[0] == SER_NULL_TYPE_TAG) {
-                boolSerde.serialize(ABoolean.TRUE, dout);
-                return;
-            } else if ((array0.getByteArray()[0] == SER_NULL_TYPE_TAG && array1.getByteArray()[0] == SER_STRING_TYPE_TAG)
-                    || (array0.getByteArray()[0] == SER_STRING_TYPE_TAG && array1.getByteArray()[0] == SER_NULL_TYPE_TAG)) {
-                boolSerde.serialize(ABoolean.FALSE, dout);
+            if (array0.getByteArray()[0] == SER_NULL_TYPE_TAG || array1.getByteArray()[0] == SER_NULL_TYPE_TAG) {
+                nullSerde.serialize(ANull.NULL, dout);
                 return;
             } else if (array0.getByteArray()[0] != SER_STRING_TYPE_TAG
                     || array1.getByteArray()[0] != SER_STRING_TYPE_TAG) {
@@ -87,15 +92,10 @@ public abstract class AbstractBinaryStringBoolEval implements ICopyEvaluator {
             throw new AlgebricksException(e);
         }
 
-        byte[] b1 = array0.getByteArray();
-        byte[] b2 = array1.getByteArray();
-
-        int lLen = array0.getLength();
-        int rLen = array1.getLength();
+        leftPtr.set(array0.getByteArray(), array0.getStartOffset() + 1, array0.getLength());
+        rightPtr.set(array1.getByteArray(), array1.getStartOffset() + 1, array1.getLength());
 
-        int lStart = array0.getStartOffset();
-        int rStart = array1.getStartOffset();
-        ABoolean res = compute(b1, lLen, lStart, b2, rLen, rStart, array0, array1) ? ABoolean.TRUE : ABoolean.FALSE;
+        ABoolean res = compute(leftPtr, rightPtr) ? ABoolean.TRUE : ABoolean.FALSE;
         try {
             boolSerde.serialize(res, dout);
         } catch (HyracksDataException e) {
@@ -103,34 +103,6 @@ public abstract class AbstractBinaryStringBoolEval implements ICopyEvaluator {
         }
     }
 
-    protected abstract boolean compute(byte[] lBytes, int lLen, int lStart, byte[] rBytes, int rLen, int rStart,
-            ArrayBackedValueStorage array0, ArrayBackedValueStorage array1) throws AlgebricksException;
+    protected abstract boolean compute(UTF8StringPointable left, UTF8StringPointable right) throws AlgebricksException;
 
-    protected String toRegex(AString pattern) {
-        StringBuilder sb = new StringBuilder();
-        String str = pattern.getStringValue();
-        for (int i = 0; i < str.length(); i++) {
-            char c = str.charAt(i);
-            if (c == '\\' && (i < str.length() - 1) && (str.charAt(i + 1) == '_' || str.charAt(i + 1) == '%')) {
-                sb.append(str.charAt(i + 1));
-                ++i;
-            } else if (c == '%') {
-                sb.append(".*");
-            } else if (c == '_') {
-                sb.append(".");
-            } else {
-                if (Arrays.binarySearch(reservedRegexChars, c) >= 0) {
-                    sb.append('\\');
-                }
-                sb.append(c);
-            }
-        }
-        return sb.toString();
-    }
-
-    private final static char[] reservedRegexChars = new char[] { '\\', '(', ')', '[', ']', '{', '}', '.', '^', '$',
-            '*', '|' };
-    static {
-        Arrays.sort(reservedRegexChars);
-    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractQuadStringStringEval.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractQuadStringStringEval.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractQuadStringStringEval.java
index 335182d..7dbc99a 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractQuadStringStringEval.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractQuadStringStringEval.java
@@ -23,12 +23,10 @@
 package org.apache.asterix.runtime.evaluators.functions;
 
 import java.io.DataOutput;
-import java.util.Arrays;
 
 import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.om.base.AMutableString;
 import org.apache.asterix.om.base.ANull;
-import org.apache.asterix.om.base.AString;
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.asterix.om.types.BuiltinType;
 import org.apache.asterix.om.types.EnumDeserializer;
@@ -38,6 +36,7 @@ import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -65,6 +64,11 @@ public abstract class AbstractQuadStringStringEval implements ICopyEvaluator {
     private ISerializerDeserializer strSerde = AqlSerializerDeserializerProvider.INSTANCE
             .getSerializerDeserializer(BuiltinType.ASTRING);
 
+    private final UTF8StringPointable strPtr1st = new UTF8StringPointable();
+    private final UTF8StringPointable strPtr2nd = new UTF8StringPointable();
+    private final UTF8StringPointable strPtr3rd = new UTF8StringPointable();
+    private final UTF8StringPointable strPtr4th = new UTF8StringPointable();
+
     public AbstractQuadStringStringEval(DataOutput dout, ICopyEvaluatorFactory eval0, ICopyEvaluatorFactory eval1,
             ICopyEvaluatorFactory eval2, ICopyEvaluatorFactory eval3, FunctionIdentifier funcID)
             throws AlgebricksException {
@@ -108,22 +112,12 @@ public abstract class AbstractQuadStringStringEval implements ICopyEvaluator {
             throw new AlgebricksException(e);
         }
 
-        byte[] b0 = array0.getByteArray();
-        byte[] b1 = array1.getByteArray();
-        byte[] b2 = array2.getByteArray();
-        byte[] b3 = array3.getByteArray();
-
-        int len0 = array0.getLength();
-        int len1 = array1.getLength();
-        int len2 = array2.getLength();
-        int len3 = array3.getLength();
+        strPtr1st.set(array0.getByteArray(), array0.getStartOffset() + 1, array0.getLength());
+        strPtr2nd.set(array1.getByteArray(), array1.getStartOffset() + 1, array1.getLength());
+        strPtr3rd.set(array2.getByteArray(), array2.getStartOffset() + 1, array2.getLength());
+        strPtr4th.set(array3.getByteArray(), array3.getStartOffset() + 1, array3.getLength());
 
-        int s0 = array0.getStartOffset();
-        int s1 = array1.getStartOffset();
-        int s2 = array2.getStartOffset();
-        int s3 = array3.getStartOffset();
-
-        String res = compute(b0, len0, s0, b1, len1, s1, b2, len2, s2, b3, len3, s3, array0, array1);
+        String res = compute(strPtr1st, strPtr2nd, strPtr3rd, strPtr4th);
         resultBuffer.setValue(res);
         try {
             strSerde.serialize(resultBuffer, dout);
@@ -132,30 +126,8 @@ public abstract class AbstractQuadStringStringEval implements ICopyEvaluator {
         }
     }
 
-    protected abstract String compute(byte[] b0, int l0, int s0, byte[] b1, int l1, int s1, byte[] b2, int l2, int s2,
-            byte[] b3, int l3, int s3, ArrayBackedValueStorage array0, ArrayBackedValueStorage array1)
-            throws AlgebricksException;
-
-    protected String toRegex(AString pattern) {
-        StringBuilder sb = new StringBuilder();
-        String str = pattern.getStringValue();
-        for (int i = 0; i < str.length(); i++) {
-            char c = str.charAt(i);
-            if (c == '\\' && (i < str.length() - 1) && (str.charAt(i + 1) == '_' || str.charAt(i + 1) == '%')) {
-                sb.append(str.charAt(i + 1));
-                ++i;
-            } else if (c == '%') {
-                sb.append(".*");
-            } else if (c == '_') {
-                sb.append(".");
-            } else {
-                if (Arrays.binarySearch(StringEvaluatorUtils.reservedRegexChars, c) >= 0) {
-                    sb.append('\\');
-                }
-                sb.append(c);
-            }
-        }
-        return sb.toString();
-    }
+    protected abstract String compute(UTF8StringPointable strPtr1st, UTF8StringPointable strPtr2nd,
+            UTF8StringPointable strPtr3rd,
+            UTF8StringPointable strPtr4th) throws AlgebricksException;
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractStringContainsEval.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractStringContainsEval.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractStringContainsEval.java
deleted file mode 100644
index e946edf..0000000
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractStringContainsEval.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.asterix.runtime.evaluators.functions;
-
-import java.io.DataOutput;
-
-import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
-import org.apache.asterix.om.base.ABoolean;
-import org.apache.asterix.om.base.ANull;
-import org.apache.asterix.om.types.ATypeTag;
-import org.apache.asterix.om.types.BuiltinType;
-import org.apache.asterix.om.types.EnumDeserializer;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
-import org.apache.hyracks.api.exceptions.HyracksDataException;
-import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
-import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
-
-public abstract class AbstractStringContainsEval implements ICopyEvaluator {
-
-    private DataOutput dout;
-
-    // allowed input types
-    private final static byte SER_NULL_TYPE_TAG = ATypeTag.NULL.serialize();
-    private final static byte SER_STRING_TYPE_TAG = ATypeTag.STRING.serialize();
-
-    private ArrayBackedValueStorage array0 = new ArrayBackedValueStorage();
-    private ArrayBackedValueStorage array1 = new ArrayBackedValueStorage();
-    private ICopyEvaluator evalString;
-    private ICopyEvaluator evalPattern;
-    @SuppressWarnings("rawtypes")
-    private ISerializerDeserializer boolSerde = AqlSerializerDeserializerProvider.INSTANCE
-            .getSerializerDeserializer(BuiltinType.ABOOLEAN);
-    @SuppressWarnings("unchecked")
-    private final ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
-            .getSerializerDeserializer(BuiltinType.ANULL);
-
-    private final FunctionIdentifier funcID;
-
-    public AbstractStringContainsEval(DataOutput dout, ICopyEvaluatorFactory evalStringFactory,
-            ICopyEvaluatorFactory evalPatternFactory, FunctionIdentifier funcID) throws AlgebricksException {
-        this.dout = dout;
-        this.evalString = evalStringFactory.createEvaluator(array0);
-        this.evalPattern = evalPatternFactory.createEvaluator(array1);
-        this.funcID = funcID;
-    }
-
-    @SuppressWarnings("unchecked")
-    @Override
-    public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
-        array1.reset();
-        evalPattern.evaluate(tuple);
-        array0.reset();
-        evalString.evaluate(tuple);
-
-        try {
-            if (array0.getByteArray()[0] == SER_NULL_TYPE_TAG || array1.getByteArray()[0] == SER_NULL_TYPE_TAG) {
-                nullSerde.serialize(ANull.NULL, dout);
-                return;
-            }
-
-            if (array0.getByteArray()[0] != SER_STRING_TYPE_TAG || array1.getByteArray()[0] != SER_STRING_TYPE_TAG) {
-                throw new AlgebricksException(funcID.getName()
-                        + ": expects input type (STRING/NULL, STRING/NULL), but got ("
-                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(array0.getByteArray()[0]) + ", "
-                        + EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(array1.getByteArray()[0]) + ").");
-            }
-        } catch (HyracksDataException e) {
-            throw new AlgebricksException(e);
-        }
-
-        byte[] b1 = array0.getByteArray();
-        byte[] b2 = array1.getByteArray();
-        ABoolean res = findMatch(b1, b2) ? ABoolean.TRUE : ABoolean.FALSE;
-        try {
-            boolSerde.serialize(res, dout);
-        } catch (HyracksDataException e) {
-            throw new AlgebricksException(e);
-        }
-    }
-
-    protected abstract boolean findMatch(byte[] strBytes, byte[] patternBytes);
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractTripleStringBoolEval.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractTripleStringBoolEval.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractTripleStringBoolEval.java
index 2740e4b..f966c1c 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractTripleStringBoolEval.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractTripleStringBoolEval.java
@@ -19,11 +19,10 @@
 package org.apache.asterix.runtime.evaluators.functions;
 
 import java.io.DataOutput;
-import java.util.Arrays;
 
 import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.om.base.ABoolean;
-import org.apache.asterix.om.base.AString;
+import org.apache.asterix.om.base.ANull;
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.asterix.om.types.BuiltinType;
 import org.apache.asterix.om.types.EnumDeserializer;
@@ -33,6 +32,7 @@ import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -50,9 +50,16 @@ public abstract class AbstractTripleStringBoolEval implements ICopyEvaluator {
     @SuppressWarnings("rawtypes")
     private ISerializerDeserializer boolSerde = AqlSerializerDeserializerProvider.INSTANCE
             .getSerializerDeserializer(BuiltinType.ABOOLEAN);
+    @SuppressWarnings("unchecked")
+    private final ISerializerDeserializer<ANull> nullSerde = AqlSerializerDeserializerProvider.INSTANCE
+            .getSerializerDeserializer(BuiltinType.ANULL);
 
     private final FunctionIdentifier funcID;
 
+    private final UTF8StringPointable strPtr1st = new UTF8StringPointable();
+    private final UTF8StringPointable strPtr2nd = new UTF8StringPointable();
+    private final UTF8StringPointable strPtr3rd = new UTF8StringPointable();
+
     public AbstractTripleStringBoolEval(DataOutput dout, ICopyEvaluatorFactory eval0, ICopyEvaluatorFactory eval1,
             ICopyEvaluatorFactory eval2, FunctionIdentifier funcID) throws AlgebricksException {
         this.dout = dout;
@@ -73,12 +80,9 @@ public abstract class AbstractTripleStringBoolEval implements ICopyEvaluator {
         eval2.evaluate(tuple);
 
         try {
-            if ((array0.getByteArray()[0] == SER_NULL_TYPE_TAG && array1.getByteArray()[0] == SER_STRING_TYPE_TAG)
-                    || (array1.getByteArray()[0] == SER_NULL_TYPE_TAG && array0.getByteArray()[0] == SER_STRING_TYPE_TAG)) {
-                boolSerde.serialize(ABoolean.FALSE, dout);
-                return;
-            } else if (array0.getByteArray()[0] == SER_NULL_TYPE_TAG && array1.getByteArray()[0] == SER_NULL_TYPE_TAG) {
-                boolSerde.serialize(ABoolean.TRUE, dout);
+            if (array0.getByteArray()[0] == SER_NULL_TYPE_TAG || array1.getByteArray()[0] == SER_NULL_TYPE_TAG
+                    || array2.getByteArray()[0] == SER_NULL_TYPE_TAG) {
+                nullSerde.serialize(ANull.NULL, dout);
                 return;
             }
 
@@ -95,19 +99,11 @@ public abstract class AbstractTripleStringBoolEval implements ICopyEvaluator {
             throw new AlgebricksException(e);
         }
 
-        byte[] b0 = array0.getByteArray();
-        byte[] b1 = array1.getByteArray();
-        byte[] b2 = array2.getByteArray();
-
-        int len0 = array0.getLength();
-        int len1 = array1.getLength();
-        int len2 = array2.getLength();
+        strPtr1st.set(array0.getByteArray(), array0.getStartOffset() + 1, array0.getLength());
+        strPtr2nd.set(array1.getByteArray(), array1.getStartOffset() + 1, array1.getLength());
+        strPtr3rd.set(array2.getByteArray(), array2.getStartOffset() + 1, array2.getLength());
 
-        int s0 = array0.getStartOffset();
-        int s1 = array1.getStartOffset();
-        int s2 = array2.getStartOffset();
-
-        ABoolean res = compute(b0, len0, s0, b1, len1, s1, b2, len2, s2, array0, array1) ? ABoolean.TRUE
+        ABoolean res = compute(strPtr1st, strPtr2nd, strPtr3rd) ? ABoolean.TRUE
                 : ABoolean.FALSE;
         try {
             boolSerde.serialize(res, dout);
@@ -116,28 +112,7 @@ public abstract class AbstractTripleStringBoolEval implements ICopyEvaluator {
         }
     }
 
-    protected abstract boolean compute(byte[] b0, int l0, int s0, byte[] b1, int l1, int s1, byte[] b2, int l2, int s2,
-            ArrayBackedValueStorage array0, ArrayBackedValueStorage array1) throws AlgebricksException;
+    protected abstract boolean compute(UTF8StringPointable strPtr1st, UTF8StringPointable strPtr2nd,
+            UTF8StringPointable strPtr3rd) throws AlgebricksException;
 
-    protected String toRegex(AString pattern) {
-        StringBuilder sb = new StringBuilder();
-        String str = pattern.getStringValue();
-        for (int i = 0; i < str.length(); i++) {
-            char c = str.charAt(i);
-            if (c == '\\' && (i < str.length() - 1) && (str.charAt(i + 1) == '_' || str.charAt(i + 1) == '%')) {
-                sb.append(str.charAt(i + 1));
-                ++i;
-            } else if (c == '%') {
-                sb.append(".*");
-            } else if (c == '_') {
-                sb.append(".");
-            } else {
-                if (Arrays.binarySearch(StringEvaluatorUtils.reservedRegexChars, c) >= 0) {
-                    sb.append('\\');
-                }
-                sb.append(c);
-            }
-        }
-        return sb.toString();
-    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractTripleStringStringEval.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractTripleStringStringEval.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractTripleStringStringEval.java
index ebedb56..9e79832 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractTripleStringStringEval.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/AbstractTripleStringStringEval.java
@@ -19,13 +19,10 @@
 package org.apache.asterix.runtime.evaluators.functions;
 
 import java.io.DataOutput;
-import java.util.Arrays;
-import java.util.regex.Pattern;
 
 import org.apache.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import org.apache.asterix.om.base.AMutableString;
 import org.apache.asterix.om.base.ANull;
-import org.apache.asterix.om.base.AString;
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.asterix.om.types.BuiltinType;
 import org.apache.asterix.om.types.EnumDeserializer;
@@ -35,6 +32,7 @@ import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
@@ -58,6 +56,10 @@ public abstract class AbstractTripleStringStringEval implements ICopyEvaluator {
     private ISerializerDeserializer strSerde = AqlSerializerDeserializerProvider.INSTANCE
             .getSerializerDeserializer(BuiltinType.ASTRING);
 
+    private final UTF8StringPointable strPtr1st = new UTF8StringPointable();
+    private final UTF8StringPointable strPtr2nd = new UTF8StringPointable();
+    private final UTF8StringPointable strPtr3rd = new UTF8StringPointable();
+
     private final FunctionIdentifier funcID;
 
     public AbstractTripleStringStringEval(DataOutput dout, ICopyEvaluatorFactory eval0, ICopyEvaluatorFactory eval1,
@@ -97,19 +99,11 @@ public abstract class AbstractTripleStringStringEval implements ICopyEvaluator {
             throw new AlgebricksException(e);
         }
 
-        byte[] b0 = array0.getByteArray();
-        byte[] b1 = array1.getByteArray();
-        byte[] b2 = array2.getByteArray();
-
-        int len0 = array0.getLength();
-        int len1 = array1.getLength();
-        int len2 = array2.getLength();
+        strPtr1st.set(array0.getByteArray(), array0.getStartOffset() + 1, array0.getLength());
+        strPtr2nd.set(array1.getByteArray(), array1.getStartOffset() + 1, array1.getLength());
+        strPtr3rd.set(array2.getByteArray(), array2.getStartOffset() + 1, array2.getLength());
 
-        int s0 = array0.getStartOffset();
-        int s1 = array1.getStartOffset();
-        int s2 = array2.getStartOffset();
-
-        String res = compute(b0, len0, s0, b1, len1, s1, b2, len2, s2, array0, array1);
+        String res = compute(strPtr1st, strPtr2nd, strPtr3rd);
         resultBuffer.setValue(res);
         try {
             strSerde.serialize(resultBuffer, dout);
@@ -118,58 +112,6 @@ public abstract class AbstractTripleStringStringEval implements ICopyEvaluator {
         }
     }
 
-    protected abstract String compute(byte[] b0, int l0, int s0, byte[] b1, int l1, int s1, byte[] b2, int l2, int s2,
-            ArrayBackedValueStorage array0, ArrayBackedValueStorage array1) throws AlgebricksException;
-
-    protected String toRegex(AString pattern) {
-        StringBuilder sb = new StringBuilder();
-        String str = pattern.getStringValue();
-        for (int i = 0; i < str.length(); i++) {
-            char c = str.charAt(i);
-            if (c == '\\' && (i < str.length() - 1) && (str.charAt(i + 1) == '_' || str.charAt(i + 1) == '%')) {
-                sb.append(str.charAt(i + 1));
-                ++i;
-            } else if (c == '%') {
-                sb.append(".*");
-            } else if (c == '_') {
-                sb.append(".");
-            } else {
-                if (Arrays.binarySearch(reservedRegexChars, c) >= 0) {
-                    sb.append('\\');
-                }
-                sb.append(c);
-            }
-        }
-        return sb.toString();
-    }
-
-    protected int toFlag(AString pattern) {
-        String str = pattern.getStringValue();
-        int flag = 0;
-        for (int i = 0; i < str.length(); i++) {
-            char c = str.charAt(i);
-            switch (c) {
-                case 's':
-                    flag |= Pattern.DOTALL;
-                    break;
-                case 'm':
-                    flag |= Pattern.MULTILINE;
-                    break;
-                case 'i':
-                    flag |= Pattern.CASE_INSENSITIVE;
-                    break;
-                case 'x':
-                    flag |= Pattern.COMMENTS;
-                    break;
-            }
-        }
-        return flag;
-    }
-
-    private final static char[] reservedRegexChars = new char[] { '\\', '(', ')', '[', ']', '{', '}', '.', '^', '$',
-            '*', '|' };
-
-    static {
-        Arrays.sort(reservedRegexChars);
-    }
+    protected abstract String compute(UTF8StringPointable strPtr1st, UTF8StringPointable strPtr2nd,
+            UTF8StringPointable strPtr3rd) throws AlgebricksException;
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CodePointToStringDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CodePointToStringDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CodePointToStringDescriptor.java
index d7b7d0a..42c5c49 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CodePointToStringDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CodePointToStringDescriptor.java
@@ -37,7 +37,7 @@ import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
 import org.apache.hyracks.data.std.api.IDataOutputProvider;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
-import org.apache.hyracks.dataflow.common.data.util.StringUtils;
+import org.apache.hyracks.util.string.UTF8StringUtil;
 
 public class CodePointToStringDescriptor extends AbstractScalarFunctionDynamicDescriptor {
 
@@ -49,6 +49,7 @@ public class CodePointToStringDescriptor extends AbstractScalarFunctionDynamicDe
     };
 
     private final static byte[] currentUTF8 = new byte[6];
+    private final static byte[] tempStoreForLength = new byte[5];
     private final byte stringTypeTag = ATypeTag.STRING.serialize();
 
     @Override
@@ -57,44 +58,6 @@ public class CodePointToStringDescriptor extends AbstractScalarFunctionDynamicDe
 
             private static final long serialVersionUID = 1L;
 
-            private int codePointToUTF8(int c) {
-                if (c < 0x80) {
-                    currentUTF8[0] = (byte) (c & 0x7F /* mask 7 lsb: 0b1111111 */);
-                    return 1;
-                } else if (c < 0x0800) {
-                    currentUTF8[0] = (byte) (c >> 6 & 0x1F | 0xC0);
-                    currentUTF8[1] = (byte) (c & 0x3F | 0x80);
-                    return 2;
-                } else if (c < 0x010000) {
-                    currentUTF8[0] = (byte) (c >> 12 & 0x0F | 0xE0);
-                    currentUTF8[1] = (byte) (c >> 6 & 0x3F | 0x80);
-                    currentUTF8[2] = (byte) (c & 0x3F | 0x80);
-                    return 3;
-                } else if (c < 0x200000) {
-                    currentUTF8[0] = (byte) (c >> 18 & 0x07 | 0xF0);
-                    currentUTF8[1] = (byte) (c >> 12 & 0x3F | 0x80);
-                    currentUTF8[2] = (byte) (c >> 6 & 0x3F | 0x80);
-                    currentUTF8[3] = (byte) (c & 0x3F | 0x80);
-                    return 4;
-                } else if (c < 0x4000000) {
-                    currentUTF8[0] = (byte) (c >> 24 & 0x03 | 0xF8);
-                    currentUTF8[1] = (byte) (c >> 18 & 0x3F | 0x80);
-                    currentUTF8[2] = (byte) (c >> 12 & 0x3F | 0x80);
-                    currentUTF8[3] = (byte) (c >> 6 & 0x3F | 0x80);
-                    currentUTF8[4] = (byte) (c & 0x3F | 0x80);
-                    return 5;
-                } else if (c < 0x80000000) {
-                    currentUTF8[0] = (byte) (c >> 30 & 0x01 | 0xFC);
-                    currentUTF8[1] = (byte) (c >> 24 & 0x3F | 0x80);
-                    currentUTF8[2] = (byte) (c >> 18 & 0x3F | 0x80);
-                    currentUTF8[3] = (byte) (c >> 12 & 0x3F | 0x80);
-                    currentUTF8[4] = (byte) (c >> 6 & 0x3F | 0x80);
-                    currentUTF8[5] = (byte) (c & 0x3F | 0x80);
-                    return 6;
-                }
-                return 0;
-            }
-
             @Override
             public ICopyEvaluator createEvaluator(final IDataOutputProvider output) throws AlgebricksException {
                 return new ICopyEvaluator() {
@@ -139,17 +102,17 @@ public class CodePointToStringDescriptor extends AbstractScalarFunctionDynamicDe
                                     int codePoint = 0;
                                     codePoint = ATypeHierarchy.getIntegerValueWithDifferentTypeTagPosition(
                                             serOrderedList, itemOffset, 1);
-                                    utf_8_len += codePointToUTF8(codePoint);
+                                    utf_8_len += UTF8StringUtil.codePointToUTF8(codePoint, currentUTF8);
                                 }
                                 out.writeByte(stringTypeTag);
-                                StringUtils.writeUTF8Len(utf_8_len, out);
+                                UTF8StringUtil.writeUTF8Length(utf_8_len, tempStoreForLength, out);
                                 for (int i = 0; i < size; i++) {
                                     int itemOffset = AOrderedListSerializerDeserializer
                                             .getItemOffset(serOrderedList, i);
                                     int codePoint = 0;
                                     codePoint = ATypeHierarchy.getIntegerValueWithDifferentTypeTagPosition(
                                             serOrderedList, itemOffset, 1);
-                                    utf_8_len = codePointToUTF8(codePoint);
+                                    utf_8_len = UTF8StringUtil.codePointToUTF8(codePoint, currentUTF8);
                                     for (int j = 0; j < utf_8_len; j++) {
                                         out.writeByte(currentUTF8[j]);
                                     }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CodepointIterator.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CodepointIterator.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CodepointIterator.java
deleted file mode 100644
index bc91000..0000000
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/CodepointIterator.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.asterix.runtime.evaluators.functions;
-
-import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
-
-public class CodepointIterator {
-    public void reset(byte[] buf, int startPos) {
-        this.buf = buf;
-        this.curPos = startPos + 2;
-        this.startPos = startPos;
-        len = UTF8StringPointable.getUTFLength(buf, startPos);
-    }
-
-    public int size() {
-        return len;
-    }
-
-    private byte[] buf;
-    private int curPos = 0;
-    private int len = 0;
-    private int startPos = 0;
-
-    public int getCodePoint() {
-        return UTF8ToCodePoint(buf, curPos);
-    }
-
-    public static int UTF8ToCodePoint(byte[] b, int s) {
-        if (b[s] >> 7 == 0) {
-            // 1 byte
-            return b[s];
-        } else if ((b[s] & 0xe0) == 0xc0) { /*
-                                            * 0xe0 = 0b1110000
-                                            */
-            // 2 bytes
-            return ((int) (b[s] & 0x1f)) << 6 | /*
-                                                * 0x3f = 0b00111111
-                                                */((int) (b[s + 1] & 0x3f));
-        } else if ((b[s] & 0xf0) == 0xe0) {
-            // 3bytes
-            return ((int) (b[s] & 0xf)) << 12 | ((int) (b[s + 1] & 0x3f)) << 6 | ((int) (b[s + 2] & 0x3f));
-        } else if ((b[s] & 0xf8) == 0xf0) {
-            // 4bytes
-            return ((int) (b[s] & 0x7)) << 18 | ((int) (b[s + 1] & 0x3f)) << 12 | ((int) (b[s + 2] & 0x3f)) << 6
-                    | ((int) (b[s + 3] & 0x3f));
-        } else if ((b[s] & 0xfc) == 0xf8) {
-            // 5bytes
-            return ((int) (b[s] & 0x3)) << 24 | ((int) (b[s + 1] & 0x3f)) << 18 | ((int) (b[s + 2] & 0x3f)) << 12
-                    | ((int) (b[s + 3] & 0x3f)) << 6 | ((int) (b[s + 4] & 0x3f));
-        } else if ((b[s] & 0xfe) == 0xfc) {
-            // 6bytes
-            return ((int) (b[s] & 0x1)) << 30 | ((int) (b[s + 1] & 0x3f)) << 24 | ((int) (b[s + 2] & 0x3f)) << 18
-                    | ((int) (b[s + 3] & 0x3f)) << 12 | ((int) (b[s + 4] & 0x3f)) << 6 | ((int) (b[s + 5] & 0x3f));
-        }
-        return 0;
-    }
-
-    public void next() {
-        int step = UTF8StringPointable.charSize(buf, curPos);
-        if (step + curPos < len + 2 + startPos)
-            curPos += step;
-    }
-
-    public boolean hasNext() {
-        int step = UTF8StringPointable.charSize(buf, curPos);
-        if (step + curPos < len + 2 + startPos)
-            return true;
-        return false;
-    }
-
-    public static int compare(CodepointIterator ls, CodepointIterator rs) {
-        CodepointIterator shortString = ls.size() < rs.size() ? ls : rs;
-
-        while (true) {
-            int c1 = ls.getCodePoint();
-            int c2 = rs.getCodePoint();
-            if (c1 != c2) {
-                return c1 - c2;
-            }
-            if (shortString.hasNext()) {
-                ls.next();
-                rs.next();
-            } else {
-                break;
-            }
-        }
-        return ls.size() - rs.size();
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/ContainsDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/ContainsDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/ContainsDescriptor.java
deleted file mode 100644
index aeffc97..0000000
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/ContainsDescriptor.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.asterix.runtime.evaluators.functions;
-
-import java.io.DataOutput;
-
-import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
-import org.apache.asterix.om.functions.IFunctionDescriptor;
-import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
-import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
-import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
-
-public class ContainsDescriptor extends AbstractScalarFunctionDynamicDescriptor {
-    private static final long serialVersionUID = 1L;
-
-    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
-        public IFunctionDescriptor createFunctionDescriptor() {
-            return new ContainsDescriptor();
-        }
-    };
-
-    @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-
-        return new ICopyEvaluatorFactory() {
-            private static final long serialVersionUID = 1L;
-
-            @Override
-            public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
-
-                DataOutput dout = output.getDataOutput();
-
-                return new AbstractStringContainsEval(dout, args[0], args[1], AsterixBuiltinFunctions.CONTAINS) {
-
-                    @Override
-                    protected boolean findMatch(byte[] strBytes, byte[] patternBytes) {
-                        int utflen1 = UTF8StringPointable.getUTFLength(strBytes, 1);
-                        int utflen2 = UTF8StringPointable.getUTFLength(patternBytes, 1);
-
-                        int s1Start = 3;
-                        int s2Start = 3;
-
-                        boolean matches = false;
-                        int maxStart = utflen1 - utflen2;
-                        int startMatch = 0;
-                        while (startMatch <= maxStart) {
-                            int c1 = startMatch;
-                            int c2 = 0;
-                            while (c1 < utflen1 && c2 < utflen2) {
-                                char ch1 = UTF8StringPointable.charAt(strBytes, s1Start + c1);
-                                char ch2 = UTF8StringPointable.charAt(patternBytes, s2Start + c2);
-
-                                if (ch1 != ch2) {
-                                    break;
-                                }
-                                c1 += UTF8StringPointable.charSize(strBytes, s1Start + c1);
-                                c2 += UTF8StringPointable.charSize(patternBytes, s2Start + c2);
-                            }
-                            if (c2 == utflen2) {
-                                matches = true;
-                                break;
-                            }
-                            startMatch += UTF8StringPointable.charSize(strBytes, s1Start + startMatch);
-                        }
-                        return matches;
-                    }
-
-                };
-            }
-        };
-    }
-
-    @Override
-    public FunctionIdentifier getIdentifier() {
-        return AsterixBuiltinFunctions.CONTAINS;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceStringIsFilterable.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceStringIsFilterable.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceStringIsFilterable.java
index e94aacf..15ce3d4 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceStringIsFilterable.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceStringIsFilterable.java
@@ -89,6 +89,8 @@ public class EditDistanceStringIsFilterable extends AbstractScalarFunctionDynami
         private final ISerializerDeserializer<ABoolean> booleanSerde = AqlSerializerDeserializerProvider.INSTANCE
                 .getSerializerDeserializer(BuiltinType.ABOOLEAN);
 
+        private final UTF8StringPointable utf8Ptr = new UTF8StringPointable();
+
         public EditDistanceStringIsFilterableEvaluator(ICopyEvaluatorFactory[] args, IDataOutputProvider output)
                 throws AlgebricksException {
             this.output = output;
@@ -110,14 +112,9 @@ public class EditDistanceStringIsFilterable extends AbstractScalarFunctionDynami
                 throw new AlgebricksException(AsterixBuiltinFunctions.EDIT_DISTANCE_STRING_IS_FILTERABLE.getName()
                         + ": expects input type STRING as first argument, but got " + typeTag + ".");
             }
-            int utf8Length = UTF8StringPointable.getUTFLength(argBuf.getByteArray(), 1);
-            int pos = 3;
-            long strLen = 0;
-            int end = pos + utf8Length;
-            while (pos < end) {
-                strLen++;
-                pos += UTF8StringPointable.charSize(argBuf.getByteArray(), pos);
-            }
+
+            utf8Ptr.set(argBuf.getByteArray(), 1, argBuf.getLength());
+            int strLen = utf8Ptr.getStringLength();
 
             // Check type and extract edit-distance threshold.
             argBuf.reset();

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EndsWithDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EndsWithDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EndsWithDescriptor.java
deleted file mode 100644
index c3bfcc1..0000000
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/EndsWithDescriptor.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.asterix.runtime.evaluators.functions;
-
-import java.io.DataOutput;
-
-import org.apache.asterix.om.functions.AsterixBuiltinFunctions;
-import org.apache.asterix.om.functions.IFunctionDescriptor;
-import org.apache.asterix.om.functions.IFunctionDescriptorFactory;
-import org.apache.asterix.runtime.evaluators.base.AbstractScalarFunctionDynamicDescriptor;
-import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluator;
-import org.apache.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import org.apache.hyracks.data.std.api.IDataOutputProvider;
-import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
-
-public class EndsWithDescriptor extends AbstractScalarFunctionDynamicDescriptor {
-    private static final long serialVersionUID = 1L;
-
-    public static final IFunctionDescriptorFactory FACTORY = new IFunctionDescriptorFactory() {
-        public IFunctionDescriptor createFunctionDescriptor() {
-            return new EndsWithDescriptor();
-        }
-    };
-
-    @Override
-    public ICopyEvaluatorFactory createEvaluatorFactory(final ICopyEvaluatorFactory[] args) throws AlgebricksException {
-
-        return new ICopyEvaluatorFactory() {
-            private static final long serialVersionUID = 1L;
-
-            @Override
-            public ICopyEvaluator createEvaluator(IDataOutputProvider output) throws AlgebricksException {
-
-                DataOutput dout = output.getDataOutput();
-
-                return new AbstractStringContainsEval(dout, args[0], args[1], AsterixBuiltinFunctions.ENDS_WITH) {
-
-                    @Override
-                    protected boolean findMatch(byte[] strBytes, byte[] patternBytes) {
-                        int utflen1 = UTF8StringPointable.getUTFLength(strBytes, 1);
-                        int utflen2 = UTF8StringPointable.getUTFLength(patternBytes, 1);
-
-                        int s1Start = 3;
-                        int s2Start = 3;
-
-                        int startMatch = utflen1 - utflen2;
-                        if (startMatch < 0) {
-                            return false;
-                        }
-                        int c1 = 0;
-                        while (c1 < startMatch) {
-                            c1 += UTF8StringPointable.charSize(strBytes, s1Start + c1);
-                        }
-                        int c2 = 0;
-                        while (c1 < utflen1 && c2 < utflen2) {
-                            char ch1 = UTF8StringPointable.charAt(strBytes, s1Start + c1);
-                            char ch2 = UTF8StringPointable.charAt(patternBytes, s2Start + c2);
-                            if (ch1 != ch2) {
-                                break;
-                            }
-                            c1 += UTF8StringPointable.charSize(strBytes, s1Start + c1);
-                            c2 += UTF8StringPointable.charSize(patternBytes, s2Start + c2);
-                        }
-                        return (c2 == utflen2);
-                    }
-
-                };
-            }
-        };
-    }
-
-    @Override
-    public FunctionIdentifier getIdentifier() {
-        return AsterixBuiltinFunctions.ENDS_WITH;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/IsNullDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/IsNullDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/IsNullDescriptor.java
index 15e623e..e7e90ad 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/IsNullDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/IsNullDescriptor.java
@@ -60,6 +60,7 @@ public class IsNullDescriptor extends AbstractScalarFunctionDynamicDescriptor {
                     private DataOutput out = output.getDataOutput();
                     private ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
                     private ICopyEvaluator eval = args[0].createEvaluator(argOut);
+                    private final AObjectSerializerDeserializer aObjSerDer = new AObjectSerializerDeserializer();
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
@@ -68,7 +69,7 @@ public class IsNullDescriptor extends AbstractScalarFunctionDynamicDescriptor {
                         boolean isNull = argOut.getByteArray()[argOut.getStartOffset()] == SER_NULL_TYPE_TAG;
                         ABoolean res = isNull ? ABoolean.TRUE : ABoolean.FALSE;
                         try {
-                            AObjectSerializerDeserializer.INSTANCE.serialize(res, out);
+                            aObjSerDer.serialize(res, out);
                         } catch (HyracksDataException e) {
                             throw new AlgebricksException(e);
                         }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/742aba85/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/IsSystemNullDescriptor.java
----------------------------------------------------------------------
diff --git a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/IsSystemNullDescriptor.java b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/IsSystemNullDescriptor.java
index 83533ba..47ae0d6 100644
--- a/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/IsSystemNullDescriptor.java
+++ b/asterix-runtime/src/main/java/org/apache/asterix/runtime/evaluators/functions/IsSystemNullDescriptor.java
@@ -60,6 +60,7 @@ public class IsSystemNullDescriptor extends AbstractScalarFunctionDynamicDescrip
                     private DataOutput out = output.getDataOutput();
                     private ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
                     private ICopyEvaluator eval = args[0].createEvaluator(argOut);
+                    private final AObjectSerializerDeserializer aObjSerDer = new AObjectSerializerDeserializer();
 
                     @Override
                     public void evaluate(IFrameTupleReference tuple) throws AlgebricksException {
@@ -68,7 +69,7 @@ public class IsSystemNullDescriptor extends AbstractScalarFunctionDynamicDescrip
                         boolean isSystemNull = argOut.getByteArray()[argOut.getStartOffset()] == SER_SYSTEM_NULL_TYPE_TAG;
                         ABoolean res = isSystemNull ? ABoolean.TRUE : ABoolean.FALSE;
                         try {
-                            AObjectSerializerDeserializer.INSTANCE.serialize(res, out);
+                            aObjSerDer.serialize(res, out);
                         } catch (HyracksDataException e) {
                             throw new AlgebricksException(e);
                         }