Flatten will generate one or more output records based on a single input record. The output record will be the input record along with an appended additional appended field(s) for the flattening. The specific behavior depends upon the type of the flatten expression provided. In all cases, the drop parameter defines whether or not all fields referenced in the target expression are maintained in the output record or removed.
Scalar/Map: In the case that the provided expression returns a scalar or map, flatten will return a single record for each input record with one additional field at the ref location defined with the same value as the input expression.
Array: If the provided expression returns an array, flatten will return multiple copies of the original input record where each is appended with the value within the array at the ref position.