Skip to content

Conversation

CarloMariaProietti
Copy link
Contributor

Solving issue #1098

@Jolanrensen
Copy link
Collaborator

@koperagen do you think it will cause issues in combination with #1465 ? or should this be good to go?

@koperagen
Copy link
Collaborator

@koperagen do you think it will cause issues in combination with #1465 ? or should this be good to go?

No issues, but in Iterable.toDataFrame we'll treat Map as value type and won't unfold it. I think it makes sense as a default

So results would be,

  1. With this new function
    listOf(mapOf("a" to 123)).toDataFrame() =>
a: Int
  1. With generic toDataFrame and deep conversion
class MapContainer(val myMap: Map<String, *>)

listOf(MapContainer(mapOf("a" to 123))).toDataFrame(maxDepth = 2)

=>

myMap: Map<String, *>
  1. Later Map can be converted
    df.convert { myMap }.with { it.toDataRow() }

@Jolanrensen
Copy link
Collaborator

@koperagen and what about listOf(myMap, 1, "").toDataFrame()? This is what I'm most concerned about

@koperagen
Copy link
Collaborator

@koperagen and what about listOf(myMap, 1, "").toDataFrame()? This is what I'm most concerned about

Iterable.toDataFrame relies on T to traverse properties. T of listOf(myMap, 1, "") is Any =>
image

Nothing changes here

@Jolanrensen
Copy link
Collaborator

Okay, in that case we can probably add it safely. Could you update this branch from master and commit apiDump again? :)

}

@Test
fun `should convert iterables of maps representing rows to DataFrame with value column`() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*columns

@CarloMariaProietti
Copy link
Contributor Author

I fixed test name, pulled master, ran apiDump.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants