@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.
toPlainValueturns every STRUCT into an object. ATupleis stored asSTRUCT("0" ..., "1" ...)(a DuckDB LIST cannot mix element types), butDataFramereturns it as an array, so it is converted back.- A
Dateis stored as{ ms, tz_offset }and rendered astoISO8601renders it. Seedate-value.ts. - A JSON column (
Any, or anObject/Tuplewith 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
| Parameter | Type |
|---|---|
value | unknown |
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
| Parameter | Type |
|---|---|
type | FieldType |
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
| Parameter | Type |
|---|---|
config | DataTypeConfig | Readonly<Overwrite<DataTypeConfig, { fields: ReadonlyDataTypeFields; }>> |
Returns
ReadonlyMap<string, ValueShaper>