Changeset: 80d63534019f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=80d63534019f
Modified Files:
monetdb5/optimizer/opt_generator.c
monetdb5/optimizer/opt_macro.c
monetdb5/optimizer/opt_mergetable.c
monetdb5/optimizer/opt_multiplex.c
monetdb5/optimizer/opt_pipes.c
monetdb5/optimizer/opt_support.c
monetdb5/optimizer/opt_wrapper.c
monetdb5/optimizer/optimizer.c
Branch: default
Log Message:
Missing MAL error codes
diffs (297 lines):
diff --git a/monetdb5/optimizer/opt_generator.c
b/monetdb5/optimizer/opt_generator.c
--- a/monetdb5/optimizer/opt_generator.c
+++ b/monetdb5/optimizer/opt_generator.c
@@ -118,7 +118,7 @@ OPTgeneratorImplementation(Client cntxt,
errorCheck(p,algebraRef,getArg(p,2));
} else if ( getModuleId(p) == sqlRef && getFunctionId(p) ==
putName("exportValue") && isaBatType(getArgType(mb,p,0)) ){
// interface expects scalar type only, not expressable
in MAL signature
- mb->errors=createException(MAL, "generate_series",
"internal error, generate_series is a table producing function");
+ mb->errors=createException(MAL, "generate_series",
SQLSTATE(42000) "internal error, generate_series is a table producing
function");
}else if ( getModuleId(p) == batcalcRef && getFunctionId(p) ==
bteRef && series[getArg(p,1)] && p->argc == 2 ){
casting(bte);
} else if ( getModuleId(p) == batcalcRef && getFunctionId(p) ==
shtRef && series[getArg(p,1)] && p->argc == 2 ){
diff --git a/monetdb5/optimizer/opt_macro.c b/monetdb5/optimizer/opt_macro.c
--- a/monetdb5/optimizer/opt_macro.c
+++ b/monetdb5/optimizer/opt_macro.c
@@ -231,7 +231,7 @@ MACROvalidate(MalBlkPtr mb)
retseen = p->token == RETURNsymbol || p->token == YIELDsymbol
|| p->barrier == RETURNsymbol || p->barrier == YIELDsymbol;
}
if (retseen && i != mb->stop - 1)
- throw(MAL, "optimizer.MACROvalidate", MACRO_SYNTAX_ERROR);
+ throw(MAL, "optimizer.MACROvalidate", SQLSTATE(HY002)
MACRO_SYNTAX_ERROR);
return MAL_SUCCEED;
}
@@ -253,7 +253,7 @@ MACROprocessor(Client cntxt, MalBlkPtr m
if (getFunctionId(q) && idcmp(getFunctionId(q), t->name) == 0
&&
getSignature(t)->token == FUNCTIONsymbol) {
if (i == last)
- throw(MAL, "optimizer.MACROoptimizer",
MACRO_DUPLICATE);
+ throw(MAL, "optimizer.MACROoptimizer",
SQLSTATE(HY002) MACRO_DUPLICATE);
last = i;
i = inlineMALblock(mb, i, t->def);
@@ -262,7 +262,7 @@ MACROprocessor(Client cntxt, MalBlkPtr m
cnt++;
if (cnt > MAXEXPANSION)
- throw(MAL, "optimizer.MACROoptimizer",
MACRO_TOO_DEEP);
+ throw(MAL, "optimizer.MACROoptimizer",
SQLSTATE(HY002) MACRO_TOO_DEEP);
}
}
return msg;
@@ -514,7 +514,7 @@ str OPTmacro(Client cntxt, MalBlkPtr mb,
newComment(mb,buf);
addtoMalBlkHistory(mb);
if (mb->errors)
- throw(MAL, "optimizer.macro", PROGRAM_GENERAL);
+ throw(MAL, "optimizer.macro", SQLSTATE(42000) PROGRAM_GENERAL);
return msg;
}
@@ -557,6 +557,6 @@ str OPTorcam(Client cntxt, MalBlkPtr mb,
newComment(mb,buf);
addtoMalBlkHistory(mb);
if (mb->errors)
- throw(MAL, "optimizer.orcam", PROGRAM_GENERAL);
+ throw(MAL, "optimizer.orcam", SQLSTATE(42000) PROGRAM_GENERAL);
return msg;
}
diff --git a/monetdb5/optimizer/opt_mergetable.c
b/monetdb5/optimizer/opt_mergetable.c
--- a/monetdb5/optimizer/opt_mergetable.c
+++ b/monetdb5/optimizer/opt_mergetable.c
@@ -739,7 +739,7 @@ mat_joinNxM(Client cntxt, MalBlkPtr mb,
if (split < 0) {
GDKfree(mats);
- mb->errors= createException(MAL,"mergetable.join","
incorrect split level");
+ mb->errors= createException(MAL,"mergetable.join",
SQLSTATE(42000) " incorrect split level");
return 0;
}
/* now detect split point */
diff --git a/monetdb5/optimizer/opt_multiplex.c
b/monetdb5/optimizer/opt_multiplex.c
--- a/monetdb5/optimizer/opt_multiplex.c
+++ b/monetdb5/optimizer/opt_multiplex.c
@@ -48,9 +48,9 @@ OPTexpandMultiplex(Client cntxt, MalBlkP
for (i = 0; i < pci->retc; i++) {
tt = getBatType(getArgType(mb, pci, i));
if (tt== TYPE_any)
- throw(MAL, "optimizer.multiplex", "Target tail type is
missing");
+ throw(MAL, "optimizer.multiplex", SQLSTATE(HY002)
"Target tail type is missing");
if (isAnyExpression(getArgType(mb, pci, i)))
- throw(MAL, "optimizer.multiplex", "Target type is
missing");
+ throw(MAL, "optimizer.multiplex", SQLSTATE(HY002)
"Target type is missing");
}
mod = VALget(&getVar(mb, getArg(pci, pci->retc))->value);
@@ -71,7 +71,7 @@ OPTexpandMultiplex(Client cntxt, MalBlkP
break;
}
if( i == pci->argc)
- throw(MAL, "optimizer.multiplex", "Iterator BAT type is
missing");
+ throw(MAL, "optimizer.multiplex", SQLSTATE(HY002) "Iterator BAT
type is missing");
#ifdef DEBUG_OPT_MULTIPLEX
{ char *tpenme;
diff --git a/monetdb5/optimizer/opt_pipes.c b/monetdb5/optimizer/opt_pipes.c
--- a/monetdb5/optimizer/opt_pipes.c
+++ b/monetdb5/optimizer/opt_pipes.c
@@ -262,11 +262,11 @@ addPipeDefinition(Client cntxt, const ch
if (i == MAXOPTPIPES) {
MT_lock_unset(&pipeLock);
- throw(MAL, "optimizer.addPipeDefinition", "Out of slots");
+ throw(MAL, "optimizer.addPipeDefinition", SQLSTATE(HY001) "Out
of slots");
}
if (pipes[i].name && pipes[i].builtin) {
MT_lock_unset(&pipeLock);
- throw(MAL, "optimizer.addPipeDefinition", "No overwrite of
built in allowed");
+ throw(MAL, "optimizer.addPipeDefinition", SQLSTATE(42000) "No
overwrite of built in allowed");
}
/* save old value */
@@ -352,7 +352,7 @@ getPipeCatalog(bat *nme, bat *def, bat *
BBPreclaim(b);
BBPreclaim(bn);
BBPreclaim(bs);
- throw(MAL,"getPipeCatalog","#MAL.getAddress address of
'%s' not found",pipes[i].name);
+ throw(MAL,"getPipeCatalog", SQLSTATE(HY002)
"#MAL.getAddress address of '%s' not found",pipes[i].name);
}
if (BUNappend(b, pipes[i].name, FALSE) != GDK_SUCCEED ||
BUNappend(bn, pipes[i].def, FALSE) != GDK_SUCCEED ||
@@ -378,7 +378,7 @@ validatePipe(MalBlkPtr mb)
InstrPtr p;
if (mb == NULL )
- throw(MAL, "optimizer.validate", "missing optimizer mal
block\n");
+ throw(MAL, "optimizer.validate", SQLSTATE(42000) "missing
optimizer mal block\n");
p = getInstrPtr(mb,1);
if (getFunctionId(p) == NULL || idcmp(getFunctionId(p), "inline"))
throw(MAL, "optimizer.validate", SQLSTATE(42000) "'inline'
should be the first\n");
@@ -501,7 +501,7 @@ addOptimizerPipe(Client cntxt, MalBlkPtr
break;
if (i == MAXOPTPIPES)
- throw(MAL, "optimizer.addOptimizerPipe", "Out of slots");
+ throw(MAL, "optimizer.addOptimizerPipe", SQLSTATE(HY001) "Out
of slots");
if (pipes[i].mb == NULL)
msg = compileOptimizer(cntxt, name);
@@ -513,7 +513,7 @@ addOptimizerPipe(Client cntxt, MalBlkPtr
continue;
p = copyInstruction(q);
if (!p) { // oh malloc you cruel mistress
- throw(MAL, "optimizer.addOptimizerPipe", "Out
of memory");
+ throw(MAL, "optimizer.addOptimizerPipe",
SQLSTATE(HY001) "Out of memory");
}
for (k = 0; k < p->argc; k++)
getArg(p, k) = cloneVariable(mb, pipes[i].mb,
getArg(p, k));
diff --git a/monetdb5/optimizer/opt_support.c b/monetdb5/optimizer/opt_support.c
--- a/monetdb5/optimizer/opt_support.c
+++ b/monetdb5/optimizer/opt_support.c
@@ -100,7 +100,7 @@ optimizeMALBlock(Client cntxt, MalBlkPtr
mb->optimize = 0;
if (mb->errors)
- throw(MAL, "optimizer.MALoptimizer", "Start with inconsistent
MAL plan");
+ throw(MAL, "optimizer.MALoptimizer", SQLSTATE(42000) "Start
with inconsistent MAL plan");
// strong defense line, assure that MAL plan is initially correct
if( mb->errors == 0 && mb->stop > 1){
@@ -144,7 +144,7 @@ optimizeMALBlock(Client cntxt, MalBlkPtr
}
if (cntxt->mode == FINISHCLIENT){
mb->optimize = GDKusec() - clk;
- throw(MAL, "optimizeMALBlock",
"prematurely stopped client");
+ throw(MAL, "optimizeMALBlock",
SQLSTATE(42000) "prematurely stopped client");
}
pc= -1;
}
@@ -159,7 +159,7 @@ wrapup:
newComment(mb, buf);
}
if (cnt >= mb->stop)
- throw(MAL, "optimizer.MALoptimizer", OPTIMIZER_CYCLE);
+ throw(MAL, "optimizer.MALoptimizer", SQLSTATE(42000)
OPTIMIZER_CYCLE);
return msg;
}
@@ -518,14 +518,14 @@ isBlocking(InstrPtr p)
static int
isOrderDepenent(InstrPtr p)
{
- if( getModuleId(p) != batsqlRef)
- return 0;
- if ( getFunctionId(p) == differenceRef ||
- getFunctionId(p) == row_numberRef ||
- getFunctionId(p) == rankRef ||
- getFunctionId(p) == dense_rankRef)
- return 1;
- return 0;
+ if( getModuleId(p) != batsqlRef)
+ return 0;
+ if ( getFunctionId(p) == differenceRef ||
+ getFunctionId(p) == row_numberRef ||
+ getFunctionId(p) == rankRef ||
+ getFunctionId(p) == dense_rankRef)
+ return 1;
+ return 0;
}
int isMapOp(InstrPtr p){
@@ -581,12 +581,12 @@ int
isMatJoinOp(InstrPtr p)
{
return (isSubJoin(p) || (getModuleId(p) == algebraRef &&
- (getFunctionId(p) == crossRef ||
- getFunctionId(p) == joinRef ||
- getFunctionId(p) == antijoinRef || /* is not mat save */
- getFunctionId(p) == thetajoinRef ||
- getFunctionId(p) == bandjoinRef ||
- getFunctionId(p) == rangejoinRef)
+ (getFunctionId(p) == crossRef ||
+ getFunctionId(p) == joinRef ||
+ getFunctionId(p) == antijoinRef || /* is not
mat save */
+ getFunctionId(p) == thetajoinRef ||
+ getFunctionId(p) == bandjoinRef ||
+ getFunctionId(p) == rangejoinRef)
));
}
diff --git a/monetdb5/optimizer/opt_wrapper.c b/monetdb5/optimizer/opt_wrapper.c
--- a/monetdb5/optimizer/opt_wrapper.c
+++ b/monetdb5/optimizer/opt_wrapper.c
@@ -104,16 +104,16 @@ str OPTwrapper (Client cntxt, MalBlkPtr
str msg = MAL_SUCCEED;
lng clk;
- if (cntxt->mode == FINISHCLIENT)
- throw(MAL, "optimizer", "prematurely stopped client");
+ if (cntxt->mode == FINISHCLIENT)
+ throw(MAL, "optimizer", SQLSTATE(42000) "prematurely stopped
client");
if( p == NULL)
- throw(MAL, "opt_wrapper", "missing optimizer statement");
+ throw(MAL, "opt_wrapper", SQLSTATE(HY002) "missing optimizer
statement");
if( mb->errors)
- throw(MAL, "opt_wrapper", "MAL block contains errors");
+ throw(MAL, "opt_wrapper", SQLSTATE(42000) "MAL block contains
errors");
snprintf(optimizer,256,"%s", fcnnme = getFunctionId(p));
-
+
OPTIMIZERDEBUG
fprintf(stderr,"=APPLY OPTIMIZER %s\n",fcnnme);
if( p && p->argc > 1 ){
@@ -122,7 +122,7 @@ str OPTwrapper (Client cntxt, MalBlkPtr
!isVarConstant(mb,getArg(p,1)) ||
!isVarConstant(mb,getArg(p,2))
)
- throw(MAL, optimizer, ILLARG_CONSTANTS);
+ throw(MAL, optimizer, SQLSTATE(42000) ILLARG_CONSTANTS);
if( stk != 0){
modnme= *getArgReference_str(stk,p,1);
@@ -135,7 +135,7 @@ str OPTwrapper (Client cntxt, MalBlkPtr
s= findSymbol(cntxt->usermodule,
putName(modnme),putName(fcnnme));
if( s == NULL)
- throw(MAL, optimizer, RUNTIME_OBJECT_UNDEFINED
":%s.%s", modnme, fcnnme);
+ throw(MAL, optimizer, SQLSTATE(HY002)
RUNTIME_OBJECT_UNDEFINED ":%s.%s", modnme, fcnnme);
mb = s->def;
stk= 0;
} else if( p )
@@ -148,18 +148,18 @@ str OPTwrapper (Client cntxt, MalBlkPtr
codes[i].timing += GDKusec() - clk;
codes[i].calls++;
if (msg)
- throw(MAL, optimizer, "Error in optimizer %s",
optimizer);
+ throw(MAL, optimizer, SQLSTATE(42000) "Error in
optimizer %s", optimizer);
break;
}
if (codes[i].nme == 0)
- throw(MAL, optimizer, "Optimizer implementation '%s' missing",
fcnnme);
+ throw(MAL, optimizer, SQLSTATE(HY002) "Optimizer implementation
'%s' missing", fcnnme);
OPTIMIZERDEBUG {
fprintf(stderr,"=FINISHED %s %d\n",optimizer, actions);
fprintFunction(stderr,mb,0,LIST_MAL_DEBUG );
}
if ( mb->errors)
- throw(MAL, optimizer, PROGRAM_GENERAL ":%s.%s", modnme, fcnnme);
+ throw(MAL, optimizer, SQLSTATE(42000) PROGRAM_GENERAL ":%s.%s",
modnme, fcnnme);
return MAL_SUCCEED;
}
diff --git a/monetdb5/optimizer/optimizer.c b/monetdb5/optimizer/optimizer.c
--- a/monetdb5/optimizer/optimizer.c
+++ b/monetdb5/optimizer/optimizer.c
@@ -67,7 +67,7 @@ QOToptimize(Client cntxt, MalBlkPtr mb,
}
s = findSymbol(cntxt->usermodule, putName(modnme), fcnnme);
if (s == NULL)
- throw(MAL, "optimizer.optimize", SEMANTIC_OPERATION_MISSING);
+ throw(MAL, "optimizer.optimize", SQLSTATE(HY002)
SEMANTIC_OPERATION_MISSING);
removeInstruction(mb, pci);
addtoMalBlkHistory(s->def);
return optimizeMALBlock(cntxt, s->def);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list