SQLite

Check-in [f474aeac4f]
Login

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

Overview
Comment:Another fix in the IN-operator algorithm description.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | rowvalue
Files: files | file ages | folders
SHA1: f474aeac4fa62d87e73189868d7c7a295ffb7265
User & Date: drh 2016-08-25 17:47:36.711
Context
2016-08-25
21:14
Refactor the sqlite3ExprCodeIN() routine for improved maintainability. (check-in: b56705ae63 user: drh tags: rowvalue)
17:47
Another fix in the IN-operator algorithm description. (check-in: f474aeac4f user: drh tags: rowvalue)
17:40
Further refinement of the in-operator.md documentation. (check-in: df0648373a user: drh tags: rowvalue)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/in-operator.md.
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87

88
89
90
91
92
93
94
95
96
            x=y1 OR x=y2

      This is the INDEX_NOOP optimization and is only undertaken if the
      IN operator is used for membership testing.  If the IN operator is
      driving a loop, then skip this step entirely.

  2.  Check the LHS to see if it is a partial-NULL and if it is, jump
      ahead to step 4.

  3.  Do a binary search for the RHS using the LHS as a probe.  If
      an exact match is found, return TRUE.

  4.  If we do not need to distingish between FALSE and NULL,
      then return FALSE.


  5.  If the RHS is non-NULL then return FALSE.

  6.  For each row in the RHS, compare that row against the LHS and
      if the result is NULL, immediately return NULL.  In the case
      of a scalar IN operator, we only need to look at the very first
      row the RHS because for a scalar RHS, all NULLs will always come 
      first.  If the RHS is empty, this step is a no-op.

  7.  Return FALSE.







|

|


<
|

>
|
|







73
74
75
76
77
78
79
80
81
82
83
84

85
86
87
88
89
90
91
92
93
94
95
96
            x=y1 OR x=y2

      This is the INDEX_NOOP optimization and is only undertaken if the
      IN operator is used for membership testing.  If the IN operator is
      driving a loop, then skip this step entirely.

  2.  Check the LHS to see if it is a partial-NULL and if it is, jump
      ahead to step 5.

  3.  Do a binary search of the RHS using the LHS as a probe.  If
      an exact match is found, return TRUE.


  4.  If the RHS is non-NULL then return FALSE.

  5.  If we do not need to distingish between FALSE and NULL,
      then return FALSE.
  
  6.  For each row in the RHS, compare that row against the LHS and
      if the result is NULL, immediately return NULL.  In the case
      of a scalar IN operator, we only need to look at the very first
      row the RHS because for a scalar RHS, all NULLs will always come 
      first.  If the RHS is empty, this step is a no-op.

  7.  Return FALSE.