Module: ElasticGraph::Warehouse::SchemaDefinition::ObjectAndInterfaceExtension

Defined in:
elasticgraph-warehouse/lib/elastic_graph/warehouse/schema_definition/object_and_interface_extension.rb

Overview

Instance Method Summary collapse

Instance Method Details

#to_warehouse_column_typeString

Returns the warehouse column type representation for this object or interface type.

Returns:

  • (String)

    a STRUCT SQL type containing all subfields



20
21
22
23
24
25
26
27
28
29
# File 'elasticgraph-warehouse/lib/elastic_graph/warehouse/schema_definition/object_and_interface_extension.rb', line 20

def to_warehouse_column_type
  subfields = indexing_fields_by_name_in_index.values.map(&:to_indexing_field).compact

  struct_field_expressions = subfields.map do |subfield|
    warehouse_type = FieldTypeConverter.convert(subfield.type)
    "#{subfield.name} #{warehouse_type}"
  end.join(", ")

  "STRUCT<#{struct_field_expressions}>"
end