google-cloud-bigquery 1.29.0 → 1.30.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/CONTRIBUTING.md +2 -3
- data/OVERVIEW.md +15 -14
- data/lib/google/cloud/bigquery/convert.rb +72 -72
- data/lib/google/cloud/bigquery/dataset.rb +75 -41
- data/lib/google/cloud/bigquery/load_job.rb +51 -3
- data/lib/google/cloud/bigquery/project.rb +44 -40
- data/lib/google/cloud/bigquery/query_job.rb +37 -34
- data/lib/google/cloud/bigquery/schema.rb +39 -3
- data/lib/google/cloud/bigquery/schema/field.rb +63 -13
- data/lib/google/cloud/bigquery/standard_sql.rb +11 -0
- data/lib/google/cloud/bigquery/table.rb +87 -7
- data/lib/google/cloud/bigquery/table/async_inserter.rb +20 -2
- data/lib/google/cloud/bigquery/version.rb +1 -1
- metadata +2 -2
@@ -773,9 +773,18 @@ module Google
|
|
773
773
|
end
|
774
774
|
|
775
775
|
##
|
776
|
-
# Adds a numeric number field to the schema.
|
777
|
-
# fixed
|
778
|
-
# the
|
776
|
+
# Adds a numeric number field to the schema. `NUMERIC` is a decimal
|
777
|
+
# type with fixed precision and scale. Precision is the number of
|
778
|
+
# digits that the number contains. Scale is how many of these
|
779
|
+
# digits appear after the decimal point. It supports:
|
780
|
+
#
|
781
|
+
# Precision: 38
|
782
|
+
# Scale: 9
|
783
|
+
# Min: -9.9999999999999999999999999999999999999E+28
|
784
|
+
# Max: 9.9999999999999999999999999999999999999E+28
|
785
|
+
#
|
786
|
+
# This type can represent decimal fractions exactly, and is suitable
|
787
|
+
# for financial calculations.
|
779
788
|
#
|
780
789
|
# See {Schema#numeric}
|
781
790
|
#
|
@@ -802,6 +811,45 @@ module Google
|
|
802
811
|
schema.numeric name, description: description, mode: mode
|
803
812
|
end
|
804
813
|
|
814
|
+
##
|
815
|
+
# Adds a bignumeric number field to the schema. `BIGNUMERIC` is a
|
816
|
+
# decimal type with fixed precision and scale. Precision is the
|
817
|
+
# number of digits that the number contains. Scale is how many of
|
818
|
+
# these digits appear after the decimal point. It supports:
|
819
|
+
#
|
820
|
+
# Precision: 76.76 (the 77th digit is partial)
|
821
|
+
# Scale: 38
|
822
|
+
# Min: -5.7896044618658097711785492504343953926634992332820282019728792003956564819968E+38
|
823
|
+
# Max: 5.7896044618658097711785492504343953926634992332820282019728792003956564819967E+38
|
824
|
+
#
|
825
|
+
# This type can represent decimal fractions exactly, and is suitable
|
826
|
+
# for financial calculations.
|
827
|
+
#
|
828
|
+
# See {Schema#bignumeric}
|
829
|
+
#
|
830
|
+
# @param [String] name The field name. The name must contain only
|
831
|
+
# letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
|
832
|
+
# start with a letter or underscore. The maximum length is 128
|
833
|
+
# characters.
|
834
|
+
# @param [String] description A description of the field.
|
835
|
+
# @param [Symbol] mode The field's mode. The possible values are
|
836
|
+
# `:nullable`, `:required`, and `:repeated`. The default value is
|
837
|
+
# `:nullable`.
|
838
|
+
#
|
839
|
+
# @example
|
840
|
+
# require "google/cloud/bigquery"
|
841
|
+
#
|
842
|
+
# bigquery = Google::Cloud::Bigquery.new
|
843
|
+
# dataset = bigquery.dataset "my_dataset"
|
844
|
+
# job = dataset.load_job "my_table", "gs://abc/file" do |schema|
|
845
|
+
# schema.bignumeric "total_cost", mode: :required
|
846
|
+
# end
|
847
|
+
#
|
848
|
+
# @!group Schema
|
849
|
+
def bignumeric name, description: nil, mode: :nullable
|
850
|
+
schema.bignumeric name, description: description, mode: mode
|
851
|
+
end
|
852
|
+
|
805
853
|
##
|
806
854
|
# Adds a boolean field to the schema.
|
807
855
|
#
|
@@ -293,35 +293,37 @@ module Google
|
|
293
293
|
#
|
294
294
|
# Ruby types are mapped to BigQuery types as follows:
|
295
295
|
#
|
296
|
-
# | BigQuery
|
297
|
-
#
|
298
|
-
# | `BOOL`
|
299
|
-
# | `INT64`
|
300
|
-
# | `FLOAT64`
|
301
|
-
# | `NUMERIC`
|
302
|
-
# | `
|
303
|
-
# | `
|
304
|
-
# | `
|
305
|
-
# | `
|
306
|
-
# | `
|
307
|
-
# | `
|
308
|
-
# | `
|
309
|
-
# | `
|
296
|
+
# | BigQuery | Ruby | Notes |
|
297
|
+
# |--------------|--------------------------------------|----------------------------------------------------|
|
298
|
+
# | `BOOL` | `true`/`false` | |
|
299
|
+
# | `INT64` | `Integer` | |
|
300
|
+
# | `FLOAT64` | `Float` | |
|
301
|
+
# | `NUMERIC` | `BigDecimal` | `BigDecimal` values will be rounded to scale 9. |
|
302
|
+
# | `BIGNUMERIC` | | Query param values must be mapped in `types`. |
|
303
|
+
# | `STRING` | `String` | |
|
304
|
+
# | `DATETIME` | `DateTime` | `DATETIME` does not support time zone. |
|
305
|
+
# | `DATE` | `Date` | |
|
306
|
+
# | `TIMESTAMP` | `Time` | |
|
307
|
+
# | `TIME` | `Google::Cloud::BigQuery::Time` | |
|
308
|
+
# | `BYTES` | `File`, `IO`, `StringIO`, or similar | |
|
309
|
+
# | `ARRAY` | `Array` | Nested arrays, `nil` values are not supported. |
|
310
|
+
# | `STRUCT` | `Hash` | Hash keys may be strings or symbols. |
|
310
311
|
#
|
311
312
|
# See [Data Types](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types) for an overview
|
312
313
|
# of each BigQuery data type, including allowed values.
|
313
|
-
# @param [Array, Hash] types Standard SQL only. Types of the SQL parameters in `params`. It is not always
|
314
|
-
# infer the right SQL type from a value in `params`. In these cases, `types` must be used to
|
315
|
-
# type for these values.
|
314
|
+
# @param [Array, Hash] types Standard SQL only. Types of the SQL parameters in `params`. It is not always
|
315
|
+
# possible to infer the right SQL type from a value in `params`. In these cases, `types` must be used to
|
316
|
+
# specify the SQL type for these values.
|
316
317
|
#
|
317
|
-
#
|
318
|
-
# parameters. This must be an `Hash` when the query uses named query parameters. The values
|
319
|
-
# type codes from the following list:
|
318
|
+
# Arguments must match the value type passed to `params`. This must be an `Array` when the query uses
|
319
|
+
# positional query parameters. This must be an `Hash` when the query uses named query parameters. The values
|
320
|
+
# should be BigQuery type codes from the following list:
|
320
321
|
#
|
321
322
|
# * `:BOOL`
|
322
323
|
# * `:INT64`
|
323
324
|
# * `:FLOAT64`
|
324
325
|
# * `:NUMERIC`
|
326
|
+
# * `:BIGNUMERIC`
|
325
327
|
# * `:STRING`
|
326
328
|
# * `:DATETIME`
|
327
329
|
# * `:DATE`
|
@@ -638,35 +640,37 @@ module Google
|
|
638
640
|
#
|
639
641
|
# Ruby types are mapped to BigQuery types as follows:
|
640
642
|
#
|
641
|
-
# | BigQuery
|
642
|
-
#
|
643
|
-
# | `BOOL`
|
644
|
-
# | `INT64`
|
645
|
-
# | `FLOAT64`
|
646
|
-
# | `NUMERIC`
|
647
|
-
# | `
|
648
|
-
# | `
|
649
|
-
# | `
|
650
|
-
# | `
|
651
|
-
# | `
|
652
|
-
# | `
|
653
|
-
# | `
|
654
|
-
# | `
|
643
|
+
# | BigQuery | Ruby | Notes |
|
644
|
+
# |--------------|--------------------------------------|----------------------------------------------------|
|
645
|
+
# | `BOOL` | `true`/`false` | |
|
646
|
+
# | `INT64` | `Integer` | |
|
647
|
+
# | `FLOAT64` | `Float` | |
|
648
|
+
# | `NUMERIC` | `BigDecimal` | `BigDecimal` values will be rounded to scale 9. |
|
649
|
+
# | `BIGNUMERIC` | | Query param values must be mapped in `types`. |
|
650
|
+
# | `STRING` | `String` | |
|
651
|
+
# | `DATETIME` | `DateTime` | `DATETIME` does not support time zone. |
|
652
|
+
# | `DATE` | `Date` | |
|
653
|
+
# | `TIMESTAMP` | `Time` | |
|
654
|
+
# | `TIME` | `Google::Cloud::BigQuery::Time` | |
|
655
|
+
# | `BYTES` | `File`, `IO`, `StringIO`, or similar | |
|
656
|
+
# | `ARRAY` | `Array` | Nested arrays, `nil` values are not supported. |
|
657
|
+
# | `STRUCT` | `Hash` | Hash keys may be strings or symbols. |
|
655
658
|
#
|
656
659
|
# See [Data Types](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types) for an overview
|
657
660
|
# of each BigQuery data type, including allowed values.
|
658
|
-
# @param [Array, Hash] types Standard SQL only. Types of the SQL parameters in `params`. It is not always
|
659
|
-
# infer the right SQL type from a value in `params`. In these cases, `types` must be used to
|
660
|
-
# type for these values.
|
661
|
+
# @param [Array, Hash] types Standard SQL only. Types of the SQL parameters in `params`. It is not always
|
662
|
+
# possible to infer the right SQL type from a value in `params`. In these cases, `types` must be used to
|
663
|
+
# specify the SQL type for these values.
|
661
664
|
#
|
662
|
-
#
|
663
|
-
# parameters. This must be an `Hash` when the query uses named query parameters. The values
|
664
|
-
# type codes from the following list:
|
665
|
+
# Arguments must match the value type passed to `params`. This must be an `Array` when the query uses
|
666
|
+
# positional query parameters. This must be an `Hash` when the query uses named query parameters. The values
|
667
|
+
# should be BigQuery type codes from the following list:
|
665
668
|
#
|
666
669
|
# * `:BOOL`
|
667
670
|
# * `:INT64`
|
668
671
|
# * `:FLOAT64`
|
669
672
|
# * `:NUMERIC`
|
673
|
+
# * `:BIGNUMERIC`
|
670
674
|
# * `:STRING`
|
671
675
|
# * `:DATETIME`
|
672
676
|
# * `:DATE`
|
@@ -853,20 +853,21 @@ module Google
|
|
853
853
|
#
|
854
854
|
# Ruby types are mapped to BigQuery types as follows:
|
855
855
|
#
|
856
|
-
# | BigQuery
|
857
|
-
#
|
858
|
-
# | `BOOL`
|
859
|
-
# | `INT64`
|
860
|
-
# | `FLOAT64`
|
861
|
-
# | `NUMERIC`
|
862
|
-
# | `
|
863
|
-
# | `
|
864
|
-
# | `
|
865
|
-
# | `
|
866
|
-
# | `
|
867
|
-
# | `
|
868
|
-
# | `
|
869
|
-
# | `
|
856
|
+
# | BigQuery | Ruby | Notes |
|
857
|
+
# |--------------|--------------------------------------|--------------------------------------------------|
|
858
|
+
# | `BOOL` | `true`/`false` | |
|
859
|
+
# | `INT64` | `Integer` | |
|
860
|
+
# | `FLOAT64` | `Float` | |
|
861
|
+
# | `NUMERIC` | `BigDecimal` | `BigDecimal` values will be rounded to scale 9. |
|
862
|
+
# | `BIGNUMERIC` | | Query param values must be mapped in `types`. |
|
863
|
+
# | `STRING` | `String` | |
|
864
|
+
# | `DATETIME` | `DateTime` | `DATETIME` does not support time zone. |
|
865
|
+
# | `DATE` | `Date` | |
|
866
|
+
# | `TIMESTAMP` | `Time` | |
|
867
|
+
# | `TIME` | `Google::Cloud::BigQuery::Time` | |
|
868
|
+
# | `BYTES` | `File`, `IO`, `StringIO`, or similar | |
|
869
|
+
# | `ARRAY` | `Array` | Nested arrays, `nil` values are not supported. |
|
870
|
+
# | `STRUCT` | `Hash` | Hash keys may be strings or symbols. |
|
870
871
|
#
|
871
872
|
# See [Data Types](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types) for an overview
|
872
873
|
# of each BigQuery data type, including allowed values.
|
@@ -887,35 +888,37 @@ module Google
|
|
887
888
|
#
|
888
889
|
# Ruby types are mapped to BigQuery types as follows:
|
889
890
|
#
|
890
|
-
# | BigQuery
|
891
|
-
#
|
892
|
-
# | `BOOL`
|
893
|
-
# | `INT64`
|
894
|
-
# | `FLOAT64`
|
895
|
-
# | `NUMERIC`
|
896
|
-
# | `
|
897
|
-
# | `
|
898
|
-
# | `
|
899
|
-
# | `
|
900
|
-
# | `
|
901
|
-
# | `
|
902
|
-
# | `
|
903
|
-
# | `
|
891
|
+
# | BigQuery | Ruby | Notes |
|
892
|
+
# |--------------|--------------------------------------|--------------------------------------------------|
|
893
|
+
# | `BOOL` | `true`/`false` | |
|
894
|
+
# | `INT64` | `Integer` | |
|
895
|
+
# | `FLOAT64` | `Float` | |
|
896
|
+
# | `NUMERIC` | `BigDecimal` | `BigDecimal` values will be rounded to scale 9. |
|
897
|
+
# | `BIGNUMERIC` | | Query param values must be mapped in `types`. |
|
898
|
+
# | `STRING` | `String` | |
|
899
|
+
# | `DATETIME` | `DateTime` | `DATETIME` does not support time zone. |
|
900
|
+
# | `DATE` | `Date` | |
|
901
|
+
# | `TIMESTAMP` | `Time` | |
|
902
|
+
# | `TIME` | `Google::Cloud::BigQuery::Time` | |
|
903
|
+
# | `BYTES` | `File`, `IO`, `StringIO`, or similar | |
|
904
|
+
# | `ARRAY` | `Array` | Nested arrays, `nil` values are not supported. |
|
905
|
+
# | `STRUCT` | `Hash` | Hash keys may be strings or symbols. |
|
904
906
|
#
|
905
907
|
# See [Data Types](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types) for an overview
|
906
908
|
# of each BigQuery data type, including allowed values.
|
907
|
-
# @param [Array, Hash] types Standard SQL only. Types of the SQL parameters in `params`. It is not always
|
908
|
-
# infer the right SQL type from a value in `params`. In these cases, `types` must be used to
|
909
|
-
# type for these values.
|
909
|
+
# @param [Array, Hash] types Standard SQL only. Types of the SQL parameters in `params`. It is not always
|
910
|
+
# possible to infer the right SQL type from a value in `params`. In these cases, `types` must be used to
|
911
|
+
# specify the SQL type for these values.
|
910
912
|
#
|
911
|
-
#
|
912
|
-
# parameters. This must be an `Hash` when the query uses named query parameters. The values
|
913
|
-
# BigQuery type codes from the following list:
|
913
|
+
# Arguments must match the value type passed to `params`. This must be an `Array` when the query uses
|
914
|
+
# positional query parameters. This must be an `Hash` when the query uses named query parameters. The values
|
915
|
+
# should be BigQuery type codes from the following list:
|
914
916
|
#
|
915
917
|
# * `:BOOL`
|
916
918
|
# * `:INT64`
|
917
919
|
# * `:FLOAT64`
|
918
920
|
# * `:NUMERIC`
|
921
|
+
# * `:BIGNUMERIC`
|
919
922
|
# * `:STRING`
|
920
923
|
# * `:DATETIME`
|
921
924
|
# * `:DATE`
|
@@ -332,9 +332,18 @@ module Google
|
|
332
332
|
end
|
333
333
|
|
334
334
|
##
|
335
|
-
# Adds a numeric number field to the schema.
|
336
|
-
#
|
337
|
-
#
|
335
|
+
# Adds a numeric number field to the schema. `NUMERIC` is a decimal
|
336
|
+
# type with fixed precision and scale. Precision is the number of
|
337
|
+
# digits that the number contains. Scale is how many of these
|
338
|
+
# digits appear after the decimal point. It supports:
|
339
|
+
#
|
340
|
+
# Precision: 38
|
341
|
+
# Scale: 9
|
342
|
+
# Min: -9.9999999999999999999999999999999999999E+28
|
343
|
+
# Max: 9.9999999999999999999999999999999999999E+28
|
344
|
+
#
|
345
|
+
# This type can represent decimal fractions exactly, and is suitable
|
346
|
+
# for financial calculations.
|
338
347
|
#
|
339
348
|
# @param [String] name The field name. The name must contain only
|
340
349
|
# letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
|
@@ -349,6 +358,33 @@ module Google
|
|
349
358
|
add_field name, :numeric, description: description, mode: mode
|
350
359
|
end
|
351
360
|
|
361
|
+
##
|
362
|
+
# Adds a bignumeric number field to the schema. `BIGNUMERIC` is a
|
363
|
+
# decimal type with fixed precision and scale. Precision is the
|
364
|
+
# number of digits that the number contains. Scale is how many of
|
365
|
+
# these digits appear after the decimal point. It supports:
|
366
|
+
#
|
367
|
+
# Precision: 76.76 (the 77th digit is partial)
|
368
|
+
# Scale: 38
|
369
|
+
# Min: -5.7896044618658097711785492504343953926634992332820282019728792003956564819968E+38
|
370
|
+
# Max: 5.7896044618658097711785492504343953926634992332820282019728792003956564819967E+38
|
371
|
+
#
|
372
|
+
# This type can represent decimal fractions exactly, and is suitable
|
373
|
+
# for financial calculations.
|
374
|
+
#
|
375
|
+
# @param [String] name The field name. The name must contain only
|
376
|
+
# letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
|
377
|
+
# start with a letter or underscore. The maximum length is 128
|
378
|
+
# characters.
|
379
|
+
# @param [String] description A description of the field.
|
380
|
+
# @param [Symbol] mode The field's mode. The possible values are
|
381
|
+
# `:nullable`, `:required`, and `:repeated`. The default value is
|
382
|
+
# `:nullable`.
|
383
|
+
#
|
384
|
+
def bignumeric name, description: nil, mode: :nullable
|
385
|
+
add_field name, :bignumeric, description: description, mode: mode
|
386
|
+
end
|
387
|
+
|
352
388
|
##
|
353
389
|
# Adds a boolean field to the schema.
|
354
390
|
#
|
@@ -40,8 +40,8 @@ module Google
|
|
40
40
|
MODES = ["NULLABLE", "REQUIRED", "REPEATED"].freeze
|
41
41
|
|
42
42
|
# @private
|
43
|
-
TYPES = ["STRING", "INTEGER", "INT64", "FLOAT", "FLOAT64", "NUMERIC", "
|
44
|
-
"TIME", "DATETIME", "DATE", "RECORD", "STRUCT"].freeze
|
43
|
+
TYPES = ["STRING", "INTEGER", "INT64", "FLOAT", "FLOAT64", "NUMERIC", "BIGNUMERIC", "BOOLEAN", "BOOL",
|
44
|
+
"BYTES", "TIMESTAMP", "TIME", "DATETIME", "DATE", "RECORD", "STRUCT"].freeze
|
45
45
|
|
46
46
|
##
|
47
47
|
# The name of the field.
|
@@ -72,10 +72,10 @@ module Google
|
|
72
72
|
#
|
73
73
|
# @return [String] The field data type. Possible values include
|
74
74
|
# `STRING`, `BYTES`, `INTEGER`, `INT64` (same as `INTEGER`),
|
75
|
-
# `FLOAT`, `FLOAT64` (same as `FLOAT`), `NUMERIC`, `
|
76
|
-
# (same as `BOOLEAN`), `TIMESTAMP`, `DATE`,
|
77
|
-
# `RECORD` (where `RECORD` indicates that the
|
78
|
-
# nested schema) or `STRUCT` (same as `RECORD`).
|
75
|
+
# `FLOAT`, `FLOAT64` (same as `FLOAT`), `NUMERIC`, `BIGNUMERIC`,
|
76
|
+
# `BOOLEAN`, `BOOL` (same as `BOOLEAN`), `TIMESTAMP`, `DATE`,
|
77
|
+
# `TIME`, `DATETIME`, `RECORD` (where `RECORD` indicates that the
|
78
|
+
# field contains a nested schema) or `STRUCT` (same as `RECORD`).
|
79
79
|
#
|
80
80
|
def type
|
81
81
|
@gapi.type
|
@@ -86,10 +86,10 @@ module Google
|
|
86
86
|
#
|
87
87
|
# @param [String] new_type The data type. Possible values include
|
88
88
|
# `STRING`, `BYTES`, `INTEGER`, `INT64` (same as `INTEGER`),
|
89
|
-
# `FLOAT`, `FLOAT64` (same as `FLOAT`), `NUMERIC`, `
|
90
|
-
# (same as `BOOLEAN`), `TIMESTAMP`, `DATE`,
|
91
|
-
# `RECORD` (where `RECORD` indicates that the
|
92
|
-
# nested schema) or `STRUCT` (same as `RECORD`).
|
89
|
+
# `FLOAT`, `FLOAT64` (same as `FLOAT`), `NUMERIC`, `BIGNUMERIC`,
|
90
|
+
# `BOOLEAN`, `BOOL` (same as `BOOLEAN`), `TIMESTAMP`, `DATE`,
|
91
|
+
# `TIME`, `DATETIME`, `RECORD` (where `RECORD` indicates that the
|
92
|
+
# field contains a nested schema) or `STRUCT` (same as `RECORD`).
|
93
93
|
#
|
94
94
|
def type= new_type
|
95
95
|
@gapi.update! type: verify_type(new_type)
|
@@ -199,6 +199,15 @@ module Google
|
|
199
199
|
type == "NUMERIC"
|
200
200
|
end
|
201
201
|
|
202
|
+
##
|
203
|
+
# Checks if the type of the field is `BIGNUMERIC`.
|
204
|
+
#
|
205
|
+
# @return [Boolean] `true` when `BIGNUMERIC`, `false` otherwise.
|
206
|
+
#
|
207
|
+
def bignumeric?
|
208
|
+
type == "BIGNUMERIC"
|
209
|
+
end
|
210
|
+
|
202
211
|
##
|
203
212
|
# Checks if the type of the field is `BOOLEAN`.
|
204
213
|
#
|
@@ -299,6 +308,7 @@ module Google
|
|
299
308
|
# * `:INT64`
|
300
309
|
# * `:FLOAT64`
|
301
310
|
# * `:NUMERIC`
|
311
|
+
# * `:BIGNUMERIC`
|
302
312
|
# * `:STRING`
|
303
313
|
# * `:DATETIME`
|
304
314
|
# * `:DATE`
|
@@ -394,9 +404,18 @@ module Google
|
|
394
404
|
end
|
395
405
|
|
396
406
|
##
|
397
|
-
# Adds a numeric number field to the schema.
|
398
|
-
# fixed
|
399
|
-
# the
|
407
|
+
# Adds a numeric number field to the schema. `NUMERIC` is a decimal
|
408
|
+
# type with fixed precision and scale. Precision is the number of
|
409
|
+
# digits that the number contains. Scale is how many of these
|
410
|
+
# digits appear after the decimal point. It supports:
|
411
|
+
#
|
412
|
+
# Precision: 38
|
413
|
+
# Scale: 9
|
414
|
+
# Min: -9.9999999999999999999999999999999999999E+28
|
415
|
+
# Max: 9.9999999999999999999999999999999999999E+28
|
416
|
+
#
|
417
|
+
# This type can represent decimal fractions exactly, and is suitable
|
418
|
+
# for financial calculations.
|
400
419
|
#
|
401
420
|
# This can only be called on fields that are of type `RECORD`.
|
402
421
|
#
|
@@ -415,6 +434,37 @@ module Google
|
|
415
434
|
add_field name, :numeric, description: description, mode: mode
|
416
435
|
end
|
417
436
|
|
437
|
+
##
|
438
|
+
# Adds a bignumeric number field to the schema. `BIGNUMERIC` is a
|
439
|
+
# decimal type with fixed precision and scale. Precision is the
|
440
|
+
# number of digits that the number contains. Scale is how many of
|
441
|
+
# these digits appear after the decimal point. It supports:
|
442
|
+
#
|
443
|
+
# Precision: 76.76 (the 77th digit is partial)
|
444
|
+
# Scale: 38
|
445
|
+
# Min: -5.7896044618658097711785492504343953926634992332820282019728792003956564819968E+38
|
446
|
+
# Max: 5.7896044618658097711785492504343953926634992332820282019728792003956564819967E+38
|
447
|
+
#
|
448
|
+
# This type can represent decimal fractions exactly, and is suitable
|
449
|
+
# for financial calculations.
|
450
|
+
#
|
451
|
+
# This can only be called on fields that are of type `RECORD`.
|
452
|
+
#
|
453
|
+
# @param [String] name The field name. The name must contain only
|
454
|
+
# letters (a-z, A-Z), numbers (0-9), or underscores (_), and must
|
455
|
+
# start with a letter or underscore. The maximum length is 128
|
456
|
+
# characters.
|
457
|
+
# @param [String] description A description of the field.
|
458
|
+
# @param [Symbol] mode The field's mode. The possible values are
|
459
|
+
# `:nullable`, `:required`, and `:repeated`. The default value is
|
460
|
+
# `:nullable`.
|
461
|
+
#
|
462
|
+
def bignumeric name, description: nil, mode: :nullable
|
463
|
+
record_check!
|
464
|
+
|
465
|
+
add_field name, :bignumeric, description: description, mode: mode
|
466
|
+
end
|
467
|
+
|
418
468
|
##
|
419
469
|
# Adds a boolean field to the nested schema of a record field.
|
420
470
|
#
|