Skip to main content

@terascope/data-mate / teal-frame/row-shape

teal-frame/row-shape

Type Aliases​

ValueShaper​

ValueShaper = (value) => unknown

Defined in: data-mate/src/teal-frame/row-shape.ts:24

Shapes rows() output where the right shape depends on the field config, not the value.

  • toPlainValue turns every STRUCT into an object. A Tuple is stored as STRUCT("0" ..., "1" ...) (a DuckDB LIST cannot mix element types), but DataFrame returns it as an array, so it is converted back.
  • A Date is stored as { ms, tz_offset } and rendered as toISO8601 renders it. See date-value.ts.
  • A JSON column (Any, or an Object/Tuple with no declared children) arrives as text and is parsed, so {x: 1} is returned as an object rather than the string '{"x":1}'.

Shapers are built once per rows() call. A column that needs no shaping gets none and costs nothing per row.

Parameters​

ParameterType
valueunknown

Returns​

unknown

Functions​

isJSONColumn()​

isJSONColumn(type, childConfig?): boolean

Defined in: data-mate/src/teal-frame/row-shape.ts:56

Whether the column is stored as JSON (toDuckDB maps these types to JSON).

Parameters​

ParameterType
typeFieldType
childConfig?DataTypeFields | ReadonlyDataTypeFields

Returns​

boolean


makeRowShapers()​

makeRowShapers(config): ReadonlyMap<string, ValueShaper>

Defined in: data-mate/src/teal-frame/row-shape.ts:27

Returns a shaper for each top-level column that needs one, keyed by column name.

Parameters​

ParameterType
configDataTypeConfig | Readonly<Overwrite<DataTypeConfig, { fields: ReadonlyDataTypeFields; }>>

Returns​

ReadonlyMap<string, ValueShaper>