lib/embulk/output/bigquery.rb in embulk-output-bigquery-0.4.12 vs lib/embulk/output/bigquery.rb in embulk-output-bigquery-0.4.13
- old
+ new
@@ -87,10 +87,11 @@
'field_delimiter' => config.param('field_delimiter', :string, :default => ','),
'encoding' => config.param('encoding', :string, :default => 'UTF-8'),
'ignore_unknown_values' => config.param('ignore_unknown_values', :bool, :default => false),
'allow_quoted_newlines' => config.param('allow_quoted_newlines', :bool, :default => false),
'time_partitioning' => config.param('time_partitioning', :hash, :default => nil),
+ 'clustering' => config.param('clustering', :hash, :default => nil), # google-api-ruby-client >= v0.21.0
'schema_update_options' => config.param('schema_update_options', :array, :default => nil),
# for debug
'skip_load' => config.param('skip_load', :bool, :default => false),
'temp_table' => config.param('temp_table', :string, :default => nil),
@@ -230,9 +231,15 @@
unless task['time_partitioning']['type']
raise ConfigError.new "`time_partitioning` must have `type` key"
end
elsif Helper.has_partition_decorator?(task['table'])
task['time_partitioning'] = {'type' => 'DAY'}
+ end
+
+ if task['clustering']
+ unless task['clustering']['fields']
+ raise ConfigError.new "`clustering` must have `fields` key"
+ end
end
if task['schema_update_options']
task['schema_update_options'].each do |schema_update_option|
unless %w[ALLOW_FIELD_ADDITION ALLOW_FIELD_RELAXATION].include?(schema_update_option)