From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id CFC2E2586E for ; Mon, 19 Aug 2019 15:57:14 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gCzvIvLabE1E for ; Mon, 19 Aug 2019 15:57:14 -0400 (EDT) Received: from smtp60.i.mail.ru (smtp60.i.mail.ru [217.69.128.40]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 8A7862375F for ; Mon, 19 Aug 2019 15:57:14 -0400 (EDT) Subject: [tarantool-patches] Re: [PATCH v1 1/1] sql: improve vdbe_field_ref fetcher References: <978c68684414e4df06fa7b37697c3f348d96cf5b.1563781318.git.kshcherbatov@tarantool.org> <967599c4-0e10-8cdc-2860-dc02105cd341@tarantool.org> <9a02e44d-cdf8-c2e6-16b9-326aef714021@tarantool.org> <4151ee6c-fb07-0801-e6ad-d62cffcdb197@tarantool.org> <2683f8ca-9fe0-a0e6-7433-9bfa4745f4f4@tarantool.org> <09af6c7e-1a6f-4736-5f34-3f65b2266d45@tarantool.org> <1924807e-20f8-31a4-0000-716346659f30@tarantool.org> From: Vladislav Shpilevoy Message-ID: <8096b7f4-cb40-a198-2401-8f4053e655e1@tarantool.org> Date: Mon, 19 Aug 2019 22:00:07 +0200 MIME-Version: 1.0 In-Reply-To: <1924807e-20f8-31a4-0000-716346659f30@tarantool.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: Kirill Shcherbatov , tarantool-patches@freelists.org 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()