Changeset: 6804b69cd90f for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6804b69cd90f Modified Files: sql/backends/monet5/sql_arrays.c sql/backends/monet5/sql_arrays.mal Branch: arrays Log Message:
removed unused code diffs (truncated from 695 to 300 lines): diff --git a/sql/backends/monet5/sql_arrays.c b/sql/backends/monet5/sql_arrays.c --- a/sql/backends/monet5/sql_arrays.c +++ b/sql/backends/monet5/sql_arrays.c @@ -72,13 +72,13 @@ static gdk_array* get_array(sql_table *t } str mvc_bind_array_dimension(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) { - ptr* dim_res = getArgReference_ptr(stk, pci, 0); - ptr* dims_res = getArgReference_ptr(stk, pci, 1); + ptr* dim = getArgReference_ptr(stk, pci, 0); + ptr* array = getArgReference_ptr(stk, pci, 1); mvc *m = NULL; str msg; sql_schema *s = NULL; sql_table *t = NULL; - sql_dimension *dim = NULL; + sql_dimension *d = NULL; str *sname = getArgReference_str(stk, pci, 3); str *tname = getArgReference_str(stk, pci, 4); str *dname = getArgReference_str(stk, pci, 5); @@ -94,13 +94,12 @@ str mvc_bind_array_dimension(Client cntx t = mvc_bind_table(m, s, *tname); if (t == NULL) throw(SQL, "sql.bind_array_dimension", "unable to find %s.%s(%s)", *sname, *tname, *dname); - dim = mvc_bind_dimension(m, t, *dname); + d = mvc_bind_dimension(m, t, *dname); if (dim == NULL) throw(SQL, "sql.bind_array_dimension", "unable to find %s.%s(%s)", *sname, *tname, *dname); - - *dim_res = generaliseDimension_analytic(dim); - *dims_res = get_array(t); + *array = get_array(t); + *dim = generaliseDimension_analytic(d); return MAL_SUCCEED; } @@ -108,7 +107,7 @@ str mvc_bind_array_dimension(Client cntx str mvc_bind_array_column(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) { BAT *b = NULL; bat *bid = getArgReference_bat(stk, pci, 0); - ptr* dims_res = getArgReference_ptr(stk, pci, 1); + ptr* array = getArgReference_ptr(stk, pci, 1); mvc *m = NULL; str msg; @@ -135,7 +134,7 @@ str mvc_bind_array_column(Client cntxt, if (c == NULL) throw(SQL, "sql.bind_array_column", "unable to find %s.%s(%s)", *sname, *tname, *cname); - *dims_res = get_array(t); + *array = get_array(t); /*bind the column*/ b = store_funcs.bind_col(m->session->tr, c, 0); @@ -148,605 +147,3 @@ str mvc_bind_array_column(Client cntxt, throw(SQL, "sql.bind_array_column", "unable to find %s.%s(%s)", *sname, *tname, *cname); throw(SQL, "sql.bind_array_column", "unable to find %s(%s)", *tname, *cname); } - - -#if 0 -//when the column belongs to an array extra values should be added in order to -//have values for all cells int he array -BAT* mvc_fill_values(sql_column *c, BAT *b_in, unsigned int cellsNum, void* defVal) { - BAT *b = NULL; - -#define fillVals(TPE, def) \ - do { \ - TPE *elements_in = NULL, *elements = NULL; \ - BUN i; \ -\ - if((b = BATnew(TYPE_void, TYPE_##TPE, cellsNum, TRANSIENT)) == NULL) \ - return NULL; \ -\ - elements = (TPE*) Tloc(b, BUNfirst(b)); \ - elements_in = (TPE*) Tloc(b_in, BUNfirst(b_in)); \ -\ - /*Add the elements that have been inserted into the cells*/ \ - for(i=0; i<BATcount(b_in); i++) { \ - elements[i] = elements_in[i]; \ - } \ - /*Fill the rest of the cells with the default value or NULL if no \ - * default values is provided*/ \ - for(;i<cellsNum; i++) { \ - elements[i] = def; \ - } \ -\ - b->tsorted = 0; \ - b->trevsorted = 0; \ - } while (0) - - switch (c->type.type->localtype) { - case TYPE_bte: - if(!defVal) - fillVals(bte, bte_nil); - else - fillVals(bte, *(bte*)defVal); - break; - case TYPE_sht: - if(!defVal) - fillVals(sht, sht_nil); - else - fillVals(sht, *(sht*)defVal); - break; - case TYPE_int: - if(!defVal) - fillVals(int, int_nil); - else - fillVals(int, *(int*)defVal); - break; - case TYPE_lng: - if(!defVal) - fillVals(lng, lng_nil); - else - fillVals(lng, *(lng*)defVal); - break; -#ifdef HAVE_HGE - case TYPE_hge: - if(!defVal) - fillVals(hge, hge_nil); - else - fillVals(hge, *(hge*)defVal); - break; -#endif - case TYPE_flt: - if(!defVal) - fillVals(flt, flt_nil); - else - fillVals(flt, *(flt*)defVal); - break; - case TYPE_dbl: - if(!defVal) - fillVals(dbl, dbl_nil); - else - fillVals(dbl, *(dbl*)defVal); - break; - case TYPE_str: { - BATiter iter; - BUN p = 0, q = 0; - - if((b = BATnew(TYPE_void, TYPE_str, cellsNum, TRANSIENT)) == NULL) - return NULL; - - /* create BAT iterator over the existing vals*/ - iter = bat_iterator(b_in); - - BATloop(b_in, p, q) { - char *t = (char *) BUNtail(iter, p); - - /* insert original head and tail in result BAT */ - BUNappend(b, t, TRUE); - } - - for(p=BATcount(b_in); p<cellsNum; p++) { - if(!defVal) - BUNappend(b,str_nil, TRUE); - else - BUNappend(b, (char*)defVal, TRUE); - } - - b->tsorted = 0; - b->trevsorted = 0; - - } - - break; - default: - fprintf(stderr, "mvc_fill_values: non-dimensional column type not handled\n"); - return NULL; - } - - BATsetcount(b,cellsNum); - BATseqbase(b,0); - BATderiveProps(b,FALSE); - - return b; -} - -static BAT* mvc_create_cells_bat(mvc *m, char *sname, char *tname, char *cname, void* defVal) { - sql_trans *tr = m->session->tr; - BAT *b = NULL; - sql_schema *s = NULL; - sql_table *t = NULL; - sql_column *c = NULL; - - s = mvc_bind_schema(m, sname); - if (s == NULL) - return NULL; - t = mvc_bind_table(m, s, tname); - if (t == NULL) - return NULL; - c = mvc_bind_column(m, t, cname); - if (c == NULL) - return NULL; - - b = store_funcs.bind_col(tr, c, 0); - - return mvc_fill_values(c, b, t->cellsNum, defVal); -} - -static BAT* -mvc_create_dimension_bat(mvc *m, char *sname, char *tname, char *dname) { - BAT *b = NULL; - sql_schema *s = NULL; - sql_table *t = NULL; - sql_dimension *dim = NULL; - - s = mvc_bind_schema(m, sname); - if (s == NULL) - return NULL; - t = mvc_bind_table(m, s, tname); - if (t == NULL) - return NULL; - dim = mvc_bind_dimension(m, t, dname); - if (dim == NULL) - return NULL; - -#define createDim(TPE, min, step, max) \ - do { \ - TPE /*it,*/ *elements = NULL; \ - long repeat1, repeat2, i, j; \ -\ - repeat1 = dim->lvl1_repeatsNum; \ - repeat2 = dim->lvl2_repeatsNum; \ -\ - if((b = BATnew(TYPE_void, TYPE_##TPE, repeat1+repeat2+1, TRANSIENT)) == NULL) \ - return NULL; \ -\ - elements = (TPE*) Tloc(b, BUNfirst(b)); \ - for(i=0; i<repeat1; i++) { \ - *elements = min; \ - elements++; \ - } \ -\ - for(j=0; j<repeat2; j++) { \ - *elements = max; \ - elements++; \ - } \ -\ - *elements = step; \ -\ - b->tsorted = 0; \ - b->trevsorted = 0; \ - b->batArray =1; \ - } while (0) - - atom_cast(dim->min, &dim->type); - atom_cast(dim->step, &dim->type); - atom_cast(dim->max, &dim->type); - - switch (dim->type.type->localtype) { - case TYPE_bte: - createDim(bte, dim->min->data.val.btval, dim->step->data.val.btval, dim->max->data.val.btval); - break; - case TYPE_sht: - createDim(sht, dim->min->data.val.shval, dim->step->data.val.shval, dim->max->data.val.shval); - break; - case TYPE_int: - createDim(int, dim->min->data.val.ival, dim->step->data.val.ival, dim->max->data.val.ival); - break; - case TYPE_lng: - createDim(lng, dim->min->data.val.lval, dim->step->data.val.lval, dim->max->data.val.lval); - break; -#ifdef HAVE_HGE - case TYPE_hge: - createDim(hge, dim->min->data.val.hval, dim->step->data.val.hval, dim->max->data.val.hval); - break; -#endif - case TYPE_flt: - createDim(flt, dim->min->data.val.fval, dim->step->data.val.fval, dim->max->data.val.fval); - break; - case TYPE_dbl: - createDim(dbl, dim->min->data.val.dval, dim->step->data.val.dval, dim->max->data.val.dval); - break; - case TYPE_str: - fprintf(stderr, "mvc_create_dimension_bat: str dimension needs special handling\n"); - return NULL; - default: - fprintf(stderr, "mvc_create_dimension_bat: dimension type not handled\n"); - return NULL; - } - -// BATsetcount(b,t->cellsNum); - BATsetcount(b,dim->lvl1_repeatsNum+dim->lvl2_repeatsNum+1); - BATseqbase(b,0); - BATderiveProps(b,FALSE); - - return b; -} - -static BAT* mvc_subselect_dimension_bat(mvc *m, char* sname, char* tname, char* dname, bat* cand, void* low, void* high, bit li, bit hi, bit anti) { - BAT *b = NULL, *candBAT, *b_tmp; - sql_schema *s = NULL; - sql_table *t = NULL; - sql_dimension *dim = NULL; - long elements_in_result = 0; - - s = mvc_bind_schema(m, sname); - if (s == NULL) _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list