]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Parse EXCLUDE clauses in window frames. They do not yet work.
authordan <dan@noemail.net>
Thu, 14 Mar 2019 20:53:21 +0000 (20:53 +0000)
committerdan <dan@noemail.net>
Thu, 14 Mar 2019 20:53:21 +0000 (20:53 +0000)
FossilOrigin-Name: d03c7533a1e993f1b12392a5193b2127484307b27072236a1255e7a30849a381

manifest
manifest.uuid
src/parse.y
src/sqliteInt.h
src/window.c
tool/mkkeywordhash.c

index d986fbd0eda262fb2bcbe6b256d14807223f16f8..20b267b2acbd78307fa04a18a552f67990e06847 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\sthings\sto\sthis\sbranch\sthat\swill\sbe\srequired\sto\ssupport\sthe\sEXCLUDE\sclause.
-D 2019-03-14T16:36:20.268
+C Parse\sEXCLUDE\sclauses\sin\swindow\sframes.\sThey\sdo\snot\syet\swork.
+D 2019-03-14T20:53:21.947
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F Makefile.in 236d2739dc3e823c3c909bca2d6cef93009bafbefd7018a8f3281074ecb92954
@@ -504,7 +504,7 @@ F src/os_win.c 85d9e532d0444ab6c16d7431490c2e279e282aa0917b0e988996b1ae0de5c5a0
 F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a
 F src/pager.c 422fd8cfa59fb9173eff36a95878904a0eeb0dcc62ba49350acc8b1e51c4dc7b
 F src/pager.h 217921e81eb5fe455caa5cda96061959706bcdd29ddb57166198645ef7822ac3
-F src/parse.y e5628381465b183e96af2508dd49dd3c2d760b4c49f079e59bacb0157e9728e2
+F src/parse.y a2a79da71f0c7c650a7ad84e0586c323441722b1af00ee19ae7dae91e5ae0432
 F src/pcache.c 696a01f1a6370c1b50a09c15972bc3bee3333f8fcd1f2da8e9a76b1b062c59ee
 F src/pcache.h 4f87acd914cef5016fae3030343540d75f5b85a1877eed1a2a19b9f284248586
 F src/pcache1.c a72804486dfa8e4b6bc30d666c97ecf1155f91a4351fc6e48ea4097e4eb304fb
@@ -520,7 +520,7 @@ F src/shell.c.in 01c0cc01391d00d247fdf640052d38c267fc16d975bc4f3154a02277c232dbe
 F src/sqlite.h.in 02be315feaf20c06028aacf3b032b5e7211e9aae066284eef77b081646b43ea0
 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
 F src/sqlite3ext.h 960f1b86c3610fa23cb6a267572a97dcf286e77aa0dd3b9b23292ffaa1ea8683
-F src/sqliteInt.h bd6a2cc9ccb88e405146d4b1424fda697592b7ecc5c0ca2c65b0d5bb58df85b5
+F src/sqliteInt.h a8a26cacf0bcb599c7f54f000acf39350f0815c53bb7fe099118ff38ede6ec7a
 F src/sqliteLimit.h 1513bfb7b20378aa0041e7022d04acb73525de35b80b252f1b83fedb4de6a76b
 F src/status.c 46e7aec11f79dad50965a5ca5fa9de009f7d6bde08be2156f1538a0a296d4d0e
 F src/table.c b46ad567748f24a326d9de40e5b9659f96ffff34
@@ -604,7 +604,7 @@ F src/where.c 8a207cb2ca6b99e1edb1e4bbff9b0504385a759cbf66180d1deb34d80ca4b799
 F src/whereInt.h 5f14db426ca46a83eabab1ae9aa6d4b8f27504ad35b64c290916289b1ddb2e88
 F src/wherecode.c ce7b21e1be2b981d62683fc59c4ca73a04a7ff2f1ebec23d41baf2da2349afd6
 F src/whereexpr.c 90859652920f153d2c03f075488744be2926625ebd36911bcbcb17d0d29c891c
-F src/window.c 8b3081e3fe6c9f5837332e027090dd5e5e9949fc9f1997f186198c18d348e79d
+F src/window.c 5b103f63d78bef864a4e1a0877cdc9cc11a6d9eee2dff10f36ef8cc6b737f574
 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
 F test/affinity2.test a6d901b436328bd67a79b41bb0ac2663918fe3bd
 F test/affinity3.test 6a101af2fc945ce2912f6fe54dd646018551710d
@@ -1740,7 +1740,7 @@ F tool/max-limits.c cbb635fbb37ae4d05f240bfb5b5270bb63c54439
 F tool/mkautoconfamal.sh 422fc365358a2e92876ffc62971a0ff28ed472fc8bcf9de0df921c736fdeca5e
 F tool/mkccode.tcl 86463e68ce9c15d3041610fedd285ce32a5cf7a58fc88b3202b8b76837650dbe x
 F tool/mkctimec.tcl dd183b73ae1c28249669741c250525f0407e579a70482371668fd5f130d9feb3
-F tool/mkkeywordhash.c a5a59223d2651161445164dcd2a73b202cf617109d041fdfe2816fc939790b13
+F tool/mkkeywordhash.c 127d0b86eea32a461b79b6c6b11fa5fd223787b681156d682bf1824bb20e2494
 F tool/mkmsvcmin.tcl cad0c7b54d7dd92bc87d59f36d4cc4f070eb2e625f14159dc2f5c4204e6a13ea
 F tool/mkopcodec.tcl d1b6362bd3aa80d5520d4d6f3765badf01f6c43c
 F tool/mkopcodeh.tcl 352a4319c0ad869eb26442bf7c3b015aa15594c21f1cce5a6420dbe999367c21
@@ -1812,7 +1812,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 0b904517bd6c4c59082381577246d3d2351b4265fc9151438ee4c33cf16f2eb1
-R c5679ad9066e2a8eceb4f5175a82147b
+P 7d66cd2013206ebad50c7cdb7dab9211fa8b47f5cb7067dcb314b3e0180875f8
+R 992c67620360ca6f1c52dae5b2723d58
 U dan
-Z ec90fdebe5542b0f73c320cb419d4b34
+Z e9244ddbbaf590a1fc94a4cdbe19ee60
index fad7517db63e01b163265d8c2f4a9115d97abcaa..13f7b671aec45663de84b19b7d76d24c460215f9 100644 (file)
@@ -1 +1 @@
-7d66cd2013206ebad50c7cdb7dab9211fa8b47f5cb7067dcb314b3e0180875f8
\ No newline at end of file
+d03c7533a1e993f1b12392a5193b2127484307b27072236a1255e7a30849a381
\ No newline at end of file
index f8701534ec2acbfc3ef87b76c7c8c91dbebfd4e2..dcbc3131972a6c4d72d8e8d2111b88ac8633751f 100644 (file)
@@ -1688,13 +1688,13 @@ window(A) ::= nm(W) frame_opt(Z). {
 }
 
 frame_opt(A) ::= .                             { 
-  A = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0);
+  A = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0);
 }
-frame_opt(A) ::= range_or_rows(X) frame_bound_s(Y). { 
-  A = sqlite3WindowAlloc(pParse, X, Y.eType, Y.pExpr, TK_CURRENT, 0);
+frame_opt(A) ::= range_or_rows(X) frame_bound_s(Y) frame_exclude_opt(Z). { 
+  A = sqlite3WindowAlloc(pParse, X, Y.eType, Y.pExpr, TK_CURRENT, 0, Z);
 }
-frame_opt(A) ::= range_or_rows(X) BETWEEN frame_bound_s(Y) AND frame_bound_e(Z). { 
-  A = sqlite3WindowAlloc(pParse, X, Y.eType, Y.pExpr, Z.eType, Z.pExpr);
+frame_opt(A) ::= range_or_rows(X) BETWEEN frame_bound_s(Y) AND frame_bound_e(Z) frame_exclude_opt(W). { 
+  A = sqlite3WindowAlloc(pParse, X, Y.eType, Y.pExpr, Z.eType, Z.pExpr, W);
 }
 
 range_or_rows(A) ::= RANGE.   { A = TK_RANGE; }
@@ -1711,6 +1711,17 @@ frame_bound(A) ::= expr(X) PRECEDING.   { A.eType = TK_PRECEDING; A.pExpr = X; }
 frame_bound(A) ::= CURRENT ROW.         { A.eType = TK_CURRENT  ; A.pExpr = 0; }
 frame_bound(A) ::= expr(X) FOLLOWING.   { A.eType = TK_FOLLOWING; A.pExpr = X; }
 
+%type frame_exclude_opt {u8}
+frame_exclude_opt(A) ::= . { A = TK_NO; }
+frame_exclude_opt(A) ::= EXCLUDE frame_exclude(X). { A = X; }
+
+%type frame_exclude {u8}
+frame_exclude(A) ::= NO OTHERS.   { A = 0; }
+frame_exclude(A) ::= CURRENT ROW. { A = TK_CURRENT; }
+frame_exclude(A) ::= GROUP.       { A = TK_GROUP; }
+frame_exclude(A) ::= TIES.        { A = TK_TIES; }
+
+
 %type window_clause {Window*}
 %destructor window_clause {sqlite3WindowListDelete(pParse->db, $$);}
 window_clause(A) ::= WINDOW windowdefn_list(B). { A = B; }
index 8c878228e3ae46a8117fd3a4bff520aba3b03980..3bd02f1389f0fea65c3de2a71e6c05f5e92a1f19 100644 (file)
@@ -3585,7 +3585,7 @@ struct Window {
 #ifndef SQLITE_OMIT_WINDOWFUNC
 void sqlite3WindowDelete(sqlite3*, Window*);
 void sqlite3WindowListDelete(sqlite3 *db, Window *p);
-Window *sqlite3WindowAlloc(Parse*, int, int, Expr*, int , Expr*);
+Window *sqlite3WindowAlloc(Parse*, int, int, Expr*, int , Expr*, u8);
 void sqlite3WindowAttach(Parse*, Expr*, Window*);
 int sqlite3WindowCompare(Parse*, Window*, Window*);
 void sqlite3WindowCodeInit(Parse*, Window*);
index c17ea1dbbca9f630827ef5451ad705e6a1730cdf..83635edac72a6fcb865d5892252e6d7ceedb0df7 100644 (file)
@@ -994,7 +994,8 @@ Window *sqlite3WindowAlloc(
   int eStart,       /* Start type: CURRENT, PRECEDING, FOLLOWING, UNBOUNDED */
   Expr *pStart,     /* Start window size if TK_PRECEDING or FOLLOWING */
   int eEnd,         /* End type: CURRENT, FOLLOWING, TK_UNBOUNDED, PRECEDING */
-  Expr *pEnd        /* End window size if TK_FOLLOWING or PRECEDING */
+  Expr *pEnd,       /* End window size if TK_FOLLOWING or PRECEDING */
+  u8 eExclude       /* EXCLUDE clause */
 ){
   Window *pWin = 0;
   int bImplicitFrame = 0;
@@ -1039,6 +1040,7 @@ Window *sqlite3WindowAlloc(
   pWin->eType = eType;
   pWin->eStart = eStart;
   pWin->eEnd = eEnd;
+  pWin->eExclude = eExclude;
   pWin->bImplicitFrame = bImplicitFrame;
   pWin->pEnd = sqlite3WindowOffsetExpr(pParse, pEnd);
   pWin->pStart = sqlite3WindowOffsetExpr(pParse, pStart);
index a3f9d2981600a68208b19bafe27ced2c4699f283..8e0314a2cd503f84285dc4dd70f081f40845ce8a 100644 (file)
@@ -205,6 +205,7 @@ static Keyword aKeywordTable[] = {
   { "ESCAPE",           "TK_ESCAPE",       ALWAYS                 },
   { "EXCEPT",           "TK_EXCEPT",       COMPOUND               },
   { "EXCLUSIVE",        "TK_EXCLUSIVE",    ALWAYS                 },
+  { "EXCLUDE",          "TK_EXCLUDE",      WINDOWFUNC             },
   { "EXISTS",           "TK_EXISTS",       ALWAYS                 },
   { "EXPLAIN",          "TK_EXPLAIN",      EXPLAIN                },
   { "FAIL",             "TK_FAIL",         CONFLICT|TRIGGER       },
@@ -239,7 +240,7 @@ static Keyword aKeywordTable[] = {
   { "LIMIT",            "TK_LIMIT",        ALWAYS                 },
   { "MATCH",            "TK_MATCH",        ALWAYS                 },
   { "NATURAL",          "TK_JOIN_KW",      ALWAYS                 },
-  { "NO",               "TK_NO",           FKEY                   },
+  { "NO",               "TK_NO",           FKEY|WINDOWFUNC        },
   { "NOT",              "TK_NOT",          ALWAYS                 },
   { "NOTHING",          "TK_NOTHING",      UPSERT                 },
   { "NOTNULL",          "TK_NOTNULL",      ALWAYS                 },
@@ -249,6 +250,7 @@ static Keyword aKeywordTable[] = {
   { "ON",               "TK_ON",           ALWAYS                 },
   { "OR",               "TK_OR",           ALWAYS                 },
   { "ORDER",            "TK_ORDER",        ALWAYS                 },
+  { "OTHERS",           "TK_OTHERS",       WINDOWFUNC             },
   { "OUTER",            "TK_JOIN_KW",      ALWAYS                 },
   { "OVER",             "TK_OVER",         WINDOWFUNC             },
   { "PARTITION",        "TK_PARTITION",    WINDOWFUNC             },
@@ -278,6 +280,7 @@ static Keyword aKeywordTable[] = {
   { "TEMP",             "TK_TEMP",         ALWAYS                 },
   { "TEMPORARY",        "TK_TEMP",         ALWAYS                 },
   { "THEN",             "TK_THEN",         ALWAYS                 },
+  { "TIES",             "TK_TIES",         WINDOWFUNC             },
   { "TO",               "TK_TO",           ALWAYS                 },
   { "TRANSACTION",      "TK_TRANSACTION",  ALWAYS                 },
   { "TRIGGER",          "TK_TRIGGER",      TRIGGER                },