Extend

Extends input tuples with derived/computed attributes

Signature

extend(operand: Relation, ext: TupleComputation) -> Relation

Examples

extend(suppliers,
  big:   ->(t){ t.name.upcase },
  small: ->(t){ t.name.downcase })

Description

Computes a relation which is the same as operand, except that each of its tuples has new attributes whose value is the result of evaluating the tuple expressions specified in ext.

Implementation notes

As of current Alf version, this operator cannot be translated to SQL code. In other words, all computations are done in ruby, which may seriously hurt performance.

Similarly, as extend tends to be a showstopper during compilation, it is strongly recommended to use it as high as possible in query expressions trees so as to delegate the largest possible query parts to data engines.