Skip to content

Fix UDF returning StructType when it is the only column. #404

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

imback82
Copy link
Contributor

This is a follow up to #376 to address the following issue:

var schema = new StructType(new[] {
    new StructField("col1", new IntegerType()),
    new StructField("col2", new StringType()) });
    
var udf = Udf<string>(str => new GenericRow(new object[] { 1, "abc" }), schema);

Row[] rows = _df.Select(udf(_df["name"]).As("col")).Collect().ToArray();
Assert.Equal(3, rows.Length);
rows[0].GetAs<Row>("col"); // This would fail!

@imback82 imback82 self-assigned this Jan 26, 2020
@imback82 imback82 added the enhancement New feature or request label Jan 26, 2020
@imback82 imback82 requested a review from suhsteve January 26, 2020 01:42
Copy link
Member

@suhsteve suhsteve left a comment

Choose a reason for hiding this comment

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

Looks like withcolumn tests are failing.

Copy link
Contributor

@elvaliuliuliu elvaliuliuliu left a comment

Choose a reason for hiding this comment

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

Tests are failing.

@imback82
Copy link
Contributor Author

@elvaliuliuliu will create a separate PR for this.

@imback82 imback82 closed this Jan 28, 2020
@imback82 imback82 deleted the pickling_fix branch January 28, 2020 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants