]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Remove some debug/test code from percentile. Make the extension easier to
authordrh <>
Mon, 2 Sep 2024 14:46:56 +0000 (14:46 +0000)
committerdrh <>
Mon, 2 Sep 2024 14:46:56 +0000 (14:46 +0000)
statically link.

FossilOrigin-Name: 6e5f146e274b210749dd8923a2da56905eb098b5a66699ff9130e3e51b1ff662

ext/misc/percentile.c
manifest
manifest.uuid

index 320d7a5301ae3b9d5d995c30f46462625db33927..2d0c578307f7c573d9c1b2ba1e97a84618e267ac 100644 (file)
 **     often small.  The developers might revisit that decision later,
 **     should the need arise.
 */
-#ifdef SQLITE_STATIC_PERCENTILE
+#if defined(SQLITE3_H)
+  /* no-op */
+#elif defined(SQLITE_STATIC_PERCENTILE)
 #  include "sqlite3.h"
 #else
 #  include "sqlite3ext.h"
@@ -171,19 +173,6 @@ static int percentSameValue(double a, double b){
   return a>=-0.001 && a<=0.001;
 }
 
-#if 0
-/* Verify that the elements of the Percentile p are in fact sorted.
-** Used for testing and debugging only.
-*/
-static void percentAssertSorted(Percentile *p){
-  int i;
-  for(i=p->nUsed-2; i>=0 && p->a[i]<=p->a[i+1]; i--){}
-  assert( i<0 );
-}
-#else
-# define percentAssertSorted(X)
-#endif
-
 /*
 ** Search p (which must have p->bSorted) looking for an entry with
 ** value y.  Return the index of that entry.
@@ -317,7 +306,6 @@ static void percentStep(sqlite3_context *pCtx, int argc, sqlite3_value **argv){
     p->a[p->nUsed++] = y;
   }else if( p->bKeepSorted ){
     int i;
-    percentAssertSorted(p);
     i = percentBinarySearch(p, y, 0);
     if( i<p->nUsed ){
       memmove(&p->a[i+1], &p->a[i], (p->nUsed-i)*sizeof(p->a[0]));
@@ -428,8 +416,6 @@ static void percentInverse(sqlite3_context *pCtx,int argc,sqlite3_value **argv){
     assert( p->nUsed>1 );
     percentSort(p->a, p->nUsed);
     p->bSorted = 1;
-  }else{
-    percentAssertSorted(p);
   }
   p->bKeepSorted = 1;
 
@@ -441,7 +427,6 @@ static void percentInverse(sqlite3_context *pCtx,int argc,sqlite3_value **argv){
       memmove(&p->a[i], &p->a[i+1], (p->nUsed - i)*sizeof(p->a[0]));
     }
   }
-  percentAssertSorted(p);
 }
 
 /*
@@ -462,8 +447,6 @@ static void percentCompute(sqlite3_context *pCtx, int bIsFinal){
       assert( p->nUsed>1 );
       percentSort(p->a, p->nUsed);
       p->bSorted = 1;
-    }else{
-      percentAssertSorted(p);
     }
     ix = p->rPct*(p->nUsed-1);
     i1 = (unsigned)ix;
@@ -501,7 +484,7 @@ int sqlite3_percentile_init(
 ){
   int rc = SQLITE_OK;
   int i;
-#ifdef SQLITE_STATIC_PERCENTILE
+#if defined(SQLITE3_H) || defined(SQLITE_STATIC_PERCENTILE)
   (void)pApi;      /* Unused parameter */
 #else
   SQLITE_EXTENSION_INIT2(pApi);
index cce3a0815cc4913cecc14a7414e9f9c227ed22ef..c08ccd55027921c42771a20695c3d83bc0472ef3 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Enhance\sthe\spercentile\sextension\sto\ssupport\spercentile_cont()\sand\npercentile_disc().\s\sAdd\ssupport\sfor\sordered-set\saggregate\snotation\sin\s\nthe\sparser\swhen\scompiling\swith\sSQLITE_ENABLE_ORDERED_SET_AGGREGATES.\s\sA\nnew\sfunction\sproperty\sSQLITE_SELFORDER1\smust\sappear\son\sany\saggregate\sfunction\nthat\swants\sto\stake\sadvantage\sof\sthe\sordered-set\saggregate\snotation.
-D 2024-09-02T12:07:37.155
+C Remove\ssome\sdebug/test\scode\sfrom\spercentile.\s\sMake\sthe\sextension\seasier\sto\nstatically\slink.
+D 2024-09-02T14:46:56.875
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -410,7 +410,7 @@ F ext/misc/nextchar.c 7877914c2a80c2f181dd04c3dbef550dfb54c93495dc03da2403b5dd58
 F ext/misc/noop.c f1a21cc9b7a4e667e5c8458d80ba680b8bd4315a003f256006046879f679c5a0
 F ext/misc/normalize.c bd84355c118e297522aba74de34a4fd286fc775524e0499b14473918d09ea61f
 F ext/misc/pcachetrace.c f4227ce03fb16aa8d6f321b72dd051097419d7a028a9853af048bee7645cb405
-F ext/misc/percentile.c 4e333fc78d2a7b9cf362e29f30fa3f486cdab9e69fbc9aa0f680399683aa22f7
+F ext/misc/percentile.c 519498f4b1da580c309f6101bad8ed75dae8b14b1cedeb9ed5674c5ba56dcfd8
 F ext/misc/prefixes.c 82645f79229877afab08c8b08ca1e7fa31921280906b90a61c294e4f540cd2a6
 F ext/misc/qpvtab.c fc189e127f68f791af90a487f4460ec91539a716daf45a0c357e963fd47cc06c
 F ext/misc/randomjson.c ef835fc64289e76ac4873b85fe12f9463a036168d7683cf2b773e36e6262c4ed
@@ -2211,8 +2211,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 9f84e8d59bcda642e732565e840f6a880a01b2fc65af2651248f6a8a6e1cb65a e1bca168e70335fa2f9537632fd16e374c566a564fab4974c0b8f61cb63d08ce
-R a80c34160df19b1603ad0e7833a0d0c3
+P 557bd245ef24af15da1374762bbeb9b8b0241da06e604efdf00d567a9ed09216
+R ec683c52072c14116d879dab2762a8e0
 U drh
-Z bcaae55c6dbf3569256cb9e1e280cac1
+Z 2046e8e3b6b1593905ac362bd0920672
 # Remove this line to create a well-formed Fossil manifest.
index dfe5de4fea7c833cd598e6436c9c4ee940b9cdcc..df5cc5da3d626d21f0c9ef9d0c4280e64d351063 100644 (file)
@@ -1 +1 @@
-557bd245ef24af15da1374762bbeb9b8b0241da06e604efdf00d567a9ed09216
+6e5f146e274b210749dd8923a2da56905eb098b5a66699ff9130e3e51b1ff662