From: drh <> Date: Mon, 18 Apr 2022 11:22:46 +0000 (+0000) Subject: Change the row-value initialization subroutine call from within the X-Git-Tag: version-3.39.0~206^2~32 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a1848a5d225a1abf434d2d2da83d3f808951effc;p=thirdparty%2Fsqlite.git Change the row-value initialization subroutine call from within the right-join body subroutine from an issue to an optimization opportunity. FossilOrigin-Name: 829d49f27c041651ffeadc1397e4dd87a9994c9290e13b93542dbd2c514769cd --- diff --git a/manifest b/manifest index 618e2ae14f..ed0f446fb0 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Do\snot\sallow\san\sempty\stable\sbypass\sto\sjump\soutside\sof\sa\sright-join\sbody\nsubroutine. -D 2022-04-18T10:26:50.482 +C Change\sthe\srow-value\sinitialization\ssubroutine\scall\sfrom\swithin\sthe\nright-join\sbody\ssubroutine\sfrom\san\sissue\sto\san\soptimization\sopportunity. +D 2022-04-18T11:22:46.211 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -1147,7 +1147,7 @@ F test/join4.test 1a352e4e267114444c29266ce79e941af5885916 F test/join5.test c4df54e2e204d7f1417bfbdd21ca324b4b07415c647595cc47798eacfddc96d3 F test/join6.test f809c025fa253f9e150c0e9afd4cef8813257bceeb6f46e04041228c9403cc2c F test/join7.test e5c9b1b729d7e1d0b4195e99833e0ff0cf2d88e7fdd32b49af1044f4c76f72d9 -F test/join8.test 8a4cea60cc57ad95f0c718f460d86a7a239fbb50eaf2fa37b66d5f195f40220c +F test/join8.test 6ed7eed8993e060e5e9d07f6bcadf1bb634742a03b9824afbcfa193adf7f9965 F test/join9.test afd899f0bda3db6d5fefae2275ad91802d056c7dcd109030100b87e0b75f47ff F test/journal1.test c7b768041b7f494471531e17abc2f4f5ebf9e5096984f43ed17c4eb80ba34497 F test/journal2.test 9dac6b4ba0ca79c3b21446bbae993a462c2397c4 @@ -1948,8 +1948,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 07ed0dca310d828f9fe152efa8ee2a89202771a8f661afa1dbeee34aaabef67a -R a87b222d27880866b7dfd28f3fc0e49d +P 1549dcd2353903b70abadd428eeef971ab940df04fb05a6b83b04ee30932db6d +R bf21b74f8101c167d0386cef1bd86b5d U drh -Z 6dba88c851bb0b27e425f682c55f1888 +Z 5ad80f89a1f49f3de1c0f70362c7802e # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 176d66942a..f65776145d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1549dcd2353903b70abadd428eeef971ab940df04fb05a6b83b04ee30932db6d \ No newline at end of file +829d49f27c041651ffeadc1397e4dd87a9994c9290e13b93542dbd2c514769cd \ No newline at end of file diff --git a/test/join8.test b/test/join8.test index c99b0f8c64..5ef85c4cf8 100644 --- a/test/join8.test +++ b/test/join8.test @@ -22,18 +22,39 @@ do_execsql_test join8-10 { SELECT avg(DISTINCT b) FROM (SELECT * FROM t2 LEFT RIGHT JOIN t1 ON c); } {NULL} -# Pending issue #1: +# Pending optimization opportunity: # Row-value initialization subroutines must be called from with the # RIGHT JOIN body subroutine before the first use of any register containing # the results of that subroutine. This seems dodgy. Test case: # -# CREATE TABLE t1(a INTEGER PRIMARY KEY AUTOINCREMENT,b,c,d,e,f,g,h,j,k,l,m,n,o,p,q,r,s); -# CREATE INDEX t1x1 ON t1(g+h,j,k); -# CREATE INDEX t1x2 ON t1(b); -# INSERT INTO t1 DEFAULT VALUES; -# SELECT a FROM (SELECT a FROM (SELECT a FROM (SELECT a FROM t1 NATURAL LEFT JOIN t1 WHERE (b, 2 ) IS ( SELECT 2 IN(2,2),2)) NATURAL LEFT FULL JOIN t1 WHERE ( rowid , 1 )<=(CASE 5 WHEN 619 THEN 841 ELSE 3374391096 END,0) ORDER BY a ASC) NATURAL LEFT JOIN t1 WHERE (b, 2 ) IS ( SELECT 3 IN(3,3),3)) NATURAL LEFT FULL JOIN t1 WHERE ( rowid , 1 )<=(CASE 5 WHEN 619 THEN 841 ELSE 3374391096 END,0) ORDER BY a ASC; -# -do_test join8-issue-1 {set rc "Issue-1 'row-value subroutine' unresolved"} {} +reset_db +do_execsql_test join8-1000 { + CREATE TABLE t1(a INTEGER PRIMARY KEY AUTOINCREMENT,b,c,d,e,f,g,h,j,k,l,m,n,o,p,q,r,s); + CREATE INDEX t1x1 ON t1(g+h,j,k); + CREATE INDEX t1x2 ON t1(b); + INSERT INTO t1 DEFAULT VALUES; +} {} +do_catchsql_test join8-1010 { + SELECT a + FROM ( + SELECT a + FROM ( + SELECT a + FROM ( + SELECT a FROM t1 NATURAL LEFT JOIN t1 + WHERE (b, 2 ) IS ( SELECT 2 IN(2,2),2) + ) + NATURAL LEFT FULL JOIN t1 + WHERE ( rowid , 1 )<=(CASE 5 WHEN 619 THEN 841 ELSE 3374391096 END,0) + ORDER BY a ASC + ) + NATURAL LEFT JOIN t1 + WHERE (b, 2 ) IS ( SELECT 3 IN(3,3),3) + ) + NATURAL LEFT FULL JOIN t1 + WHERE ( rowid , 1 )<=(CASE 5 WHEN 619 THEN 841 ELSE 3374391096 END,0) + ORDER BY a ASC; +} {0 1} # Pending issue #2: (now resolved) # Jump to addrHalt inside the RIGHT JOIN body subroutine bypasses the