Reference documentation and code samples for the BigQuery API class Google::Cloud::Bigquery::StandardSql::DataType.
The type of a variable, e.g., a function argument. See Routine and Argument.
Inherits
- Object
Example
require "google/cloud/bigquery" bigquery = Google::Cloud::Bigquery.new dataset = bigquery.dataset "my_dataset" routine = dataset.create_routine "my_routine" do |r| r.routine_type = "SCALAR_FUNCTION" r.language = :SQL r.body = "(SELECT SUM(IF(elem.name = \"foo\",elem.val,null)) FROM UNNEST(arr) AS elem)" r.arguments = [ Google::Cloud::Bigquery::Argument.new( name: "arr", argument_kind: "FIXED_TYPE", data_type: Google::Cloud::Bigquery::StandardSql::DataType.new( type_kind: "ARRAY", array_element_type: Google::Cloud::Bigquery::StandardSql::DataType.new( type_kind: "STRUCT", struct_type: Google::Cloud::Bigquery::StandardSql::StructType.new( fields: [ Google::Cloud::Bigquery::StandardSql::Field.new( name: "name", type: Google::Cloud::Bigquery::StandardSql::DataType.new(type_kind: "STRING") ), Google::Cloud::Bigquery::StandardSql::Field.new( name: "val", type: Google::Cloud::Bigquery::StandardSql::DataType.new(type_kind: "INT64") ) ] ) ) ) ) ] end
Methods
#array?
def array?() -> BooleanChecks if the #type_kind of the field is ARRAY.
- 
        (Boolean) — truewhenARRAY,falseotherwise.
#array_element_type
def array_element_type() -> DataType, nilThe type of the array's elements, if #type_kind is ARRAY. See #array?. Optional.
- (DataType, nil)
#bignumeric?
def bignumeric?() -> BooleanChecks if the #type_kind of the field is BIGNUMERIC.
- 
        (Boolean) — truewhenBIGNUMERIC,falseotherwise.
#boolean?
def boolean?() -> BooleanChecks if the #type_kind of the field is BOOL.
- 
        (Boolean) — truewhenBOOL,falseotherwise.
#bytes?
def bytes?() -> BooleanChecks if the #type_kind of the field is BYTES.
- 
        (Boolean) — truewhenBYTES,falseotherwise.
#date?
def date?() -> BooleanChecks if the #type_kind of the field is DATE.
- 
        (Boolean) — truewhenDATE,falseotherwise.
#datetime?
def datetime?() -> BooleanChecks if the #type_kind of the field is DATETIME.
- 
        (Boolean) — truewhenDATETIME,falseotherwise.
#float?
def float?() -> BooleanChecks if the #type_kind of the field is FLOAT64.
- 
        (Boolean) — truewhenFLOAT64,falseotherwise.
#geography?
def geography?() -> BooleanChecks if the #type_kind of the field is GEOGRAPHY.
- 
        (Boolean) — truewhenGEOGRAPHY,falseotherwise.
#initialize
def initialize(type_kind, array_element_type, struct_type) -> DataTypeCreates a new, immutable StandardSql::DataType object.
def initialize(type_kind, array_element_type, struct_type) -> DataType- 
       type_kind (String) — The top level type of this field. Required. Can be any standard SQL data
type (e.g., INT64,DATE,ARRAY).
- 
       array_element_type (DataType, String) — The type of the array's elements, if #type_kind is ARRAY. See #array?. Optional.
- 
       struct_type (StructType) — The fields of the struct, in order, if #type_kind is STRUCT. See #struct?. Optional.
- (DataType) — a new instance of DataType
#int?
def int?() -> BooleanChecks if the #type_kind of the field is INT64.
- 
        (Boolean) — truewhenINT64,falseotherwise.
#numeric?
def numeric?() -> BooleanChecks if the #type_kind of the field is NUMERIC.
- 
        (Boolean) — truewhenNUMERIC,falseotherwise.
#string?
def string?() -> BooleanChecks if the #type_kind of the field is STRING.
- 
        (Boolean) — truewhenSTRING,falseotherwise.
#struct?
def struct?() -> BooleanChecks if the #type_kind of the field is STRUCT.
- 
        (Boolean) — truewhenSTRUCT,falseotherwise.
#struct_type
def struct_type() -> StructType, nilThe fields of the struct, in order, if #type_kind is STRUCT. See #struct?. Optional.
- (StructType, nil)
#time?
def time?() -> BooleanChecks if the #type_kind of the field is TIME.
- 
        (Boolean) — truewhenTIME,falseotherwise.
#timestamp?
def timestamp?() -> BooleanChecks if the #type_kind of the field is TIMESTAMP.
- 
        (Boolean) — truewhenTIMESTAMP,falseotherwise.
#type_kind
def type_kind() -> StringThe top level type of this field. Required. Can be any standard SQL data type (e.g., INT64, DATE,
ARRAY).
- (String) — The upper case type.