bigquery_migration 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b64d00c827e85ec40f7c37bc2153ee2c06ce80c1
4
- data.tar.gz: 9ff2ebad940ec9f46739d5c4a934f7c773f9f5ea
3
+ metadata.gz: ce47a4ba011b85511ddfcdb55489abd8bddebdb4
4
+ data.tar.gz: 2c22d84df63cc2a0000fb05f07f062332528cfb7
5
5
  SHA512:
6
- metadata.gz: 075e151988a8566dbcff6c9a20debd29fb9642fecc8bfe952a3fe0bae33f2a63a6f8e49d2a186f39a4943abd2de29d8692ab4985fea397cb4ede5b25a797493b
7
- data.tar.gz: 1eeb968a5161bb89089a38bf5aacee696c07672f5f1a977bf00bcf10f2a5d7eba87038f86048dedb00ec746e725255f57507c1dae49690584b71c39caeffa538
6
+ metadata.gz: af8b65b3735dff7e674528121dd145b1b14b346a58b3928e16375f4bbd0bb757d7ecb370fa8efd6a65aafd7f625fde5ede18b1f2533551c8a34dd0db5d077809
7
+ data.tar.gz: 4bad1538699ecdee97efa129bf8bd7900fb8cd3913c5363b134b6c10d8b6a2ed02423d089944fc67c115b72d677f111b9016d532890d59e78b6f2119f793df05
@@ -1,3 +1,9 @@
1
+ # 0.1.6 (2016/07/26)
2
+
3
+ Fixes:
4
+
5
+ * Fix empty hash to nil
6
+
1
7
  # 0.1.5 (2016/07/25)
2
8
 
3
9
  Enhancements:
@@ -95,9 +95,9 @@ class BigqueryMigration
95
95
  end
96
96
  elsif column[:mode] == 'REPEATED'
97
97
  v = row[:v]
98
- count < v.length ? value.push(v[count][:v]) : value.push(nil)
98
+ count < v.length ? value.push(normalize_value(v[count][:v])) : value.push(nil)
99
99
  elsif count == 0
100
- value.push(row[:v])
100
+ value.push((normalize_value(row[:v])))
101
101
  else
102
102
  value.push(nil)
103
103
  end
@@ -105,6 +105,12 @@ class BigqueryMigration
105
105
  value
106
106
  end
107
107
 
108
+ # special treatment empty hash.
109
+ # nil is converted into {} by to_h
110
+ private def normalize_value(v)
111
+ v.is_a?(Hash) && v.empty? ? nil : v
112
+ end
113
+
108
114
  private def generate_nil_count(fields)
109
115
  fields.inject(0) do |acc, f|
110
116
  f[:type] == 'RECORD' ? acc + generate_nil_count(f[:fields]) : acc + 1
@@ -1,3 +1,3 @@
1
1
  class BigqueryMigration
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bigquery_migration
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naotoshi Seo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-07-25 00:00:00.000000000 Z
11
+ date: 2016-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-api-client