Changeset: a4c088ee3f25 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a4c088ee3f25
Modified Files:
sql/backends/monet5/UDF/80_ssdb.sql
sql/backends/monet5/UDF/ssdb.c
sql/backends/monet5/UDF/ssdb.mal
Branch: ssdb
Log Message:
Give number of observations as parameter in the grouping function.
diffs (67 lines):
diff --git a/sql/backends/monet5/UDF/80_ssdb.sql
b/sql/backends/monet5/UDF/80_ssdb.sql
--- a/sql/backends/monet5/UDF/80_ssdb.sql
+++ b/sql/backends/monet5/UDF/80_ssdb.sql
@@ -43,7 +43,8 @@ EXTERNAL NAME ssdb.cooking;
-- (obsgroupid INT, center_traj_x INT, center_traj_y INT, fromtime
INT, totime INT)
-- tout_obs: name of the output table for groups-observations, with columns
-- (obsgroupid INT, obsid INT)
-CREATE PROCEDURE grouping (tin CHAR(128), tout_grp CHAR(128), tout_obs
CHAR(128))
+--observations: total number of observations-1
+CREATE PROCEDURE grouping (tin CHAR(128), tout_grp CHAR(128), tout_obs
CHAR(128), observations INT)
EXTERNAL NAME ssdb.grouping;
-- Determines for each polygon in the input table 'tin' if it intersects with
diff --git a/sql/backends/monet5/UDF/ssdb.c b/sql/backends/monet5/UDF/ssdb.c
--- a/sql/backends/monet5/UDF/ssdb.c
+++ b/sql/backends/monet5/UDF/ssdb.c
@@ -1323,13 +1323,14 @@ SSDBgrouping(Client cntxt, MalBlkPtr mb,
str tin_name = *(str *) getArgReference(stk, pci, pci->retc + 0);
str tout_grp_name = *(str *) getArgReference(stk, pci, pci->retc + 1);
str tout_obs_name = *(str *) getArgReference(stk, pci, pci->retc + 2);
+ int nr_obs = *(int *) getArgReference(stk, pci, pci->retc + 3);
BAT *tin_l_obsid = NULL, *tin_l_time = NULL, *tin_l_centerx = NULL,
*tin_l_centery = NULL, *tin_r_obsid = NULL, *tin_r_time = NULL, *tin_r_centerx
= NULL, *tin_r_centery = NULL;
BAT *tout_grp_obsgroupid = NULL, *tout_grp_center_traj_x = NULL,
*tout_grp_center_traj_y = NULL, *tout_grp_fromtime = NULL, *tout_grp_totime =
NULL;
BAT *tout_obs_obsgroupid = NULL, *tout_obs_obsid = NULL;
BUN idx=0, nr_points=0;
- int nr_obs = 0,l,obsid,groups=0,found=0,j,tuples_grp=0;
+ int l,obsid,groups=0,found=0,j,tuples_grp=0;
int *tin_l_obsid_t = NULL, *tin_l_time_t = NULL, *tin_l_centerx_t =
NULL, *tin_l_centery_t = NULL, *tin_r_obsid_t = NULL, *tin_r_time_t = NULL,
*tin_r_centerx_t = NULL, *tin_r_centery_t = NULL;
int *tout_grp_obsgroupid_t = NULL, *tout_grp_center_traj_x_t = NULL,
*tout_grp_center_traj_y_t = NULL, *tout_grp_fromtime_t = NULL,
*tout_grp_totime_t = NULL;
int *tout_obs_obsgroupid_t = NULL, *tout_obs_obsid_t = NULL;
@@ -1341,8 +1342,8 @@ SSDBgrouping(Client cntxt, MalBlkPtr mb,
if (msg)
return msg;
- if (pci->argc - pci->retc != 3)
- return sql_message("GROUPING(): 3 parameters expected, got %d",
pci->argc - pci->retc);
+ if (pci->argc - pci->retc != 4)
+ return sql_message("GROUPING(): 4 parameters expected, got %d",
pci->argc - pci->retc);
if (!tin_name)
return sql_message("GROUPING(): missing name of the input
table");
if (!tout_grp_name)
@@ -1407,7 +1408,7 @@ SSDBgrouping(Client cntxt, MalBlkPtr mb,
/*assign memory to structures*/
nr_points = BATcount(tin_l_obsid);
- nr_obs = tin_l_obsid_t[nr_points-1]+1;
+ nr_obs=nr_obs+1;
groupFrom = GDKmalloc(nr_obs * sizeof(obs_group*));
if (!groupFrom)
diff --git a/sql/backends/monet5/UDF/ssdb.mal b/sql/backends/monet5/UDF/ssdb.mal
--- a/sql/backends/monet5/UDF/ssdb.mal
+++ b/sql/backends/monet5/UDF/ssdb.mal
@@ -22,9 +22,9 @@ pattern cooking(tin:str, tout_obs:str, t
address SSDBcooking
comment "Cooks all image pixels in the table 'tin' into observations and store
them in the table 'tout_obs', the polygons of the observations are stored in
the table 'tout_plg'";
-pattern grouping(tin:str, tout_grp:str, tout_obs:str):void
+pattern grouping(tin:str, tout_grp:str, tout_obs:str, observations:int):void
address SSDBgrouping
-comment "Cooks observations in the table 'tin' into groups. The groups (and
some more information for each group) are stored in the table 'tout_grp'. The
observations that belong in eavh group are stored in the table 'tout_obs'";
+comment "Cooks observations in the table 'tin' into groups. The groups (and
some more information for each group) are stored in the table 'tout_grp'. The
observations that belong in each group are stored in the table 'tout_obs'";
pattern intersects(tin:str, tout:str, xstart:int, ystart:int, xlen:int,
ylen:int):void
address SSDBintersects
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list