Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Unified Diff: third_party/sqlite/src/ext/rtree/rtreeC.test

Issue 1610963002: Import SQLite 3.10.2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/sqlite/src/ext/rtree/rtree9.test ('k') | third_party/sqlite/src/ext/rtree/rtreeE.test » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/sqlite/src/ext/rtree/rtreeC.test
diff --git a/third_party/sqlite/src/ext/rtree/rtreeC.test b/third_party/sqlite/src/ext/rtree/rtreeC.test
index 94db05a4d1b77bda2bdfe427e34c49e051a99dcf..9a64df51d5374126cf3cc087600e18b2de4b2e02 100644
--- a/third_party/sqlite/src/ext/rtree/rtreeC.test
+++ b/third_party/sqlite/src/ext/rtree/rtreeC.test
@@ -269,5 +269,88 @@ ifcapable rtree {
db close
}
+#--------------------------------------------------------------------
+# Test that queries featuring LEFT or CROSS JOINS are handled correctly.
+# Handled correctly in this case means:
+#
+# * Terms with prereqs that appear to the left of a LEFT JOIN against
+# the virtual table are always available to xBestIndex.
+#
+# * Terms with prereqs that appear to the right of a LEFT JOIN against
+# the virtual table are never available to xBestIndex.
+#
+# And the same behaviour for CROSS joins.
+#
+reset_db
+do_execsql_test 7.0 {
+ CREATE TABLE xdir(x1);
+ CREATE TABLE ydir(y1);
+ CREATE VIRTUAL TABLE rt USING rtree_i32(id, xmin, xmax, ymin, ymax);
+
+ INSERT INTO xdir VALUES(5);
+ INSERT INTO ydir VALUES(10);
+
+ INSERT INTO rt VALUES(1, 2, 7, 12, 14); -- Not a hit
+ INSERT INTO rt VALUES(2, 2, 7, 8, 12); -- A hit!
+ INSERT INTO rt VALUES(3, 7, 11, 8, 12); -- Not a hit!
+ INSERT INTO rt VALUES(4, 5, 5, 10, 10); -- A hit!
+
+}
+
+proc do_eqp_execsql_test {tn sql res} {
+ set query "EXPLAIN QUERY PLAN $sql ; $sql "
+ uplevel [list do_execsql_test $tn $query $res]
+}
+
+do_eqp_execsql_test 7.1 {
+ SELECT id FROM xdir, rt, ydir
+ ON (y1 BETWEEN ymin AND ymax)
+ WHERE (x1 BETWEEN xmin AND xmax);
+} {
+ 0 0 0 {SCAN TABLE xdir}
+ 0 1 2 {SCAN TABLE ydir}
+ 0 2 1 {SCAN TABLE rt VIRTUAL TABLE INDEX 2:B2D3B0D1}
+ 2 4
+}
+
+do_eqp_execsql_test 7.2 {
+ SELECT * FROM xdir, rt LEFT JOIN ydir
+ ON (y1 BETWEEN ymin AND ymax)
+ WHERE (x1 BETWEEN xmin AND xmax);
+} {
+ 0 0 0 {SCAN TABLE xdir}
+ 0 1 1 {SCAN TABLE rt VIRTUAL TABLE INDEX 2:B0D1}
+ 0 2 2 {SCAN TABLE ydir}
+
+ 5 1 2 7 12 14 {}
+ 5 2 2 7 8 12 10
+ 5 4 5 5 10 10 10
+}
+
+do_eqp_execsql_test 7.3 {
+ SELECT id FROM xdir, rt CROSS JOIN ydir
+ ON (y1 BETWEEN ymin AND ymax)
+ WHERE (x1 BETWEEN xmin AND xmax);
+} {
+ 0 0 0 {SCAN TABLE xdir}
+ 0 1 1 {SCAN TABLE rt VIRTUAL TABLE INDEX 2:B0D1}
+ 0 2 2 {SCAN TABLE ydir}
+ 2 4
+}
+
+do_eqp_execsql_test 7.4 {
+ SELECT id FROM rt, xdir CROSS JOIN ydir
+ ON (y1 BETWEEN ymin AND ymax)
+ WHERE (x1 BETWEEN xmin AND xmax);
+} {
+ 0 0 1 {SCAN TABLE xdir}
+ 0 1 0 {SCAN TABLE rt VIRTUAL TABLE INDEX 2:B0D1}
+ 0 2 2 {SCAN TABLE ydir}
+ 2 4
+}
+
+finish_test
+
+
finish_test
« no previous file with comments | « third_party/sqlite/src/ext/rtree/rtree9.test ('k') | third_party/sqlite/src/ext/rtree/rtreeE.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698