Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fully resolve potentially ambiguous symbols by removing using namespa…
…ce statements from headers which have a cascading effect. This causes potential behavior changes when switching to c++11 since symbols can be exported from std and boost while both have been imported into the global namespace.
  • Loading branch information
David Mott committed Apr 29, 2019
1 parent 1813add commit 4b9d046
Show file tree
Hide file tree
Showing 131 changed files with 596 additions and 626 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -108,3 +108,4 @@ columnstoreversion.h
.idea/
.build
/.vs
/CMakeSettings.json
11 changes: 11 additions & 0 deletions CMakeLists.txt
Expand Up @@ -24,6 +24,17 @@ ENDIF()

MESSAGE(STATUS "Running cmake version ${CMAKE_VERSION}")

OPTION(USE_CCACHE "reduce compile time with ccache." FALSE)
if(NOT USE_CCACHE)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "")
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "")
else()
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif(CCACHE_FOUND)
endif()
# Distinguish between community and non-community builds, with the
# default being a community build. This does not impact the feature
# set that will be compiled in; it's merely provided as a hint to
Expand Down
2 changes: 1 addition & 1 deletion dbcon/execplan/predicateoperator.h
Expand Up @@ -295,7 +295,7 @@ inline bool PredicateOperator::getBoolVal(rowgroup::Row& row, bool& isNull, Retu
// we won't want to just multiply by scale, as it may move
// significant digits out of scope. So we break them apart
// and compare each separately
int64_t scale = max(lop->resultType().scale, rop->resultType().scale);
int64_t scale = std::max(lop->resultType().scale, rop->resultType().scale);
if (scale)
{
long double intpart1;
Expand Down
9 changes: 3 additions & 6 deletions dbcon/execplan/treenode.h
Expand Up @@ -41,9 +41,6 @@
#include "exceptclasses.h"
#include "dataconvert.h"

// Workaround for my_global.h #define of isnan(X) causing a std::std namespace
using namespace std;

namespace messageqcpp
{
class ByteStream;
Expand Down Expand Up @@ -608,7 +605,7 @@ inline const std::string& TreeNode::getStrVal()
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) || std::isnan(base))
if (std::isnan(exponent) || std::isnan(base))
{
snprintf(tmp, 312, "%f", fResult.floatVal);
fResult.strVal = removeTrailing0(tmp, 312);
Expand Down Expand Up @@ -643,7 +640,7 @@ inline const std::string& TreeNode::getStrVal()
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) || std::isnan(base))
if (std::isnan(exponent) || std::isnan(base))
{
snprintf(tmp, 312, "%f", fResult.doubleVal);
fResult.strVal = removeTrailing0(tmp, 312);
Expand Down Expand Up @@ -677,7 +674,7 @@ inline const std::string& TreeNode::getStrVal()
int exponent = (int)floorl(log10( fabsl(fResult.longDoubleVal))); // This will round down the exponent
long double base = fResult.longDoubleVal * pow(10, -1.0 * exponent);

if (isnan(exponent) || isnan(base))
if (std::isnan(exponent) || std::isnan(base))
{
snprintf(tmp, 312, "%Lf", fResult.longDoubleVal);
fResult.strVal = removeTrailing0(tmp, 312);
Expand Down
5 changes: 2 additions & 3 deletions dbcon/execplan/udafcolumn.h
Expand Up @@ -30,7 +30,6 @@ namespace messageqcpp
class ByteStream;
}

using namespace mcsv1sdk;
/**
* Namespace
*/
Expand Down Expand Up @@ -78,7 +77,7 @@ class UDAFColumn : public AggregateColumn
/**
* Accessors and Mutators
*/
mcsv1Context& getContext()
mcsv1sdk::mcsv1Context& getContext()
{
return context;
}
Expand Down Expand Up @@ -122,7 +121,7 @@ class UDAFColumn : public AggregateColumn
virtual bool operator!=(const UDAFColumn& t) const;

private:
mcsv1Context context;
mcsv1sdk::mcsv1Context context;
};

/**
Expand Down
26 changes: 13 additions & 13 deletions dbcon/joblist/crossenginestep.cpp
Expand Up @@ -63,9 +63,9 @@ namespace joblist
{

CrossEngineStep::CrossEngineStep(
const string& schema,
const string& table,
const string& alias,
const std::string& schema,
const std::string& table,
const std::string& alias,
const JobInfo& jobInfo) :
BatchPrimitive(jobInfo),
fRowsRetrieved(0),
Expand Down Expand Up @@ -113,7 +113,7 @@ bool CrossEngineStep::deliverStringTableRowGroup() const
}


void CrossEngineStep::addFcnJoinExp(const vector<execplan::SRCP>& fe)
void CrossEngineStep::addFcnJoinExp(const std::vector<execplan::SRCP>& fe)
{
fFeFcnJoin = fe;
}
Expand All @@ -131,7 +131,7 @@ void CrossEngineStep::setFE1Input(const rowgroup::RowGroup& rg)
}


void CrossEngineStep::setFcnExpGroup3(const vector<execplan::SRCP>& fe)
void CrossEngineStep::setFcnExpGroup3(const std::vector<execplan::SRCP>& fe)
{
fFeSelects = fe;
}
Expand Down Expand Up @@ -336,7 +336,7 @@ int64_t CrossEngineStep::convertValueNum(
case CalpontSystemCatalog::TEXT:
case CalpontSystemCatalog::CLOB:
{
string i = boost::any_cast<string>(anyVal);
std::string i = boost::any_cast<std::string>(anyVal);
// bug 1932, pad nulls up to the size of v
i.resize(sizeof(rv), 0);
rv = *((uint64_t*) i.data());
Expand Down Expand Up @@ -435,7 +435,7 @@ void CrossEngineStep::execute()
if (ret != 0)
mysql->handleMySqlError(mysql->getError().c_str(), ret);

string query(makeQuery());
std::string query(makeQuery());
fLogger->logMessage(logging::LOG_TYPE_INFO, "QUERY to foreign engine: " + query);

if (traceOn())
Expand Down Expand Up @@ -651,7 +651,7 @@ void CrossEngineStep::setBPP(JobStep* jobStep)
pDictionaryStep* pds = NULL;
pDictionaryScan* pdss = NULL;
FilterStep* fs = NULL;
string bop = " AND ";
std::string bop = " AND ";

if (pcs != 0)
{
Expand Down Expand Up @@ -690,12 +690,12 @@ void CrossEngineStep::setBPP(JobStep* jobStep)
}
}

void CrossEngineStep::addFilterStr(const vector<const Filter*>& f, const string& bop)
void CrossEngineStep::addFilterStr(const std::vector<const Filter*>& f, const std::string& bop)
{
if (f.size() == 0)
return;

string filterStr;
std::string filterStr;

for (uint64_t i = 0; i < f.size(); i++)
{
Expand Down Expand Up @@ -731,7 +731,7 @@ void CrossEngineStep::setProjectBPP(JobStep* jobStep1, JobStep*)
}


string CrossEngineStep::makeQuery()
std::string CrossEngineStep::makeQuery()
{
ostringstream oss;
oss << fSelectClause << " FROM " << fTable;
Expand All @@ -742,7 +742,7 @@ string CrossEngineStep::makeQuery()
if (!fWhereClause.empty())
oss << fWhereClause;

// the string must consist of a single SQL statement without a terminating semicolon ; or \g.
// the std::string must consist of a single SQL statement without a terminating semicolon ; or \g.
// oss << ";";
return oss.str();
}
Expand Down Expand Up @@ -832,7 +832,7 @@ uint32_t CrossEngineStep::nextBand(messageqcpp::ByteStream& bs)
}


const string CrossEngineStep::toString() const
const std::string CrossEngineStep::toString() const
{
ostringstream oss;
oss << "CrossEngineStep ses:" << fSessionId << " txn:" << fTxnId << " st:" << fStepId;
Expand Down
18 changes: 8 additions & 10 deletions dbcon/joblist/crossenginestep.h
Expand Up @@ -30,8 +30,6 @@
#include "primitivestep.h"
#include "threadnaming.h"

using namespace std;

// forward reference
namespace utils
{
Expand Down Expand Up @@ -60,9 +58,9 @@ class CrossEngineStep : public BatchPrimitive, public TupleDeliveryStep
/** @brief CrossEngineStep constructor
*/
CrossEngineStep(
const string& schema,
const string& table,
const string& alias,
const std::string& schema,
const std::string& table,
const std::string& alias,
const JobInfo& jobInfo);

/** @brief CrossEngineStep destructor
Expand Down Expand Up @@ -124,15 +122,15 @@ class CrossEngineStep : public BatchPrimitive, public TupleDeliveryStep
{
return fRowsReturned;
}
const string& schemaName() const
const std::string& schemaName() const
{
return fSchema;
}
const string& tableName() const
const std::string& tableName() const
{
return fTable;
}
const string& tableAlias() const
const std::string& tableAlias() const
{
return fAlias;
}
Expand All @@ -149,10 +147,10 @@ class CrossEngineStep : public BatchPrimitive, public TupleDeliveryStep
bool deliverStringTableRowGroup() const;
uint32_t nextBand(messageqcpp::ByteStream& bs);

void addFcnJoinExp(const vector<execplan::SRCP>&);
void addFcnJoinExp(const std::vector<execplan::SRCP>&);
void addFcnExpGroup1(const boost::shared_ptr<execplan::ParseTree>&);
void setFE1Input(const rowgroup::RowGroup&);
void setFcnExpGroup3(const vector<execplan::SRCP>&);
void setFcnExpGroup3(const std::vector<execplan::SRCP>&);
void setFE23Output(const rowgroup::RowGroup&);

void addFilter(JobStep* jobStep);
Expand Down
2 changes: 1 addition & 1 deletion dbcon/joblist/jlf_execplantojoblist.cpp
Expand Up @@ -3373,7 +3373,7 @@ namespace joblist
// conversion performed by the functions in this file.
// @bug6131, pre-order traversing
/* static */ void
JLF_ExecPlanToJobList::walkTree(ParseTree* n, JobInfo& jobInfo)
JLF_ExecPlanToJobList::walkTree(execplan::ParseTree* n, JobInfo& jobInfo)
{
TreeNode* tn = n->data();
JobStepVector jsv;
Expand Down
4 changes: 2 additions & 2 deletions dbcon/joblist/jlf_execplantojoblist.h
Expand Up @@ -30,7 +30,7 @@
#include "calpontexecutionplan.h"
#include "calpontselectexecutionplan.h"
#include "calpontsystemcatalog.h"
using namespace execplan;


#include "jlf_common.h"

Expand All @@ -50,7 +50,7 @@ class JLF_ExecPlanToJobList
* @param ParseTree (in) is CEP to be translated to a joblist
* @param JobInfo& (in/out) is the JobInfo reference that is loaded
*/
static void walkTree(ParseTree* n, JobInfo& jobInfo);
static void walkTree(execplan::ParseTree* n, JobInfo& jobInfo);

/** @brief This function add new job steps to the job step vector in JobInfo
*
Expand Down
3 changes: 2 additions & 1 deletion dbcon/joblist/joblistfactory.cpp
Expand Up @@ -88,6 +88,7 @@ using namespace logging;
#include "rowgroup.h"
using namespace rowgroup;

#include "mcsv1_udaf.h"

namespace
{
Expand Down Expand Up @@ -709,7 +710,7 @@ void updateAggregateColType(AggregateColumn* ac, const SRCP& srcp, int op, JobIn

if (udafc)
{
mcsv1Context& udafContext = udafc->getContext();
mcsv1sdk::mcsv1Context& udafContext = udafc->getContext();
ct.colDataType = udafContext.getResultType();
ct.colWidth = udafContext.getColWidth();
ct.scale = udafContext.getScale();
Expand Down
2 changes: 1 addition & 1 deletion dbcon/joblist/jobstep.cpp
Expand Up @@ -57,7 +57,7 @@ namespace joblist
{
boost::mutex JobStep::fLogMutex; //=PTHREAD_MUTEX_INITIALIZER;

ThreadPool JobStep::jobstepThreadPool(defaultJLThreadPoolSize, 0);
threadpool::ThreadPool JobStep::jobstepThreadPool(defaultJLThreadPoolSize, 0);

ostream& operator<<(ostream& os, const JobStep* rhs)
{
Expand Down
4 changes: 1 addition & 3 deletions dbcon/joblist/jobstep.h
Expand Up @@ -53,8 +53,6 @@
# endif
#endif

using namespace threadpool;

namespace joblist
{

Expand Down Expand Up @@ -423,7 +421,7 @@ class JobStep
fOnClauseFilter = b;
}

static ThreadPool jobstepThreadPool;
static threadpool::ThreadPool jobstepThreadPool;
protected:

//@bug6088, for telemetry posting
Expand Down
11 changes: 6 additions & 5 deletions dbcon/mysql/ha_calpont_execplan.cpp
Expand Up @@ -44,6 +44,7 @@
#include <limits>

#include <string.h>
#include "mcsv1_udaf.h"

using namespace std;

Expand Down Expand Up @@ -4610,7 +4611,7 @@ ReturnedColumn* buildAggregateColumn(Item* item, gp_walk_info& gwi)

if (udafc)
{
mcsv1Context& context = udafc->getContext();
mcsv1sdk::mcsv1Context& context = udafc->getContext();
context.setName(isp->func_name());

// Set up the return type defaults for the call to init()
Expand All @@ -4620,8 +4621,8 @@ ReturnedColumn* buildAggregateColumn(Item* item, gp_walk_info& gwi)
context.setPrecision(udafc->resultType().precision);

context.setParamCount(udafc->aggParms().size());
ColumnDatum colType;
ColumnDatum colTypes[udafc->aggParms().size()];
mcsv1sdk::ColumnDatum colType;
mcsv1sdk::ColumnDatum colTypes[udafc->aggParms().size()];

// Build the column type vector.
// Modified for MCOL-1201 multi-argument aggregate
Expand Down Expand Up @@ -4649,7 +4650,7 @@ ReturnedColumn* buildAggregateColumn(Item* item, gp_walk_info& gwi)
return NULL;
}

if (udaf->init(&context, colTypes) == mcsv1_UDAF::ERROR)
if (udaf->init(&context, colTypes) == mcsv1sdk::mcsv1_UDAF::ERROR)
{
gwi.fatalParseError = true;
gwi.parseErrorText = udafc->getContext().getErrorMessage();
Expand All @@ -4662,7 +4663,7 @@ ReturnedColumn* buildAggregateColumn(Item* item, gp_walk_info& gwi)

// UDAF_OVER_REQUIRED means that this function is for Window
// Function only. Reject it here in aggregate land.
if (udafc->getContext().getRunFlag(UDAF_OVER_REQUIRED))
if (udafc->getContext().getRunFlag(mcsv1sdk::UDAF_OVER_REQUIRED))
{
gwi.fatalParseError = true;
gwi.parseErrorText =
Expand Down
2 changes: 1 addition & 1 deletion dbcon/mysql/ha_calpont_impl.cpp
Expand Up @@ -3295,7 +3295,7 @@ void ha_calpont_impl_start_bulk_insert(ha_rows rows, TABLE* table)

if (get_local_query(thd))
{
OamCache* oamcache = OamCache::makeOamCache();
const auto oamcache = oam::OamCache::makeOamCache();
int localModuleId = oamcache->getLocalPMId();

if (localModuleId == 0)
Expand Down

0 comments on commit 4b9d046

Please sign in to comment.