Строка карты набора данных Spark 'не может разрешить карту метода (<лямбда-выражение>)' - PullRequest
0 голосов
/ 26 апреля 2018

Попытка создать RDD из набора данных, пытаясь сопоставить каждую строку в наборе данных. Получение cannot resolve method map(<lambda expression>) ошибки на map в df1.map(r ->:

Dataset<Object> df1 = session.read().parquet(tableName).as(Encoders.bean(Object.class));

JavaRDD<List<Tuple3<Long, Integer, Double>>> tempDatas1 = df1.map(r -> new MapFunction<Object, List<Tuple3<Long, Integer, Double>>>(){
            //@Override
            public List<Tuple3<Long, Integer, Double>> call(Object row) throws Exception
            {

            // Get the sample property, remove leading and ending spaces and split it by comma
            // to get each sample individually
            List<Tuple2<String, Integer>> samples = zipWithIndex((row.getSamples().trim().split(",")));

            // Gets the unique identifier for that s.
            Long snp = row.getPos();

            // Calculates the hamming distance.
            return samples.stream().map(t -> {
                String alleles = t._1();
                Integer patient = t._2();

                List<String> values = Arrays.asList(alleles.split("\\|"));

                Double firstAllele = Double.parseDouble(values.get(0));
                Double secondAllele = Double.parseDouble(values.get(1));

                // Returns the initial s id, p id and the distance in form of Tuple.
                return new Tuple3<>(snp, patient, firstAllele + secondAllele);
            }).collect(Collectors.toList());
            }
        });

Любая помощь будет оценена.

...