/** * Retrieve (or create if it doesn't exist) the correct Instance for this * SeedObject using 'seenSchemas' to resolve circular references */ public synchronized Instance retrieve(SeedObject hv, Set<SeedObject> seenSchemas) throws AvroSerdeException { if(LOG.isDebugEnabled()) LOG.debug("Checking for hv: " + hv.toString()); if(cache.containsKey(hv)) { if(LOG.isDebugEnabled()) LOG.debug("Returning cache result."); return cache.get(hv); } if(LOG.isDebugEnabled()) LOG.debug("Creating new instance and storing in cache"); Instance instance = makeInstance(hv, seenSchemas); cache.put(hv, instance); return instance; }
/** * Retrieve (or create if it doesn't exist) the correct Instance for this * SeedObject */ public Instance retrieve(SeedObject hv) throws AvroSerdeException { return retrieve(hv, null); }
@Override protected InstanceCache<Object, GenericEnumSymbol> makeInstance(final Schema schema, Set<Schema> seenSchemas) { return new InstanceCache<Object, GenericEnumSymbol>() { @Override protected GenericEnumSymbol makeInstance(Object seed, Set<Object> seenSchemas) { return new GenericData.EnumSymbol(schema, seed.toString()); } }; } };
/** * Retrieve (or create if it doesn't exist) the correct Instance for this * SeedObject using 'seenSchemas' to resolve circular references */ public synchronized Instance retrieve(SeedObject hv, Set<SeedObject> seenSchemas) throws AvroSerdeException { if(LOG.isDebugEnabled()) LOG.debug("Checking for hv: " + hv.toString()); if(cache.containsKey(hv)) { if(LOG.isDebugEnabled()) LOG.debug("Returning cache result."); return cache.get(hv); } if(LOG.isDebugEnabled()) LOG.debug("Creating new instance and storing in cache"); Instance instance = makeInstance(hv, seenSchemas); cache.put(hv, instance); return instance; }
@Override protected InstanceCache<Object, GenericEnumSymbol> makeInstance(final Schema schema, Set<Schema> seenSchemas) { return new InstanceCache<Object, GenericEnumSymbol>() { @Override protected GenericEnumSymbol makeInstance(Object seed, Set<Object> seenSchemas) { return new GenericData.EnumSymbol(schema, seed.toString()); } }; } };
return typeInfoCache.retrieve(schema, seenSchemas);
/** * Retrieve (or create if it doesn't exist) the correct Instance for this * SeedObject */ public Instance retrieve(SeedObject hv) throws AvroSerdeException { if(LOG.isDebugEnabled()) LOG.debug("Checking for hv: " + hv.toString()); if(cache.containsKey(hv.hashCode())) { if(LOG.isDebugEnabled()) LOG.debug("Returning cache result."); return cache.get(hv.hashCode()); } if(LOG.isDebugEnabled()) LOG.debug("Creating new instance and storing in cache"); Instance instance = makeInstance(hv); cache.put(hv.hashCode(), instance); return instance; }
@Override protected InstanceCache<Object, GenericEnumSymbol> makeInstance(final Schema schema, Set<Schema> seenSchemas) { return new InstanceCache<Object, GenericEnumSymbol>() { @Override protected GenericEnumSymbol makeInstance(Object seed, Set<Object> seenSchemas) { return new GenericData.EnumSymbol(schema, seed.toString()); } }; } };
/** * Retrieve (or create if it doesn't exist) the correct Instance for this * SeedObject */ public Instance retrieve(SeedObject hv) throws AvroSerdeException { return retrieve(hv, null); }
/** * Retrieve (or create if it doesn't exist) the correct Instance for this * SeedObject using 'seenSchemas' to resolve circular references */ public Instance retrieve(SeedObject hv, Set<SeedObject> seenSchemas) throws AvroSerdeException { if(LOG.isDebugEnabled()) LOG.debug("Checking for hv: " + hv.toString()); if(cache.containsKey(hv.hashCode())) { if(LOG.isDebugEnabled()) LOG.debug("Returning cache result."); return cache.get(hv.hashCode()); } if(LOG.isDebugEnabled()) LOG.debug("Creating new instance and storing in cache"); Instance instance = makeInstance(hv, seenSchemas); cache.put(hv.hashCode(), instance); return instance; }
@Override protected InstanceCache<Object, GenericEnumSymbol> makeInstance(final Schema schema, Set<Schema> seenSchemas) { return new InstanceCache<Object, GenericEnumSymbol>() { @Override protected GenericEnumSymbol makeInstance(Object seed, Set<Object> seenSchemas) { return new GenericData.EnumSymbol(schema, seed.toString()); } }; } };
public V retrieve(K hv) throws AvroSerdeException { return retrieve(hv, null); }
/** * Retrieve (or create if it doesn't exist) the correct Instance for this * SeedObject using 'seenSchemas' to resolve circular references */ public Instance retrieve(SeedObject hv, Set<SeedObject> seenSchemas) throws AvroSerdeException { if(LOG.isDebugEnabled()) LOG.debug("Checking for hv: " + hv.toString()); if(cache.containsKey(hv.hashCode())) { if(LOG.isDebugEnabled()) LOG.debug("Returning cache result."); return cache.get(hv.hashCode()); } if(LOG.isDebugEnabled()) LOG.debug("Creating new instance and storing in cache"); Instance instance = makeInstance(hv, seenSchemas); cache.put(hv.hashCode(), instance); return instance; }
@Override protected InstanceCache<Object, GenericEnumSymbol> makeInstance(final Schema schema, Set<Schema> seenSchemas) { return new InstanceCache<Object, GenericEnumSymbol>() { @Override protected GenericEnumSymbol makeInstance(Object seed, Set<Object> seenSchemas) { return new GenericData.EnumSymbol(schema, seed.toString()); } }; } };
/** * Retrieve (or create if it doesn't exist) the correct Instance for this * SeedObject */ public Instance retrieve(SeedObject hv) throws AvroSerdeException { return retrieve(hv, null); }
public V retrieve(K hv, Set<K> seenSchemas) throws AvroSerdeException { V instance = cache.getIfPresent(hv); if (instance == null) { instance = makeInstance(hv, seenSchemas); cache.put(hv, instance); } return instance; }
/** * Convert an Avro Schema into an equivalent Hive TypeInfo. * @param schema to record. Must be of record type. * @return TypeInfo matching the Avro schema * @throws AvroSerdeException for any problems during conversion. */ public static TypeInfo generateTypeInfo(Schema schema) throws AvroSerdeException { return typeInfoCache.retrieve(schema); }
/** * Retrieve (or create if it doesn't exist) the correct Instance for this * SeedObject */ public Instance retrieve(SeedObject hv) throws AvroSerdeException { return retrieve(hv, null); }