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:
valueholds the JSON primitive, ornullif the record is not a primitive.arrayholds the JSON array as aList, ornullif 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,arraybecomes aFrameColumninstead, in which a record without an array is an emptyDataFrame, as frame columns cannot holdnull.the unwrapped object properties hold
nullif 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]|
⌎-------------⌏Companion properties
Returns an immutable kotlin.enums.EnumEntries list containing the constants of this enum type, in the order they're declared.
Companion functions
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.)
Returns an array containing the constants of this enum type, in the order they're declared.