Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,9 @@ def read_rows request, options = nil
# which can be used to break up the data for distributed tasks like
# mapreduces.
#
# If a `row_range` is provided in the request, the returned samples will be
# restricted to the specified range.
#
# @overload sample_row_keys(request, options = nil)
# Pass arguments to `sample_row_keys` via a request object, either of type
# {::Google::Cloud::Bigtable::V2::SampleRowKeysRequest} or an equivalent Hash.
Expand All @@ -371,7 +374,7 @@ def read_rows request, options = nil
# @param options [::Gapic::CallOptions, ::Hash]
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
#
# @overload sample_row_keys(table_name: nil, authorized_view_name: nil, materialized_view_name: nil, app_profile_id: nil)
# @overload sample_row_keys(table_name: nil, authorized_view_name: nil, materialized_view_name: nil, app_profile_id: nil, row_range: nil)
# Pass arguments to `sample_row_keys` via keyword arguments. Note that at
# least one keyword argument is required. To specify no parameters, or to keep all
# the default parameter values, pass an empty Hash as a request object (see above).
Expand All @@ -395,6 +398,11 @@ def read_rows request, options = nil
# @param app_profile_id [::String]
# This value specifies routing for replication. If not specified, the
# "default" application profile will be used.
# @param row_range [::Google::Cloud::Bigtable::V2::RowRange, ::Hash]
# Optional. The row range to sample. If not specified, samples
# from all rows.
# The output will always return the end key in the range as the last sample
# returned.
#
# @yield [response, operation] Access the result along with the RPC operation
# @yieldparam response [::Enumerable<::Google::Cloud::Bigtable::V2::SampleRowKeysResponse>]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,12 @@ class CellChunk
# @return [::String]
# This value specifies routing for replication. If not specified, the
# "default" application profile will be used.
# @!attribute [rw] row_range
# @return [::Google::Cloud::Bigtable::V2::RowRange]
# Optional. The row range to sample. If not specified, samples
# from all rows.
# The output will always return the end key in the range as the last sample
# returned.
class SampleRowKeysRequest
include ::Google::Protobuf::MessageExts
extend ::Google::Protobuf::MessageExts::ClassMethods
Expand All @@ -219,17 +225,21 @@ class SampleRowKeysRequest
# Response message for Bigtable.SampleRowKeys.
# @!attribute [rw] row_key
# @return [::String]
# Sorted streamed sequence of sample row keys in the table. The table might
# have contents before the first row key in the list and after the last one,
# but a key containing the empty string indicates "end of table" and will be
# the last response given, if present.
# Sorted streamed sequence of sample row keys in the table, restricted to
# the row_range if specified in the request. The table might have contents
# before the first row key in the list and after the last one, but a key
# containing the empty string indicates "end of table" and will be the last
# response given, if present and within the row-range specified in the
# request.
# Note that row keys in this list may not have ever been written to or read
# from, and users should therefore not make any assumptions about the row key
# structure that are specific to their use case.
# @!attribute [rw] offset_bytes
# @return [::Integer]
# Approximate total storage space used by all rows in the table which precede
# `row_key`. Buffering the contents of all rows between two subsequent
# `row_key` (and if a row-range is specified in the request, which follow
# what would have been the previous sample before the row-range start).
# Buffering the contents of all rows between two subsequent
# samples would require space roughly equal to the difference in their
# `offset_bytes` fields.
class SampleRowKeysResponse
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ def test_sample_row_keys
authorized_view_name = "hello world"
materialized_view_name = "hello world"
app_profile_id = "hello world"
row_range = {}

sample_row_keys_client_stub = ClientStub.new [grpc_response].to_enum, grpc_operation do |name, request, options:|
assert_equal :sample_row_keys, name
Expand All @@ -172,6 +173,7 @@ def test_sample_row_keys
assert_equal "hello world", request["authorized_view_name"]
assert_equal "hello world", request["materialized_view_name"]
assert_equal "hello world", request["app_profile_id"]
assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Cloud::Bigtable::V2::RowRange), request["row_range"]
refute_nil options
end

Expand All @@ -182,7 +184,7 @@ def test_sample_row_keys
end

# Use hash object
client.sample_row_keys({ table_name: table_name, authorized_view_name: authorized_view_name, materialized_view_name: materialized_view_name, app_profile_id: app_profile_id }) do |response, operation|
client.sample_row_keys({ table_name: table_name, authorized_view_name: authorized_view_name, materialized_view_name: materialized_view_name, app_profile_id: app_profile_id, row_range: row_range }) do |response, operation|
assert_kind_of Enumerable, response
response.to_a.each do |r|
assert_kind_of ::Google::Cloud::Bigtable::V2::SampleRowKeysResponse, r
Expand All @@ -191,7 +193,7 @@ def test_sample_row_keys
end

# Use named arguments
client.sample_row_keys table_name: table_name, authorized_view_name: authorized_view_name, materialized_view_name: materialized_view_name, app_profile_id: app_profile_id do |response, operation|
client.sample_row_keys table_name: table_name, authorized_view_name: authorized_view_name, materialized_view_name: materialized_view_name, app_profile_id: app_profile_id, row_range: row_range do |response, operation|
assert_kind_of Enumerable, response
response.to_a.each do |r|
assert_kind_of ::Google::Cloud::Bigtable::V2::SampleRowKeysResponse, r
Expand All @@ -200,7 +202,7 @@ def test_sample_row_keys
end

# Use protobuf object
client.sample_row_keys ::Google::Cloud::Bigtable::V2::SampleRowKeysRequest.new(table_name: table_name, authorized_view_name: authorized_view_name, materialized_view_name: materialized_view_name, app_profile_id: app_profile_id) do |response, operation|
client.sample_row_keys ::Google::Cloud::Bigtable::V2::SampleRowKeysRequest.new(table_name: table_name, authorized_view_name: authorized_view_name, materialized_view_name: materialized_view_name, app_profile_id: app_profile_id, row_range: row_range) do |response, operation|
assert_kind_of Enumerable, response
response.to_a.each do |r|
assert_kind_of ::Google::Cloud::Bigtable::V2::SampleRowKeysResponse, r
Expand All @@ -209,7 +211,7 @@ def test_sample_row_keys
end

# Use hash object with options
client.sample_row_keys({ table_name: table_name, authorized_view_name: authorized_view_name, materialized_view_name: materialized_view_name, app_profile_id: app_profile_id }, grpc_options) do |response, operation|
client.sample_row_keys({ table_name: table_name, authorized_view_name: authorized_view_name, materialized_view_name: materialized_view_name, app_profile_id: app_profile_id, row_range: row_range }, grpc_options) do |response, operation|
assert_kind_of Enumerable, response
response.to_a.each do |r|
assert_kind_of ::Google::Cloud::Bigtable::V2::SampleRowKeysResponse, r
Expand All @@ -218,7 +220,7 @@ def test_sample_row_keys
end

# Use protobuf object with options
client.sample_row_keys(::Google::Cloud::Bigtable::V2::SampleRowKeysRequest.new(table_name: table_name, authorized_view_name: authorized_view_name, materialized_view_name: materialized_view_name, app_profile_id: app_profile_id), grpc_options) do |response, operation|
client.sample_row_keys(::Google::Cloud::Bigtable::V2::SampleRowKeysRequest.new(table_name: table_name, authorized_view_name: authorized_view_name, materialized_view_name: materialized_view_name, app_profile_id: app_profile_id, row_range: row_range), grpc_options) do |response, operation|
assert_kind_of Enumerable, response
response.to_a.each do |r|
assert_kind_of ::Google::Cloud::Bigtable::V2::SampleRowKeysResponse, r
Expand Down
Loading