google-cloud-bigquery 1.27.0 → 1.32.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +58 -0
  3. data/CONTRIBUTING.md +3 -4
  4. data/LOGGING.md +1 -1
  5. data/OVERVIEW.md +15 -14
  6. data/lib/google/cloud/bigquery/convert.rb +72 -76
  7. data/lib/google/cloud/bigquery/copy_job.rb +1 -0
  8. data/lib/google/cloud/bigquery/data.rb +2 -2
  9. data/lib/google/cloud/bigquery/dataset.rb +181 -62
  10. data/lib/google/cloud/bigquery/dataset/access.rb +3 -3
  11. data/lib/google/cloud/bigquery/dataset/list.rb +2 -2
  12. data/lib/google/cloud/bigquery/external.rb +9 -2619
  13. data/lib/google/cloud/bigquery/external/bigtable_source.rb +230 -0
  14. data/lib/google/cloud/bigquery/external/bigtable_source/column.rb +404 -0
  15. data/lib/google/cloud/bigquery/external/bigtable_source/column_family.rb +945 -0
  16. data/lib/google/cloud/bigquery/external/csv_source.rb +481 -0
  17. data/lib/google/cloud/bigquery/external/data_source.rb +771 -0
  18. data/lib/google/cloud/bigquery/external/json_source.rb +170 -0
  19. data/lib/google/cloud/bigquery/external/parquet_source.rb +148 -0
  20. data/lib/google/cloud/bigquery/external/sheets_source.rb +166 -0
  21. data/lib/google/cloud/bigquery/extract_job.rb +4 -2
  22. data/lib/google/cloud/bigquery/job.rb +9 -3
  23. data/lib/google/cloud/bigquery/job/list.rb +4 -4
  24. data/lib/google/cloud/bigquery/load_job.rb +178 -19
  25. data/lib/google/cloud/bigquery/model/list.rb +2 -2
  26. data/lib/google/cloud/bigquery/policy.rb +2 -1
  27. data/lib/google/cloud/bigquery/project.rb +47 -43
  28. data/lib/google/cloud/bigquery/project/list.rb +2 -2
  29. data/lib/google/cloud/bigquery/query_job.rb +84 -62
  30. data/lib/google/cloud/bigquery/routine.rb +1 -4
  31. data/lib/google/cloud/bigquery/routine/list.rb +2 -2
  32. data/lib/google/cloud/bigquery/schema.rb +39 -3
  33. data/lib/google/cloud/bigquery/schema/field.rb +63 -13
  34. data/lib/google/cloud/bigquery/service.rb +11 -13
  35. data/lib/google/cloud/bigquery/standard_sql.rb +15 -3
  36. data/lib/google/cloud/bigquery/table.rb +312 -69
  37. data/lib/google/cloud/bigquery/table/async_inserter.rb +44 -17
  38. data/lib/google/cloud/bigquery/table/list.rb +2 -2
  39. data/lib/google/cloud/bigquery/version.rb +1 -1
  40. metadata +28 -14
@@ -121,12 +121,12 @@ module Google
121
121
  # puts project.name
122
122
  # end
123
123
  #
124
- def all request_limit: nil
124
+ def all request_limit: nil, &block
125
125
  request_limit = request_limit.to_i if request_limit
126
126
  return enum_for :all, request_limit: request_limit unless block_given?
127
127
  results = self
128
128
  loop do
129
- results.each { |r| yield r }
129
+ results.each(&block)
130
130
  if request_limit
131
131
  request_limit -= 1
132
132
  break if request_limit.negative?
@@ -514,7 +514,7 @@ module Google
514
514
  # Checks if the destination table will be time-partitioned. See
515
515
  # [Partitioned Tables](https://cloud.google.com/bigquery/docs/partitioned-tables).
516
516
  #
517
- # @return [Boolean, nil] `true` when the table will be time-partitioned,
517
+ # @return [Boolean] `true` when the table will be time-partitioned,
518
518
  # or `false` otherwise.
519
519
  #
520
520
  # @!group Attributes
@@ -589,10 +589,15 @@ module Google
589
589
  ###
590
590
  # Checks if the destination table will be clustered.
591
591
  #
592
+ # See {QueryJob::Updater#clustering_fields=}, {Table#clustering_fields} and
593
+ # {Table#clustering_fields=}.
594
+ #
592
595
  # @see https://cloud.google.com/bigquery/docs/clustered-tables
593
- # Introduction to Clustered Tables
596
+ # Introduction to clustered tables
597
+ # @see https://cloud.google.com/bigquery/docs/creating-clustered-tables
598
+ # Creating and using clustered tables
594
599
  #
595
- # @return [Boolean, nil] `true` when the table will be clustered,
600
+ # @return [Boolean] `true` when the table will be clustered,
596
601
  # or `false` otherwise.
597
602
  #
598
603
  # @!group Attributes
@@ -607,14 +612,16 @@ module Google
607
612
  # be first partitioned and subsequently clustered. The order of the
608
613
  # returned fields determines the sort order of the data.
609
614
  #
610
- # See {QueryJob::Updater#clustering_fields=}.
615
+ # BigQuery supports clustering for both partitioned and non-partitioned
616
+ # tables.
617
+ #
618
+ # See {QueryJob::Updater#clustering_fields=}, {Table#clustering_fields} and
619
+ # {Table#clustering_fields=}.
611
620
  #
612
- # @see https://cloud.google.com/bigquery/docs/partitioned-tables
613
- # Partitioned Tables
614
621
  # @see https://cloud.google.com/bigquery/docs/clustered-tables
615
- # Introduction to Clustered Tables
622
+ # Introduction to clustered tables
616
623
  # @see https://cloud.google.com/bigquery/docs/creating-clustered-tables
617
- # Creating and Using Clustered Tables
624
+ # Creating and using clustered tables
618
625
  #
619
626
  # @return [Array<String>, nil] The clustering fields, or `nil` if the
620
627
  # destination table will not be clustered.
@@ -692,8 +699,11 @@ module Google
692
699
  end
693
700
  ensure_schema!
694
701
 
695
- options = { token: token, max: max, start: start }
696
- data_hash = service.list_tabledata destination_table_dataset_id, destination_table_table_id, options
702
+ data_hash = service.list_tabledata destination_table_dataset_id,
703
+ destination_table_table_id,
704
+ token: token,
705
+ max: max,
706
+ start: start
697
707
  Data.from_gapi_json data_hash, destination_table_gapi, @gapi, service
698
708
  end
699
709
  alias query_results data
@@ -704,12 +714,11 @@ module Google
704
714
  ##
705
715
  # @private Create an Updater object.
706
716
  def initialize service, gapi
717
+ super()
707
718
  @service = service
708
719
  @gapi = gapi
709
720
  end
710
721
 
711
- # rubocop:disable all
712
-
713
722
  ##
714
723
  # @private Create an Updater from an options hash.
715
724
  #
@@ -748,8 +757,6 @@ module Google
748
757
  updater
749
758
  end
750
759
 
751
- # rubocop:enable all
752
-
753
760
  ##
754
761
  # Sets the geographic location where the job should run. Required
755
762
  # except for US and EU.
@@ -853,20 +860,21 @@ module Google
853
860
  #
854
861
  # Ruby types are mapped to BigQuery types as follows:
855
862
  #
856
- # | BigQuery | Ruby | Notes |
857
- # |-------------|--------------------------------------|------------------------------------------------|
858
- # | `BOOL` | `true`/`false` | |
859
- # | `INT64` | `Integer` | |
860
- # | `FLOAT64` | `Float` | |
861
- # | `NUMERIC` | `BigDecimal` | Will be rounded to 9 decimal places |
862
- # | `STRING` | `String` | |
863
- # | `DATETIME` | `DateTime` | `DATETIME` does not support time zone. |
864
- # | `DATE` | `Date` | |
865
- # | `TIMESTAMP` | `Time` | |
866
- # | `TIME` | `Google::Cloud::BigQuery::Time` | |
867
- # | `BYTES` | `File`, `IO`, `StringIO`, or similar | |
868
- # | `ARRAY` | `Array` | Nested arrays, `nil` values are not supported. |
869
- # | `STRUCT` | `Hash` | Hash keys may be strings or symbols. |
863
+ # | BigQuery | Ruby | Notes |
864
+ # |--------------|--------------------------------------|--------------------------------------------------|
865
+ # | `BOOL` | `true`/`false` | |
866
+ # | `INT64` | `Integer` | |
867
+ # | `FLOAT64` | `Float` | |
868
+ # | `NUMERIC` | `BigDecimal` | `BigDecimal` values will be rounded to scale 9. |
869
+ # | `BIGNUMERIC` | | Query param values must be mapped in `types`. |
870
+ # | `STRING` | `String` | |
871
+ # | `DATETIME` | `DateTime` | `DATETIME` does not support time zone. |
872
+ # | `DATE` | `Date` | |
873
+ # | `TIMESTAMP` | `Time` | |
874
+ # | `TIME` | `Google::Cloud::BigQuery::Time` | |
875
+ # | `BYTES` | `File`, `IO`, `StringIO`, or similar | |
876
+ # | `ARRAY` | `Array` | Nested arrays, `nil` values are not supported. |
877
+ # | `STRUCT` | `Hash` | Hash keys may be strings or symbols. |
870
878
  #
871
879
  # See [Data Types](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types) for an overview
872
880
  # of each BigQuery data type, including allowed values.
@@ -887,35 +895,37 @@ module Google
887
895
  #
888
896
  # Ruby types are mapped to BigQuery types as follows:
889
897
  #
890
- # | BigQuery | Ruby | Notes |
891
- # |-------------|--------------------------------------|------------------------------------------------|
892
- # | `BOOL` | `true`/`false` | |
893
- # | `INT64` | `Integer` | |
894
- # | `FLOAT64` | `Float` | |
895
- # | `NUMERIC` | `BigDecimal` | Will be rounded to 9 decimal places |
896
- # | `STRING` | `String` | |
897
- # | `DATETIME` | `DateTime` | `DATETIME` does not support time zone. |
898
- # | `DATE` | `Date` | |
899
- # | `TIMESTAMP` | `Time` | |
900
- # | `TIME` | `Google::Cloud::BigQuery::Time` | |
901
- # | `BYTES` | `File`, `IO`, `StringIO`, or similar | |
902
- # | `ARRAY` | `Array` | Nested arrays, `nil` values are not supported. |
903
- # | `STRUCT` | `Hash` | Hash keys may be strings or symbols. |
898
+ # | BigQuery | Ruby | Notes |
899
+ # |--------------|--------------------------------------|--------------------------------------------------|
900
+ # | `BOOL` | `true`/`false` | |
901
+ # | `INT64` | `Integer` | |
902
+ # | `FLOAT64` | `Float` | |
903
+ # | `NUMERIC` | `BigDecimal` | `BigDecimal` values will be rounded to scale 9. |
904
+ # | `BIGNUMERIC` | | Query param values must be mapped in `types`. |
905
+ # | `STRING` | `String` | |
906
+ # | `DATETIME` | `DateTime` | `DATETIME` does not support time zone. |
907
+ # | `DATE` | `Date` | |
908
+ # | `TIMESTAMP` | `Time` | |
909
+ # | `TIME` | `Google::Cloud::BigQuery::Time` | |
910
+ # | `BYTES` | `File`, `IO`, `StringIO`, or similar | |
911
+ # | `ARRAY` | `Array` | Nested arrays, `nil` values are not supported. |
912
+ # | `STRUCT` | `Hash` | Hash keys may be strings or symbols. |
904
913
  #
905
914
  # See [Data Types](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types) for an overview
906
915
  # 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 to
908
- # infer the right SQL type from a value in `params`. In these cases, `types` must be used to specify the SQL
909
- # type for these values.
916
+ # @param [Array, Hash] types Standard SQL only. Types of the SQL parameters in `params`. It is not always
917
+ # possible to infer the right SQL type from a value in `params`. In these cases, `types` must be used to
918
+ # specify the SQL type for these values.
910
919
  #
911
- # Must match the value type passed to `params`. This must be an `Array` when the query uses positional query
912
- # parameters. This must be an `Hash` when the query uses named query parameters. The values should be
913
- # BigQuery type codes from the following list:
920
+ # Arguments must match the value type passed to `params`. This must be an `Array` when the query uses
921
+ # positional query parameters. This must be an `Hash` when the query uses named query parameters. The values
922
+ # should be BigQuery type codes from the following list:
914
923
  #
915
924
  # * `:BOOL`
916
925
  # * `:INT64`
917
926
  # * `:FLOAT64`
918
927
  # * `:NUMERIC`
928
+ # * `:BIGNUMERIC`
919
929
  # * `:STRING`
920
930
  # * `:DATETIME`
921
931
  # * `:DATE`
@@ -935,13 +945,13 @@ module Google
935
945
  raise ArgumentError, "types must use the same format as params" if types.class != params.class
936
946
 
937
947
  case params
938
- when Array then
948
+ when Array
939
949
  @gapi.configuration.query.use_legacy_sql = false
940
950
  @gapi.configuration.query.parameter_mode = "POSITIONAL"
941
951
  @gapi.configuration.query.query_parameters = params.zip(types).map do |param, type|
942
952
  Convert.to_query_param param, type
943
953
  end
944
- when Hash then
954
+ when Hash
945
955
  @gapi.configuration.query.use_legacy_sql = false
946
956
  @gapi.configuration.query.parameter_mode = "NAMED"
947
957
  @gapi.configuration.query.query_parameters = params.map do |name, param|
@@ -1442,23 +1452,23 @@ module Google
1442
1452
  end
1443
1453
 
1444
1454
  ##
1445
- # Sets one or more fields on which the destination table should be
1446
- # clustered. Must be specified with time-based partitioning, data in
1447
- # the table will be first partitioned and subsequently clustered.
1455
+ # Sets the list of fields on which data should be clustered.
1448
1456
  #
1449
1457
  # Only top-level, non-repeated, simple-type fields are supported. When
1450
1458
  # you cluster a table using multiple columns, the order of columns you
1451
1459
  # specify is important. The order of the specified columns determines
1452
1460
  # the sort order of the data.
1453
1461
  #
1454
- # See {QueryJob#clustering_fields}.
1462
+ # BigQuery supports clustering for both partitioned and non-partitioned
1463
+ # tables.
1464
+ #
1465
+ # See {QueryJob#clustering_fields}, {Table#clustering_fields} and
1466
+ # {Table#clustering_fields=}.
1455
1467
  #
1456
- # @see https://cloud.google.com/bigquery/docs/partitioned-tables
1457
- # Partitioned Tables
1458
1468
  # @see https://cloud.google.com/bigquery/docs/clustered-tables
1459
- # Introduction to Clustered Tables
1469
+ # Introduction to clustered tables
1460
1470
  # @see https://cloud.google.com/bigquery/docs/creating-clustered-tables
1461
- # Creating and Using Clustered Tables
1471
+ # Creating and using clustered tables
1462
1472
  #
1463
1473
  # @param [Array<String>] fields The clustering fields. Only top-level,
1464
1474
  # non-repeated, simple-type fields are supported.
@@ -1592,9 +1602,20 @@ module Google
1592
1602
  # end
1593
1603
  #
1594
1604
  class Stage
1595
- attr_reader :compute_ratio_avg, :compute_ratio_max, :id, :name, :read_ratio_avg, :read_ratio_max,
1596
- :records_read, :records_written, :status, :steps, :wait_ratio_avg, :wait_ratio_max,
1597
- :write_ratio_avg, :write_ratio_max
1605
+ attr_reader :compute_ratio_avg
1606
+ attr_reader :compute_ratio_max
1607
+ attr_reader :id
1608
+ attr_reader :name
1609
+ attr_reader :read_ratio_avg
1610
+ attr_reader :read_ratio_max
1611
+ attr_reader :records_read
1612
+ attr_reader :records_written
1613
+ attr_reader :status
1614
+ attr_reader :steps
1615
+ attr_reader :wait_ratio_avg
1616
+ attr_reader :wait_ratio_max
1617
+ attr_reader :write_ratio_avg
1618
+ attr_reader :write_ratio_max
1598
1619
 
1599
1620
  ##
1600
1621
  # @private Creates a new Stage instance.
@@ -1657,7 +1678,8 @@ module Google
1657
1678
  # end
1658
1679
  #
1659
1680
  class Step
1660
- attr_reader :kind, :substeps
1681
+ attr_reader :kind
1682
+ attr_reader :substeps
1661
1683
 
1662
1684
  ##
1663
1685
  # @private Creates a new Stage instance.
@@ -1006,6 +1006,7 @@ module Google
1006
1006
  ##
1007
1007
  # @private Create an Updater object.
1008
1008
  def initialize gapi
1009
+ super()
1009
1010
  @original_gapi = gapi
1010
1011
  @gapi = gapi.dup
1011
1012
  end
@@ -1210,15 +1211,11 @@ module Google
1210
1211
  end
1211
1212
  alias refresh! reload!
1212
1213
 
1213
- # rubocop:disable Style/CaseEquality
1214
-
1215
1214
  # @private
1216
1215
  def updates?
1217
1216
  !(@gapi === @original_gapi)
1218
1217
  end
1219
1218
 
1220
- # rubocop:enable Style/CaseEquality
1221
-
1222
1219
  # @private
1223
1220
  def to_gapi
1224
1221
  @gapi
@@ -124,12 +124,12 @@ module Google
124
124
  # puts routine.routine_id
125
125
  # end
126
126
  #
127
- def all request_limit: nil
127
+ def all request_limit: nil, &block
128
128
  request_limit = request_limit.to_i if request_limit
129
129
  return enum_for :all, request_limit: request_limit unless block_given?
130
130
  results = self
131
131
  loop do
132
- results.each { |r| yield r }
132
+ results.each(&block)
133
133
  if request_limit
134
134
  request_limit -= 1
135
135
  break if request_limit.negative?
@@ -332,9 +332,18 @@ module Google
332
332
  end
333
333
 
334
334
  ##
335
- # Adds a numeric number field to the schema. Numeric is a
336
- # fixed-precision numeric type with 38 decimal digits, 9 that follow the
337
- # decimal point.
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", "BOOLEAN", "BOOL", "BYTES", "TIMESTAMP",
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`, `BOOLEAN`, `BOOL`
76
- # (same as `BOOLEAN`), `TIMESTAMP`, `DATE`, `TIME`, `DATETIME`,
77
- # `RECORD` (where `RECORD` indicates that the field contains a
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`, `BOOLEAN`, `BOOL`
90
- # (same as `BOOLEAN`), `TIMESTAMP`, `DATE`, `TIME`, `DATETIME`,
91
- # `RECORD` (where `RECORD` indicates that the field contains a
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. Numeric is a
398
- # fixed-precision numeric type with 38 decimal digits, 9 that follow
399
- # the decimal point.
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
  #