@Override
 public <T> PType<T> as(PType<T> ptype) {
   if (ptype instanceof WritableType
       || ptype instanceof WritableTableType
       || ptype instanceof WritableGroupedTableType) {
     return ptype;
   }
   if (ptype instanceof PGroupedTableType) {
     PTableType ptt = ((PGroupedTableType) ptype).getTableType();
     return new WritableGroupedTableType((WritableTableType) as(ptt));
   }
   PType<T> prim = Writables.getPrimitiveType(ptype.getTypeClass());
   if (prim != null) {
     return prim;
   }
   return PTypeUtils.convert(ptype, this);
 }
Exemple #2
0
 @SuppressWarnings({"unchecked", "rawtypes"})
 protected static void testInputOutputFn(PType ptype, Object java, Object avro) {
   initialize(ptype);
   assertEquals(java, ptype.getInputMapFn().map(avro));
   assertEquals(avro, ptype.getOutputMapFn().map(java));
 }
Exemple #3
0
 private static void initialize(PType ptype) {
   ptype.getInputMapFn().initialize();
   ptype.getOutputMapFn().initialize();
 }