1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

MCOL-299 Change the getStrVal() for float and double to match the results of the mariadb display string for same.

This commit is contained in:
David Hall
2016-09-22 09:34:13 -05:00
parent e48ef0063a
commit afab801b5f
3 changed files with 555 additions and 471 deletions

View File

@ -39,8 +39,7 @@
#include "calpontsystemcatalog.h"
#include "exceptclasses.h"
#include "dataconvert.h"
namespace messageqcpp {
namespace messageqecpp {
class ByteStream;
}
@ -483,8 +482,24 @@ inline const std::string& TreeNode::getStrVal()
}
else
{
snprintf(tmp, 312, "%e", fResult.floatVal);
fResult.strVal = tmp;
// MCOL-299 Print scientific with 5 mantissa and no + sign for exponent
int exponent = (int)floor(log10( fabs(fResult.floatVal))); // This will round down the exponent
double base = fResult.floatVal * pow(10, -1.0*exponent);
if (isnan(exponent) || isnan(base))
{
snprintf(tmp, 312, "%f", fResult.floatVal);
fResult.strVal = removeTrailing0(tmp, 312);
}
else
{
snprintf(tmp, 312, "%.5f", base);
fResult.strVal = removeTrailing0(tmp, 312);
snprintf(tmp, 312, "e%02d", exponent);
fResult.strVal += tmp;
}
// snprintf(tmp, 312, "%e.5", fResult.floatVal);
// fResult.strVal = tmp;
}
break;
}
@ -499,8 +514,23 @@ inline const std::string& TreeNode::getStrVal()
}
else
{
snprintf(tmp, 312, "%e", fResult.doubleVal);
fResult.strVal = tmp;
// MCOL-299 Print scientific with 9 mantissa and no + sign for exponent
int exponent = (int)floor(log10( fabs(fResult.doubleVal))); // This will round down the exponent
double base = fResult.doubleVal * pow(10, -1.0*exponent);
if (isnan(exponent) || isnan(base))
{
snprintf(tmp, 312, "%f", fResult.doubleVal);
fResult.strVal = removeTrailing0(tmp, 312);
}
else
{
snprintf(tmp, 312, "%.9f", base);
fResult.strVal = removeTrailing0(tmp, 312);
snprintf(tmp, 312, "e%02d", exponent);
fResult.strVal += tmp;
}
// snprintf(tmp, 312, "%e", fResult.doubleVal);
// fResult.strVal = tmp;
}
break;
}

View File

@ -203,12 +203,14 @@
Name="Source Files"
Filters="*.c;*.C;*.cc;*.cpp;*.cp;*.cxx;*.c++;*.prg;*.pas;*.dpr;*.asm;*.s;*.bas;*.java;*.cs;*.sc;*.e;*.cob;*.html;*.rc;*.tcl;*.py;*.pl;*.d">
<F N="joiner.cpp"/>
<F N="joinpartition.cpp"/>
<F N="tuplejoiner.cpp"/>
</Folder>
<Folder
Name="Header Files"
Filters="*.h;*.H;*.hh;*.hpp;*.hxx;*.inc;*.sh;*.cpy;*.if">
<F N="joiner.h"/>
<F N="joinpartition.h"/>
<F N="tuplejoiner.h"/>
</Folder>
<Folder

View File

@ -211,6 +211,32 @@
<F N="messageqcpp/srv.cpp"/>
<F N="messageqcpp/tdriver.cpp"/>
</Folder>
<Folder
Name="querystats"
Filters="">
<F N="querystats/querystats.cpp"/>
</Folder>
<Folder
Name="windowfunction"
Filters="">
<F N="windowfunction/framebound.cpp"/>
<F N="windowfunction/frameboundrange.cpp"/>
<F N="windowfunction/frameboundrow.cpp"/>
<F N="windowfunction/idborderby.cpp"/>
<F N="windowfunction/wf_count.cpp"/>
<F N="windowfunction/wf_lead_lag.cpp"/>
<F N="windowfunction/wf_min_max.cpp"/>
<F N="windowfunction/wf_nth_value.cpp"/>
<F N="windowfunction/wf_ntile.cpp"/>
<F N="windowfunction/wf_percentile.cpp"/>
<F N="windowfunction/wf_ranking.cpp"/>
<F N="windowfunction/wf_row_number.cpp"/>
<F N="windowfunction/wf_stats.cpp"/>
<F N="windowfunction/wf_sum_avg.cpp"/>
<F N="windowfunction/windowframe.cpp"/>
<F N="windowfunction/windowfunction.cpp"/>
<F N="windowfunction/windowfunctiontype.cpp"/>
</Folder>
</Folder>
<Folder
Name="Header Files"
@ -229,6 +255,32 @@
<F N="messageqcpp/socketclosed.h"/>
<F N="messageqcpp/socketparms.h"/>
</Folder>
<Folder
Name="querystats headers"
Filters="">
<F N="querystats/querystats.h"/>
</Folder>
<Folder
Name="windowfunction headers"
Filters="">
<F N="windowfunction/framebound.h"/>
<F N="windowfunction/frameboundrange.h"/>
<F N="windowfunction/frameboundrow.h"/>
<F N="windowfunction/idborderby.h"/>
<F N="windowfunction/wf_count.h"/>
<F N="windowfunction/wf_lead_lag.h"/>
<F N="windowfunction/wf_min_max.h"/>
<F N="windowfunction/wf_nth_value.h"/>
<F N="windowfunction/wf_ntile.h"/>
<F N="windowfunction/wf_percentile.h"/>
<F N="windowfunction/wf_ranking.h"/>
<F N="windowfunction/wf_row_number.h"/>
<F N="windowfunction/wf_stats.h"/>
<F N="windowfunction/wf_sum_avg.h"/>
<F N="windowfunction/windowframe.h"/>
<F N="windowfunction/windowfunction.h"/>
<F N="windowfunction/windowfunctiontype.h"/>
</Folder>
</Folder>
<Folder
Name="Resource Files"