fill
Table of Contents
Function
fill — add null values for missing record fields
Synopsis
fill(val: any, t: type) -> any
Description
The fill function adds to the input record val
any fields that are
present in the output type t
but not in the input. Such fields are added
after the fields already present in t
and in the order they appear in the
input record.
Filled fields are added with a null
value. Filling is useful when
you want to be sure that all fields in a schema are present in a record.
If val
is not a record, it is returned unmodified.
✵ Tip ✵
Many users seeking the functionality of fill
prefer to use the
shape
function which applies the fill
, cast
,
and order
functions simultaneously on a record.
Examples
Fill a record
fill(this, <{a:int64,b:string}>)
{a:1}
Loading...
produces
Fill an array of records
fill(this, <[{a:int64,b:int64}]>)
[{a:1},{a:2}]
Loading...
produces
Non-records are returned unmodified
fill(this, <{a:int64,b:int64}>)
10.0.0.1
1
"foo"
Loading...
produces