You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudberry.apache.org by av...@apache.org on 2024/12/27 11:17:45 UTC

(cloudberry) 06/13: Break early when creating Memtuple binding from TupleDesc.

This is an automated email from the ASF dual-hosted git repository.

avamingli pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git

commit fb54cfef799de8f5458b81050c43f80a71f2695d
Author: Zhang Mingli <av...@gmail.com>
AuthorDate: Fri Sep 23 09:25:38 2022 +0800

    Break early when creating Memtuple binding from TupleDesc.
    
    MemtupleBinding is column aligned by 4 or 8 bytes.
    It can be set to 8 if we find a atrribute's attalign is 'd' (8 bytes on
    most machines), there is no need to check other attributes.
    Add some comments about how to compute null bitmap entries space.
    
    Authored-by: Mingli Zhang <av...@gmail.com>
---
 src/backend/access/common/memtuple.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/backend/access/common/memtuple.c b/src/backend/access/common/memtuple.c
index d03b0710c2..ca59103547 100644
--- a/src/backend/access/common/memtuple.c
+++ b/src/backend/access/common/memtuple.c
@@ -95,6 +95,8 @@ void destroy_memtuple_binding(MemTupleBinding *pbind)
  * null attribute.  For all possible combinations of 4 null bit,
  * we index into a short[16] array to get how many space is saved
  * by the nulls.
+ * Null bitmap is spilt into bytes and each byte is spilt into low
+ * and high bits. So each byte will need 2 short[16] arrays. 
  */
 
 /* Compute how much space to store the null save entries.
@@ -429,7 +431,10 @@ MemTupleBinding *create_memtuple_binding(TupleDesc tupdesc)
 		Form_pg_attribute attr = TupleDescAttr(tupdesc, i);
 
 		if (attr->attlen > 0 && attr->attalign == 'd')
+		{
 			pbind->column_align = 8;
+			break;
+		}
 	}
 
 	pbind->null_bitmap_extra_size = compute_null_bitmap_extra_size(tupdesc, pbind->column_align); 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org