pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Volkan YAZICI <yazicivo@ttnet.net.tr>
To: pgsql-general@postgresql.org
Subject: intarray internals
Date: Sat, 6 May 2006 00:46:01 +0300
Message-ID: <20060505214601.GA208@alamut> (raw)

Hi,

I'm reading through the source code of intarray contrib module. Despite
being at the beginning, I've some questions to ask. I'd be so
appreciated if anybody can help.


[1]
What's the function of execute() in _int_bool.c? As far as I can
understand, some other functions (eg. execconsistent()) calling
execute() with specific check methods (like checkcondition_bit()) but
I still couldn't figure out which functionality execute() stands for.


[2]
In g_int_decompress(), shouldn't

if (ARRISVOID(in))
    PG_RETURN_POINTER(entry);

part be replaced with

if (ARRISVOID(in))
{
    if (in != (ArrayType *) DatumGetPointer(entry->key))
        pfree(in);
    PG_RETURN_POINTER(entry)
}


[3]
Again, in g_int_decompress(), I couldn't figure out the functionality of
below lines:

din = ARRPTR(in);
lenr = internal_size(din, lenin);

for (i = 0; i < lenin; i += 2)
    for (j = din[i]; j <= din[i + 1]; j++)
        if ((!i) || *(dr - 1) != j)
            *dr++ = j;

If I understand right, above loop, tries to reconstruct array with more
smaller intervals - to be able to make more accurate predicates while
digging into nodes. If so, AFAICS, g_int_compress() and
g_int_decompress() methods can be (quite?) improved.

Furthermore, I've tested above functions with some random input and
couldn't create any cases hold for a[i] == a[i - 1] (which is used
in internal_size() method's loop.) Did I miss something obvious?


Regards.

P.S. Instead of an explanation to questions, pointings to right files to
read (at least for the beginning) would be appreciated too.



view thread (11+ messages)  latest in thread

Message-ID: <20060505214601.GA208@alamut>
Permalink:  ../20060505214601.GA208@alamut/
Also on:    postgresql.org/message-id/20060505214601.GA208@alamut

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: yazicivo@ttnet.net.tr, pgsql-general@postgresql.org
  Subject: Re: intarray internals
  In-Reply-To: <20060505214601.GA208@alamut>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox