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

Add RecordConverter.toRecord(Schema, List<Object>) #5849

Merged
merged 1 commit into from Jul 8, 2018

Conversation

Projects
None yet
2 participants
@treo
Copy link
Member

treo commented Jul 8, 2018

This allows for easy interoperability between POJOs and DataVec.

Example usage:

SomeDTO example; // comes from somewhere, and has the fields a: Int, b: double, c: String

Schema schema = new Schema.Builder()
    .addColumnInteger("CountOfA")
    .addColumnDouble("PriceOfA")
    .addColumnCategorical("Category", "Foo", "Bar")
    .build();

// can now be used with, e.g. a TransformProcess
List<Writable> record = RecordConverter.toRecord(schema, 
    Arrays.asList(example.getA(), example.getB(), example.getC())); 

@treo treo requested a review from agibsonccc Jul 8, 2018

@agibsonccc agibsonccc merged commit 6f4b765 into master Jul 8, 2018

1 of 2 checks passed

codeclimate Code Climate encountered an error attempting to analyze this pull request.
Details
continuous-integration/jenkins/pr-merge This commit looks good
Details

@agibsonccc agibsonccc deleted the treo_add_list_to_record branch Jul 8, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment