While map.toDataRow() is very helpful, there's no easy way to fully unfold nested maps to to datarows, like
val map = mapOf(
"name" to "a",
"metadata" to
mapOf(
"country" to "Philippines",
"region" to mapOf("name" to "Caraga", "code" to "XIII"),
"population" to mapOf("value" to "12345", "year" to 2020),
"wrongMap" to mapOf(1 to 2, 4 to 4),
),
)
Similarly to unfold and toDataFrame(), we could add a maxDepth parameter that would allow us to specify the maximum depth of nesting we scan for and convert.
convertKeysToString: Boolean might be another nice addition because there's no way to tell if keys are strings or not until we encounter a ClassCastException.
Iterable<Map<String, Any?>>.toDataFrame() should probably gain the same treatment.
And if we're converting keys to strings anyways, let's make it work for Map<Any, Any?>, why not
While
map.toDataRow()is very helpful, there's no easy way to fully unfold nested maps to to datarows, likeSimilarly to
unfoldandtoDataFrame(), we could add amaxDepthparameter that would allow us to specify the maximum depth of nesting we scan for and convert.convertKeysToString: Booleanmight be another nice addition because there's no way to tell if keys are strings or not until we encounter aClassCastException.Iterable<Map<String, Any?>>.toDataFrame()should probably gain the same treatment.And if we're converting keys to strings anyways, let's make it work for
Map<Any, Any?>, why not