You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
MCOL-1786 Reduce the performance degradation caused by iequals.
This commit is contained in:
@ -31,8 +31,6 @@
|
||||
#include <ctype.h>
|
||||
#include <cfloat>
|
||||
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
|
||||
#include "we_bulkload.h"
|
||||
#include "we_bulkloadbuffer.h"
|
||||
#include "we_brm.h"
|
||||
@ -370,18 +368,11 @@ void BulkLoadBuffer::convert(char* field, int fieldLength,
|
||||
{
|
||||
errno = 0;
|
||||
|
||||
if (iequals(field, "true"))
|
||||
{
|
||||
fVal = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
fVal = (float)strtod( field, 0 );
|
||||
#else
|
||||
fVal = strtof( field, 0 );
|
||||
#endif
|
||||
}
|
||||
|
||||
if (errno == ERANGE)
|
||||
{
|
||||
@ -414,6 +405,11 @@ void BulkLoadBuffer::convert(char* field, int fieldLength,
|
||||
fVal = minFltSat;
|
||||
bufStats.satCount++;
|
||||
}
|
||||
if ( fVal == 0
|
||||
&& isTrueWord(const_cast<const char*>(field), fieldLength) )
|
||||
{
|
||||
fVal = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -474,14 +470,7 @@ void BulkLoadBuffer::convert(char* field, int fieldLength,
|
||||
{
|
||||
errno = 0;
|
||||
|
||||
if (iequals(field, "true"))
|
||||
{
|
||||
dVal = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dVal = strtod(field, 0);
|
||||
}
|
||||
|
||||
if (errno == ERANGE)
|
||||
{
|
||||
@ -514,6 +503,11 @@ void BulkLoadBuffer::convert(char* field, int fieldLength,
|
||||
dVal = column.fMinDblSat;
|
||||
bufStats.satCount++;
|
||||
}
|
||||
else if (dVal == 0
|
||||
&& isTrueWord(const_cast<const char*>(field), fieldLength))
|
||||
{
|
||||
dVal = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -629,12 +623,6 @@ void BulkLoadBuffer::convert(char* field, int fieldLength,
|
||||
}
|
||||
else
|
||||
{
|
||||
if (iequals(field, "true"))
|
||||
{
|
||||
strcpy(field, "1");
|
||||
fieldLength = 1;
|
||||
}
|
||||
|
||||
if ( (column.dataType == CalpontSystemCatalog::DECIMAL ) ||
|
||||
(column.dataType == CalpontSystemCatalog::UDECIMAL) )
|
||||
{
|
||||
@ -664,6 +652,11 @@ void BulkLoadBuffer::convert(char* field, int fieldLength,
|
||||
origVal = static_cast<int64_t>(column.fMaxIntSat);
|
||||
bSatVal = true;
|
||||
}
|
||||
else if ( origVal == 0
|
||||
&& isTrueWord(const_cast<const char*>(field), fieldLength) )
|
||||
{
|
||||
origVal = 1;
|
||||
}
|
||||
|
||||
if (bSatVal)
|
||||
bufStats.satCount++;
|
||||
@ -722,14 +715,7 @@ void BulkLoadBuffer::convert(char* field, int fieldLength,
|
||||
{
|
||||
errno = 0;
|
||||
|
||||
if (iequals(field, "true"))
|
||||
{
|
||||
origVal = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
origVal = strtoll(field, 0, 10);
|
||||
}
|
||||
|
||||
if (errno == ERANGE)
|
||||
bSatVal = true;
|
||||
@ -747,6 +733,11 @@ void BulkLoadBuffer::convert(char* field, int fieldLength,
|
||||
origVal = static_cast<int64_t>(column.fMaxIntSat);
|
||||
bSatVal = true;
|
||||
}
|
||||
else if ( origVal == 0
|
||||
&& isTrueWord(const_cast<const char*>(field), fieldLength) )
|
||||
{
|
||||
origVal = 1;
|
||||
}
|
||||
|
||||
if (bSatVal)
|
||||
bufStats.satCount++;
|
||||
@ -805,7 +796,7 @@ void BulkLoadBuffer::convert(char* field, int fieldLength,
|
||||
}
|
||||
else
|
||||
{
|
||||
if (iequals(field, "true"))
|
||||
if (isTrueWord(const_cast<const char*>(field), fieldLength))
|
||||
{
|
||||
strcpy(field, "1");
|
||||
fieldLength = 1;
|
||||
@ -898,14 +889,7 @@ void BulkLoadBuffer::convert(char* field, int fieldLength,
|
||||
{
|
||||
errno = 0;
|
||||
|
||||
if (iequals(field, "true"))
|
||||
{
|
||||
origVal = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
origVal = strtoll(field, 0, 10);
|
||||
}
|
||||
|
||||
if (errno == ERANGE)
|
||||
bSatVal = true;
|
||||
@ -923,6 +907,11 @@ void BulkLoadBuffer::convert(char* field, int fieldLength,
|
||||
origVal = static_cast<int64_t>(column.fMaxIntSat);
|
||||
bSatVal = true;
|
||||
}
|
||||
else if ( origVal == 0
|
||||
&& isTrueWord(const_cast<const char*>(field), fieldLength) )
|
||||
{
|
||||
origVal = 1;
|
||||
}
|
||||
|
||||
if (bSatVal)
|
||||
bufStats.satCount++;
|
||||
@ -981,7 +970,7 @@ void BulkLoadBuffer::convert(char* field, int fieldLength,
|
||||
}
|
||||
else
|
||||
{
|
||||
if (iequals(field, "true"))
|
||||
if (isTrueWord(const_cast<const char*>(field), fieldLength))
|
||||
{
|
||||
strcpy(field, "1");
|
||||
fieldLength = 1;
|
||||
@ -1018,6 +1007,7 @@ void BulkLoadBuffer::convert(char* field, int fieldLength,
|
||||
bSatVal = true;
|
||||
}
|
||||
|
||||
|
||||
if (bSatVal)
|
||||
bufStats.satCount++;
|
||||
|
||||
@ -1199,14 +1189,7 @@ void BulkLoadBuffer::convert(char* field, int fieldLength,
|
||||
{
|
||||
errno = 0;
|
||||
|
||||
if (iequals(field, "true"))
|
||||
{
|
||||
ullVal = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ullVal = strtoull(field, 0, 10);
|
||||
}
|
||||
|
||||
if (errno == ERANGE)
|
||||
bSatVal = true;
|
||||
@ -1220,6 +1203,11 @@ void BulkLoadBuffer::convert(char* field, int fieldLength,
|
||||
ullVal = column.fMaxIntSat;
|
||||
bSatVal = true;
|
||||
}
|
||||
else if ( ullVal == 0
|
||||
&& isTrueWord(const_cast<const char*>(field), fieldLength) )
|
||||
{
|
||||
ullVal = 1;
|
||||
}
|
||||
|
||||
if (bSatVal)
|
||||
bufStats.satCount++;
|
||||
@ -1276,14 +1264,7 @@ void BulkLoadBuffer::convert(char* field, int fieldLength,
|
||||
{
|
||||
errno = 0;
|
||||
|
||||
if (iequals(field, "true"))
|
||||
{
|
||||
origVal = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
origVal = strtoll(field, 0, 10);
|
||||
}
|
||||
|
||||
if (errno == ERANGE)
|
||||
bSatVal = true;
|
||||
@ -1301,6 +1282,11 @@ void BulkLoadBuffer::convert(char* field, int fieldLength,
|
||||
origVal = static_cast<int64_t>(column.fMaxIntSat);
|
||||
bSatVal = true;
|
||||
}
|
||||
else if ( origVal == 0
|
||||
&& isTrueWord(const_cast<const char*>(field), fieldLength) )
|
||||
{
|
||||
origVal = 1;
|
||||
}
|
||||
|
||||
if (bSatVal)
|
||||
bufStats.satCount++;
|
||||
@ -1361,7 +1347,7 @@ void BulkLoadBuffer::convert(char* field, int fieldLength,
|
||||
}
|
||||
else
|
||||
{
|
||||
if (iequals(field, "true"))
|
||||
if (isTrueWord(const_cast<const char*>(field), fieldLength))
|
||||
{
|
||||
strcpy(field, "1");
|
||||
fieldLength = 1;
|
||||
|
@ -383,5 +383,14 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
inline bool isTrueWord(const char *field, int fieldLength)
|
||||
{
|
||||
//return false;
|
||||
return fieldLength == 4 && ( field[0] == 'T' || field[0] == 't' )
|
||||
&& ( field[1] == 'R' || field[1] == 'r' )
|
||||
&& ( field[2] == 'U' || field[2] == 'u' )
|
||||
&& ( field[3] == 'E' || field[3] == 'e' );
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user