TypeClashTactic

Allows the choice of how to handle type clashes when reading a JSON file. Such as:

[
{ "a": "text" },
{ "a": { "b": 2 } },
{ "a": [6, 7, 8] }
]

ARRAY_AND_VALUE_COLUMNS (default) will create a DataFrame looking like (including null values):

⌌-----------------------------------------------⌍
| | a:{b:Int?, value:String?, array:List<Int>?}|
|--|--------------------------------------------|
| 0| { b:null, value:"text", array:null }|
| 1| { b:2, value:null, array:null }|
| 2| { b:null, value:null, array:[6, 7, 8] }|
⌎-----------------------------------------------⌏

So, for the type clashing argument it will create a ColumnGroup with the properties value, array, and the unwrapped properties of the objects the property can be.

Each of these columns only holds a value for the records that actually have that shape; for all other records it holds null, which makes all columns nullable:

  • value holds the JSON primitive, or null if the record is not a primitive.

  • array holds the JSON array as a List, or null if the record is not an array (note that this is different from an empty JSON array [], which is read as an empty list). When the arrays contain objects, array becomes a FrameColumn instead, in which a record without an array is an empty DataFrame, as frame columns cannot hold null.

  • the unwrapped object properties hold null if the record is not an object, or if the object does not have that property.

A JSON null record, as well as a missing property, is null in all these columns.

Note that a type clash is not the only source of value/array columns; at the top level they're created for any JSON element that isn't an object. For more information: See the "value" and "array" columns on the documentation website.

ANY_COLUMNS will create a DataFrame looking like:

⌌-------------⌍
| | a:Any|
|--|----------|
| 0| "text"|
| 1| { b:2 }|
| 2| [6, 7, 8]|
⌎-------------⌏

Entries

Link copied to clipboard

Companion properties

Link copied to clipboard

Returns an immutable kotlin.enums.EnumEntries list containing the constants of this enum type, in the order they're declared.

Companion functions

Link copied to clipboard

Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Link copied to clipboard

Returns an array containing the constants of this enum type, in the order they're declared.

Properties

Link copied to clipboard
Link copied to clipboard