Uploaded image for project: 'TinkerPop'
  1. TinkerPop
  2. TINKERPOP-2961

Missing exceptions for unsolvable match pattern, which may lead to logic inconsistency

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.6.0
    • None
    • process
    • None

    Description

      Hi all! From Discord.

      We noticed that in some cases unsolvable matching will not lead to the exception "unsolvable pattern" in Gremlin.

      For a simple example, in the empty graph, the following query will not lead to an exception, while it will result in an exception in the GraphModern:

      g.V().match(__.as("A").out().as("B"), __.as("C").out().as("B"), __.as("D").out().as("A"))
      

      In more complex cases, this missing may lead to a worse result.

      For example, in the graph created by attachment create-8.log

      g.V().match(
      __.as("n2").out().as("n1"), 
      __.as("n2").in().in().in().both().in().as("n1"), 
      __.as("n2").both().in().in().as("n3"), 
      __.as("n3").in().both().as("n2"), 
      __.as("n2").in().in().in().in().both().as("n4"), 
      __.as("n2").out().both().in().as("n4"), 
      __.as("n3").both().as("n4"), 
      __.as("n1").in().both().both().both().as("n5")
      ).dedup().count()
      
      =>306691
      
      g.V().match(
      __.as("n2").out().as("n1"), 
      __.as("n2").in().in().in().both().in().as("n1"), 
      __.as("n2").both().in().in().as("n3"), 
      __.as("n3").in().both().as("n2"), 
      __.as("n4").both().out().out().out().out().as("n2"), 
      __.as("n2").out().both().in().as("n4"), 
      __.as("n3").both().as("n4"), 
      __.as("n1").in().both().both().both().as("n5")
      ).dedup().count()
      
      =>306075
      

      The two queries are equivalent, the only difference is the expression of the traversal "__.as("n4").both().out().out().out().out().as("n2")".
      I am not sure which of their results in the correct result, but the logic inconsistency indicates that the missing exception may cause worse results than we thought before.

      After the discussion with spmallette, we believe that it would be better if detect the unsolvable pattern before the execution.

      In addition, it would be highly appreciated if someone can reproduce and confirm the logic inconsistency in the complex cases. I think it may imply other potential issues of the traversal strategies. And if such logic inconsistency still exists using both solvable equivalent patterns, we will reduce & report is ASAP.

       

      Best regards,

      Joye Mang

      Attachments

        1. create-8.log
          128 kB
          Miracy Cavendish

        Activity

          People

            Unassigned Unassigned
            miracy Miracy Cavendish
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: