[tarantool-patches] Re: [PATCH 06/10] sql: completely remove support of partial indexes
Vladislav Shpilevoy
v.shpilevoy at tarantool.org
Sat Aug 25 00:04:06 MSK 2018
Thanks for the fixes! See my ones on the branch.
On 21/08/2018 19:31, n.pettik wrote:
>
>> On 13 Aug 2018, at 23:24, Vladislav Shpilevoy <v.shpilevoy at tarantool.org> wrote:
>>
>> Thanks for the patch! I have pushed my review fixes in
>> a separate commit.
>>
>> Please, investigate also is it possible to remove pPartial
>> variable from constructAutomaticIndex? It would allow to
>> remove sql_resolve_part_idx_label alongside.
>
> ConstructAutomatiIndex() is now dead code, so I can’t really check it.
> Lets now remove it. I doubt that this code can be adapted easily, so
> it is likely to be re-implemented anyway.
>
diff --git a/src/box/sql/analyze.c b/src/box/sql/analyze.c
index 00d96d220..901951963 100644
--- a/src/box/sql/analyze.c
+++ b/src/box/sql/analyze.c
@@ -51,9 +51,9 @@
* which the index belongs. In each such row, the stat column will be
* a string consisting of a list of integers. The first integer in this
* list is the number of rows in the index. (This is the same as the
- * number of rows in the table, except for partial indices.) The second
- * integer is the average number of rows in the index that have the same
- * value in the first column of the index. The third integer is the average
+ * number of rows in the table.) The second integer is the
+ * average number of rows in the index that have the same value in
+ * the first column of the index. The third integer is the average
* number of rows in the index that have the same value for the first two
* columns. The N-th integer (for N>1) is the average number of rows in
* the index which have the same value for the first N-1 columns. For
diff --git a/src/box/sql/expr.c b/src/box/sql/expr.c
index a41ea8f13..50505b1d3 100644
--- a/src/box/sql/expr.c
+++ b/src/box/sql/expr.c
@@ -3700,7 +3700,7 @@ sqlite3ExprCodeTarget(Parse * pParse, Expr * pExpr, int target)
int iTab = pExpr->iTable;
if (iTab < 0) {
if (pParse->ckBase > 0) {
- /* Generating CHECK constraints or inserting into partial index */
+ /* Generating CHECK constraints. */
return pExpr->iColumn + pParse->ckBase;
} else {
/* Coding an expression that is part of an index where column names
diff --git a/src/box/sql/resolve.c b/src/box/sql/resolve.c
index 97b642723..9a2d6ff4e 100644
--- a/src/box/sql/resolve.c
+++ b/src/box/sql/resolve.c
@@ -514,11 +514,13 @@ notValid(Parse * pParse, /* Leave error message here */
{
assert((validMask & ~(NC_IsCheck | NC_IdxExpr)) == 0);
if ((pNC->ncFlags & validMask) != 0) {
- const char *zIn = "partial index WHERE clauses";
+ const char *zIn;
if (pNC->ncFlags & NC_IdxExpr)
zIn = "index expressions";
else if (pNC->ncFlags & NC_IsCheck)
zIn = "CHECK constraints";
+ else
+ unreachable();
sqlite3ErrorMsg(pParse, "%s prohibited in %s", zMsg, zIn);
}
}
diff --git a/src/box/sql/select.c b/src/box/sql/select.c
index d22f4e0a9..849c0f871 100644
--- a/src/box/sql/select.c
+++ b/src/box/sql/select.c
@@ -6247,7 +6247,7 @@ sqlite3Select(Parse * pParse, /* The parser context */
* optimized specially. The OP_Count instruction
* is executed on the primary key index,
* since there is no difference which index
- * to choose (except for partial indexes).
+ * to choose.
*/
const int cursor = pParse->nTab++;
/*
diff --git a/src/box/sql/whereInt.h b/src/box/sql/whereInt.h
index 548cbcb2a..889a667ae 100644
--- a/src/box/sql/whereInt.h
+++ b/src/box/sql/whereInt.h
@@ -538,4 +538,3 @@ void sqlite3WhereTabFuncArgs(Parse *, struct SrcList_item *, WhereClause *);
#define WHERE_AUTO_INDEX 0x00004000 /* Uses an ephemeral index */
#define WHERE_SKIPSCAN 0x00008000 /* Uses the skip-scan algorithm */
#define WHERE_UNQ_WANTED 0x00010000 /* WHERE_ONEROW would have been helpful */
-#define WHERE_PARTIALIDX 0x00020000 /* The automatic index is partial */
diff --git a/src/box/sql/wherecode.c b/src/box/sql/wherecode.c
index 10a3f2d95..b45ca7cbe 100644
--- a/src/box/sql/wherecode.c
+++ b/src/box/sql/wherecode.c
@@ -231,8 +231,6 @@ sqlite3WhereExplainOneScan(Parse * pParse, /* Parse context */
if (isSearch) {
zFmt = "PRIMARY KEY";
}
- } else if (flags & WHERE_PARTIALIDX) {
- zFmt = "AUTOMATIC PARTIAL COVERING INDEX";
} else if (flags & WHERE_AUTO_INDEX) {
zFmt = "AUTOMATIC COVERING INDEX";
} else if (flags & WHERE_IDX_ONLY) {
More information about the Tarantool-patches
mailing list