aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2014-10-25 13:42:16 +0000
committerdrh <drh@noemail.net>2014-10-25 13:42:16 +0000
commitd05ab6aacf08a1fd7af581cae4b28390ecd5c44c (patch)
treea0d6853758bf5745ff18c58bd46a650c12c0cf1c
parent051575cbf4c47fc472f53146e30d6ddddc9054b3 (diff)
downloadsqlite-d05ab6aacf08a1fd7af581cae4b28390ecd5c44c.tar.gz
sqlite-d05ab6aacf08a1fd7af581cae4b28390ecd5c44c.zip
Increase the resolution of the second parameter to the likelihood() SQL
function (the probability value) so that it can handle probabilities as small as 0.00000001. Formerly, it ran out of precision at 0.001. FossilOrigin-Name: 0f08924fe0c52a85a103f67bee9809e0f8f884b0
-rw-r--r--manifest16
-rw-r--r--manifest.uuid2
-rw-r--r--src/resolve.c4
-rw-r--r--src/sqliteInt.h2
-rw-r--r--src/where.c2
5 files changed, 13 insertions, 13 deletions
diff --git a/manifest b/manifest
index 28fa8e138..6d8395af5 100644
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Do\snot\suse\svirtual\s(and\shence\sredundant)\sWHERE-clause\sterms\sto\srestrict\sthe\ncontent\sof\sa\sautomatic\spartial\sindex.\s\sShow\swhen\san\sautomatic\spartial\sindex\nis\sused\sin\sthe\sEXPLAIN\sQUERY\sPLAN\soutput.
-D 2014-10-25T12:28:25.871
+C Increase\sthe\sresolution\sof\sthe\ssecond\sparameter\sto\sthe\slikelihood()\sSQL\nfunction\s(the\sprobability\svalue)\sso\sthat\sit\scan\shandle\sprobabilities\nas\ssmall\sas\s0.00000001.\s\sFormerly,\sit\sran\sout\sof\sprecision\sat\s0.001.
+D 2014-10-25T13:42:16.126
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in cf57f673d77606ab0f2d9627ca52a9ba1464146a
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -225,14 +225,14 @@ F src/pragma.c 3f3e959390a10c0131676f0e307acce372777e0f
F src/prepare.c 6ef0cf2f9274982988ed6b7cab1be23147e94196
F src/printf.c 090fac0f779c93c8a95089a125339686648835e4
F src/random.c d10c1f85b6709ca97278428fd5db5bbb9c74eece
-F src/resolve.c 57d5ad93913beb43ad9b8ade435a54e5fb8ccd40
+F src/resolve.c 4965007d6497b6a4d7a6d98751cc39712885f952
F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e
F src/select.c 428165951748151e87a15295b7357221433e311b
F src/shell.c 282f8f5278e0c78eb442217531172ec9e1538796
F src/sqlite.h.in 4a5e5158c189d2bcd45c7c4607c2c0eb6d25c153
F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad
F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d
-F src/sqliteInt.h 123b28f3552d4ffdd3e53707fe8120a069df69e4
+F src/sqliteInt.h 90519c3b3e8ee90adfce013234c4bd07275d77b5
F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d
F src/status.c 961d5926e5a8fda611d385ec22c226b8635cd1cb
F src/table.c 2e99ef7ef16187e17033d9398dc962ce22dab5cb
@@ -302,7 +302,7 @@ F src/vtab.c cb0c194303fea276b48d7d4b6d970b5a96bde8de
F src/wal.c 10e7de7ce90865a68153f001a61f1d985cd17983
F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4
F src/walker.c c253b95b4ee44b21c406e2a1052636c31ea27804
-F src/where.c 3312adfda33a9ca85c8a380a642a1a5905398b06
+F src/where.c 4ce8c4826b7f86d080f0ed4e7a9045bb5014be77
F src/whereInt.h 19279cd0664ce1d90b9ad3ef0108cb494acfe455
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
@@ -1206,7 +1206,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P d95d0313c447f5baeabdb17284d8606331ab7d49
-R 9499438a1fccf595ef80fbd4c31b20b8
+P b9ad601eab1d7298d369267eb697c7fa1bc16985
+R 06fd31d9e4c300e561fccc4cf28a702b
U drh
-Z cdff8327924b867b12e561826d5fe961
+Z 628a0c5751868817bd40f1740c611aef
diff --git a/manifest.uuid b/manifest.uuid
index 8b94233ae..3804da23b 100644
--- a/manifest.uuid
+++ b/manifest.uuid
@@ -1 +1 @@
-b9ad601eab1d7298d369267eb697c7fa1bc16985 \ No newline at end of file
+0f08924fe0c52a85a103f67bee9809e0f8f884b0 \ No newline at end of file
diff --git a/src/resolve.c b/src/resolve.c
index e507ccb81..8fb580b3a 100644
--- a/src/resolve.c
+++ b/src/resolve.c
@@ -584,7 +584,7 @@ static int exprProbability(Expr *p){
sqlite3AtoF(p->u.zToken, &r, sqlite3Strlen30(p->u.zToken), SQLITE_UTF8);
assert( r>=0.0 );
if( r>1.0 ) return -1;
- return (int)(r*1000.0);
+ return (int)(r*134217728.0);
}
/*
@@ -716,7 +716,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
** EVIDENCE-OF: R-53436-40973 The likely(X) function is equivalent to
** likelihood(X,0.9375). */
/* TUNING: unlikely() probability is 0.0625. likely() is 0.9375 */
- pExpr->iTable = pDef->zName[0]=='u' ? 62 : 938;
+ pExpr->iTable = pDef->zName[0]=='u' ? 8388608 : 125829120;
}
}
#ifndef SQLITE_OMIT_AUTHORIZATION
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index b7f992c34..5114ccccf 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -2000,7 +2000,7 @@ struct Expr {
int iTable; /* TK_COLUMN: cursor number of table holding column
** TK_REGISTER: register number
** TK_TRIGGER: 1 -> new, 0 -> old
- ** EP_Unlikely: 1000 times likelihood */
+ ** EP_Unlikely: 134217728 times likelihood */
ynVar iColumn; /* TK_COLUMN: column index. -1 for rowid.
** TK_VARIABLE: variable number (always >= 1). */
i16 iAgg; /* Which entry in pAggInfo->aCol[] or ->aFunc[] */
diff --git a/src/where.c b/src/where.c
index 2e42b8fc3..358d50826 100644
--- a/src/where.c
+++ b/src/where.c
@@ -225,7 +225,7 @@ static int whereClauseInsert(WhereClause *pWC, Expr *p, u8 wtFlags){
}
pTerm = &pWC->a[idx = pWC->nTerm++];
if( p && ExprHasProperty(p, EP_Unlikely) ){
- pTerm->truthProb = sqlite3LogEst(p->iTable) - 99;
+ pTerm->truthProb = sqlite3LogEst(p->iTable) - 270;
}else{
pTerm->truthProb = 1;
}