[tarantool-patches] Re: [PATCH v1 1/1] sql: improve vdbe_field_ref fetcher
Vladislav Shpilevoy
v.shpilevoy at tarantool.org
Mon Aug 19 23:00:07 MSK 2019
Hi! Thanks for the fixes. Mine are on the branch in
a separate commit and below. Squash them please, if they
are ok.
============================================================
diff --git a/src/box/column_mask.h b/src/box/column_mask.h
index 5fb0e1fe0..9470fe19c 100644
--- a/src/box/column_mask.h
+++ b/src/box/column_mask.h
@@ -125,16 +125,15 @@ column_mask_fieldno_is_set(uint64_t column_mask, uint32_t fieldno)
/**
* Set a bit with given index @a bitno in a given @a bitmask.
- * Do nothing when @a bitno is greater than size if bitmask.
+ * Do nothing when @a bitno is greater than size of bitmask.
* @param bitmask Bitmask to test.
- * @param bitno bit number to test (must be 0-based).
+ * @param bitno Bit number to test (must be 0-based).
*/
static inline void
bitmask64_set_bit(uint64_t *bitmask, uint32_t bitno)
{
- if (bitno >= 64)
- return;
- *bitmask |= ((uint64_t)1 << bitno);
+ if (bitno < 64)
+ *bitmask |= ((uint64_t)1 << bitno);
}
/**
@@ -148,9 +147,7 @@ bitmask64_set_bit(uint64_t *bitmask, uint32_t bitno)
static inline bool
bitmask64_is_bit_set(uint64_t bitmask, uint32_t bitno)
{
- if (bitno >= 64)
- return false;
- return (bitmask & ((uint64_t)1 << bitno)) != 0;
+ return bitno < 64 && (bitmask & ((uint64_t)1 << bitno)) != 0;
}
#endif
diff --git a/test/sql/misc.result b/test/sql/misc.result
index 545be15f6..a157ddbc1 100644
--- a/test/sql/misc.result
+++ b/test/sql/misc.result
@@ -181,35 +181,10 @@ box.execute('SELECT field70, field64 FROM test')
rows:
- [70, 64]
...
-box.space.TEST:drop()
----
-...
-- In the case below described optimization works fine.
-format = {}
----
-...
-t = {}
----
-...
-for i = 1, 70 do \
- format[i] = {name = 'FIELD'..i, type = 'unsigned'} \
- t[i] = i \
-end
+pk:alter({parts = {66}})
---
...
-s = box.schema.create_space('TEST', {format = format})
----
-...
-pk = s:create_index('pk', {parts = {66}})
----
-...
-s:insert(t)
----
-- [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
- 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42,
- 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
- 63, 64, 65, 66, 67, 68, 69, 70]
-...
box.execute('SELECT field66, field68, field70 FROM test')
---
- metadata:
diff --git a/test/sql/misc.test.lua b/test/sql/misc.test.lua
index 8067be213..541660c61 100644
--- a/test/sql/misc.test.lua
+++ b/test/sql/misc.test.lua
@@ -59,17 +59,8 @@ s = box.schema.create_space('TEST', {format = format})
pk = s:create_index('pk', {parts = {70}})
s:insert(t)
box.execute('SELECT field70, field64 FROM test')
-box.space.TEST:drop()
-- In the case below described optimization works fine.
-format = {}
-t = {}
-for i = 1, 70 do \
- format[i] = {name = 'FIELD'..i, type = 'unsigned'} \
- t[i] = i \
-end
-s = box.schema.create_space('TEST', {format = format})
-pk = s:create_index('pk', {parts = {66}})
-s:insert(t)
+pk:alter({parts = {66}})
box.execute('SELECT field66, field68, field70 FROM test')
box.space.TEST:drop()
More information about the Tarantool-patches
mailing list