GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Adding vertices and edges with the same label name - generate ClassCastException on traversal of vertices - g.V() · Issue #498 · ArcadeData/arcadedb

Adding vertices and edges with the same label name - generate ClassCastException on traversal of vertices - g.V() #498

New issue
Copy link
New issue
Copy link
Closed
Closed
Adding vertices and edges with the same label name - generate ClassCastException on traversal of vertices - g.V()#498
Copy link
Assignees
lvca
Milestone
22.10.1

Description

@nicolaiwadstrom
nicolaiwadstrom
opened on Aug 31, 2022
Issue body actions

ArcadeDB Version: 22.8.1

JDK Version: Oracle Corporation v11.0.2 build 11.0.2+9 (2019-01-15) - class version 55.0

OS: MacOS 12.4

Expected behavior

ArcadeGraph.vertices( ids... String ) to return only vertices

Actual behavior

the query in ArcadeGraph.vertices() implementation do not query only vertices, but will also return edges, which causes a ClassCastException on line 212:

  return resultset.stream()
          .map(result -> (Vertex) new ArcadeVertex(this, (com.arcadedb.graph.Vertex) (result.toElement())))
    .iterator();

The problem is: (com.arcadedb.graph.Vertex) (result.toElement())

Steps to reproduce

Create Vertices and Edges with properties, where vertices and the the edge have the same label identifier. Do a graph traversal:

			com.arcadedb.database.Database database = databaseServer().getDatabase( "debug-db-2", true, true );

			org.apache.tinkerpop.gremlin.arcadedb.structure.ArcadeGraph graph = 
				org.apache.tinkerpop.gremlin.arcadedb.structure.ArcadeGraph.open( database );
			
			GraphTraversalSource g = 
				AnonymousTraversalSource
					.traversal()
					.withEmbedded( graph )
			;
			
			org.apache.tinkerpop.gremlin.structure.Vertex _v1 = g.addV( "l1" ).property(  "[test]", "sallad" ).next();
			org.apache.tinkerpop.gremlin.structure.Vertex _v2 = g.addV( "l1" ).property(  "[test]", "sallad" ).next();

			g.addE( "l1" ).from( _v1 ).to( _v2 ).property(  "[test]", "sallad" ).iterate();
			
			
			g.V()
				.has( "[test]", org.apache.tinkerpop.gremlin.process.traversal.P.within( "sallad" ) )
			
			.forEachRemaining( v -> {
				System.out.println( v + " --> " + "  " );
			} );

---- Exception details ----

java.lang.ClassCastException: class com.arcadedb.graph.MutableEdge cannot be cast to class com.arcadedb.graph.Vertex (com.arcadedb.graph.MutableEdge and com.arcadedb.graph.Vertex are in unnamed module of loader 'app')
java.lang.ClassCastException: class com.arcadedb.graph.MutableEdge cannot be cast to class com.arcadedb.graph.Vertex (com.arcadedb.graph.MutableEdge and com.arcadedb.graph.Vertex are in unnamed module of loader 'app')
	at org.apache.tinkerpop.gremlin.arcadedb.structure.ArcadeGraph.lambda$vertices$0(ArcadeGraph.java:212) ~[arcadedb-gremlin-22.8.1.jar:?]
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) ~[?:?]
	at com.arcadedb.query.sql.executor.ResultSet.tryAdvance(ResultSet.java:60) ~[arcadedb-engine-22.8.1.jar:?]
	at java.util.stream.StreamSpliterators$WrappingSpliterator.lambda$initPartialTraversalState$0(StreamSpliterators.java:294) ~[?:?]
	at java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.fillBuffer(StreamSpliterators.java:206) ~[?:?]
	at java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.doAdvance(StreamSpliterators.java:169) ~[?:?]
	at java.util.stream.StreamSpliterators$WrappingSpliterator.tryAdvance(StreamSpliterators.java:300) ~[?:?]
	at java.util.Spliterators$1Adapter.hasNext(Spliterators.java:681) ~[?:?]
	at org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep.processNextStart(GraphStep.java:149) ~[gremlin-core-3.5.1.jar:3.5.1]
	at org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.hasNext(AbstractStep.java:150) ~[gremlin-core-3.5.1.jar:3.5.1]
	at org.apache.tinkerpop.gremlin.process.traversal.step.util.ExpandableStepIterator.next(ExpandableStepIterator.java:55) ~[gremlin-core-3.5.1.jar:3.5.1]
	at org.apache.tinkerpop.gremlin.process.traversal.step.filter.FilterStep.processNextStart(FilterStep.java:37) ~[gremlin-core-3.5.1.jar:3.5.1]
	at org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.next(AbstractStep.java:135) ~[gremlin-core-3.5.1.jar:3.5.1]
	at org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep.next(AbstractStep.java:40) ~[gremlin-core-3.5.1.jar:3.5.1]
	at org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversal.next(DefaultTraversal.java:230) ~[gremlin-core-3.5.1.jar:3.5.1]
	at org.apache.tinkerpop.gremlin.process.traversal.Traversal.forEachRemaining(Traversal.java:278) ~[gremlin-core-3.5.1.jar:3.5.1]
	at test.lambda$0(TestEmbeddedDatabaserServer2.java:139) ~[classes/:?]
	at io.vertx.core.impl.ContextImpl.lambda$null$0(ContextImpl.java:159) ~[vertx-core-4.3.1.jar:4.3.1]
	at io.vertx.core.impl.AbstractContext.dispatch(AbstractContext.java:101) ~[vertx-core-4.3.1.jar:4.3.1]
	at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$1(ContextImpl.java:157) ~[vertx-core-4.3.1.jar:4.3.1]
	at io.vertx.core.impl.TaskQueue.run(TaskQueue.java:76) ~[vertx-core-4.3.1.jar:4.3.1]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [netty-common-4.1.77.Final.jar:4.1.77.Final]
	at java.lang.Thread.run(Thread.java:834) [?:?]

Activity

  1. lvca
    self-assigned this
    on Aug 31, 2022
  2. lvca
    added
    bug
    on Aug 31, 2022
  3. lvca
    added this to the 22.9.1 milestone on Aug 31, 2022
  4. lvca commented on Sep 1, 2022

    @lvca
    lvca
    on Sep 1, 2022
    Member
    More actions

    I checked the method and only the buckets relative to the vertex types are considered:

    arcadedb/gremlin/src/main/java/org/apache/tinkerpop/gremlin/arcadedb/structure/ArcadeGraph.java

    Line 191 in 9b6a20a

    if (t instanceof VertexType)

  5. lvca
    added a commit that references this issue on Sep 1, 2022

    Attempt to fix issue with returning edges on graph.vertices()

    b1d616b
  6. lvca commented on Sep 1, 2022

    @lvca
    lvca
    on Sep 1, 2022
    Member
    More actions

    Ok, I found something odd in ArcadeGraph. A check is missing about the label name. It checks only that the vertex/edge types exist without checking that is a vertex or edge type. Not sure if this fixes the issue, I'd need a test case in java to reproduce it. Any chance you can build the latest snapshot from git main branch and try it out?

  7. nicolaiwadstrom commented on Sep 4, 2022

    @nicolaiwadstrom
    nicolaiwadstrom
    on Sep 4, 2022
    Author
    More actions

    Thanks, I will give it a go to try to build from latest and see if that fixes it.

  8. lvca
    modified the milestones: 22.9.1, 22.10.1 on Oct 3, 2022
  9. lvca commented on Oct 15, 2022

    @lvca
    lvca
    on Oct 15, 2022
    Member
    More actions

    @nicolaiwadstrom any news on this? Were you able to try this out? Thanks in advance.

  10. lvca commented on Oct 24, 2022

    @lvca
    lvca
    on Oct 24, 2022
    Member
    More actions

    No feedback from the user, closing this issue.

  11. lvca
    closed this as completedon Oct 24, 2022
  12. mergify
    added a commit that references this issue on Nov 16, 2025

    chore(deps): bump org.apache.maven.plugins:maven-jar-plugin from 3.4.…

    b0b4f26
  13. tae898
    added 2 commits that reference this issue on Jun 28, 2026

    Attempt to fix issue with returning edges on graph.vertices()

    5763684

    chore(deps): bump org.apache.maven.plugins:maven-jar-plugin from 3.4.…

    5b7b22c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @lvca
    lvca

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    • 22.10.1

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.