/** * Internal function for getting the Properties object associated with * this UDF instance. * @return The Properties object associated with this UDF instance */ protected final Properties getProperties() { if (udfContextSignature == null) { return getProperties(AvroStorage.class, null); } else { return getProperties(AvroStorage.class, udfContextSignature); } }
/** * Sets the output avro schema to {@s}. * @param s An Avro schema */ protected final void setOutputAvroSchema(final Schema s) { schema = s; getProperties() .setProperty(OUTPUT_AVRO_SCHEMA, s.toString()); }
/** * Sets the input avro schema to {@s}. * @param s The specified schema */ protected final void setInputAvroSchema(final Schema s) { schema = s; getProperties().setProperty(INPUT_AVRO_SCHEMA, s.toString()); }
/** * Utility function that gets the input avro schema from the udf * properties and updates schema for this instance. */ private final void updateSchemaFromInputAvroSchema() { String schemaString = getProperties().getProperty(INPUT_AVRO_SCHEMA); if (schemaString != null) { Schema s = new Schema.Parser().parse(schemaString); schema = s; } }
/** * Utility function that gets the output schema from the udf * properties for this instance of the store function. * @return the output schema associated with this UDF */ protected final Schema getOutputAvroSchema() { if (schema == null) { String schemaString = getProperties() .getProperty(OUTPUT_AVRO_SCHEMA); if (schemaString != null) { schema = (new Schema.Parser()).parse(schemaString); } } return schema; }