Skip to content

alternate_explode_function

Remi-C edited this page Jan 10, 2014 · 2 revisions

This page describe the changes made to the original poitcloud to add a new functonnality allowing to reduce the number of attributes in a patch , in order to more efficient patch to point conversion when we don't need all attributes

create a new xml schema with a subset of attributes, for test purpose.

The plan is as follow : when using a patch, we call pcpatch pc_patchsubset(a_patch, ['attribute1','attribute2', ...])

This function takes a patch and return a new patch with only a few attributes that have been selected, if possible staying in the dimensionnal compression mode.

Then we can use whatever other function on this patch, provided we don't try to use other attributes than provided. Explicitly, the only other function that will be tested are PC_Explode.

Analysis of the current code state :

a patch -> patch function : PC_Uncompress --> pc_access.c/pcpatch_uncompress : call functions from lib/pc_api.h which are precised in lib/*.c

SQL : PC_Explode : --> pc_acces.c / pcpatch_unnest :

Data structure : about patch SERIALIZED_PATCH : in pc_pgsql.h : a C struct It is the base struct for output/input at the database level.

pc_api.h/patch : int type;
int8_t readonly;
const PCSCHEMA *schema;
uint32_t npoints;
PCBOUNDS bounds;
PCSTATS *stats;

then 3 inheriting specialized patch type with various data holder (depending on the compression)

About schema : PCSCHEMA uint32_t pcid; /* Unique ID for schema / uint32_t ndims; / How many dimensions does this schema have? / size_t size; / How wide (bytes) is a point with this schema? */ PCDIMENSION *dims; / Array of dimension pointers / uint32_t srid; / Foreign key reference to SPATIAL_REF_SYS / int32_t x_position; / What entry is the x coordinate at? / int32_t y_position; / What entry is the y coordinate at? / uint32_t compression; / Compression type applied to the data */ hashtable namehash; / Look-up from dimension name to pointer */

PCDIMENSION; char *name; char *description; uint32_t position; uint32_t size; uint32_t byteoffset; uint32_t interpretation; double scale; double offset; uint8_t active;

Changes we make :

adding a sql function in pointcloud--1.sql : pc_patchsubset calling "pcpatch_subset" as we don't want reoinstall everything, we add also an update script, but finally we just add the function manually CREATE OR REPLACE FUNCTION pc_uncompress(p pcpatch) RETURNS pcpatch AS '$libdir/pointcloud', 'pcpatch_uncompress' LANGUAGE c IMMUTABLE STRICT Change PC_Access.c to add a new function "pcpatch_subset" (2 places to change), this function calls a function in lib/pc_api.h and lib/

Change pc_patch.c to add a new function called pc_patch_reduce_dimension

Change the test framework : added a new test for pc_patch_reduce_dimension registered the test

Clone this wiki locally