tinkerpop-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Mallette (Jira)" <j...@apache.org>
Subject [jira] [Commented] (TINKERPOP-2331) Select(<multiple keys>).By(__ValueMap(true)) throws "Unable to cast" exception
Date Tue, 17 Mar 2020 14:34:00 GMT

    [ https://issues.apache.org/jira/browse/TINKERPOP-2331?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17060957#comment-17060957
] 

Stephen Mallette commented on TINKERPOP-2331:
---------------------------------------------

I'm not sure if this is still an issue for you, but I gave this a test and can't say that
I can recreate the problem. Your sample graph is missing an edge so your failing query would
return no results in the console or otherwise. I decided to just recreate the traversal using
the standard modern toy dataset and it worked fine on 3.4-dev branch which is still about
even with 3.4.6 at this point i think:

{code}
g.V().Has("person", "name", "marko").As("a")
                .Out("xxx").Has("person", "name", "josh").As("b")
                .Select<object>("a", "b").By(__.ValueMap<object, object>(true)).ToList()
{code}

Perhaps the issue is resolve now? or perhaps I didn't properly capture the nature of the failure
in my test? 

> Select(<multiple keys>).By(__ValueMap(true)) throws "Unable to cast" exception
> ------------------------------------------------------------------------------
>
>                 Key: TINKERPOP-2331
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2331
>             Project: TinkerPop
>          Issue Type: Bug
>          Components: dotnet
>    Affects Versions: 3.4.4
>            Reporter: Tom Brown
>            Priority: Major
>
> It looks like dotnet version does not support selecting multiple vertices by aliases
and following syntax always throws an exception
> Select("key1", "key2").By(__.ValueMap(true))
> System.InvalidCastException: 'Unable to cast object of type 'System.Collections.Generic.Dictionary`2[System.Object,System.Object]'
to type 'Gremlin.Net.Structure.Vertex'.'
>  
> *Steps to reproduce:*
> _1. Create following test graph_
> graph = TinkerGraph.open();
>  g = graph.traversal();
>  g.addV().property("name", "B").
>  addV().property("name", "A");
>  
> _2. Query from Gremlin console to verify that query syntax is OK_
> g.V().has("name", "A").as("a").out().has("name", "B").as("b").select("a", "b").by(valueMap(true))
>  
> _3. Query from .net to get an exception_
> g.V().Has("name", "A").As("a").Out().Has("name", "B").as("b").Select<object>("a",
"b").By(__.ValueMap<object, object>(true)).ToList()
>  
> *Hack fix that works*
> My hacky fix was to create "ByDictionary" method similar to "By", but I could not figure
out how to add a proper override to "By"
> public GraphTraversal<S, Dictionary<object, object>> ByDictionary(ITraversal
traversal)
>  {
>  Bytecode.AddStep("by", traversal);
>  return Wrap<S, Dictionary<object, object>>(this);
>  }



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Mime
View raw message