From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id A26716F867; Tue, 1 Feb 2022 16:37:52 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org A26716F867 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1643722672; bh=G/bmGyNkIjnwIgLsukz4pRywvWYkA/gzKISIMhV9Z4I=; h=To:Cc:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=dWa+dJxctFeYvu6OAQN+VIcN+K2NeEDmOaeqqY2kGkhxjKJmbMM3HzP4gxKxs2PGm vKRgtD7hfsSaFBV9JF7vWWjS5cIbMFXY9PCxLo2AhLvDH8DIRvn0NX/Jh4gOktBwhQ PkFLr49hb8Ixik2O4XPV9jpMleqHYa5/7qxcZEmg= Received: from smtpng2.i.mail.ru (smtpng2.i.mail.ru [94.100.179.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id D5B4D6F86A for ; Tue, 1 Feb 2022 16:37:22 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org D5B4D6F86A Received: by smtpng2.m.smailru.net with esmtpa (envelope-from ) id 1nEtLW-00045u-9v; Tue, 01 Feb 2022 16:37:22 +0300 To: v.shpilevoy@tarantool.org Cc: tarantool-patches@dev.tarantool.org Date: Tue, 1 Feb 2022 16:37:22 +0300 Message-Id: <194ad18940d38561e96d6ef7eeb6da0e4a5c65cf.1643722506.git.imeevma@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-4EC0790: 10 X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD99F281FB7F96F126D5C01C79F7F2485624D256791FCB2EE0000894C459B0CD1B94003E547D97F04CE772B63D50B808CF2AA45120333E8030E6C2C8FE43D3956A9 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7AEADB70076298E75EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637EA9DEEAA3ECF8E948638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8AA4FC60AC79C9A9822C072575E19033E117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCAA867293B0326636D2E47CDBA5A96583BD4B6F7A4D31EC0BC014FD901B82EE079FA2833FD35BB23D27C277FBC8AE2E8B2EE5AD8F952D28FBA471835C12D1D977C4224003CC8364762BB6847A3DEAEFB0F43C7A68FF6260569E8FC8737B5C2249EC8D19AE6D49635B68655334FD4449CB9ECD01F8117BC8BEAAAE862A0553A39223F8577A6DFFEA7CDDB9BF3B882869D543847C11F186F3C59DAA53EE0834AAEE X-8FC586DF: 6EFBBC1D9D64D975 X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975CCED4562AEA10A75F88183FDCD1C60AE5CA448835FF5350F29C2B6934AE262D3EE7EAB7254005DCED7532B743992DF240BDC6A1CF3F042BAD6DF99611D93F60EFE323A604FE95ED09DC48ACC2A39D04F89CDFB48F4795C241BDAD6C7F3747799A X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D3451BBE684D17D72219F920DDF952CA7FCC285525FC9016A0C4E18281D729DE7207399E169366C66E41D7E09C32AA3244C49E980DF7157081A76E3E426886D580B60759606DA2E136A729B2BEF169E0186 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioje/Fy4v4LxyrsjaD9r8nRbg== X-Mailru-Sender: 689FA8AB762F739339CABD9B3CA9A7D623B8B7C3704FC49895B0E0402D57F44083D72C36FC87018B9F80AB2734326CD2FB559BB5D741EB96352A0ABBE4FDA4210A04DAD6CC59E3365FEEDEB644C299C0ED14614B50AE0675 X-Mras: Ok Subject: [Tarantool-patches] [PATCH v2 1/4] sql: fix COUNT() optimization conditions X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Mergen Imeev via Tarantool-patches Reply-To: imeevma@tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" This patch fixes the conditions under which COUNT() is optimized. At some point, the conditions were broken, but since there was no other aggregate function requiring zero arguments, this problem did not change the behavior. Needed for #2579 --- src/box/sql/select.c | 2 +- src/box/sql/sqlInt.h | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/box/sql/select.c b/src/box/sql/select.c index 55aaff87f..b532cac4e 100644 --- a/src/box/sql/select.c +++ b/src/box/sql/select.c @@ -4650,7 +4650,7 @@ is_simple_count(struct Select *select, struct AggInfo *agg_info) return NULL; assert(agg_info->aFunc->func->def->language == FUNC_LANGUAGE_SQL_BUILTIN); - if (sql_func_flag_is_set(agg_info->aFunc->func, SQL_FUNC_COUNT) || + if (strcmp(agg_info->aFunc->func->def->name, "COUNT") != 0 || (agg_info->aFunc->pExpr->x.pList != NULL && agg_info->aFunc->pExpr->x.pList->nExpr > 0)) return NULL; diff --git a/src/box/sql/sqlInt.h b/src/box/sql/sqlInt.h index 0db16b293..f49522dc8 100644 --- a/src/box/sql/sqlInt.h +++ b/src/box/sql/sqlInt.h @@ -1117,8 +1117,6 @@ struct type_def { */ #define SQL_FUNC_LENGTH 0x0040 /* Built-in length() function */ #define SQL_FUNC_TYPEOF 0x0080 /* Built-in typeof() function */ -/** Built-in count() function. */ -#define SQL_FUNC_COUNT 0x0100 #define SQL_FUNC_COALESCE 0x0200 /* Built-in coalesce() or ifnull() */ #define SQL_FUNC_UNLIKELY 0x0400 /* Built-in unlikely() function */ /** Built-in min() or least() function. */ -- 2.25.1