Class: Google::Cloud::Bigquery::External::BigtableSource::Column
- Inherits:
-
Object
- Object
- Google::Cloud::Bigquery::External::BigtableSource::Column
- Defined in:
- lib/google/cloud/bigquery/external/bigtable_source/column.rb,
lib/google/cloud/bigquery/external/bigtable_source/column_family.rb
Overview
BigtableSource::Column
A Bigtable column to expose in the table schema along with its types.
Instance Method Summary collapse
-
#encoding ⇒ String
The encoding of the values when the type is not
STRING
. -
#encoding=(new_encoding) ⇒ Object
Set the encoding of the values when the type is not
STRING
. -
#field_name ⇒ String
If the qualifier is not a valid BigQuery field identifier (does not match
[a-zA-Z][a-zA-Z0-9_]*
) a valid identifier must be provided as the column field name and is used as field name in queries. -
#field_name=(new_field_name) ⇒ Object
Sets the identifier to be used as the column field name in queries when the qualifier is not a valid BigQuery field identifier (does not match
[a-zA-Z][a-zA-Z0-9_]*
). -
#latest ⇒ Boolean
Whether only the latest version of value in this column are exposed.
-
#latest=(new_latest) ⇒ Object
Set whether only the latest version of value in this column are exposed.
-
#qualifier ⇒ String
Qualifier of the column.
-
#qualifier=(new_qualifier) ⇒ Object
Set the qualifier of the column.
-
#type ⇒ String
The type to convert the value in cells of this column.
-
#type=(new_type) ⇒ Object
Set the type to convert the value in cells of this column.
Instance Method Details
#encoding ⇒ String
The encoding of the values when the type is not STRING
.
160 161 162 |
# File 'lib/google/cloud/bigquery/external/bigtable_source/column.rb', line 160 def encoding @gapi.encoding end |
#encoding=(new_encoding) ⇒ Object
Set the encoding of the values when the type is not STRING
.
Acceptable encoding values are:
TEXT
- indicates values are alphanumeric text strings.BINARY
- indicates values are encoded using HBaseBytes.toBytes
family of functions. This can be overridden on a column.
190 191 192 193 |
# File 'lib/google/cloud/bigquery/external/bigtable_source/column.rb', line 190 def encoding= new_encoding frozen_check! @gapi.encoding = new_encoding end |
#field_name ⇒ String
If the qualifier is not a valid BigQuery field identifier (does
not match [a-zA-Z][a-zA-Z0-9_]*
) a valid identifier must be
provided as the column field name and is used as field name in
queries.
219 220 221 |
# File 'lib/google/cloud/bigquery/external/bigtable_source/column.rb', line 219 def field_name @gapi.field_name end |
#field_name=(new_field_name) ⇒ Object
Sets the identifier to be used as the column field name in queries
when the qualifier is not a valid BigQuery field identifier (does
not match [a-zA-Z][a-zA-Z0-9_]*
).
246 247 248 249 |
# File 'lib/google/cloud/bigquery/external/bigtable_source/column.rb', line 246 def field_name= new_field_name frozen_check! @gapi.field_name = new_field_name end |
#latest ⇒ Boolean
Whether only the latest version of value in this column are exposed. Can also be set at the column family level. However, this value takes precedence when set at both levels.
273 274 275 |
# File 'lib/google/cloud/bigquery/external/bigtable_source/column.rb', line 273 def latest @gapi.only_read_latest end |
#latest=(new_latest) ⇒ Object
Set whether only the latest version of value in this column are exposed. Can also be set at the column family level. However, this value takes precedence when set at both levels.
299 300 301 302 |
# File 'lib/google/cloud/bigquery/external/bigtable_source/column.rb', line 299 def latest= new_latest frozen_check! @gapi.only_read_latest = new_latest end |
#qualifier ⇒ String
Qualifier of the column. Columns in the parent column family that
has this exact qualifier are exposed as .
field. If the
qualifier is valid UTF-8 string, it will be represented as a UTF-8
string. Otherwise, it will represented as a ASCII-8BIT string.
If the qualifier is not a valid BigQuery field identifier (does
not match [a-zA-Z][a-zA-Z0-9_]*
) a valid identifier must be
provided as field_name
.
91 92 93 |
# File 'lib/google/cloud/bigquery/external/bigtable_source/column.rb', line 91 def qualifier @gapi.qualifier_string || Base64.strict_decode64(@gapi.qualifier_encoded.to_s) end |
#qualifier=(new_qualifier) ⇒ Object
Set the qualifier of the column. Columns in the parent column
family that has this exact qualifier are exposed as .
field.
Values that are valid UTF-8 strings will be treated as such. All
other values will be treated as BINARY
.
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/google/cloud/bigquery/external/bigtable_source/column.rb', line 119 def qualifier= new_qualifier frozen_check! raise ArgumentError if new_qualifier.nil? utf8_qualifier = new_qualifier.encode Encoding::UTF_8 if utf8_qualifier.valid_encoding? @gapi.qualifier_string = utf8_qualifier if @gapi.instance_variables.include? :@qualifier_encoded @gapi.remove_instance_variable :@qualifier_encoded end else @gapi.qualifier_encoded = Base64.strict_encode64 new_qualifier if @gapi.instance_variables.include? :@qualifier_string @gapi.remove_instance_variable :@qualifier_string end end rescue EncodingError @gapi.qualifier_encoded = Base64.strict_encode64 new_qualifier @gapi.remove_instance_variable :@qualifier_string if @gapi.instance_variables.include? :@qualifier_string end |
#type ⇒ String
The type to convert the value in cells of this column. The values
are expected to be encoded using HBase Bytes.toBytes
function
when using the BINARY
encoding value. The following BigQuery
types are allowed:
BYTES
STRING
INTEGER
FLOAT
BOOLEAN
Default type is BYTES
. Can also be set at the column family
level. However, this value takes precedence when set at both
levels.
336 337 338 |
# File 'lib/google/cloud/bigquery/external/bigtable_source/column.rb', line 336 def type @gapi.type end |
#type=(new_type) ⇒ Object
Set the type to convert the value in cells of this column. The
values are expected to be encoded using HBase Bytes.toBytes
function when using the BINARY
encoding value. The following
BigQuery types are allowed:
BYTES
STRING
INTEGER
FLOAT
BOOLEAN
Default type is BYTES
. Can also be set at the column family
level. However, this value takes precedence when set at both
levels.
374 375 376 377 |
# File 'lib/google/cloud/bigquery/external/bigtable_source/column.rb', line 374 def type= new_type frozen_check! @gapi.type = new_type end |