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