Fixed issues 698 and 699. Also added JSON printers for UUIDs

The following commits from your working branch will be included:

commit 956ec767c369f4b238ad98b260b8fe83b1b5ea40
Author: zheilbron <zheilbron@gmail.com>
Date:   Fri May 16 10:50:15 2014 -0700

    fix issue 698

commit 8e0fd4d8ea6779e8ced4ee8001ccff70c7ac97ab
Author: zheilbron <zheilbron@gmail.com>
Date:   Fri May 16 10:36:22 2014 -0700

    add JSON printers for UUIDs

commit 2b550b3646255c6c9dca95d16cb78d075ec22205
Author: zheilbron <zheilbron@gmail.com>
Date:   Fri May 16 10:10:41 2014 -0700

    fix issue 699

Change-Id: I096505bdb5d4ab0f0dbbc46d15349a2c5682fe29
Reviewed-on: http://fulliautomatix.ics.uci.edu:8443/32
Reviewed-by: Inci Cetindil <icetindil@gmail.com>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/json/APrintVisitor.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/json/APrintVisitor.java
index e791bf8..4b3584b 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/json/APrintVisitor.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/printer/json/APrintVisitor.java
@@ -20,6 +20,7 @@
 import java.util.Map;
 
 import edu.uci.ics.asterix.common.exceptions.AsterixException;
+import edu.uci.ics.asterix.dataflow.data.nontagged.printers.AUUIDPrinter;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.ABooleanPrinter;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.ACirclePrinter;
 import edu.uci.ics.asterix.dataflow.data.nontagged.printers.json.ADatePrinter;
@@ -183,6 +184,10 @@
                     ADayTimeDurationPrinter.INSTANCE.print(b, s, l, ps);
                     break;
                 }
+                case UUID: {
+                    AUUIDPrinter.INSTANCE.print(b, s, l, ps);
+                    break;
+                }
                 default: {
                     throw new NotImplementedException("No printer for type " + typeTag);
                 }
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/RecordMergeTypeComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/RecordMergeTypeComputer.java
index f663d50..75ed41d 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/RecordMergeTypeComputer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/typecomputer/impl/RecordMergeTypeComputer.java
@@ -77,8 +77,7 @@
             IAType fieldType = recType1.getFieldTypes()[i];
             int pos = Collections.binarySearch(resultFieldNames, fieldName);
             if (pos >= 0) {
-                resultFieldNames.set(pos, fieldName);
-                resultFieldTypes.set(pos, fieldType);
+                throw new AlgebricksException("Duplicate field \"" + fieldName + "\" encountered");
             } else {
                 additionalFieldNames.add(fieldName);
                 additionalFieldTypes.add(fieldType);
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/ARecordType.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/ARecordType.java
index 96955b0..ac62a5d 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/ARecordType.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/ARecordType.java
@@ -260,17 +260,16 @@
                 throw new AsterixException("Cannot autogenerate a composite primary key");
             }
 
-            ATypeTag pkTypeTag = getFieldType(partitioningExprs.get(0)).getTypeTag();
+            String fieldName = partitioningExprs.get(0);
+            IAType fieldType = getPartitioningExpressionType(fieldName);
+            ATypeTag pkTypeTag = fieldType.getTypeTag();
             if (pkTypeTag != ATypeTag.UUID) {
                 throw new AsterixException("Cannot autogenerate a primary key for type " + pkTypeTag
                         + ". Autogenerated primary keys must be of type " + ATypeTag.UUID + ".");
             }
         } else {
             for (String fieldName : partitioningExprs) {
-                IAType fieldType = getFieldType(fieldName);
-                if (fieldType == null) {
-                    throw new AsterixException("A field with this name  \"" + fieldName + "\" could not be found.");
-                }
+                IAType fieldType = getPartitioningExpressionType(fieldName);
                 switch (fieldType.getTypeTag()) {
                     case INT8:
                     case INT16:
@@ -296,6 +295,14 @@
         }
     }
 
+    private IAType getPartitioningExpressionType(String fieldName) throws AsterixException, IOException {
+        IAType fieldType = getFieldType(fieldName);
+        if (fieldType == null) {
+            throw new AsterixException("Primary key field \"" + fieldName + "\" could not be found.");
+        }
+        return fieldType;
+    }
+
     /**
      * Validates the key fields that will be used as keys of an index.
      *