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

Unified Diff: third_party/sqlite/src/test/tkt-b75a9ca6b0.test

Issue 949043002: Add //third_party/sqlite to dirs_to_snapshot, remove net_sql.patch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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/test/tkt-b72787b1.test ('k') | third_party/sqlite/src/test/tkt-ba7cbfaedc.test » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/sqlite/src/test/tkt-b75a9ca6b0.test
diff --git a/third_party/sqlite/src/test/tkt-b75a9ca6b0.test b/third_party/sqlite/src/test/tkt-b75a9ca6b0.test
new file mode 100644
index 0000000000000000000000000000000000000000..0c81a534da500031cfe7fca6b0b096ae7cb1bf98
--- /dev/null
+++ b/third_party/sqlite/src/test/tkt-b75a9ca6b0.test
@@ -0,0 +1,77 @@
+# 2014-04-21
+#
+# The author disclaims copyright to this source code. In place of
+# a legal notice, here is a blessing:
+#
+# May you do good and not evil.
+# May you find forgiveness for yourself and forgive others.
+# May you share freely, never taking more than you give.
+#
+#*************************************************************************
+#
+# Test that ticket [b75a9ca6b0] has been fixed.
+#
+# Ticket [b75a9ca6b0] concerns queries that have both a GROUP BY
+# and an ORDER BY. This code verifies that SQLite is able to
+# optimize out the ORDER BY in some circumstances, but retains the
+# ORDER BY when necessary.
+#
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+set testprefix tkt-b75a9ca6b0
+
+do_execsql_test 1 {
+ CREATE TABLE t1 (x, y);
+ INSERT INTO t1 VALUES (1, 3);
+ INSERT INTO t1 VALUES (2, 2);
+ INSERT INTO t1 VALUES (3, 1);
+}
+
+do_execsql_test 1.1 {
+ CREATE INDEX i1 ON t1(x, y);
+}
+
+set idxscan {0 0 0 {SCAN TABLE t1 USING COVERING INDEX i1}}
+set tblscan {0 0 0 {SCAN TABLE t1}}
+set grpsort {0 0 0 {USE TEMP B-TREE FOR GROUP BY}}
+set sort {0 0 0 {USE TEMP B-TREE FOR ORDER BY}}
+
+foreach {tn q res eqp} [subst -nocommands {
+ 1 "SELECT * FROM t1 GROUP BY x, y ORDER BY x,y"
+ {1 3 2 2 3 1} {$idxscan}
+
+ 2 "SELECT * FROM t1 GROUP BY x, y ORDER BY x"
+ {1 3 2 2 3 1} {$idxscan $sort}
+
+ 3 "SELECT * FROM t1 GROUP BY y, x ORDER BY y, x"
+ {3 1 2 2 1 3} {$idxscan $sort}
+
+ 4 "SELECT * FROM t1 GROUP BY x ORDER BY x"
+ {1 3 2 2 3 1} {$idxscan}
+
+ 5 "SELECT * FROM t1 GROUP BY y ORDER BY y"
+ {3 1 2 2 1 3} {$tblscan $grpsort}
+
+ 6 "SELECT * FROM t1 GROUP BY y ORDER BY x"
+ {1 3 2 2 3 1} {$tblscan $grpsort $sort}
+
+ 7 "SELECT * FROM t1 GROUP BY x, y ORDER BY x, y DESC"
+ {1 3 2 2 3 1} {$idxscan $sort}
+
+ 8 "SELECT * FROM t1 GROUP BY x, y ORDER BY x DESC, y DESC"
+ {3 1 2 2 1 3} {$idxscan $sort}
+
+ 9 "SELECT * FROM t1 GROUP BY x, y ORDER BY x ASC, y ASC"
+ {1 3 2 2 3 1} {$idxscan}
+
+ 10 "SELECT * FROM t1 GROUP BY x, y ORDER BY x COLLATE nocase, y"
+ {1 3 2 2 3 1} {$idxscan $sort}
+
+}] {
+ do_execsql_test 1.$tn.1 $q $res
+ do_eqp_test 1.$tn.2 $q $eqp
+}
+
+
+finish_test
« no previous file with comments | « third_party/sqlite/src/test/tkt-b72787b1.test ('k') | third_party/sqlite/src/test/tkt-ba7cbfaedc.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698