Small optimizations to the grammar for window functions save about 120 bytes

of space in the parser tables.

FossilOrigin-Name: bce01d9584e52b23d7c07c2e832d5fa5d6e6235711c856b903a296725f61ed6e
This commit is contained in:
drh 2019-04-02 18:12:20 +00:00
parent 94809086e5
commit 0f134f0267
3 changed files with 22 additions and 25 deletions

View File

@ -1,5 +1,5 @@
C Use\sa\sseparate\sbit\son\sdb->dbOptFlags\sto\sdisable\sthe\sxInverse\soptimization\son\nwindow\sfunctions,\srather\sthan\sreusing\sthe\squery-flattener\sdisable\sbit.
D 2019-04-02T17:45:56.576
C Small\soptimizations\sto\sthe\sgrammar\sfor\swindow\sfunctions\ssave\sabout\s120\sbytes\nof\sspace\sin\sthe\sparser\stables.
D 2019-04-02T18:12:20.162
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -506,7 +506,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 db16b24caee36f68746fd4748cab3c53238a8a4a78587659733e41c84d7be36d
F src/parse.y 209b0e396a1bde1e4b515b86d00b5b1d3f6e13ba7edf3adb6acd41fa8560edf0
F src/pcache.c 696a01f1a6370c1b50a09c15972bc3bee3333f8fcd1f2da8e9a76b1b062c59ee
F src/pcache.h 4f87acd914cef5016fae3030343540d75f5b85a1877eed1a2a19b9f284248586
F src/pcache1.c a72804486dfa8e4b6bc30d666c97ecf1155f91a4351fc6e48ea4097e4eb304fb
@ -1815,7 +1815,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 10aedce3dd2c0c9f0ee9e0aefd0b4d2c2eb17c4ca72003c4db9768ea5cdafcf4
R f1a10ca86f18e0715bc6dca126e4cb23
P bc0fb1c324be2fd668bc4398c7d364b7e3c5a98537fe5fb58a125b66f3e6d041
R 31f79484d2e9bc79fcf8ee7f9041a857
U drh
Z eb8e54dc09491a0338a5611748ad5dd1
Z 869b3f84b6baf5642194100f15e4c54e

View File

@ -1 +1 @@
bc0fb1c324be2fd668bc4398c7d364b7e3c5a98537fe5fb58a125b66f3e6d041
bce01d9584e52b23d7c07c2e832d5fa5d6e6235711c856b903a296725f61ed6e

View File

@ -1694,33 +1694,30 @@ frame_opt(A) ::= . {
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) frame_exclude_opt(W). {
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; }
range_or_rows(A) ::= ROWS. { A = TK_ROWS; }
range_or_rows(A) ::= GROUPS. { A = TK_GROUPS;}
range_or_rows(A) ::= RANGE|ROWS|GROUPS(X). {A = @X; /*A-overwrites-X*/}
frame_bound_s(A) ::= frame_bound(X). {A = X;}
frame_bound_s(A) ::= UNBOUNDED(X) PRECEDING. {A.eType = @X; A.pExpr = 0;}
frame_bound_e(A) ::= frame_bound(X). {A = X;}
frame_bound_e(A) ::= UNBOUNDED(X) FOLLOWING. {A.eType = @X; A.pExpr = 0;}
frame_bound_s(A) ::= frame_bound(X). { A = X; }
frame_bound_s(A) ::= UNBOUNDED PRECEDING. {A.eType = TK_UNBOUNDED; A.pExpr = 0;}
frame_bound_e(A) ::= frame_bound(X). { A = X; }
frame_bound_e(A) ::= UNBOUNDED FOLLOWING. {A.eType = TK_UNBOUNDED; A.pExpr = 0;}
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; }
frame_bound(A) ::= expr(X) PRECEDING|FOLLOWING(Y).
{A.eType = @Y; A.pExpr = X;}
frame_bound(A) ::= CURRENT(X) ROW. {A.eType = @X; A.pExpr = 0;}
%type frame_exclude_opt {u8}
frame_exclude_opt(A) ::= . { A = 0; }
frame_exclude_opt(A) ::= EXCLUDE frame_exclude(X). { A = X; }
frame_exclude_opt(A) ::= . {A = 0;}
frame_exclude_opt(A) ::= EXCLUDE frame_exclude(X). {A = X;}
%type frame_exclude {u8}
frame_exclude(A) ::= NO OTHERS. { A = TK_NO; }
frame_exclude(A) ::= CURRENT ROW. { A = TK_CURRENT; }
frame_exclude(A) ::= GROUP. { A = TK_GROUP; }
frame_exclude(A) ::= TIES. { A = TK_TIES; }
frame_exclude(A) ::= NO(X) OTHERS. {A = @X; /*A-overwrites-X*/}
frame_exclude(A) ::= CURRENT(X) ROW. {A = @X; /*A-overwrites-X*/}
frame_exclude(A) ::= GROUP|TIES(X). {A = @X; /*A-overwrites-X*/}
%type window_clause {Window*}