org.apache.spark.rdd.RDD.dependencies()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(1.7k)|赞(0)|评价(0)|浏览(287)

本文整理了Java中org.apache.spark.rdd.RDD.dependencies方法的一些代码示例,展示了RDD.dependencies的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RDD.dependencies方法的具体详情如下:
包路径:org.apache.spark.rdd.RDD
类名称:RDD
方法名:dependencies

RDD.dependencies介绍

暂无

代码示例

代码示例来源:origin: apache/drill

private static void rddToString(RDD rdd, StringBuilder sb, String offset) {
 sb.append(offset).append(rdd.getClass().getCanonicalName()).append("[").append(rdd.hashCode()).append("]");
 if (rdd.getStorageLevel().useMemory()) {
  sb.append("(cached)");
 }
 sb.append("\n");
 Collection<Dependency> dependencies = JavaConversions.asJavaCollection(rdd.dependencies());
 if (dependencies != null) {
  offset += "\t";
  for (Dependency dependency : dependencies) {
   RDD parentRdd = dependency.rdd();
   rddToString(parentRdd, sb, offset);
  }
 } else if (rdd instanceof UnionRDD) {
  UnionRDD unionRDD = (UnionRDD) rdd;
  offset += "\t";
  Collection<RDD> parentRdds = JavaConversions.asJavaCollection(unionRDD.rdds());
  for (RDD parentRdd : parentRdds) {
   rddToString(parentRdd, sb, offset);
  }
 }
}

代码示例来源:origin: apache/hive

Assert.assertTrue(reducerRdd.creationSite().longForm().contains("Reducer 2"));
List<Dependency<?>> rdds = JavaConversions.seqAsJavaList(reducerRdd.dependencies());
Assert.assertEquals(1, rdds.size());
RDD shuffledRdd = rdds.get(0).rdd();
Assert.assertTrue(shuffledRdd.creationSite().longForm().contains("Reducer 2"));
rdds = JavaConversions.seqAsJavaList(shuffledRdd.dependencies());
Assert.assertEquals(1, rdds.size());
RDD mapRdd = rdds.get(0).rdd();
Assert.assertTrue(mapRdd.creationSite().longForm().contains("Map 1"));
rdds = JavaConversions.seqAsJavaList(mapRdd.dependencies());
Assert.assertEquals(1, rdds.size());
RDD hadoopRdd = rdds.get(0).rdd();

相关文章