SQLite

Check-in [7558a0ad22]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix a problem involving detail=col and column filters.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | fts5-perf
Files: files | file ages | folders
SHA1: 7558a0ad2276e91f2faced8ea405d9fdb4fa0c6e
User & Date: dan 2016-01-23 14:45:36.706
Context
2016-01-23
16:20
Merge trunk changes (including fixes for warnings in fts5) with this branch. (check-in: ceccc9ad78 user: dan tags: fts5-perf)
14:45
Fix a problem involving detail=col and column filters. (check-in: 7558a0ad22 user: dan tags: fts5-perf)
2016-01-22
19:48
Experimental performance enhancements for fts5. (check-in: b5a57b812f user: dan tags: fts5-perf)
Changes
Unified Diff Ignore Whitespace Patch
Changes to ext/fts5/fts5_index.c.
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022

5023
5024
5025
5026
5027

5028
5029

5030


5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041

5042
5043
5044
5045
5046
5047
5048
static void fts5IterSetOutputs_Col(Fts5Iter *pIter, Fts5SegIter *pSeg){
  Fts5Colset *pColset = pIter->pColset;
  pIter->base.iRowid = pSeg->iRowid;

  assert( pIter->pIndex->pConfig->eDetail==FTS5_DETAIL_COLUMNS );
  assert( pColset );

  if( pSeg->iLeafOffset+pSeg->nPos<=pSeg->pLeaf->szLeaf && 0 ){
    /* All data is stored on the current page. Populate the output 
    ** variables to point into the body of the page object. */
    Fts5PoslistWriter writer = {0};
    const u8 *a = &pSeg->pLeaf->p[pSeg->iLeafOffset];
    int n = pSeg->nPos;
    int iCol = 0;

    i64 iPos = 0;
    int iOff = 0;

    fts5BufferZero(&pIter->poslist);
    while( 0==sqlite3Fts5PoslistNext64(a, n, &iOff, &iPos) ){

      if( iPos==pColset->aiCol[iCol] ){
        sqlite3Fts5PoslistWriterAppend(&pIter->poslist, &writer, iPos);

        if( ++iCol>=pColset->nCol ) break;


      }
    }

  }else{
    /* The data is distributed over two or more pages. Copy it into the
    ** Fts5Iter.poslist buffer and then set the output pointer to point
    ** to this buffer.  */
    fts5BufferZero(&pIter->poslist);
    fts5SegiterPoslist(pIter->pIndex, pSeg, pColset, &pIter->poslist);
  }


  pIter->base.pData = pIter->poslist.p;
  pIter->base.nData = pIter->poslist.n;
}

/*
** xSetOutputs callback used by detail=full when there is a column filter.
*/







|






>





>
|
|
>
|
>
>











>







5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
static void fts5IterSetOutputs_Col(Fts5Iter *pIter, Fts5SegIter *pSeg){
  Fts5Colset *pColset = pIter->pColset;
  pIter->base.iRowid = pSeg->iRowid;

  assert( pIter->pIndex->pConfig->eDetail==FTS5_DETAIL_COLUMNS );
  assert( pColset );

  if( pSeg->iLeafOffset+pSeg->nPos<=pSeg->pLeaf->szLeaf ){
    /* All data is stored on the current page. Populate the output 
    ** variables to point into the body of the page object. */
    Fts5PoslistWriter writer = {0};
    const u8 *a = &pSeg->pLeaf->p[pSeg->iLeafOffset];
    int n = pSeg->nPos;
    int iCol = 0;
    int iCVal = pColset->aiCol[0];
    i64 iPos = 0;
    int iOff = 0;

    fts5BufferZero(&pIter->poslist);
    while( 0==sqlite3Fts5PoslistNext64(a, n, &iOff, &iPos) ){
      while( iPos>=iCVal ){
        if( iPos==iCVal ){
          sqlite3Fts5PoslistWriterAppend(&pIter->poslist, &writer, iPos);
        }
        if( ++iCol>=pColset->nCol ) goto setoutputs_col_out;
        assert( pColset->aiCol[iCol]>iCVal );
        iCVal = pColset->aiCol[iCol];
      }
    }

  }else{
    /* The data is distributed over two or more pages. Copy it into the
    ** Fts5Iter.poslist buffer and then set the output pointer to point
    ** to this buffer.  */
    fts5BufferZero(&pIter->poslist);
    fts5SegiterPoslist(pIter->pIndex, pSeg, pColset, &pIter->poslist);
  }

setoutputs_col_out:
  pIter->base.pData = pIter->poslist.p;
  pIter->base.nData = pIter->poslist.n;
}

/*
** xSetOutputs callback used by detail=full when there is a column filter.
*/