Changeset: b1ba62ed5901 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b1ba62ed5901
Modified Files:
        sql/backends/monet5/sql_rdf.c
        sql/backends/monet5/sql_rdf.h
        sql/backends/monet5/sql_rdf_jgraph.c
Branch: rdf
Log Message:

Do not handle exception when pso size is 0


diffs (113 lines):

diff --git a/sql/backends/monet5/sql_rdf.c b/sql/backends/monet5/sql_rdf.c
--- a/sql/backends/monet5/sql_rdf.c
+++ b/sql/backends/monet5/sql_rdf.c
@@ -2395,6 +2395,8 @@ BAT               *global_mbat = NULL;
 BATiter        global_mapi; 
 PsoPropStat    *pso_propstat = NULL; /* Store the offsets of a prop 
                                         in the exceptional PSO table */
+int            need_handling_exception = 1;
+
 static
 void getOffsets(PsoPropStat *pso_pstat, oid *p, BUN *start, BUN *end){
 
@@ -2595,7 +2597,12 @@ str SQLrdfprepare(Client cntxt, MalBlkPt
        //print_simpleCSset(global_csset);
 
        printf("Done preparation\n"); 
-
+       
+       #if HANDLING_EXCEPTION
+       need_handling_exception = 1; 
+       #else
+       need_handling_exception = 0;    
+       #endif
        //Build pso_propstat to store offsets of each
        //P in PSO table
        {
@@ -2604,9 +2611,15 @@ str SQLrdfprepare(Client cntxt, MalBlkPt
                BAT *pso_fullSbat = mvc_bind(m, schema, "pso", "s",0);
                BAT *pso_fullObat = mvc_bind(m, schema, "pso", "o",0);
                build_PsoPropStat(pso_fullPbat, global_p_propstat->numAdded, 
pso_fullSbat, pso_fullObat); 
+                       
+               if (BATcount(pso_fullSbat) == 0) {
+                       need_handling_exception = 0; 
+                       printf("Do not need to handle exception\n"); 
+               }
                
        }
        
+
        /*
        {       //Test
                BAT *testBat = BATnew(TYPE_void, TYPE_str, 100, TRANSIENT); 
diff --git a/sql/backends/monet5/sql_rdf.h b/sql/backends/monet5/sql_rdf.h
--- a/sql/backends/monet5/sql_rdf.h
+++ b/sql/backends/monet5/sql_rdf.h
@@ -70,6 +70,7 @@ extern PropStat *global_c_propstat;
 extern BAT *global_mbat;
 extern BATiter global_mapi;
 extern PsoPropStat *pso_propstat; 
+extern int need_handling_exception; 
 
 #define APPLY_OPTIMIZATION_FOR_OPTIONAL        1       /* Instead of using 
left join, we use a project with ifthenelse */
                                                /* on the set of optional 
columns */
diff --git a/sql/backends/monet5/sql_rdf_jgraph.c 
b/sql/backends/monet5/sql_rdf_jgraph.c
--- a/sql/backends/monet5/sql_rdf_jgraph.c
+++ b/sql/backends/monet5/sql_rdf_jgraph.c
@@ -3626,28 +3626,28 @@ sql_rel* _group_star_pattern(mvc *c, jgr
                        exps_print_ext(c, union_rdfscan_exps, 0, 
"union_rdfscan_exps: ");
                        */
                        
-                       #if HANDLING_EXCEPTION
-
-                       rel_rdfscan = build_rdfexception(c, tmptbId[0], jg, 
union_rdfscan_exps, nijgroup, ijgroup, nnodes_per_ijgroup, spprops);
-                               
-                       printf("RDF exception\n"); 
-                       _rel_print(c, rel_rdfscan); 
-
-                       rel = rel_setop(c->sa, rel_alltable, rel_rdfscan, 
op_union); 
-                       rel->exps = sp_proj_exps[0]; 
-                       #else
-                       rel = rel_alltable; 
-                       #endif
+                       if (need_handling_exception){
+
+                               rel_rdfscan = build_rdfexception(c, tmptbId[0], 
jg, union_rdfscan_exps, nijgroup, ijgroup, nnodes_per_ijgroup, spprops);
+                                       
+                               printf("RDF exception\n"); 
+                               _rel_print(c, rel_rdfscan); 
+
+                               rel = rel_setop(c->sa, rel_alltable, 
rel_rdfscan, op_union); 
+                               rel->exps = sp_proj_exps[0]; 
+                       }
+                       else 
+                               rel = rel_alltable; 
 
                }
                else {
-                       #if HANDLING_EXCEPTION
-                       rel_rdfscan = build_rdfexception(c, -1, jg, NULL,  
nijgroup, ijgroup, nnodes_per_ijgroup, spprops);
-                       rel = rel_rdfscan; 
-                       #else
-                       printf("There must be a matching table!!!!!\n"); 
-                       assert(0); 
-                       #endif
+                       if (need_handling_exception){
+                               rel_rdfscan = build_rdfexception(c, -1, jg, 
NULL,  nijgroup, ijgroup, nnodes_per_ijgroup, spprops);
+                               rel = rel_rdfscan; 
+                       } else {
+                               printf("There must be a matching 
table!!!!!\n"); 
+                               assert(0); 
+                       }
                }
 
 
@@ -3869,6 +3869,8 @@ void buildJoinGraph(mvc *c, sql_rel *r, 
 void transform_to_rel_plan(mvc *c, sql_rel *r){
        int hasUnion = 0; 
 
+
+
        handling_Union(c, r, 0, &hasUnion);
 
        if (hasUnion == 0) {
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to