Aklakan commented on issue #2535:
URL: https://github.com/apache/jena/issues/2535#issuecomment-2169510461

   Another use case is the SPARQL 4x4 Sudoku solver where the candidate field 
values are modeled in inline VALUES blocks. With hash joins, the example 
completes instantly. With linear joins the execution attempts to perform `4^16 
= 4294967296` iterations.
   
   ```sparql
   PREFIX eg: <http://www.example.org/>
   
   SELECT
     ?w11 ?w12 ?w13 ?w14
     ?w21 ?w22 ?w23 ?w24
     ?w31 ?w32 ?w33 ?w34
     ?w41 ?w42 ?w43 ?w44
   WHERE {
     VALUES ?w11 { 1 2 3 4 } VALUES ?w12 { 1 2 3 4 } VALUES ?w13 { 1 2 3 4 } 
VALUES ?w14 { 1 2 3 4 }
     VALUES ?w21 { 1 2 3 4 } VALUES ?w22 { 1 2 3 4 } VALUES ?w23 { 1 2 3 4 } 
VALUES ?w24 { 1 2 3 4 }
     VALUES ?w31 { 1 2 3 4 } VALUES ?w32 { 1 2 3 4 } VALUES ?w33 { 1 2 3 4 } 
VALUES ?w34 { 1 2 3 4 }
     VALUES ?w41 { 1 2 3 4 } VALUES ?w42 { 1 2 3 4 } VALUES ?w43 { 1 2 3 4 } 
VALUES ?w44 { 1 2 3 4 }
   FILTER(
     (?w11 != ?w12) && (?w11 != ?w13) && (?w11 != ?w14) && (?w12 != ?w13) && 
(?w12 != ?w14) && (?w13 != ?w14) &&
     (?w21 != ?w22) && (?w21 != ?w23) && (?w21 != ?w24) && (?w22 != ?w23) && 
(?w22 != ?w24) && (?w23 != ?w24) &&
     (?w31 != ?w32) && (?w31 != ?w33) && (?w31 != ?w34) && (?w32 != ?w33) && 
(?w32 != ?w34) && (?w33 != ?w34) &&
     (?w41 != ?w42) && (?w41 != ?w43) && (?w41 != ?w44) && (?w42 != ?w43) && 
(?w42 != ?w44) && (?w43 != ?w44) &&
   
     (?w11 != ?w21) && (?w11 != ?w31) && (?w11 != ?w41) && (?w21 != ?w31) && 
(?w21 != ?w41) && (?w31 != ?w41) &&
     (?w12 != ?w22) && (?w12 != ?w32) && (?w12 != ?w42) && (?w22 != ?w32) && 
(?w22 != ?w42) && (?w32 != ?w42) &&
     (?w13 != ?w23) && (?w13 != ?w33) && (?w13 != ?w43) && (?w32 != ?w33) && 
(?w23 != ?w43) && (?w33 != ?w43) &&
     (?w14 != ?w24) && (?w14 != ?w43) && (?w14 != ?w44) && (?w42 != ?w34) && 
(?w24 != ?w44) && (?w43 != ?w44) &&
   
     (?w11 != ?w22) && (?w12 != ?w21 ) &&
     (?w13 != ?w24) && (?w23 != ?w14 ) &&
     (?w31 != ?w42) && (?w32 != ?w41 ) &&
     (?w33 != ?w44) && (?w34 != ?w43 ) &&
   
     # Initial field
     (?w11 = 1 ) &&
     (?w22 = 2 ) &&
     (?w33 = 4 ) &&
     (?w44 = 3 )
   )
   }
   ```


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to