rubenada commented on PR #5370:
URL: https://github.com/apache/calcite/pull/5370#issuecomment-6610059624

   @vldpyatkov thanks for pushing this forward!
   Quick question: IIUC the usage of SEARCH on a diamond shape graph could lead 
to "duplicated" results, e.g.:
   
   Edges: 0→1, 0→2, 1→3, 2→3. Node 3 can be reached two ways.
   ```
   WITH RECURSIVE edges(src, dst) AS (VALUES (0,1), (0,2), (1,3), (2,3)),
   walk(node) AS (
     VALUES (0)
     UNION
     SELECT e.dst FROM walk AS w JOIN edges AS e ON e.src = w.node)
   SELECT node FROM walk
   ```
   Without `SEARCH`: 0,1,2,3
   With `SEARCH DEPTH`:  (0, [0]),  (1, [0,1]), (2, [0,2]), (3, [0,1,3]), (3, 
[0,2,3])
   On the second case, 3 is returned two times (because paths differ).
   
   Analogously, on a graph: 0→1, 1→3, 0→3
   Without `SEARCH`: 0,1,3
   With `SEARCH BREADTH`: (0, ROW(0,0)),  (1, ROW(1,1)), (3, ROW(1,3)), (3, 
ROW(2,3)).
   On the second case, 3 is returned two times (because depths differ).
   
   If this is the case, could we have some tests showing these cases? Shall we 
document somehow this phenomenon?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to