Commit d466ed90 authored by Sergey Vojtovich's avatar Sergey Vojtovich

MDEV-6473 - main.statistics fails on PPC64

mysql.column_stats wasn't stored/restored properly on big-endian
with histogram_type=DOUBLE_PREC_HB.

Store histogram values using int2store()/uint2korr().

Note that this patch invalidates previously calculated histogram
values on big-endian.
parent a1e41e32
...@@ -602,7 +602,7 @@ String *Item_func_decode_histogram::val_str(String *str) ...@@ -602,7 +602,7 @@ String *Item_func_decode_histogram::val_str(String *str)
val= p[i] / ((double)((1 << 8) - 1)); val= p[i] / ((double)((1 << 8) - 1));
break; break;
case DOUBLE_PREC_HB: case DOUBLE_PREC_HB:
val= ((uint16 *)(p + i))[0] / ((double)((1 << 16) - 1)); val= uint2korr(p + i) / ((double)((1 << 16) - 1));
i++; i++;
break; break;
default: default:
......
...@@ -147,7 +147,7 @@ private: ...@@ -147,7 +147,7 @@ private:
case SINGLE_PREC_HB: case SINGLE_PREC_HB:
return (uint) (((uint8 *) values)[i]); return (uint) (((uint8 *) values)[i]);
case DOUBLE_PREC_HB: case DOUBLE_PREC_HB:
return (uint) (((uint16 *) values)[i]); return (uint) uint2korr(values + i * 2);
} }
return 0; return 0;
} }
...@@ -214,7 +214,7 @@ public: ...@@ -214,7 +214,7 @@ public:
((uint8 *) values)[i]= (uint8) (val * prec_factor()); ((uint8 *) values)[i]= (uint8) (val * prec_factor());
return; return;
case DOUBLE_PREC_HB: case DOUBLE_PREC_HB:
((uint16 *) values)[i]= (uint16) (val * prec_factor()); int2store(values + i * 2, val * prec_factor());
return; return;
} }
} }
...@@ -226,7 +226,7 @@ public: ...@@ -226,7 +226,7 @@ public:
((uint8 *) values)[i]= ((uint8 *) values)[i-1]; ((uint8 *) values)[i]= ((uint8 *) values)[i-1];
return; return;
case DOUBLE_PREC_HB: case DOUBLE_PREC_HB:
((uint16 *) values)[i]= ((uint16 *) values)[i-1]; int2store(values + i * 2, uint2korr(values + i * 2 - 2));
return; return;
} }
} }
......
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