asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ima...@apache.org
Subject [81/85] [abbrv] incubator-asterixdb-hyracks git commit: - Fixed Type Casting issue - Reorganized duplicated internal class in the DelimitedDataParser and DelimitedDataParserFactory - Prevented a user from creating an inverted index on a dataset with a va
Date Fri, 24 Apr 2015 18:46:48 GMT
- Fixed Type Casting issue
- Reorganized duplicated internal class in the DelimitedDataParser and DelimitedDataParserFactory
- Prevented a user from creating an inverted index on a dataset with a variable-length PK

Change-Id: Ic5606501223b8d860b49a258ff49afacd7d76b9a
Reviewed-on: http://fulliautomatix.ics.uci.edu:8443/191
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <westmann@gmail.com>


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

Branch: refs/heads/master
Commit: e0f048dfd2b01a56c862ca5ee82674794715024f
Parents: 97acfe5
Author: Taewoo Kim <wangsaeu@gmail.com>
Authored: Thu Feb 12 20:35:37 2015 -0800
Committer: Ian Maxon <imaxon@uci.edu>
Committed: Sun Mar 1 21:35:34 2015 -0800

----------------------------------------------------------------------
 .../physical/HybridHashJoinPOperator.java       |   7 +-
 .../data/IBinaryIntegerInspector.java           |   8 +-
 .../runtime/base/IUnnestingPositionWriter.java  |   6 +-
 .../value/BinaryComparatorConstant.java         |  30 ++
 .../api/dataflow/value/IBinaryComparator.java   |   8 +-
 .../api/dataflow/value/IBinaryHashFunction.java |   8 +-
 .../std/accessors/MurmurHash3BinaryHash.java    |  72 ++++
 .../MurmurHash3BinaryHashFunctionFamily.java    |  48 +--
 .../comm/io/FrameTuplePairComparator.java       |   8 +-
 .../FieldHashPartitionComputerFactory.java      |   7 +-
 .../FieldHashPartitionComputerFamily.java       |   9 +-
 .../dataflow/hadoop/mapreduce/ReduceWriter.java |  15 +-
 .../file/DelimitedDataTupleParserFactory.java   | 354 +-----------------
 .../file/FieldCursorForDelimitedDataParser.java | 357 +++++++++++++++++++
 .../std/group/HashSpillableTableFactory.java    |  12 +-
 .../dataflow/std/group/ISpillableTable.java     |   6 +-
 .../ExternalGroupMergeOperatorNodePushable.java |  24 +-
 .../preclustered/PreclusteredGroupWriter.java   |   7 +-
 .../dataflow/std/join/JoinComparator.java       |  72 ++--
 .../dataflow/std/sort/FrameSorterMergeSort.java |  18 +-
 .../dataflow/std/sort/FrameSorterQuickSort.java |  10 +-
 .../hyracks/dataflow/std/sort/IFrameSorter.java |   6 +-
 .../dataflow/std/sort/ISelectionTree.java       |  28 +-
 .../sort/OptimizedExternalSortRunGenerator.java |  30 +-
 ...imizedExternalSortRunGeneratorWithLimit.java |  32 +-
 .../std/sort/RunMergingFrameReader.java         |  18 +-
 .../hyracks/dataflow/std/sort/SortMinHeap.java  |  24 +-
 .../dataflow/std/sort/SortMinMaxHeap.java       |  38 +-
 .../TPCHCustomerOrderNestedLoopJoinTest.java    |   8 +-
 .../ics/hyracks/examples/tpch/client/Main.java  |  15 +-
 .../storage/am/btree/api/IBTreeFrame.java       |   6 +-
 .../storage/am/btree/api/IBTreeLeafFrame.java   |  16 +-
 .../am/btree/api/IPrefixSlotManager.java        |  42 ++-
 .../compressors/FieldPrefixCompressor.java      |  21 +-
 .../frames/BTreeFieldPrefixNSMLeafFrame.java    |  52 ++-
 .../am/btree/frames/BTreeNSMInteriorFrame.java  |  25 +-
 .../am/btree/frames/BTreeNSMLeafFrame.java      |  48 ++-
 .../am/btree/frames/OrderedSlotManager.java     |   7 +-
 .../am/btree/impls/FieldPrefixSlotManager.java  |   9 +-
 .../storage/am/common/api/ISlotManager.java     |   7 +-
 .../storage/am/common/api/ITreeIndexFrame.java  |   9 +-
 .../am/common/ophelpers/MultiComparator.java    |  15 +-
 .../am/common/ophelpers/SingleComparator.java   |   7 +-
 .../storage/am/lsm/btree/impls/LSMBTree.java    |   6 +-
 .../am/lsm/common/api/ILSMComponentFilter.java  |  10 +-
 .../am/lsm/common/api/ILSMIndexInternal.java    |  14 +-
 .../am/lsm/common/impls/LSMComponentFilter.java |  10 +-
 .../lsm/common/impls/LSMIndexSearchCursor.java  |  21 +-
 .../invertedindex/impls/LSMInvertedIndex.java   |  16 +-
 .../FixedSizeElementInvertedListCursor.java     |   8 +-
 .../am/lsm/rtree/impls/AbstractLSMRTree.java    |   6 +-
 ...SMRTreeWithAntiMatterTuplesSearchCursor.java |  19 +-
 .../am/rtree/api/IRTreeInteriorFrame.java       |  19 +-
 .../storage/am/rtree/api/IRTreeLeafFrame.java   |  12 +-
 .../storage/am/rtree/api/IRTreePolicy.java      |   9 +-
 .../am/rtree/frames/RStarTreePolicy.java        |   9 +-
 .../am/rtree/frames/RTreeComputationUtils.java  |  12 +-
 .../storage/am/rtree/frames/RTreeNSMFrame.java  |   8 +-
 .../am/rtree/frames/RTreeNSMInteriorFrame.java  |  28 +-
 .../am/rtree/frames/RTreeNSMLeafFrame.java      |  12 +-
 .../storage/am/rtree/frames/RTreePolicy.java    |   9 +-
 .../am/rtree/impls/UnorderedSlotManager.java    |   7 +-
 ...stractModificationOperationCallbackTest.java |   9 +-
 .../AbstractSearchOperationCallbackTest.java    |   8 +-
 .../LSMBTreeSearchOperationCallbackTest.java    |   8 +-
 .../btree/perf/ConcurrentSkipListRunner.java    |  47 +--
 .../am/lsm/btree/perf/InMemorySortRunner.java   |  55 +--
 67 files changed, 1064 insertions(+), 847 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/e0f048df/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/HybridHashJoinPOperator.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/HybridHashJoinPOperator.java b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/HybridHashJoinPOperator.java
index ac45ac3..3abdec9 100644
--- a/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/HybridHashJoinPOperator.java
+++ b/algebricks/algebricks-core/src/main/java/edu/uci/ics/hyracks/algebricks/core/algebra/operators/physical/HybridHashJoinPOperator.java
@@ -3,9 +3,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * you may obtain a copy of the License from
- * 
+ *
  *     http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -253,7 +253,8 @@ class JoinMultiComparator implements ITuplePairComparator {
     }
 
     @Override
-    public int compare(IFrameTupleAccessor accessor0, int tIndex0, IFrameTupleAccessor accessor1, int tIndex1) {
+    public int compare(IFrameTupleAccessor accessor0, int tIndex0, IFrameTupleAccessor accessor1, int tIndex1)
+            throws HyracksDataException {
         int tStart0 = accessor0.getTupleStartOffset(tIndex0);
         int fStartOffset0 = accessor0.getFieldSlotsLength() + tStart0;
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/e0f048df/algebricks/algebricks-data/src/main/java/edu/uci/ics/hyracks/algebricks/data/IBinaryIntegerInspector.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-data/src/main/java/edu/uci/ics/hyracks/algebricks/data/IBinaryIntegerInspector.java b/algebricks/algebricks-data/src/main/java/edu/uci/ics/hyracks/algebricks/data/IBinaryIntegerInspector.java
index 31f82ed..3707912 100644
--- a/algebricks/algebricks-data/src/main/java/edu/uci/ics/hyracks/algebricks/data/IBinaryIntegerInspector.java
+++ b/algebricks/algebricks-data/src/main/java/edu/uci/ics/hyracks/algebricks/data/IBinaryIntegerInspector.java
@@ -3,9 +3,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * you may obtain a copy of the License from
- * 
+ *
  *     http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -14,6 +14,8 @@
  */
 package edu.uci.ics.hyracks.algebricks.data;
 
+import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
+
 public interface IBinaryIntegerInspector {
-    public int getIntegerValue(byte[] bytes, int offset, int length);
+    public int getIntegerValue(byte[] bytes, int offset, int length) throws HyracksDataException;
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/e0f048df/algebricks/algebricks-runtime/src/main/java/edu/uci/ics/hyracks/algebricks/runtime/base/IUnnestingPositionWriter.java
----------------------------------------------------------------------
diff --git a/algebricks/algebricks-runtime/src/main/java/edu/uci/ics/hyracks/algebricks/runtime/base/IUnnestingPositionWriter.java b/algebricks/algebricks-runtime/src/main/java/edu/uci/ics/hyracks/algebricks/runtime/base/IUnnestingPositionWriter.java
index b8d549a..65f5083 100644
--- a/algebricks/algebricks-runtime/src/main/java/edu/uci/ics/hyracks/algebricks/runtime/base/IUnnestingPositionWriter.java
+++ b/algebricks/algebricks-runtime/src/main/java/edu/uci/ics/hyracks/algebricks/runtime/base/IUnnestingPositionWriter.java
@@ -3,9 +3,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * you may obtain a copy of the License from
- * 
+ *
  *     http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,5 +18,5 @@ import java.io.DataOutput;
 import java.io.IOException;
 
 public interface IUnnestingPositionWriter {
-    public void write(DataOutput dataOutput, int position) throws IOException;
+    public void write(DataOutput dataOutput, long position) throws IOException;
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/e0f048df/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/dataflow/value/BinaryComparatorConstant.java
----------------------------------------------------------------------
diff --git a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/dataflow/value/BinaryComparatorConstant.java b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/dataflow/value/BinaryComparatorConstant.java
new file mode 100644
index 0000000..998ecd4
--- /dev/null
+++ b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/dataflow/value/BinaryComparatorConstant.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.api.dataflow.value;
+
+public final class BinaryComparatorConstant {
+
+    // Result code for isComparable()
+    // TRUE: can be comparable
+    // FALSE: can not be comparable
+    // UNKNOWN: can not be decided whether two arguments are comparable or not - usually NULL
+
+    public static enum ComparableResultCode {
+        TRUE,
+        FALSE,
+        UNKNOWN
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/e0f048df/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/dataflow/value/IBinaryComparator.java
----------------------------------------------------------------------
diff --git a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/dataflow/value/IBinaryComparator.java b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/dataflow/value/IBinaryComparator.java
index 8e63fff..e6d8312 100644
--- a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/dataflow/value/IBinaryComparator.java
+++ b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/dataflow/value/IBinaryComparator.java
@@ -3,9 +3,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * you may obtain a copy of the License from
- * 
+ *
  *     http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -14,6 +14,8 @@
  */
 package edu.uci.ics.hyracks.api.dataflow.value;
 
+import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
+
 public interface IBinaryComparator {
-    public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2);
+    public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) throws HyracksDataException;
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/e0f048df/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/dataflow/value/IBinaryHashFunction.java
----------------------------------------------------------------------
diff --git a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/dataflow/value/IBinaryHashFunction.java b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/dataflow/value/IBinaryHashFunction.java
index 744e948..377cfe9 100644
--- a/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/dataflow/value/IBinaryHashFunction.java
+++ b/hyracks/hyracks-api/src/main/java/edu/uci/ics/hyracks/api/dataflow/value/IBinaryHashFunction.java
@@ -3,9 +3,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * you may obtain a copy of the License from
- * 
+ *
  *     http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -14,6 +14,8 @@
  */
 package edu.uci.ics.hyracks.api.dataflow.value;
 
+import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
+
 public interface IBinaryHashFunction {
-    int hash(byte[] bytes, int offset, int length);
+    int hash(byte[] bytes, int offset, int length) throws HyracksDataException;
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/e0f048df/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/accessors/MurmurHash3BinaryHash.java
----------------------------------------------------------------------
diff --git a/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/accessors/MurmurHash3BinaryHash.java b/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/accessors/MurmurHash3BinaryHash.java
new file mode 100644
index 0000000..9763445
--- /dev/null
+++ b/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/accessors/MurmurHash3BinaryHash.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.data.std.accessors;
+
+/**
+ * An implementation of the Murmur3 hash family. The code is implemented based
+ * on the original <a
+ * href=http://code.google.com/p/guava-libraries/source/browse
+ * /guava/src/com/google/common/hash/Murmur3_32HashFunction.java>guava
+ * implementation</a> from Google Guava library.
+ */
+public class MurmurHash3BinaryHash {
+
+    private MurmurHash3BinaryHash() {
+    }
+
+    private static final int C1 = 0xcc9e2d51;
+    private static final int C2 = 0x1b873593;
+    private static final int C3 = 5;
+    private static final int C4 = 0xe6546b64;
+    private static final int C5 = 0x85ebca6b;
+    private static final int C6 = 0xc2b2ae35;
+
+    public static int hash(byte[] bytes, int offset, int length, int seed) {
+        int h = seed;
+        int p = offset;
+        int remain = length;
+
+        while (remain >= 4) {
+            int k = (bytes[p] & 0xff) | ((bytes[p + 1] & 0xff) << 8) | ((bytes[p + 2] & 0xff) << 16)
+                    | ((bytes[p + 3] & 0xff) << 24);
+            k *= C1;
+            k = Integer.rotateLeft(k, 15);
+            k *= C2;
+            h ^= k;
+            h = Integer.rotateLeft(h, 13);
+            h = h * C3 + C4;
+            p += 4;
+            remain -= 4;
+        }
+        if (remain > 0) {
+            int k = 0;
+            for (int i = 0; remain > 0; i += 8) {
+                k ^= (bytes[p++] & 0xff) << i;
+                remain--;
+            }
+            k *= C1;
+            k = Integer.rotateLeft(k, 15);
+            k *= C2;
+            h ^= k;
+        }
+        h ^= length;
+        h ^= (h >>> 16);
+        h *= C5;
+        h ^= (h >>> 13);
+        h *= C6;
+        h ^= (h >>> 16);
+        return h;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/e0f048df/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/accessors/MurmurHash3BinaryHashFunctionFamily.java
----------------------------------------------------------------------
diff --git a/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/accessors/MurmurHash3BinaryHashFunctionFamily.java b/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/accessors/MurmurHash3BinaryHashFunctionFamily.java
index 8512287..c1c72b5 100644
--- a/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/accessors/MurmurHash3BinaryHashFunctionFamily.java
+++ b/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/accessors/MurmurHash3BinaryHashFunctionFamily.java
@@ -3,9 +3,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * you may obtain a copy of the License from
- * 
+ *
  *     http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,8 +24,7 @@ import edu.uci.ics.hyracks.api.dataflow.value.IBinaryHashFunctionFamily;
  * /guava/src/com/google/common/hash/Murmur3_32HashFunction.java>guava
  * implementation</a> from Google Guava library.
  */
-public class MurmurHash3BinaryHashFunctionFamily implements
-        IBinaryHashFunctionFamily {
+public class MurmurHash3BinaryHashFunctionFamily implements IBinaryHashFunctionFamily {
 
     public static final IBinaryHashFunctionFamily INSTANCE = new MurmurHash3BinaryHashFunctionFamily();
 
@@ -34,51 +33,12 @@ public class MurmurHash3BinaryHashFunctionFamily implements
     private MurmurHash3BinaryHashFunctionFamily() {
     }
 
-    private static final int C1 = 0xcc9e2d51;
-    private static final int C2 = 0x1b873593;
-    private static final int C3 = 5;
-    private static final int C4 = 0xe6546b64;
-    private static final int C5 = 0x85ebca6b;
-    private static final int C6 = 0xc2b2ae35;
-
     @Override
     public IBinaryHashFunction createBinaryHashFunction(final int seed) {
         return new IBinaryHashFunction() {
             @Override
             public int hash(byte[] bytes, int offset, int length) {
-                int h = seed;
-                int p = offset;
-                int remain = length;
-                while (remain >= 4) {
-                    int k = (bytes[p] & 0xff) | ((bytes[p + 1] & 0xff) << 8)
-                            | ((bytes[p + 2] & 0xff) << 16)
-                            | ((bytes[p + 3] & 0xff) << 24);
-                    k *= C1;
-                    k = Integer.rotateLeft(k, 15);
-                    k *= C2;
-                    h ^= k;
-                    h = Integer.rotateLeft(h, 13);
-                    h = h * C3 + C4;
-                    p += 4;
-                    remain -= 4;
-                }
-                if (remain > 0) {
-                    int k = 0;
-                    for (int i = 0; remain > 0; i += 8) {
-                        k ^= (bytes[p++] & 0xff) << i;
-                        remain--;
-                    }
-                    k *= C1;
-                    k = Integer.rotateLeft(k, 15);
-                    k *= C2;
-                    h ^= k;
-                }
-                h ^= length;
-                h ^= (h >>> 16);
-                h *= C5;
-                h ^= (h >>> 13);
-                h *= C6;
-                h ^= (h >>> 16);
+                int h = MurmurHash3BinaryHash.hash(bytes, offset, length, seed);
                 return h;
             }
         };

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/e0f048df/hyracks/hyracks-dataflow-common/src/main/java/edu/uci/ics/hyracks/dataflow/common/comm/io/FrameTuplePairComparator.java
----------------------------------------------------------------------
diff --git a/hyracks/hyracks-dataflow-common/src/main/java/edu/uci/ics/hyracks/dataflow/common/comm/io/FrameTuplePairComparator.java b/hyracks/hyracks-dataflow-common/src/main/java/edu/uci/ics/hyracks/dataflow/common/comm/io/FrameTuplePairComparator.java
index e89fd09..15039ca 100644
--- a/hyracks/hyracks-dataflow-common/src/main/java/edu/uci/ics/hyracks/dataflow/common/comm/io/FrameTuplePairComparator.java
+++ b/hyracks/hyracks-dataflow-common/src/main/java/edu/uci/ics/hyracks/dataflow/common/comm/io/FrameTuplePairComparator.java
@@ -3,9 +3,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * you may obtain a copy of the License from
- * 
+ *
  *     http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -15,6 +15,7 @@
 package edu.uci.ics.hyracks.dataflow.common.comm.io;
 
 import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparator;
+import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
 
 public class FrameTuplePairComparator {
     private final int[] keys0;
@@ -27,7 +28,8 @@ public class FrameTuplePairComparator {
         this.comparators = comparators;
     }
 
-    public int compare(FrameTupleAccessor accessor0, int tIndex0, FrameTupleAccessor accessor1, int tIndex1) {
+    public int compare(FrameTupleAccessor accessor0, int tIndex0, FrameTupleAccessor accessor1, int tIndex1)
+            throws HyracksDataException {
         int tStart0 = accessor0.getTupleStartOffset(tIndex0);
         int fStartOffset0 = accessor0.getFieldSlotsLength() + tStart0;
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/e0f048df/hyracks/hyracks-dataflow-common/src/main/java/edu/uci/ics/hyracks/dataflow/common/data/partition/FieldHashPartitionComputerFactory.java
----------------------------------------------------------------------
diff --git a/hyracks/hyracks-dataflow-common/src/main/java/edu/uci/ics/hyracks/dataflow/common/data/partition/FieldHashPartitionComputerFactory.java b/hyracks/hyracks-dataflow-common/src/main/java/edu/uci/ics/hyracks/dataflow/common/data/partition/FieldHashPartitionComputerFactory.java
index a1084fe..ef010f9 100644
--- a/hyracks/hyracks-dataflow-common/src/main/java/edu/uci/ics/hyracks/dataflow/common/data/partition/FieldHashPartitionComputerFactory.java
+++ b/hyracks/hyracks-dataflow-common/src/main/java/edu/uci/ics/hyracks/dataflow/common/data/partition/FieldHashPartitionComputerFactory.java
@@ -3,9 +3,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * you may obtain a copy of the License from
- * 
+ *
  *     http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -19,6 +19,7 @@ import edu.uci.ics.hyracks.api.dataflow.value.IBinaryHashFunction;
 import edu.uci.ics.hyracks.api.dataflow.value.IBinaryHashFunctionFactory;
 import edu.uci.ics.hyracks.api.dataflow.value.ITuplePartitionComputer;
 import edu.uci.ics.hyracks.api.dataflow.value.ITuplePartitionComputerFactory;
+import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
 
 public class FieldHashPartitionComputerFactory implements ITuplePartitionComputerFactory {
     private static final long serialVersionUID = 1L;
@@ -38,7 +39,7 @@ public class FieldHashPartitionComputerFactory implements ITuplePartitionCompute
         }
         return new ITuplePartitionComputer() {
             @Override
-            public int partition(IFrameTupleAccessor accessor, int tIndex, int nParts) {
+            public int partition(IFrameTupleAccessor accessor, int tIndex, int nParts) throws HyracksDataException {
                 if (nParts == 1) {
                     return 0;
                 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/e0f048df/hyracks/hyracks-dataflow-common/src/main/java/edu/uci/ics/hyracks/dataflow/common/data/partition/FieldHashPartitionComputerFamily.java
----------------------------------------------------------------------
diff --git a/hyracks/hyracks-dataflow-common/src/main/java/edu/uci/ics/hyracks/dataflow/common/data/partition/FieldHashPartitionComputerFamily.java b/hyracks/hyracks-dataflow-common/src/main/java/edu/uci/ics/hyracks/dataflow/common/data/partition/FieldHashPartitionComputerFamily.java
index 590184c..a224f56 100644
--- a/hyracks/hyracks-dataflow-common/src/main/java/edu/uci/ics/hyracks/dataflow/common/data/partition/FieldHashPartitionComputerFamily.java
+++ b/hyracks/hyracks-dataflow-common/src/main/java/edu/uci/ics/hyracks/dataflow/common/data/partition/FieldHashPartitionComputerFamily.java
@@ -3,9 +3,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * you may obtain a copy of the License from
- * 
+ *
  *     http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -19,6 +19,7 @@ import edu.uci.ics.hyracks.api.dataflow.value.IBinaryHashFunction;
 import edu.uci.ics.hyracks.api.dataflow.value.IBinaryHashFunctionFamily;
 import edu.uci.ics.hyracks.api.dataflow.value.ITuplePartitionComputer;
 import edu.uci.ics.hyracks.api.dataflow.value.ITuplePartitionComputerFamily;
+import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
 
 public class FieldHashPartitionComputerFamily implements ITuplePartitionComputerFamily {
     private static final long serialVersionUID = 1L;
@@ -38,7 +39,7 @@ public class FieldHashPartitionComputerFamily implements ITuplePartitionComputer
         }
         return new ITuplePartitionComputer() {
             @Override
-            public int partition(IFrameTupleAccessor accessor, int tIndex, int nParts) {
+            public int partition(IFrameTupleAccessor accessor, int tIndex, int nParts) throws HyracksDataException {
                 int h = 0;
                 int startOffset = accessor.getTupleStartOffset(tIndex);
                 int slotLength = accessor.getFieldSlotsLength();
@@ -52,7 +53,7 @@ public class FieldHashPartitionComputerFamily implements ITuplePartitionComputer
                     h += fh;
                 }
                 if (h < 0) {
-                    h = -(h+1);
+                    h = -(h + 1);
                 }
                 return h % nParts;
             }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/e0f048df/hyracks/hyracks-dataflow-hadoop/src/main/java/edu/uci/ics/hyracks/dataflow/hadoop/mapreduce/ReduceWriter.java
----------------------------------------------------------------------
diff --git a/hyracks/hyracks-dataflow-hadoop/src/main/java/edu/uci/ics/hyracks/dataflow/hadoop/mapreduce/ReduceWriter.java b/hyracks/hyracks-dataflow-hadoop/src/main/java/edu/uci/ics/hyracks/dataflow/hadoop/mapreduce/ReduceWriter.java
index af1b731..8877df4 100644
--- a/hyracks/hyracks-dataflow-hadoop/src/main/java/edu/uci/ics/hyracks/dataflow/hadoop/mapreduce/ReduceWriter.java
+++ b/hyracks/hyracks-dataflow-hadoop/src/main/java/edu/uci/ics/hyracks/dataflow/hadoop/mapreduce/ReduceWriter.java
@@ -3,9 +3,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * you may obtain a copy of the License from
- * 
+ *
  *     http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -146,10 +146,10 @@ public class ReduceWriter<K2, V2, K3, V3> implements IFrameWriter {
     private void reduce() throws HyracksDataException {
         kvi.reset(group, bPtr + 1);
         try {
-            Reducer<K2, V2, K3, V3>.Context rCtx = new MRContextUtil().createReduceContext(helper.getConfiguration(), taId, kvi,
-                    keyCounter, valueCounter, recordWriter, null, null,
-                    (RawComparator<K2>) helper.getRawGroupingComparator(), (Class<K2>) helper.getJob()
-                            .getMapOutputKeyClass(), (Class<V2>) helper.getJob().getMapOutputValueClass());
+            Reducer<K2, V2, K3, V3>.Context rCtx = new MRContextUtil().createReduceContext(helper.getConfiguration(),
+                    taId, kvi, keyCounter, valueCounter, recordWriter, null, null, (RawComparator<K2>) helper
+                            .getRawGroupingComparator(), (Class<K2>) helper.getJob().getMapOutputKeyClass(),
+                    (Class<V2>) helper.getJob().getMapOutputValueClass());
             reducer.run(rCtx);
         } catch (Exception e) {
             throw new HyracksDataException(e);
@@ -157,7 +157,8 @@ public class ReduceWriter<K2, V2, K3, V3> implements IFrameWriter {
         groupStarted = false;
     }
 
-    private boolean sameGroup(FrameTupleAccessor a1, int t1Idx, FrameTupleAccessor a2, int t2Idx) {
+    private boolean sameGroup(FrameTupleAccessor a1, int t1Idx, FrameTupleAccessor a2, int t2Idx)
+            throws HyracksDataException {
         for (int i = 0; i < comparators.length; ++i) {
             int fIdx = groupFields[i];
             int s1 = a1.getTupleStartOffset(t1Idx) + a1.getFieldSlotsLength() + a1.getFieldStartOffset(t1Idx, fIdx);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/e0f048df/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/file/DelimitedDataTupleParserFactory.java
----------------------------------------------------------------------
diff --git a/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/file/DelimitedDataTupleParserFactory.java b/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/file/DelimitedDataTupleParserFactory.java
index dd1343d..6fd38d2 100644
--- a/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/file/DelimitedDataTupleParserFactory.java
+++ b/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/file/DelimitedDataTupleParserFactory.java
@@ -37,14 +37,10 @@ public class DelimitedDataTupleParserFactory implements ITupleParserFactory {
     private char fieldDelimiter;
     private char quote;
 
-    private boolean isDoubleQuoteIncludedInThisField;
-    private int doubleQuoteCount;
-
-    private int lineCount;
     private int fieldCount;
 
     public DelimitedDataTupleParserFactory(IValueParserFactory[] fieldParserFactories, char fieldDelimiter) {
-        this(fieldParserFactories,fieldDelimiter, '\"');
+        this(fieldParserFactories, fieldDelimiter, '\"');
     }
 
     public DelimitedDataTupleParserFactory(IValueParserFactory[] fieldParserFactories, char fieldDelimiter, char quote) {
@@ -52,7 +48,6 @@ public class DelimitedDataTupleParserFactory implements ITupleParserFactory {
         this.fieldDelimiter = fieldDelimiter;
         this.quote = quote;
         this.fieldCount = 0;
-        this.lineCount = 1;
     }
 
     @Override
@@ -71,18 +66,19 @@ public class DelimitedDataTupleParserFactory implements ITupleParserFactory {
                     ArrayTupleBuilder tb = new ArrayTupleBuilder(valueParsers.length);
                     DataOutput dos = tb.getDataOutput();
 
-                    FieldCursor cursor = new FieldCursor(new InputStreamReader(in));
+                    FieldCursorForDelimitedDataParser cursor = new FieldCursorForDelimitedDataParser(
+                            new InputStreamReader(in), fieldDelimiter, quote);
                     while (cursor.nextRecord()) {
                         tb.reset();
                         for (int i = 0; i < valueParsers.length; ++i) {
-                            if (!cursor.nextField()) {
+                            if (!cursor.nextField(fieldCount)) {
                                 break;
                             }
-                            // Eliminate doule quotes in the field that we are going to parse
-                            if (isDoubleQuoteIncludedInThisField) {
-                                eliminateDoulbleQuote(cursor.buffer, cursor.fStart, cursor.fEnd - cursor.fStart);
-                                cursor.fEnd -= doubleQuoteCount;
-                                isDoubleQuoteIncludedInThisField = false;
+                            // Eliminate double quotes in the field that we are going to parse
+                            if (cursor.isDoubleQuoteIncludedInThisField) {
+                                cursor.eliminateDoubleQuote(cursor.buffer, cursor.fStart, cursor.fEnd - cursor.fStart);
+                                cursor.fEnd -= cursor.doubleQuoteCount;
+                                cursor.isDoubleQuoteIncludedInThisField = false;
                             }
                             valueParsers[i].parse(cursor.buffer, cursor.fStart, cursor.fEnd - cursor.fStart, dos);
                             tb.addFieldEndOffset();
@@ -108,336 +104,4 @@ public class DelimitedDataTupleParserFactory implements ITupleParserFactory {
         };
     }
 
-    private enum State {
-        INIT,
-        IN_RECORD,
-        EOR,
-        CR,
-        EOF
-    }
-
-    protected class FieldCursor {
-        private static final int INITIAL_BUFFER_SIZE = 4096;
-        private static final int INCREMENT = 4096;
-
-        private final Reader in;
-
-        private char[] buffer;
-        private int start;
-        private int end;
-        private State state;
-
-        private int fStart;
-        private int fEnd;
-
-        private int lastQuotePosition;
-        private int lastDoubleQuotePosition;
-        private int lastDelimiterPosition;
-        private int quoteCount;
-        private boolean startedQuote;
-
-        public FieldCursor(Reader in) {
-            this.in = in;
-            buffer = new char[INITIAL_BUFFER_SIZE];
-            start = 0;
-            end = 0;
-            state = State.INIT;
-            lastDelimiterPosition = -99;
-            lastQuotePosition = -99;
-            lastDoubleQuotePosition = -99;
-            quoteCount = 0;
-            startedQuote = false;
-        }
-
-        public boolean nextRecord() throws IOException {
-            while (true) {
-                switch (state) {
-                    case INIT:
-                        boolean eof = !readMore();
-                        if (eof) {
-                            state = State.EOF;
-                            return false;
-                        } else {
-                            state = State.IN_RECORD;
-                            return true;
-                        }
-
-                    case IN_RECORD:
-                        int p = start;
-                        while (true) {
-                            if (p >= end) {
-                                int s = start;
-                                eof = !readMore();
-                                if (eof) {
-                                    state = State.EOF;
-                                    return start < end;
-                                }
-                                p -= (s - start);
-                                lastQuotePosition -= (s - start);
-                                lastDoubleQuotePosition -= (s - start);
-                                lastDelimiterPosition -= (s - start);
-                            }
-                            char ch = buffer[p];
-                            // We perform rough format correctness (delimiter, quote) check here
-                            // to set the starting position of a record.
-                            // In the field level, more checking will be conducted.
-                            if (ch == quote) {
-                                startedQuote = true;
-                                // check two quotes in a row - "". This is an escaped quote
-                                if (lastQuotePosition == p - 1 && start != p - 1 && lastDoubleQuotePosition != p - 1) {
-                                    lastDoubleQuotePosition = p;
-                                }
-                                lastQuotePosition = p;
-                            } else if (ch == fieldDelimiter) {
-                                if (startedQuote && lastQuotePosition == p - 1 && lastDoubleQuotePosition != p - 1) {
-                                    startedQuote = false;
-                                    lastDelimiterPosition = p;
-                                }
-                            } else if (ch == '\n' && !startedQuote) {
-                                start = p + 1;
-                                state = State.EOR;
-                                lastDelimiterPosition = p;
-                                break;
-                            } else if (ch == '\r' && !startedQuote) {
-                                start = p + 1;
-                                state = State.CR;
-                                break;
-                            }
-                            ++p;
-                        }
-                        break;
-
-                    case CR:
-                        if (start >= end) {
-                            eof = !readMore();
-                            if (eof) {
-                                state = State.EOF;
-                                return false;
-                            }
-                        }
-                        char ch = buffer[start];
-                        if (ch == '\n' && !startedQuote) {
-                            ++start;
-                            state = State.EOR;
-                        } else {
-                            state = State.IN_RECORD;
-                            return true;
-                        }
-
-                    case EOR:
-                        if (start >= end) {
-                            eof = !readMore();
-                            if (eof) {
-                                state = State.EOF;
-                                return false;
-                            }
-                        }
-                        state = State.IN_RECORD;
-                        lastDelimiterPosition = start;
-                        return start < end;
-
-                    case EOF:
-                        return false;
-                }
-            }
-        }
-
-        public boolean nextField() throws IOException {
-            switch (state) {
-                case INIT:
-                case EOR:
-                case EOF:
-                case CR:
-                    return false;
-
-                case IN_RECORD:
-                    boolean eof;
-                    // reset quote related values
-                    startedQuote = false;
-                    isDoubleQuoteIncludedInThisField = false;
-                    lastQuotePosition = -99;
-                    lastDoubleQuotePosition = -99;
-                    quoteCount = 0;
-                    doubleQuoteCount = 0;
-
-                    int p = start;
-                    while (true) {
-                        if (p >= end) {
-                            int s = start;
-                            eof = !readMore();
-                            p -= (s - start);
-                            lastQuotePosition -= (s - start);
-                            lastDoubleQuotePosition -= (s - start);
-                            lastDelimiterPosition -= (s - start);
-                            if (eof) {
-                                state = State.EOF;
-                                if (startedQuote && lastQuotePosition == p - 1 && lastDoubleQuotePosition != p - 1
-                                        && quoteCount == doubleQuoteCount * 2 + 2) {
-                                    // set the position of fStart to +1, fEnd to -1 to remove quote character
-                                    fStart = start + 1;
-                                    fEnd = p - 1;
-                                } else {
-                                    fStart = start;
-                                    fEnd = p;
-                                }
-                                return true;
-                            }
-                        }
-                        char ch = buffer[p];
-                        if (ch == quote) {
-                            // If this is first quote in the field, then it needs to be placed in the beginning.
-                            if (!startedQuote) {
-                                if (lastDelimiterPosition == p - 1 || lastDelimiterPosition == -99) {
-                                    startedQuote = true;
-                                } else {
-                                    // In this case, we don't have a quote in the beginning of a field.
-                                    throw new IOException(
-                                            "At line: "
-                                                    + lineCount
-                                                    + ", field#: "
-                                                    + (fieldCount+1)
-                                                    + " - a quote enclosing a field needs to be placed in the beginning of that field.");
-                                }
-                            }
-                            // Check double quotes - "". We check [start != p-2]
-                            // to avoid false positive where there is no value in a field,
-                            // since it looks like a double quote. However, it's not a double quote.
-                            // (e.g. if field2 has no value:
-                            //       field1,"",field3 ... )
-                            if (lastQuotePosition == p - 1 && lastDelimiterPosition != p - 2
-                                    && lastDoubleQuotePosition != p - 1) {
-                                isDoubleQuoteIncludedInThisField = true;
-                                doubleQuoteCount++;
-                                lastDoubleQuotePosition = p;
-                            }
-                            lastQuotePosition = p;
-                            quoteCount++;
-                        } else if (ch == fieldDelimiter) {
-                            // If there was no quote in the field,
-                            // then we assume that the field contains a valid string.
-                            if (!startedQuote) {
-                                fStart = start;
-                                fEnd = p;
-                                start = p + 1;
-                                lastDelimiterPosition = p;
-                                return true;
-                            } else if (startedQuote) {
-                                if (lastQuotePosition == p - 1 && lastDoubleQuotePosition != p - 1) {
-                                    // There is a quote right before the delimiter (e.g. ",)  and it is not two quote,
-                                    // then the field contains a valid string.
-                                    // We set the position of fStart to +1, fEnd to -1 to remove quote character
-                                    fStart = start + 1;
-                                    fEnd = p - 1;
-                                    start = p + 1;
-                                    lastDelimiterPosition = p;
-                                    return true;
-                                } else if (lastQuotePosition < p - 1 && lastQuotePosition != lastDoubleQuotePosition
-                                        && quoteCount == doubleQuoteCount * 2 + 2) {
-                                    // There is a quote before the delimiter, however it is not directly placed before the delimiter.
-                                    // In this case, we throw an exception.
-                                    // quoteCount == doubleQuoteCount * 2 + 2 : only true when we have two quotes except double-quotes.
-                                    throw new IOException("At line: " + lineCount + ", field#: " + (fieldCount+1)
-                                            + " -  A quote enclosing a field needs to be followed by the delimiter.");
-                                }
-                            }
-                            // If the control flow reaches here: we have a delimiter in this field and
-                            // there should be a quote in the beginning and the end of
-                            // this field. So, just continue reading next character
-                        } else if (ch == '\n') {
-                            if (!startedQuote) {
-                                fStart = start;
-                                fEnd = p;
-                                start = p + 1;
-                                state = State.EOR;
-                                lineCount++;
-                                lastDelimiterPosition = p;
-                                return true;
-                            } else if (startedQuote && lastQuotePosition == p - 1 && lastDoubleQuotePosition != p - 1
-                                    && quoteCount == doubleQuoteCount * 2 + 2) {
-                                // set the position of fStart to +1, fEnd to -1 to remove quote character
-                                fStart = start + 1;
-                                fEnd = p - 1;
-                                lastDelimiterPosition = p;
-                                start = p + 1;
-                                state = State.EOR;
-                                lineCount++;
-                                return true;
-                            }
-                        } else if (ch == '\r') {
-                            if (!startedQuote) {
-                                fStart = start;
-                                fEnd = p;
-                                start = p + 1;
-                                state = State.CR;
-                                lastDelimiterPosition = p;
-                                return true;
-                            } else if (startedQuote && lastQuotePosition == p - 1 && lastDoubleQuotePosition != p - 1
-                                    && quoteCount == doubleQuoteCount * 2 + 2) {
-                                // set the position of fStart to +1, fEnd to -1 to remove quote character
-                                fStart = start + 1;
-                                fEnd = p - 1;
-                                lastDelimiterPosition = p;
-                                start = p + 1;
-                                state = State.CR;
-                                return true;
-                            }
-                        }
-                        ++p;
-                    }
-            }
-            throw new IllegalStateException();
-        }
-
-        protected void resetQuoteRelatedValue() {
-            startedQuote = false;
-            isDoubleQuoteIncludedInThisField = false;
-            lastQuotePosition = -99;
-            lastDoubleQuotePosition = -99;
-            quoteCount = 0;
-            doubleQuoteCount = 0;
-        }
-
-        protected boolean readMore() throws IOException {
-            if (start > 0) {
-                System.arraycopy(buffer, start, buffer, 0, end - start);
-            }
-            end -= start;
-            start = 0;
-
-            if (end == buffer.length) {
-                buffer = Arrays.copyOf(buffer, buffer.length + INCREMENT);
-            }
-
-            int n = in.read(buffer, end, buffer.length - end);
-            if (n < 0) {
-                return false;
-            }
-            end += n;
-            return true;
-        }
-
-    }
-
-    // Eliminate escaped double quotes("") in a field
-    protected void eliminateDoulbleQuote(char[] buffer, int start, int length) {
-        int lastDoubleQuotePosition = -99;
-        int writepos = start;
-        int readpos = start;
-        // Find positions where double quotes appear
-        for (int i = 0; i < length; i++) {
-            // Skip double quotes
-            if (buffer[readpos] == quote && lastDoubleQuotePosition != readpos - 1) {
-                lastDoubleQuotePosition = readpos;
-                readpos++;
-            } else {
-                // Moving characters except double quote to the front
-                if (writepos != readpos) {
-                    buffer[writepos] = buffer[readpos];
-                }
-                writepos++;
-                readpos++;
-            }
-        }
-    }
 }
-

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/e0f048df/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/file/FieldCursorForDelimitedDataParser.java
----------------------------------------------------------------------
diff --git a/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/file/FieldCursorForDelimitedDataParser.java b/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/file/FieldCursorForDelimitedDataParser.java
new file mode 100644
index 0000000..c6fd654
--- /dev/null
+++ b/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/file/FieldCursorForDelimitedDataParser.java
@@ -0,0 +1,357 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.dataflow.std.file;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.util.Arrays;
+
+public class FieldCursorForDelimitedDataParser {
+
+    private enum State {
+        INIT,
+        IN_RECORD,
+        EOR,
+        CR,
+        EOF
+    }
+
+    // public variables will be used by delimited data parser
+    public char[] buffer;
+    public int fStart;
+    public int fEnd;
+    public int lineCount;
+    public int doubleQuoteCount;
+    public boolean isDoubleQuoteIncludedInThisField;
+
+    private static final int INITIAL_BUFFER_SIZE = 4096;
+    private static final int INCREMENT = 4096;
+
+    private final Reader in;
+
+    private int start;
+    private int end;
+    private State state;
+
+    private int lastQuotePosition;
+    private int lastDoubleQuotePosition;
+    private int lastDelimiterPosition;
+    private int quoteCount;
+    private boolean startedQuote;
+
+    private char quote;
+    private char fieldDelimiter;
+
+    public FieldCursorForDelimitedDataParser(Reader in, char fieldDelimiter, char quote) {
+        this.in = in;
+        buffer = new char[INITIAL_BUFFER_SIZE];
+        start = 0;
+        end = 0;
+        state = State.INIT;
+        this.quote = quote;
+        this.fieldDelimiter = fieldDelimiter;
+        lastDelimiterPosition = -99;
+        lastQuotePosition = -99;
+        lastDoubleQuotePosition = -99;
+        quoteCount = 0;
+        doubleQuoteCount = 0;
+        startedQuote = false;
+        isDoubleQuoteIncludedInThisField = false;
+        lineCount = 1;
+    }
+
+    public boolean nextRecord() throws IOException {
+        while (true) {
+            switch (state) {
+                case INIT:
+                    boolean eof = !readMore();
+                    if (eof) {
+                        state = State.EOF;
+                        return false;
+                    } else {
+                        state = State.IN_RECORD;
+                        return true;
+                    }
+
+                case IN_RECORD:
+                    int p = start;
+                    while (true) {
+                        if (p >= end) {
+                            int s = start;
+                            eof = !readMore();
+                            if (eof) {
+                                state = State.EOF;
+                                return start < end;
+                            }
+                            p -= (s - start);
+                            lastQuotePosition -= (s - start);
+                            lastDoubleQuotePosition -= (s - start);
+                            lastDelimiterPosition -= (s - start);
+                        }
+                        char ch = buffer[p];
+                        // We perform rough format correctness (delimiter, quote) check here
+                        // to set the starting position of a record.
+                        // In the field level, more checking will be conducted.
+                        if (ch == quote) {
+                            startedQuote = true;
+                            // check two quotes in a row - "". This is an escaped quote
+                            if (lastQuotePosition == p - 1 && start != p - 1 && lastDoubleQuotePosition != p - 1) {
+                                lastDoubleQuotePosition = p;
+                            }
+                            lastQuotePosition = p;
+                        } else if (ch == fieldDelimiter) {
+                            if (startedQuote && lastQuotePosition == p - 1 && lastDoubleQuotePosition != p - 1) {
+                                startedQuote = false;
+                                lastDelimiterPosition = p;
+                            }
+                        } else if (ch == '\n' && !startedQuote) {
+                            start = p + 1;
+                            state = State.EOR;
+                            lastDelimiterPosition = p;
+                            break;
+                        } else if (ch == '\r' && !startedQuote) {
+                            start = p + 1;
+                            state = State.CR;
+                            break;
+                        }
+                        ++p;
+                    }
+                    break;
+
+                case CR:
+                    if (start >= end) {
+                        eof = !readMore();
+                        if (eof) {
+                            state = State.EOF;
+                            return false;
+                        }
+                    }
+                    char ch = buffer[start];
+                    if (ch == '\n' && !startedQuote) {
+                        ++start;
+                        state = State.EOR;
+                    } else {
+                        state = State.IN_RECORD;
+                        return true;
+                    }
+
+                case EOR:
+                    if (start >= end) {
+                        eof = !readMore();
+                        if (eof) {
+                            state = State.EOF;
+                            return false;
+                        }
+                    }
+                    state = State.IN_RECORD;
+                    lastDelimiterPosition = start;
+                    return start < end;
+
+                case EOF:
+                    return false;
+            }
+        }
+    }
+
+    public boolean nextField(int fieldCount) throws IOException {
+        switch (state) {
+            case INIT:
+            case EOR:
+            case EOF:
+            case CR:
+                return false;
+
+            case IN_RECORD:
+                boolean eof;
+                // reset quote related values
+                startedQuote = false;
+                isDoubleQuoteIncludedInThisField = false;
+                lastQuotePosition = -99;
+                lastDoubleQuotePosition = -99;
+                quoteCount = 0;
+                doubleQuoteCount = 0;
+
+                int p = start;
+                while (true) {
+                    if (p >= end) {
+                        int s = start;
+                        eof = !readMore();
+                        p -= (s - start);
+                        lastQuotePosition -= (s - start);
+                        lastDoubleQuotePosition -= (s - start);
+                        lastDelimiterPosition -= (s - start);
+                        if (eof) {
+                            state = State.EOF;
+                            if (startedQuote && lastQuotePosition == p - 1 && lastDoubleQuotePosition != p - 1
+                                    && quoteCount == doubleQuoteCount * 2 + 2) {
+                                // set the position of fStart to +1, fEnd to -1 to remove quote character
+                                fStart = start + 1;
+                                fEnd = p - 1;
+                            } else {
+                                fStart = start;
+                                fEnd = p;
+                            }
+                            return true;
+                        }
+                    }
+                    char ch = buffer[p];
+                    if (ch == quote) {
+                        // If this is first quote in the field, then it needs to be placed in the beginning.
+                        if (!startedQuote) {
+                            if (lastDelimiterPosition == p - 1 || lastDelimiterPosition == -99) {
+                                startedQuote = true;
+                            } else {
+                                // In this case, we don't have a quote in the beginning of a field.
+                                throw new IOException(
+                                        "At line: "
+                                                + lineCount
+                                                + ", field#: "
+                                                + (fieldCount + 1)
+                                                + " - a quote enclosing a field needs to be placed in the beginning of that field.");
+                            }
+                        }
+                        // Check double quotes - "". We check [start != p-2]
+                        // to avoid false positive where there is no value in a field,
+                        // since it looks like a double quote. However, it's not a double quote.
+                        // (e.g. if field2 has no value:
+                        //       field1,"",field3 ... )
+                        if (lastQuotePosition == p - 1 && lastDelimiterPosition != p - 2
+                                && lastDoubleQuotePosition != p - 1) {
+                            isDoubleQuoteIncludedInThisField = true;
+                            doubleQuoteCount++;
+                            lastDoubleQuotePosition = p;
+                        }
+                        lastQuotePosition = p;
+                        quoteCount++;
+                    } else if (ch == fieldDelimiter) {
+                        // If there was no quote in the field,
+                        // then we assume that the field contains a valid string.
+                        if (!startedQuote) {
+                            fStart = start;
+                            fEnd = p;
+                            start = p + 1;
+                            lastDelimiterPosition = p;
+                            return true;
+                        } else if (startedQuote) {
+                            if (lastQuotePosition == p - 1 && lastDoubleQuotePosition != p - 1) {
+                                // There is a quote right before the delimiter (e.g. ",)  and it is not two quote,
+                                // then the field contains a valid string.
+                                // We set the position of fStart to +1, fEnd to -1 to remove quote character
+                                fStart = start + 1;
+                                fEnd = p - 1;
+                                start = p + 1;
+                                lastDelimiterPosition = p;
+                                startedQuote = false;
+                                return true;
+                            } else if (lastQuotePosition < p - 1 && lastQuotePosition != lastDoubleQuotePosition
+                                    && quoteCount == doubleQuoteCount * 2 + 2) {
+                                // There is a quote before the delimiter, however it is not directly placed before the delimiter.
+                                // In this case, we throw an exception.
+                                // quoteCount == doubleQuoteCount * 2 + 2 : only true when we have two quotes except double-quotes.
+                                throw new IOException("At line: " + lineCount + ", field#: " + (fieldCount + 1)
+                                        + " -  A quote enclosing a field needs to be followed by the delimiter.");
+                            }
+                        }
+                        // If the control flow reaches here: we have a delimiter in this field and
+                        // there should be a quote in the beginning and the end of
+                        // this field. So, just continue reading next character
+                    } else if (ch == '\n') {
+                        if (!startedQuote) {
+                            fStart = start;
+                            fEnd = p;
+                            start = p + 1;
+                            state = State.EOR;
+                            lineCount++;
+                            lastDelimiterPosition = p;
+                            return true;
+                        } else if (startedQuote && lastQuotePosition == p - 1 && lastDoubleQuotePosition != p - 1
+                                && quoteCount == doubleQuoteCount * 2 + 2) {
+                            // set the position of fStart to +1, fEnd to -1 to remove quote character
+                            fStart = start + 1;
+                            fEnd = p - 1;
+                            lastDelimiterPosition = p;
+                            start = p + 1;
+                            state = State.EOR;
+                            lineCount++;
+                            startedQuote = false;
+                            return true;
+                        }
+                    } else if (ch == '\r') {
+                        if (!startedQuote) {
+                            fStart = start;
+                            fEnd = p;
+                            start = p + 1;
+                            state = State.CR;
+                            lastDelimiterPosition = p;
+                            return true;
+                        } else if (startedQuote && lastQuotePosition == p - 1 && lastDoubleQuotePosition != p - 1
+                                && quoteCount == doubleQuoteCount * 2 + 2) {
+                            // set the position of fStart to +1, fEnd to -1 to remove quote character
+                            fStart = start + 1;
+                            fEnd = p - 1;
+                            lastDelimiterPosition = p;
+                            start = p + 1;
+                            state = State.CR;
+                            startedQuote = false;
+                            return true;
+                        }
+                    }
+                    ++p;
+                }
+        }
+        throw new IllegalStateException();
+    }
+
+    protected boolean readMore() throws IOException {
+        if (start > 0) {
+            System.arraycopy(buffer, start, buffer, 0, end - start);
+        }
+        end -= start;
+        start = 0;
+
+        if (end == buffer.length) {
+            buffer = Arrays.copyOf(buffer, buffer.length + INCREMENT);
+        }
+
+        int n = in.read(buffer, end, buffer.length - end);
+        if (n < 0) {
+            return false;
+        }
+        end += n;
+        return true;
+    }
+
+    // Eliminate escaped double quotes("") in a field
+    public void eliminateDoubleQuote(char[] buffer, int start, int length) {
+        int lastDoubleQuotePosition = -99;
+        int writepos = start;
+        int readpos = start;
+        // Find positions where double quotes appear
+        for (int i = 0; i < length; i++) {
+            // Skip double quotes
+            if (buffer[readpos] == quote && lastDoubleQuotePosition != readpos - 1) {
+                lastDoubleQuotePosition = readpos;
+                readpos++;
+            } else {
+                // Moving characters except double quote to the front
+                if (writepos != readpos) {
+                    buffer[writepos] = buffer[readpos];
+                }
+                writepos++;
+                readpos++;
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/e0f048df/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/HashSpillableTableFactory.java
----------------------------------------------------------------------
diff --git a/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/HashSpillableTableFactory.java b/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/HashSpillableTableFactory.java
index df74a93..a4970ea 100644
--- a/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/HashSpillableTableFactory.java
+++ b/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/HashSpillableTableFactory.java
@@ -3,9 +3,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * you may obtain a copy of the License from
- * 
+ *
  *     http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -51,7 +51,7 @@ public class HashSpillableTableFactory implements ISpillableTableFactory {
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see
      * edu.uci.ics.hyracks.dataflow.std.aggregations.ISpillableTableFactory#
      * buildSpillableTable(edu.uci.ics.hyracks.api.context.IHyracksTaskContext,
@@ -135,7 +135,7 @@ public class HashSpillableTableFactory implements ISpillableTableFactory {
             private int[] tPointers;
 
             @Override
-            public void sortFrames() {
+            public void sortFrames() throws HyracksDataException {
                 int sfIdx = storedKeys[0];
                 int totalTCount = table.getTupleCount();
                 tPointers = new int[totalTCount * 3];
@@ -361,7 +361,7 @@ public class HashSpillableTableFactory implements ISpillableTableFactory {
              * list. There are two cases:<br>
              * 1) If the next frame is not initialized, allocate a new frame. 2)
              * When frames are already created, they are recycled.
-             * 
+             *
              * @return Whether a new frame is added successfully.
              * @throws HyracksDataException
              */
@@ -389,7 +389,7 @@ public class HashSpillableTableFactory implements ISpillableTableFactory {
                 return true;
             }
 
-            private void sort(int[] tPointers, int offset, int length) {
+            private void sort(int[] tPointers, int offset, int length) throws HyracksDataException {
                 int m = offset + (length >> 1);
                 int mTable = tPointers[m * 3];
                 int mRow = tPointers[m * 3 + 1];

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/e0f048df/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/ISpillableTable.java
----------------------------------------------------------------------
diff --git a/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/ISpillableTable.java b/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/ISpillableTable.java
index 65f71a3..6ac2a6d 100644
--- a/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/ISpillableTable.java
+++ b/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/ISpillableTable.java
@@ -3,9 +3,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * you may obtain a copy of the License from
- * 
+ *
  *     http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -31,7 +31,7 @@ public interface ISpillableTable {
 
     public List<ByteBuffer> getFrames();
 
-    public void sortFrames();
+    public void sortFrames() throws HyracksDataException;
 
     public boolean insert(FrameTupleAccessor accessor, int tIndex) throws HyracksDataException;
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/e0f048df/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/external/ExternalGroupMergeOperatorNodePushable.java
----------------------------------------------------------------------
diff --git a/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/external/ExternalGroupMergeOperatorNodePushable.java b/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/external/ExternalGroupMergeOperatorNodePushable.java
index fdb59a4..a55443c 100644
--- a/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/external/ExternalGroupMergeOperatorNodePushable.java
+++ b/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/external/ExternalGroupMergeOperatorNodePushable.java
@@ -3,9 +3,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * you may obtain a copy of the License from
- * 
+ *
  *     http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -397,7 +397,7 @@ class ExternalGroupMergeOperatorNodePushable extends AbstractUnaryOutputSourceOp
     /**
      * Close the run file, and also the corresponding readers and
      * input frame.
-     * 
+     *
      * @param index
      * @param runCursors
      * @param tupleAccessor
@@ -415,7 +415,8 @@ class ExternalGroupMergeOperatorNodePushable extends AbstractUnaryOutputSourceOp
         }
     }
 
-    private int compareFrameTuples(IFrameTupleAccessor fta1, int j1, IFrameTupleAccessor fta2, int j2) {
+    private int compareFrameTuples(IFrameTupleAccessor fta1, int j1, IFrameTupleAccessor fta2, int j2)
+            throws HyracksDataException {
         byte[] b1 = fta1.getBuffer().array();
         byte[] b2 = fta2.getBuffer().array();
         for (int f = 0; f < keyFields.length; ++f) {
@@ -434,7 +435,8 @@ class ExternalGroupMergeOperatorNodePushable extends AbstractUnaryOutputSourceOp
         return 0;
     }
 
-    private Comparator<ReferenceEntry> createEntryComparator(final IBinaryComparator[] comparators) {
+    private Comparator<ReferenceEntry> createEntryComparator(final IBinaryComparator[] comparators)
+            throws HyracksDataException {
         return new Comparator<ReferenceEntry>() {
 
             @Override
@@ -453,10 +455,16 @@ class ExternalGroupMergeOperatorNodePushable extends AbstractUnaryOutputSourceOp
                     int s2 = fta2.getTupleStartOffset(j2) + fta2.getFieldSlotsLength()
                             + fta2.getFieldStartOffset(j2, fIdx);
                     int l2 = fta2.getFieldEndOffset(j2, fIdx) - fta2.getFieldStartOffset(j2, fIdx);
-                    int c = comparators[f].compare(b1, s1, l1, b2, s2, l2);
-                    if (c != 0) {
-                        return c;
+                    int c;
+                    try {
+                        c = comparators[f].compare(b1, s1, l1, b2, s2, l2);
+                        if (c != 0) {
+                            return c;
+                        }
+                    } catch (HyracksDataException e) {
+                        throw new IllegalArgumentException(e);
                     }
+
                 }
                 return 0;
             }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/e0f048df/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/preclustered/PreclusteredGroupWriter.java
----------------------------------------------------------------------
diff --git a/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/preclustered/PreclusteredGroupWriter.java b/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/preclustered/PreclusteredGroupWriter.java
index b67e236..45f0488 100644
--- a/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/preclustered/PreclusteredGroupWriter.java
+++ b/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/group/preclustered/PreclusteredGroupWriter.java
@@ -3,9 +3,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * you may obtain a copy of the License from
- * 
+ *
  *     http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -141,7 +141,8 @@ public class PreclusteredGroupWriter implements IFrameWriter {
 
     }
 
-    private boolean sameGroup(FrameTupleAccessor a1, int t1Idx, FrameTupleAccessor a2, int t2Idx) {
+    private boolean sameGroup(FrameTupleAccessor a1, int t1Idx, FrameTupleAccessor a2, int t2Idx)
+            throws HyracksDataException {
         for (int i = 0; i < comparators.length; ++i) {
             int fIdx = groupFields[i];
             int s1 = a1.getTupleStartOffset(t1Idx) + a1.getFieldSlotsLength() + a1.getFieldStartOffset(t1Idx, fIdx);

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/e0f048df/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/join/JoinComparator.java
----------------------------------------------------------------------
diff --git a/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/join/JoinComparator.java b/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/join/JoinComparator.java
index 3256d2e..e393d49 100644
--- a/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/join/JoinComparator.java
+++ b/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/join/JoinComparator.java
@@ -3,9 +3,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * you may obtain a copy of the License from
- * 
+ *
  *     http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,39 +17,41 @@ package edu.uci.ics.hyracks.dataflow.std.join;
 import edu.uci.ics.hyracks.api.comm.IFrameTupleAccessor;
 import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparator;
 import edu.uci.ics.hyracks.api.dataflow.value.ITuplePairComparator;
+import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
 
 class JoinComparator implements ITuplePairComparator {
-	 private final IBinaryComparator bComparator;
-     private final int field0;
-     private final int field1;
-
-     public JoinComparator(IBinaryComparator bComparator, int field0, int field1) {
-         this.bComparator = bComparator;
-         this.field0 = field0;
-         this.field1 = field1;
-     }
-
-     @Override
-     public int compare(IFrameTupleAccessor accessor0, int tIndex0, IFrameTupleAccessor accessor1, int tIndex1) {
-         int tStart0 = accessor0.getTupleStartOffset(tIndex0);
-         int fStartOffset0 = accessor0.getFieldSlotsLength() + tStart0;
-
-         int tStart1 = accessor1.getTupleStartOffset(tIndex1);
-         int fStartOffset1 = accessor1.getFieldSlotsLength() + tStart1;
-
-         int fStart0 = accessor0.getFieldStartOffset(tIndex0, field0);
-         int fEnd0 = accessor0.getFieldEndOffset(tIndex0, field0);
-         int fLen0 = fEnd0 - fStart0;
-
-         int fStart1 = accessor1.getFieldStartOffset(tIndex1, field1);
-         int fEnd1 = accessor1.getFieldEndOffset(tIndex1, field1);
-         int fLen1 = fEnd1 - fStart1;
-
-         int c = bComparator.compare(accessor0.getBuffer().array(), fStart0 + fStartOffset0, fLen0, accessor1
-                 .getBuffer().array(), fStart1 + fStartOffset1, fLen1);
-         if (c != 0) {
-             return c;
-         }
-         return 0;
-     }
+    private final IBinaryComparator bComparator;
+    private final int field0;
+    private final int field1;
+
+    public JoinComparator(IBinaryComparator bComparator, int field0, int field1) {
+        this.bComparator = bComparator;
+        this.field0 = field0;
+        this.field1 = field1;
+    }
+
+    @Override
+    public int compare(IFrameTupleAccessor accessor0, int tIndex0, IFrameTupleAccessor accessor1, int tIndex1)
+            throws HyracksDataException {
+        int tStart0 = accessor0.getTupleStartOffset(tIndex0);
+        int fStartOffset0 = accessor0.getFieldSlotsLength() + tStart0;
+
+        int tStart1 = accessor1.getTupleStartOffset(tIndex1);
+        int fStartOffset1 = accessor1.getFieldSlotsLength() + tStart1;
+
+        int fStart0 = accessor0.getFieldStartOffset(tIndex0, field0);
+        int fEnd0 = accessor0.getFieldEndOffset(tIndex0, field0);
+        int fLen0 = fEnd0 - fStart0;
+
+        int fStart1 = accessor1.getFieldStartOffset(tIndex1, field1);
+        int fEnd1 = accessor1.getFieldEndOffset(tIndex1, field1);
+        int fLen1 = fEnd1 - fStart1;
+
+        int c = bComparator.compare(accessor0.getBuffer().array(), fStart0 + fStartOffset0, fLen0, accessor1
+                .getBuffer().array(), fStart1 + fStartOffset1, fLen1);
+        if (c != 0) {
+            return c;
+        }
+        return 0;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/e0f048df/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/sort/FrameSorterMergeSort.java
----------------------------------------------------------------------
diff --git a/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/sort/FrameSorterMergeSort.java b/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/sort/FrameSorterMergeSort.java
index cc0f1ef..8dbdbd4 100644
--- a/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/sort/FrameSorterMergeSort.java
+++ b/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/sort/FrameSorterMergeSort.java
@@ -3,9 +3,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * you may obtain a copy of the License from
- * 
+ *
  *     http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -94,7 +94,7 @@ public class FrameSorterMergeSort implements IFrameSorter {
     }
 
     @Override
-    public void sortFrames() {
+    public void sortFrames() throws HyracksDataException {
         int nBuffers = dataFrameCount;
         tupleCount = 0;
         for (int i = 0; i < nBuffers; ++i) {
@@ -150,7 +150,7 @@ public class FrameSorterMergeSort implements IFrameSorter {
         }
     }
 
-    private void sort(int offset, int length) {
+    private void sort(int offset, int length) throws HyracksDataException {
         int step = 1;
         int len = length;
         int end = offset + len;
@@ -173,8 +173,12 @@ public class FrameSorterMergeSort implements IFrameSorter {
         }
     }
 
-    /** Merge two subarrays into one */
-    private void merge(int start1, int start2, int len1, int len2) {
+    /**
+     * Merge two subarrays into one
+     *
+     * @throws HyracksDataException
+     */
+    private void merge(int start1, int start2, int len1, int len2) throws HyracksDataException {
         int targetPos = start1;
         int pos1 = start1;
         int pos2 = start2;
@@ -208,7 +212,7 @@ public class FrameSorterMergeSort implements IFrameSorter {
         tPointersTemp[dest * 4 + 3] = tPointers[src * 4 + 3];
     }
 
-    private int compare(int tp1, int tp2) {
+    private int compare(int tp1, int tp2) throws HyracksDataException {
         int i1 = tPointers[tp1 * 4];
         int j1 = tPointers[tp1 * 4 + 1];
         int v1 = tPointers[tp1 * 4 + 3];

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/e0f048df/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/sort/FrameSorterQuickSort.java
----------------------------------------------------------------------
diff --git a/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/sort/FrameSorterQuickSort.java b/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/sort/FrameSorterQuickSort.java
index 083f4a7..d607a51 100644
--- a/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/sort/FrameSorterQuickSort.java
+++ b/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/sort/FrameSorterQuickSort.java
@@ -3,9 +3,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * you may obtain a copy of the License from
- * 
+ *
  *     http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -92,7 +92,7 @@ public class FrameSorterQuickSort implements IFrameSorter {
     }
 
     @Override
-    public void sortFrames() {
+    public void sortFrames() throws HyracksDataException {
         int nBuffers = dataFrameCount;
         tupleCount = 0;
         for (int i = 0; i < nBuffers; ++i) {
@@ -147,7 +147,7 @@ public class FrameSorterQuickSort implements IFrameSorter {
         }
     }
 
-    private void sort(int[] tPointers, int offset, int length) {
+    private void sort(int[] tPointers, int offset, int length) throws HyracksDataException {
         int m = offset + (length >> 1);
         int mi = tPointers[m * 4];
         int mj = tPointers[m * 4 + 1];
@@ -212,7 +212,7 @@ public class FrameSorterQuickSort implements IFrameSorter {
         }
     }
 
-    private int compare(int[] tPointers, int tp1, int tp2i, int tp2j, int tp2v) {
+    private int compare(int[] tPointers, int tp1, int tp2i, int tp2j, int tp2v) throws HyracksDataException {
         int i1 = tPointers[tp1 * 4];
         int j1 = tPointers[tp1 * 4 + 1];
         int v1 = tPointers[tp1 * 4 + 3];

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb-hyracks/blob/e0f048df/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/sort/IFrameSorter.java
----------------------------------------------------------------------
diff --git a/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/sort/IFrameSorter.java b/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/sort/IFrameSorter.java
index 6778852..d9b8d37 100644
--- a/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/sort/IFrameSorter.java
+++ b/hyracks/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/sort/IFrameSorter.java
@@ -3,9 +3,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * you may obtain a copy of the License from
- * 
+ *
  *     http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -28,7 +28,7 @@ public interface IFrameSorter {
 
     public void insertFrame(ByteBuffer buffer) throws HyracksDataException;
 
-    public void sortFrames();
+    public void sortFrames() throws HyracksDataException;
 
     public void flushFrames(IFrameWriter writer) throws HyracksDataException;
 


Mime
View raw message