ThriftToPig { public static void setConversionProperties(Configuration conf) { if (conf != null) { useEnumId = conf.getBoolean(USE_ENUM_ID_CONF_KEY, false); LOG.debug("useEnumId is set to " + useEnumId); } } ThriftToPig(Class<M> tClass); static ThriftToPig<M> newInstance(Class<M> tClass); static ThriftToPig<M> newInstance(TypeRef<M> typeRef); TStructDescriptor getTStructDescriptor(); Tuple getPigTuple(M thriftObj); Tuple getLazyTuple(M thriftObj); static void setConversionProperties(Configuration conf); @SuppressWarnings("unchecked") static Object toPigObject(Field field, Object value, boolean lazy); static Schema toSchema(Class<? extends TBase<?, ?>> tClass); Schema toSchema(); static Schema toSchema(TStructDescriptor tDesc); static String toPigScript(Class<? extends TBase<?, ?>> thriftClass,
                                   Class<? extends LoadFunc> pigLoader); static void stringifySchema(StringBuilder sb,
                                     Schema schema,
                                     byte type,
                                     StringBuilder prefix); static void main(String[] args); static final Logger LOG; }
@SuppressWarnings({ "rawtypes", "unchecked" }) @Test public void testSetConversionProperties() throws ExecException { PhoneNumber pn = new PhoneNumber(); pn.setNumber("1234"); pn.setType(PhoneType.HOME); ThriftToPig ttp = ThriftToPig.newInstance(PhoneNumber.class); Tuple tuple = ttp.getPigTuple(pn); assertEquals(DataType.CHARARRAY, tuple.getType(1)); assertEquals(PhoneType.HOME.toString(), tuple.get(1)); Configuration conf = new Configuration(); conf.setBoolean(ThriftToPig.USE_ENUM_ID_CONF_KEY, true); ThriftToPig.setConversionProperties(conf); tuple = ttp.getPigTuple(pn); assertEquals(DataType.INTEGER, tuple.getType(1)); assertEquals(PhoneType.HOME.getValue(), tuple.get(1)); }