diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/cast/ACastVisitor.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/cast/ACastVisitor.java
index a711eb9..e93048e 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/cast/ACastVisitor.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/pointables/cast/ACastVisitor.java
@@ -112,7 +112,7 @@
                 try {
                     // do the promotion; note that the type tag field should be skipped
                     promoteComputer.promote(accessor.getByteArray(), accessor.getStartOffset() + 1,
-                            accessor.getLength() - 1, castBuffer);
+                            accessor.getLength() - 1, castBuffer.getDataOutput());
                     arg.first.set(castBuffer);
                 } catch (IOException e) {
                     throw new AsterixException(e);
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/hierachy/AbstractIntegerTypePromoteComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/hierachy/AbstractIntegerTypePromoteComputer.java
index 7df6f43..e10e41a 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/hierachy/AbstractIntegerTypePromoteComputer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/hierachy/AbstractIntegerTypePromoteComputer.java
@@ -14,23 +14,23 @@
  */
 package edu.uci.ics.asterix.om.types.hierachy;
 
+import java.io.DataOutput;
 import java.io.IOException;
 
 import edu.uci.ics.asterix.om.types.ATypeTag;
-import edu.uci.ics.hyracks.data.std.api.IMutableValueStorage;
 
 public abstract class AbstractIntegerTypePromoteComputer implements ITypePromoteComputer {
 
-    public void promoteIntegerType(byte[] data, int start, int length, IMutableValueStorage storageForPromotedValue,
+    public void promoteIntegerType(byte[] data, int start, int length, DataOutput out,
             ATypeTag targetType, int targetTypeLength) throws IOException {
-        storageForPromotedValue.getDataOutput().writeByte(targetType.serialize());
+        out.writeByte(targetType.serialize());
         long num = 0;
         for (int i = start; i < start + length; i++) {
             num += (data[i] & 0xff) << ((length - 1 - (i - start)) * 8);
         }
 
         for (int i = targetTypeLength - 1; i >= 0; i--) {
-            storageForPromotedValue.getDataOutput().writeByte((byte) ((num >>> (i * 8)) & 0xFF));
+            out.writeByte((byte) ((num >>> (i * 8)) & 0xFF));
         }
     }
 }
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/hierachy/FloatToDoubleTypePromoteComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/hierachy/FloatToDoubleTypePromoteComputer.java
index a3cfbc8..70c6097 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/hierachy/FloatToDoubleTypePromoteComputer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/hierachy/FloatToDoubleTypePromoteComputer.java
@@ -14,10 +14,10 @@
  */
 package edu.uci.ics.asterix.om.types.hierachy;
 
+import java.io.DataOutput;
 import java.io.IOException;
 
 import edu.uci.ics.asterix.om.types.ATypeTag;
-import edu.uci.ics.hyracks.data.std.api.IMutableValueStorage;
 import edu.uci.ics.hyracks.dataflow.common.data.marshalling.DoubleSerializerDeserializer;
 import edu.uci.ics.hyracks.dataflow.common.data.marshalling.FloatSerializerDeserializer;
 
@@ -33,11 +33,11 @@
      * @see edu.uci.ics.asterix.om.types.hierachy.ITypePromoteComputer#promote(byte[], int, int, edu.uci.ics.hyracks.data.std.api.IMutableValueStorage)
      */
     @Override
-    public void promote(byte[] data, int start, int length, IMutableValueStorage storageForPromotedValue)
+    public void promote(byte[] data, int start, int length, DataOutput out)
             throws IOException {
-        storageForPromotedValue.getDataOutput().writeByte(ATypeTag.DOUBLE.serialize());
+        out.writeByte(ATypeTag.DOUBLE.serialize());
         DoubleSerializerDeserializer.INSTANCE.serialize((double) (FloatSerializerDeserializer.getFloat(data, start)),
-                storageForPromotedValue.getDataOutput());
+                out);
     }
 
 }
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/hierachy/ITypePromoteComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/hierachy/ITypePromoteComputer.java
index e8612af..995b61a 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/hierachy/ITypePromoteComputer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/hierachy/ITypePromoteComputer.java
@@ -14,12 +14,11 @@
  */
 package edu.uci.ics.asterix.om.types.hierachy;
 
+import java.io.DataOutput;
 import java.io.IOException;
 
-import edu.uci.ics.hyracks.data.std.api.IMutableValueStorage;
-
 public interface ITypePromoteComputer {
 
-    void promote(byte[] data, int start, int length, IMutableValueStorage storageForPromotedValue) throws IOException;
+    void promote(byte[] data, int start, int length, DataOutput out) throws IOException;
 
 }
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/hierachy/IntegerToDoubleTypePromoteComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/hierachy/IntegerToDoubleTypePromoteComputer.java
index dfd116e..4987b94 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/hierachy/IntegerToDoubleTypePromoteComputer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/hierachy/IntegerToDoubleTypePromoteComputer.java
@@ -14,10 +14,10 @@
  */
 package edu.uci.ics.asterix.om.types.hierachy;
 
+import java.io.DataOutput;
 import java.io.IOException;
 
 import edu.uci.ics.asterix.om.types.ATypeTag;
-import edu.uci.ics.hyracks.data.std.api.IMutableValueStorage;
 import edu.uci.ics.hyracks.dataflow.common.data.marshalling.DoubleSerializerDeserializer;
 
 public class IntegerToDoubleTypePromoteComputer implements ITypePromoteComputer {
@@ -29,14 +29,14 @@
     }
 
     @Override
-    public void promote(byte[] data, int start, int length, IMutableValueStorage storageForPromotedValue)
+    public void promote(byte[] data, int start, int length, DataOutput out)
             throws IOException {
-        storageForPromotedValue.getDataOutput().writeByte(ATypeTag.DOUBLE.serialize());
+        out.writeByte(ATypeTag.DOUBLE.serialize());
         long val = 0L;
         for (int i = 0; i < length; i++) {
             val += ((long) (data[start + i] & 0xff)) << (8 * (length - 1 - i));
         }
-        DoubleSerializerDeserializer.INSTANCE.serialize(Double.valueOf(val), storageForPromotedValue.getDataOutput());
+        DoubleSerializerDeserializer.INSTANCE.serialize(Double.valueOf(val), out);
     }
 
 }
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/hierachy/IntegerToFloatTypePromoteComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/hierachy/IntegerToFloatTypePromoteComputer.java
index c1bd9e5..db8d59a 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/hierachy/IntegerToFloatTypePromoteComputer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/hierachy/IntegerToFloatTypePromoteComputer.java
@@ -14,10 +14,10 @@
  */
 package edu.uci.ics.asterix.om.types.hierachy;
 
+import java.io.DataOutput;
 import java.io.IOException;
 
 import edu.uci.ics.asterix.om.types.ATypeTag;
-import edu.uci.ics.hyracks.data.std.api.IMutableValueStorage;
 import edu.uci.ics.hyracks.dataflow.common.data.marshalling.FloatSerializerDeserializer;
 
 public class IntegerToFloatTypePromoteComputer implements ITypePromoteComputer {
@@ -32,14 +32,14 @@
      * @see edu.uci.ics.asterix.om.types.hierachy.ITypePromoteComputer#promote(byte[], int, int, edu.uci.ics.hyracks.data.std.api.IMutableValueStorage)
      */
     @Override
-    public void promote(byte[] data, int start, int length, IMutableValueStorage storageForPromotedValue)
+    public void promote(byte[] data, int start, int length, DataOutput out)
             throws IOException {
-        storageForPromotedValue.getDataOutput().writeByte(ATypeTag.FLOAT.serialize());
+        out.writeByte(ATypeTag.FLOAT.serialize());
         float val = 0;
         for (int i = 0; i < length; i++) {
             val += (data[start + i] & 0xff) << (8 * (length - 1 - i));
         }
-        FloatSerializerDeserializer.INSTANCE.serialize(val, storageForPromotedValue.getDataOutput());
+        FloatSerializerDeserializer.INSTANCE.serialize(val, out);
 
     }
 
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/hierachy/IntegerToInt16TypePromoteComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/hierachy/IntegerToInt16TypePromoteComputer.java
index 8835a57..6731c8c 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/hierachy/IntegerToInt16TypePromoteComputer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/hierachy/IntegerToInt16TypePromoteComputer.java
@@ -14,10 +14,10 @@
  */
 package edu.uci.ics.asterix.om.types.hierachy;
 
+import java.io.DataOutput;
 import java.io.IOException;
 
 import edu.uci.ics.asterix.om.types.ATypeTag;
-import edu.uci.ics.hyracks.data.std.api.IMutableValueStorage;
 
 public class IntegerToInt16TypePromoteComputer extends AbstractIntegerTypePromoteComputer {
 
@@ -31,9 +31,9 @@
      * @see edu.uci.ics.asterix.om.types.hierachy.ITypePromoteComputer#promote(byte[], int, int, edu.uci.ics.hyracks.data.std.api.IMutableValueStorage)
      */
     @Override
-    public void promote(byte[] data, int start, int length, IMutableValueStorage storageForPromotedValue)
+    public void promote(byte[] data, int start, int length, DataOutput out)
             throws IOException {
-        promoteIntegerType(data, start, length, storageForPromotedValue, ATypeTag.INT16, 2);
+        promoteIntegerType(data, start, length, out, ATypeTag.INT16, 2);
     }
 
 }
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/hierachy/IntegerToInt32TypePromoteComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/hierachy/IntegerToInt32TypePromoteComputer.java
index 8a808bf..6e3978c 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/hierachy/IntegerToInt32TypePromoteComputer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/hierachy/IntegerToInt32TypePromoteComputer.java
@@ -14,10 +14,10 @@
  */
 package edu.uci.ics.asterix.om.types.hierachy;
 
+import java.io.DataOutput;
 import java.io.IOException;
 
 import edu.uci.ics.asterix.om.types.ATypeTag;
-import edu.uci.ics.hyracks.data.std.api.IMutableValueStorage;
 
 public class IntegerToInt32TypePromoteComputer extends AbstractIntegerTypePromoteComputer {
 
@@ -27,9 +27,9 @@
     }
 
     @Override
-    public void promote(byte[] data, int start, int length, IMutableValueStorage storageForPromotedValue)
+    public void promote(byte[] data, int start, int length, DataOutput out)
             throws IOException {
-        promoteIntegerType(data, start, length, storageForPromotedValue, ATypeTag.INT32, 4);
+        promoteIntegerType(data, start, length, out, ATypeTag.INT32, 4);
     }
 
 }
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/hierachy/IntegerToInt64TypePromoteComputer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/hierachy/IntegerToInt64TypePromoteComputer.java
index b24604d..448dd8e 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/hierachy/IntegerToInt64TypePromoteComputer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/types/hierachy/IntegerToInt64TypePromoteComputer.java
@@ -14,10 +14,10 @@
  */
 package edu.uci.ics.asterix.om.types.hierachy;
 
+import java.io.DataOutput;
 import java.io.IOException;
 
 import edu.uci.ics.asterix.om.types.ATypeTag;
-import edu.uci.ics.hyracks.data.std.api.IMutableValueStorage;
 
 public class IntegerToInt64TypePromoteComputer extends AbstractIntegerTypePromoteComputer {
 
@@ -30,9 +30,9 @@
      * @see edu.uci.ics.asterix.om.types.hierachy.ITypePromoteComputer#promote(byte[], int, int, edu.uci.ics.hyracks.data.std.api.IMutableValueStorage)
      */
     @Override
-    public void promote(byte[] data, int start, int length, IMutableValueStorage storageForPromotedValue)
+    public void promote(byte[] data, int start, int length, DataOutput out)
             throws IOException {
-        promoteIntegerType(data, start, length, storageForPromotedValue, ATypeTag.INT64, 8);
+        promoteIntegerType(data, start, length, out, ATypeTag.INT64, 8);
     }
 
 }
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/std/AbstractMinMaxAggregateFunction.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/std/AbstractMinMaxAggregateFunction.java
index 29aba33..b961ef1 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/std/AbstractMinMaxAggregateFunction.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/std/AbstractMinMaxAggregateFunction.java
@@ -101,7 +101,7 @@
                     tempValForCasting.reset();
                     try {
                         tpc.promote(outputVal.getByteArray(), outputVal.getStartOffset() + 1,
-                                outputVal.getLength() - 1, tempValForCasting);
+                                outputVal.getLength() - 1, tempValForCasting.getDataOutput());
                     } catch (IOException e) {
                         throw new AlgebricksException(e);
                     }
@@ -119,7 +119,7 @@
                     tempValForCasting.reset();
                     try {
                         tpc.promote(inputVal.getByteArray(), inputVal.getStartOffset() + 1, inputVal.getLength() - 1,
-                                tempValForCasting);
+                                tempValForCasting.getDataOutput());
                     } catch (IOException e) {
                         throw new AlgebricksException(e);
                     }
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/ADMDataParser.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/ADMDataParser.java
index 755c0e0..26a6584 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/ADMDataParser.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/ADMDataParser.java
@@ -50,6 +50,7 @@
 import edu.uci.ics.asterix.om.types.AUnorderedListType;
 import edu.uci.ics.asterix.om.types.IAType;
 import edu.uci.ics.asterix.om.types.hierachy.ATypeHierarchy;
+import edu.uci.ics.asterix.om.types.hierachy.ITypePromoteComputer;
 import edu.uci.ics.asterix.om.util.NonTaggedFormatUtil;
 import edu.uci.ics.asterix.runtime.operators.file.adm.AdmLexer;
 import edu.uci.ics.asterix.runtime.operators.file.adm.AdmLexerException;
@@ -66,7 +67,8 @@
     protected boolean datasetRec;
 
     private int nullableFieldId = 0;
-
+    private ArrayBackedValueStorage castBuffer = new ArrayBackedValueStorage();
+    
     private Queue<ArrayBackedValueStorage> baaosPool = new ArrayDeque<ArrayBackedValueStorage>();
     private Queue<IARecordBuilder> recordBuilderPool = new ArrayDeque<IARecordBuilder>();
     private Queue<IAsterixListBuilder> orderedListBuilderPool = new ArrayDeque<IAsterixListBuilder>();
@@ -141,7 +143,7 @@
                 break;
             }
             case AdmLexer.TOKEN_DOUBLE_LITERAL: {
-                parseNumericLiteral(ATypeTag.DOUBLE, objectType, out);
+                parseToTarget(ATypeTag.DOUBLE, objectType, out);
                 break;
             }
             case AdmLexer.TOKEN_DOUBLE_CONS: {
@@ -149,7 +151,7 @@
                 break;
             }
             case AdmLexer.TOKEN_FLOAT_LITERAL: {
-                parseNumericLiteral(ATypeTag.FLOAT, objectType, out);
+                parseToTarget(ATypeTag.FLOAT, objectType, out);
                 break;
             }
             case AdmLexer.TOKEN_FLOAT_CONS: {
@@ -157,7 +159,7 @@
                 break;
             }
             case AdmLexer.TOKEN_INT8_LITERAL: {
-                parseNumericLiteral(ATypeTag.INT8, objectType, out);
+                parseAndCast(ATypeTag.INT8, objectType, out);
                 break;
             }
             case AdmLexer.TOKEN_INT8_CONS: {
@@ -165,16 +167,19 @@
                 break;
             }
             case AdmLexer.TOKEN_INT16_LITERAL: {
-                parseNumericLiteral(ATypeTag.INT16, objectType, out);
+                parseAndCast(ATypeTag.INT16, objectType, out);
                 break;
             }
             case AdmLexer.TOKEN_INT16_CONS: {
                 parseConstructor(ATypeTag.INT16, objectType, out);
                 break;
             }
-            case AdmLexer.TOKEN_INT_LITERAL:
+            case AdmLexer.TOKEN_INT_LITERAL:{
+                parseToTarget(ATypeTag.INT32, objectType, out);
+                break;
+            }
             case AdmLexer.TOKEN_INT32_LITERAL: {
-                parseNumericLiteral(ATypeTag.INT32, objectType, out);
+                parseAndCast(ATypeTag.INT32, objectType, out);
                 break;
             }
             case AdmLexer.TOKEN_INT32_CONS: {
@@ -182,7 +187,7 @@
                 break;
             }
             case AdmLexer.TOKEN_INT64_LITERAL: {
-                parseNumericLiteral(ATypeTag.INT64, objectType, out);
+                parseAndCast(ATypeTag.INT64, objectType, out);
                 break;
             }
             case AdmLexer.TOKEN_INT64_CONS: {
@@ -713,37 +718,66 @@
         baaosPool.add(tempBaaos);
     }
 
-    private void parseNumericLiteral(ATypeTag typeTag, IAType objectType, DataOutput out) throws AsterixException,
-            IOException {
-        final ATypeTag targetTypeTag = getTargetTypeTag(typeTag, objectType, out);
-        if (targetTypeTag != null) {
-            switch (targetTypeTag) {
-                case DOUBLE:
-                    aDouble.setValue(Double.parseDouble(admLexer.getLastTokenImage()));
-                    doubleSerde.serialize(aDouble, out);
-                    return;
-                case FLOAT:
-                    aFloat.setValue(Float.parseFloat(admLexer.getLastTokenImage()));
-                    floatSerde.serialize(aFloat, out);
-                    return;
-                case INT8:
-                    parseInt8(admLexer.getLastTokenImage(), out);
-                    return;
-                case INT16:
-                    parseInt16(admLexer.getLastTokenImage(), out);
-                    return;
-                case INT32:
-                    parseInt32(admLexer.getLastTokenImage(), out);
-                    return;
-                case INT64:
-                    parseInt64(admLexer.getLastTokenImage(), out);
-                    return;
-                default: // fall through
-            }
+    private boolean parseNumeric(final ATypeTag typeTag, DataOutput out) throws HyracksDataException,
+            AsterixException {
+        switch (typeTag) {
+            case DOUBLE:
+                aDouble.setValue(Double.parseDouble(admLexer.getLastTokenImage()));
+                doubleSerde.serialize(aDouble, out);
+                return true;
+            case FLOAT:
+                aFloat.setValue(Float.parseFloat(admLexer.getLastTokenImage()));
+                floatSerde.serialize(aFloat, out);
+                return true;
+            case INT8:
+                parseInt8(admLexer.getLastTokenImage(), out);
+                return true;
+            case INT16:
+                parseInt16(admLexer.getLastTokenImage(), out);
+                return true;
+            case INT32:
+                parseInt32(admLexer.getLastTokenImage(), out);
+                return true;
+            case INT64:
+                parseInt64(admLexer.getLastTokenImage(), out);
+                return true;
+            default: // fall through
         }
-        throw new AsterixException(mismatchErrorMessage + objectType.getTypeName() + mismatchErrorMessage2 + typeTag);
+        return false;
     }
 
+    private void parseToTarget(ATypeTag typeTag, IAType objectType, DataOutput out) throws AsterixException,
+            IOException {
+        final ATypeTag targetTypeTag = getTargetTypeTag(typeTag, objectType, out);
+        if (targetTypeTag == null || !parseNumeric(targetTypeTag, out)) {
+            throw new AsterixException(mismatchErrorMessage + objectType.getTypeName() + mismatchErrorMessage2
+                    + typeTag);
+        }
+    }
+    
+    private void parseAndCast(ATypeTag typeTag, IAType objectType, DataOutput out) throws AsterixException, IOException {
+        final ATypeTag targetTypeTag = getTargetTypeTag(typeTag, objectType, out);
+        DataOutput dataOutput = out;
+        if (targetTypeTag != typeTag) {
+            castBuffer.reset();
+            dataOutput = castBuffer.getDataOutput();
+        }
+
+        if (targetTypeTag == null || !parseNumeric(typeTag, dataOutput)) {
+            throw new AsterixException(mismatchErrorMessage + objectType.getTypeName() + mismatchErrorMessage2
+                    + typeTag);
+        }
+
+        if (targetTypeTag != typeTag) {
+            ITypePromoteComputer promoteComputer = ATypeHierarchy.getTypePromoteComputer(typeTag, targetTypeTag);
+            // the availability if the promote computer should be consistent with the availability of a target type
+            assert promoteComputer != null;
+            // do the promotion; note that the type tag field should be skipped
+            promoteComputer.promote(castBuffer.getByteArray(), castBuffer.getStartOffset() + 1,
+                    castBuffer.getLength() - 1, out);
+        }
+    }
+    
     private void parseConstructor(ATypeTag typeTag, IAType objectType, DataOutput out) throws AsterixException {
         try {
             int token = admLexer.next();
