Skip to content

Converting generic row result column back into a dataframe again #878

Answered by imback82
dbeavon asked this question in Q&A
Discussion options

You must be logged in to vote

For the example in the test you shared:

Row[] rows = _df.Select(udf(nameCol).As("col"), nameCol).Collect().ToArray();

_df.Select(udf(nameCol).As("col"), nameCol) returns a DataFrame, so I am confused with what you are trying to do: "to cast the collection of row datatypes back into a dataframe ?"

The column type of udf(nameCol).As("col") is the schema you specify in the UDF, so you can keep operating on the dataframe based on the schema. Try to run _df.Select(udf(nameCol).As("col"), nameCol).PrintSchema() to see the schema of the dataframe after applying the UDF.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@dbeavon
Comment options

@imback82
Comment options

@dbeavon
Comment options

Answer selected by dbeavon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants