Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[geomesa-users] Compilaiton error in Java when applying "map" to an RDD generated via GeoMesaSpark.rdd

I am trying to generate an RDD of Objects from an RDD of SimpleFeatures, but I was not able to find a way to do it.

Here's the failing code:
public static RDD<Object> loadFromGeoMesaTable(Configuration conf,
      SparkContext sc, GeoMesaOptions options) {

    RDD<Object> rddOut = GeoMesaSpark.rdd(conf, sc,
        TweetFeatureStore.getFeatureType(options).getDataStore(), null, false)
        .map((feat) -> {
          return new Tweet(feat);
        }, scala.reflect.ClassTag$.MODULE$.apply(Object.class));

    return rddOut;
  }

Here's the compilation error:
method map in class org.apache.spark.rdd.RDD<T> cannot be applied to given types;
[ERROR] required: scala.Function1<org.opengis.feature.simple.SimpleFeature,U>,scala.reflect.ClassTag<U>
[ERROR] found: (feat)->{ [...]t); },scala.reflect.ClassTag<java.lang.Object>
[ERROR] reason: cannot infer type-variable(s) U,T
[ERROR] (argument mismatch; scala.Function1 is not a functional interface
[ERROR] multiple non-overriding abstract methods found in interface scala.Function1)

Any help much appreciated,

Luca Morandini
Data Architect - AURIN project
Melbourne eResearch Group
Department of Computing and Information Systems
University of Melbourne
Tel. +61 03 903 58 380
Skype: lmorandini


Back to the top