我正在尝试从Dataset创建RDD,如下所示:
Dataset<Positions> bondDF = SQLContext.sql("select * from
df_positions where asset_type='BOND'").as(positionsEncoder);
bondDF.show();
JavaRDD<Positions> bondRDD = bondDF.toJavaRDD();
System.out.println("Bond RDD :"+ bondRDD.first().getAsset_type());
bondDF.show()
输出为:
|asset_type |book_id |instrument_id |product_category |product_code | product_name|
+-----------+--------+--------------+-----------------+-------------+--------------+
|BOND |CBOND_1 | 46637K547 | FIXED_INCOME | 100 |CORPORATE BOND|
RDD输出为空但我希望它是BOND
。事实上,asset_type
,book_id
等所有属性都是空的。