Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uyqov-00DhHx-QY for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Sep 2025 11:59:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uyqos-006c5d-Kj for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Sep 2025 11:59:31 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uyqor-006c5T-QP for pgsql-hackers@lists.postgresql.org; Wed, 17 Sep 2025 11:59:31 +0000 Received: from fout-a8-smtp.messagingengine.com ([103.168.172.151]) by makus.postgresql.org with smtp (Exim 4.96) (envelope-from ) id 1uyqoq-000tbg-17 for pgsql-hackers@lists.postgresql.org; Wed, 17 Sep 2025 11:59:29 +0000 Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfout.phl.internal (Postfix) with ESMTP id 3DF09EC02DE; Wed, 17 Sep 2025 07:59:27 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Wed, 17 Sep 2025 07:59:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=burd.me; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1758110367; x=1758196767; bh=cj/YxRM8+xpLxUXgHGaoH+gNHAvs9Vsi9it7fA5wgKM=; b= MdoV+Zo3NvZUH+2A+29AXiN+JHgDJMYUlpQhYO0Qz+STBw9okDvkzZRlQmFTSutF Dqz8cqxbETuK/kUhBeoGKBjH+JMunK0ilWK6985kGDJMSJo4v3wrY1xeDunt4poO bl20zUUGH77buJGa1fiIr9Igx7qomivm8neUGX1WrQZrbTIXrcrbQ3tAUH1E+ruR WCdEqbjPWvNvhvcGG7JCcPCxB1PY5LWPq5f6BYICfMLgUpORZUJ73RNkh41EP6jB s6Lthmeyai9CUXCOTAezrt1gCRPSduk2kEvPHjGxdazZay2wq/Ep3BxCfgnrolHP DNcAUunacswa91f6msCgqA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1758110367; x= 1758196767; bh=cj/YxRM8+xpLxUXgHGaoH+gNHAvs9Vsi9it7fA5wgKM=; b=e McI0AVLs/o99PgYp0EvKfNQg/GmV+M5UqZzncRrFr+upCBY+mIHQMffksO7D+N2G HhBsklYzY9uWXl7aZJfDk+1xXdJfKH1dYEUI8uU5hLhoULrVtt7ngWZtalNBAUhw QWhv2uDfkrylnsDpLI3oMbD/afrjTZlkNMEXJx9IOzTkuTWb21abJBma/5xUztet iv1ak2V/8iWO1VhDwINmqHRwMmYZ0nU+mLuRmxzFhhEKJqQAU4Mq4vfgFi0eiO2I eLp80Kwhxk0YAWzDWjQxNNDFKrguc/leBdUy8p2Hol34O83u9/UFzDre2n46nc67 0/pLthepbbfsC3945ECBQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggdegfeeflecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpeffhffvvefkjghfuffogggtgfgusehtjehmtdertdejnecuhfhrohhmpefirhgvghcu uehurhguuceoghhrvghgsegsuhhrugdrmhgvqeenucggtffrrghtthgvrhhnpeegvdfftd elvdekteeljedvleduueevudfggeetudfgudejtdeikedtvefglefgieenucevlhhushht vghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehgrhgvghessghurhgurd hmvgdpnhgspghrtghpthhtohephedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohep mhhitghhrggvlhesphgrqhhuihgvrhdrgiihiidprhgtphhtthhopehsrgifrggurgdrmh hshhhksehgmhgrihhlrdgtohhmpdhrtghpthhtohepphhgshhqlhdqhhgrtghkvghrshes lhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhgpdhrtghpthhtohepnhgrthhhrghnug gsohhsshgrrhhtsehgmhgrihhlrdgtohhmpdhrtghpthhtoheprhhosggvrhhtmhhhrggr shesghhmrghilhdrtghomh X-ME-Proxy: Feedback-ID: i675e48f3:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 17 Sep 2025 07:59:26 -0400 (EDT) Date: Wed, 17 Sep 2025 07:59:15 -0400 From: Greg Burd To: Michael Paquier , Masahiko Sawada Cc: PostgreSQL Hackers , Nathan Bossart , Robert Haas Message-ID: <691D5239-9A9F-4537-A75D-2045BFF66712@greg.burd.me> In-Reply-To: References: Subject: Re: [PATCH] Add tests for Bitmapset X-Mailer: Mailspring MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sep 16 2025, at 8:35 pm, Michael Paquier wrote: > On Tue, Sep 16, 2025 at 03:00:40PM -0700, Masahiko Sawada wrote: >> Thank you for updating the patch. It seems cfbot caught a regression >> test error[1] in a 32-bit build. > > - bitmap_hash [1,3,5] | 49870778 > + bitmap_hash [1,3,5] | 1509752520 > > This one is able the hash value computation being not portable across > architectures. I would just change these to be non-NULL, I guess. > -- > Michael Thanks Michael, Sawada-san, yep hashing is arch dependent (go figure!), but thankfully it is deterministic. Rather that test for non-NULL I've come up with this approach: -- Architecture-aware hash testing WITH arch_info AS ( SELECT CASE WHEN pg_column_size(1::bigint) = 8 THEN '64bit' ELSE '32bit' END as architecture ), expected_values AS ( SELECT architecture, CASE architecture WHEN '64bit' THEN 0 WHEN '32bit' THEN 0 END as hash_null, CASE architecture WHEN '64bit' THEN 49870778 WHEN '32bit' THEN 1509752520 END as hash_135, CASE architecture WHEN '64bit' THEN -303921606 WHEN '32bit' THEN 0 -- TBD END as hash_246 FROM arch_info ) SELECT 'expected hash NULL' as test, test_bitmap_hash(NULL) = hash_null as result FROM expected_values UNION ALL SELECT 'expected hash [1,3,5]' as test, test_bitmap_hash(test_bms_from_array(ARRAY[1,3,5])) = hash_135 as result FROM expected_values UNION ALL SELECT 'expected hash [2,4,6]' as test, test_bitmap_hash(test_bms_from_array(ARRAY[2,4,6])) = hash_246 as result FROM expected_values; However I'm not sure what the value is for testing hash functions except for coverage and I'm fairly certain that function is well exercised. That said, I think that will work. I'll let cfbot tell me the 32bit hash value on the next run. thanks again for the helpful insights, -greg