Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

blend

  upcast all input values into a blended type

Synopsis

blend

Description

The blend operator computes a blended type over all of its input then upcasts all values in the input to the blended type.

This is logically equivalent to:

from input | values upcast(this, (from input | aggregate blend(this)))

Because all values of the input must be read to compute the blended type, blend may spill its input to disk when memory limits are exceeded.

Note

Spilling is not yet implemented for the vectorized runtime.

Examples


Blend two records

# spq
blend
# input
{a:1}
{b:2}
# expected output
{a?:1,b?:_::int64}
{a?:_::int64,b?:2}

Blend records with type variation

# spq
blend
# input
{a:1}
{a:"foo"}
# expected output
{a:1::(int64|string)}
{a:"foo"::(int64|string)}

Blend records with complex type variation

# spq
blend
# input
{a:[1,2]}
{a:["foo","bar"],b:10.0.0.1}
# expected output
{a:[1,2]::[int64|string],b?:_::ip}
{a:["foo","bar"]::[int64|string],b?:10.0.0.1}