用bean的选定属性编写镶木素输出
我有一个bean类
@Getter
@Setter
public class Employee {
String id;
String name;
String depart;
String address;
final String pipe= "|";
@Override
public String toString() {
return id +pipe+ name +pipe+depart;
}
}
,我有一个javardd<雇员> emprdd;
当我进行emprdd.saveastext(path);
时。我将输出作为基于Tostring方法的输出。 现在,我想在将其转换为dataframe之后写入镶木quet格式,但我只需要(id,name,drake
)。我尝试了sqlContext.CreateDataFrame(rdd,employee.class);
(语法被忽略),但我不需要所有属性。
任何人都可以指导我完成这个问题。 (这是一个样本,我有350多个属性的Bean类)
I have a bean class
@Getter
@Setter
public class Employee {
String id;
String name;
String depart;
String address;
final String pipe= "|";
@Override
public String toString() {
return id +pipe+ name +pipe+depart;
}
}
And I have a JavaRDD<Employee> emprdd;
and when I do the emprdd.saveAsText(path);
. I get the output as based on the toString method.
Now I wanted to write into the parquet format after converting it to the dataframe but I need only (id,name,depart
). I tried sqlContext.createDataframe(rdd,Employee.class);
(syntax ignored), but I dont need all the properties.
Can anyone guide me through this. (This is a sample , I have bean class with 350+ attributes)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论