diff --git a/src/java/com/twitter/elephantbird/util/ThriftUtils.java b/src/java/com/twitter/elephantbird/util/ThriftUtils.java
index <HASH>..<HASH> 100644
--- a/src/java/com/twitter/elephantbird/util/ThriftUtils.java
+++ b/src/java/com/twitter/elephantbird/util/ThriftUtils.java
@@ -1,6 +1,7 @@
 package com.twitter.elephantbird.util;
 
 import java.lang.reflect.Field;
+import java.lang.reflect.Method;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.thrift.TBase;
@@ -104,11 +105,15 @@ public class ThriftUtils {
 
   public static Class<?> getFiedlType(Class<?> containingClass, String fieldName) {
     try {
-      Field field = containingClass.getDeclaredField(fieldName);
-      return field.getType();
-    } catch (NoSuchFieldException e) {
-      throw new RuntimeException("while trying to find " + fieldName + " in "
-                                 + containingClass, e);
+      // checking the return type of get method works for union as well.
+      String getMethodName = "get"
+                             + fieldName.substring(0, 1).toUpperCase()
+                             + fieldName.substring(1);
+      Method method = containingClass.getDeclaredMethod(getMethodName);
+      return method.getReturnType();
+    } catch (NoSuchMethodException e) {
+      throw new RuntimeException("while trying to find type for " + fieldName +
+                                 " in " + containingClass, e);
     }
   }
 }
ThriftUtils : use return type of get method to
find the type of a field. This works for unions 
where there are no real fields in the class.