Update of /cvsroot/monetdb/pathfinder/compiler/include
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv11514/include
Modified Files:
algebra.h logical.h logical_mnemonic.h physical.h
physical_mnemonic.h xml2lalg_converters.h
Log Message:
-- Replaced aggregate operators count, min, max, avg, sum, prod, seqty1,
and all in the algebra by a single aggregate operator ``aggr''
that can handle multiple aggregates. The aggregate entries
are of kind count, min, max, avg, sum, prod, seqty1, all, and dist.
-- Added new aggregate kind ``dist'' that allows to represent group by
columns that functionally depend on the partitioning criterion
in the result of the grouping aggregate.
-- Added rewrite that merges aggregates.
-- Added rewrite that removes superfluous aggregates.
-- Added rewrite that pushes a rank operator through an aggregate.
-- Extended the XML import to cope with the old
as well as the new representation of aggregates.
U physical.h
Index: physical.h
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/include/physical.h,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- physical.h 20 May 2009 16:00:46 -0000 1.55
+++ physical.h 12 Jun 2009 13:06:16 -0000 1.56
@@ -85,11 +85,7 @@
, pa_to = 50 /**< op:to operator */
, pa_count_ext = 54 /**< Count operator with loop backup
for empty values*/
- , pa_count = 55 /**< Count operator */
- , pa_avg = 56 /**< Avg operator */
- , pa_max = 57 /**< Max operator */
- , pa_min = 58 /**< Min operator */
- , pa_sum = 59 /**< Sum operator */
+ , pa_aggr = 55 /**< aggregate operator */
, pa_mark = 60 /**< consecutive numbering operator
(starting from 1) */
, pa_rank = 61 /**< ranking operator */
@@ -99,10 +95,6 @@
certain type */
, pa_type_assert = 64 /**< restriction of the type of a given column */
, pa_cast = 65 /**< cast a table to a given type */
- , pa_seqty1 = 66 /**< test for exactly one type occurrence in one
- iteration (Pathfinder extension) */
- , pa_all = 67 /**< test if all items in an iteration are true */
- , pa_prod = 68 /**< product aggregate, should be after pa_sum */
, pa_llscjoin = 100 /**< Loop-Lifted StaircaseJoin */
, pa_llscjoin_dup = 101 /**< Loop-Lifted StaircaseJoin with duplicates */
, pa_doc_tbl = 120 /**< Access to persistent document relation */
@@ -249,13 +241,13 @@
} count;
/*
- * semantic content for operators applying a
- * (partitioned) aggregation function (sum, min, max and avg) on a column
+ * semantic content for operators applying a
+ * (partitioned) aggregation function
*/
struct {
- PFalg_col_t col; /**< column to be used for the agg. func. */
- PFalg_col_t part; /**< partitioning column */
- PFalg_col_t res; /**< column to hold the result */
+ PFalg_col_t part; /**< partitioning column */
+ unsigned int count; /**< length of the aggregate list */
+ PFalg_aggr_t *aggr; /**< aggregate list */
} aggr;
/* semantic content for mark operators */
@@ -653,20 +645,12 @@
PFalg_col_t, PFalg_col_t, PFalg_col_t);
/**
- * Count: Count function operator. Does neither benefit from
- * any existing ordering, nor does it provide/preserve any input
- * ordering.
- */
-PFpa_op_t *PFpa_count (const PFpa_op_t *,
- PFalg_col_t, PFalg_col_t);
-
-/**
* Aggr: Aggregation function operator. Does neither benefit from
* any existing ordering, nor does it provide/preserve any input
* ordering.
*/
-PFpa_op_t *PFpa_aggr (PFpa_op_kind_t kind, const PFpa_op_t *n, PFalg_col_t
res,
- PFalg_col_t col, PFalg_col_t part);
+PFpa_op_t * PFpa_aggr (const PFpa_op_t *n, PFalg_col_t part,
+ unsigned int count, PFalg_aggr_t *aggr);
/****************************************************************/
U logical_mnemonic.h
Index: logical_mnemonic.h
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/include/logical_mnemonic.h,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- logical_mnemonic.h 8 Jan 2009 16:54:12 -0000 1.41
+++ logical_mnemonic.h 12 Jun 2009 13:06:16 -0000 1.42
@@ -105,14 +105,11 @@
/* op:to operator */
#define to(a,b,c,d) PFla_to ((a),(b),(c),(d))
-/* operator applying a (partitioned) aggregation function on a column */
-#define aggr(a,b,c,d,e) PFla_aggr ((a),(b),(c),(d),(e))
-
-/* (partitioned) row counting operator */
-#define count(a,b,c) PFla_count ((a),(b),(c))
+/* operator applying a (partitioned) aggregation function */
+#define aggr(a,b,c,d) PFla_aggr ((a),(b),(c),(d))
/** rownumber operator */
-#define rownum(a,b,c,d) PFla_rownum ((a),(b),(c),(d))
+#define rownum(a,b,c,d) PFla_rownum ((a),(b),(c),(d))
/** rowrank operator */
#define rowrank(a,b,c) PFla_rowrank ((a),(b),(c))
@@ -133,12 +130,6 @@
/* type cast operator */
#define cast(a,b,c,d) PFla_cast ((a),(b),(c),(d))
-/* algebra seqty1 operator (see PFla_seqty1()) */
-#define seqty1(a,b,c,d) PFla_seqty1((a), (b), (c), (d))
-
-/* all operator (see PFla_all()) */
-#define all(a,b,c,d) PFla_all((a), (b), (c), (d))
-
/* path step */
#define step(a,b,c,d,e,f,g) PFla_step ((a),(b),(c),(d),(e),(f),(g))
#define step_join(a,b,c,d,e,f) PFla_step_join ((a),(b),(c),(d),(e),(f))
U algebra.h
Index: algebra.h
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/include/algebra.h,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -d -r1.112 -r1.113
--- algebra.h 20 May 2009 08:42:23 -0000 1.112
+++ algebra.h 12 Jun 2009 13:06:15 -0000 1.113
@@ -457,6 +457,29 @@
};
typedef enum PFalg_doc_tbl_kind_t PFalg_doc_tbl_kind_t;
+/* ................ aggregate specification ................. */
+
+enum PFalg_aggr_kind_t {
+ alg_aggr_dist /**< aggregate of a column that functionally
+ depends on the partitioning column */
+ , alg_aggr_count /**< count aggregate */
+ , alg_aggr_min /**< minimum aggregate */
+ , alg_aggr_max /**< maximum aggregate */
+ , alg_aggr_avg /**< average aggregate */
+ , alg_aggr_sum /**< sum aggregate */
+ , alg_aggr_seqty1 /**< sequence type matching for `1' occurrence */
+ , alg_aggr_all /**< all existential quantifier */
+ , alg_aggr_prod /**< product aggregate */
+};
+typedef enum PFalg_aggr_kind_t PFalg_aggr_kind_t;
+
+struct PFalg_aggr_t {
+ PFalg_aggr_kind_t kind; /**< aggregate kind */
+ PFalg_col_t res; /**< result column */
+ PFalg_col_t col; /**< input column */
+};
+typedef struct PFalg_aggr_t PFalg_aggr_t;
+
/* ............. document fields specification .............. */
enum PFalg_doc_t {
@@ -640,6 +663,18 @@
char * PFalg_fun_str (PFalg_fun_t fun);
/**
+ * Print aggregate kind
+ */
+char * PFalg_aggr_kind_str (PFalg_aggr_kind_t kind);
+
+/**
+ * Construct an aggregate entry.
+ */
+PFalg_aggr_t PFalg_aggr (PFalg_aggr_kind_t kind,
+ PFalg_col_t res,
+ PFalg_col_t col);
+
+/**
* Construct a predicate.
*/
PFalg_sel_t PFalg_sel (PFalg_comp_t comp,
U physical_mnemonic.h
Index: physical_mnemonic.h
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/include/physical_mnemonic.h,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- physical_mnemonic.h 20 May 2009 16:00:46 -0000 1.40
+++ physical_mnemonic.h 12 Jun 2009 13:06:16 -0000 1.41
@@ -96,9 +96,8 @@
#define to(a,b,c,d) PFpa_to ((a), (b), (c), (d))
-#define count(a,b,c) PFpa_count ((a), (b), (c))
#define ecount(a,b,c,d,e) PFpa_count_ext ((a), (b), (c), (d), (e))
-#define aggr(a,b,c,d,e) PFpa_aggr ((a), (b), (c), (d), (e))
+#define aggr(a,b,c,d) PFpa_aggr ((a), (b), (c), (d))
/** a sort specification list is just another attribute list */
#define sortby(...) PFord_order_intro (__VA_ARGS__)
U xml2lalg_converters.h
Index: xml2lalg_converters.h
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/include/xml2lalg_converters.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- xml2lalg_converters.h 6 May 2009 21:32:39 -0000 1.11
+++ xml2lalg_converters.h 12 Jun 2009 13:06:16 -0000 1.12
@@ -56,6 +56,8 @@
PFalg_comp_t PFxml2la_conv_2PFLA_comparisonType (char* s);
+PFalg_aggr_kind_t PFxml2la_conv_2PFLA_aggregateType (char* s);
+
PFalg_fun_t PFxml2la_conv_2PFLA_functionType (char* s);
bool PFxml2la_conv_2PFLA_orderingDirection (char* s);
U logical.h
Index: logical.h
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/include/logical.h,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -d -r1.68 -r1.69
--- logical.h 10 Mar 2009 12:20:43 -0000 1.68
+++ logical.h 12 Jun 2009 13:06:16 -0000 1.69
@@ -89,11 +89,7 @@
, la_bool_or = 29 /**< boolean OR operator */
, la_bool_not = 30 /**< boolean NOT operator */
, la_to = 31 /**< op:to operator */
- , la_avg = 32 /**< operator for (partitioned) avg of a column
*/
- , la_max = 33 /**< operator for (partitioned) max of a column
*/
- , la_min = 34 /**< operator for (partitioned) min of a column
*/
- , la_sum = 35 /**< operator for (partitioned) sum of a column
*/
- , la_count = 36 /**< (partitioned) row counting operator */
+ , la_aggr = 32 /**< (partitioned) aggregate operator */
/* Semantics of la_row_num, la_rowrank, la_rank, and la_rowid:
- la_rownum behaves exactly like SQLs ROW_NUMBER. It is used to generate
position values.
@@ -118,9 +114,6 @@
certain type */
, la_type_assert = 42 /**< restricts the type of a relation */
, la_cast = 43 /**< type cast of a column */
- , la_seqty1 = 44 /**< test for exactly one type occurrence in one
- iteration (Pathfinder extension) */
- , la_all = 45 /**< test if all items in an iteration are true
*/
, la_step = 50 /**< XPath location step */
, la_step_join = 51 /**< duplicate generating path step */
, la_guide_step = 52 /**< XPath location step
@@ -179,11 +172,8 @@
/* builtin support for XQuery functions */
, la_string_join =102 /**< fn:string-join */
- , la_prod =110 /**< pf:product should be after la_sum */
-
, la_dummy =120 /**< dummy operator that does nothing */
-
};
/** algebra operator kinds */
typedef enum PFla_op_kind_t PFla_op_kind_t;
@@ -312,15 +302,12 @@
/*
* semantic content for operators applying a
- * (partitioned) aggregation function (count, sum, min, max and avg)
- * on a column
- * or a boolean grouping function (seqty1, all,...)
+ * (partitioned) aggregation function
*/
struct {
- PFalg_col_t col; /**< column to be used for the agg. func. */
- /* Note that 'col' is ignored by la_count
*/
PFalg_col_t part; /**< partitioning column */
- PFalg_col_t res; /**< column to hold the result */
+ unsigned int count; /**< length of the aggregate list */
+ PFalg_aggr_t *aggr; /**< aggregate list */
} aggr;
/* semantic content for rownumber, rowrank, and rank operator */
@@ -817,10 +804,10 @@
/**
* Constructor for operators forming the application of a
- * (partitioned) aggregation function (sum, min, max and avg) on a column.
+ * (partitioned) aggregation function.
*/
-PFla_op_t * PFla_aggr (PFla_op_kind_t kind, const PFla_op_t *n,
- PFalg_col_t res, PFalg_col_t col, PFalg_col_t part);
+PFla_op_t * PFla_aggr (const PFla_op_t *n, PFalg_col_t part,
+ unsigned int count, PFalg_aggr_t *aggr);
/** Constructor for (partitioned) row counting operators. */
PFla_op_t * PFla_count (const PFla_op_t *n, PFalg_col_t res,
@@ -869,18 +856,6 @@
PFla_op_t * PFla_cast (const PFla_op_t *n, PFalg_col_t res, PFalg_col_t col,
PFalg_simple_type_t ty);
-/** Constructor for sequence type matching operator for `1' occurrence */
-PFla_op_t * PFla_seqty1 (const PFla_op_t *n,
- PFalg_col_t res, PFalg_col_t col, PFalg_col_t part);
-
-/**
- * Constructor for `all' test.
- * (Do all tuples in partition @a part carry the value true in
- * column @a item ?)
- */
-PFla_op_t * PFla_all (const PFla_op_t *n, PFalg_col_t res,
- PFalg_col_t col, PFalg_col_t part);
-
/**
* Constructor for XPath step evaluation.
*/
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins