@Override public final ResourceSchema getSchema(final String location, final Job job) throws IOException { if (schema == null) { Schema s = getAvroSchema(location, job); setInputAvroSchema(s); } ResourceSchema rs = AvroStorageSchemaConversionUtilities .avroSchemaToResourceSchema(schema, allowRecursive); return rs; }
@Override public void setLocation(final String location, final Job job) throws IOException { FileInputFormat.setInputPaths(job, location); if (schema == null) { schema = getInputAvroSchema(); if (schema == null) { schema = getAvroSchema(location, job); if (schema == null) { throw new IOException( "Could not determine avro schema for location " + location); } setInputAvroSchema(schema); } } }
@Override public RequiredFieldResponse pushProjection(final RequiredFieldList rfl) throws FrontendException { requiredFieldList = rfl; Schema newSchema = AvroStorageSchemaConversionUtilities .newSchemaFromRequiredFieldList(schema, rfl); if (newSchema != null) { schema = newSchema; setInputAvroSchema(schema); return new RequiredFieldResponse(true); } else { log.warn("could not select fields subset " + rfl + "\n"); warn("could not select fields subset", PigWarning.UDF_WARNING_2); return new RequiredFieldResponse(false); } }
Schema s = (new Schema.Parser()).parse(sn); setInputAvroSchema(s); setOutputAvroSchema(s); } catch (SchemaParseException e) { setInputAvroSchema(s); setOutputAvroSchema(s); } catch (FileNotFoundException fnfe) { try { Schema s = ((GenericContainer) Class.forName(schemaClass).newInstance()).getSchema(); setInputAvroSchema(s); setOutputAvroSchema(s); } catch (ClassNotFoundException | IllegalAccessException cnfe) {