lib/piglet/relation/join.rb in piglet-0.1.2 vs lib/piglet/relation/join.rb in piglet-0.2.0
- old
+ new
@@ -7,9 +7,14 @@
@join_fields = Hash[*description.select { |k, v| k.is_a?(Relation) }.flatten]
@sources = @join_fields.keys
@using = description[:using]
@parallel = description[:parallel]
end
+
+ def schema
+ schemas = @sources.map { |s| s.schema }
+ schemas.first.union(schemas[1..-1])
+ end
def to_s
joins = @sources.map { |s| "#{s.alias} BY #{@join_fields[s]}" }.join(', ')
str = "JOIN #{joins}"
str << " USING \"#{@using.to_s}\"" if @using
\ No newline at end of file