简体   繁体   English

是否可以在scala中将Apache ignite rdd转换为spark rdd

[英]Is it possible to convert apache ignite rdd to spark rdd in scala

I am new to apache ignite as well as for spark... Can any one help with example to convert ignite rdd to spark rdd in scala. 我是新来的apache ignite以及spark ...可以有人举个例子在scala中将ignite rdd转换为spark rdd吗?

Updated---- Use case: I will receive a dataframes of hbase tables.. I will execute some logic to build report out of it, save it to the ignite rdd... and same ignite rdd will be updated for each table... once all the tables are executed final ignite rdd will be converted to spark or java rdd and last rule will be executed on that rdd... to run that rule I need that rdd to be converted into dataframe. 已更新----用例:我将收到一个hbase表的数据框。我将执行一些逻辑以从中构建报告,将其保存到ignite rdd ...,并将为每个表更新相同的ignite rdd。 ..一旦所有表都执行完,最终点燃rdd将被转换为spark或java rdd,最后一条规则将在该rdd上执行...要运行该规则,我需要将rdd转换为数据框。 and that dataframe would be saved as a final report in hive... 并且该数据框将作为最终报告保存在配置单元中...

What do you mean by converting? 转换是什么意思? IgniteRDD is a Spark RDD , technically it' a subtype of RDD trait. IgniteRDD 是Spark RDD ,从技术上讲,它是RDD特性的子类型。

Spark internally has many type of RDDs: MappedRDD, HadoopRDD, LogicalRDD. Spark内部具有许多类型的RDD:MappedRDD,HadoopRDD,LogicalRDD。 IgniteRDD is only one of possible type of RDD and after some transformations it also will be wrapped by other RDD type, ie MappedRDD. IgniteRDD只是RDD的一种可能类型,经过一些转换后,它也会被其他RDD类型(即MappedRDD)包装。

You can also write your own RDD :) 您也可以编写自己的RDD :)

Example from documentation : 文档中的示例:

val cache = igniteContext.fromCache("partitioned")
val result = cache.filter(_._2.contains("Ignite")).collect()

After filtering cache RDD, type will be different - IgniteRDD will be wrapped to FilteredRDD. 过滤缓存RDD之后,类型将有所不同-IgniteRDD将包装为FilteredRDD。 However it's still implementation of RDD trait. 但是,它仍然是RDD特性的实现。

Update after comment: 评论后更新:

  1. At first, have you imported implicits? 首先,您是否导入了隐式? import spark.implicits._
  2. In SparkSession you've got various createDataFrame methods that will convert your RDD into DataFrame / Dataset SparkSession中,您具有各种createDataFrame方法,这些方法会将RDD转换为DataFrame / Dataset

If it still not help you, please provide us error that you're getting while creating DataFrame and code example 如果仍然无法解决问题,请向我们提供您在创建DataFrame和代码示例时遇到的错误

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM