Commit 6691d12e authored by Olivier Bertrand's avatar Olivier Bertrand

- Make another temporary fix for the compiler bug in CalculateArray

  modified:   storage/connect/jsonudf.cpp
  modified:   storage/connect/tabjson.cpp
parent bcfb5b2d
......@@ -497,7 +497,7 @@ PVAL JSNX::ExpandArray(PGLOBAL g, PJAR arp, int n)
/*********************************************************************************/
PVAL JSNX::CalculateArray(PGLOBAL g, PJAR arp, int n)
{
int i, ars = arp->size(), nv = 0, nextsame = 0;
int i, ars = arp->size(), nv = 0;
bool err;
OPVAL op = Nodes[n].Op;
PVAL val[2], vp = Nodes[n].Valp;
......@@ -507,17 +507,11 @@ PVAL JSNX::CalculateArray(PGLOBAL g, PJAR arp, int n)
vp->Reset();
if (trace)
htrc("CalculateArray size=%d\n", ars);
else // This is temporary until we find a better way to fix the compiler
htrc(""); // bug sometime causing the next loop to be executed only once.
htrc("CalculateArray size=%d op=%d\n", ars, op);
for (i = 0; i < ars; i++) {
jvrp = arp->GetValue(i);
if (trace)
htrc("i=%d Value %s null=%d nv=%d\n",
i, jvrp->GetString(g), jvrp->IsNull() ? 1 : 0, nv);
if (!jvrp->IsNull() || (op == OP_CNC && GetJsonNull())) {
if (jvrp->IsNull()) {
jvrp->Value = AllocateValue(g, GetJsonNull(), TYPE_STRING);
......@@ -528,6 +522,10 @@ PVAL JSNX::CalculateArray(PGLOBAL g, PJAR arp, int n)
} else
jvp = jvrp;
if (trace)
htrc("jvp=%s null=%d\n",
jvp->GetString(g), jvp->IsNull() ? 1 : 0);
if (!nv++) {
SetJsonValue(g, vp, jvp, n);
continue;
......@@ -560,6 +558,13 @@ PVAL JSNX::CalculateArray(PGLOBAL g, PJAR arp, int n)
if (err)
vp->Reset();
if (trace) {
char buf(32);
htrc("vp='%s' err=%d\n",
vp->GetCharString(&buf), err ? 1 : 0);
} // endif trace
} // endif Zero
} // endif jvrp
......@@ -577,7 +582,6 @@ PVAL JSNX::CalculateArray(PGLOBAL g, PJAR arp, int n)
} // endif Op
//Tjp->NextSame = nextsame;
return vp;
} // end of CalculateArray
......
......@@ -1592,9 +1592,9 @@ PVAL JSONCOL::CalculateArray(PGLOBAL g, PJAR arp, int n)
ars = MY_MIN(Tjp->Limit, arp->size());
if (trace)
htrc("CalculateArray size=%d\n", ars);
else // This is temporary until we find a better way to fix the compiler
htrc(""); // bug sometime causing the next loop to be executed only once.
htrc("CalculateArray size=%d op=%d nextsame=%d\n", ars, op, nextsame);
else // This seems to prevent a bug in zip.test
htrc("");
for (i = 0; i < ars; i++) {
jvrp = arp->GetValue(i);
......@@ -1614,7 +1614,11 @@ PVAL JSONCOL::CalculateArray(PGLOBAL g, PJAR arp, int n)
} else
jvp = jvrp;
if (!nv++) {
if (trace)
htrc("jvp=%s null=%d\n",
jvp->GetString(g), jvp->IsNull() ? 1 : 0);
if (!nv++) {
SetJsonValue(g, vp, jvp, n);
continue;
} else
......@@ -1630,7 +1634,7 @@ PVAL JSONCOL::CalculateArray(PGLOBAL g, PJAR arp, int n)
val[0] = MulVal;
err = vp->Compute(g, val, 1, op);
break;
break;
// case OP_NUM:
case OP_SEP:
val[0] = Nodes[n].Valp;
......@@ -1646,7 +1650,14 @@ PVAL JSONCOL::CalculateArray(PGLOBAL g, PJAR arp, int n)
if (err)
vp->Reset();
} // endif Null
if (trace) {
char buf(32);
htrc("vp='%s' err=%d\n",
vp->GetCharString(&buf), err ? 1 : 0);
} // endif trace
} // endif Null
} while (Tjp->NextSame > nextsame);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment