You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by Madabhattula Rajesh Kumar <mr...@gmail.com> on 2014/11/03 09:23:37 UTC

To find distances to reachable source vertices using GraphX

Hi All,

I'm trying to understand below link example program. When I run this
program, I'm getting "*java.lang.NullPointerException*" at below
highlighted line.

*https://gist.github.com/ankurdave/4a17596669b36be06100
<https://gist.github.com/ankurdave/4a17596669b36be06100>*

    val updatedDists = edge.srcAttr.filter {
    case (source, dist) =>
    *val existingDist = edge.dstAttr.getOrElse(source, Int.MaxValue) *
    existingDist > dist + 1
    }.mapValues(_ + 1).map(identity)

Could you please help me to resolve this issue.

Regards,
Rajesh

Re: To find distances to reachable source vertices using GraphX

Posted by Madabhattula Rajesh Kumar <mr...@gmail.com>.
Thank you Ankur for your help and support!!!

On Tue, Nov 4, 2014 at 5:24 AM, Ankur Dave <an...@gmail.com> wrote:

> The NullPointerException seems to be because edge.dstAttr is null, which
> might be due to SPARK-3936
> <https://issues.apache.org/jira/browse/SPARK-3936>. Until that's fixed, I
> edited the Gist with a workaround. Does that fix the problem?
>
> Ankur <http://www.ankurdave.com/>
>
> On Mon, Nov 3, 2014 at 12:23 AM, Madabhattula Rajesh Kumar <
> mrajaforu@gmail.com> wrote:
>
>> Hi All,
>>
>> I'm trying to understand below link example program. When I run this
>> program, I'm getting "*java.lang.NullPointerException*" at below
>> highlighted line.
>>
>> *https://gist.github.com/ankurdave/4a17596669b36be06100
>> <https://gist.github.com/ankurdave/4a17596669b36be06100>*
>>
>>     val updatedDists = edge.srcAttr.filter {
>>     case (source, dist) =>
>>     *val existingDist = edge.dstAttr.getOrElse(source, Int.MaxValue) *
>>     existingDist > dist + 1
>>     }.mapValues(_ + 1).map(identity)
>>
>> Could you please help me to resolve this issue.
>>
>> Regards,
>> Rajesh
>>
>
>

Re: To find distances to reachable source vertices using GraphX

Posted by Ankur Dave <an...@gmail.com>.
The NullPointerException seems to be because edge.dstAttr is null, which
might be due to SPARK-3936
<https://issues.apache.org/jira/browse/SPARK-3936>. Until that's fixed, I
edited the Gist with a workaround. Does that fix the problem?

Ankur <http://www.ankurdave.com/>

On Mon, Nov 3, 2014 at 12:23 AM, Madabhattula Rajesh Kumar <
mrajaforu@gmail.com> wrote:

> Hi All,
>
> I'm trying to understand below link example program. When I run this
> program, I'm getting "*java.lang.NullPointerException*" at below
> highlighted line.
>
> *https://gist.github.com/ankurdave/4a17596669b36be06100
> <https://gist.github.com/ankurdave/4a17596669b36be06100>*
>
>     val updatedDists = edge.srcAttr.filter {
>     case (source, dist) =>
>     *val existingDist = edge.dstAttr.getOrElse(source, Int.MaxValue) *
>     existingDist > dist + 1
>     }.mapValues(_ + 1).map(identity)
>
> Could you please help me to resolve this issue.
>
> Regards,
> Rajesh
>