Cube extension types support

Lists: pgsql-hackers
From: Stas Kelvich <stas(dot)kelvich(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Cube extension types support
Date: 2013-09-24 15:44:22
Message-ID: 2FA9406C-E702-4A2F-8545-66726A1B5960@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hello, hackers.

In this patch I've implemented support for different storage types for cubes. Now it supports float8, float4, int4, int2, int1. Type stored in the header of each cube, one for all coordinates. So for cubes with int1 coordinates it can save up to 8x disk space. Typed cubes can be created in two ways:

1) Via cube_suffix() functions, where suffix can be "f4", "i4", "i2", "i1", and arguments are two or one numbers or arrays, i.e.

# select cube_i1(1,2) as c;
c
------------
(1),(2):i1

# select cube_f4(array[1,2,3], array[5,6,7]) as c;
c
------------------------
(1, 2, 3),(5, 6, 7):f4

2) Via modificator in the end of string that will be casted to cube, i.e.

# select '(1,2,3):i2'::cube as c;
c
--------------
(1, 2, 3):i2

When no modificator given float8 will be used by default. Old-style cubes without type in header also treated as float8 for backward compatibility.

This patch changes a lot of things in code, so it interfere with others patches to the cube extension. I will update this patch, if other patches will be accepted to commit.

Attachment Content-Type Size
types_cumulative.diff application/octet-stream 47.1 KB

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Stas Kelvich <stas(dot)kelvich(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Cube extension types support
Date: 2013-09-25 15:58:35
Message-ID: 5243082B.8060406@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 9/24/13 11:44 AM, Stas Kelvich wrote:
> In this patch I've implemented support for different storage types for cubes.

Doesn't build:

gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -fpic -I. -I. -I../../src/include -D_GNU_SOURCE -I/usr/include/libxml2 -c -o cubeparse.o cubeparse.c -MMD -MP -MF .deps/cubeparse.Po
cubeparse.y:35:13: warning: ‘check_coord’ used but never defined [enabled by default]
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -fpic -shared -o cube.so cube.o cubeparse.o -L../../src/port -L../../src/common -L/usr/lib -Wl,--as-needed -lm
/usr/bin/ld: cubeparse.o: relocation R_X86_64_PC32 against symbol `check_coord' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [cube.so] Error 1