basic-lib/src/main/java/com/streamsets/pipeline/stage/processor/schemagen/generators/AvroSchemaGenerator.java
private Schema.Field schemaFieldForType(
      String fieldPath,
      Record record,
      String fieldName,
      Field field
  ) throws OnRecordErrorException {
    Schema simpleSchema = simpleSchemaForType(fieldPath, record, field);
    Schema finalSchema = simpleSchema;

    // If Nullable check box was selected, wrap the whole schema in union with null
    if(getConfig().avroNullableFields) {
      finalSchema = Schema.createUnion(ImmutableList.of(
        Schema.create(Schema.Type.NULL),
        simpleSchema
      ));
    }

    return new Schema.Field(
      fieldName,
      finalSchema,
      null,
      getDefaultValue(simpleSchema)
    );
  }
private Schema.Field schemaFieldForType(
      String fieldPath,
      Record record,
      String fieldName,
      Field field
  ) throws OnRecordErrorException {
    Schema simpleSchema = simpleSchemaForType(fieldPath, record, field);
    Schema finalSchema = simpleSchema;

    // If Nullable check box was selected, wrap the whole schema in union with null
    if(getConfig().avroNullableFields) {
      finalSchema = Schema.createUnion(ImmutableList.of(
        Schema.create(Schema.Type.NULL),
        simpleSchema
      ));
    }

    return new Schema.Field(
      fieldName,
      finalSchema,
      null,
      getDefaultValue(simpleSchema)
    );
  }
private Schema . Field schemaFieldForType ( String fieldPath , Record record , String fieldName , Field field ) throws OnRecordErrorException { Schema simpleSchema = simpleSchemaForType ( fieldPath , record , field ) ; Schema finalSchema = simpleSchema ; // If Nullable check box was selected, wrap the whole schema in union with null if ( getConfig ( ) . avroNullableFields ) { finalSchema = Schema . createUnion ( ImmutableList . of ( Schema . create ( Schema . Type . NULL ) , simpleSchema ) ) ; } return new Schema . Field ( fieldName , finalSchema , null , getDefaultValue ( simpleSchema ) ) ; }
Generate schema for given field and optionally wrap it in union with null if configured.
Generate schema for given field and optionally wrap it in union with null if configured .