lib/fluent/plugin/bigquery/schema.rb in fluent-plugin-bigquery-0.4.4 vs lib/fluent/plugin/bigquery/schema.rb in fluent-plugin-bigquery-0.5.0.beta1
- old
+ new
@@ -207,27 +207,25 @@
:mode => mode.to_s.upcase,
:fields => self.to_a,
}
end
- def load_schema(schema, allow_overwrite=true)
+ def load_schema(schema)
schema.each do |field|
raise ConfigError, 'field must have type' unless field.key?('type')
name = field['name']
mode = (field['mode'] || 'nullable').downcase.to_sym
type = field['type'].downcase.to_sym
field_schema_class = FIELD_TYPES[type]
raise ConfigError, "Invalid field type: #{field['type']}" unless field_schema_class
- next if @fields.key?(name) and !allow_overwrite
-
field_schema = field_schema_class.new(name, mode)
@fields[name] = field_schema
if type == :record
raise ConfigError, "record field must have fields" unless field.key?('fields')
- field_schema.load_schema(field['fields'], allow_overwrite)
+ field_schema.load_schema(field['fields'])
end
end
end
def register_field(name, type)