google-cloud-bigquery 1.26.0 → 1.27.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 +12 -0
- data/lib/google/cloud/bigquery/job.rb +35 -1
- data/lib/google/cloud/bigquery/routine.rb +127 -5
- data/lib/google/cloud/bigquery/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 334d37be375f513da083f7338e1324413409a6c30554456c08290ed1337c2701
|
4
|
+
data.tar.gz: f21c7793b5a9f82d0c3840aa5915fd10ef43644ccc1d9ea996a63860fa8b16ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 187d0549552613c40f85001fdf82197db01af5b5e285dfd6f7615a64c62ed74807c0ea31ac560d2a1516dae0c91f14fcc08b143882fcf8437b8d7c964f256348
|
7
|
+
data.tar.gz: e6b80ed9ccff8ffb2f8537a009a6d41a7930ee080f50800001b0afa9f7706a85af58180d091051f34a2499d66ca15f5c084a74cbbff244d8c22d266fc62713db
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Release History
|
2
2
|
|
3
|
+
### 1.27.0 / 2021-02-10
|
4
|
+
|
5
|
+
#### Features
|
6
|
+
|
7
|
+
* Add Job#reservation_usage
|
8
|
+
* Add Routine#determinism_level
|
9
|
+
* Add Routine#determinism_level
|
10
|
+
* Add Routine#determinism_level=
|
11
|
+
* Add Routine#determinism_level_deterministic?
|
12
|
+
* Add Routine#determinism_level_not_deterministic?
|
13
|
+
* Add Routine::Updater#determinism_level=
|
14
|
+
|
3
15
|
### 1.26.0 / 2021-01-13
|
4
16
|
|
5
17
|
#### Features
|
@@ -215,6 +215,17 @@ module Google
|
|
215
215
|
@gapi.statistics.parent_job_id
|
216
216
|
end
|
217
217
|
|
218
|
+
##
|
219
|
+
# An array containing the job resource usage breakdown by reservation, if present. Reservation usage statistics
|
220
|
+
# are only reported for jobs that are executed within reservations. On-demand jobs do not report this data.
|
221
|
+
#
|
222
|
+
# @return [Array<Google::Cloud::Bigquery::Job::ReservationUsage>, nil] The reservation usage, if present.
|
223
|
+
#
|
224
|
+
def reservation_usage
|
225
|
+
return nil unless @gapi.statistics.reservation_usage
|
226
|
+
Array(@gapi.statistics.reservation_usage).map { |g| ReservationUsage.from_gapi g }
|
227
|
+
end
|
228
|
+
|
218
229
|
##
|
219
230
|
# The statistics including stack frames for a child job of a script.
|
220
231
|
#
|
@@ -489,6 +500,29 @@ module Google
|
|
489
500
|
end
|
490
501
|
end
|
491
502
|
|
503
|
+
##
|
504
|
+
# Represents Job resource usage breakdown by reservation.
|
505
|
+
#
|
506
|
+
# @attr_reader [String] name The reservation name or "unreserved" for on-demand resources usage.
|
507
|
+
# @attr_reader [Fixnum] slot_ms The slot-milliseconds the job spent in the given reservation.
|
508
|
+
#
|
509
|
+
class ReservationUsage
|
510
|
+
attr_reader :name, :slot_ms
|
511
|
+
|
512
|
+
##
|
513
|
+
# @private Creates a new ReservationUsage instance.
|
514
|
+
def initialize name, slot_ms
|
515
|
+
@name = name
|
516
|
+
@slot_ms = slot_ms
|
517
|
+
end
|
518
|
+
|
519
|
+
##
|
520
|
+
# @private New ReservationUsage from a statistics.reservation_usage value.
|
521
|
+
def self.from_gapi gapi
|
522
|
+
new gapi.name, gapi.slot_ms
|
523
|
+
end
|
524
|
+
end
|
525
|
+
|
492
526
|
##
|
493
527
|
# Represents statistics for a child job of a script.
|
494
528
|
#
|
@@ -547,7 +581,7 @@ module Google
|
|
547
581
|
end
|
548
582
|
|
549
583
|
##
|
550
|
-
# @private New ScriptStatistics from a statistics.script_statistics
|
584
|
+
# @private New ScriptStatistics from a statistics.script_statistics value.
|
551
585
|
def self.from_gapi gapi
|
552
586
|
frames = Array(gapi.stack_frames).map { |g| ScriptStackFrame.from_gapi g }
|
553
587
|
new gapi.evaluation_kind, frames
|
@@ -603,6 +603,93 @@ module Google
|
|
603
603
|
update_gapi!
|
604
604
|
end
|
605
605
|
|
606
|
+
###
|
607
|
+
# The JavaScript UDF determinism level. Optional.
|
608
|
+
#
|
609
|
+
# * `DETERMINISTIC` - Deterministic indicates that two calls with the same input to a UDF yield the same output.
|
610
|
+
# If all JavaScript UDFs are `DETERMINISTIC`, the query result is potentially cachable.
|
611
|
+
# * `NOT_DETERMINISTIC` - Not deterministic indicates that the output of the UDF is not guaranteed to yield the
|
612
|
+
# same output each time for a given set of inputs. If any JavaScript UDF is `NOT_DETERMINISTIC`, the query
|
613
|
+
# result is not cacheable.
|
614
|
+
#
|
615
|
+
# Even if a JavaScript UDF is deterministic, many other factors can prevent usage of cached query results.
|
616
|
+
# Example factors include but not limited to: DDL/DML, non-deterministic SQL function calls, update of
|
617
|
+
# referenced tables/views/UDFs or imported JavaScript libraries. SQL UDFs cannot have determinism specified.
|
618
|
+
# Their determinism is automatically determined.
|
619
|
+
#
|
620
|
+
# @return [String, nil] The routine determinism level in upper case, or `nil` if not set or the object is a
|
621
|
+
# reference (see {#reference?}).
|
622
|
+
#
|
623
|
+
# @example
|
624
|
+
# require "google/cloud/bigquery"
|
625
|
+
#
|
626
|
+
# bigquery = Google::Cloud::Bigquery.new
|
627
|
+
# dataset = bigquery.dataset "my_dataset"
|
628
|
+
# routine = dataset.routine "my_routine"
|
629
|
+
#
|
630
|
+
# routine.determinism_level #=> "NOT_DETERMINISTIC"
|
631
|
+
#
|
632
|
+
# @!group Attributes
|
633
|
+
#
|
634
|
+
def determinism_level
|
635
|
+
return nil if reference?
|
636
|
+
ensure_full_data!
|
637
|
+
@gapi.determinism_level
|
638
|
+
end
|
639
|
+
|
640
|
+
##
|
641
|
+
# Updates the JavaScript UDF determinism level. Optional.
|
642
|
+
#
|
643
|
+
# * `DETERMINISTIC` - Deterministic indicates that two calls with the same input to a UDF yield the same output.
|
644
|
+
# If all JavaScript UDFs are `DETERMINISTIC`, the query result is potentially cachable.
|
645
|
+
# * `NOT_DETERMINISTIC` - Not deterministic indicates that the output of the UDF is not guaranteed to yield the
|
646
|
+
# same output each time for a given set of inputs. If any JavaScript UDF is `NOT_DETERMINISTIC`, the query
|
647
|
+
# result is not cacheable.
|
648
|
+
#
|
649
|
+
# @param [String, nil] new_determinism_level The new routine determinism level in upper case.
|
650
|
+
#
|
651
|
+
# @example
|
652
|
+
# require "google/cloud/bigquery"
|
653
|
+
#
|
654
|
+
# bigquery = Google::Cloud::Bigquery.new
|
655
|
+
# dataset = bigquery.dataset "my_dataset"
|
656
|
+
# routine = dataset.routine "my_routine"
|
657
|
+
#
|
658
|
+
# routine.determinism_level #=> "NOT_DETERMINISTIC"
|
659
|
+
# routine.determinism_level = "DETERMINISTIC"
|
660
|
+
#
|
661
|
+
# @!group Attributes
|
662
|
+
#
|
663
|
+
def determinism_level= new_determinism_level
|
664
|
+
ensure_full_data!
|
665
|
+
@gapi.determinism_level = new_determinism_level
|
666
|
+
update_gapi!
|
667
|
+
end
|
668
|
+
|
669
|
+
##
|
670
|
+
# Checks if the value of {#determinism_level} is `DETERMINISTIC`. The default is `false`.
|
671
|
+
#
|
672
|
+
# @return [Boolean] `true` when `DETERMINISTIC` and the object is not a reference (see {#reference?}), `false`
|
673
|
+
# otherwise.
|
674
|
+
#
|
675
|
+
# @!group Attributes
|
676
|
+
#
|
677
|
+
def determinism_level_deterministic?
|
678
|
+
@gapi.determinism_level == "DETERMINISTIC"
|
679
|
+
end
|
680
|
+
|
681
|
+
##
|
682
|
+
# Checks if the value of {#determinism_level} is `NOT_DETERMINISTIC`. The default is `false`.
|
683
|
+
#
|
684
|
+
# @return [Boolean] `true` when `NOT_DETERMINISTIC` and the object is not a reference (see {#reference?}),
|
685
|
+
# `false` otherwise.
|
686
|
+
#
|
687
|
+
# @!group Attributes
|
688
|
+
#
|
689
|
+
def determinism_level_not_deterministic?
|
690
|
+
@gapi.determinism_level == "NOT_DETERMINISTIC"
|
691
|
+
end
|
692
|
+
|
606
693
|
##
|
607
694
|
# Updates the routine with changes made in the given block in a single update request. The following attributes
|
608
695
|
# may be set: {Updater#routine_type=}, {Updater#language=}, {Updater#arguments=}, {Updater#return_type=},
|
@@ -999,7 +1086,9 @@ module Google
|
|
999
1086
|
# routine = dataset.routine "my_routine"
|
1000
1087
|
#
|
1001
1088
|
# routine.return_type.type_kind #=> "INT64"
|
1002
|
-
# routine.
|
1089
|
+
# routine.update do |r|
|
1090
|
+
# r.return_type = "STRING"
|
1091
|
+
# end
|
1003
1092
|
#
|
1004
1093
|
def return_type= new_return_type
|
1005
1094
|
@gapi.return_type = StandardSql::DataType.gapi_from_string_or_data_type new_return_type
|
@@ -1019,9 +1108,11 @@ module Google
|
|
1019
1108
|
# dataset = bigquery.dataset "my_dataset"
|
1020
1109
|
# routine = dataset.routine "my_routine"
|
1021
1110
|
#
|
1022
|
-
# routine.
|
1023
|
-
#
|
1024
|
-
#
|
1111
|
+
# routine.update do |r|
|
1112
|
+
# r.imported_libraries = [
|
1113
|
+
# "gs://cloud-samples-data/bigquery/udfs/max-value.js"
|
1114
|
+
# ]
|
1115
|
+
# end
|
1025
1116
|
#
|
1026
1117
|
def imported_libraries= new_imported_libraries
|
1027
1118
|
@gapi.imported_libraries = new_imported_libraries
|
@@ -1069,12 +1160,43 @@ module Google
|
|
1069
1160
|
# routine = dataset.routine "my_routine"
|
1070
1161
|
#
|
1071
1162
|
# routine.description #=> "My routine description"
|
1072
|
-
# routine.
|
1163
|
+
# routine.update do |r|
|
1164
|
+
# r.description = "My updated routine description"
|
1165
|
+
# end
|
1073
1166
|
#
|
1074
1167
|
def description= new_description
|
1075
1168
|
@gapi.description = new_description
|
1076
1169
|
end
|
1077
1170
|
|
1171
|
+
##
|
1172
|
+
# Updates the JavaScript UDF determinism level. Optional.
|
1173
|
+
#
|
1174
|
+
# * `DETERMINISTIC` - Deterministic indicates that two calls with the same input to a UDF yield the same
|
1175
|
+
# output. If all JavaScript UDFs are `DETERMINISTIC`, the query result is potentially cachable.
|
1176
|
+
# * `NOT_DETERMINISTIC` - Not deterministic indicates that the output of the UDF is not guaranteed to yield
|
1177
|
+
# the same output each time for a given set of inputs. If any JavaScript UDF is `NOT_DETERMINISTIC`, the
|
1178
|
+
# query result is not cacheable.
|
1179
|
+
#
|
1180
|
+
# @param [String, nil] new_determinism_level The new routine determinism level in upper case.
|
1181
|
+
#
|
1182
|
+
# @example
|
1183
|
+
# require "google/cloud/bigquery"
|
1184
|
+
#
|
1185
|
+
# bigquery = Google::Cloud::Bigquery.new
|
1186
|
+
# dataset = bigquery.dataset "my_dataset"
|
1187
|
+
# routine = dataset.routine "my_routine"
|
1188
|
+
#
|
1189
|
+
# routine.determinism_level #=> "NOT_DETERMINISTIC"
|
1190
|
+
# routine.update do |r|
|
1191
|
+
# r.determinism_level = "DETERMINISTIC"
|
1192
|
+
# end
|
1193
|
+
#
|
1194
|
+
# @!group Attributes
|
1195
|
+
#
|
1196
|
+
def determinism_level= new_determinism_level
|
1197
|
+
@gapi.determinism_level = new_determinism_level
|
1198
|
+
end
|
1199
|
+
|
1078
1200
|
def update
|
1079
1201
|
raise "not implemented in #{self.class}"
|
1080
1202
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-bigquery
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.27.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Moore
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-
|
12
|
+
date: 2021-02-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: concurrent-ruby
|
@@ -291,7 +291,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
291
291
|
- !ruby/object:Gem::Version
|
292
292
|
version: '0'
|
293
293
|
requirements: []
|
294
|
-
rubygems_version: 3.
|
294
|
+
rubygems_version: 3.2.6
|
295
295
|
signing_key:
|
296
296
|
specification_version: 4
|
297
297
|
summary: API Client library for Google BigQuery
|