Module: ElasticGraph::Warehouse::SchemaDefinition::ObjectInterfaceAndUnionExtension
- Defined in:
- elasticgraph-warehouse/lib/elastic_graph/warehouse/schema_definition/object_interface_and_union_extension.rb
Overview
Extends SchemaDefinition::SchemaElements::ObjectType, SchemaDefinition::SchemaElements::InterfaceType, and SchemaDefinition::SchemaElements::UnionType to add warehouse column type conversion.
Instance Method Summary collapse
-
#to_warehouse_column_type ⇒ String
Returns the warehouse column type representation for this object, interface, or union type.
Instance Method Details
#to_warehouse_column_type ⇒ String
Note:
For union types, the STRUCT includes all fields from all subtypes, following the same pattern used in the datastore mapping (see SchemaDefinition::Indexing::FieldType::Union#to_mapping).
Returns the warehouse column type representation for this object, interface, or union type.
23 24 25 26 27 28 29 30 31 32 |
# File 'elasticgraph-warehouse/lib/elastic_graph/warehouse/schema_definition/object_interface_and_union_extension.rb', line 23 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 |